Packagesandy.core.scenegraph
Classpublic class Camera3D
InheritanceCamera3D Inheritance ATransformable Inheritance Node

The Camera3D class is used to create a camera for the Sandy world.

As of this version of Sandy, the camera is added to the object tree, which means it is transformed in the same manner as any other object.

[ToDo: Describe the camera in some detail]



Public Properties
 PropertyDefined by
 InheritedboundingBox : BBox
The bounding box of this node IMPORTANT: Do not modify it unless you perfectly know what you are doing
Node
 InheritedboundingSphere : BSphere
The bounding sphere of this node IMPORTANT: Do not modify it unless you perfectly know what you are doing
Node
 Inheritedbroadcaster : BubbleEventBroadcaster
The broadcaster

The broadcaster is used to send events to listeners.
This property is a BubbleEventBroadcaster.

Node
 Inheritedchanged : Boolean = false
This property set the cache status of the current node.
Node
 Inheritedchildren : Array
The children of this node are stored inside this array.
Node
 Inheritedculled : CullingState
This property represent the culling state of the current node.
Node
 Inheriteddisable : Boolean = false
Disable the local transformations applied to this Node if set to false.
ATransformable
  far : Number
Far plane distance for culling/clipping.
Camera3D
  fov : Number
The angle of view of this camera in degrees.
Camera3D
  frustrum : Frustum
The frustum of the camera.
Camera3D
  invModelMatrix : Matrix4

Inverse of the model matrix This is apply at the culling phasis The matrix is inverted in comparison of the real model view matrix.
This allows replacement of the objects in the correct camera frame before projection

Camera3D
  invProjectionMatrix : Matrix4
[read-only] Returns the inverse of the projection matrix of this camera.
Camera3D
 Inheritedmatrix : Matrix4
ATransformable
 InheritedmodelMatrix : Matrix4
Cached matrix corresponding to the transformation to the 0,0,0 frame system
Node
 Inheritedname : String
Name of this node.
Node
  nbPolygons : uint = 0
Camera3D
  nbVertices : uint = 0
Camera3D
  near : Number
Near plane distance for culling/clipping.
Camera3D
 Inheritedout : Vector
Forward direction ( local z ) in parent coordinates.
ATransformable
 Inheritedpan : Number
Pans this object around the local y axis.
ATransformable
 Inheritedparent : Node
The parent node of this node.
Node
  projectionMatrix : Matrix4
[read-only] Returns the projection matrix of this camera.
Camera3D
 Inheritedroll : Number
Rolls this object around the local z axis.
ATransformable
 InheritedrotateX : Number
Rotates this object around an axis parallel to the parents x axis.
ATransformable
 InheritedrotateY : Number
Rotates this object around an axis parallel to the parents y axis.
ATransformable
 InheritedrotateZ : Number
Rotates this object around an axis paralell to the parents z axis.
ATransformable
 InheritedscaleX : Number
x scale of this object.
ATransformable
 InheritedscaleY : Number
y scale of this object.
ATransformable
 InheritedscaleZ : Number
z scale of this object.
ATransformable
 Inheritedscene : Scene3D = null
Reference to the scene is it linked to.
Node
 Inheritedside : Vector
Side direction ( local x ) in parent coordinates.
ATransformable
 Inheritedtarget : Vector
The position in the parent frame this object should "look at".
ATransformable
 Inheritedtilt : Number
Getter for the tilt value
ATransformable
 Inheritedup : Vector
Up direction ( local y ) in parent coordinates.
ATransformable
 InheritedviewMatrix : Matrix4
Cached matrix corresponding to the transformation to the camera frame system
Node
  viewport : ViewPort
The camera viewport
Camera3D
 Inheritedvisible : Boolean = true
Specify the visibility of this node.
Node
 Inheritedx : Number
x position of this object in its parent frame.
ATransformable
 Inheritedy : Number
y position of this object in its parent frame.
ATransformable
 Inheritedz : Number
z position of the node in its parent frame.
ATransformable
Protected Properties
 PropertyDefined by
 Inheritedm_oEB : BubbleEventBroadcaster
Node
 Inheritedm_oPreviousOffsetRotation : Vector
ATransformable
 Inheritedm_tmpMt : Matrix4
ATransformable
 Inherited_oScale : Vector
ATransformable
 Inherited_p : Vector
ATransformable
 Inherited_vOut : Vector
ATransformable
 Inherited_vSide : Vector
ATransformable
 Inherited_vUp : Vector
ATransformable
Public Methods
 MethodDefined by
  
Camera3D(p_nWidth:Number, p_nHeight:Number, p_nFov:Number = 45, p_nNear:Number = 50, p_nFar:Number = 10000)
Creates a camera for projecting visible objects in the world.
Camera3D
 Inherited
