Packagealternativa.engine3d.core
Classpublic class Camera3D
InheritanceCamera3D Inheritance Object3D

Camera showing 3D-scene on screen.

A newly created camera is directed along parent's Z axis.

To render an image seen by a camera, the camera must be assigned to a view — an instance of the alternativa.engine3d.display.View class.

See also

alternativa.engine3d.display.View


Public Properties
 PropertyDefined by
 Inheritedchildren : Set
A set of child objects.
Object3D
 Inheritedcoords : Point3D
Object coordinates.
Object3D
  currentSector : Sector
[read-only] A sector containing the camera.
Camera3D
  farClipping : Boolean
Whether or not far clipping is enabled.
Camera3D
  farClippingDistance : Number
Distance to the far clipping plane in the camera's coordinate system.
Camera3D
  focalLength : Number
[read-only] Camera's focal distance.
Camera3D
  fov : Number
FOV in radians for perspective projection.
Camera3D
 Inheritedmobility : int
Mobility level.
Object3D
 InheritedmouseEnabled : Boolean = true
Specifies whether this object receives mouse messages.
Object3D
 Inheritedname : String
Object name.
Object3D
  nearClipping : Boolean
Whether or not near clipping is enabled.
Camera3D
  nearClippingDistance : Number
Distance to the near clipping plane in a camera's coordinate system.
Camera3D
  orthographic : Boolean
Determines whether orthographic (true) or perspective (false) projection is used.
Camera3D
 Inheritedparent : Object3D
Parent object.
Object3D
 InheritedrotationX : Number
X-axis rotation angle in radians.
Object3D
 InheritedrotationY : Number
Y-axis rotation angle in radians.
Object3D
 InheritedrotationZ : Number
Z-axis rotation angle in radians.
Object3D
 InheritedscaleX : Number
X-axis scale coefficient.
Object3D
 InheritedscaleY : Number
Y-axis scale coefficient.
Object3D
 InheritedscaleZ : Number
Z-axis scale coefficient.
Object3D
 Inheritedscene : Scene3D
Scene containing given object.
Object3D
 Inheritedtransformation : Matrix3D
Full (global) transformation matrix of an object.
Object3D
  view : View
A view to which an image from the camera is rendered.
Camera3D
  viewClipping : Boolean
Whether or not clipping by view pyramid is enabled.
Camera3D
 Inheritedx : Number
X coordinate.
Object3D
 Inheritedy : Number
Y coordinate.
Object3D
 Inheritedz : Number
Z coordinate.
Object3D
  zoom : Number
Image zoom coefficient in orthographic mode.
Camera3D
Public Methods
 MethodDefined by
  
Camera3D(name:String = null)
Creates a new camera instance.
Camera3D
 Inherited
Adds a child object.
Object3D
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener.
Object3D
 Inherited
Clones object.
Object3D
 Inherited
dispatchEvent(event:Event):Boolean
Dispatches an event.
Object3D
 Inherited
forEach(func:Function):void
Calls the specified function for the object an all its children, passing the current object as an argument.
Object3D
 Inherited
getChildByName(name:String, deep:Boolean = false):Object3D
Gets a child object with the given name.
Object3D
 Inherited
globalToLocal(point:Point3D, result:Point3D = null):Point3D
Transforms a point form global coordinate system to an object's coordinate system
Object3D
 Inherited
hasEventListener(type:String):Boolean
Checks if there are registered event listeners for events of the specified type.
Object3D
 Inherited
localToGlobal(point:Point3D, result:Point3D = null):Point3D
Transforms a point from local coordinate system of an object to global coordinate system.
Object3D
 Inherited
Delete child object.
Object3D
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes an event listener.
Object3D
 Inherited
toString():String
Get string representation of object.
Object3D
 Inherited
willTrigger(type:String):Boolean
Object3D
Protected Methods
 MethodDefined by
  
addToScene(scene:Scene3D):void
Method is being called when adding object to scene.
Camera3D
  
Copies the source object's properties.
Camera3D
  
Creates` empty object without inner structure.
Camera3D
  
defaultName():String
Default object name.
Camera3D
  
Method is being called whed deleting object from a scene.
Camera3D
Events
 EventSummaryDefined by
 Inherited Dispatched when a user presses and releases left mouse button over the same object.Object3D
 Inherited Dispatched when a user presses left mouse button over an object.Object3D
 Inherited Dispatched when a user moves mouse pointer while it is over an object.Object3D
 Inherited Dispatched when a user moves mouse pointer away from an object.Object3D
 Inherited Dispatched when a user moves mouse pointer over an object.Object3D
 Inherited Dispatched when a user releases left mouse button over an object.Object3D
 Inherited Dispatched when a user spins mouse wheel over an object.Object3D
Property detail
currentSectorproperty
currentSector:Sector  [read-only]

A sector containing the camera.

For proper method's behavior the scene must be rebuilt by calling the Scene.calculate() method after the following properties have changed: Scene.splitters, Scene.sectors, Scene.planeOffsetThreshold.

Implementation
    public function get currentSector():Sector

See also

farClippingproperty 
farClipping:Boolean  [read-write]

Whether or not far clipping is enabled. When the property is set to true, all geometry with Z-coordinate in the camera coordinates system greater than specified value is not rendered. If the property is set to false, geometry is not clipped.

The default value is false.

Implementation
    public function get farClipping():Boolean
    public function set farClipping(value:Boolean):void

See also

farClippingDistanceproperty 
farClippingDistance:Number  [read-write]

Distance to the far clipping plane in the camera's coordinate system. If a negative value is specified, the property is set to zero.

The default value is 1.

Implementation
    public function get farClippingDistance():Number
    public function set farClippingDistance(value:Number):void

See also

focalLengthproperty 
focalLength:Number  [read-only]

Camera's focal distance. The value is calculated by formula f = d/tan(fov/2), where d is a half of the view diagonal. If the camera is not connected to a view, the value is NaN.

Implementation
    public function get focalLength():Number

See also

fov
fovproperty 
fov:Number  [read-write]

FOV in radians for perspective projection. When FOV is changed, the focal length of a camera is calculated using the formula f = d/tan(fov/2), where d is half diagonal of the view. FOV is limited by the range [0, PI] radians.

Implementation
    public function get fov():Number
    public function set fov(value:Number):void

See also

focalLength
nearClippingproperty 
nearClipping:Boolean  [read-write]

Whether or not near clipping is enabled. When the property is set to true, all geometry with Z-coordinate in a camera coordinates system less than specified value is not rendered. If the property is set to false, geometry is not clipped.

The default value is false.

Implementation
    public function get nearClipping():Boolean
    public function set nearClipping(value:Boolean):void

See also

nearClippingDistanceproperty 
nearClippingDistance:Number  [read-write]

Distance to the near clipping plane in a camera's coordinate system. If a negative value is specified, the property is set to zero.

The default value is 1.

Implementation
    public function get nearClippingDistance():Number
    public function set nearClippingDistance(value:Number):void

See also

orthographicproperty 
orthographic:Boolean  [read-write]

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

The default value is false.

Implementation
    public function get orthographic():Boolean
    public function set orthographic(value:Boolean):void
viewproperty 
view:View  [read-write]

A view to which an image from the camera is rendered.

Implementation
    public function get view():View
    public function set view(value:View):void
viewClippingproperty 
viewClipping:Boolean  [read-write]

Whether or not clipping by view pyramid is enabled. When the property is set to true, geometry is clipped by view pyramid. If value of false is specified, no clipping occurs. This can improve performance when the whole scene is in the view pyramid.

If there are objects behind the camera, it's not recommended to turn off view clipping and near clipping simultaneously, since it will cause rendering artifacts and, in case of using texture materials, the procedure of adaptive triangulation may fall into an endless cycle.

The default value is true.

Implementation
    public function get viewClipping():Boolean
    public function set viewClipping(value:Boolean):void

See also

zoomproperty 
zoom:Number  [read-write]

Image zoom coefficient in orthographic mode.

Implementation
    public function get zoom():Number
    public function set zoom(value:Number):void
Constructor detail
Camera3D()constructor
public function Camera3D(name:String = null)

Creates a new camera instance.

Parameters
name:String (default = null)camera name
Method detail
addToScene()method
protected override function addToScene(scene:Scene3D):void

Method is being called when adding object to scene. Descendants may redefine method for making specific actions.

Parameters
scene:Scene3Dscene, which object is being added to
clonePropertiesFrom()method 
protected override function clonePropertiesFrom(source:Object3D):void

Copies the source object's properties. This method is being used in clone() method and must be redefined in its descendants to get a right object. Every descendant must copy only the properties that were introduced in the descendant's class. Inherited properties are copied by calling super.clonePropertiesFrom(source).

Parameters
source:Object3Dobject, which properties are being copied
createEmptyObject()method 
protected override function createEmptyObject():Object3D

Creates` empty object without inner structure. For example, if geometrical primitive, when added, forms a bunch of vertices, faces and surfaces, this method doesn't create them. This method is being used in clone() and has to be redefined in descendants in order to get the right object.

Returns
Object3Da new empty object
defaultName()method 
protected override function defaultName():String

Default object name.

Returns
Stringdefault object name
removeFromScene()method 
protected override function removeFromScene(scene:Scene3D):void

Method is being called whed deleting object from a scene.Descendants may redefine method for making specific actions.

Parameters
scene:Scene3Dscena, from which the object is being deleted from