![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
A material class for rendering Simplex Noise. More...
#include <SimplexNoise.h>
Public Member Functions | |
SimplexNoise (int seed, GradientMaterial< colors > *gradientMaterial) | |
Constructs a SimplexNoise instance. | |
float | Noise (float xin, float yin) |
Generates 2D Simplex Noise. | |
float | Noise (float xin, float yin, float zin) |
Generates 3D Simplex Noise. | |
void | SetScale (Vector3D noiseScale) |
Sets the scale for noise generation. | |
void | SetZPosition (float zPosition) |
Sets the Z-position for 3D noise generation. | |
RGBColor | GetRGB (const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override |
Retrieves the color for a given position based on the noise value. | |
![]() | |
virtual | ~Material ()=default |
Virtual destructor for proper cleanup in derived classes. | |
Private Member Functions | |
void | InitializePermutation (int seed) |
Initializes the permutation tables based on the seed. | |
Private Attributes | |
GradientMaterial< colors > * | gradientMaterial |
GradientMaterial used to map noise values to colors. | |
Vector3D | noiseScale = Vector3D(1, 1, 1) |
Scaling factor for the noise generation. | |
const float | F2 = 0.5f * (sqrtf(3.0f) - 1.0f) |
Simplex Noise constants for 2D. | |
const float | G2 = (3.0f - sqrtf(3.0f)) / 6.0f |
Simplex Noise constants for 2D. | |
const float | F3 = 1.0f / 3.0f |
Simplex Noise constants for 3D. | |
const float | G3 = 1.0f / 6.0f |
Simplex Noise constants for 3D. | |
float | zPosition = 0.0f |
Z-position for 3D noise. | |
Vector3D | grad3 [12] |
uint8_t | p_supply [256] |
uint8_t | p [256] |
uint8_t | perm [512] |
Permutation table for noise generation. | |
uint8_t | permMod12 [512] |
Permutation table modulo 12 for gradient selection. | |
Additional Inherited Members | |
![]() | |
enum | Method { Base , Add , Subtract , Multiply , Divide , Darken , Lighten , Screen , Overlay , SoftLight , Replace , EfficientMask , Bypass } |
Defines blending methods for combining colors. More... | |
A material class for rendering Simplex Noise.
This template-based class generates noise values using the Simplex Noise algorithm and maps the values to colors using a GradientMaterial
.
colors | The number of colors in the gradient material. |
Definition at line 30 of file SimplexNoise.h.
SimplexNoise | ( | int | seed, |
GradientMaterial< colors > * | gradientMaterial | ||
) |
Constructs a SimplexNoise instance.
seed | The seed for noise generation. |
gradientMaterial | Pointer to a GradientMaterial for mapping noise to colors. |
|
overridevirtual |
Retrieves the color for a given position based on the noise value.
position | 3D position in the scene. |
normal | Normal vector at the position (not used for this material). |
uvw | Texture coordinates at the position (not used for this material). |
Implements Material.
Referenced by FlowNoise::GetRGB(), RainbowNoise::GetRGB(), and RainbowNoise2::GetRGB().
Initializes the permutation tables based on the seed.
seed | The seed for randomizing the permutation tables. |
Generates 2D Simplex Noise.
xin | X-coordinate. |
yin | Y-coordinate. |
Generates 3D Simplex Noise.
xin | X-coordinate. |
yin | Y-coordinate. |
zin | Z-coordinate. |
Sets the scale for noise generation.
noiseScale | A Vector3D representing the scaling factors for X, Y, and Z. |
Referenced by FlowNoise::Update(), RainbowNoise::Update(), RainbowNoise2::Update(), TVStatic::Update(), ProtogenArtleckAnimation::Update(), WaffleDaProtoAnimation::Update(), and NukudeFaceAnimation::Update().
Sets the Z-position for 3D noise generation.
zPosition | The Z-coordinate for noise generation. |
Referenced by FlowNoise::Update(), RainbowNoise::Update(), RainbowNoise2::Update(), TVStatic::Update(), ProtogenArtleckAnimation::Update(), WaffleDaProtoAnimation::Update(), and NukudeFaceAnimation::Update().
Simplex Noise constants for 2D.
Definition at line 35 of file SimplexNoise.h.
Simplex Noise constants for 3D.
Definition at line 37 of file SimplexNoise.h.
Simplex Noise constants for 2D.
Definition at line 36 of file SimplexNoise.h.
Simplex Noise constants for 3D.
Definition at line 38 of file SimplexNoise.h.
Definition at line 42 of file SimplexNoise.h.
|
private |
GradientMaterial used to map noise values to colors.
Definition at line 32 of file SimplexNoise.h.
Scaling factor for the noise generation.
Definition at line 34 of file SimplexNoise.h.
Definition at line 61 of file SimplexNoise.h.
Definition at line 47 of file SimplexNoise.h.
Permutation table for noise generation.
Definition at line 76 of file SimplexNoise.h.
Permutation table modulo 12 for gradient selection.
Definition at line 77 of file SimplexNoise.h.
Z-position for 3D noise.
Definition at line 39 of file SimplexNoise.h.