Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
ToyMaker::CameraSystem Class Reference

System responsible for managing all active cameras belonging to this world, tracking and updating associated projection and view matrices. More...

#include <camera_system.hpp>

Inheritance diagram for ToyMaker::CameraSystem:
ToyMaker::System< CameraSystem, std::tuple< Transform, CameraProperties >, std::tuple<> >

Public Member Functions

 CameraSystem (std::weak_ptr< ECSWorld > world)
 Construct a new CameraSystem object.
 
void updateActiveCameraMatrices ()
 Updates all matrices associated with active cameras in this world per their properties and positions.
 

Static Public Member Functions

static std::string getSystemTypeName ()
 Returns the ECS system type string for this object.
 

Private Member Functions

void onEntityEnabled (EntityID entityID) override
 Adds enabled entity to the projection update and view update queues.
 
void onEntityDisabled (EntityID entityID) override
 Removes extra entity related structures from system bookkeeping, if necessary.
 
void onEntityUpdated (EntityID entityID) override
 Adds entity to projection and view update queues.
 
void onSimulationActivated () override
 Initializes the CameraSystem, querying and adding all eligible entities to update queues.
 
void onPreRenderStep (float simulationProgress) override
 The step in which new projection and view matrices are actually computed for all active cameras.
 

Private Attributes

std::set< EntityIDmProjectionUpdateQueue {}
 Entities whose camera properties were updated this frame, whose projection matrix should be recomputed as soon as possible.
 
std::set< EntityIDmViewUpdateQueue {}
 Entities whose position or rotation were updated this frame, whose view matrix should be recomputed as soon as possible.
 

Detailed Description

System responsible for managing all active cameras belonging to this world, tracking and updating associated projection and view matrices.

Constructor & Destructor Documentation

◆ CameraSystem()

ToyMaker::CameraSystem::CameraSystem ( std::weak_ptr< ECSWorld > world)
inlineexplicit

Construct a new CameraSystem object.

Parameters
worldThe world to which this system belongs.

Member Function Documentation

◆ getSystemTypeName()

static std::string ToyMaker::CameraSystem::getSystemTypeName ( )
inlinestatic

Returns the ECS system type string for this object.

Returns
std::string This system's ECS system type string.
See also
ECSWorld::registerSystem()

◆ onEntityDisabled()

void CameraSystem::onEntityDisabled ( EntityID entityID)
overrideprivate

Removes extra entity related structures from system bookkeeping, if necessary.

Parameters
entityIDEntity being removed.

◆ onEntityEnabled()

void CameraSystem::onEntityEnabled ( EntityID entityID)
overrideprivate

Adds enabled entity to the projection update and view update queues.

Parameters
entityIDThe enabled entity.
See also
mProjectionUpdateQueue
mViewUpdateQueue

◆ onEntityUpdated()

void CameraSystem::onEntityUpdated ( EntityID entityID)
overrideprivate

Adds entity to projection and view update queues.

Parameters
entityIDThe entity that was updated

◆ onPreRenderStep()

void CameraSystem::onPreRenderStep ( float simulationProgress)
overrideprivate

The step in which new projection and view matrices are actually computed for all active cameras.

Parameters
simulationProgressThe progress since the end of the last simulation update to the start of the next one, as a number between 0 and 1.

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