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

A dynamic horizontal rainbow gradient material. More...

#include <HorizontalRainbow.h>

Inheritance diagram for HorizontalRainbow:
Collaboration diagram for HorizontalRainbow:

Public Member Functions

 HorizontalRainbow ()
 Default constructor for HorizontalRainbow.
 
void Update (float ratio)
 Updates the gradient animation based on the provided 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 gradient.
 
- Public Member Functions inherited from Material
virtual ~Material ()=default
 Virtual destructor for proper cleanup in derived classes.
 

Private Attributes

RGBColor noiseSpectrum [6] = {RGBColor(255, 0, 0), RGBColor(255, 255, 0), RGBColor(0, 255, 0), RGBColor(0, 255, 255), RGBColor(0, 0, 255), RGBColor(255, 0, 255)}
 Predefined rainbow colors.
 
GradientMaterial< 6 > gNoiseMat = GradientMaterial<6>(&noiseSpectrum[0], 2.0f, false, false)
 Gradient material for the rainbow spectrum.
 
float positionOffset = 0.0f
 Position offset for animating the gradient.
 

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 horizontal rainbow gradient material.

The HorizontalRainbow class generates a colorful horizontal gradient using a predefined rainbow spectrum and supports dynamic animation of the gradient.

Definition at line 25 of file HorizontalRainbow.h.

Constructor & Destructor Documentation

◆ HorizontalRainbow()

HorizontalRainbow ( )
inline

Default constructor for HorizontalRainbow.

Definition at line 35 of file HorizontalRainbow.h.

Member Function Documentation

◆ GetMaterial()

Material * GetMaterial ( )
virtual

Retrieves the associated material.

Returns
Pointer to the Material instance.

Implements AnimatedMaterial.

Definition at line 11 of file HorizontalRainbow.cpp.

References gNoiseMat.

◆ GetRGB()

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

Computes the color at a given position in the gradient.

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 15 of file HorizontalRainbow.cpp.

References GradientMaterial< colorCount >::GetRGB(), and gNoiseMat.

◆ Update()

void Update ( float  ratio)
virtual

Updates the gradient animation based on the provided time ratio.

Parameters
ratioThe time ratio for animation updates.

Implements AnimatedMaterial.

Definition at line 3 of file HorizontalRainbow.cpp.

References gNoiseMat, positionOffset, GradientMaterial< colorCount >::SetGradientPeriod(), GradientMaterial< colorCount >::SetPositionOffset(), and GradientMaterial< colorCount >::SetRotationAngle().

Referenced by SplatAnimation::Update(), UnicornZhenjaAnimation::Update(), and ProtogenProject::UpdateFace().

Member Data Documentation

◆ gNoiseMat

GradientMaterial<6> gNoiseMat = GradientMaterial<6>(&noiseSpectrum[0], 2.0f, false, false)
private

Gradient material for the rainbow spectrum.

Definition at line 28 of file HorizontalRainbow.h.

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

◆ noiseSpectrum

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

Predefined rainbow colors.

Definition at line 27 of file HorizontalRainbow.h.

◆ positionOffset

float positionOffset = 0.0f
private

Position offset for animating the gradient.

Definition at line 29 of file HorizontalRainbow.h.

Referenced by Update().


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