6#include "../Morph/ProtoDRMorph.h"
7#include "../Render/Scene.h"
8#include "../Signals/FunctionGenerator.h"
10#include "../Objects/Spyro.h"
11#include "../Objects/Background.h"
13#include "../Materials/Animated/AudioReactiveGradient.h"
14#include "../Materials/Animated/SpectrumAnalyzer.h"
15#include "../Materials/Animated/RainbowNoise.h"
16#include "../Materials/Animated/RainbowSpiral.h"
17#include "../Materials/CombineMaterial.h"
18#include "../Materials/GradientMaterial.h"
19#include "../Materials/MaterialAnimator.h"
20#include "../Materials/NormalMaterial.h"
21#include "../Materials/StripeMaterial.h"
23#include "../Signals/FFTVoiceDetection.h"
24#include "../Sensors/MenuButtonHandler.h"
25#include "../Sensors/SerialSync.h"
26#include "../Sensors/MicrophoneFourier_MAX9814.h"
36 RGBColor gradientSpectrum[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)};
89 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::BlushEye), ProtoDR::BlushEye, 40, 0.0f, 1.0f);
90 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::HideBlush), ProtoDR::HideBlush, 10, 1.0f, 0.0f);
91 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::HideEyeBrow), ProtoDR::HideEyeBrow, 10, 0.0f, 1.0f);
92 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::OwOMouth), ProtoDR::OwOMouth, 60, 0.0f, 1.0f);
94 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::SadEye), ProtoDR::SadEye, 70, 0.0f, 1.0f);
95 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::SadEyeBrow), ProtoDR::SadEyeBrow, 80, 0.0f, 1.0f);
96 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::SadMouth), ProtoDR::SadMouth, 90, 0.0f, 1.0f);
98 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::FlatMouth), ProtoDR::FlatMouth, 50, 0.0f, 1.0f);
99 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::DeadEye), ProtoDR::DeadEye, 1, 0.0f, 1.0f);
101 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::HeartEye), ProtoDR::HeartEye, 30, 0.0f, 1.0f);
103 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::OwO), ProtoDR::OwO, 90, 0.0f, 1.0f);
105 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::AlphaGenCircle), ProtoDR::AlphaGenCircle, 90, 0.0f, 1.0f);
106 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::AlphaGenSquare), ProtoDR::AlphaGenSquare, 90, 0.0f, 1.0f);
107 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::HideAll), ProtoDR::HideAll, 90, 0.0f, 1.0f);
109 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::NewFins), ProtoDR::NewFins, 90, 0.0f, 1.0f);
110 eEA.
AddParameter(
pM.GetMorphWeightReference(ProtoDR::AngryEyeMouth), ProtoDR::AngryEyeMouth, 90, 0.0f, 1.0f);
217 scene.AddObject(
pM.GetObject());
218 scene.AddObject(
spyro.GetObject());
238 MenuButtonHandler::Initialize(15, 13, 1000);
438 pM.SetMorphWeight(ProtoDR::HideSecondEye, 0.0f);
474 pM.SetMorphWeight(ProtoDR::HideSecondEye, 0.0f);
510 pM.SetMorphWeight(ProtoDR::HideSecondEye, 0.0f);
522 pM.GetObject()->Disable();
523 spyro.GetObject()->Enable();
530 spyro.GetObject()->ResetVertices();
532 spyro.GetObject()->GetTransform()->SetRotation(rotation);
533 spyro.GetObject()->GetTransform()->SetScale(
Vector3D(sx, sx, sx));
534 spyro.GetObject()->GetTransform()->SetPosition(
Vector3D(0.0f, 30.0f, 600.0f));
536 spyro.GetObject()->UpdateTransform();
539 spyro.GetObject()->SetMaterial(&
spyro.material);
575 pM.SetMorphWeight(ProtoDR::HideSecondEye, 1.0f);
615 pM.SetMorphWeight(ProtoDR::HideSecondEye, 0.0f);
655 pM.SetMorphWeight(ProtoDR::HideSecondEye, 0.0f);
671 return pM.GetObject();
677 if(MenuButtonHandler::UseMicrophone()){
695 pM.GetObject()->Enable();
696 spyro.GetObject()->Disable();
699 float x = sinf(ratio * 3.14159f / 180.0f * 360.0f * 2.0f) * 3.0f;
700 float y = cosf(ratio * 3.14159f / 180.0f * 360.0f * 3.0f) * 3.0f;
726 ratio = fmod(ratio -
offset, 1.0f);
733 uint8_t mode = MenuButtonHandler::GetFaceState();
741 ratio = fmod(ratio -
offset, 1.0f);
746 else if (mode == 1)
OwO();
747 else if (mode == 2)
Sad();
748 else if (mode == 3)
Dead();
749 else if (mode == 4)
Heart();
777 pM.GetObject()->GetTransform()->SetRotation(
Vector3D(0, 180.0f, 0.0f));
778 pM.GetObject()->GetTransform()->SetPosition(
Vector3D(x, y, 600.0f));
779 pM.GetObject()->GetTransform()->Scale(
Vector3D(1.0f, 1.0f, 1.0f));
781 pM.GetObject()->UpdateTransform();
Declares the EasyEaseAnimator template class for advanced animation easing.
Declares the KeyFrameTrack template class for managing keyframe-based animations.
void SpyroDisplay(float ratio, bool normal)
KeyFrameTrack< 1, 10 > botFinLR2
NormalMaterial normalMaterial
void Initialize() override
SimpleMaterial redMaterial
KeyFrameTrack< 1, 5 > mouth
void UpdateKeyFrameTracks()
RainbowSpiral rainbowSpiral
SimpleMaterial blackMaterial
SimpleMaterial blueMaterial
MaterialAnimator< 7 > materialAnimator
KeyFrameTrack< 1, 10 > botFinLR4
KeyFrameTrack< 1, 10 > botFinLR1
KeyFrameTrack< 1, 10 > botFinLR3
KeyFrameTrack< 1, 10 > blink
KeyFrameTrack< 1, 5 > topFinGap
FunctionGenerator fGenMatOpacity
FunctionGenerator fGenMatPeriod
FunctionGenerator fGenMatPos
FunctionGenerator fGenScale
KeyFrameTrack< 1, 5 > topFinInner
FunctionGenerator fGenRotation
EasyEaseAnimator< 30 > eEA
RGBColor gradientSpectrum[6]
void FadeIn(float stepRatio) override
void SpectrumAnalyzerDisplay()
void FadeOut(float stepRatio) override
void AddBotFinKeyFrames()
RainbowNoise rainbowNoise
KeyFrameTrack< 1, 5 > topFinOuter
void AddTopFinKeyFrames()
void Update(float ratio) override
void AddMidFinKeyFrames()
KeyFrameTrack< 1, 5 > midFin
FFTVoiceDetection< 128 > voiceDetection
void AudioReactiveGradientDisplay()
FunctionGenerator fGenMatWidth
KeyFrameTrack< 1, 10 > botFinLR5
FunctionGenerator fGenMatSize
FunctionGenerator fGenMatAmplitude
GradientMaterial< 6 > gradientMat
AudioReactiveGradient aRG
A material class for creating an audio-reactive gradient effect.
void SetPosition(Vector2D offset)
Sets the position of the gradient.
void Update(float *readData)
Updates the gradient based on new audio data.
void SetRotation(float angle)
Sets the rotation angle of the gradient.
void SetHueAngle(float hueAngle)
Sets the hue angle for color adjustments.
A template class for implementing advanced animation easing.
void AddParameterFrame(uint16_t dictionaryValue, float value) override
Adds a single frame value for a parameter.
void Update() override
Updates the animator, advancing all animations.
void AddParameter(float *parameter, uint16_t dictionaryValue, uint16_t frames, float basis, float goal) override
Adds a parameter to the animator.
Encapsulates a 3D rotation using Euler angles and a specific order of application.
Detects visemes based on FFT voice analysis.
void Update(float *peaks, float maxFrequency)
Updates the viseme probabilities based on new FFT data.
A class to generate various waveform functions with customizable parameters.
float Update()
Updates and calculates the next value of the waveform.
Creates a customizable gradient material for rendering.
@ Cosine
Smooth cosine interpolation.
A template class for managing animations with multiple parameters and keyframes.
void AddParameter(float *parameter)
Adds a parameter to the track.
void Play()
Resumes the animation.
void Reset()
Resets the animation track to its initial state.
void AddKeyFrame(float time, float value)
Adds a keyframe to the track.
void Pause()
Pauses the animation.
float Update()
Updates the animation track and computes the new parameter value.
Animates transitions and blends between multiple materials.
void AddMaterial(Material::Method method, Material *material, uint16_t frames, float minOpacity, float maxOpacity)
Adds a material to the animation with specified properties.
void SetBaseMaterial(Material::Method method, Material *material)
Sets the base material for the animation.
void AddMaterialFrame(Material &material, float opacity)
Adds a specific frame for a material in the animation.
void Update()
Updates the animator, advancing the transitions.
@ Lighten
Chooses the lighter color.
@ Add
Adds colors together.
@ Replace
Replaces the base color.
static T Map(T value, T inLow, T inMax, T outMin, T outMax)
Maps a value from one range to another.
static float GetCurrentMagnitude()
Retrieves the current signal magnitude.
static float GetSampleRate()
Retrieves the current sampling rate.
static float * GetFourierFiltered()
Retrieves the filtered FFT output data.
static void Initialize(uint8_t pin, uint32_t sampleRate, float minDB, float maxDB)
Initializes the microphone and FFT system with basic parameters.
static void Update()
Updates the microphone system, processing new samples and performing FFT.
A material that visualizes surface normals as RGB colors.
Represents a 3D object with geometry, material, and transformation data.
A mathematical construct representing a rotation in 3D space.
Represents an RGB color and provides methods for manipulation.
A dynamic material that creates a rainbow effect using simplex noise.
void Update(float ratio)
Updates the material animation based on the time ratio.
A dynamic material creating a colorful rainbow spiral animation.
void Update(float ratio)
Updates the material animation based on the time ratio.
Handles 3D rotations and conversions between various rotation representations.
Quaternion GetQuaternion()
Gets the quaternion representation of the rotation.
static void SetMouthMove(float ratio)
static void SetMode(uint8_t mode)
static void SetRatio(float ratio)
static float GetMouthMove()
A material that applies a single, solid RGB color to surfaces.
A material that visualizes audio data as a spectrum.
void SetMirrorYState(bool state)
Sets the mirroring state for the visualization.
void Update(float *readData)
Updates the spectrum visualization with new audio data.
void SetFlipYState(bool state)
Sets the flipping state for the visualization.
void SetRotation(float angle)
Sets the rotation angle of the visualization.
void SetHueAngle(float hueAngle)
Sets the hue adjustment angle for the spectrum colors.
Generates striped patterns with configurable properties.
void SetStripeWidth(float stripeWidth)
Sets the stripe width.
void SetPositionOffset(Vector2D positionOffset)
Sets the position offset for the pattern.
void SetRotationAngle(float rotationAngle)
Sets the rotation angle for the pattern.
void SetWaveAmplitude(float waveAmplitude)
Sets the wave amplitude for the sinusoidal effect.
void SetWavePeriod(float wavePeriod)
Sets the wave period for the sinusoidal effect.
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
const EulerOrder EulerOrderXZYS
Order: X → Z → Y, static frame.