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
21
22#if defined(PROJECT_PROTOGEN_HUB75)
24 ProtogenHUB75Project project; ///< Instance of the Protogen HUB75 project.
25
26#elif defined(PROJECT_PROTOGEN_WS35)
28 ProtogenWS35Project project; ///< Instance of the Protogen WS35 project.
29
30#elif defined(PROJECT_PROTOGEN_BETA)
32 BetaProject project; ///< Instance of the Beta project.
33
34#elif defined(PROJECT_VERIFY_ENGINE)
36 VerifyEngine project; ///< Instance of the Verify Engine project.
37
38#elif defined(PROJECT_VERIFY_HARDWARE)
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 */
49void 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 */
71void 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}
User-configurable settings for the project.
Implementation of a test project to verify the engine functionality.
static void ScanDevices()
static void TestHUD()
static void TestNeoTrellis()
static void TestBoopSensor()
void Animate(float ratio)
Animates the project state based on the given ratio.
Definition Project.cpp:35
void Render()
Renders the scene.
Definition Project.cpp:43
void Display()
Updates the display with the rendered content.
Definition Project.cpp:52
void PrintStats()
Prints performance statistics such as frame rate and operation times.
Definition Project.cpp:60
void Initialize() override
Initializes the ProtogenProject, setting up sensors, menus, and hardware.
A project class to validate the rendering engine functionality.
void setup()
Arduino setup function, initializes the selected project.
Definition main.cpp:49
void loop()
Arduino main loop function, animates, renders, and updates the selected project.
Definition main.cpp:71