![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Creates a customizable gradient material for rendering. More...
#include <GradientMaterial.h>
Public Member Functions | |
GradientMaterial (RGBColor *rgbColors, float gradientPeriod, bool isRadial, bool isStepped=false) | |
Constructs a GradientMaterial instance. | |
void | UpdateGradient (RGBColor *rgbColors) |
Updates the colors of the gradient. | |
void | SetPositionOffset (Vector2D positionOffset) |
Sets the position offset for the gradient. | |
void | SetRotationOffset (Vector2D rotationOffset) |
Sets the rotation offset for the gradient. | |
void | SetRotationAngle (float rotationAngle) |
Sets the rotation angle for the gradient. | |
void | SetGradientPeriod (float gradientPeriod) |
Sets the gradient's period of repetition. | |
void | GradientShift (float ratio) |
Shifts the gradient by a ratio. | |
void | HueShift (float hueDeg) |
Shifts the hue of the gradient by a specified degree. | |
void | UpdateRGB () |
Updates the RGB colors in the gradient. | |
RGBColor | GetRGB (const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override |
Gets the RGB color for a given position in the gradient. | |
![]() | |
virtual | ~Material ()=default |
Virtual destructor for proper cleanup in derived classes. | |
Private Attributes | |
RGBColor | rgbColors [colorCount] |
Array of colors used in the gradient. | |
RGBColor * | baseRGBColors |
Pointer to the base RGB colors. | |
Vector2D | positionOffset |
Offset for the gradient's position. | |
Vector2D | rotationOffset |
Point about which the gradient rotates. | |
float | gradientPeriod = 1.0f |
Period of the gradient repetition. | |
float | rotationAngle = 0.0f |
Angle for rotating the gradient. | |
bool | isRadial = false |
Whether the gradient is radial. | |
bool | isStepped = false |
Whether the gradient is stepped. | |
float | gradientShift = 0.0f |
Shift in the gradient pattern. | |
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... | |
Creates a customizable gradient material for rendering.
The GradientMaterial
class supports linear and radial gradients, with options for stepping, position and rotation offsets, and period adjustments.
colorCount | Number of colors in the gradient. |
Definition at line 30 of file GradientMaterial.h.
GradientMaterial | ( | RGBColor * | rgbColors, |
float | gradientPeriod, | ||
bool | isRadial, | ||
bool | isStepped = false |
||
) |
Constructs a GradientMaterial
instance.
rgbColors | Array of colors for the gradient. |
gradientPeriod | Period of the gradient repetition. |
isRadial | Whether the gradient is radial. |
isStepped | Whether the gradient is stepped. |
|
overridevirtual |
Gets the RGB color for a given position in the gradient.
position | 3D position in the gradient. |
normal | Normal vector at the position. |
uvw | Texture coordinates at the position. |
Implements Material.
Referenced by HorizontalRainbow::GetRGB(), and DepthMaterial::GetRGB().
Shifts the gradient by a ratio.
ratio | The ratio by which to shift the gradient. |
Referenced by TVStatic::Update(), and XenraxAnimation::Update().
Shifts the hue of the gradient by a specified degree.
hueDeg | Degrees by which to shift the gradient's hue. |
Referenced by RainbowNoise::Update(), RainbowNoise2::Update(), TVStatic::Update(), ProtogenArtleckAnimation::Update(), WaffleDaProtoAnimation::Update(), InfraredAnimation::Update(), ProtobottAnimation::Update(), and NukudeFaceAnimation::Update().
Sets the gradient's period of repetition.
gradientPeriod | The new gradient period. |
Referenced by FlowNoise::Update(), HorizontalRainbow::Update(), RainbowNoise::Update(), RainbowNoise2::Update(), TVStatic::Update(), ProtogenArtleckAnimation::Update(), WaffleDaProtoAnimation::Update(), and NukudeFaceAnimation::Update().
Sets the position offset for the gradient.
positionOffset | The new position offset. |
Referenced by HorizontalRainbow::Update().
Sets the rotation angle for the gradient.
rotationAngle | The new rotation angle in degrees. |
Referenced by XenraxAnimation::Battery(), BroookAnimation::BroookAnimation(), SergaliciousAnimation::SergaliciousAnimation(), StrawberryAnimation::StrawberryAnimation(), TVStatic::TVStatic(), HorizontalRainbow::Update(), and Warzone2Animation::Warzone2Animation().
Sets the rotation offset for the gradient.
rotationOffset | The new rotation offset point. |
Updates the colors of the gradient.
rgbColors | New array of colors for the gradient. |
Referenced by FlowNoise::SetGradient(), HUB75AnimationSplit::Update(), WS35AnimationSplit::Update(), and ProtogenProject::UpdateFace().
Updates the RGB colors in the gradient.
Referenced by SammyAnimation::Update(), TechSaneAnimation::Update(), HUB75AnimationSplit::Update(), and WS35AnimationSplit::Update().
Pointer to the base RGB colors.
Definition at line 33 of file GradientMaterial.h.
Period of the gradient repetition.
Definition at line 36 of file GradientMaterial.h.
Shift in the gradient pattern.
Definition at line 40 of file GradientMaterial.h.
Whether the gradient is radial.
Definition at line 38 of file GradientMaterial.h.
Whether the gradient is stepped.
Definition at line 39 of file GradientMaterial.h.
Offset for the gradient's position.
Definition at line 34 of file GradientMaterial.h.
Array of colors used in the gradient.
Definition at line 32 of file GradientMaterial.h.
Angle for rotating the gradient.
Definition at line 37 of file GradientMaterial.h.
Point about which the gradient rotates.
Definition at line 35 of file GradientMaterial.h.