Packagesandy.core
Classpublic class Scene3D
InheritanceScene3D Inheritance flash.events.EventDispatcher
SubclassesWorld3D

The Scene3D object is the central point of a Sandy world.

You can have multiple Scene3D objects in the same application.
The older World3D is a singleton special case of Scene3D.
The scene contains the object tree with groups, a camera, a light source and a canvas to draw on.


Example
To create a scene, you pass a container, a camera and a root group to its constructor.
The rendering of the world is driven by a "heart beat", which may be a Timer or the Event.ENTER_FRAME event.
   var camera:Camera3D = new Camera3D(400, 300);
   camera.z = -200;
   // The call to createScene() will create the root Group of this scene
   var scene:Scene3D = new Scene3D("Scene 1", this, camera, createScene());
   scene.root.addChild(camera);
   //The handler calls the world.render() method to render the world for each frame.
   addEventListener(Event.ENTER_FRAME, enterFrameHandler);
  



Public Properties
 PropertyDefined by
  camera : Camera3D
The camera looking at this scene.
Scene3D
  container : Sprite
The container that stores all displayabel objects for this scene.
Scene3D
  light : Light3D
The simple light of this scene.
Scene3D
  materialManager : MaterialManager
The material manager for the scene.
Scene3D
  name : String
[read-only] Returns the scene's name as a string value.
Scene3D
  rectClipping : Boolean
Enable this property (default value is true!) to perfectly clip your 3D scene to the viewport dimension.
Scene3D
  root : Group
The root of the scene graph for this scene.
Scene3D
Public Methods
 MethodDefined by
  
Scene3D(p_sName:String, p_oContainer:Sprite, p_oCamera:Camera3D = null, p_oRootNode:Group = null)
Creates a new Scene.
Scene3D
  
dispose():Boolean
Dispose all the resources of this given scene.
Scene3D
  
render(p_oEvt:SandyEvent = null):void
Renders this scene into its display object container.
Scene3D
Events
 EventSummaryDefined by
   Dispatched when a light is added to the scene.Scene3D
   Dispatched when the scene is culled.Scene3D
   Dispatched when the scene is rendered.Scene3D
   Dispatched when the display list is rendered.Scene3D
   Dispatched when the scene is updated.Scene3D
Property detail
cameraproperty
public var camera:Camera3D

The camera looking at this scene.

See also

containerproperty 
public var container:Sprite

The container that stores all displayabel objects for this scene.

lightproperty 
light:Light3D  [read-write]

The simple light of this scene.

Implementation
    public function get light():Light3D
    public function set light(value:Light3D):void

See also

materialManagerproperty 
public var materialManager:MaterialManager

The material manager for the scene.

nameproperty 
name:String  [read-only]

Returns the scene's name as a string value. This value can't be changed.

Implementation
    public function get name():String
rectClippingproperty 
rectClipping:Boolean  [read-write]

Enable this property (default value is true!) to perfectly clip your 3D scene to the viewport dimension. Once enabled, even if you don't have enableClipping set to true for each of your objects, nothing will be drawn outside

Implementation
    public function get rectClipping():Boolean
    public function set rectClipping(value:Boolean):void
rootproperty 
public var root:Group

The root of the scene graph for this scene.

See also

Constructor detail
Scene3D()constructor
public function Scene3D(p_sName:String, p_oContainer:Sprite, p_oCamera:Camera3D = null, p_oRootNode:Group = null)

Creates a new Scene.

Each scene has its own container where its 2D representation will be drawn.
The scene is automatically registered with the SceneLocator.

Remember to give the scenes different names if you want to use the SceneLocator registry

Parameters
p_sName:String — The name of this scene
 
p_oContainer:Sprite — The container that will store all displayable objects for this scene
 
p_oCamera:Camera3D (default = null) — The single camera for this scene
 
p_oRootNode:Group (default = null) — The root group of the object tree for this scene

See also

Method detail
dispose()method
public function dispose():Boolean

Dispose all the resources of this given scene.

Ressources will be free, and scene unregistered from SceneLocator

Returns
Boolean
render()method 
public function render(p_oEvt:SandyEvent = null):void

Renders this scene into its display object container.

Parameters
p_oEvt:SandyEvent (default = null) — An eventual event - defaults to null. Not in use...

See also

Event detail
lightAddedevent 
Event object type: sandy.events.SandyEvent
SandyEvent.type property = sandy.events.SandyEvent.LIGHT_ADDED

Dispatched when a light is added to the scene.

Defines the value of the type property of a lightAdded event object.

scene_cullevent  
Event object type: sandy.events.SandyEvent
SandyEvent.type property = sandy.events.SandyEvent.SCENE_CULL

Dispatched when the scene is culled.

Defines the value of the type property of a scene_cull event object.

scene_renderevent  
Event object type: sandy.events.SandyEvent
SandyEvent.type property = sandy.events.SandyEvent.SCENE_RENDER

Dispatched when the scene is rendered.

Defines the value of the type property of a scene_render event object.

scene_render_display_listevent  
Event object type: sandy.events.SandyEvent
SandyEvent.type property = sandy.events.SandyEvent.SCENE_RENDER_DISPLAYLIST

Dispatched when the display list is rendered.

Defines the value of the type property of a scene_render_display_list event object.

scene_updateevent  
Event object type: sandy.events.SandyEvent
SandyEvent.type property = sandy.events.SandyEvent.SCENE_UPDATE

Dispatched when the scene is updated.

Defines the value of the type property of a scene_update event object.