Packagealternativa.engine3d.core
Classpublic class Camera3D
InheritanceCamera3D Inheritance Object3D Inheritance Object

Camera - it's three-dimensional object without its own visual representation and intended for visualising hierarchy of objects. For resource optimization camera draws only visible objects(objects in frustum). The view frustum is the volume that contains everything that is potentially visible on the screen. This volume takes the shape of a truncated pyramid, which defines by 6 planes. The apex of the pyramid is the camera position and the base of the pyramid is the farClipping. The pyramid is truncated at the nearClipping. Current version of Alternativa3D uses Z-Buffer for sorting objects, accuracy of sorting depends on distance between farClipping and nearClipping. That's why necessary to set a minimum distance between them for current scene. nearClipping mustn't be equal zero.



Public Properties
 PropertyDefined By
  blurEnabled : Boolean = true
Camera3D
 InheritedboundBox : BoundBox
Bounds of the object described as rectangular parallelepiped.
Object3D
 InheritedconcatenatedMatrix : Matrix3D
[read-only] A Matrix3D object representing the combined transformation matrices of the Object3D and all of its parent objects, back to the root level.
Object3D
  debug : Boolean = false
Turns debug mode on if true and off otherwise.
Camera3D
  depthScale : int
Camera3D
  diagram : DisplayObject
[read-only] Diagram where debug information is displayed.
Camera3D
  diagramAlign : String
Diagram alignment relatively to working space.
Camera3D
  diagramHorizontalMargin : Number
Diagram margin from the edge of working space in horizontal axis.
Camera3D
  diagramVerticalMargin : Number
Diagram margin from the edge of working space in vertical axis.
Camera3D
 InheriteddoubleClickEnabled : Boolean = false
Specifies whether the object receives doubleClick events.
Object3D
  effectMode : int = 0
Defines what will render the camera.
Camera3D
  effectRate : int = 1
Camera3D
 InheritedexcludedLights : Vector.<Light3D>
[read-only] Returns excluded lights list of current object.
Object3D
  farClipping : Number
Far distance of clipping.
Camera3D
  fov : Number
Field if view.
Camera3D
  fpsUpdatePeriod : int = 10
The amount of frames which determines the period of FPS value update in diagram.
Camera3D
 Inheritedmatrix : Matrix3D
The matrix property represents a transformation matrix that determines the position and orientation of an Object3D.
Object3D
 InheritedmouseChildren : Boolean = true
Determines whether or not the children of the object are mouse, or user input device, enabled.
Object3D
 InheritedmouseEnabled : Boolean = true
Specifies whether this object receives mouse, or other user input, messages.
Object3D
 Inheritedname : String
Name of the object.
Object3D
  nearClipping : Number
Near clipping distance.
Camera3D
 InheritednumChildren : int
[read-only] Returns the number of children of this object.
Object3D
  orthographic : Boolean = false
Determines whether orthographic (true) or perspective (false) projection is used.
Camera3D
 Inheritedparent : Object3D
[read-only] Object3D, to which this object was added as a child.
Object3D
 InheritedrotationX : Number
The angle of rotation of Object3D around the X-axis expressed in radians.
Object3D
 InheritedrotationY : Number
The angle of rotation of Object3D around the Y-axis expressed in radians.
Object3D
 InheritedrotationZ : Number
The angle of rotation of Object3D around the Z-axis expressed in radians.
Object3D
 InheritedscaleX : Number
The scale of the Object3D along the X-axis.
Object3D
 InheritedscaleY : Number
The scale of the Object3D along the Y-axis.
Object3D
 InheritedscaleZ : Number
The scale of the Object3D along the Z-axis.
Object3D
  ssaoScale : int = 0
Defines SSAO resolution.
Camera3D
  timerUpdatePeriod : int = 10
The amount of frames which determines the period of MS value update in diagram.
Camera3D
 InheriteduseHandCursor : Boolean
A Boolean value that indicates whether the pointing hand (hand cursor) appears when the pointer rolls over a Object3D.
Object3D
 InheriteduserData : Object
Custom data available to store within Object3D by user.
Object3D
  view : View
The viewport defines part of screen to which renders image seen by the camera.
Camera3D
 Inheritedvisible : Boolean = true
Whether or not the display object is visible.
Object3D
 Inheritedx : Number
X coordinate.
Object3D
 Inheritedy : Number
Y coordinate.
Object3D
 Inheritedz : Number
