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

Radially shifts the red, green, and blue channels of the pixels. More...

#include <ShiftR.h>

Inheritance diagram for ShiftR:
Collaboration diagram for ShiftR:

Public Member Functions

 ShiftR (uint8_t pixels)
 Constructs a ShiftR effect instance.
 
void ApplyEffect (IPixelGroup *pixelGroup) override
 Applies the radial shift effect to the given pixel group.
 
- Public Member Functions inherited from Effect
 Effect ()
 Default constructor for the Effect class.
 
void SetRatio (float ratio)
 Sets the scaling ratio for the effect.
 

Private Attributes

const uint8_t pixels
 Number of pixels to consider for the radial effect.
 
FunctionGenerator fGenPhase1 = FunctionGenerator(FunctionGenerator::Sawtooth, 0.0f, 1.0f, 4.5f)
 Function generator for the red channel rotation phase.
 
FunctionGenerator fGenPhase2 = FunctionGenerator(FunctionGenerator::Sawtooth, 0.0f, 1.0f, 3.2f)
 Function generator for the green channel rotation phase.
 
FunctionGenerator fGenRotation = FunctionGenerator(FunctionGenerator::Sawtooth, 0.0f, 360.0f, 3.7f)
 Function generator for the overall rotation.
 

Additional Inherited Members

- Protected Attributes inherited from Effect
float ratio = 0.0f
 A scaling ratio used for dynamic effect adjustments.
 

Detailed Description

Radially shifts the red, green, and blue channels of the pixels.

The ShiftR effect uses multiple function generators to apply rotations and phase shifts to the pixel colors, resulting in a swirling radial color transition.

Definition at line 26 of file ShiftR.h.

Constructor & Destructor Documentation

◆ ShiftR()

ShiftR ( uint8_t  pixels)

Constructs a ShiftR effect instance.

Parameters
pixelsThe number of pixels to consider for the radial effect.

Definition at line 4 of file ShiftR.cpp.

Member Function Documentation

◆ ApplyEffect()

void ApplyEffect ( IPixelGroup pixelGroup)
overridevirtual

Applies the radial shift effect to the given pixel group.

This method shifts the red, green, and blue channels of the pixels radially based on the configured function generators.

Parameters
pixelGroupPointer to the IPixelGroup to which the effect will be applied.

Implements Effect.

Definition at line 6 of file ShiftR.cpp.

References RGBColor::B, fGenRotation, RGBColor::G, IPixelGroup::GetColorBuffer(), IPixelGroup::GetColors(), IPixelGroup::GetPixelCount(), IPixelGroup::GetRadialIndex(), Mathematics::Map(), pixels, RGBColor::R, Effect::ratio, and FunctionGenerator::Update().

Member Data Documentation

◆ fGenPhase1

FunctionGenerator fGenPhase1 = FunctionGenerator(FunctionGenerator::Sawtooth, 0.0f, 1.0f, 4.5f)
private

Function generator for the red channel rotation phase.

Definition at line 31 of file ShiftR.h.

◆ fGenPhase2

FunctionGenerator fGenPhase2 = FunctionGenerator(FunctionGenerator::Sawtooth, 0.0f, 1.0f, 3.2f)
private

Function generator for the green channel rotation phase.

Definition at line 34 of file ShiftR.h.

◆ fGenRotation

FunctionGenerator fGenRotation = FunctionGenerator(FunctionGenerator::Sawtooth, 0.0f, 360.0f, 3.7f)
private

Function generator for the overall rotation.

Definition at line 37 of file ShiftR.h.

Referenced by ApplyEffect().

◆ pixels

const uint8_t pixels
private

Number of pixels to consider for the radial effect.

Definition at line 28 of file ShiftR.h.

Referenced by ApplyEffect().


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