![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
A dynamic oscilloscope material for visualizing audio signals. More...
#include <Oscilloscope.h>
Public Member Functions | |
Oscilloscope (Vector2D size, Vector2D offset) | |
Constructs an Oscilloscope with the specified size and offset. | |
~Oscilloscope () | |
Destroys the Oscilloscope instance. | |
void | SetMaterial (Material *material) |
Sets an additional material for visual effects. | |
float * | GetSampleData () |
Retrieves the current sample data. | |
void | SetSize (Vector2D size) |
Sets the size of the oscilloscope visualization. | |
void | SetPosition (Vector2D offset) |
Sets the position of the oscilloscope visualization. | |
void | SetRotation (float angle) |
Sets the rotation angle of the visualization. | |
void | SetHueAngle (float hueAngle) |
Sets the hue angle for color adjustments. | |
void | Update (float *data) |
Updates the oscilloscope visualization based on new audio data. | |
RGBColor | GetRGB (const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override |
Computes the color at a given position in the visualization. | |
![]() | |
virtual | ~Material ()=default |
Virtual destructor for proper cleanup in derived classes. | |
Private Attributes | |
BouncePhysics * | bPhy [128] |
Array of BouncePhysics instances for dynamic bouncing behavior. | |
Vector2D | size |
The size of the oscilloscope visualization. | |
Vector2D | offset |
The position offset of the visualization. | |
float | angle = 0.0f |
Rotation angle of the visualization. | |
float | hueAngle = 0.0f |
Hue angle for color adjustments. | |
float | radius = 40.0f |
Radius for circular visualization patterns. | |
uint8_t | colors |
Number of colors in the gradient. | |
float * | data |
Pointer to the audio sample data. | |
float | midPoint = 0.0f |
Midpoint for audio data normalization. | |
uint8_t | bins = 128 |
Number of bins for audio data processing. | |
MaxFilter< 40 > | maxF = MaxFilter<40>() |
Filter for tracking maximum values. | |
MinFilter< 40 > | minF = MinFilter<40>() |
Filter for tracking minimum values. | |
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 an additional material for effects. | |
float | minValue |
float | maxValue |
Minimum and maximum values for data scaling. | |
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 dynamic oscilloscope material for visualizing audio signals.
The Oscilloscope class provides real-time visualization of audio signals, featuring bouncing physics, gradient colors, and customizable attributes such as size, position, and rotation.
Definition at line 29 of file Oscilloscope.h.
Oscilloscope | ( | Vector2D | size, |
Vector2D | offset | ||
) |
Constructs an Oscilloscope with the specified size and offset.
size | The size of the oscilloscope visualization. |
offset | The position offset of the visualization. |
Definition at line 3 of file Oscilloscope.cpp.
References Vector2D::Divide(), gM, material, offset, and size.
~Oscilloscope | ( | ) |
|
overridevirtual |
Computes the color at a given position in the visualization.
position | The position in 3D space. |
normal | The surface normal vector. |
uvw | The texture coordinates. |
Implements Material.
Definition at line 48 of file Oscilloscope.cpp.
References angle, bins, Mathematics::CosineInterpolation(), data, Material::GetRGB(), hueAngle, RGBColor::HueShift(), Mathematics::IsClose(), Mathematics::Map(), material, maxValue, minValue, offset, Vector2D::Rotate(), size, Vector2D::X, Vector3D::X, Vector2D::Y, and Vector3D::Y.
float * GetSampleData | ( | ) |
Retrieves the current sample data.
Definition at line 19 of file Oscilloscope.cpp.
References data.
Sets the hue angle for color adjustments.
hueAngle | The new hue angle in degrees. |
Definition at line 35 of file Oscilloscope.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(), GammaAnimation::Update(), HUB75AnimationSplit::Update(), WS35AnimationSplit::Update(), and ProtogenProject::UpdateFace().
Sets an additional material for visual effects.
material | Pointer to the Material instance. |
Definition at line 15 of file Oscilloscope.cpp.
References material.
Sets the position of the oscilloscope visualization.
offset | The new position offset as a Vector2D. |
Definition at line 27 of file Oscilloscope.cpp.
References offset.
Referenced by ProtogenProject::ProtogenProject(), 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(), and WS35AnimationSplit::Update().
Sets the rotation angle of the visualization.
angle | The new rotation angle in degrees. |
Definition at line 31 of file Oscilloscope.cpp.
References angle.
Referenced by GammaAnimation::Update().
Sets the size of the oscilloscope visualization.
size | The new size as a Vector2D. |
Definition at line 23 of file Oscilloscope.cpp.
References Vector2D::Divide(), and size.
Referenced by ProtogenProject::ProtogenProject(), 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(), and WS35AnimationSplit::Update().
Updates the oscilloscope visualization based on new audio data.
data | Pointer to the audio sample data array. |
Definition at line 39 of file Oscilloscope.cpp.
References bins, data, MaxFilter< memory >::Filter(), MinFilter< memory >::Filter(), maxF, maxValue, midPoint, minF, and minValue.
Referenced by ProtogenProject::OscilloscopeFace(), AphoriAnimation::Update(), BasilGardenAnimation::Update(), BroookAnimation::Update(), HertzzAnimation::Update(), InfraredAnimation::Update(), SammyAnimation::Update(), SergaliciousAnimation::Update(), StrawberryAnimation::Update(), TamamoAnimation::Update(), TechSaneAnimation::Update(), Warzone2Animation::Update(), XenraxAnimation::Update(), GammaAnimation::Update(), HUB75AnimationSplit::Update(), and WS35AnimationSplit::Update().
|
private |
Rotation angle of the visualization.
Definition at line 34 of file Oscilloscope.h.
Referenced by GetRGB(), and SetRotation().
|
private |
Number of bins for audio data processing.
Definition at line 40 of file Oscilloscope.h.
|
private |
Array of BouncePhysics instances for dynamic bouncing behavior.
Definition at line 31 of file Oscilloscope.h.
Referenced by ~Oscilloscope().
|
private |
Number of colors in the gradient.
Definition at line 37 of file Oscilloscope.h.
|
private |
Pointer to the audio sample data.
Definition at line 38 of file Oscilloscope.h.
Referenced by GetRGB(), GetSampleData(), and Update().
|
private |
Gradient material for the rainbow spectrum.
Definition at line 46 of file Oscilloscope.h.
Referenced by Oscilloscope().
|
private |
Hue angle for color adjustments.
Definition at line 35 of file Oscilloscope.h.
Referenced by GetRGB(), and SetHueAngle().
|
private |
Pointer to an additional material for effects.
Definition at line 48 of file Oscilloscope.h.
Referenced by GetRGB(), Oscilloscope(), and SetMaterial().
Filter for tracking maximum values.
Definition at line 42 of file Oscilloscope.h.
Referenced by Update().
|
private |
Minimum and maximum values for data scaling.
Definition at line 50 of file Oscilloscope.h.
|
private |
Midpoint for audio data normalization.
Definition at line 39 of file Oscilloscope.h.
Referenced by Update().
Filter for tracking minimum values.
Definition at line 43 of file Oscilloscope.h.
Referenced by Update().
|
private |
Definition at line 50 of file Oscilloscope.h.
|
private |
The position offset of the visualization.
Definition at line 33 of file Oscilloscope.h.
Referenced by GetRGB(), Oscilloscope(), and SetPosition().
|
private |
Radius for circular visualization patterns.
Definition at line 36 of file Oscilloscope.h.
|
private |
Predefined rainbow colors.
Definition at line 45 of file Oscilloscope.h.
|
private |
The size of the oscilloscope visualization.
Definition at line 32 of file Oscilloscope.h.
Referenced by GetRGB(), Oscilloscope(), and SetSize().