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

Generates a spiral pattern with configurable properties. More...

#include <SpiralMaterial.h>

Inheritance diagram for SpiralMaterial:
Collaboration diagram for SpiralMaterial:

Public Member Functions

 SpiralMaterial (uint8_t colorCount, RGBColor *rgbColors, float width, float bend)
 Constructs a SpiralMaterial instance.
 
 ~SpiralMaterial ()
 Destructor for SpiralMaterial.
 
void SetPositionOffset (Vector2D positionOffset)
 Sets the position offset for the spiral.
 
void SetRotationOffset (Vector2D rotationOffset)
 Sets the rotation offset for the spiral.
 
void SetRotationAngle (float rotationAngle)
 Sets the rotation angle for the spiral.
 
void SetWidth (float width)
 Sets the width of the spiral arms.
 
void SetBend (float bend)
 Sets the bending factor of the spiral arms.
 
void HueShift (float hueDeg)
 Shifts the hue of the spiral colors.
 
RGBColor GetRGB (const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
 Retrieves the color for a given position.
 
- Public Member Functions inherited from Material
virtual ~Material ()=default
 Virtual destructor for proper cleanup in derived classes.
 

Private Attributes

RGBColorrgbColors
 Array of colors for the spiral.
 
RGBColorbaseRGBColors
 Backup array for the original colors.
 
uint8_t colorCount
 Number of colors in the spiral.
 
Vector2D positionOffset
 Offset for the position of the spiral.
 
Vector2D rotationOffset
 Point around which the spiral rotates.
 
float width
 Width of the spiral arms.
 
float bend
 Degree of bending for the spiral arms.
 
float rotationAngle
 Angle to rotate the spiral pattern.
 

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

Generates a spiral pattern with configurable properties.

This class provides methods for manipulating the position, rotation, width, and bend of a spiral. The pattern is created using an array of RGB colors.

Definition at line 27 of file SpiralMaterial.h.

Constructor & Destructor Documentation

◆ SpiralMaterial()

SpiralMaterial ( uint8_t  colorCount,
RGBColor rgbColors,
float  width,
float  bend 
)

Constructs a SpiralMaterial instance.

Parameters
colorCountNumber of colors in the spiral.
rgbColorsPointer to an array of colors.
widthWidth of the spiral arms.
bendDegree of bending for the spiral arms.

Definition at line 3 of file StripeMaterial.cpp.

References baseRGBColors, bend, colorCount, rgbColors, and width.

◆ ~SpiralMaterial()

Destructor for SpiralMaterial.

Definition at line 17 of file StripeMaterial.cpp.

References baseRGBColors, and rgbColors.

Member Function Documentation

◆ GetRGB()

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

Retrieves the color for a given position.

Parameters
position3D position in the scene.
normalNormal vector at the position (not used for this material).
uvwTexture coordinates at the position (not used for this material).
Returns
The RGB color corresponding to the given position.

Implements Material.

Definition at line 48 of file StripeMaterial.cpp.

References bend, colorCount, EulerConstants::EulerOrderXYZS, Mathematics::Fract(), Rotation::GetQuaternion(), Vector2D::Magnitude(), Mathematics::MPI, positionOffset, rgbColors, Quaternion::RotateVector(), rotationAngle, width, Vector2D::X, Vector3D::X, Vector2D::Y, and Vector3D::Y.

Referenced by RainbowSpiral::GetRGB().

◆ HueShift()

void HueShift ( float  hueDeg)

Shifts the hue of the spiral colors.

Parameters
hueDegThe degree to shift the hue.

Definition at line 42 of file StripeMaterial.cpp.

References baseRGBColors, colorCount, RGBColor::HueShift(), and rgbColors.

◆ SetBend()

void SetBend ( float  bend)

Sets the bending factor of the spiral arms.

Parameters
bendThe degree of bending.

Definition at line 38 of file StripeMaterial.cpp.

References bend.

Referenced by RainbowSpiral::Update(), WaffleDaProtoAnimation::Update(), and FullScreenAnimation::Update().

◆ SetPositionOffset()

void SetPositionOffset ( Vector2D  positionOffset)

Sets the position offset for the spiral.

Parameters
positionOffsetThe offset to apply.

Definition at line 22 of file StripeMaterial.cpp.

References positionOffset.

Referenced by RainbowSpiral::Update(), WaffleDaProtoAnimation::Update(), and FullScreenAnimation::Update().

◆ SetRotationAngle()

void SetRotationAngle ( float  rotationAngle)

Sets the rotation angle for the spiral.

Parameters
rotationAngleThe angle to rotate the spiral pattern.

Definition at line 30 of file StripeMaterial.cpp.

References rotationAngle.

Referenced by RainbowSpiral::Update(), WaffleDaProtoAnimation::Update(), and FullScreenAnimation::Update().

◆ SetRotationOffset()

void SetRotationOffset ( Vector2D  rotationOffset)

Sets the rotation offset for the spiral.

Parameters
rotationOffsetThe point around which to rotate.

Definition at line 26 of file StripeMaterial.cpp.

References rotationOffset.

◆ SetWidth()

void SetWidth ( float  width)

Sets the width of the spiral arms.

Parameters
widthThe desired width.

Definition at line 34 of file StripeMaterial.cpp.

References width.

Member Data Documentation

◆ baseRGBColors

RGBColor* baseRGBColors
private

Backup array for the original colors.

Definition at line 30 of file SpiralMaterial.h.

Referenced by HueShift(), SpiralMaterial(), and ~SpiralMaterial().

◆ bend

float bend
private

Degree of bending for the spiral arms.

Definition at line 35 of file SpiralMaterial.h.

Referenced by GetRGB(), SetBend(), and SpiralMaterial().

◆ colorCount

uint8_t colorCount
private

Number of colors in the spiral.

Definition at line 31 of file SpiralMaterial.h.

Referenced by GetRGB(), HueShift(), and SpiralMaterial().

◆ positionOffset

Vector2D positionOffset
private

Offset for the position of the spiral.

Definition at line 32 of file SpiralMaterial.h.

Referenced by GetRGB(), and SetPositionOffset().

◆ rgbColors

RGBColor* rgbColors
private

Array of colors for the spiral.

Definition at line 29 of file SpiralMaterial.h.

Referenced by GetRGB(), HueShift(), SpiralMaterial(), and ~SpiralMaterial().

◆ rotationAngle

float rotationAngle
private

Angle to rotate the spiral pattern.

Definition at line 36 of file SpiralMaterial.h.

Referenced by GetRGB(), and SetRotationAngle().

◆ rotationOffset

Vector2D rotationOffset
private

Point around which the spiral rotates.

Definition at line 33 of file SpiralMaterial.h.

Referenced by SetRotationOffset().

◆ width

float width
private

Width of the spiral arms.

Definition at line 34 of file SpiralMaterial.h.

Referenced by GetRGB(), SetWidth(), and SpiralMaterial().


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