Z coordinate.
Object3D
Public Methods
 MethodDefined By
  
Camera3D(nearClipping:Number, farClipping:Number)
Creates a Camera3D object.
Camera3D
 Inherited
Adds given Object3D instance as a child to the end of this Object3D's children list.
Object3D
 Inherited
addChildAt(child:Object3D, index:int):Object3D
Adds a child Object3D instance to this Object3D instance.
Object3D
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
Object3D
  
addToDebug(debug:int, objectOrClass:*):void
Adds an object or a class to list of debug drawing.
Camera3D
 Inherited
Calculates object's bounds in its own coordinates
Object3D
  
calculateRay(origin:Vector3D, direction:Vector3D, viewX:Number, viewY:Number):void
Calculates a ray in global space.
Camera3D
 Inherited
clearExcludedLights(updateChildren:Boolean = false):void
Resets list of lights excluded from lighting this object.
Object3D
  
[override] Returns a copy of object.
Camera3D
 Inherited
contains(child:Object3D):Boolean
Check if given object is child of this Object3D.
Object3D
 Inherited
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
Object3D
 Inherited
excludeLight(light:Light3D, updateChildren:Boolean = false):void
Disables lighting of the object by given light.
Object3D
 Inherited
getChildAt(index:int):Object3D
Returns the child Object3D instance that exists at the specified index.
Object3D
 Inherited
Returns child Object3D instance with given name.
Object3D
 Inherited
Returns index of given child Object3D instance.
Object3D
 Inherited
getResources(hierarchy:Boolean = false, resourceType:Class = null):Vector.<Resource>
Gather the resources of this Object3D.
Object3D
 Inherited
globalToLocal(point:Vector3D):Vector3D
Converts the Vector3D object from the root Object3D (global) coordinates to the local Object3D's own coordinates.
Object3D
 Inherited
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
Object3D
 Inherited
intersectRay(origin:Vector3D, direction:Vector3D):RayIntersectionData
Searches for the intersection of an Object3D and given ray, defined by origin and direction.
Object3D
 Inherited
localToGlobal(point:Vector3D):Vector3D
Converts the Vector3D object from the Object3D's own (local) coordinates to the root Object3D (global) coordinates.
Object3D
  
lookAt(x:Number, y:Number, z:Number):void
Camera3D lookAt method
Camera3D
  
projectGlobal(point:Vector3D):Vector3D
Transforms point from global space to screen space.
Camera3D
 Inherited
Removes the specified child Object3D instance from the child list of the this Object3D instance.
Object3D
 Inherited
Removes a child Object3D from the specified index position in the child list of the Object3D.
Object3D
 Inherited
removeChildren(beginIndex:int = 0, endIndex:int = 2147483647):void
Removes child objects in given range of indexes.
Object3D
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
Object3D
  
removeFromDebug(debug:int, objectOrClass:*):void
Removed an object or a class from list of debug drawing.
Camera3D
  
render(stage3D:Stage3D):void
Rendering of objects hierarchy to the given Stage3D.
Camera3D
 Inherited
setChildIndex(child:Object3D, index:int):void
Sets index for child Object3D instance.
Object3D
  
setPosition(x:Number, y:Number, z:Number):void
Setup Camera3D position using x, y, z coordinates
Camera3D
  
startTimer():void
Starts time count.
Camera3D
  
stopTimer():void
Stops time count.
Camera3D
 Inherited
swapChildren(child1:Object3D, child2:Object3D):void
Swaps index positions of two specified child objects.
Object3D
 Inherited
swapChildrenAt(index1:int, index2:int):void
Swaps index positions of two child objects by its index.
Object3D
 Inherited
toString():String
Returns the string representation of the specified object.
Object3D
 Inherited
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
Object3D
Protected Methods
 MethodDefined By
  
