![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
A material class for creating an audio-reactive gradient effect. More...
#include <AudioReactiveGradient.h>
Public Member Functions | |
AudioReactiveGradient (Vector2D size, Vector2D offset, bool bounce=false, bool circular=false) | |
Constructs an AudioReactiveGradient with specified parameters. | |
~AudioReactiveGradient () | |
Destroys the AudioReactiveGradient instance. | |
void | SetMaterial (Material *material) |
Sets a secondary material for additional effects. | |
float * | GetFourierData () |
Retrieves the Fourier-transformed audio data. | |
void | SetSize (Vector2D size) |
Sets the size of the gradient. | |
void | SetPosition (Vector2D offset) |
Sets the position of the gradient. | |
void | SetRotation (float angle) |
Sets the rotation angle of the gradient. | |
void | SetHueAngle (float hueAngle) |
Sets the hue angle for color adjustments. | |
void | SetRadius (float radius) |
Sets the radius for circular gradient patterns. | |
void | Update (float *readData) |
Updates the gradient based on new audio data. | |
RGBColor | GetRGB (const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override |
Retrieves the color of the gradient at a specific position. | |
![]() | |
virtual | ~Material ()=default |
Virtual destructor for proper cleanup in derived classes. | |
Private Attributes | |
BouncePhysics * | bPhy [128] |
Array of BouncePhysics instances for handling dynamic bouncing. | |
Vector2D | size |
The size of the gradient area. | |
Vector2D | offset |
The offset of the gradient from the origin. | |
float | angle = 0.0f |
Rotation angle of the gradient. | |
float | hueAngle = 0.0f |
Hue angle for color adjustments. | |
float | radius = 0.0f |
Radius for circular gradient patterns. | |
uint8_t | colors |
Number of colors in the gradient. | |
float * | data |
Pointer to the audio data array. | |
float | bounceData [128] |
Processed bounce data for audio reactivity. | |
uint8_t | bins = 128 |
Number of bins for audio data processing. | |
bool | bounce = false |
Flag indicating if bouncing effects are enabled. | |
bool | circular = false |
Flag indicating if circular patterns are enabled. | |
RGBColor | rainbowSpectrum [6] = {RGBColor(255, 0, 0), RGBColor(255, 255, 0), RGBColor(0, 255, 0), RGBColor(0, 255, 255), RGBColor(0, 0, 255), RGBColor(255, 0, 255)} |
Predefined rainbow colors. | |
GradientMaterial< 6 > | gM = GradientMaterial<6>(rainbowSpectrum, 1.0f, false) |
Gradient material for the rainbow spectrum. | |
Material * | material |
Pointer to a secondary material for additional effects. | |
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... | |
A material class for creating an audio-reactive gradient effect.
The AudioReactiveGradient class generates a gradient effect that dynamically reacts to audio data. It supports features like bouncing effects, circular patterns, and customizable gradient colors.
Definition at line 28 of file AudioReactiveGradient.h.
AudioReactiveGradient | ( | Vector2D | size, |
Vector2D | offset, | ||
bool | bounce = false , |
||
bool | circular = false |
||
) |
Constructs an AudioReactiveGradient with specified parameters.
size | The size of the gradient. |
offset | The offset of the gradient. |
bounce | Enable or disable bouncing effects. |
circular | Enable or disable circular patterns. |
Definition at line 3 of file AudioReactiveGradient.cpp.
References bounce, bPhy, circular, Vector2D::Divide(), gM, material, offset, and size.
Destroys the AudioReactiveGradient instance.
Definition at line 17 of file AudioReactiveGradient.cpp.
References bPhy.
float * GetFourierData | ( | ) |
Retrieves the Fourier-transformed audio data.
Definition at line 27 of file AudioReactiveGradient.cpp.
References bounce, bounceData, and data.
|
overridevirtual |
Retrieves the color of the gradient at a specific position.
position | The position in 3D space. |
normal | The surface normal vector. |
uvw | The texture coordinates. |
Implements Material.
Definition at line 67 of file AudioReactiveGradient.cpp.
References angle, bins, bounce, bounceData, circular, Mathematics::CosineInterpolation(), data, Material::GetRGB(), hueAngle, Mathematics::IsClose(), Mathematics::Map(), material, Mathematics::MPI, offset, radius, Vector2D::Rotate(), size, Vector2D::X, Vector3D::X, Vector2D::Y, and Vector3D::Y.
Sets the hue angle for color adjustments.
hueAngle | The new hue angle in degrees. |
Definition at line 47 of file AudioReactiveGradient.cpp.
References hueAngle.
Referenced by AphoriAnimation::Update(), BasilGardenAnimation::Update(), BroookAnimation::Update(), GalaxyAnimation::Update(), HertzzAnimation::Update(), InfraredAnimation::Update(), SammyAnimation::Update(), SergaliciousAnimation::Update(), StrawberryAnimation::Update(), TamamoAnimation::Update(), TechSaneAnimation::Update(), Warzone2Animation::Update(), XenraxAnimation::Update(), AlphaAnimation::Update(), GammaAnimation::Update(), HUB75AnimationSplit::Update(), WS35AnimationSplit::Update(), and ProtogenProject::UpdateFace().
Sets a secondary material for additional effects.
material | Pointer to the secondary material. |
Definition at line 23 of file AudioReactiveGradient.cpp.
References material.
Sets the position of the gradient.
offset | The new position offset as a Vector2D. |
Definition at line 39 of file AudioReactiveGradient.cpp.
References offset.
Referenced by AphoriAnimation::Update(), BasilGardenAnimation::Update(), BroookAnimation::Update(), GalaxyAnimation::Update(), HertzzAnimation::Update(), InfraredAnimation::Update(), SammyAnimation::Update(), SergaliciousAnimation::Update(), StrawberryAnimation::Update(), TamamoAnimation::Update(), TechSaneAnimation::Update(), Warzone2Animation::Update(), XenraxAnimation::Update(), AlphaAnimation::Update(), GammaAnimation::Update(), HUB75AnimationSplit::Update(), WS35AnimationSplit::Update(), and ProtogenProject::UpdateFace().
Sets the radius for circular gradient patterns.
radius | The new radius value. |
Definition at line 51 of file AudioReactiveGradient.cpp.
References radius.
Referenced by AphoriAnimation::Update(), BasilGardenAnimation::Update(), BroookAnimation::Update(), GalaxyAnimation::Update(), HertzzAnimation::Update(), InfraredAnimation::Update(), SammyAnimation::Update(), SergaliciousAnimation::Update(), StrawberryAnimation::Update(), TamamoAnimation::Update(), TechSaneAnimation::Update(), Warzone2Animation::Update(), XenraxAnimation::Update(), GammaAnimation::Update(), HUB75AnimationSplit::Update(), WS35AnimationSplit::Update(), and ProtogenProject::UpdateFace().
Sets the rotation angle of the gradient.
angle | The new rotation angle in degrees. |
Definition at line 43 of file AudioReactiveGradient.cpp.
References angle.
Referenced by AphoriAnimation::Update(), BasilGardenAnimation::Update(), BroookAnimation::Update(), GalaxyAnimation::Update(), HertzzAnimation::Update(), InfraredAnimation::Update(), SammyAnimation::Update(), SergaliciousAnimation::Update(), StrawberryAnimation::Update(), TamamoAnimation::Update(), TechSaneAnimation::Update(), Warzone2Animation::Update(), XenraxAnimation::Update(), AlphaAnimation::Update(), GammaAnimation::Update(), HUB75AnimationSplit::Update(), WS35AnimationSplit::Update(), and ProtogenProject::UpdateFace().
Sets the size of the gradient.
size | The new size as a Vector2D. |
Definition at line 35 of file AudioReactiveGradient.cpp.
References Vector2D::Divide(), and size.
Referenced by AphoriAnimation::Update(), BasilGardenAnimation::Update(), BroookAnimation::Update(), GalaxyAnimation::Update(), HertzzAnimation::Update(), InfraredAnimation::Update(), SammyAnimation::Update(), SergaliciousAnimation::Update(), StrawberryAnimation::Update(), TamamoAnimation::Update(), TechSaneAnimation::Update(), Warzone2Animation::Update(), XenraxAnimation::Update(), GammaAnimation::Update(), HUB75AnimationSplit::Update(), WS35AnimationSplit::Update(), and ProtogenProject::UpdateFace().
Updates the gradient based on new audio data.
readData | Pointer to the audio data array. |
Definition at line 55 of file AudioReactiveGradient.cpp.
References bounce, bounceData, bPhy, BouncePhysics::Calculate(), and data.
Referenced by ProtogenProject::AudioReactiveGradientFace(), AphoriAnimation::Update(), BasilGardenAnimation::Update(), BroookAnimation::Update(), HertzzAnimation::Update(), InfraredAnimation::Update(), SammyAnimation::Update(), SergaliciousAnimation::Update(), StrawberryAnimation::Update(), TamamoAnimation::Update(), TechSaneAnimation::Update(), Warzone2Animation::Update(), XenraxAnimation::Update(), AlphaAnimation::Update(), GammaAnimation::Update(), HUB75AnimationSplit::Update(), and WS35AnimationSplit::Update().
|
private |
Rotation angle of the gradient.
Definition at line 33 of file AudioReactiveGradient.h.
Referenced by GetRGB(), and SetRotation().
|
private |
Number of bins for audio data processing.
Definition at line 39 of file AudioReactiveGradient.h.
Referenced by GetRGB().
Flag indicating if bouncing effects are enabled.
Definition at line 40 of file AudioReactiveGradient.h.
Referenced by AudioReactiveGradient(), GetFourierData(), GetRGB(), and Update().
|
private |
Processed bounce data for audio reactivity.
Definition at line 38 of file AudioReactiveGradient.h.
Referenced by GetFourierData(), GetRGB(), and Update().
|
private |
Array of BouncePhysics instances for handling dynamic bouncing.
Definition at line 30 of file AudioReactiveGradient.h.
Referenced by AudioReactiveGradient(), Update(), and ~AudioReactiveGradient().
Flag indicating if circular patterns are enabled.
Definition at line 41 of file AudioReactiveGradient.h.
Referenced by AudioReactiveGradient(), and GetRGB().
|
private |
Number of colors in the gradient.
Definition at line 36 of file AudioReactiveGradient.h.
|
private |
Pointer to the audio data array.
Definition at line 37 of file AudioReactiveGradient.h.
Referenced by GetFourierData(), GetRGB(), and Update().
|
private |
Gradient material for the rainbow spectrum.
Definition at line 44 of file AudioReactiveGradient.h.
Referenced by AudioReactiveGradient().
|
private |
Hue angle for color adjustments.
Definition at line 34 of file AudioReactiveGradient.h.
Referenced by GetRGB(), and SetHueAngle().
|
private |
Pointer to a secondary material for additional effects.
Definition at line 46 of file AudioReactiveGradient.h.
Referenced by AudioReactiveGradient(), GetRGB(), and SetMaterial().
|
private |
The offset of the gradient from the origin.
Definition at line 32 of file AudioReactiveGradient.h.
Referenced by AudioReactiveGradient(), GetRGB(), and SetPosition().
|
private |
Radius for circular gradient patterns.
Definition at line 35 of file AudioReactiveGradient.h.
Referenced by GetRGB(), and SetRadius().
|
private |
Predefined rainbow colors.
Definition at line 43 of file AudioReactiveGradient.h.
|
private |
The size of the gradient area.
Definition at line 31 of file AudioReactiveGradient.h.
Referenced by AudioReactiveGradient(), GetRGB(), and SetSize().