Neo  0.5.0
Developer Documentation
Neo::Scene Class Reference

The Scene class represents a scene in a Maratis level. More...

#include <Scene.h>

Classes

class  AdditionalData
 

Public Member Functions

 Scene (void)
 
 ~Scene (void)
 
AdditionalDatagetAdditionalData ()
 
void setAdditionalData (AdditionalData *d)
 
void setName (const char *name)
 Sets the scene name. More...
 
const char * getName (void)
 Returns the name of the scene. More...
 
Vector3 getAmbientLight ()
 
void setAmbientLight (Vector3 light)
 
void setDataMode (M_DATA_MODES dataMode)
 
M_DATA_MODES getDataMode (void)
 
void setScriptFilename (const char *scriptFilename)
 Sets the scenes script that will be executed. More...
 
const char * getScriptFilename (void)
 Returns the filename of the script that is currently attached to this scene. More...
 
void setGravity (const Vector3 &gravity)
 Sets the gravitational pull in this scene to the given value. More...
 
Vector3 getGravity (void) const
 Returns the current gravity in a MVector3. More...
 
void playLoopSounds (void)
 
void stopAllSounds (void)
 
void deleteObject (Object3d *object)
 Removes the given object from this scene and deletes its memory. More...
 
OCameraaddNewCamera (void)
 Creates a new camera, adds it to the scene and returns it. More...
 
OCameraaddNewCamera (const OCamera &camera)
 Copies the camera and adds the new instance to the scene. More...
 
OLightaddNewLight (void)
 Creates a new light source and adds it to the scene. More...
 
Object3daddNewGroup (void)
 
Object3daddNewGroup (const Object3d &object)
 
OLightaddNewLight (const OLight &light)
 Copies the light and adds the new instance to the scene. More...
 
OEntityaddNewEntity (MeshRef *meshRef)
 
OEntityaddNewEntity (const OEntity &entity)
 
OSoundaddNewSound (SoundRef *soundRef)
 
OSoundaddNewSound (const OSound &sound)
 
OTextaddNewText (FontRef *fontRef)
 
OTextaddNewText (const OText &text)
 
unsigned int getObjectsNumber (void)
 Returns the number of objects in the scene. More...
 
unsigned int getCamerasNumber (void)
 Returns the number of cameras in the scene. More...
 
unsigned int getLightsNumber (void)
 Returns the number of lights in the scene. More...
 
unsigned int getEntitiesNumber (void)
 Returns the number of entities in the scene. More...
 
unsigned int getSoundsNumber (void)
 Returns the number of sounds in the scene. More...
 
unsigned int getTextsNumber (void)
 Returns the number of text objects in the scene. More...
 
void setCurrentCameraId (unsigned int id)
 
unsigned int getCurrentCameraId (void)
 
void setCurrentCamera (OCamera *c)
 
OCameragetCurrentCamera (void)
 Returns the currently active camera from this scene. More...
 
void setCurrentFrame (int currentFrame)
 
int getCurrentFrame (void)
 
Object3dgetObjectByName (const char *name)
 Returns the object with the given name or NULL if it is not found. More...
 
Object3dgetObjectByHandle (unsigned long handle)
 Returns the object with the given ID or NULL if it is not found. More...
 
OLightgetLightByName (const char *name)
 Returns the light with the given name or NULL if it is not found. More...
 
OCameragetCameraByName (const char *name)
 Returns the camera with the given name or NULL if it is not found. More...
 
OEntitygetEntityByName (const char *name)
 Returns the entity with the given name or NULL if it is not found. More...
 
OSoundgetSoundByName (const char *name)
 Returns the sound with the given name or NULL if it is not found. More...
 
OTextgetTextByName (const char *name)
 Returns the text object with the given name or NULL if it is not found. More...
 
bool getObjectIndex (const char *name, unsigned int *id)
 Searches the object with the given name and copies the ID. More...
 
Object3dgetObjectByIndex (unsigned int index)
 
OLightgetLightByIndex (unsigned int index)
 
OCameragetCameraByIndex (unsigned int index)
 
OEntitygetEntityByIndex (unsigned int index)
 
OSoundgetSoundByIndex (unsigned int index)
 
OTextgetTextByIndex (unsigned int index)
 
void begin (void)
 
void end (void)
 
void prepareCollisionShape (OEntity *entity)
 
