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()) {
98 }
99
100 hud.SetEffect(Menu::GetEffect());// Pull Effect from menu and store reference in hud for observing data
101 hud.Update();
102 this->scene.SetEffect(&hud);// Use HUD as effect for overlay/data extraction
103
104 voiceDetection.SetThreshold(map(Menu::GetMicLevel(), 0, 10, 1000, 50));
106
108
109 sA.SetHueAngle(ratio * 360.0f * 4.0f);
112
113 aRG.SetRadius((xOffset + 2.0f) * 2.0f + 25.0f);
114 aRG.SetSize(Vector2D((xOffset + 2.0f) * 10.0f + 50.0f, (xOffset + 2.0f) * 10.0f + 50.0f));
115 aRG.SetHueAngle(ratio * 360.0f * 8.0f);
116 aRG.SetRotation(ratio * 360.0f * 2.0f);
117
118 oSC.SetHueAngle(ratio * 360.0f * 8.0f);
119
121 RGBColor hueFront = RGBColor(255, 0, 0).HueShift(Menu::GetHueF() * 36);
122 RGBColor hueBack = RGBColor(255, 0, 0).HueShift(Menu::GetHueB() * 36);
123
124 gradientSpectrum[0] = hueFront;
125 gradientSpectrum[1] = hueBack;
127
128 flowNoise.SetGradient(hueFront, 0);
129 flowNoise.SetGradient(hueBack, 1);
130
132
133 eEA.Update();
134
135 flowNoise.Update(ratio);
136 rainbowSpiral.Update(ratio);
137 hRainbow.Update(ratio);
140
141 uint8_t faceSize = Menu::GetFaceSize();
142 float scale = Menu::ShowMenu() * 0.6f + 0.4f;
143 float faceSizeOffset = faceSize * (cameraSize.X / 20.0f);// /2 for min of half size, /10 for 10 face size options
144 float faceSizeMaxX = cameraSize.X / 2.0f;
145
146 float xMaxCamera = cameraSize.X - faceSizeMaxX + faceSizeOffset;
147
148 aRG.SetPosition(Vector2D(xMaxCamera / 2.0f + xOffset * 4.0f, cameraSize.Y / 2.0f + yOffset * 4.0f));
149
151}
152
153
155 this->camMin = min;
156 this->camMax = max;
157
160}
161
169
170Transform ProtogenProject::GetAlignmentTransform(Vector2D min, Vector2D max, Object3D* obj, float rotation, float margin){
173
175 objAOther.SetEdgeMargin(margin);
176
177 return objAOther.GetTransform(obj);
178}
179
180Transform ProtogenProject::GetAlignmentTransform(Vector2D min, Vector2D max, Object3D** objects, uint8_t objectCount, float rotation, float margin){
183
185 objAOther.SetEdgeMargin(margin);
186
187 return objAOther.GetTransform(objects, objectCount);
188}
189
190void ProtogenProject::AlignObject(Vector2D min, Vector2D max, Object3D* obj, float rotation, float margin, bool mirror){
193
195 objAOther.SetEdgeMargin(margin);
197
198 objAOther.SetMirrorX(mirror);
199}
200
201void ProtogenProject::AlignObjects(Vector2D min, Vector2D max, Object3D** objects, uint8_t objectCount, float rotation, float margin, bool mirror){
204
206 objAOther.SetEdgeMargin(margin);
207 objAOther.AlignObjects(objects, objectCount);
208
209 objAOther.SetMirrorX(mirror);
210}
211
212void ProtogenProject::AlignObjectNoScale(Vector2D min, Vector2D max, Object3D* obj, float rotation, float margin, bool mirror){
215
217 objAOther.SetEdgeMargin(margin);
219
220 objAOther.SetMirrorX(mirror);
221}
222
223void ProtogenProject::AlignObjectsNoScale(Vector2D min, Vector2D max, Object3D** objects, uint8_t objectCount, float rotation, float margin, bool mirror){
226
228 objAOther.SetEdgeMargin(margin);
229 objAOther.AlignObjectsNoScale(objects, objectCount);
230
231 objAOther.SetMirrorX(mirror);
232}
233
234void ProtogenProject::AlignObjectFace(Object3D* obj, float rotation, float margin, bool mirror){
235 objA.SetPlaneOffsetAngle(rotation);
236 objA.SetEdgeMargin(margin);
237 objA.AlignObject(obj);
238 objA.SetMirrorX(mirror);
239}
240
241void ProtogenProject::AlignObjectsFace(Object3D** objects, uint8_t objectCount, float rotation, float margin, bool mirror){
242 objA.SetPlaneOffsetAngle(rotation);
243 objA.SetEdgeMargin(margin);
244 objA.AlignObjects(objects, objectCount);
245 objA.SetMirrorX(mirror);
246}
247
248void ProtogenProject::AlignObjectNoScaleFace(Object3D* obj, float rotation, float margin, bool mirror){
249 objA.SetPlaneOffsetAngle(rotation);
250 objA.SetEdgeMargin(margin);
252 objA.SetMirrorX(mirror);
253}
254
255void ProtogenProject::AlignObjectsNoScaleFace(Object3D** objects, uint8_t objectCount, float rotation, float margin, bool mirror){
256 objA.SetPlaneOffsetAngle(rotation);
257 objA.SetEdgeMargin(margin);
258 objA.AlignObjectsNoScale(objects, objectCount);
259 objA.SetMirrorX(mirror);
260}
261
262void ProtogenProject::AlignObjectRear(Object3D* obj, float rotation, float margin, bool mirror){
264 objARear.SetEdgeMargin(margin);
266 objARear.SetMirrorX(mirror);
267}
268
269void ProtogenProject::AlignObjectsRear(Object3D** objects, uint8_t objectCount, float rotation, float margin, bool mirror){
271 objARear.SetEdgeMargin(margin);
272 objARear.AlignObjects(objects, objectCount);
273 objARear.SetMirrorX(mirror);
274}
275
276void ProtogenProject::AlignObjectNoScaleRear(Object3D* obj, float rotation, float margin, bool mirror){
278 objARear.SetEdgeMargin(margin);
280 objARear.SetMirrorX(mirror);
281}
282
283void ProtogenProject::AlignObjectsNoScaleRear(Object3D** objects, uint8_t objectCount, float rotation, float margin, bool mirror){
285 objARear.SetEdgeMargin(margin);
286 objARear.AlignObjectsNoScale(objects, objectCount);
287 objARear.SetMirrorX(mirror);
288}
289
290
294
298
302
304 uint8_t faceSize = Menu::GetFaceSize();
305
306 float xSizeRatio = 1.0f - 0.5f + faceSize * (1.0f / 20.0f);
307
308 return xSizeRatio;
309}
310
311void ProtogenProject::AddParameter(uint8_t index, float* parameter, uint16_t transitionFrames, IEasyEaseAnimator::InterpolationMethod interpolationMethod, bool invertDirection){
312 if(invertDirection){
313 eEA.AddParameter(parameter, index, transitionFrames, 1.0f, 0.0f);
314 }
315 else{
316 eEA.AddParameter(parameter, index, transitionFrames, 0.0f, 1.0f);
317 }
318
319 eEA.SetInterpolationMethod(index, interpolationMethod);
320}
321
322void ProtogenProject::AddViseme(Viseme::MouthShape visemeName, float* parameter){
323 eEA.AddParameter(parameter, visemeName + 100, 2, 0.0f, 1.0f);
324
326}
327
328void ProtogenProject::AddBlinkParameter(float* blinkParameter){
329 blink.AddParameter(blinkParameter);
330
331 blinkSet = true;
332}
333
334void ProtogenProject::AddParameterFrame(uint16_t ProjectIndex, float target){
335 eEA.AddParameterFrame(ProjectIndex, target);
336}
337
338void ProtogenProject::AddMaterial(Material::Method method, Material* material, uint16_t frames, float minOpacity, float maxOpacity){
339 materialAnimator.AddMaterial(method, material, frames, minOpacity, maxOpacity);
340}
341
342void ProtogenProject::AddMaterialFrame(Color color, float opacity){
343 switch(color){
344 case CYELLOW:
346 break;
347 case CORANGE:
349 break;
350 case CWHITE:
352 break;
353 case CGREEN:
355 break;
356 case CPURPLE:
358 break;
359 case CRED:
361 break;
362 case CBLUE:
364 break;
365 case CRAINBOW:
367 break;
368 case CRAINBOWNOISE:
370 break;
373 break;
374 case CBLACK:
376 break;
377 default:
378 break;
379 }
380}
381
382void ProtogenProject::AddMaterialFrame(Material& material, float opacity){
383 materialAnimator.AddMaterialFrame(material, opacity);
384}
385
386void ProtogenProject::AddBackgroundMaterial(Material::Method method, Material* material, uint16_t frames, float minOpacity, float maxOpacity){
387 backgroundMaterial.AddMaterial(method, material, frames, minOpacity, maxOpacity);
388}
389
391 switch(color){
392 case CYELLOW:
394 break;
395 case CORANGE:
397 break;
398 case CWHITE:
400 break;
401 case CGREEN:
403 break;
404 case CPURPLE:
406 break;
407 case CRED:
409 break;
410 case CBLUE:
412 break;
413 case CRAINBOW:
415 break;
416 case CRAINBOWNOISE:
418 break;
421 break;
422 case CBLACK:
424 break;
425 default:
426 break;
427 }
428}
429
431 backgroundMaterial.AddMaterialFrame(material, opacity);
432}
433
445
457
469
473
478
483
485 return isBooped;
486}
487
491
492void ProtogenProject::SetWiggleSpeed(float multiplier){
493 fGenMatXMove.SetPeriod(5.3f / multiplier);
494 fGenMatYMove.SetPeriod(6.7f / multiplier);
495}
496
497void ProtogenProject::SetMenuWiggleSpeed(float multiplierX, float multiplierY, float multiplierR){
498 Menu::SetWiggleSpeed(multiplierX, multiplierY, multiplierR);
499}
500
504
508
512
516
517ProtogenProject::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) {
518 this->camMin = camMin;
519 this->camMax = camMax;
520 this->microphonePin = microphonePin;
521 this->buttonPin = buttonPin;
522 this->faceCount = faceCount;
523
524 this->scene.AddObject(background.GetObject());
525
526 background.GetObject()->SetMaterial(&backgroundMaterial);
527
529
531
532 objA.SetCameraMax(camMax);
535
536 this->scene.EnableEffect();
537
538 cameraSize = camMax - camMin;
539
540 //sA.SetSize(cameraSize);
541 //sA.SetPosition(cameraSize / 2.0f);
542
543 //oSC.SetSize(cameraSize);
544 //oSC.SetPosition(cameraSize / 2.0f);
545
546
547 sA.SetSize(Vector2D(220.0f, 72.0f));
549
550 oSC.SetSize(Vector2D(220.0f, 72.0f));
552
555}
556
559
560 boop.Initialize(5);
561
562 hud.Initialize();
563
565
566 MicrophoneFourier::Initialize(microphonePin, 8000, 50.0f, 120.0f);//8KHz sample rate, 50dB min, 120dB max
567
568 #ifdef NEOTRELLISMENU
569 Menu::Initialize(faceCount);//NeoTrellis
570 #else
571 Menu::Initialize(faceCount, buttonPin, 500);//7 is number of faces
572 #endif
573}
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
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:311
void SetFaceMin(Vector2D faceMin)
Sets the minimum face rendering coordinates.
Definition SSD1306.cpp:222
void Initialize()
Initializes the display and related components.
Definition SSD1306.cpp:230
void SetFaceMax(Vector2D faceMax)
Sets the maximum face rendering coordinates.
Definition SSD1306.cpp:226
void Update()
Updates the display content based on the current state.
Definition SSD1306.cpp:281
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.
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.
@ 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.