GluonGraphics::Engine Class Reference

Main entrypoint for working with Gluon Graphics. More...

#include <engine.h>

Inheritance diagram for GluonGraphics::Engine:
GluonCore::Singleton< T > QObject

List of all members.

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 ()
ItemcreateItem (const QString &mesh)
void destroyItem (Item *item)
MaterialcreateMaterial (const QString &name)
void destroyMaterial (const QString &name)
bool hasMaterial (const QString &name)
Materialmaterial (const QString &name)
bool addMaterial (const QString &name, Material *material)
void removeMaterial (const QString &name)
MeshcreateMesh (const QString &name)
void destroyMesh (const QString &name)
bool hasMesh (const QString &name)
Meshmesh (const QString &name)
bool addMesh (const QString &name, Mesh *mesh)
void removeMesh (const QString &name)
TexturecreateTexture (const QString &name)
void destroyTexture (const QString &name)
bool hasTexture (const QString &name)
Texturetexture (const QString &name)
bool addTexture (const QString &name, Texture *texture)
void removeTexture (const QString &name)
CameraactiveCamera ()
ViewportcurrentViewport ()

Friends

class GluonCore::Singleton< Engine >

Detailed Description

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.


Member Function Documentation

Camera * Engine::activeCamera (  ) 

Retrieve the current active camera.

Returns:
The active camera, or 0 if no camera has been set as active yet.

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.

Parameters:
name The name used to identify the material.
Parameters:
material The material to add.
Returns:
True if successful, false if not. False is also returned when a material with the same name is already registered.

Definition at line 214 of file engine.cpp.

bool Engine::addMesh ( const QString &  name,
Mesh mesh 
)

Add a mesh to the registry.

Parameters:
name The name used to identify the mesh.
Parameters:
mesh The mesh to add.
Returns:
True if successful, false if not. False is also returned when a mesh with the same name is already registered.

Definition at line 250 of file engine.cpp.

bool Engine::addTexture ( const QString &  name,
Texture texture 
)

Add a texture to the registry.

Parameters:
name The name used to identify the texture.
Parameters:
texture The texture to add.
Returns:
True if successful, false if not. False is also returned when a texture with the same name is already registered.

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().

Parameters:
mesh The name of the mesh to attach to the new item. If this mesh does not exist yet it will be created.
Returns:
The item just created.

Definition at line 169 of file engine.cpp.

Material * Engine::createMaterial ( const QString &  name  ) 

Create a Material.

Parameters:
name The name of the material to create.
Returns:
A new material with name as name or an existing material if name is equal to an existing material.

Definition at line 190 of file engine.cpp.

Mesh * Engine::createMesh ( const QString &  name  ) 

Create a Mesh.

Parameters:
name The name of the mesh to create.
Returns:
A new mesh with name as name or an existing mesh if name is equal to an existing mesh.

Definition at line 226 of file engine.cpp.

Texture * Engine::createTexture ( const QString &  name  ) 

Create a Texture.

See also:
GluonGraphics::Texture
Parameters:
name The name of the texture to create.
Returns:
A new texture with name as name or an existing texture if name is equal to an existing texture.

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
name The name of the material to check for.
Returns:
True if the material is registered, false if not.

Definition at line 202 of file engine.cpp.

bool Engine::hasMesh ( const QString &  name  ) 

Check whether a mesh is registered.

Parameters:
name The name of the mesh to check for.
Returns:
True if the mesh is registered, false if not.

Definition at line 238 of file engine.cpp.

bool Engine::hasTexture ( const QString &  name  ) 

Check whether a texture is registered.

Parameters:
name The name of the texture to check for.
Returns:
True if the texture is registered, false if not.

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.

Parameters:
name The name of the material to retrieve.
Returns:
The material requested or 0 if not found.

Definition at line 208 of file engine.cpp.

Mesh * Engine::mesh ( const QString &  name  ) 

Retrieve a registered mesh.

Parameters:
name The name of the mesh to retrieve.
Returns:
The mesh requested or 0 if not found.

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
width The new width of the framebuffer.
Parameters:
height The new height 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.

Parameters:
name The name of the texture to retrieve.
Returns:
The texture requested or 0 if not found.

Definition at line 280 of file engine.cpp.


Friends And Related Function Documentation

friend class GluonCore::Singleton< Engine > [friend]

Definition at line 328 of file engine.h.


The documentation for this class was generated from the following files:
Generated on Mon Dec 27 13:13:43 2010 for Gluon by  doxygen 1.6.3