ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
ProtogenProjectTemplate.cpp
Go to the documentation of this file.
2
9
13
23 materialAnimator.AddMaterial(Material::Replace, &flowNoise, 40, 0.15f, 1.0f);//layer 8
25 materialAnimator.AddMaterial(Material::Replace, &hRainbow, 40, 0.0f, 1.0f);//layer 10
30
41 backgroundMaterial.AddMaterial(Material::Replace, &hRainbow, 40, 0.0f, 1.0f);//layer 10
46}
47
51
68
70 switch(Menu::GetFaceColor()){
76 case 6: materialAnimator.AddMaterialFrame(redMaterial, 0.8f); break;
79 case 9: materialAnimator.AddMaterialFrame(flowNoise, 0.8f); break;
80 case 10: materialAnimator.AddMaterialFrame(hRainbow, 0.8f); break;
81 case 11: materialAnimator.AddMaterialFrame(blackMaterial, 0.8f); break;
82 default: break;
83 }
84}
85
86void ProtogenProject::UpdateFace(float ratio) {
87 while(!frameLimiter.IsReady()) delay(1);
88
89 Menu::Update(ratio);
90
92
95
96 if (Menu::UseBoopSensor()) {
99 }
100
101 hud.SetEffect(Menu::GetEffect());// Pull Effect from menu and store reference in hud for observing data
102 hud.Update();
103 this->scene.SetEffect(&hud);// Use HUD as effect for overlay/data extraction
104
105 voiceDetection.SetThreshold(map(Menu::GetMicLevel(), 0, 10, 1000, 50));
107
109
110 sA.SetHueAngle(ratio * 360.0f * 4.0f);
113
114 aRG.SetRadius((xOffset + 2.0f) * 2.0f + 25.0f);
115 aRG.SetSize(Vector2D((xOffset + 2.0f) * 10.0f + 50.0f, (xOffset + 2.0f) * 10.0f + 50.0f));
116 aRG.SetHueAngle(ratio * 360.0f * 8.0f);
117 aRG.SetRotation(ratio * 360.0f * 2.0f);
118
119 oSC.SetHueAngle(ratio * 360.0f * 8.0f);
120
122 RGBColor hueFront = RGBColor(255, 0, 0).HueShift(Menu::GetHueF() * 36);
123 RGBColor hueBack = RGBColor(255, 0, 0).HueShift(Menu::GetHueB() * 36);
124
125 gradientSpectrum[0] = hueFront;
126 gradientSpectrum[1] = hueBack;
128
129 flowNoise.SetGradient(hueFront, 0);
130 flowNoise.SetGradient(hueBack, 1);
131
133
134 eEA.Update();
135
136 flowNoise.Update(ratio);
137 rainbowSpiral.Update(ratio);
138 hRainbow.Update(ratio);
141
142 uint8_t faceSize = Menu::GetFaceSize();
143 float scale = Menu::ShowMenu() * 0.6f + 0.4f;
144 float faceSizeOffset = faceSize * (cameraSize.X / 20.0f);// /2 for min of half size, /10 for 10 face size options
145 float faceSizeMaxX = cameraSize.X / 2.0f;
146
147 float xMaxCamera = cameraSize.X - faceSizeMaxX + faceSizeOffset;
148
149 aRG.SetPosition(Vector2D(xMaxCamera / 2.0f + xOffset * 4.0f, cameraSize.Y / 2.0f + yOffset * 4.0f));
150
152}
153
154
156 this->camMin = min;
157 this->camMax = max;
158
161}
162
170
171Transform ProtogenProject::GetAlignmentTransform(Vector2D min, Vector2D max, Object3D* obj, float rotation, float margin){
174
176 objAOther.SetEdgeMargin(margin);
177
178 return objAOther.GetTransform(obj);
179}
180
181Transform ProtogenProject::GetAlignmentTransform(Vector2D min, Vector2D max, Object3D** objects, uint8_t objectCount, float rotation, float margin){
184
186 objAOther.SetEdgeMargin(margin);
187
188 return objAOther.GetTransform(objects, objectCount);
189}
190
191void ProtogenProject::AlignObject(Vector2D min, Vector2D max, Object3D* obj, float rotation, float margin, bool mirror){
194
196 objAOther.SetEdgeMargin(margin);
198
199 objAOther.SetMirrorX(mirror);
200}
201
202void ProtogenProject::AlignObjects(Vector2D min, Vector2D max, Object3D** objects, uint8_t objectCount, float rotation, float margin, bool mirror){
205
207 objAOther.SetEdgeMargin(margin);
208 objAOther.AlignObjects(objects, objectCount);
209
210 objAOther.SetMirrorX(mirror);
211}
212
213void ProtogenProject::AlignObjectNoScale(Vector2D min, Vector2D max, Object3D* obj, float rotation, float margin, bool mirror){
216
218 objAOther.SetEdgeMargin(margin);
220
221 objAOther.SetMirrorX(mirror);
222}
223
224void ProtogenProject::AlignObjectsNoScale(Vector2D min, Vector2D max, Object3D** objects, uint8_t objectCount, float rotation, float margin, bool mirror){
227
229 objAOther.SetEdgeMargin(margin);
230 objAOther.AlignObjectsNoScale(objects, objectCount);
231
232 objAOther.SetMirrorX(mirror);
233}
234
235void ProtogenProject::AlignObjectFace(Object3D* obj, float rotation, float margin, bool mirror){
236 objA.SetPlaneOffsetAngle(rotation);
237 objA.SetEdgeMargin(margin);
238 objA.AlignObject(obj);
239 objA.SetMirrorX(mirror);
240}
241
242void ProtogenProject::AlignObjectsFace(Object3D** objects, uint8_t objectCount, float rotation, float margin, bool mirror){
243 objA.SetPlaneOffsetAngle(rotation);
244 objA.SetEdgeMargin(margin);
245 objA.AlignObjects(objects, objectCount);
246 objA.SetMirrorX(mirror);
247}
248
249void ProtogenProject::AlignObjectNoScaleFace(Object3D* obj, float rotation, float margin, bool mirror){
250 objA.SetPlaneOffsetAngle(rotation);
251 objA.SetEdgeMargin(margin);
253 objA.SetMirrorX(mirror);
254}
255
256void ProtogenProject::AlignObjectsNoScaleFace(Object3D** objects, uint8_t objectCount, float rotation, float margin, bool mirror){
257 objA.SetPlaneOffsetAngle(rotation);
258 objA.SetEdgeMargin(margin);
259 objA.AlignObjectsNoScale(objects, objectCount);
260 objA.SetMirrorX(mirror);
261}
262
263void ProtogenProject::AlignObjectRear(Object3D* obj, float rotation, float margin, bool mirror){
265 objARear.SetEdgeMargin(margin);
267 objARear.SetMirrorX(mirror);
268}
269
270void ProtogenProject::AlignObjectsRear(Object3D** objects, uint8_t objectCount, float rotation, float margin, bool mirror){
272 objARear.SetEdgeMargin(margin);
273 objARear.AlignObjects(objects, objectCount);
274 objARear.SetMirrorX(mirror);
275}
276
277void ProtogenProject::AlignObjectNoScaleRear(Object3D* obj, float rotation, float margin, bool mirror){
279 objARear.SetEdgeMargin(margin);
281 objARear.SetMirrorX(mirror);
282}
283
284void ProtogenProject::AlignObjectsNoScaleRear(Object3D** objects, uint8_t objectCount, float rotation, float margin, bool mirror){
286 objARear.SetEdgeMargin(margin);
287 objARear.AlignObjectsNoScale(objects, objectCount);
288 objARear.SetMirrorX(mirror);
289}
290
291
295
299
303
305 uint8_t faceSize = Menu::GetFaceSize();
306
307 float xSizeRatio = 1.0f - 0.5f + faceSize * (1.0f / 20.0f);
308
309 return xSizeRatio;
310}
311
312void ProtogenProject::AddParameter(uint8_t index, float* parameter, uint16_t transitionFrames, IEasyEaseAnimator::InterpolationMethod interpolationMethod, bool invertDirection){
313 if(invertDirection){
314 eEA.AddParameter(parameter, index, transitionFrames, 1.0f, 0.0f);
315 }
316 else{
317 eEA.AddParameter(parameter, index, transitionFrames, 0.0f, 1.0f);
318 }
319
320 eEA.SetInterpolationMethod(index, interpolationMethod);
321}
322
323void ProtogenProject::AddViseme(Viseme::MouthShape visemeName, float* parameter){
324 eEA.AddParameter(parameter, visemeName + 100, 2, 0.0f, 1.0f);
325
327}
328
329void ProtogenProject::AddBlinkParameter(float* blinkParameter){
330 blink.AddParameter(blinkParameter);
331
332 blinkSet = true;
333}
334
335void ProtogenProject::AddParameterFrame(uint16_t ProjectIndex, float target){
336 eEA.AddParameterFrame(ProjectIndex, target);
337}
338
339void ProtogenProject::AddMaterial(Material::Method method, Material* material, uint16_t frames, float minOpacity, float maxOpacity){
340 materialAnimator.AddMaterial(method, material, frames, minOpacity, maxOpacity);
341}
342
343void ProtogenProject::AddMaterialFrame(Color color, float opacity){
344 switch(color){
345 case CYELLOW:
347 break;
348 case CORANGE:
350 break;
351 case CWHITE:
353 break;
354 case CGREEN:
356 break;
357 case CPURPLE:
359 break;
360 case CRED:
362 break;
363 case CBLUE:
365 break;
366 case CRAINBOW:
368 break;
369 case CRAINBOWNOISE:
371 break;
374 break;
375 case CBLACK:
377 break;
378 default:
379 break;
380 }
381}
382
383void ProtogenProject::AddMaterialFrame(Material& material, float opacity){
384 materialAnimator.AddMaterialFrame(material, opacity);
385}
386
387void ProtogenProject::AddBackgroundMaterial(Material::Method method, Material* material, uint16_t frames, float minOpacity, float maxOpacity){
388 backgroundMaterial.AddMaterial(method, material, frames, minOpacity, maxOpacity);
389}
390
392 switch(color){
393 case CYELLOW:
395 break;
396 case CORANGE:
398 break;
399 case CWHITE:
401 break;
402 case CGREEN:
404 break;
405 case CPURPLE:
407 break;
408 case CRED:
410 break;
411 case CBLUE:
413 break;
414 case CRAINBOW:
416 break;
417 case CRAINBOWNOISE:
419 break;
422 break;
423 case CBLACK:
425 break;
426 default:
427 break;
428 }
429}
430
432 backgroundMaterial.AddMaterialFrame(material, opacity);
433}
434
446
458
470
474
479
484
486 return isBooped;
487}
488
492
493void ProtogenProject::SetWiggleSpeed(float multiplier){
494 fGenMatXMove.SetPeriod(5.3f / multiplier);
495 fGenMatYMove.SetPeriod(6.7f / multiplier);
496}
497
498void ProtogenProject::SetMenuWiggleSpeed(float multiplierX, float multiplierY, float multiplierR){
499 Menu::SetWiggleSpeed(multiplierX, multiplierY, multiplierR);
500}
501
505
509
513
517
518ProtogenProject::ProtogenProject(CameraManager* cameras, Controller* controller, uint8_t numObjects, Vector2D camMin, Vector2D camMax, uint8_t microphonePin, uint8_t buttonPin, uint8_t faceCount) : Project(cameras, controller, numObjects + 1) {
519 this->camMin = camMin;
520 this->camMax = camMax;
521 this->microphonePin = microphonePin;
522 this->buttonPin = buttonPin;
523 this->faceCount = faceCount;
524
525 this->scene.AddObject(background.GetObject());
526
527 background.GetObject()->SetMaterial(&backgroundMaterial);
528
530
532
533 objA.SetCameraMax(camMax);
536
537 this->scene.EnableEffect();
538
539 cameraSize = camMax - camMin;
540
541 //sA.SetSize(cameraSize);
542 //sA.SetPosition(cameraSize / 2.0f);
543
544 //oSC.SetSize(cameraSize);
545 //oSC.SetPosition(cameraSize / 2.0f);
546
547
548 sA.SetSize(Vector2D(220.0f, 72.0f));
550
551 oSC.SetSize(Vector2D(220.0f, 72.0f));
553
556}
557
560
563
564 hud.Initialize();
565
567
568 MicrophoneFourier::Initialize(microphonePin, 8000, 50.0f, 120.0f);//8KHz sample rate, 50dB min, 120dB max
569
570 #ifdef NEOTRELLISMENU
571 Menu::Initialize(faceCount);//NeoTrellis
572 #else
573 Menu::Initialize(faceCount, buttonPin, 500);//7 is number of faces
574 #endif
575}
Contains the class definition for ProtogenProject, a default project template for handling microphone...
static bool Initialize(uint8_t threshold)
Initializes the APDS9960 sensor.
Definition APDS9960.cpp:14
static bool isBooped()
Checks if the sensor is "booped" (close proximity detected).
Definition APDS9960.cpp:43
static bool Initialize(uint8_t threshold)
Initializes the APDS9999 sensor.
Definition APDS9999.cpp:14
static bool isBooped()
Checks if the sensor is "booped" (close proximity detected).
Definition APDS9999.cpp:47
void AddParameter(float *parameter)
Adds a parameter to the animation track.
void Play()
Starts or resumes playback of the animation track.
void Reset()
Resets the animation track to its initial state.
void Pause()
Pauses playback of the animation track.
float Update()
Updates the animation track and returns the current parameter value.
void SetRadius(float radius)
Sets the radius for circular gradient patterns.
void SetPosition(Vector2D offset)
Sets the position of the gradient.
void Update(float *readData)
Updates the gradient based on new audio data.
void SetSize(Vector2D size)
Sets the size 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.
Manages multiple CameraBase objects.
Abstract base class for representing a color with operations for modification and interpolation.
Definition Color.h:20
Base class for managing brightness and display operations of lighting controllers.
Definition Controller.h:25
virtual void Initialize()=0
Initializes the controller.
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 SetInterpolationMethod(uint16_t dictionaryValue, InterpolationMethod interpMethod) override
Sets the interpolation method for a specific parameter.
void AddParameter(float *parameter, uint16_t dictionaryValue, uint16_t frames, float basis, float goal) override
Adds a parameter to the animator.
float GetViseme(MouthShape viseme)
Retrieves the probability of a specific viseme.
void SetThreshold(float threshold)
Sets the threshold for formant calculations.
void Update(float *peaks, float maxFrequency)
Updates the viseme probabilities based on new FFT data.
void Initialize()
Initializes the fan controller by setting up the pin for PWM output.
void SetPWM(uint8_t pwm)
Sets the PWM value to control the fan speed.
void SetGradient(RGBColor color, uint8_t colorIndex)
Sets a specific gradient color.
Definition FlowNoise.cpp:3
void Update(float ratio)
Updates the material's state based on the provided time ratio.
Definition FlowNoise.cpp:8
void SetPeriod(float period)
Sets the period of the waveform.
float Update()
Updates and calculates the next value of the waveform.
void UpdateGradient(RGBColor *rgbColors)
Updates the colors of the gradient.
void SetEffect(Effect *effect)
Sets the sub-effect to be applied to the display.
Definition SSD1306.cpp:315
void SetFaceMin(Vector2D faceMin)
Sets the minimum face rendering coordinates.
Definition SSD1306.cpp:226
void Initialize()
Initializes the display and related components.
Definition SSD1306.cpp:234
void SetFaceMax(Vector2D faceMax)
Sets the maximum face rendering coordinates.
Definition SSD1306.cpp:230
void Update()
Updates the display content based on the current state.
Definition SSD1306.cpp:285
void Update(float ratio)
Updates the gradient animation based on the provided time ratio.
InterpolationMethod
Enumeration of interpolation methods for animations.
@ Linear
Straight linear interpolation.
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.
Abstract base class for rendering materials.
Definition Material.h:27
Method
Defines blending methods for combining colors.
Definition Material.h:33
@ Add
Adds colors together.
Definition Material.h:35
@ Replace
Replaces the base color.
Definition Material.h:44
static uint8_t GetFaceColor()
Gets the current face color index.
Definition Menu.cpp:453
static uint8_t GetMicLevel()
Gets the current microphone level.
Definition Menu.cpp:417
static void SetPositionOffset(Vector2D positionOffset)
Sets an additional offset to be added on top of the base position.
Definition Menu.cpp:276
static float ShowMenu()
Returns how much of the menu is shown, typically normalized (0.0 to 1.0).
Definition Menu.cpp:494
static void SetWiggleSpeed(float wiggleSpeedX, float wiggleSpeedY, float wiggleSpeedR)
Sets the speed multipliers for X-axis, Y-axis, and rotational wiggle.
Definition Menu.cpp:253
static uint8_t GetFanSpeed()
Gets the current fan speed index.
Definition Menu.cpp:489
static Material * GetMaterial()
Provides a pointer to the material used for rendering the menu text.
Definition Menu.cpp:155
static uint8_t MirrorSpectrumAnalyzer()
Checks if the spectrum analyzer mirroring is toggled on or off.
Definition Menu.cpp:435
static uint8_t GetFaceSize()
Gets the current face size.
Definition Menu.cpp:444
static void Initialize(uint8_t faceCount, uint8_t pin, uint16_t holdingTime, Vector2D size=Vector2D(240, 50))
Initializes the Menu using a face count, input pin, holding time, and size.
Definition Menu.cpp:102
static uint8_t GetHueF()
Gets the front hue value.
Definition Menu.cpp:462
static void SetSize(Vector2D size)
Sets the overall menu size and updates the text engine accordingly.
Definition Menu.cpp:259
static uint8_t UseMicrophone()
Checks if the microphone usage is toggled on or off.
Definition Menu.cpp:408
static uint8_t UseBoopSensor()
Checks if the boop sensor usage is toggled on or off.
Definition Menu.cpp:426
static void Update(float ratio)
Updates the menu each frame, handling transitions, wiggle effects, and text generation.
Definition Menu.cpp:208
static uint8_t GetHueB()
Gets the back hue value.
Definition Menu.cpp:471
static Effect * GetEffect()
Retrieves the current effect (post-processing) based on the menu setting.
Definition Menu.cpp:159
static float GetCurrentMagnitude()
Retrieves the current signal magnitude.
static float GetSampleRate()
Retrieves the current sampling rate.
static float * GetSamples()
Retrieves the raw input samples.
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.
Represents a 3D object with geometry, material, and transformation data.
Definition Object3D.h:28
Handles aligning and transforming 3D objects to fit within specified 2D camera bounds.
Definition ObjectAlign.h:24
void SetEdgeMargin(float edgeMargin)
Sets the margin to keep from the edges when aligning objects.
void AlignObjectNoScale(Object3D *obj)
Aligns a single Object3D within the camera bounds without applying the object's scaling factor.
@ Stretch
Attempt to scale the object(s) to fill the entire area.
Definition ObjectAlign.h:43
Transform GetTransform(Object3D *obj)
Computes the final Transform for aligning a single Object3D within the camera bounds.
void SetJustification(Justification jst)
Sets the justification mode for alignment.
void SetPlaneOffsetAngle(float offsetPlaneAngle)
Sets the additional rotation offset (plane offset angle), in degrees or radians, that will be applied...
void AlignObjectsNoScale(Object3D **objs, uint8_t numObjects)
Aligns multiple objects without applying the object's scaling factor.
void AlignObject(Object3D *obj)
Aligns a single Object3D within the camera bounds, including applying scale factors as necessary.
void SetCameraMax(Vector2D camMax)
Updates the maximum bounds for the 2D camera region.
void AlignObjects(Object3D **objs, uint8_t numObjects)
Aligns multiple objects within the camera bounds, including scale factors.
void SetMirrorX(bool mirrorX)
Enables or disables mirroring along the X-axis for the aligned objects.
void SetCameraMin(Vector2D camMin)
Updates the minimum bounds for the 2D camera region.
void SetPosition(Vector2D offset)
Sets the position of the oscilloscope visualization.
void SetSize(Vector2D size)
Sets the size of the oscilloscope visualization.
void Update(float *data)
Updates the oscilloscope visualization based on new audio data.
void SetHueAngle(float hueAngle)
Sets the hue angle for color adjustments.
Manages animations, rendering, and display operations.
Definition Project.h:31
Scene scene
The Scene object representing the rendered environment.
Definition Project.h:35
Controller * controller
Pointer to the Controller for controlling the display.
Definition Project.h:34
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.
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.
APDS9960 boop60
Gesture sensor used for detecting "boops.".
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.
@ 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.
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.
ProtogenProject(CameraManager *cameras, Controller *controller, uint8_t numObjects, Vector2D camMin, Vector2D camMax, uint8_t microphonePin, uint8_t buttonPin, uint8_t faceCount)
Constructs a ProtogenProject instance.
Represents an RGB color and provides methods for manipulation.
Definition RGBColor.h:23
RGBColor HueShift(const float &hueDeg)
Shifts the hue of the color by a specified angle in degrees.
Definition RGBColor.cpp:65
void Update(float ratio)
Updates the material animation based on the time ratio.
void SetEffect(Effect *effect)
Sets the screen-space effect for the scene.
Definition Scene.cpp:27
void AddObject(Object3D *object)
Adds a 3D object to the scene.
Definition Scene.cpp:31
void EnableEffect()
Enables the screen-space effect for the scene.
Definition Scene.cpp:15
void SetPosition(Vector2D offset)
Sets the position of the visualization area.
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 SetSize(Vector2D size)
Sets the size of the visualization area.
void SetHueAngle(float hueAngle)
Sets the hue adjustment angle for the spectrum colors.
bool IsReady()
Checks if the specified time interval has elapsed.
Definition TimeStep.cpp:11
Represents a 3D transformation including position, rotation, and scale.
Definition Transform.h:22
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Definition Vector2D.h:27
Vector2D Multiply(const Vector2D &vector) const
Multiplies this vector by another Vector2D component-wise.
Definition Vector2D.cpp:46
float X
The X-component of the 2D vector.
Definition Vector2D.h:29
float Y
The Y-component of the 2D vector.
Definition Vector2D.h:30
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26
MouthShape
Enumerates the possible mouth shapes for viseme detection.
@ ER
Mouth shape corresponding to the "ER" sound.
@ OO
Mouth shape corresponding to the "OO" sound.
@ AH
Mouth shape corresponding to the "AH" sound.
@ UH
Mouth shape corresponding to the "UH" sound.
@ AR
Mouth shape corresponding to the "AR" sound.
@ SS
Mouth shape corresponding to the "SS" sound (optional).
@ EE
Mouth shape corresponding to the "EE" sound.