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

Implements a glitch effect along the X-axis for pixel groups. More...

#include <GlitchX.h>

Inheritance diagram for GlitchX:
Collaboration diagram for GlitchX:

Public Member Functions

 GlitchX (uint8_t pixels)
 Constructs a GlitchX effect with a specified number of pixels.
 
void ApplyEffect (IPixelGroup *pixelGroup) override
 Applies the glitch effect along the X-axis 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
 The number of pixels to distort.
 

Additional Inherited Members

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

Detailed Description

Implements a glitch effect along the X-axis for pixel groups.

The GlitchX effect distorts the positions of pixels randomly along the X-axis, creating a glitch-like distortion.

Definition at line 26 of file GlitchX.h.

Constructor & Destructor Documentation

◆ GlitchX()

GlitchX ( uint8_t  pixels)

Constructs a GlitchX effect with a specified number of pixels.

Parameters
pixelsThe number of pixels to distort along the X-axis.

Definition at line 3 of file GlitchX.cpp.

Member Function Documentation

◆ ApplyEffect()

void ApplyEffect ( IPixelGroup pixelGroup)
overridevirtual

Applies the glitch effect along the X-axis to the given pixel group.

This method modifies the X-coordinates of the pixels in the group, shifting them randomly within a defined range.

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

Implements Effect.

Definition at line 5 of file GlitchX.cpp.

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

Member Data Documentation

◆ pixels

const uint8_t pixels
private

The number of pixels to distort.

Definition at line 28 of file GlitchX.h.

Referenced by ApplyEffect().


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