[override] Copies basic properties of Object3D.
Camera3D
Events
 Event Summary Defined By
 InheritedDispatches when an Object3D is added as a child to another Object3D.Object3D
 InheritedDispatched when a user presses and releases the main button of the user's pointing device over the same Object3D.Object3D
 InheritedDispatched when a user presses and releases the main button of a pointing device twice in rapid succession over the same Object3D.Object3D
 InheritedDispatched when a user presses and releases the middle button of the user's pointing device over the same Object3D.Object3D
 InheritedDispatched when a user presses the middle pointing device button over an Object3D instance.Object3D
 InheritedDispatched when a user releases the pointing device button over an Object3D instance.Object3D
 InheritedDispatched when a user presses the pointing device button over an Object3D instance.Object3D
 InheritedDispatched when a user moves the pointing device while it is over an Object3D.Object3D
 InheritedDispatched when the user moves a pointing device away from an Object3D instance.Object3D
 InheritedDispatched when the user moves a pointing device over an Object3D instance.Object3D
 InheritedDispatched when a user releases the pointing device button over an Object3D instance.Object3D
 InheritedDispatched when a mouse wheel is spun over an Object3D instance.Object3D
 InheritedDispatched when a Object3D is about to be removed from the children list.Object3D
 InheritedDispatched when a user presses and releases the right button of the user's pointing device over the same Object3D.Object3D
 InheritedDispatched when a user presses the right pointing device button over an Object3D instance.Object3D
 InheritedDispatched when a user releases the pointing device button over an Object3D instance.Object3D
 InheritedDispatched when the user moves a pointing device away from an Object3D instance.Object3D
 InheritedDispatched when the user moves a pointing device over an Object3D instance.Object3D
Public Constants
 ConstantDefined By
  MODE_COLOR : int = 0
[static] In this mode camera will render usual color image without SSAO.
Camera3D
  MODE_DEPTH : int = 2
[static] This mode displays depth map which is z-buffer converted to grayscale.
Camera3D
  MODE_NORMALS : int = 3
[static] This mode displays normal map calculated in screen space.
Camera3D
  MODE_RAW_DEPTH : int = 1
[static] This mode represents z-buffer as it is stored with engine.
Camera3D
  MODE_SSAO_COLOR : int = 9
[static] This mode displays postprocessed image which is SSAO effect combined with usual color image.
Camera3D
  MODE_SSAO_ONLY : int = 8
[static] This mode displays pure SSAO effect.
Camera3D
Property Detail
blurEnabledproperty
public var blurEnabled:Boolean = true

debugproperty 
public var debug:Boolean = false

Turns debug mode on if true and off otherwise. The default value is false.

See also

depthScaleproperty 
depthScale:int


Implementation
    public function get depthScale():int
    public function set depthScale(value:int):void
diagramproperty 
diagram:DisplayObject  [read-only]

Diagram where debug information is displayed. To display diagram, you need to add it on the screen. FPS is an average amount of frames per second. MS is an average time of executing the code part in milliseconds. This code part is measured with startTimer - stopTimer. MEM is an amount of memory reserved by player (in megabytes). DRW is an amount of draw calls in the current frame. PLG is an amount of visible polygons in the current frame. TRI is an amount of drawn triangles in the current frame.


Implementation
    public function get diagram():DisplayObject

See also

diagramAlignproperty 
diagramAlign:String

Diagram alignment relatively to working space. You can use constants of StageAlign class.


Implementation
    public function get diagramAlign():String
    public function set diagramAlign(value:String):void
diagramHorizontalMarginproperty 
diagramHorizontalMargin:Number

Diagram margin from the edge of working space in horizontal axis.


Implementation
    public function get diagramHorizontalMargin():Number
    public function set diagramHorizontalMargin(value:Number):void
diagramVerticalMarginproperty 
diagramVerticalMargin:Number

Diagram margin from the edge of working space in vertical axis.


Implementation
    public function get diagramVerticalMargin():Number
    public function set diagramVerticalMargin(value:Number):void
effectModeproperty 
public var effectMode:int = 0

Defines what will render the camera. You should set one of following values: Camera3D.MODE_COLOR, Camera3D.MODE_DEPTH, Camera3D.MODE_NORMALS, Camera3D.MODE_RAW_DEPTH, Camera3D.MODE_SSAO_COLOR, Camera3D.MODE_SSAO_ONLY

See also

effectRateproperty 
public var effectRate:int = 1

farClippingproperty 
public var farClipping:Number

Far distance of clipping. Default value Number.MAX_VALUE.

fovproperty 
public var fov:Number

Field if view. Defines in radians. Default value is Math.PI/2 which considered with 90 degrees.

fpsUpdatePeriodproperty 
public var fpsUpdatePeriod:int = 10

The amount of frames which determines the period of FPS value update in diagram.

See also

nearClippingproperty 
public var nearClipping:Number

Near clipping distance. Default value 0. It should be as big as possible.

orthographicproperty 
public var orthographic:Boolean = false

Determines whether orthographic (true) or perspective (false) projection is used. The default value is false.

ssaoScaleproperty 
public var ssaoScale:int = 0

Defines SSAO resolution. In case of 0 SSAO resolution is equal to screen resolution, in case of 1 – half screen resolution and so on.

timerUpdatePeriodproperty 
public var timerUpdatePeriod:int = 10

The amount of frames which determines the period of MS value update in diagram.

See also

viewproperty 
public var view:View

The viewport defines part of screen to which renders image seen by the camera. If viewport is not defined, the camera would not draws anything.

Constructor Detail
Camera3D()Constructor
public function Camera3D(nearClipping:Number, farClipping:Number)

Creates a Camera3D object.

Parameters
nearClipping:Number — Near clipping distance.
 
farClipping:Number — Far clipping distance.
Method Detail
addToDebug()method
public function addToDebug(debug:int, objectOrClass:*):void

Adds an object or a class to list of debug drawing. In case of class, all object of this type will drawn in debug mode.

Parameters

debug:int — The component of object which will draws in debug mode. Should be Debug.BOUND for now. Check Debug for updates.
 
objectOrClass:*Object3D or class extended Object3D.

See also

calculateRay()method 
public function calculateRay(origin:Vector3D, direction:Vector3D, viewX:Number, viewY:Number):void

Calculates a ray in global space. The ray defines by its origin and direction. The ray goes like from the global camera position trough the point corresponding to the viewport point with coordinates viewX и viewY. The ray origin placed within nearClipping plane. This ray can be used in the Object3D.intersectRay() method. The result writes to passed arguments.

Parameters

origin:Vector3D — Ray origin will wrote here.
 
direction:Vector3D — Ray direction will wrote here.
 
viewX:Number — Horizontal coordinate in view plane, through which the ray should go.
 
viewY:Number — Vertical coordinate in view plane, through which the ray should go.

clone()method 
override public function clone():Object3D

Returns a copy of object.

Returns
Object3D — A copy of this Object3D.
clonePropertiesFrom()method 
override protected function clonePropertiesFrom(source:Object3D):void

Copies basic properties of Object3D. This method calls from clone() method.

Parameters

source:Object3DObject3D, properties of which will be copied.

lookAt()method 
public function lookAt(x:Number, y:Number, z:Number):void

Camera3D lookAt method

Parameters

x:Number
 
y:Number
 
z:Number

projectGlobal()method 
public function projectGlobal(point:Vector3D):Vector3D

Transforms point from global space to screen space. The view property should be defined.

Parameters

point:Vector3D — Point in global space.

Returns
Vector3D — A Vector3D object containing screen coordinates.
removeFromDebug()method 
public function removeFromDebug(debug:int, objectOrClass:*):void

Removed an object or a class from list of debug drawing.

Parameters

debug:int — The component of object which will draws in debug mode. Should be Debug.BOUND for now. Check Debug for updates.
 
objectOrClass:*Object3D or class extended Object3D.

See also

render()method 
public function render(stage3D:Stage3D):void

Rendering of objects hierarchy to the given Stage3D.

Parameters

stage3D:Stage3DStage3D to which image will be rendered.

setPosition()method 
public function setPosition(x:Number, y:Number, z:Number):void

Setup Camera3D position using x, y, z coordinates

Parameters

x:Number
 
y:Number
 
z:Number

startTimer()method 
public function startTimer():void

Starts time count. startTimer()and stopTimer() are necessary to measure time for code part executing. The result is displayed in the field MS of the diagram.

See also

stopTimer()method 
public function stopTimer():void

Stops time count. startTimer() and stopTimer() are necessary to measure time for code part executing. The result is displayed in the field MS of the diagram.

See also

Constant Detail
MODE_COLORConstant
public static const MODE_COLOR:int = 0

In this mode camera will render usual color image without SSAO.

MODE_DEPTHConstant 
public static const MODE_DEPTH:int = 2

This mode displays depth map which is z-buffer converted to grayscale.

MODE_NORMALSConstant 
public static const MODE_NORMALS:int = 3

This mode displays normal map calculated in screen space.

MODE_RAW_DEPTHConstant 
public static const MODE_RAW_DEPTH:int = 1

This mode represents z-buffer as it is stored with engine. For distance encoding red and green channels are used.

MODE_SSAO_COLORConstant 
public static const MODE_SSAO_COLOR:int = 9

This mode displays postprocessed image which is SSAO effect combined with usual color image.

MODE_SSAO_ONLYConstant 
public static const MODE_SSAO_ONLY:int = 8

This mode displays pure SSAO effect.