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

A material that applies a single, solid RGB color to surfaces. More...

#include <SimpleMaterial.h>

Inheritance diagram for SimpleMaterial:
Collaboration diagram for SimpleMaterial:

Public Member Functions

 SimpleMaterial (RGBColor rgb)
 Constructs a SimpleMaterial with a specified RGB color.
 
void HueShift (float hueDeg)
 Adjusts the hue of the material's color.
 
void SetRGB (RGBColor rgb)
 Sets a new RGB color for the material.
 
RGBColor GetRGB (const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
 Retrieves the RGB color for a surface.
 
- Public Member Functions inherited from Material
virtual ~Material ()=default
 Virtual destructor for proper cleanup in derived classes.
 

Private Attributes

RGBColor rgb
 The active RGB color applied to the surface.
 
RGBColor baseRGB
 The base RGB color used for reference during hue shifts.
 

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 material that applies a single, solid RGB color to surfaces.

This class allows setting a static RGB color or dynamically adjusting its hue for visual effects.

Definition at line 23 of file SimpleMaterial.h.

Constructor & Destructor Documentation

◆ SimpleMaterial()

Constructs a SimpleMaterial with a specified RGB color.

Parameters
rgbThe initial color to be applied to the material.

Definition at line 3 of file SimpleMaterial.cpp.

References baseRGB, and rgb.

Member Function Documentation

◆ GetRGB()

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

Retrieves the RGB color for a surface.

For SimpleMaterial, this always returns the same color, regardless of position, normal, or texture coordinates.

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

Implements Material.

Definition at line 17 of file SimpleMaterial.cpp.

References rgb.

◆ HueShift()

void HueShift ( float  hueDeg)

Adjusts the hue of the material's color.

This function shifts the hue of the current color by the specified degree value while maintaining its brightness and saturation.

Parameters
hueDegThe hue shift in degrees (range: 0–360).

Definition at line 8 of file SimpleMaterial.cpp.

References baseRGB, RGBColor::HueShift(), and rgb.

◆ SetRGB()

void SetRGB ( RGBColor  rgb)

Sets a new RGB color for the material.

Parameters
rgbThe new RGB color to apply.

Definition at line 12 of file SimpleMaterial.cpp.

References baseRGB, and rgb.

Referenced by SpyroRotateAnimation::Update().

Member Data Documentation

◆ baseRGB

RGBColor baseRGB
private

The base RGB color used for reference during hue shifts.

Definition at line 26 of file SimpleMaterial.h.

Referenced by HueShift(), SetRGB(), and SimpleMaterial().

◆ rgb

RGBColor rgb
private

The active RGB color applied to the surface.

Definition at line 25 of file SimpleMaterial.h.

Referenced by GetRGB(), HueShift(), SetRGB(), and SimpleMaterial().


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