ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Project Class Referenceabstract

Manages animations, rendering, and display operations. More...

#include <Project.h>

Inheritance diagram for Project:
Collaboration diagram for Project:

Public Member Functions

 Project (CameraManager *cameras, Controller *controller, uint8_t numObjects)
 Constructs a Project with specified camera manager and controller.
 
float GetAnimationTime ()
 Retrieves the time spent on animations.
 
float GetRenderTime ()
 Retrieves the time spent on rendering.
 
float GetDisplayTime ()
 Retrieves the time spent on display operations.
 
float GetFrameRate ()
 Retrieves the current frame rate.
 
virtual void Initialize ()=0
 Initializes the project.
 
void Animate (float ratio)
 Animates the project state based on the given ratio.
 
void Render ()
 Renders the scene.
 
void Display ()
 Updates the display with the rendered content.
 
void PrintStats ()
 Prints performance statistics such as frame rate and operation times.
 

Protected Member Functions

virtual void Update (float ratio)=0
 Updates the project state based on the given ratio.
 
void RenderStartTimer ()
 Starts the render timer for measuring render performance.
 
void RenderEndTimer ()
 Stops the render timer and records the elapsed time.
 

Protected Attributes

CameraManagercameras
 Pointer to the CameraManager for managing cameras.
 
Controllercontroller
 Pointer to the Controller for controlling the display.
 
Scene scene
 The Scene object representing the rendered environment.
 
RunningAverageFilter< 50 > avgFPS = RunningAverageFilter<50>(0.05f)
 Running average filter for frame rate calculation.
 
long previousAnimationTime = 0
 Time of the previous animation frame in microseconds.
 
long previousRenderTime = 0
 Time of the previous render frame in microseconds.
 
long previousDisplayTime = 0
 Time of the previous display frame in microseconds.
 
float fade = 0.0f
 Fade parameter for animations.
 
float animationTime = 0.0f
 Time spent on animation in milliseconds.
 
float renderTime = 0.0f
 Time spent on rendering in milliseconds.
 
float displayTime = 0.0f
 Time spent on display in milliseconds.
 

Detailed Description

Manages animations, rendering, and display operations.

The Project class integrates various subsystems including camera management, scene rendering, and display updates. It also tracks and reports performance metrics such as frame rate and individual operation times.

Definition at line 31 of file Project.h.

Constructor & Destructor Documentation

◆ Project()

Project ( CameraManager cameras,
Controller controller,
uint8_t  numObjects 
)

Constructs a Project with specified camera manager and controller.

Parameters
camerasPointer to the CameraManager managing the cameras.
controllerPointer to the Controller managing the display.
numObjectsNumber of objects to initialize in the scene.

Definition at line 3 of file Project.cpp.

References previousAnimationTime, previousDisplayTime, and previousRenderTime.

Member Function Documentation

◆ Animate()

void Animate ( float  ratio)

Animates the project state based on the given ratio.

Parameters
ratioA float representing the interpolation ratio for animations.

Definition at line 35 of file Project.cpp.

References animationTime, previousAnimationTime, and Update().

◆ Display()

void Display ( )

Updates the display with the rendered content.

Definition at line 52 of file Project.cpp.

References controller, Controller::Display(), displayTime, and previousDisplayTime.

◆ GetAnimationTime()

float GetAnimationTime ( )

Retrieves the time spent on animations.

Returns
The animation time in milliseconds.

Definition at line 19 of file Project.cpp.

References animationTime.

Referenced by PrintStats().

◆ GetDisplayTime()

float GetDisplayTime ( )

Retrieves the time spent on display operations.

Returns
The display time in milliseconds.

Definition at line 27 of file Project.cpp.

References displayTime.

Referenced by PrintStats().

◆ GetFrameRate()

float GetFrameRate ( )

Retrieves the current frame rate.

Returns
The frame rate in frames per second (FPS).

Definition at line 31 of file Project.cpp.

References animationTime, avgFPS, displayTime, RunningAverageFilter< memory >::Filter(), and renderTime.

