Struct SafeNode

Source
pub struct SafeNode(/* private fields */);
Expand description

Unlike Node, this structure is safe to use because it is built from typed nodes that implement the Generator trait, or built by an encoded node tree produced by NoiseTool.

You can see how to use it in the generator module.

Implementations§

Source§

impl SafeNode

Source

pub fn from_encoded_node_tree( encoded_node_tree: &str, ) -> Result<Self, FastNoiseError>

Creates a SafeNode instance from an encoded node tree.

§Errors

Returns an error if the encoded node tree is invalid or if creation fails.

Source

pub fn get_simd_level(&self) -> u32

Source

pub fn gen_uniform_grid_2d( &self, noise_out: &mut [f32], x_start: i32, y_start: i32, x_size: i32, y_size: i32, frequency: f32, seed: i32, ) -> OutputMinMax

§Panics

Panics if noise_out.len() < x_size * y_size.

Source

pub fn gen_uniform_grid_3d( &self, noise_out: &mut [f32], x_start: i32, y_start: i32, z_start: i32, x_size: i32, y_size: i32, z_size: i32, frequency: f32, seed: i32, ) -> OutputMinMax

§Panics

Panics if noise_out.len() < x_size * y_size * z_size.

Source

pub fn gen_uniform_grid_4d( &self, noise_out: &mut [f32], x_start: i32, y_start: i32, z_start: i32, w_start: i32, x_size: i32, y_size: i32, z_size: i32, w_size: i32, frequency: f32, seed: i32, ) -> OutputMinMax

§Panics

Panics if noise_out.len() < x_size * y_size * z_size * w_size.

Source

pub fn gen_position_array_2d( &self, noise_out: &mut [f32], x_pos_array: &[f32], y_pos_array: &[f32], x_offset: f32, y_offset: f32, seed: i32, ) -> OutputMinMax

§Panics

Panics if noise_out, x_pos_array, and y_pos_array do not have the same length.

Source

pub fn gen_position_array_3d( &self, noise_out: &mut [f32], x_pos_array: &[f32], y_pos_array: &[f32], z_pos_array: &[f32], x_offset: f32, y_offset: f32, z_offset: f32, seed: i32, ) -> OutputMinMax

§Panics

Panics if noise_out, x_pos_array, y_pos_array, and z_pos_array do not have the same length.

Source

pub fn gen_position_array_4d( &self, noise_out: &mut [f32], x_pos_array: &[f32], y_pos_array: &[f32], z_pos_array: &[f32], w_pos_array: &[f32], x_offset: f32, y_offset: f32, z_offset: f32, w_offset: f32, seed: i32, ) -> OutputMinMax

§Panics

Panics if noise_out, x_pos_array, y_pos_array, z_pos_array and w_pos_array do not have the same length.

Source

pub fn gen_tileable_2d( &self, noise_out: &mut [f32], x_size: i32, y_size: i32, frequency: f32, seed: i32, ) -> OutputMinMax

§Panics

Panics if noise_out.len() < x_size * y_size.

Source

pub fn gen_single_2d(&self, x: f32, y: f32, seed: i32) -> f32

Source

pub fn gen_single_3d(&self, x: f32, y: f32, z: f32, seed: i32) -> f32

Source

pub fn gen_single_4d(&self, x: f32, y: f32, z: f32, w: f32, seed: i32) -> f32

Trait Implementations§

Source§

impl Clone for SafeNode

Source§

fn clone(&self) -> SafeNode

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SafeNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Generator for SafeNode

Source§

impl Send for SafeNode

Source§

impl Sync for SafeNode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Hybrid for T
where T: Generator,