Radium Engine  1.5.20
Loading...
Searching...
No Matches
Ra::Engine::RadiumEngine Class Reference

#include <Engine/RadiumEngine.hpp>

+ Collaboration diagram for Ra::Engine::RadiumEngine:

Public Member Functions

void initialize ()
 
void initializeGL ()
 
glbinding::Version getOpenGLVersion () const
 Get the currently used OpenGL version.
 
void cleanup ()
 
void getTasks (Core::TaskQueue *taskQueue, Scalar dt)
 
bool registerSystem (const std::string &name, Scene::System *system, int priority=1)
 
Scene::SystemgetSystem (const std::string &system) const
 
Data::DisplayablegetMesh (const std::string &entityName, const std::string &componentName, const std::string &roName=std::string()) const
 
bool loadFile (const std::string &file)
 
const Core::Asset::FileData & getFileData () const
 
void releaseFile ()
 
void endFrameSync ()
 
Rendering::RenderObjectManager * getRenderObjectManager () const
 Manager getters.
 
Scene::EntityManager * getEntityManager () const
 
Scene::SignalManagergetSignalManager () const
 
Data::TextureManagergetTextureManager () const
 
Data::ShaderProgramManagergetShaderProgramManager () const
 
void registerFileLoader (std::shared_ptr< Core::Asset::FileLoaderInterface > fileLoader)
 
const std::vector< std::shared_ptr< Core::Asset::FileLoaderInterface > > & getFileLoaders () const
 
Core::Aabb computeSceneAabb () const
 
void pushFboAndViewport ()
 
void popFboAndViewport ()
 
std::string getResourcesDir ()
 
void runGpuTasks ()
 
Core::TaskQueue::TaskId addGpuTask (std::unique_ptr< Core::Task >)
 
void removeGpuTask (Core::TaskQueue::TaskId taskId)
 
Time Management.
void setRealTime (bool realTime)
 Toggles Real-time (on) or Constant (off) time flow.
 
bool isRealTime () const
 Indicates if Real-time time flow is on (Constant-time is off) .
 
bool isConstantTime () const
 Indicates if Constant-time time flow is on (Real-time is off) .
 
bool setConstantTimeStep (Scalar dt, bool forceConstantTime=false)
 Sets the time delta between two frames for Constant-time time flow.
 
void setForwardBackward (bool mode)
 Activates or disables ForwardBackward time flow.
 
void play (bool isPlaying)
 
void step ()
 
void resetTime ()
 
void setTime (Scalar t)
 
void setStartTime (Scalar t)
 
Scalar getStartTime () const
 
void setEndTime (Scalar t)
 
Scalar getEndTime () const
 
Scalar getTime () const
 
uint getFrame () const
 

Detailed Description

Engine main class : Manage all the systems and managers that are used by the engine module.

See also
Documentation on Engine Object Model

Definition at line 54 of file RadiumEngine.hpp.

Member Function Documentation

◆ addGpuTask()

Core::TaskQueue::TaskId Ra::Engine::RadiumEngine::addGpuTask ( std::unique_ptr< Core::Task > task)

Add a task to the gpu task queue, will be run once runGpuTasks() is called.

Returns
the task id of the added task

Definition at line 477 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ cleanup()

void Ra::Engine::RadiumEngine::cleanup ( )

Free all resources acquired during initialize

Definition at line 141 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ computeSceneAabb()

Core::Aabb Ra::Engine::RadiumEngine::computeSceneAabb ( ) const

Compute the aabb of the scene by aggregating aabb from entity.

Definition at line 329 of file RadiumEngine.cpp.

◆ endFrameSync()

void Ra::Engine::RadiumEngine::endFrameSync ( )

Is called at the end of the frame to synchronize any data that may have been updated during the frame's multithreaded processing.

Definition at line 163 of file RadiumEngine.cpp.

◆ getEndTime()

Scalar Ra::Engine::RadiumEngine::getEndTime ( ) const

Returns the end time for the time window.

Definition at line 413 of file RadiumEngine.cpp.

◆ getEntityManager()

Scene::EntityManager * Ra::Engine::RadiumEngine::getEntityManager ( ) const

Get the entity manager attached to the engine.

Note
, the engine keep ownership on the pointer returned
Returns
the entity manager

Definition at line 285 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ getFileData()

const FileData & Ra::Engine::RadiumEngine::getFileData ( ) const

Access to the content of the loaded file. Access to the content is only available at loading time. As soon as the loaded file is released, its content is no more available outside the Entity/Component architecture.

Precondition
The Engine must be in "loading state".
Returns

Definition at line 311 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ getFileLoaders()

const std::vector< std::shared_ptr< FileLoaderInterface > > & Ra::Engine::RadiumEngine::getFileLoaders ( ) const

