ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
DrGonzoTest.h
Go to the documentation of this file.
1#pragma once
2
3#include "../Templates/ProtogenProjectTemplate.h"
4#include "../../Assets/Models/OBJ/DeltaDisplayBackground.h"
5#include "../../Assets/Models/FBX/NukudeFlat.h"
6#include "../../Assets/Models/FBX/Commissions/DrGonzoFace2.h"
7
8#include "../../Camera/CameraManager/Implementations/HUB75DeltaCameras.h"
9#include "../../Controller/HUB75Controller.h"
10
11//#define NEOTRELLISMENU
12
14private:
17 NukudeFace pM;
18 DrGonzoFace pM2;
19 DeltaDisplayBackground deltaDisplayBackground;
20
21 const __FlashStringHelper* faceArray[10] = {F("DEFAULT"), F("ANGRY"), F("DOUBT"), F("FROWN"), F("LOOKUP"), F("SAD"), F("AUDIO1"), F("AUDIO2"), F("AUDIO3")};
22
23 void LinkControlParameters() override {//Called from parent
24 AddParameter(NukudeFace::Anger, pM.GetMorphWeightReference(NukudeFace::Anger), 15);
25 AddParameter(NukudeFace::Sadness, pM.GetMorphWeightReference(NukudeFace::Sadness), 15, EasyEaseInterpolation::InterpolationMethod::Cosine);
26 AddParameter(NukudeFace::Surprised, pM.GetMorphWeightReference(NukudeFace::Surprised), 15);
27 AddParameter(NukudeFace::Doubt, pM.GetMorphWeightReference(NukudeFace::Doubt), 15);
28 AddParameter(NukudeFace::Frown, pM.GetMorphWeightReference(NukudeFace::Frown), 15);
29 AddParameter(NukudeFace::LookUp, pM.GetMorphWeightReference(NukudeFace::LookUp), 15);
30 AddParameter(NukudeFace::LookDown, pM.GetMorphWeightReference(NukudeFace::LookDown), 15);
31
32 AddParameter(NukudeFace::HideBlush, pM.GetMorphWeightReference(NukudeFace::HideBlush), 15, EasyEaseInterpolation::InterpolationMethod::Cosine, true);
33
34 AddViseme(Viseme::MouthShape::EE, pM.GetMorphWeightReference(NukudeFace::vrc_v_ee));
35 AddViseme(Viseme::MouthShape::AH, pM.GetMorphWeightReference(NukudeFace::vrc_v_aa));
36 AddViseme(Viseme::MouthShape::UH, pM.GetMorphWeightReference(NukudeFace::vrc_v_dd));
37 AddViseme(Viseme::MouthShape::AR, pM.GetMorphWeightReference(NukudeFace::vrc_v_rr));
38 AddViseme(Viseme::MouthShape::ER, pM.GetMorphWeightReference(NukudeFace::vrc_v_ch));
39 AddViseme(Viseme::MouthShape::OO, pM.GetMorphWeightReference(NukudeFace::vrc_v_oh));
40 AddViseme(Viseme::MouthShape::SS, pM.GetMorphWeightReference(NukudeFace::vrc_v_ss));
41
42 AddBlinkParameter(pM.GetMorphWeightReference(NukudeFace::Blink));
43 }
44
45 void Default(){}
46
47 void Angry(){
48 AddParameterFrame(NukudeFace::Anger, 1.0f);
50 }
51
52 void Sad(){
53 AddParameterFrame(NukudeFace::Sadness, 1.0f);
54 AddParameterFrame(NukudeFace::Frown, 1.0f);
56 }
57
58 void Surprised(){
59 AddParameterFrame(NukudeFace::Surprised, 1.0f);
60 AddParameterFrame(NukudeFace::HideBlush, 0.0f);
62 }
63
64 void Doubt(){
65 AddParameterFrame(NukudeFace::Doubt, 1.0f);
66 }
67
68 void Frown(){
69 AddParameterFrame(NukudeFace::Frown, 1.0f);
70 }
71
72 void LookUp(){
73 AddParameterFrame(NukudeFace::LookUp, 1.0f);
74 }
75
76 void LookDown(){
77 AddParameterFrame(NukudeFace::LookDown, 1.0f);
78 }
79
80public:
81 DrGonzoTest() : ProtogenProject(&cameras, &controller, 2, Vector2D(), Vector2D(192.0f, 94.0f), 22, 23, 9){
82 scene.AddObject(pM.GetObject());
84
85 pM.GetObject()->SetMaterial(GetFaceMaterial());
86 deltaDisplayBackground.GetObject()->SetMaterial(GetFaceMaterial());
87
89
91
92 SetWiggleSpeed(5.0f);
93 SetMenuWiggleSpeed(0.0f, 0.0f, 0.0f);
94 SetMenuOffset(Vector2D(17.5f, -3.0f));
95 SetMenuSize(Vector2D(192, 56));
96 }
97
98 void Update(float ratio) override {
99 pM.Reset();
100
101 uint8_t mode = Menu::GetFaceState();//change by button press
102
105
106 if (IsBooped() && mode != 6){
107 Surprised();
108 }
109 else{
110 if (mode == 0) Default();
111 else if (mode == 1) Angry();
112 else if (mode == 2) Doubt();
113 else if (mode == 3) Frown();
114 else if (mode == 4) LookUp();
115 else if (mode == 5) Sad();
116 else if (mode == 6) {
118 }
119 else if (mode == 7){
121 }
122 else {
124 }
125 }
126
127 UpdateFace(ratio);
128
129 pM.Update();
130
131 AlignObject(pM.GetObject(), -7.5f);
132
133 pM.GetObject()->GetTransform()->SetPosition(GetWiggleOffset());
134 pM.GetObject()->UpdateTransform();
135 }
136};
void Frown()
Definition DrGonzoTest.h:68
void LinkControlParameters() override
Links external or user-defined control parameters (pure virtual to be implemented).
Definition DrGonzoTest.h:23
DrGonzoFace pM2
Definition DrGonzoTest.h:18
void LookDown()
Definition DrGonzoTest.h:76
const __FlashStringHelper * faceArray[10]
Definition DrGonzoTest.h:21
void Doubt()
Definition DrGonzoTest.h:64
NukudeFace pM
Definition DrGonzoTest.h:17
void LookUp()
Definition DrGonzoTest.h:72
void Update(float ratio) override
Updates the project state based on the given ratio.
Definition DrGonzoTest.h:98
DeltaDisplayBackground deltaDisplayBackground
Definition DrGonzoTest.h:19
HUB75Controller controller
Definition DrGonzoTest.h:16
HUB75DeltaCameraManager cameras
Definition DrGonzoTest.h:15
void Default()
Definition DrGonzoTest.h:45
void Angry()
Definition DrGonzoTest.h:47
void Surprised()
Definition DrGonzoTest.h:58
Manages HUB75 LED matrices with camera integration.
void SetAccentBrightness(uint8_t maxAccentBrightness) override
Sets the maximum accent brightness of the secondary display.
void SetBrightness(uint8_t maxBrightness) override
Sets the maximum brightness of the LED matrix.
void SetFaceArray(const __FlashStringHelper **faceNames)
Sets the array of face names.
Definition SSD1306.cpp:217
static uint8_t GetFaceState()
Retrieves the current face state. In hardware mode, it is read from the MenuHandler.
Definition Menu.cpp:381
static uint8_t GetBrightness()
Gets the current brightness level. In hardware mode, it is read from the MenuHandler.
Definition Menu.cpp:390
static uint8_t GetAccentBrightness()
Gets the current accent brightness level.
Definition Menu.cpp:399
Scene scene
The Scene object representing the rendered environment.
Definition Project.h:35
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.
Vector3D GetWiggleOffset()
Computes and returns a Vector3D offset for a "wiggle" effect using function generators.
void AudioReactiveGradientFace()
Enables the Audio Reactive Gradient on the face, updating offsets and calling callbacks.
void SetMenuOffset(Vector2D offset)
Sets the menu's position offset.
void SetMenuSize(Vector2D size)
Sets the menu's size.
void OscilloscopeFace()
Enables the Oscilloscope on the face, updating offsets and calling callbacks.
void UpdateFace(float ratio)
Updates the face's rendered content, reading any user input and applying changes.
void SetWiggleSpeed(float multiplier)
Sets the overall wiggle speed for both X and Y function generators.
bool IsBooped()
Checks if the sensor has detected a boop.
void SpectrumAnalyzerFace()
Enables the Spectrum Analyzer on the face, updating offsets and calling callbacks.
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 AddViseme(Viseme::MouthShape visemeName, float *parameter)
Adds a viseme parameter to the animator (for mouth shapes).
@ CRAINBOW
Rainbow spiral.
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.
void AddBlinkParameter(float *blinkParameter)
Adds a float parameter to the blink track for controlling blinking.
void AddParameterFrame(uint16_t ProjectIndex, float target)
Adds a frame target to a previously added parameter.
Material * GetFaceMaterial()
Retrieves the current face material animator.
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.
void AddObject(Object3D *object)
Adds a 3D object to the scene.
Definition Scene.cpp:31
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Definition Vector2D.h:27
@ 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.