11#include "../Templates/Project.h"
12#include "../../Animation/KeyFrameTrack.h"
13#include "../../Animation/EasyEaseAnimator.h"
14#include "../../Assets/Models/OBJ/Background.h"
15#include "../../ExternalDevices/InputDevices/Menu/Menu.h"
16#include "../../ExternalDevices/Sensors/APDS9960.h"
17#include "../../ExternalDevices/Displays/SSD1306.h"
18#include "../../ExternalDevices/Sensors/Microphone/MicrophoneFourier_MAX9814.h"
19#include "../../ExternalDevices/OutputDevices/FanController.h"
21#include "../../Scene/Materials/Utils/MaterialAnimator.h"
22#include "../../Scene/Materials/Static/SimpleMaterial.h"
23#include "../../Scene/Materials/Animated/FlowNoise.h"
24#include "../../Scene/Materials/Animated/RainbowNoise.h"
25#include "../../Scene/Materials/Animated/RainbowSpiral.h"
26#include "../../Scene/Materials/Animated/HorizontalRainbow.h"
27#include "../../Scene/Materials/Animated/SpectrumAnalyzer.h"
28#include "../../Scene/Materials/Animated/AudioReactiveGradient.h"
29#include "../../Scene/Materials/Animated/Oscilloscope.h"
31#include "../../Animation/AnimationTracks/BlinkTrack.h"
32#include "../../Utils/Signals/FunctionGenerator.h"
33#include "../../ExternalDevices/Sensors/Microphone/Utils/FFTVoiceDetection.h"
34#include "../../Scene/Objects/ObjectAlign.h"
36#include "../../Utils/Time/TimeStep.h"
38#include "../UserConfiguration.h"
354 void AlignObjectsFace(
Object3D** objects, uint8_t objectCount,
float rotation = 0.0f,
float margin = 2.0f,
bool mirror =
true);
392 void AlignObjectsRear(
Object3D** objects, uint8_t objectCount,
float rotation = 0.0f,
float margin = 2.0f,
bool mirror =
true);
445 void AddParameter(uint8_t index,
float* parameter, uint16_t transitionFrames,
447 bool invertDirection =
false);
478 float minOpacity = 0.0f,
float maxOpacity = 1.0f);
503 float minOpacity = 0.0f,
float maxOpacity = 1.0f);
A class for managing the Adafruit APDS9960 sensor.
A material class for creating an audio-reactive gradient effect.
A template class for animating eye blinking using keyframes.
Manages multiple CameraBase objects.
Abstract base class for representing a color with operations for modification and interpolation.
Base class for managing brightness and display operations of lighting controllers.
A template class for implementing advanced animation easing.
Detects visemes based on FFT voice analysis.
Manages PWM-based fan speed control.
A dynamic simplex noise gradient material for a flowing effect.
A class to generate various waveform functions with customizable parameters.
Creates a customizable gradient material for rendering.
Renders and displays information on an SSD1306/SH1106 display.
A dynamic horizontal rainbow gradient material.
InterpolationMethod
Enumeration of interpolation methods for animations.
@ Overshoot
Interpolation with overshooting behavior.
Animates transitions and blends between multiple materials.
Abstract base class for rendering materials.
Method
Defines blending methods for combining colors.
Represents a 3D object with geometry, material, and transformation data.
Handles aligning and transforming 3D objects to fit within specified 2D camera bounds.
A dynamic oscilloscope material for visualizing audio signals.
Manages animations, rendering, and display operations.
CameraManager * cameras
Pointer to the CameraManager for managing cameras.
Controller * controller
Pointer to the Controller for controlling the display.
A default project template that includes functionality for an analog microphone, APDS9960 boop sensor...
void SetMenuWiggleSpeed(float multiplierX, float multiplierY, float multiplierR)
Adjusts the menu's wiggle speed along X, Y, and rotation.
SimpleMaterial greenMaterial
Solid green material.
FunctionGenerator fGenMatYMove
BlinkTrack< 2 > blink
Blink track handler.
uint8_t buttonPin
Pin for the button input.
SpectrumAnalyzer sA
Audio-reactive materials.
Vector3D GetWiggleOffset()
Computes and returns a Vector3D offset for a "wiggle" effect using function generators.
uint8_t offsetFaceInd
Index for generic face offset in EasyEaseAnimator.
void Initialize() override
Initializes the ProtogenProject, setting up sensors, menus, and hardware.
SimpleMaterial redMaterial
Solid red material.
virtual void SpectrumAnalyzerCallback()=0
Callback invoked when the Spectrum Analyzer face is enabled/updated.
void UpdateKeyFrameTracks()
Updates any keyframe tracks (e.g., blink track).
void SetCameraMain(Vector2D min, Vector2D max)
Sets the camera bounds for the main (front) view.
void EnableBlinking()
Enables blinking (resets and plays the blink track).
RainbowSpiral rainbowSpiral
Spiral rainbow animated material.
bool isBooped
Flag to indicate if the APDS9960 sensor has detected a "boop".
SimpleMaterial blackMaterial
Solid black material.
SimpleMaterial blueMaterial
Solid blue material.
void AudioReactiveGradientFace()
Enables the Audio Reactive Gradient on the face, updating offsets and calling callbacks.
virtual void AudioReactiveGradientCallback()=0
Callback invoked when the Audio Reactive Gradient face is enabled/updated.
FanController fanController
Fan controller for controlling a fan's PWM.
void SetMenuOffset(Vector2D offset)
Sets the menu's position offset.
void AlignObjectsFace(Object3D **objects, uint8_t objectCount, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns multiple Object3D objects to the "face" camera bounds with scaling.
void SetMenuSize(Vector2D size)
Sets the menu's size.
float xOffset
Offsets used for small "wiggle" or motion in the scene.
SimpleMaterial yellowMaterial
Solid yellow material.
bool blinkSet
Flag to indicate if the blink parameter has been set.
void UpdateFFTVisemes()
Updates FFT-based visemes for voice detection and mouth shape animations.
void AlignObjectNoScaleRear(Object3D *obj, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns a single Object3D to the rear camera bounds without scaling.
void AddBackgroundMaterialFrame(Color color, float opacity=0.8f)
Adds a material frame to the background from a color enum.
float yOffset
Y-axis offset.
void OscilloscopeFace()
Enables the Oscilloscope on the face, updating offsets and calling callbacks.
Vector2D camMaxRear
Rear camera maximum bounds.
float offsetFaceARG
Offset for AudioReactiveGradient face.
void UpdateFace(float ratio)
Updates the face's rendered content, reading any user input and applying changes.
void AlignObjectRear(Object3D *obj, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns a single Object3D to the rear camera bounds with scaling.
void SetMaterialColor()
Sets the material color based on menu selection, applying color changes.
MaterialAnimator< 20 > backgroundMaterial
Handles layering of background materials.
FlowNoise flowNoise
Noise-based animated material.
void SetWiggleSpeed(float multiplier)
Sets the overall wiggle speed for both X and Y function generators.
Vector2D camMin
Minimum and maximum bounds for the primary (front) camera view.
EasyEaseAnimator< 60 > eEA
Animator that eases parameter transitions.
GradientMaterial< 2 > gradientMat
bool IsBooped()
Checks if the sensor has detected a boop.
float offsetFaceSA
Offset for SpectrumAnalyzer face.
void SpectrumAnalyzerFace()
Enables the Spectrum Analyzer on the face, updating offsets and calling callbacks.
Background background
Background object and associated 3D model.
void SetBaseMaterial(Material *material)
Sets the base material for the face material animator.
void AddParameter(uint8_t index, float *parameter, uint16_t transitionFrames, IEasyEaseAnimator::InterpolationMethod interpolationMethod=IEasyEaseAnimator::InterpolationMethod::Overshoot, bool invertDirection=false)
Adds a parameter to the EasyEaseAnimator for interpolation.
void SetMaterialLayers()
Sets up the initial layering of materials for both the face and background.
void AddMaterial(Material::Method method, Material *material, uint16_t frames=20, float minOpacity=0.0f, float maxOpacity=1.0f)
Adds a new material to the face's MaterialAnimator with given parameters.
ObjectAlign objAOther
Generic alignment object.
APDS9960 boop
Gesture sensor used for detecting "boops.".
float offsetFace
Facial offset parameters for layering advanced materials (e.g., Spectrum Analyzer).
void DisableBlinking()
Disables blinking (pauses and resets the blink track).
MaterialAnimator< 20 > materialAnimator
Material animators for face and background layering.
SimpleMaterial orangeMaterial
Solid orange material.
void AlignObjectFace(Object3D *obj, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns a single Object3D to the "face" camera bounds with scaling.
void AlignObjectsNoScale(Vector2D min, Vector2D max, Object3D **objects, uint8_t objectCount, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns multiple Object3D objects without scaling.
uint8_t faceCount
Total number of faces available (e.g., for UI or animations).
Vector2D cameraSize
The size of the camera used for rendering calculations.
void AlignObjectNoScale(Vector2D min, Vector2D max, Object3D *obj, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns a single Object3D without scaling.
float GetFaceScale()
Computes the face scaling based on a user-defined face size.
FunctionGenerator fGenMatXMove
Function generators for X/Y wiggle movements.
void AddViseme(Viseme::MouthShape visemeName, float *parameter)
Adds a viseme parameter to the animator (for mouth shapes).
void SetCameraRear(Vector2D min, Vector2D max)
Sets the camera bounds for the rear view.
SimpleMaterial purpleMaterial
Solid purple material.
ObjectAlign objA
Object alignment for the front, rear, and an additional alignment object.
float offsetFaceOSC
Offset for Oscilloscope face.
@ CBASE
Base or default color.
@ CRAINBOWNOISE
Flow noise (rainbow noise).
@ CHORIZONTALRAINBOW
Horizontal rainbow effect.
@ CRAINBOW
Rainbow spiral.
uint8_t offsetFaceIndSA
Index for SpectrumAnalyzer offset in EasyEaseAnimator.
HorizontalRainbow hRainbow
Horizontal rainbow animated material.
TimeStep frameLimiter
A TimeStep object to limit frames (e.g., to 120 FPS).
FFTVoiceDetection< 128 > voiceDetection
Voice detection system based on FFT data.
HeadsUpDisplay hud
Heads-up display (HUD) for the face overlay or additional data.
void AddMaterialFrame(Color color, float opacity=0.8f)
Adds a new material frame to the face's MaterialAnimator from a color enum.
ObjectAlign objARear
Alignment for the rear camera.
ObjectAlign * GetObjectAlignFace()
Gets the ObjectAlign instance for the face camera.
RGBColor gradientSpectrum[2]
Gradient used for color transitions.
Vector2D camMinRear
Minimum and maximum bounds for the rear camera view.
void HideFace()
Hides the face by setting its offset parameter.
virtual void OscilloscopeCallback()=0
Callback invoked when the Oscilloscope face is enabled/updated.
virtual void LinkControlParameters()=0
Links external or user-defined control parameters (pure virtual to be implemented).
void AlignObjectNoScaleFace(Object3D *obj, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns a single Object3D to the "face" camera bounds without scaling.
uint8_t offsetFaceIndOSC
Index for Oscilloscope offset in EasyEaseAnimator.
void AddBlinkParameter(float *blinkParameter)
Adds a float parameter to the blink track for controlling blinking.
Material * GetBackgroundMaterial()
Retrieves the current background material animator.
ObjectAlign * GetObjectAlignRear()
Gets the ObjectAlign instance for the rear camera.
void AlignObjectsNoScaleRear(Object3D **objects, uint8_t objectCount, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns multiple Object3D objects to the rear camera bounds without scaling.
void LinkParameters()
Links internal parameters to the EasyEaseAnimator or other controllers.
uint8_t microphonePin
Pin assignments and face count.
void AlignObjectsRear(Object3D **objects, uint8_t objectCount, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns multiple Object3D objects to the rear camera bounds with scaling.
Vector2D camMax
Front camera maximum bounds.
void AddParameterFrame(uint16_t ProjectIndex, float target)
Adds a frame target to a previously added parameter.
Transform GetAlignmentTransform(Vector2D min, Vector2D max, Object3D *obj, float rotation=0.0f, float margin=2.0f)
Computes a transform for aligning a single Object3D within the given bounds.
Material * GetFaceMaterial()
Retrieves the current face material animator.
void AlignObjects(Vector2D min, Vector2D max, Object3D **objects, uint8_t objectCount, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns multiple Object3D objects, applying scaling.
SimpleMaterial whiteMaterial
Solid white material.
uint8_t offsetFaceIndARG
Index for AudioReactiveGradient offset in EasyEaseAnimator.
ObjectAlign * GetObjectAlign()
Gets the generic ObjectAlign instance.
void AddBackgroundMaterial(Material::Method method, Material *material, uint16_t frames=20, float minOpacity=0.0f, float maxOpacity=1.0f)
Adds a new material to the background's MaterialAnimator with given parameters.
void AlignObjectsNoScaleFace(Object3D **objects, uint8_t objectCount, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns multiple Object3D objects to the "face" camera bounds without scaling.
AudioReactiveGradient aRG
void AlignObject(Vector2D min, Vector2D max, Object3D *obj, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns a single Object3D within the given bounds, applying scaling.
A mathematical construct representing a rotation in 3D space.
Represents an RGB color and provides methods for manipulation.
A dynamic material creating a colorful rainbow spiral animation.
A material that applies a single, solid RGB color to surfaces.
A material that visualizes audio data as a spectrum.
Provides a mechanism to trigger actions at a specified frequency.
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.
MouthShape
Enumerates the possible mouth shapes for viseme detection.