ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
RainbowNoise2 Class Reference

A dynamic material that creates a rainbow effect using simplex noise with black-to-color transitions. More...

#include <RainbowNoise2.h>

Inheritance diagram for RainbowNoise2:
Collaboration diagram for RainbowNoise2:

Public Member Functions

 RainbowNoise2 ()
 Default constructor for RainbowNoise2.
 
void Update (float ratio)
 Updates the material animation based on the time ratio.
 
MaterialGetMaterial ()
 Retrieves the associated material.
 
RGBColor GetRGB (const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
 Computes the color at a given position in the material.
 
- Public Member Functions inherited from Material
virtual ~Material ()=default
 Virtual destructor for proper cleanup in derived classes.
 

Private Attributes

FunctionGenerator fGenMatGradient = FunctionGenerator(FunctionGenerator::Sine, 0.0f, 0.5f, 6.65f)
 Function to animate gradient properties.
 
RGBColor noiseSpectrum [4] = {RGBColor(0, 0, 0), RGBColor(255, 0, 0), RGBColor(0, 255, 0), RGBColor(0, 0, 255)}
 Spectrum for the gradient, starting with black.
 
GradientMaterial< 4 > gNoiseMat = GradientMaterial<4>(noiseSpectrum, 2.0f, false)
 Gradient material for simplex noise.
 
SimplexNoise< 4 > sNoise = SimplexNoise<4>(1, &gNoiseMat)
 Simplex noise generator.
 
float simplexNoiseDepth = 0.0f
 Depth parameter for simplex noise.
 

Additional Inherited Members

- Public Types inherited from Material
enum  Method {
  Base , Add , Subtract , Multiply ,
  Divide , Darken , Lighten , Screen ,
  Overlay , SoftLight , Replace , EfficientMask ,
  Bypass
}
 Defines blending methods for combining colors. More...
 

Detailed Description

A dynamic material that creates a rainbow effect using simplex noise with black-to-color transitions.

The RainbowNoise2 class combines simplex noise with a gradient material to produce a dynamic, colorful effect that shifts over time, starting from black.

Definition at line 26 of file RainbowNoise2.h.

Constructor & Destructor Documentation

◆ RainbowNoise2()

RainbowNoise2 ( )
inline

Default constructor for RainbowNoise2.

Definition at line 38 of file RainbowNoise2.h.

Member Function Documentation

◆ GetMaterial()

Material * GetMaterial ( )
virtual

Retrieves the associated material.

Returns
Pointer to the GradientMaterial instance.

Implements AnimatedMaterial.

Definition at line 15 of file RainbowNoise2.cpp.

References sNoise.

◆ GetRGB()

RGBColor GetRGB ( const Vector3D position,
const Vector3D normal,
const Vector3D uvw 
)
overridevirtual

Computes the color at a given position in the material.

Parameters
positionThe position in 3D space.
normalThe surface normal vector.
uvwThe texture coordinates.
Returns
The computed color as an RGBColor.

Implements Material.

Definition at line 19 of file RainbowNoise2.cpp.

References SimplexNoise< colors >::GetRGB(), and sNoise.

◆ Update()

void Update ( float  ratio)
virtual

Updates the material animation based on the time ratio.

Parameters
ratioThe time ratio used for animation updates.

Implements AnimatedMaterial.

Definition at line 3 of file RainbowNoise2.cpp.

References fGenMatGradient, gNoiseMat, GradientMaterial< colorCount >::HueShift(), GradientMaterial< colorCount >::SetGradientPeriod(), SimplexNoise< colors >::SetScale(), SimplexNoise< colors >::SetZPosition(), simplexNoiseDepth, sNoise, and FunctionGenerator::Update().

Referenced by ClockAnimation::Update().

Member Data Documentation

◆ fGenMatGradient

FunctionGenerator fGenMatGradient = FunctionGenerator(FunctionGenerator::Sine, 0.0f, 0.5f, 6.65f)
private

Function to animate gradient properties.

Definition at line 28 of file RainbowNoise2.h.

Referenced by Update().

◆ gNoiseMat

GradientMaterial<4> gNoiseMat = GradientMaterial<4>(noiseSpectrum, 2.0f, false)
private

Gradient material for simplex noise.

Definition at line 30 of file RainbowNoise2.h.

Referenced by Update().

◆ noiseSpectrum

RGBColor noiseSpectrum[4] = {RGBColor(0, 0, 0), RGBColor(255, 0, 0), RGBColor(0, 255, 0), RGBColor(0, 0, 255)}
private

Spectrum for the gradient, starting with black.

Definition at line 29 of file RainbowNoise2.h.

◆ simplexNoiseDepth

float simplexNoiseDepth = 0.0f
private

Depth parameter for simplex noise.

Definition at line 32 of file RainbowNoise2.h.

Referenced by Update().

◆ sNoise

SimplexNoise<4> sNoise = SimplexNoise<4>(1, &gNoiseMat)
private

Simplex noise generator.

Definition at line 31 of file RainbowNoise2.h.

Referenced by GetMaterial(), GetRGB(), and Update().


The documentation for this class was generated from the following files: