Class sandy.core.World3D

Description

The 3D world for displaying the Objects.

World3D is a singleton class, it's the central point of Sandy :
You can have only one World3D, which contain Groups, Cameras and Lights

See Also

Field Index

onContainerCreatedEVENT, onLightAddedEVENT, onRenderEVENT, onStartEVENT, onStopEVENT

Method Index

addCamera(), addEventListener(), getAmbientLight(), getCamera(), getCameraList(), getContainer(), getCurrentCamera(), getCurrentProjectionMatrix(), getInstance(), getLight(), getObjects(), getRootGroup(), getVersion(), killInstance(), removeEventListener(), render(), resetContainer(), setAmbientLight(), setCamera(), setContainer(), setLight(), setRootGroup(), stop(), toString()

Field Detail

onRenderEVENT

static public onRenderEVENT:EventType
The World3D rendering Event. It's the event broadcasted every time the world is rendered

onStartEVENT

static public onStartEVENT:EventType
The World3D start Event. Broadcasted when the world start to be rendered

onStopEVENT

static public onStopEVENT:EventType
The World3D stop Event. Broadcasted when the world stop to be rendered

onLightAddedEVENT

static public onLightAddedEVENT:EventType

onContainerCreatedEVENT

static public onContainerCreatedEVENT:EventType

Method Detail

resetContainer

public function resetContainer(mc:MovieClip):Void

Removes the container clip and recreates it. This is a Kludge in order to clean up screen when resetting the world - unsupported and likely buggy

setContainer

public function setContainer(mc:MovieClip):Void

getContainer

public function getContainer(Void):MovieClip

addEventListener

public function addEventListener(e:EventType, o):Void

Add a listener for a specific event.

Parameters

oThe object listener

removeEventListener

public function removeEventListener(e:EventType, oL):Void

Remove a listener for a specific event.

Parameters

eEventType The type of event we want to register
oLThe object listener

getObjects

public function getObjects(Void):Array

Allows to get the array of all the objects

Parameters

Void

Return

Object3D array

getInstance

static public function getInstance(mc:MovieClip):World3D

Get the Singleton instance of World3D.

Return

World3D, the only one instance possible

getVersion

static public function getVersion(Void):String

Returns a version string ("1.2"), useful for conditional code

killInstance

static public function killInstance(Void):World3D

Kills the single instance, so it can be recreated - unsupported and likely buggy

setCamera

public function setCamera(pCam:Camera3D):Void

Set the Camera3D of the world.

Parameters

addCamera

public function addCamera(pCam:Camera3D):Void

Set the Camera3D of the world. Deprecated. Maintained for backward- compatibility with Sandy 1.1, even though it just sets the only camera.

Parameters

getCameraList

public function getCameraList(Void):Array

Get the list of Camera3D of the world. Deprecated. Maintained for backward- compatibility with Sandy 1.1, even though it just returns the only camera.

Return

The Camera3D array

getCamera

public function getCamera(id:Number):Camera3D

Get the Camera3D of the world. @param id Number The id of the camera you want. Ignored. Always assumes 0.

Return

The Camera3D

setLight

public function setLight(l:Light3D):Void

We set the unique ligth of the 3D world.

Parameters

lLight3D The light instance

Return

Void nothing

getLight

public function getLight(Void):Light3D

Returns the world light reference.

Parameters

VoidNothing

Return

Light3D The light reference

setAmbientLight

public function setAmbientLight(a:Number):Void

Specify the lowest light level in the world

Parameters

athe light level

getAmbientLight

public function getAmbientLight(Void):Number

Get the lowest light level setting

Return

Number light level

setRootGroup

public function setRootGroup(objGroup:Group):Void

Add a Group to the world.

Parameters

objGroupThe group to add. It must not be a transformGroup !

Return

Number The identifier of the object in the list. With that you will be able to use getGroup method.

getRootGroup

public function getRootGroup(Void):Group

Get the root Group of the world.

Return

Group THe root group of the World3D instance.

render

public function render(Void):Void

Compute all groups, and draw them. Should be call only once, or everytime after a Wordl3D.stop call.

stop

public function stop(Void):Void

Stop the rendering of the World3D. You can start again th rendering by calling render method.

getCurrentProjectionMatrix

public function getCurrentProjectionMatrix(Void):Matrix4

Allows to get the current matrix projection ( usefull since there's several cameras allowed )

Parameters

Void

Return

Matrix4 The current projection matrix

getCurrentCamera

public function getCurrentCamera(Void):Camera3D

Allows to get the current camera. Deprecated. Always returns first and only camera.

Parameters

Void

Return

Camera3D The current camera

toString

public function toString(Void):String