Struct cgl_rs::noise::NoiseParams
source · #[repr(C)]pub struct NoiseParams {
pub type_id: i32,
pub fractal_type: i32,
pub octaves: i32,
pub frequency: NoiseDataType,
pub lacunarity: NoiseDataType,
pub gain: NoiseDataType,
pub weighted_strength: NoiseDataType,
pub ping_pong_strength: NoiseDataType,
}
Fields§
§type_id: i32
§fractal_type: i32
§octaves: i32
§frequency: NoiseDataType
§lacunarity: NoiseDataType
§gain: NoiseDataType
§weighted_strength: NoiseDataType
§ping_pong_strength: NoiseDataType
Implementations§
source§impl NoiseParams
impl NoiseParams
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new NoiseParams
instance with default values.
Example
cgl_rs::noise::init();
let params = cgl_rs::noise::NoiseParams::new();
cgl_rs::noise::shutdown();
sourcepub fn set_type(&mut self, noise_type: NoiseType)
pub fn set_type(&mut self, noise_type: NoiseType)
Sets the type of noise to generate.
Example
cgl_rs::noise::init();
let mut params = cgl_rs::noise::NoiseParams::new();
params.set_type(cgl_rs::noise::NoiseType::Perlin);
cgl_rs::noise::shutdown();
sourcepub fn set_fractal_type(&mut self, fractal_type: FractalType)
pub fn set_fractal_type(&mut self, fractal_type: FractalType)
Sets the type of fractal to use when generating noise.
Example
cgl_rs::noise::init();
let mut params = cgl_rs::noise::NoiseParams::new();
params.set_fractal_type(cgl_rs::noise::FractalType::FBM);
cgl_rs::noise::shutdown();
sourcepub fn set_octaves(&mut self, octaves: i32)
pub fn set_octaves(&mut self, octaves: i32)
Sets the number of octaves to use when generating noise.
Example
cgl_rs::noise::init();
let mut params = cgl_rs::noise::NoiseParams::new();
params.set_octaves(4);
cgl_rs::noise::shutdown();
sourcepub fn set_frequency(&mut self, frequency: NoiseDataType)
pub fn set_frequency(&mut self, frequency: NoiseDataType)
Sets the frequency of the noise.
Example
cgl_rs::noise::init();
let mut params = cgl_rs::noise::NoiseParams::new();
params.set_frequency(0.01);
cgl_rs::noise::shutdown();
sourcepub fn set_lacunarity(&mut self, lacunarity: NoiseDataType)
pub fn set_lacunarity(&mut self, lacunarity: NoiseDataType)
Sets the lacunarity of the noise.
Example
cgl_rs::noise::init();
let mut params = cgl_rs::noise::NoiseParams::new();
params.set_lacunarity(2.0);
cgl_rs::noise::shutdown();
sourcepub fn set_gain(&mut self, gain: NoiseDataType)
pub fn set_gain(&mut self, gain: NoiseDataType)
Sets the gain of the noise.
Example
cgl_rs::noise::init();
let mut params = cgl_rs::noise::NoiseParams::new();
params.set_gain(0.5);
cgl_rs::noise::shutdown();
sourcepub fn set_weighted_strength(&mut self, weighted_strength: NoiseDataType)
pub fn set_weighted_strength(&mut self, weighted_strength: NoiseDataType)
Sets the weighted strength of the noise.
Example
cgl_rs::noise::init();
let mut params = cgl_rs::noise::NoiseParams::new();
params.set_weighted_strength(0.5);
cgl_rs::noise::shutdown();
sourcepub fn set_ping_pong_strength(&mut self, ping_pong_strength: NoiseDataType)
pub fn set_ping_pong_strength(&mut self, ping_pong_strength: NoiseDataType)
Sets the ping pong strength of the noise.
Example
cgl_rs::noise::init();
let mut params = cgl_rs::noise::NoiseParams::new();
params.set_ping_pong_strength(0.5);
cgl_rs::noise::shutdown();
sourcepub fn get_type(&self) -> NoiseType
pub fn get_type(&self) -> NoiseType
Gets the type of noise being generated.
Example
cgl_rs::noise::init();
let params = cgl_rs::noise::NoiseParams::new();
let noise_type = params.get_type();
cgl_rs::noise::shutdown();
sourcepub fn get_fractal_type(&self) -> FractalType
pub fn get_fractal_type(&self) -> FractalType
Gets the type of fractal being used to generate noise.
Example
cgl_rs::noise::init();
let params = cgl_rs::noise::NoiseParams::new();
let fractal_type = params.get_fractal_type();
cgl_rs::noise::shutdown();
sourcepub fn get_octaves(&self) -> i32
pub fn get_octaves(&self) -> i32
Gets the number of octaves being used to generate noise.
Example
cgl_rs::noise::init();
let params = cgl_rs::noise::NoiseParams::new();
let octaves = params.get_octaves();
cgl_rs::noise::shutdown();
sourcepub fn get_frequency(&self) -> NoiseDataType
pub fn get_frequency(&self) -> NoiseDataType
Gets the frequency of the noise.
Example
cgl_rs::noise::init();
let params = cgl_rs::noise::NoiseParams::new();
let frequency = params.get_frequency();
cgl_rs::noise::shutdown();
sourcepub fn get_lacunarity(&self) -> NoiseDataType
pub fn get_lacunarity(&self) -> NoiseDataType
Gets the lacunarity of the noise.
Example
cgl_rs::noise::init();
let params = cgl_rs::noise::NoiseParams::new();
let lacunarity = params.get_lacunarity();
cgl_rs::noise::shutdown();
sourcepub fn get_gain(&self) -> NoiseDataType
pub fn get_gain(&self) -> NoiseDataType
Gets the gain of the noise.
Example
cgl_rs::noise::init();
let params = cgl_rs::noise::NoiseParams::new();
let gain = params.get_gain();
cgl_rs::noise::shutdown();
sourcepub fn get_weighted_strength(&self) -> NoiseDataType
pub fn get_weighted_strength(&self) -> NoiseDataType
Gets the weighted strength of the noise.
Example
cgl_rs::noise::init();
let params = cgl_rs::noise::NoiseParams::new();
let weighted_strength = params.get_weighted_strength();
cgl_rs::noise::shutdown();
sourcepub fn get_ping_pong_strength(&self) -> NoiseDataType
pub fn get_ping_pong_strength(&self) -> NoiseDataType
Gets the ping pong strength of the noise.
Example
cgl_rs::noise::init();
let params = cgl_rs::noise::NoiseParams::new();
let ping_pong_strength = params.get_ping_pong_strength();
cgl_rs::noise::shutdown();
sourcepub fn get_noise(
&self,
x: NoiseDataType,
y: NoiseDataType,
z: NoiseDataType
) -> NoiseDataType
pub fn get_noise( &self, x: NoiseDataType, y: NoiseDataType, z: NoiseDataType ) -> NoiseDataType
Trait Implementations§
source§impl Clone for NoiseParams
impl Clone for NoiseParams
source§fn clone(&self) -> NoiseParams
fn clone(&self) -> NoiseParams
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for NoiseParams
impl Debug for NoiseParams
impl Copy for NoiseParams
Auto Trait Implementations§
impl RefUnwindSafe for NoiseParams
impl Send for NoiseParams
impl Sync for NoiseParams
impl Unpin for NoiseParams
impl UnwindSafe for NoiseParams
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more