de.mirell.m3d
class CCamera
Object
|
+--de.mirell.m3d.CCamera
Implemented Interfaces: IPositionable, IRotateable, IXMLSerializabledynamic class CCamera extends Object
A camera with various functions which makes use of Quaternions
Example:
- Author:Mirell Development
- Version:1.0
Method Summary
Set the camera rotation using euler angles
Unserializes XML into the object
Retrieves the current direction vector
Retrives the name identifier for this camera
Retrieves the currently set perspective of this camera
Retrieves the current center point of the object
Retrieves the current rotation of the object
Determines if objectstate has changed
Rotates camera to point to a coordinate in space
Moves this camera relative to it's current view vector
Set the pitch of this camera
Set the roll of this camera
Rotate the object using a quaternion
Set the current direction vector
Retrives the name identifier for this camera
Sets perspective of this camera
Sets the center point of the object
Set the current rotation of the object
Serializes the object into XML
Translate the position of the object
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
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.
- Specified by:fromXML in interface de.mirell.xml.serialization.IXMLSerializable
- Parameters:
value XML which represents the serialized form of the object
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
- Specified by:getPosition in interface IPositionable
- Returns:The center of the object
getRotation
public function getRotation (
): CQuaternion
Retrieves the current rotation of the object
- Specified by:getRotation in interface IRotateable
- Returns:The 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
- Specified by:rotate in interface IRotateable
- Parameters:
q The amount to rotate the object set using a de.mirell.math.CQuaternion
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
- Specified by:setPosition in interface IPositionable
- Parameters:
Value The new center of the object
setRotation
public function setRotation (
Value: CQuaternion): Void
Set the current rotation of the object
- Specified by:setRotation in interface IRotateable
- Parameters:
Value The rotation of the object specfied by a de.mirell.math.CQuaternion
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.
- Specified by:toXML in interface de.mirell.xml.serialization.IXMLSerializable
- Returns:The XML which contains the serialized representation of the object
translate
public function translate (
Value: CCoordinate): Void
Translate the position of the object
- Specified by:translate in interface ITranslateable
- Parameters:
Value The amount to translate the object's position's x,y and z values using a CCoordinate
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
- CCamera.as, Last Modified: 03.09.2004 21:49:50