void prepareCollisionObject (OEntity *entity)
 
void prepareConstraints (OEntity *entity)
 
void preparePhysics (void)
 
void updatePhysics (void)
 
void update (void)
 Updates the scene and all objects in it. More...
 
void updateObjectsBehaviors (void)
 Updates all behaviors of objects in this scene. More...
 
void drawObjectsBehaviors (void)
 Call draw for all behaviors in this scene. More...
 
void updateObjectsMatrices (void)
 
void draw (OCamera *camera)
 Renders the scene to the screen. More...
 

Detailed Description

The Scene class represents a scene in a Maratis level.

One level can have multiple independent scenes with objects and scripts. You can use this to overlay a scene over another to create ingame GUI or similar.

Constructor & Destructor Documentation

Neo::Scene::Scene ( void  )
Neo::Scene::~Scene ( void  )

Member Function Documentation

OCamera* Neo::Scene::addNewCamera ( void  )

Creates a new camera, adds it to the scene and returns it.

See also
OCamera
Returns
The new camera.
OCamera* Neo::Scene::addNewCamera ( const OCamera camera)

Copies the camera and adds the new instance to the scene.

Parameters
cameraThe camera to copy.
Returns
The new copy of the camera.
OEntity* Neo::Scene::addNewEntity ( MeshRef meshRef)
OEntity* Neo::Scene::addNewEntity ( const OEntity entity)
Object3d* Neo::Scene::addNewGroup ( void  )
Object3d* Neo::Scene::addNewGroup ( const Object3d object)
OLight* Neo::Scene::addNewLight ( void  )

Creates a new light source and adds it to the scene.

See also
MOLight
Returns
The new light source.
OLight* Neo::Scene::addNewLight ( const OLight light)

Copies the light and adds the new instance to the scene.

Parameters
lightThe light to copy from.
Returns
The new copy.
OSound* Neo::Scene::addNewSound ( SoundRef soundRef)
OSound* Neo::Scene::addNewSound ( const OSound sound)
OText* Neo::Scene::addNewText ( FontRef fontRef)
OText* Neo::Scene::addNewText ( const OText text)
void Neo::Scene::begin ( void  )
void Neo::Scene::deleteObject ( Object3d object)

Removes the given object from this scene and deletes its memory.

Parameters
objectThe object to be removed.

Should also remove all children!

void Neo::Scene::draw ( OCamera camera)

Renders the scene to the screen.

This method takes the camera and renders everything from this point of view to the screen/buffer. This is done by using a subclass of RenderingContext to render.

See also
RenderingContext
Parameters
cameraThe camera to use.
void Neo::Scene::drawObjectsBehaviors ( void  )

Call draw for all behaviors in this scene.

See also
Behavior
void Neo::Scene::end ( void  )
AdditionalData* Neo::Scene::getAdditionalData ( )
inline
Vector3 Neo::Scene::getAmbientLight ( )
inline
OCamera* Neo::Scene::getCameraByIndex ( unsigned int  index)
inline
OCamera* Neo::Scene::getCameraByName ( const char *  name)

Returns the camera with the given name or NULL if it is not found.

See also
OCamera
Parameters
nameThe cameras name.
Returns
The camera or NULL.
unsigned int Neo::Scene::getCamerasNumber ( void  )
inline

Returns the number of cameras in the scene.

Returns
Number of cameras
OCamera* Neo::Scene::getCurrentCamera ( void  )

Returns the currently active camera from this scene.

See also
OCamera
Returns
The current camera.
unsigned int Neo::Scene::getCurrentCameraId ( void  )
inline
int Neo::Scene::getCurrentFrame ( void  )
inline
M_DATA_MODES Neo::Scene::getDataMode ( void  )
inline
unsigned int Neo::Scene::getEntitiesNumber ( void  )
inline

Returns the number of entities in the scene.

Returns
Number of entities
OEntity* Neo::Scene::getEntityByIndex ( unsigned int  index)
inline
OEntity* Neo::Scene::getEntityByName ( const char *  name)

Returns the entity with the given name or NULL if it is not found.

See also
MOEntity
Parameters
nameThe entities name.
Returns
The entity or NULL.
Vector3 Neo::Scene::getGravity ( void  ) const
inline

Returns the current gravity in a MVector3.

Returns
The gravity vector.
OLight* Neo::Scene::getLightByIndex ( unsigned int  index)
inline
OLight* Neo::Scene::getLightByName ( const char *  name)

Returns the light with the given name or NULL if it is not found.

See also
MOLight
Parameters
nameThe lights name.
Returns
The light or NULL.
unsigned int Neo::Scene::getLightsNumber ( void  )
inline

Returns the number of lights in the scene.

Returns
Number of lights
const char* Neo::Scene::getName ( void  )
inline

Returns the name of the scene.

Returns
The scene name.
Object3d* Neo::Scene::getObjectByHandle ( unsigned long  handle)
inline

Returns the object with the given ID or NULL if it is not found.

See also
Neo::Object3d::getId()
Parameters
handleThe object handle.
Returns
The object.
Object3d* Neo::Scene::getObjectByIndex ( unsigned int  index)
inline
Object3d* Neo::Scene::getObjectByName ( const char *  name)

Returns the object with the given name or NULL if it is not found.

See also
MObject3d
Parameters
nameThe objects name.
Returns
The object or NULL.
bool Neo::Scene::getObjectIndex ( const char *  name,
unsigned int *  id 
)

Searches the object with the given name and copies the ID.

The ID will be copied to the location where the pointer id points to.

Example:

unsigned int id;
scene->getObjectIndex("object", &id);
Parameters
nameThe name of the object.
idPointer to an unsigned int to retrieve the data.
Returns
Returns true if the object exists and false if it doesn't.
unsigned int Neo::Scene::getObjectsNumber ( void  )
inline

Returns the number of objects in the scene.

Returns
Number of objects
const char* Neo::Scene::getScriptFilename ( void  )
inline

Returns the filename of the script that is currently attached to this scene.

Returns
The path to the script.
OSound* Neo::Scene::getSoundByIndex ( unsigned int  index)
inline
OSound* Neo::Scene::getSoundByName ( const char *  name)

Returns the sound with the given name or NULL if it is not found.

See also
MOSound
Parameters
nameThe sounds name.
Returns
The sound or NULL.
unsigned int Neo::Scene::getSoundsNumber ( void  )
inline

Returns the number of sounds in the scene.

Returns
Number of sounds
OText* Neo::Scene::getTextByIndex ( unsigned int  index)
inline
OText* Neo::Scene::getTextByName ( const char *  name)

Returns the text object with the given name or NULL if it is not found.

See also
MOText
Parameters
nameThe objects name.
Returns
The object or NULL.
unsigned int Neo::Scene::getTextsNumber ( void  )
inline

Returns the number of text objects in the scene.

Returns
Number of text objects
void Neo::Scene::playLoopSounds ( void  )
void Neo::Scene::prepareCollisionObject ( OEntity entity)
void Neo::Scene::prepareCollisionShape ( OEntity entity)
void Neo::Scene::prepareConstraints ( OEntity entity)
void Neo::Scene::preparePhysics ( void  )
void Neo::Scene::setAdditionalData ( AdditionalData d)
inline
void Neo::Scene::setAmbientLight ( Vector3  light)
inline
void Neo::Scene::setCurrentCamera ( OCamera c)
void Neo::Scene::setCurrentCameraId ( unsigned int  id)
inline
void Neo::Scene::setCurrentFrame ( int  currentFrame)
inline
void Neo::Scene::setDataMode ( M_DATA_MODES  dataMode)
inline
void Neo::Scene::setGravity ( const Vector3 gravity)
inline

Sets the gravitational pull in this scene to the given value.

This new gravity is stored in a MVector3.

Example:

scene.setGravity(MVector3(0.0f, 0.0f, -9.81f));
Parameters
gravity
void Neo::Scene::setName ( const char *  name)

Sets the scene name.

The scene name is a property by which you can find a particular scene.

See also
Level::getSceneByName
Parameters
nameThe new name which will be copied to an internal buffer.
void Neo::Scene::setScriptFilename ( const char *  scriptFilename)

Sets the scenes script that will be executed.

Sets the path to a script. Those script can contain game logics.

Parameters
scriptFilename
void Neo::Scene::stopAllSounds ( void  )
void Neo::Scene::update ( void  )

Updates the scene and all objects in it.

void Neo::Scene::updateObjectsBehaviors ( void  )

Updates all behaviors of objects in this scene.

See also
Behavior
void Neo::Scene::updateObjectsMatrices ( void  )
void Neo::Scene::updatePhysics ( void  )

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