addChild(p_oChild:Node):void
Adds a new child to this node.
Node
 Inherited
addEventListener(p_sEvt:String, p_oL:*):void
Adds a listener for the specified event.
Node
  
Adds a displayable object to the display list.
Camera3D
  
cull(p_oScene:Scene3D, p_oFrustum:Frustum, p_oViewMatrix:Matrix4, p_bChanged:Boolean):void
Nothing to do - the camera can't be culled
Camera3D
  
destroy():void
Delete the camera node and clear its displaylist.
Camera3D
 Inherited
getChildByName(p_sName:String, p_bRecurs:Boolean = false):Node
Returns the child node with the specified name.
Node
 Inherited
getChildFromId(p_nId:uint, p_bRecurs:Boolean = false):Node
Returns the child node with the specified id.
Node
 Inherited
getChildList():Array
Returns an array with all child nodes of this node.
Node
 Inherited
getPosition(p_sMode:String = "local"):Vector
Returns the position of this group or object.
ATransformable
 Inherited
hasParent():Boolean
Tests if this node has a parent.
Node
 Inherited
initFrame():void
Initiates the local coordinate system for this object.
ATransformable
 Inherited
isParent(p_oNode:Node):Boolean
Tests if the node passed in the argument is parent of this node.
Node
 Inherited
lookAt(p_nX:Number, p_nY:Number, p_nZ:Number):void
Makes this object "look at" the specified position in the parent frame.
ATransformable
 Inherited
moveForward(p_nD:Number):void
Translates this object along its forward vector ( local z ) in the parent frame.
ATransformable
 Inherited
moveHorizontally(p_nD:Number):void
Translates this object parallel to its parent zx plane and in its forward direction.
ATransformable
 Inherited
moveLateraly(p_nD:Number):void
Translates this object laterally in its parent frame.
ATransformable
 Inherited
moveSideways(p_nD:Number):void
Translates this object along its side vector ( local x ) in the parent frame.
ATransformable
 Inherited
moveUpwards(p_nD:Number):void
Translates this object along its up vector ( local y ) in the parent frame.
ATransformable
 Inherited
moveVertically(p_nD:Number):void
Translates this object vertically in ots parent frame.
ATransformable
  
projectArray(p_oList:Array):void

Project the vertices list given in parameter.

Camera3D
  
projectVertex(p_oVertex:Vertex):void

Project the vertex passed as parameter.

Camera3D
 Inherited
remove():void
Removes this node from the node tree, saving its child nodes.
Node
 Inherited
removeChildById(p_nId:Number):Boolean
Removes the child node with the specified id.
Node
 Inherited
removeChildByName(p_sName:String):Boolean
Removes the child node with the specified name.
Node
 Inherited
removeEventListener(p_sEvt:String, p_oL:*):void
Removes a listener for the specified event.
Node
  
render(p_oScene:Scene3D, p_oCamera:Camera3D):void
Nothing is done here - the camera is not rendered
Camera3D
  
renderDisplayList(p_oScene:Scene3D):void
Process the rendering of the scene.
Camera3D
 Inherited
rotateAxis(p_nX:Number, p_nY:Number, p_nZ:Number, p_nAngle:Number):void
Rotate this object around the specified axis in the parent frame by the specified angle.
ATransformable
  
setPerspectiveProjection(p_nFovY:Number, p_nAspectRatio:Number, p_nZNear:Number, p_nZFar:Number):void
Sets a projection matrix with perspective.
Camera3D
 Inherited
setPosition(p_nX:Number, p_nY:Number, p_nZ:Number):void
Sets the position of this object in coordinates of its parent frame.
ATransformable
 Inherited
swapParent(p_oNewParent:Node):void
Moves this node to another parent node.
Node
  
toString():String
Camera3D
 Inherited
translate(p_nX:Number, p_nY:Number, p_nZ:Number):void
Translate this object from it's current position with the specified offsets.
ATransformable
  
update(p_oScene:Scene3D, p_oModelMatrix:Matrix4, p_bChanged:Boolean):void
Updates the state of the camera transformation.
Camera3D
  
Updates the perspective projection.
Camera3D
 Inherited
Updates the transform matrix of the current object/node before it is rendered.
ATransformable
Public Constants
 ConstantDefined by
 Inheritedid : uint
The unique id of this node in the node graph.
Node
Property detail
farproperty
far:Number  [read-write]

Far plane distance for culling/clipping.

Implementation
    public function get far():Number
    public function set far(value:Number):void
fovproperty 
fov:Number  [read-write]

The angle of view of this camera in degrees.