Get the active file loaders from the engine

Returns

Definition at line 305 of file RadiumEngine.cpp.

◆ getFrame()

uint Ra::Engine::RadiumEngine::getFrame ( ) const
Returns
the current frame.

Definition at line 427 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ getMesh()

Data::Displayable * Ra::Engine::RadiumEngine::getMesh ( const std::string & entityName,
const std::string & componentName,
const std::string & roName = std::string() ) const

Convenience function returning a Mesh from its entity and component names. When no RenderObject name is given, returns the mesh associated to the first render object.

Note
: mark as deprecated as it must be either removed or reimplemented
Warning
will be deprecated
Deprecated
Will be removed from this class in the next release. A Mesh manager, that could serve mesh by name will be implemented.

Definition at line 204 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ getOpenGLVersion()

glbinding::Version Ra::Engine::RadiumEngine::getOpenGLVersion ( ) const

Get the currently used OpenGL version.

Returns
the initialized glbinding::Version If openGL is not initialize, version is not valid (e.g. Version.isValid() == false)

Definition at line 81 of file RadiumEngine.cpp.

◆ getRenderObjectManager()

Rendering::RenderObjectManager * Ra::Engine::RadiumEngine::getRenderObjectManager ( ) const

Manager getters.

Get the RenderObject manager attached to the engine.

Note
, the engine keep ownership on the pointer returned
Returns
the object manager

Definition at line 281 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ getResourcesDir()

std::string Ra::Engine::RadiumEngine::getResourcesDir ( )
inline

Definition at line 331 of file RadiumEngine.hpp.

◆ getShaderProgramManager()

Data::ShaderProgramManager * Ra::Engine::RadiumEngine::getShaderProgramManager ( ) const

Get the shader program manager attached to the engine.

Note
, the engine keep ownership on the pointer returned
Returns
the shader program manager

Definition at line 297 of file RadiumEngine.cpp.

◆ getSignalManager()

Scene::SignalManager * Ra::Engine::RadiumEngine::getSignalManager ( ) const

Get the signal manager attached to the engine.

Note
, the engine keep ownership on the pointer returned
Returns
the signal manager

Definition at line 289 of file RadiumEngine.cpp.

◆ getStartTime()

Scalar Ra::Engine::RadiumEngine::getStartTime ( ) const

Returns the start time for the time window.

Definition at line 405 of file RadiumEngine.cpp.

◆ getSystem()

Scene::System * Ra::Engine::RadiumEngine::getSystem ( const std::string & system) const

Get the named system

Parameters
system
Returns

Definition at line 195 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ getTasks()

void Ra::Engine::RadiumEngine::getTasks ( Core::TaskQueue * taskQueue,
Scalar dt )

Builds the set of task that must be executed for the current frame.

See also
Documentation on Engine Object Model the what are tasks and what they can do
Parameters
taskQueuethe task queue that will be executed for the current frame
dtthe time elapsed since the last frame in seconds.

Definition at line 168 of file RadiumEngine.cpp.

◆ getTextureManager()

Data::TextureManager * Ra::Engine::RadiumEngine::getTextureManager ( ) const

Get the texture manager attached to the engine.

Note
, the engine keep ownership on the pointer returned
Returns
the texture manager

Definition at line 293 of file RadiumEngine.cpp.

◆ getTime()

Scalar Ra::Engine::RadiumEngine::getTime ( ) const
Returns
the current time.

Definition at line 423 of file RadiumEngine.cpp.

◆ initialize()

void Ra::Engine::RadiumEngine::initialize ( )

Instantiate all object managers that make Radium Object Model functionnal. Initialize internal resources and default states.

Definition at line 44 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ initializeGL()

void Ra::Engine::RadiumEngine::initializeGL ( )

Initialize all the OpenGL functionalities of the Engine. Shader set : reusable shaders, materials and named strings Texture set : reusable textures

Note
When calling this function, caller must ensures that a valid openGL context is bound. All initialisations will be done in the bound openGl context.

Definition at line 69 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ isConstantTime()

bool Ra::Engine::RadiumEngine::isConstantTime ( ) const

Indicates if Constant-time time flow is on (Real-time is off) .

See also
isRealTime

Definition at line 373 of file RadiumEngine.cpp.

◆ isRealTime()

bool Ra::Engine::RadiumEngine::isRealTime ( ) const

Indicates if Real-time time flow is on (Constant-time is off) .

See also
isConstantTime

Definition at line 369 of file RadiumEngine.cpp.

◆ loadFile()

bool Ra::Engine::RadiumEngine::loadFile ( const std::string & file)

Try to loads the given file. If no loader is able to process the input fileformat (determined on the file extension), return false. If a loader is found, creates the root entity of the loaded scene and gives the content of the file to all systems to add components and to this root entity.

