de.mirell.m3d
class C3DObject
Object
|
+--de.mirell.m3d.C3DObject
Implemented Interfaces: IDrawable, IPositionable, IRotateable, IScaleable, IXMLSerializableAll Known Subclasses: CLine, CModel, CPolygon, CSpritedynamic class C3DObject extends Object
Base class for any object in 3D space
C3DObject implements various standard behaviours used to render an object based on a list of vertices. C3DObject can not draw itself and acts as an abstract class for other classes like CModel.
- Author:Mirell Development
- Version:1.0
- See also:
Property Summary
Set the event method associated with this standard movieclip eventRetrieve the event method associated with this standard movieclip event
Set the event method associated with this standard movieclip eventRetrieve the event method associated with this standard movieclip event
Set the event method associated with this standard movieclip event Retrieve the event method associated with this standard movieclip event
Method Summary
Adds the specified vertex to the end of the vertexlist
Trigger creation of the object's movieclip
Trigger removal of the object's movieclip
Draws the object
Unserializes XML into the object
Retrieve the movieclip the object draws itself on
Retrieve the object's movieclip
Retrieves the object associated as the parent of the object
Retrieves the current center point of the object
Retrieves the current rotation of the object
Retrieve the type of the object
Retrieve the vertices of the object
Determine if object has faces
Determine if object has vertices
Determines if object needs to be redrawn
Removes the specified vertex from the vertexlist
Rotate the object using a quaternion
Scale the object in space
Set the movieclip to draw the object on
Associates an object as the parent of this
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
Property Documentation
onPress
public onPress: Function (read, write)
Set the event method associated with this standard movieclip eventRetrieve the event method associated with this standard movieclip event
onRollOut
public onRollOut: Function (read, write)
Set the event method associated with this standard movieclip eventRetrieve the event method associated with this standard movieclip event
onRollOver
public onRollOver: Function (read, write)
Set the event method associated with this standard movieclip event Retrieve the event method associated with this standard movieclip event
Constructor Documentation
C3DObject
public function C3DObject (
)
Constructs a new C3DObject instance
The instance is positioned at (0,0,0) with no vertices assigned.
- See also:
Method Documentation
addVertex
public function addVertex (
Item: CVertex): CVertex
Adds the specified vertex to the end of the vertexlist
The vertex is not added if already in the vertexlist of the object
- Parameters:
Item The CVertex to add to the vertices of the object - Returns:Returns the added vertex
createMovieClip
public function createMovieClip (
): Void
Trigger creation of the object's movieclip
If a Display was set a new movieclip is created and the target for all drawing operations of the object
destroyMovieClip
public function destroyMovieClip (
): Void
Trigger removal of the object's movieclip
Remove the movie created from a prior call to createMovieClip
draw
public function draw (
): Void
Draws the object
This method is called from the renderer when the object needs to draw itself.
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
getDisplay
public function getDisplay (
): MovieClip
Retrieve the movieclip the object draws itself on
- Returns:The movieclip the object draws itself on
getMovieClip
public function getMovieClip (
): MovieClip
Retrieve the object's movieclip
The movie is created from a call to createMovieClip and is used for drawing operations
getParent
public function getParent (
): Object
Retrieves the object associated as the parent of the object
- Returns:The object to be considered as parent of the object
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
getType
public function getType (
): String
Retrieve the type of the object
- Returns:The classname of the object
getVertices
public function getVertices (
): Array
Retrieve the vertices of the object
- Returns:Returns the vertices of the object in the current state
hasFaces
public function hasFaces (
): Boolean
Determine if object has faces
- Returns:Returns
True
if the object has faces
hasVertices
public function hasVertices (
): Boolean
Determine if object has vertices
- Returns:Returns
True
if the object has vertices
isChanged
public function isChanged (
): Boolean
Determines if object needs to be redrawn
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
removeVertex
public function removeVertex (
Item: CVertex): Void
Removes the specified vertex from the vertexlist
All vertices are shifted up in the vertex array of the object
- Parameters:
Item Vertex to be removed
rotate
public function rotate (
Value: CQuaternion): Void
Rotate the object using a quaternion
- Specified by:rotate in interface IRotateable
- Parameters:
Value The amount to rotate the object set using a CQuaternion
scale
public function scale (
Value: CCoordinate): Void
Scale the object in space
- Specified by:scale in interface IScaleable
- Parameters:
Value The amount to scale the object's x,y and z values using a CCoordinate
setDisplay
public function setDisplay (
display: MovieClip): Void
Set the movieclip to draw the object on
- Parameters:
display Target movieclip for drawing operations
setParent
public function setParent (
Parent: Object): Void
Associates an object as the parent of this
Used to traverse object relation trees. Usefull for a vertex to determine it's parent object it belongs to.
- Parameters:
Parent The object to be considered as parent of the object
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 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
- C3DObject.as, Last Modified: 28.08.2004 18:20:10