Implementation
    public function get fov():Number
    public function set fov(value:Number):void
frustrumproperty 
public var frustrum:Frustum

The frustum of the camera.

invModelMatrixproperty 
public var invModelMatrix:Matrix4

Inverse of the model matrix This is apply at the culling phasis The matrix is inverted in comparison of the real model view matrix.
This allows replacement of the objects in the correct camera frame before projection

invProjectionMatrixproperty 
invProjectionMatrix:Matrix4  [read-only]

Returns the inverse of the projection matrix of this camera.

Implementation
    public function get invProjectionMatrix():Matrix4
nbPolygonsproperty 
public var nbPolygons:uint = 0
nbVerticesproperty 
public var nbVertices:uint = 0
nearproperty 
near:Number  [read-write]

Near plane distance for culling/clipping.

Implementation
    public function get near():Number
    public function set near(value:Number):void
projectionMatrixproperty 
projectionMatrix:Matrix4  [read-only]

Returns the projection matrix of this camera.

Implementation
    public function get projectionMatrix():Matrix4
viewportproperty 
public var viewport:ViewPort

The camera viewport

Constructor detail
Camera3D()constructor
public function Camera3D(p_nWidth:Number, p_nHeight:Number, p_nFov:Number = 45, p_nNear:Number = 50, p_nFar:Number = 10000)

Creates a camera for projecting visible objects in the world.

By default the camera shows a perspective projection

Parameters
p_nWidth:Number — Width of the camera viewport in pixels
 
p_nHeight:Number — Height of the camera viewport in pixels
 
p_nFov:Number (default = 45) — The vertical angle of view in degrees - Default 45
 
p_nNear:Number (default = 50) — The distance from the camera to the near clipping plane - Default 50
 
p_nFar:Number (default = 10000) — The distance from the camera to the far clipping plane - Default 10000
Method detail
addToDisplayList()method
public function addToDisplayList(p_oShape:IDisplayable):void

Adds a displayable object to the display list.

Parameters
p_oShape:IDisplayable — The object to add
cull()method 
public override function cull(p_oScene:Scene3D, p_oFrustum:Frustum, p_oViewMatrix:Matrix4, p_bChanged:Boolean):void

Nothing to do - the camera can't be culled

Parameters
p_oScene:Scene3D
 
p_oFrustum:Frustum
 
p_oViewMatrix:Matrix4
 
p_bChanged:Boolean
destroy()method 
public override function destroy():void

Delete the camera node and clear its displaylist.

projectArray()method 
public function projectArray(p_oList:Array):void

Project the vertices list given in parameter. The vertices are projected to the screen, as a 2D position.

Parameters
p_oList:Array
projectVertex()method 
public function projectVertex(p_oVertex:Vertex):void

Project the vertex passed as parameter. The vertices are projected to the screen, as a 2D position.

Parameters
p_oVertex:Vertex
render()method 
public override function render(p_oScene:Scene3D, p_oCamera:Camera3D):void

Nothing is done here - the camera is not rendered

Parameters
p_oScene:Scene3D
 
p_oCamera:Camera3D
renderDisplayList()method 
public function renderDisplayList(p_oScene:Scene3D):void

Process the rendering of the scene. The camera has all the information needed about the objects to render. The camera stores all the visible shape/polygons into an array, and loop through it calling their display method. Before the display call, the container graphics is cleared.

Parameters
p_oScene:Scene3D
setPerspectiveProjection()method 
public function setPerspectiveProjection(p_nFovY:Number, p_nAspectRatio:Number, p_nZNear:Number, p_nZFar:Number):void

Sets a projection matrix with perspective.

This projection allows a natural visual presentation of objects, mimicking 3D perspective.

Parameters
p_nFovY:Number — The angle of view in degrees - Default 45.
 
p_nAspectRatio:Number — The ratio between vertical and horizontal dimension - Default the viewport ratio (width/height)
 
p_nZNear:Number — The distance betweeen the camera and the near plane - Default 10.
 
p_nZFar:Number — The distance betweeen the camera position and the far plane. Default 10 000.
toString()method 
public override function toString():String

Returns
String
update()method 
public override function update(p_oScene:Scene3D, p_oModelMatrix:Matrix4, p_bChanged:Boolean):void

Updates the state of the camera transformation.

Parameters
p_oScene:Scene3D — The current scene
 
p_oModelMatrix:Matrix4 — The matrix which represents the parent model matrix. Basically it stores the rotation/translation/scale of all the nodes above the current one.
 
p_bChanged:Boolean — A boolean value which specify if the state has changed since the previous rendering. If false, we save some matrix multiplication process.
updatePerspective()method 
public function updatePerspective():void

Updates the perspective projection.