Note
Calling this method set the engine in the "loading state".
Parameters
file
Returns
true if file is loaded, false else.

Definition at line 233 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ play()

void Ra::Engine::RadiumEngine::play ( bool isPlaying)

Activates or stops time flow.

Definition at line 383 of file RadiumEngine.cpp.

◆ popFboAndViewport()

void Ra::Engine::RadiumEngine::popFboAndViewport ( )

Restore OpenGL Framebuffer and viewport from the internal Engine stack. The state have to be previously saved with pushFboAndViewport() Error message if stack is empty.

Definition at line 352 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ pushFboAndViewport()

void Ra::Engine::RadiumEngine::pushFboAndViewport ( )

Save currently bound OpenGL Framebuffer and viewport on the internal Engine stack. You can restore the state afterward with popFboAndViewport()

Definition at line 341 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ registerFileLoader()

void Ra::Engine::RadiumEngine::registerFileLoader ( std::shared_ptr< Core::Asset::FileLoaderInterface > fileLoader)

Register a new file loader to the engine.

Parameters
fileLoader

Definition at line 301 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ registerSystem()

bool Ra::Engine::RadiumEngine::registerSystem ( const std::string & name,
Scene::System * system,
int priority = 1 )

System with high priority will always be used first. Systems with the same priority are ranked randomly. Default priority is 1 for all systems;

Parameters
name
system
priorityValue used to rank the systems

Definition at line 183 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ releaseFile()

void Ra::Engine::RadiumEngine::releaseFile ( )

Release the content of the loaded file. After calling this, the getFileData method must not be called for this file

Parameters
filenamethe name of the file to release. If empty, releases the last loaded file.
Note
Calling this method set the engine out of the "loading state".

Definition at line 276 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ removeGpuTask()

void Ra::Engine::RadiumEngine::removeGpuTask ( Core::TaskQueue::TaskId taskId)

remove a previously added task according to its taskId (invalid taskId silently ignored)

Definition at line 481 of file RadiumEngine.cpp.

◆ resetTime()

void Ra::Engine::RadiumEngine::resetTime ( )

Resets time to the start time of the time window.

Note
Also stops time flow.

Definition at line 391 of file RadiumEngine.cpp.

◆ runGpuTasks()

void Ra::Engine::RadiumEngine::runGpuTasks ( )

run (and flush) gpu task queue

Definition at line 473 of file RadiumEngine.cpp.

◆ setConstantTimeStep()

bool Ra::Engine::RadiumEngine::setConstantTimeStep ( Scalar dt,
bool forceConstantTime = false )

Sets the time delta between two frames for Constant-time time flow.

Parameters
forceConstantTimeIf true, enforces Constant-time time mode by calling setRealTime(false). If false, doesn't change the time mode.
Returns
true if Constant-time flow is used.
See also
isConstantTime

Definition at line 377 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ setEndTime()

void Ra::Engine::RadiumEngine::setEndTime ( Scalar t)

Sets the end time for the time window.

Note
A negative end time makes the time flow indefinitely, whether in ForwardBackward mode or not.
If the start time comes after the end time, then time will flow indefinitely.

Definition at line 409 of file RadiumEngine.cpp.

◆ setForwardBackward()

void Ra::Engine::RadiumEngine::setForwardBackward ( bool mode)

Activates or disables ForwardBackward time flow.

When ForwardBackward mode is disabled (default), time will flow through the time window and restart over. When ForwardBackward mode is enabled, time will flow back and forth in the time window.

Note
If end time is negative, the ForwardBackward mode doesn't apply and time just flows indefinitely.

Definition at line 417 of file RadiumEngine.cpp.

◆ setRealTime()

void Ra::Engine::RadiumEngine::setRealTime ( bool realTime)

Toggles Real-time (on) or Constant (off) time flow.

In Real-time mode, time flows according to the actually elapsed time between consecutive frames, while in constant mode time flows according to a fixed time step.

Definition at line 365 of file RadiumEngine.cpp.

◆ setStartTime()

void Ra::Engine::RadiumEngine::setStartTime ( Scalar t)

Sets the start time for the time window.

Note
A negative start time is considered as 0.
If the start time comes after the end time, then time will flow indefinitely.

Definition at line 401 of file RadiumEngine.cpp.

+ Here is the call graph for this function:

◆ setTime()

void Ra::Engine::RadiumEngine::setTime ( Scalar t)

Sets time to t.

Note
t can be any time value, regardless of the time window or time flow modes. However as soon as time flows, t will be adapted.

Definition at line 397 of file RadiumEngine.cpp.

◆ step()

void Ra::Engine::RadiumEngine::step ( )

Activates time flow for one frame.

Definition at line 387 of file RadiumEngine.cpp.


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