Main entrypoint for working with Gluon Graphics. More...
#include <engine.h>
Classes | |
class | EnginePrivate |
Public Slots | |
void | render () |
void | setFramebufferSize (int width, int height) |
void | setActiveCamera (Camera *camera) |
void | setViewport (Viewport *viewport) |
Signals | |
void | activeCameraChanged (Camera *) |
Public Member Functions | |
void | initialize () |
Item * | createItem (const QString &mesh) |
void | destroyItem (Item *item) |
Material * | createMaterial (const QString &name) |
void | destroyMaterial (const QString &name) |
bool | hasMaterial (const QString &name) |
Material * | material (const QString &name) |
bool | addMaterial (const QString &name, Material *material) |
void | removeMaterial (const QString &name) |
Mesh * | createMesh (const QString &name) |
void | destroyMesh (const QString &name) |
bool | hasMesh (const QString &name) |
Mesh * | mesh (const QString &name) |
bool | addMesh (const QString &name, Mesh *mesh) |
void | removeMesh (const QString &name) |
Texture * | createTexture (const QString &name) |
void | destroyTexture (const QString &name) |
bool | hasTexture (const QString &name) |
Texture * | texture (const QString &name) |
bool | addTexture (const QString &name, Texture *texture) |
void | removeTexture (const QString &name) |
Camera * | activeCamera () |
Viewport * | currentViewport () |
Friends | |
class | GluonCore::Singleton< Engine > |
Main entrypoint for working with Gluon Graphics.
This class provides the main entry point for working with classes from Gluon Graphics. It provides factory methods for the most used objects in Gluon Graphics as well as providing a registry of objects.
This registry is used to render the current scene. For that, a single render operation is provided. This render operation renders the registered objects to a Framebuffer Object, which is then rendered to a fullscreen quad by means of a post-processing shader.
Note that this class is thread-safe.
Definition at line 54 of file engine.h.
Camera * Engine::activeCamera | ( | ) |
Retrieve the current active camera.
Definition at line 298 of file engine.cpp.
void GluonGraphics::Engine::activeCameraChanged | ( | Camera * | ) | [signal] |
Emitted whenever the active camera changes.
bool Engine::addMaterial | ( | const QString & | name, | |
Material * | material | |||
) |
Add a material to the registry.
name | The name used to identify the material.
|
Definition at line 214 of file engine.cpp.
bool Engine::addMesh | ( | const QString & | name, | |
Mesh * | mesh | |||
) |
Add a mesh to the registry.
name | The name used to identify the mesh.
|
Definition at line 250 of file engine.cpp.
bool Engine::addTexture | ( | const QString & | name, | |
Texture * | texture | |||
) |
Add a texture to the registry.
name | The name used to identify the texture.
|
Definition at line 286 of file engine.cpp.
Item * Engine::createItem | ( | const QString & | mesh | ) |
Create an Item.
The item will be put into the internal registry of items and should be removed by calling destroyItem().
mesh | The name of the mesh to attach to the new item. If this mesh does not exist yet it will be created. |
Definition at line 169 of file engine.cpp.
Material * Engine::createMaterial | ( | const QString & | name | ) |
Create a Material.
name | The name of the material to create. |
Definition at line 190 of file engine.cpp.
Mesh * Engine::createMesh | ( | const QString & | name | ) |
Create a Mesh.
name | The name of the mesh to create. |
Definition at line 226 of file engine.cpp.
Texture * Engine::createTexture | ( | const QString & | name | ) |
Create a Texture.
name | The name of the texture to create. |
Definition at line 262 of file engine.cpp.
Viewport * Engine::currentViewport | ( | ) |
Definition at line 304 of file engine.cpp.
void Engine::destroyItem | ( | Item * | item | ) |
Destroy an item.
This will remove the item from the internal registry and then delete it.
item | The item to destroy. |
Definition at line 181 of file engine.cpp.
void Engine::destroyMaterial | ( | const QString & | name | ) |
Destroy a material.
The material will be removed and then deleted. Note that if the material is not registered the call is silently ignored.
name | The name of the material to destroy. |
Definition at line 197 of file engine.cpp.
void Engine::destroyMesh | ( | const QString & | name | ) |
Destroy a mesh.
The mesh will be removed and then deleted. Note that if the mesh is not registered the call is silently ignored.
name | The name of the mesh to destroy. |
Definition at line 232 of file engine.cpp.
void Engine::destroyTexture | ( | const QString & | name | ) |
Destroy a texture.
The texture will be removed and then deleted. Note that if the texture is not registered the call is silently ignored.
name | The name of the texture to destroy. |
Definition at line 268 of file engine.cpp.
bool Engine::hasMaterial | ( | const QString & | name | ) |
Check whether a material is registered.
name | The name of the material to check for. |
Definition at line 202 of file engine.cpp.
bool Engine::hasMesh | ( | const QString & | name | ) |
Check whether a mesh is registered.
name | The name of the mesh to check for. |
Definition at line 238 of file engine.cpp.
bool Engine::hasTexture | ( | const QString & | name | ) |
Check whether a texture is registered.
name | The name of the texture to check for. |
Definition at line 274 of file engine.cpp.
void Engine::initialize | ( | ) |
Initialize the defaults.
This will create a "default" material, mesh and texture to be used as default.
It should be called during the OpenGL initialization phase.
Definition at line 154 of file engine.cpp.
Material * Engine::material | ( | const QString & | name | ) |
Retrieve a registered material.
name | The name of the material to retrieve. |
Definition at line 208 of file engine.cpp.
Mesh * Engine::mesh | ( | const QString & | name | ) |
Retrieve a registered mesh.
name | The name of the mesh to retrieve. |
Definition at line 244 of file engine.cpp.
void Engine::removeMaterial | ( | const QString & | name | ) |
Remove a material from the registry.
The material will be removed but not deleted.
name | The name of the material to remove. |
Definition at line 220 of file engine.cpp.
void Engine::removeMesh | ( | const QString & | name | ) |
Remove a mesh from the registry.
The mesh will be removed but not deleted.
name | The name of the mesh to remove. |
Definition at line 256 of file engine.cpp.
void Engine::removeTexture | ( | const QString & | name | ) |
Remove a texture from the registry.
The texture will be removed but not deleted.
name | The name of the texture to remove. |
Definition at line 292 of file engine.cpp.
void Engine::render | ( | ) | [slot] |
Render the current scene.
This will render the currently visible scene.
Definition at line 310 of file engine.cpp.
void Engine::setActiveCamera | ( | Camera * | camera | ) | [slot] |
Set the currently active camera.
This camera will be used for rendering the scene.
camera | The camera to set as active camera. |
Definition at line 350 of file engine.cpp.
void Engine::setFramebufferSize | ( | int | width, | |
int | height | |||
) | [slot] |
Set the internal framebuffer size.
This will rebuild the framebuffer used by this class to a framebuffer with the specified size. This should be called whenever the display widget resizes, to keep the rendering correct.
Note that when the current scene is being rendered the framebuffer will be locked and this method will wait until rendering has been completed.
width | The new width of the framebuffer.
|
Definition at line 336 of file engine.cpp.
void Engine::setViewport | ( | Viewport * | viewport | ) | [slot] |
Definition at line 359 of file engine.cpp.
Texture * Engine::texture | ( | const QString & | name | ) |
Retrieve a registered texture.
name | The name of the texture to retrieve. |
Definition at line 280 of file engine.cpp.
friend class GluonCore::Singleton< Engine > [friend] |