Radium Engine
1.5.20
|
#include <Engine/RadiumEngine.hpp>
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::System * | getSystem (const std::string &system) const |
Data::Displayable * | getMesh (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::SignalManager * | getSignalManager () const |
Data::TextureManager * | getTextureManager () const |
Data::ShaderProgramManager * | getShaderProgramManager () 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 |
Engine main class : Manage all the systems and managers that are used by the engine module.
Definition at line 54 of file RadiumEngine.hpp.
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.
Definition at line 477 of file RadiumEngine.cpp.
void Ra::Engine::RadiumEngine::cleanup | ( | ) |
Free all resources acquired during initialize
Definition at line 141 of file RadiumEngine.cpp.
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.
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.
Scalar Ra::Engine::RadiumEngine::getEndTime | ( | ) | const |
Returns the end
time for the time window.
Definition at line 413 of file RadiumEngine.cpp.
Scene::EntityManager * Ra::Engine::RadiumEngine::getEntityManager | ( | ) | const |
Get the entity manager attached to the engine.
Definition at line 285 of file RadiumEngine.cpp.
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.
Definition at line 311 of file RadiumEngine.cpp.
const std::vector< std::shared_ptr< FileLoaderInterface > > & Ra::Engine::RadiumEngine::getFileLoaders | ( | ) | const |
Get the active file loaders from the engine
Definition at line 305 of file RadiumEngine.cpp.
uint Ra::Engine::RadiumEngine::getFrame | ( | ) | const |
Definition at line 427 of file RadiumEngine.cpp.
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.
Definition at line 204 of file RadiumEngine.cpp.
glbinding::Version Ra::Engine::RadiumEngine::getOpenGLVersion | ( | ) | const |
Get the currently used OpenGL version.
Definition at line 81 of file RadiumEngine.cpp.
Rendering::RenderObjectManager * Ra::Engine::RadiumEngine::getRenderObjectManager | ( | ) | const |
Manager getters.
Get the RenderObject manager attached to the engine.
Definition at line 281 of file RadiumEngine.cpp.
|
inline |
Definition at line 331 of file RadiumEngine.hpp.
Data::ShaderProgramManager * Ra::Engine::RadiumEngine::getShaderProgramManager | ( | ) | const |
Get the shader program manager attached to the engine.
Definition at line 297 of file RadiumEngine.cpp.
Scene::SignalManager * Ra::Engine::RadiumEngine::getSignalManager | ( | ) | const |
Get the signal manager attached to the engine.
Definition at line 289 of file RadiumEngine.cpp.
Scalar Ra::Engine::RadiumEngine::getStartTime | ( | ) | const |
Returns the start
time for the time window.
Definition at line 405 of file RadiumEngine.cpp.
Scene::System * Ra::Engine::RadiumEngine::getSystem | ( | const std::string & | system | ) | const |
Get the named system
system |
Definition at line 195 of file RadiumEngine.cpp.
void Ra::Engine::RadiumEngine::getTasks | ( | Core::TaskQueue * | taskQueue, |
Scalar | dt ) |
Builds the set of task that must be executed for the current frame.
taskQueue | the task queue that will be executed for the current frame |
dt | the time elapsed since the last frame in seconds. |
Definition at line 168 of file RadiumEngine.cpp.
Data::TextureManager * Ra::Engine::RadiumEngine::getTextureManager | ( | ) | const |
Get the texture manager attached to the engine.
Definition at line 293 of file RadiumEngine.cpp.
Scalar Ra::Engine::RadiumEngine::getTime | ( | ) | const |
Definition at line 423 of file RadiumEngine.cpp.
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.
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
Definition at line 69 of file RadiumEngine.cpp.
bool Ra::Engine::RadiumEngine::isConstantTime | ( | ) | const |
Indicates if Constant-time time flow is on (Real-time is off) .
Definition at line 373 of file RadiumEngine.cpp.
bool Ra::Engine::RadiumEngine::isRealTime | ( | ) | const |
Indicates if Real-time time flow is on (Constant-time is off) .
Definition at line 369 of file RadiumEngine.cpp.
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.
file |
Definition at line 233 of file RadiumEngine.cpp.
void Ra::Engine::RadiumEngine::play | ( | bool | isPlaying | ) |
Activates or stops time flow.
Definition at line 383 of file RadiumEngine.cpp.
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.
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.
void Ra::Engine::RadiumEngine::registerFileLoader | ( | std::shared_ptr< Core::Asset::FileLoaderInterface > | fileLoader | ) |
Register a new file loader to the engine.
fileLoader |
Definition at line 301 of file RadiumEngine.cpp.
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;
name | |
system | |
priority | Value used to rank the systems |
Definition at line 183 of file RadiumEngine.cpp.
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
filename | the name of the file to release. If empty, releases the last loaded file. |
Definition at line 276 of file RadiumEngine.cpp.
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.
void Ra::Engine::RadiumEngine::resetTime | ( | ) |
Resets time to the start
time of the time window.
Definition at line 391 of file RadiumEngine.cpp.
void Ra::Engine::RadiumEngine::runGpuTasks | ( | ) |
run (and flush) gpu task queue
Definition at line 473 of file RadiumEngine.cpp.
bool Ra::Engine::RadiumEngine::setConstantTimeStep | ( | Scalar | dt, |
bool | forceConstantTime = false ) |
Sets the time delta between two frames for Constant-time time flow.
forceConstantTime | If true, enforces Constant-time time mode by calling setRealTime(false). If false, doesn't change the time mode. |
Definition at line 377 of file RadiumEngine.cpp.
void Ra::Engine::RadiumEngine::setEndTime | ( | Scalar | t | ) |
Sets the end
time for the time window.
start
time comes after the end
time, then time will flow indefinitely. Definition at line 409 of file RadiumEngine.cpp.
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.
end
time is negative, the ForwardBackward mode doesn't apply and time just flows indefinitely. Definition at line 417 of file RadiumEngine.cpp.
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.
void Ra::Engine::RadiumEngine::setStartTime | ( | Scalar | t | ) |
Sets the start
time for the time window.
start
time comes after the end
time, then time will flow indefinitely. Definition at line 401 of file RadiumEngine.cpp.
void Ra::Engine::RadiumEngine::setTime | ( | Scalar | t | ) |
Sets time to t
.
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.
void Ra::Engine::RadiumEngine::step | ( | ) |
Activates time flow for one frame.
Definition at line 387 of file RadiumEngine.cpp.