de.mirell.m3d

class CCamera

Object | +--de.mirell.m3d.CCamera
Implemented Interfaces: IPositionable, IRotateable, IXMLSerializable

dynamic class CCamera extends Object
A camera with various functions which makes use of Quaternions
Example:

  • Author:
    Mirell Development
  • Version:
    1.0

Field Summary

public onRender: Function
A function to be called every rendercycle

Constructor

public CCamera ( )
Constructs a new Camera instance

Method Summary

public changePitchYawRoll ( pitch, yaw, roll: Number ): Void
Set the camera rotation using euler angles
public fromXML ( value: XML ): Void
Unserializes XML into the object
public getDirection ( ): CCoordinate
Retrieves the current direction vector
public getName ( ): String
Retrives the name identifier for this camera
public getPerspective ( ): Number
Retrieves the currently set perspective of this camera
public getPosition ( ): CCoordinate
Retrieves the current center point of the object
public getRotation ( ): CQuaternion
Retrieves the current rotation of the object
public isChanged ( ): Boolean
Determines if objectstate has changed
public lookAt ( targetPoint: CCoordinate ): Void
Rotates camera to point to a coordinate in space
public moveRelative ( Value: CCoordinate ): Void
Moves this camera relative to it's current view vector
public pitch ( degrees: Number ): Void
Set the pitch of this camera
public roll ( degrees: Number ): Void
Set the roll of this camera
public rotate ( q: CQuaternion ): Void
Rotate the object using a quaternion
public setDirection ( v: CCoordinate ): Void
Set the current direction vector
public setName ( Value: String ): Void
Retrives the name identifier for this camera
public setPerspective ( Value: Number ): Void
Sets perspective of this camera
public setPosition ( Value: CCoordinate ): Void
Sets the center point of the object
public setRotation ( Value: CQuaternion ): Void
Set the current rotation of the object
public toXML ( ): XML
Serializes the object into XML
public translate ( Value: CCoordinate ): Void
Translate the position of the object
public yaw ( degrees: Number ): Void
Set the yaw of this camera

Field Documentation

onRender

public var onRender: Function
A function to be called every rendercycle
  • Usage:
    myCamera.onRender = function ()
    {
    	...
    }
    

Constructor Documentation

CCamera

public function CCamera (
)
Constructs a new Camera instance
The instance's state is set to "change" upon creation and positioned at 0,0,0.
  • Usage:
    myCamera = new CCamera();

Method Documentation

changePitchYawRoll

public function changePitchYawRoll (
pitch,
yaw,
roll: Number): Void
Set the camera rotation using euler angles
This function calls rotate for the rotation.
  • Parameters:
    pitch
    The pitch in degrees
    yaw
    The yaw in degrees
    roll
    The roll in degrees

fromXML

public function fromXML (
value: XML): Void
Unserializes XML into the object
Object state is set according to XML.

getDirection

public function getDirection (
): CCoordinate
Retrieves the current direction vector
  • Returns:
    Direction vector as CCoordinate

getName

public function getName (
): String
Retrives the name identifier for this camera
  • Returns:
    The name of this camera.

getPerspective

public function getPerspective (
): Number
Retrieves the currently set perspective of this camera
  • Returns:
    Perspective in units.

getPosition

public function getPosition (
): CCoordinate
Retrieves the current center point of the object

getRotation

public function getRotation (
): CQuaternion
Retrieves the current rotation of the object

isChanged

public function isChanged (
): Boolean
Determines if objectstate has changed
If any relevant state within the object (e.g.: vertexlist) is changed since the last call to C3DEngine.render
  • Returns:
    True if the object's state has changed since the last call to C3DEngine.render

lookAt

public function lookAt (
targetPoint: CCoordinate): Void
Rotates camera to point to a coordinate in space
Concstant calls to lookAt result in the effect of the camera looking towards the specified coordinate even while moving. (Follow a coordinate)
  • Parameters:
    targetPoint
    The coordinate to target.

moveRelative

public function moveRelative (
Value: CCoordinate): Void
Moves this camera relative to it's current view vector
Moves this camera in all directions based on the current view vector (which is internaly handled by a Quaternion).
  • Parameters:
    Value
    The movement specified as a CCoordinate.
  • Example:
    // Move the camera forward
    myCamera.moveRelative( new CCoordinate(0,0,10) );
    // Move the camera left
    myCamera.moveRelative( new CCoordinate(-10,0,0) );
    

pitch

public function pitch (
degrees: Number): Void
Set the pitch of this camera
This function calls rotate for the rotation.
  • Parameters:
    degrees
    The pitch in degrees

roll

public function roll (
degrees: Number): Void
Set the roll of this camera
This function calls rotate for the rotation.
  • Parameters:
    degrees
    The roll in degrees

rotate

public function rotate (
q: CQuaternion): Void
Rotate the object using a quaternion

setDirection

public function setDirection (
v: CCoordinate): Void
Set the current direction vector
  • Parameters:
    v
    A vector in space specified as CCoordinate

setName

public function setName (
Value: String): Void
Retrives the name identifier for this camera
Assign names to cameras.
  • Returns:
    The name of this camera.

setPerspective

public function setPerspective (
Value: Number): Void
Sets perspective of this camera
  • Parameters:
    Value
    Perspective in units.

setPosition

public function setPosition (
Value: CCoordinate): Void
Sets the center point of the object

setRotation

public function setRotation (
Value: CQuaternion): Void
Set the current rotation of the object

toXML

public function toXML (
): XML
Serializes the object into XML
The current object state will be serialized. The fromXML method must be able to unserialize the XML.

translate

public function translate (
Value: CCoordinate): Void
Translate the position of the object

yaw

public function yaw (
degrees: Number): Void
Set the yaw of this camera
This function calls rotate for the rotation.
  • Parameters:
    degrees
    The yaw in degrees

The documentation was generated from the following file: