World

Inherited: None

Description

Note: A scene object creating automatically by the engine. Only one World instance can be created in the game. A scene object must be set as a parent for other game hierarchies to show them on the screen. The main scene graph object can be retrieved using Engine::sceneGraph()

Public Methods

Scene *

activeScene () const

Scene *

createScene (const std::string & name)

Object *

gameController () const

bool

isToBeUpdated ()

Scene *

loadScene (const std::string & path, bool additive)

void

makeDirty ()

bool

rayCast (const Ray & ray, float maxDistance, Ray::Hit * hit)

void

setActiveScene (Scene * scene)

void

setGameController (Object * controller)

void

setRayCastHandler (RayCastCallback callback, System * system)

void

setToBeUpdated (bool flag)

void

unloadAll ()

void

unloadScene (Scene * scene)

Static Methods

None

Methods Description

Scene * World::activeScene () const

Returns an active Scene.

There must always be one Scene marked as the active at the same time.

See also setActiveScene().


Scene * World::createScene (std::string & name)

Create an empty new Scene at runtime with the given name.


Object * World::gameController () const

Returns a game controller object.

Game controller is abstract object respocible for various gameplay aspects.

See also setGameController().


bool World::isToBeUpdated ()

Returns in case of scene must be updated in the current frame; otherwise returns false.


Scene * World::loadScene (std::string & path, bool additive)

Loads the scene stored in the .map files by the it’s path.

Note: The previous scenes will be not unloaded in the case of an additive flag is true.


void World::makeDirty ()

Marks World as dirty. Mainly used to detect scene graph configuration changes.


bool World::rayCast (Ray & ray, float maxDistance, Ray::Hit * hit)

Casts a ray, of length maxDistance, against all colliders in the World. Returns true if the ray has a hit point with a Collider; otherwise returns false.


void World::setActiveScene (Scene * scene)

Sets the scene to be active.

There must always be one Scene marked as the active at the same time.

See also activeScene().


void World::setGameController (Object * controller)

Sets the game controller.

Game controller is abstract object respocible for various gameplay aspects.

See also gameController().


void World::setRayCastHandler (RayCastCallback callback, System * system)

Sets the raycast callback function.

This function will be used to check intersections with in game geometry. In the most cases implemented in the physical engines. This callback is added by any physical system by the default.


void World::setToBeUpdated (bool flag)

Sets an update flag.

See also isToBeUpdated().


void World::unloadAll ()

Unloads all from the World.


void World::unloadScene (Scene * scene)

Unloads the scene from the World.