objc2_gameplay_kit/generated/
GKNoise.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13extern_class!(
14    /// GKNoise is the object used to manipulate and combine noise in continuous 3D space.  It takes a GKNoiseSource as input.
15    /// To extract and use a portion of the noise within the 3D space use the GKNoiseMap class.
16    ///
17    ///
18    /// See: GKNoiseSource
19    ///
20    /// See: GKNoiseMap
21    ///
22    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gknoise?language=objc)
23    #[unsafe(super(NSObject))]
24    #[derive(Debug, PartialEq, Eq, Hash)]
25    pub struct GKNoise;
26);
27
28extern_conformance!(
29    unsafe impl NSObjectProtocol for GKNoise {}
30);
31
32impl GKNoise {
33    extern_methods!(
34        #[cfg(feature = "objc2-app-kit")]
35        #[cfg(target_os = "macos")]
36        /// Color gradient of this noise, represented as 'value : color' pairs.  Utilized when this noise is rendered to a texture.
37        #[unsafe(method(gradientColors))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn gradientColors(&self) -> Retained<NSDictionary<NSNumber, NSColor>>;
40
41        #[cfg(feature = "objc2-app-kit")]
42        #[cfg(target_os = "macos")]
43        /// Setter for [`gradientColors`][Self::gradientColors].
44        ///
45        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
46        #[unsafe(method(setGradientColors:))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn setGradientColors(&self, gradient_colors: &NSDictionary<NSNumber, NSColor>);
49
50        /// Initializes a constant noise of 0.0 at all positions.
51        #[unsafe(method(init))]
52        #[unsafe(method_family = init)]
53        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
54
55        #[cfg(feature = "GKNoiseSource")]
56        /// Initializes a noise with the specified noise source.
57        ///
58        ///
59        /// Parameter `noiseSource`: The noise source to use to initially populate the 3D noise space.
60        #[unsafe(method(noiseWithNoiseSource:))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn noiseWithNoiseSource(noise_source: &GKNoiseSource) -> Retained<Self>;
63
64        #[cfg(all(feature = "GKNoiseSource", feature = "objc2-app-kit"))]
65        #[cfg(target_os = "macos")]
66        /// Initializes a noise with the specified noise source and parameters.
67        ///
68        ///
69        /// Parameter `noiseSource`: The noise source to use to initially populate the 3D noise space.
70        ///
71        /// Parameter `gradientColors`: The color gradient to use for this noise in 'value : color' pairs.
72        #[unsafe(method(noiseWithNoiseSource:gradientColors:))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn noiseWithNoiseSource_gradientColors(
75            noise_source: &GKNoiseSource,
76            gradient_colors: &NSDictionary<NSNumber, NSColor>,
77        ) -> Retained<Self>;
78
79        #[cfg(feature = "GKNoiseSource")]
80        /// Initializes a noise with the specified noise source.
81        ///
82        ///
83        /// Parameter `noiseSource`: The noise source to use to initially populate the 3D noise space.
84        #[unsafe(method(initWithNoiseSource:))]
85        #[unsafe(method_family = init)]
86        pub unsafe fn initWithNoiseSource(
87            this: Allocated<Self>,
88            noise_source: &GKNoiseSource,
89        ) -> Retained<Self>;
90
91        #[cfg(all(feature = "GKNoiseSource", feature = "objc2-app-kit"))]
92        #[cfg(target_os = "macos")]
93        /// Initializes a noise with the specified noise source and parameters.
94        ///
95        ///
96        /// Parameter `noiseSource`: The noise source to use to initially populate the 3D noise space.
97        ///
98        /// Parameter `gradientColors`: The color gradient to use for this noise in 'value : color' pairs.
99        #[unsafe(method(initWithNoiseSource:gradientColors:))]
100        #[unsafe(method_family = init)]
101        pub unsafe fn initWithNoiseSource_gradientColors(
102            this: Allocated<Self>,
103            noise_source: &GKNoiseSource,
104            gradient_colors: &NSDictionary<NSNumber, NSColor>,
105        ) -> Retained<Self>;
106
107        /// Initializes a composite noise from one or more component noises.  Useful for combining and layering noises together.
108        ///
109        ///
110        /// Parameter `noises`: The component noises to combine.
111        ///
112        /// Parameter `selectionNoise`: The noise that governs which component noise is chosen for each position of the resulting noise.
113        /// The range of values is equally-subdivided for each component noise.
114        #[unsafe(method(noiseWithComponentNoises:selectionNoise:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn noiseWithComponentNoises_selectionNoise(
117            noises: &NSArray<GKNoise>,
118            selection_noise: &GKNoise,
119        ) -> Retained<Self>;
120
121        /// Initializes a composite noise from one or more component noises.  Useful for combining and layering noises together.
122        ///
123        ///
124        /// Parameter `noises`: The component noises to combine.
125        ///
126        /// Parameter `selectionNoise`: The noise that governs which component noise is chosen for each position of the resulting noise.
127        /// The range of values is equally-subdivided for each component noise.
128        ///
129        /// Parameter `componentBoundaries`: The noise value boundaries of the selection noise to use for the component noises.  Specify
130        /// one less boundary than the number of component noises.  This is a parallel array to blendDistances.
131        ///
132        /// Parameter `blendDistances`: The size of smoothing that is applied to boundaries where two component noises meet.  Specify
133        /// one less blend distance than the number of component noises.  This is a parallel array to componentBoundaries.
134        #[unsafe(method(noiseWithComponentNoises:selectionNoise:componentBoundaries:boundaryBlendDistances:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn noiseWithComponentNoises_selectionNoise_componentBoundaries_boundaryBlendDistances(
137            noises: &NSArray<GKNoise>,
138            selection_noise: &GKNoise,
139            component_boundaries: &NSArray<NSNumber>,
140            blend_distances: &NSArray<NSNumber>,
141        ) -> Retained<Self>;
142
143        /// Takes the absoltue value of all noise positions.
144        #[unsafe(method(applyAbsoluteValue))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn applyAbsoluteValue(&self);
147
148        /// Clamps all noise values to the specified bounds.
149        ///
150        ///
151        /// Parameter `lowerBound`: The noise value lower bound.
152        ///
153        /// Parameter `upperBound`: The noise value upper bound.
154        #[unsafe(method(clampWithLowerBound:upperBound:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn clampWithLowerBound_upperBound(
157            &self,
158            lower_bound: c_double,
159            upper_bound: c_double,
160        );
161
162        /// Raises all noise values to the specified power.
163        ///
164        ///
165        /// Parameter `power`: The power to which to raise all noise values.
166        #[unsafe(method(raiseToPower:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn raiseToPower(&self, power: c_double);
169
170        /// Inverts all noise values, from positive to negative and vice versa.
171        #[unsafe(method(invert))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn invert(&self);
174
175        /// Applies a turbulent displacement to all noise values.
176        #[unsafe(method(applyTurbulenceWithFrequency:power:roughness:seed:))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn applyTurbulenceWithFrequency_power_roughness_seed(
179            &self,
180            frequency: c_double,
181            power: c_double,
182            roughness: c_int,
183            seed: i32,
184        );
185
186        /// Remaps all noise values to a smooth curve that passes through the specified control points.
187        ///
188        ///
189        /// Parameter `controlPoints`: Pairs of 'input : output' values to use as control points for the smooth remapping curve.
190        /// Duplicate input values are not permitted.
191        #[unsafe(method(remapValuesToCurveWithControlPoints:))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn remapValuesToCurveWithControlPoints(
194            &self,
195            control_points: &NSDictionary<NSNumber, NSNumber>,
196        );
197
198        /// Remaps all noise values to one or more terraces with peaks.  Useful for creating valleys and trenches.
199        ///
200        ///
201        /// Parameter `peakInputValues`: Inputs positions of terrace peaks.
202        ///
203        /// Parameter `inverted`: Governs the curve direction from peak to peak.
204        #[unsafe(method(remapValuesToTerracesWithPeaks:terracesInverted:))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn remapValuesToTerracesWithPeaks_terracesInverted(
207            &self,
208            peak_input_values: &NSArray<NSNumber>,
209            inverted: bool,
210        );
211
212        /// Adds all noise values by the noise values at the same position in specified noise.
213        ///
214        ///
215        /// Parameter `noise`: The noise from which to add values to this noise.
216        #[unsafe(method(addWithNoise:))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn addWithNoise(&self, noise: &GKNoise);
219
220        /// Multiplies all noise values by the noise values at the same position in specified noise.
221        ///
222        ///
223        /// Parameter `noise`: The noise from which to multiply values to this noise.
224        #[unsafe(method(multiplyWithNoise:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn multiplyWithNoise(&self, noise: &GKNoise);
227
228        /// Takes the minimum value between this noise and the specified noise at each position.
229        ///
230        ///
231        /// Parameter `noise`: The noise to compare against this noise at each position in determining which to take the minimum value from.
232        #[unsafe(method(minimumWithNoise:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn minimumWithNoise(&self, noise: &GKNoise);
235
236        /// Takes the maximum value between this noise and the specified noise at each position.
237        ///
238        ///
239        /// Parameter `noise`: The noise to compare against this noise at each position in determining which to take the maximum value from.
240        #[unsafe(method(maximumWithNoise:))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn maximumWithNoise(&self, noise: &GKNoise);
243
244        /// Raises all noise values to the power of the value at the same position of the specified noise.
245        ///
246        ///
247        /// Parameter `noise`: The noise from which to raise this noise's values by.
248        #[unsafe(method(raiseToPowerWithNoise:))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn raiseToPowerWithNoise(&self, noise: &GKNoise);
251
252        /// Displaces all noise values by the values at the same positions of the specified noises.
253        ///
254        ///
255        /// Parameter `xDisplacementNoise`: The noise from which to displace along the x-axis this noise's values at the same positions.
256        ///
257        /// Parameter `yDisplacementNoise`: The noise from which to displace along the y-axis this noise's values at the same positions.
258        ///
259        /// Parameter `zDisplacementNoise`: The noise from which to displace along the z-axis this noise's values at the same positions.
260        #[unsafe(method(displaceXWithNoise:yWithNoise:zWithNoise:))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn displaceXWithNoise_yWithNoise_zWithNoise(
263            &self,
264            x_displacement_noise: &GKNoise,
265            y_displacement_noise: &GKNoise,
266            z_displacement_noise: &GKNoise,
267        );
268    );
269}
270
271/// Methods declared on superclass `NSObject`.
272impl GKNoise {
273    extern_methods!(
274        #[unsafe(method(new))]
275        #[unsafe(method_family = new)]
276        pub unsafe fn new() -> Retained<Self>;
277    );
278}