ProtoTracer
1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1
/**
2
* @file main.cpp
3
* @brief Entry point for various projects, managing initialization and main loop operations.
4
*
5
* This file determines which project to run based on the defined preprocessor directive
6
* and provides functionality for initializing and executing the selected project.
7
*
8
* Supported projects:
9
* - PROJECT_PROTOGEN_HUB75
10
* - PROJECT_PROTOGEN_WS35
11
* - PROJECT_PROTOGEN_BETA
12
* - PROJECT_VERIFY_ENGINE
13
* - PROJECT_VERIFY_HARDWARE
14
*
15
* @date 22/12/2024
16
* @version 1.0
17
* @author Coela Can't
18
*/
19
20
#include "
Examples/UserConfiguration.h
"
21
22
#if defined(PROJECT_PROTOGEN_HUB75)
23
#include "
Examples/Protogen/ProtogenHUB75Project.h
"
24
ProtogenHUB75Project
project;
///< Instance of the Protogen HUB75 project.
25
26
#elif defined(PROJECT_PROTOGEN_WS35)
27
#include "
Examples/Protogen/ProtogenWS35Project.h
"
28
ProtogenWS35Project
project;
///< Instance of the Protogen WS35 project.
29
30
#elif defined(PROJECT_PROTOGEN_BETA)
31
#include "
Examples/Protogen/BetaProject.h
"
32
BetaProject
project;
///< Instance of the Beta project.
33
34
#elif defined(PROJECT_VERIFY_ENGINE)
35
#include "
Examples/VerifyEngine.h
"
36
VerifyEngine
project;
///< Instance of the Verify Engine project.
37
38
#elif defined(PROJECT_VERIFY_HARDWARE)
39
#include "
Examples/Protogen/ProtogenHardwareTest.h
"
40
#else
41
#error "No project defined! Please define one of PROJECT_PROTOGEN_HUB75, PROJECT_PROTOGEN_WS35, or PROJECT_VERIFY_ENGINE."
42
#endif
43
44
/**
45
* @brief Arduino setup function, initializes the selected project.
46
*
47
* If PROJECT_VERIFY_HARDWARE is defined, runs continuous hardware testing.
48
*/
49
void
setup
() {
50
Serial.begin(115200);
///< Initializes the serial port for debugging.
51
Serial.println(
"\nStarting..."
);
52
53
#ifndef PROJECT_VERIFY_HARDWARE
54
project.
Initialize
();
///< Initializes the selected project.
55
delay(100);
///< Ensures stability after initialization.
56
#else
57
while
(
true
) {
58
HardwareTest::ScanDevices
();
///< Scans for connected hardware devices.
59
HardwareTest::TestNeoTrellis
();
///< Tests the NeoTrellis input device.
60
HardwareTest::TestBoopSensor
();
///< Tests the proximity (boop) sensor.
61
HardwareTest::TestHUD
();
///< Tests the HUD (Head-Up Display) functionality.
62
}
63
#endif
64
}
65
66
/**
67
* @brief Arduino main loop function, animates, renders, and updates the selected project.
68
*
69
* If PROJECT_VERIFY_HARDWARE is defined, this function is disabled.
70
*/
71
void
loop
() {
72
#ifndef PROJECT_VERIFY_HARDWARE
73
float
ratio = (float)(millis() % 5000) / 5000.0f;
///< Calculates animation ratio based on time.
74
75
project.
Animate
(ratio);
///< Animates the project based on the current ratio.
76
project.
Render
();
///< Renders the project's scene.
77
project.
Display
();
///< Displays the rendered frame.
78
project.
PrintStats
();
///< Outputs debugging and performance statistics.
79
#endif
80
}
BetaProject.h
ProtogenHUB75Project.h
ProtogenHardwareTest.h
ProtogenWS35Project.h
UserConfiguration.h
User-configurable settings for the project.
VerifyEngine.h
Implementation of a test project to verify the engine functionality.
BetaProject
Definition
BetaProject.h:17
HardwareTest::ScanDevices
static void ScanDevices()
Definition
ProtogenHardwareTest.h:295
HardwareTest::TestHUD
static void TestHUD()
Definition
ProtogenHardwareTest.h:272
HardwareTest::TestNeoTrellis
static void TestNeoTrellis()
Definition
ProtogenHardwareTest.h:286
HardwareTest::TestBoopSensor
static void TestBoopSensor()
Definition
ProtogenHardwareTest.h:278
Project::Animate
void Animate(float ratio)
Animates the project state based on the given ratio.
Definition
Project.cpp:35
Project::Render
void Render()
Renders the scene.
Definition
Project.cpp:43
Project::Display
void Display()
Updates the display with the rendered content.
Definition
Project.cpp:52
Project::PrintStats
void PrintStats()
Prints performance statistics such as frame rate and operation times.
Definition
Project.cpp:60
ProtogenHUB75Project
Definition
ProtogenHUB75Project.h:10
ProtogenProject::Initialize
void Initialize() override
Initializes the ProtogenProject, setting up sensors, menus, and hardware.
Definition
ProtogenProjectTemplate.cpp:557
ProtogenWS35Project
Definition
ProtogenWS35Project.h:9
VerifyEngine
A project class to validate the rendering engine functionality.
Definition
VerifyEngine.h:31
setup
void setup()
Arduino setup function, initializes the selected project.
Definition
main.cpp:49
loop
void loop()
Arduino main loop function, animates, renders, and updates the selected project.
Definition
main.cpp:71
src
main.cpp
Generated by
1.15.0