#include <CWorld.h>
Public Member Functions | |
cWorld () | |
Constructor of cWorld. | |
virtual | ~cWorld () |
Destructor of cWorld. | |
void | setBackgroundColor (const GLfloat a_red, const GLfloat a_green, const GLfloat a_blue) |
Set the background color used when rendering. | |
void | setBackgroundColor (const cColorf &a_color) |
Set the background color used when rendering. | |
cColorf | getBackgroundColor () const |
Get the background color used when rendering. | |
void | enableLightSourceRendering (bool enable) |
Enable or disable the rendering of this world's light sources. | |
cTexture2D * | newTexture () |
Create a new bitmap texture. | |
cTexture2D * | getTexture (unsigned int a_index) |
Get a pointer to a texture by passing an index into my texture list. | |
void | addTexture (cTexture2D *a_texture) |
Add a texture to my texture list. | |
bool | removeTexture (cTexture2D *a_texture) |
Remove a texture from my texture list. | |
bool | deleteTexture (cTexture2D *a_texture) |
Delete a texture. | |
void | deleteAllTextures () |
Delete all textures. | |
virtual bool | computeCollisionDetection (cVector3d &a_segmentPointA, cVector3d &a_segmentPointB, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings) |
Compute collision detection between a ray segment and all objects in this world. | |
virtual void | render (const int a_renderMode=0) |
Render OpenGL lights. | |
virtual cLight * | getLightSource (int index) |
Get access to a particular light source (between 0 and MAXIMUM_OPENGL_LIGHT_COUNT-1). | |
virtual void | onDisplayReset (const bool a_affectChildren=true) |
Resets textures and displays for the world. | |
Public Attributes | |
double | m_worldModelView [16] |
It's useful to store the world's modelview matrix, for rendering stuff in "global" coordinates. | |
Protected Member Functions | |
bool | addLightSource (cLight *a_light) |
Add a light source to this world. | |
bool | removeLightSource (cLight *a_light) |
Remove a light source from this world. | |
Protected Attributes | |
cColorf | m_backgroundColor |
Background color. Default color is black. | |
vector< cTexture2D * > | m_textures |
List of textures. | |
vector< cLight * > | m_lights |
List of light sources. | |
bool | m_renderLightSources |
Should I render my light sources, or just use the current OpenGL light state? | |
bool | m_performingDisplayReset |
Some apps may have multiple cameras, which would cause recursion when resetting the display. | |
Friends | |
class | cLight |
cWorld::~cWorld | ( | ) | [virtual] |
bool cWorld::addLightSource | ( | cLight * | a_light | ) | [protected] |
Add a light source to this world.
Add an OpenGL light source to the world. A maximum of eight light sources can be registered. For each registered light source, an OpenGL lightID number is defined
a_light | light source to register. |
void cWorld::addTexture | ( | cTexture2D * | a_texture | ) |
Add a texture to my texture list.
Add texture to texture list.
a_texture | Texture to be added to the textures list. |
bool cWorld::computeCollisionDetection | ( | cVector3d & | a_segmentPointA, | |
cVector3d & | a_segmentPointB, | |||
cCollisionRecorder & | a_recorder, | |||
cCollisionSettings & | a_settings | |||
) | [virtual] |
Compute collision detection between a ray segment and all objects in this world.
Determine whether the given segment intersects a triangle in this world. The segment is described by a start point /e a_segmentPointA and end point /e a_segmentPointB. Collision detection functions of all children of the world are called, which recursively call the collision detection functions for all objects in this world. If there is more than one collision, the one closest to a_segmentPointA is the one returned.
a_segmentPointA | Start point of segment. Value may be changed if returned collision is with a moving object. | |
a_segmentPointB | End point of segment. | |
a_recorder | Stores all collision events | |
a_settings | Contains collision settings information. |
Reimplemented from cGenericObject.
void cWorld::deleteAllTextures | ( | ) |
Delete all textures.
Delete all texture from memory.
bool cWorld::deleteTexture | ( | cTexture2D * | a_texture | ) |
Delete a texture.
Delete texture from textures list and erase it from memory.
a_texture | Texture to be deleted. |
cLight * cWorld::getLightSource | ( | int | index | ) | [virtual] |
Get access to a particular light source (between 0 and MAXIMUM_OPENGL_LIGHT_COUNT-1).
Get access to a particular light source (between 0 and MAXIMUM_OPENGL_LIGHT_COUNT-1). Returns a pointer to the requested light, or zero if it's not available.
index | Specifies the light (0 -> 7) that should be accessed |
cTexture2D * cWorld::newTexture | ( | ) |
Create a new bitmap texture.
Create new texture and add it to textures list.
void cWorld::onDisplayReset | ( | const bool | a_affectChildren = true |
) | [virtual] |
Resets textures and displays for the world.
Called by the user or by the viewport when the world needs to have textures and display lists reset (e.g. after a switch to or from fullscreen).
a_affectChildren | Should I pass this on to my children? |
Reimplemented from cGenericObject.
bool cWorld::removeLightSource | ( | cLight * | a_light | ) | [protected] |
Remove a light source from this world.
Remove a light source from world.
a_light | light source to be removed. |
bool cWorld::removeTexture | ( | cTexture2D * | a_texture | ) |
Remove a texture from my texture list.
Remove texture from textures list. Texture is not deleted from memory.
a_texture | Texture to be removed from textures list. |
void cWorld::render | ( | const int | a_renderMode = 0 |
) | [virtual] |
Render OpenGL lights.
Render the world in OpenGL.
a_renderMode | Rendering Mode. |
Reimplemented from cGenericObject.
void cWorld::setBackgroundColor | ( | const cColorf & | a_color | ) |
void cWorld::setBackgroundColor | ( | const GLfloat | a_red, | |
const GLfloat | a_green, | |||
const GLfloat | a_blue | |||
) |