4 this->size =
size.Divide(2.0f);
11 for (uint8_t i = 0; i < 128; i++) {
18 for (uint8_t i = 0; i < 128; i++) {
36 this->size =
size.Divide(2.0f);
58 for (uint8_t i = 0; i < 128; i++) {
77 rPos.
Y = sqrtf(tX * tX + rPos.
Y * rPos.
Y);
84 float xDistance2 =
size.X / float(
bins) * (x + 1) -
size.X;
90 float inside = 1.0f - (height * 4.0f + 0.15f) - yColor;
94 }
else if (
circular && rPos.
Y + height * 150.0f >
radius - 5.0f && rPos.
Y - height * 150.0f <
radius - 5.0f) {
95 if (rPos.
Y - height * 50.0f > 75.0f) {
97 }
else if (rPos.
Y - height * 50.0f < 125.0f) {
A material class for creating an audio-reactive gradient effect.
void SetRadius(float radius)
Sets the radius for circular gradient patterns.
void SetPosition(Vector2D offset)
Sets the position of the gradient.
float radius
Radius for circular gradient patterns.
AudioReactiveGradient(Vector2D size, Vector2D offset, bool bounce=false, bool circular=false)
Constructs an AudioReactiveGradient with specified parameters.
float bounceData[128]
Processed bounce data for audio reactivity.
float * data
Pointer to the audio data array.
BouncePhysics * bPhy[128]
Array of BouncePhysics instances for handling dynamic bouncing.
float hueAngle
Hue angle for color adjustments.
bool bounce
Flag indicating if bouncing effects are enabled.
float * GetFourierData()
Retrieves the Fourier-transformed audio data.
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.
~AudioReactiveGradient()
Destroys the AudioReactiveGradient instance.
void SetSize(Vector2D size)
Sets the size of the gradient.
Vector2D offset
The offset of the gradient from the origin.
float angle
Rotation angle of the gradient.
bool circular
Flag indicating if circular patterns are enabled.
GradientMaterial< 6 > gM
Gradient material for the rainbow spectrum.
void SetMaterial(Material *material)
Sets a secondary material for additional effects.
void SetRotation(float angle)
Sets the rotation angle of the gradient.
Material * material
Pointer to a secondary material for additional effects.
uint8_t bins
Number of bins for audio data processing.
void SetHueAngle(float hueAngle)
Sets the hue angle for color adjustments.
Vector2D size
The size of the gradient area.
Simulates bouncing physics with gravity and velocity damping.
Abstract base class for rendering materials.
static const float MPI
Mathematical constant (3.14159265358979323846...).
static bool IsClose(float v1, float v2, float epsilon)
Checks if two values are close within a specified epsilon.
static T Map(T value, T inLow, T inMax, T outMin, T outMax)
Maps a value from one range to another.
static float CosineInterpolation(float beg, float fin, float ratio)
Applies a cosine-based interpolation between two values.
Represents an RGB color and provides methods for manipulation.
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Vector2D Rotate(const float &angle, const Vector2D &offset) const
Rotates this vector by a specified angle (in degrees or radians) around a given offset.
float X
The X-component of the 2D vector.
float Y
The Y-component of the 2D vector.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
float X
The X-component of the 3D vector.
float Y
The Y-component of the 3D vector.