Referenced by PrintStats().

◆ GetRenderTime()

float GetRenderTime ( )

Retrieves the time spent on rendering.

Returns
The render time in milliseconds.

Definition at line 23 of file Project.cpp.

References renderTime.

Referenced by PrintStats().

◆ Initialize()

virtual void Initialize ( )
pure virtual

Initializes the project.

This method is intended to be overridden by derived classes to define specific initialization logic for the project.

Implemented in ProtogenProject, Boot, SpyroAnimation, and VerifyEngine.

◆ PrintStats()

void PrintStats ( )

Prints performance statistics such as frame rate and operation times.

Definition at line 60 of file Project.cpp.

References Debug::FreeMem(), GetAnimationTime(), GetDisplayTime(), GetFrameRate(), and GetRenderTime().

◆ Render()

void Render ( )

Renders the scene.

Definition at line 43 of file Project.cpp.

References cameras, previousRenderTime, RenderingEngine::Rasterize(), renderTime, and scene.

◆ RenderEndTimer()

void RenderEndTimer ( )
protected

Stops the render timer and records the elapsed time.

Definition at line 15 of file Project.cpp.

References previousRenderTime, and renderTime.

◆ RenderStartTimer()

void RenderStartTimer ( )
protected

Starts the render timer for measuring render performance.

Definition at line 11 of file Project.cpp.

References previousRenderTime.

◆ Update()

virtual void Update ( float  ratio)
protectedpure virtual

Updates the project state based on the given ratio.

This method is intended to be overridden by derived classes to define specific update logic for animations or state transitions.

Parameters
ratioA float representing the interpolation ratio for updates.

Implemented in Boot, AceAnimation, ArrowAnimation, DrGonzoProject, DrGonzoTest, SageAnimation, SplatAnimation, UnicornZhenjaAnimation, FursuitEyesV1, BetaProject, ProtogenHUB75Project, ProtogenWS35Project, CreeperAnimation, SpyroAnimation, and VerifyEngine.

Referenced by Animate().

Member Data Documentation

◆ animationTime

float animationTime = 0.0f
protected

Time spent on animation in milliseconds.

Definition at line 43 of file Project.h.

Referenced by Animate(), GetAnimationTime(), and GetFrameRate().

◆ avgFPS

RunningAverageFilter<50> avgFPS = RunningAverageFilter<50>(0.05f)
protected

Running average filter for frame rate calculation.

Definition at line 37 of file Project.h.

Referenced by GetFrameRate().

◆ cameras

CameraManager* cameras
protected

Pointer to the CameraManager for managing cameras.

Definition at line 33 of file Project.h.

Referenced by Render().

◆ controller

Controller* controller
protected

Pointer to the Controller for controlling the display.

Definition at line 34 of file Project.h.

Referenced by Display(), and ProtogenProject::Initialize().

◆ displayTime

float displayTime = 0.0f
protected

Time spent on display in milliseconds.

Definition at line 45 of file Project.h.

Referenced by Display(), GetDisplayTime(), and GetFrameRate().

◆ fade

float fade = 0.0f
protected

Fade parameter for animations.

Definition at line 42 of file Project.h.

◆ previousAnimationTime

long previousAnimationTime = 0
protected

Time of the previous animation frame in microseconds.

Definition at line 39 of file Project.h.

Referenced by Animate(), and Project().

◆ previousDisplayTime

long previousDisplayTime = 0
protected

Time of the previous display frame in microseconds.

Definition at line 41 of file Project.h.

Referenced by Display(), and Project().

◆ previousRenderTime

long previousRenderTime = 0
protected

Time of the previous render frame in microseconds.

Definition at line 40 of file Project.h.

Referenced by Project(), Render(), RenderEndTimer(), and RenderStartTimer().

◆ renderTime

float renderTime = 0.0f
protected

Time spent on rendering in milliseconds.

Definition at line 44 of file Project.h.

Referenced by GetFrameRate(), GetRenderTime(), Render(), and RenderEndTimer().

◆ scene


The documentation for this class was generated from the following files: