Class sandy.view.Camera3D

Description

Camera3D

Field Index

frustrum, viewport

Method Index

new Camera3D()
compile(), getFov(), getMatrix(), getPitch(), getPosition(), getProjectionMatrix(), getProjectionMatrixInverse(), getRoll(), getTransformationMatrixInverse(), getTransformMatrix(), getYaw(), isModified(), lookAt(), moveForward(), moveHorizontally(), moveLateraly(), moveSideways(), moveUpwards(), moveVertically(), pan(), removeInterpolator(), resize(), roll(), rotateAxis(), rotateX(), rotateY(), rotateZ(), setInterpolator(), setPerspectiveProjection(), setPosition(), tilt(), toString(), translate()

Constructor Detail

Camera3D

public function Camera3D(p_nWidth:Number, p_nHeight:Number)

Create a new Camera3D. The default camera projection is the perspective one with default parameters values.

Parameters

Field Detail

frustrum

public frustrum:Frustum
The frustum of the camera. See class.

viewport

public viewport:Viewport

Method Detail

resize

public function resize(p_nWidth:Number, p_nHeight:Number):Void

Update the screen viewport dimensions

Parameters

moveSideways

public function moveSideways(d:Number):Void

Allow the camera to translate along its side vector. If you imagine yourself in a game, it would be a step on your right or on your left

Parameters

dNumber Move the camera along its side vector

moveUpwards

public function moveUpwards(d:Number):Void

Allow the camera to translate along its up vector. If you imagine yourself in a game, it would be a jump on the direction of your body (so not always the vertical!)

Parameters

dNumber Move the camera along its up vector

moveForward

public function moveForward(d:Number):Void

Allow the camera to translate along its view vector. If you imagine yourself in a game, it would be a step in the direction you look at. If you look the sky you will translate upwards ! So be careful with its use.

Parameters

dNumber Move the camera along its viw vector

moveHorizontally

public function moveHorizontally(d:Number):Void

Allow the camera to translate horizontally If you imagine yourself in a game, it would be a step in the direction you look at but without changing your altitude.

Parameters

dNumber Move the camera horizontally

moveVertically

public function moveVertically(d:Number):Void

Allow the camera to translate vertically If you imagine yourself in a game, it would be a jump strictly vertical.

Parameters

dNumber Move the camera vertically

translate

public function translate(px:Number, py:Number, pz:Number):Void

Translate the camera from it's actual position with the offset values pased in parameters

Parameters

pxx offset that will be added to the x coordinate of the camera
pyy offset that will be added to the y coordinate position of the camera
pzz offset that will be added to the z coordinate position of the camera

moveLateraly

public function moveLateraly(d:Number):Void

Allow the camera to translate lateraly If you imagine yourself in a game, it would be a step on the right with a positiv parameter and to the left with a negative parameter

Parameters

dNumber Move the camera lateraly

rotateAxis

public function rotateAxis(ax:Number, ay:Number, az:Number, nAngle:Number):Void

Rotate the camera around a specific axis by an angle passed in parameter

Parameters

axNumber The x coordinate of the axis
ayNumber The y coordinate of the axis
azNumber The z coordinate of the axis
nAngleNumber The amount of rotation. This angle is in degrees.

lookAt

public function lookAt(px:Number, py:Number, pz:Number):Void

Make the camera look at a specific position. Useful to follow a moving object or a static object while the camera is moving.

Parameters

pxNumber The x position to look at
pyNumber The y position to look at
pzNumber The z position to look at

rotateX

public function rotateX(nAngle:Number):Void

RotateX - Rotation around the global X axis of the camera frame

Parameters

nAngleNumber The angle of rotation in degree.

Return

Void

rotateY

public function rotateY(nAngle:Number):Void

rotateY - Rotation around the global Y axis of the camera frame

Parameters

nAngleNumber The angle of rotation in degree.

Return

Void

rotateZ

public function rotateZ(nAngle:Number):Void

rotateZ - Rotation around the global Z axis of the camera frame

Parameters

nAngleNumber The angle of rotation in degree between : [ -180; 180 ].

Return

tilt

public function tilt(nAngle:Number):Void

Tilt - Rotation around the local X axis of the camera frame Range from -90 to +90 where 0 = Horizon, +90 = straight up and –90 = straight down.

Parameters

nAngleNumber The angle of rotation in degree.

Return

Void

pan

public function pan(nAngle:Number):Void

Pan - Rotation around the local Y axis of the camera frame Range from 0 to 360 where 0=North, 90=East, 180=South and 270=West.

Parameters

nAngleNumber The angle of rotation in degree.

Return

Void

roll

public function roll(nAngle:Number):Void

roll - Rotation around the local Z axis of the camera frame Range from -180 to +180 where 0 means the plane is aligned with the horizon, +180 = Full roll right and –180 = Full roll left. In both cases, when the roll is 180 and –180, the plane is flipped on its back.

Parameters

nAngleNumber The angle of rotation in degree.

Return

getRoll

public function getRoll(Void):Number

getPitch

public function getPitch(Void):Number

getYaw

public function getYaw(Void):Number

getFov

public function getFov(Void):Number

setPosition

public function setPosition(x:Number, y:Number, z:Number):Void

Set the position of the camera. Basically apply a translation.

Parameters

xx position of the camera
yy position of the camera
zz position of the camera

getPosition

public function getPosition(Void):Vector

Get the position of the camera.

Return

the position of the camera as a Vector

setInterpolator

public function setInterpolator(i:Interpolator3D):Boolean

Set an interpolator to the camera. Currently the camera handles only a Path interpolator or a Position interpolation.

Parameters

iInterpolator3D The interpolator you want to apply to the camera. It must be a Path interpolator or a Position interpolation

Return

Boolean True is the operation goes well, false otherwise

removeInterpolator

public function removeInterpolator(Void):Boolean

REmove the interpolator is exist. remove also the listeners.

Parameters

Void

Return

Boolean True is the operation goes well, false otherwise.

isModified

public function isModified(Void):Boolean

This method helps you to know if something has changed in the camera, and if you need to compile it again to take care about the modifications.

Parameters

Void

Return

Boolean True value is returned if something has changed, false otherwise.

compile

public function compile(Void):Void

Compile the camera transformations by multiplicating the matrix together. Be carefull to call isModified method before to save computations.

getMatrix

public function getMatrix(Void):Matrix4

getProjectionMatrix

public function getProjectionMatrix(Void):Matrix4

Return the projection matrix.

Return

Matrix4

getProjectionMatrixInverse

public function getProjectionMatrixInverse(Void):Matrix4

Returns the inverse of the projection matrix

getTransformMatrix

public function getTransformMatrix(Void):Matrix4

Return the transformation matrix.

Return

Matrix4

getTransformationMatrixInverse

public function getTransformationMatrixInverse(Void):Matrix4

toString

public function toString(Void):String

setPerspectiveProjection

public function setPerspectiveProjection(fovY:Number, aspectRatio:Number, zNear:Number, zFar:Number):Void

Set a projection matrix with perspective. This projection allows a more human visual representation of objects.

Parameters

fovYThe angle of view in degress. Default value: 45.
aspectRatioThe ratio between vertical and horizontal pixels. Default value: the screeen ratio (width/height)
zNearThe distance between the camera position and the near plane. Default value: 50.
zFarThe distance between the camera position and the far plane. Default value: 3,000.