| Package | sandy.core.scenegraph |
| Class | public class Shape3D |
| Inheritance | Shape3D ATransformable Node |
| Implements | IDisplayable |
| Subclasses | Box, Cylinder, Hedra, Line3D, Plane3D, Sphere, Torus |
It represents a node in the object tree of the world.
A Shape3D is a leaf node and can not have any child nodes.
It must be the child of a branch group or a transform group, but transformations can be applied to the Shape directly.
| Property | Defined by | ||
|---|---|---|---|
| aPolygons : Array
The array of polygons building this object.
| Shape3D | ||
| appearance : Appearance
The appearance of this object.
| Shape3D | ||
![]() | boundingBox : BBox
The bounding box of this node
IMPORTANT: Do not modify it unless you perfectly know what you are doing
| Node | |
![]() | boundingSphere : BSphere
The bounding sphere of this node
IMPORTANT: Do not modify it unless you perfectly know what you are doing
| Node | |
![]() | broadcaster : BubbleEventBroadcaster
The broadcaster
The broadcaster is used to send events to listeners. | Node | |
![]() | changed : Boolean = false
This property set the cache status of the current node.
| Node | |
![]() | children : Array
The children of this node are stored inside this array.
| Node | |
| container : Sprite [read-only]
The contianer for this object.
| Shape3D | ||
![]() | culled : CullingState
This property represent the culling state of the current node.
| Node | |
| DEFAULT_APPEARANCE : Appearance
[static]
Default appearance for Shape3D instances.
| Shape3D | ||
| DEFAULT_MATERIAL : Material
[static]
Default material for the DEFAULT_APPEARANCE object
| Shape3D | ||
| depth : Number [read-only]
The depth of this object.
| Shape3D | ||
![]() | disable : Boolean = false
Disable the local transformations applied to this Node if set to false.
| ATransformable | |
| enableBackFaceCulling : Boolean
Should back face culling be enabled for this object?.
| Shape3D | ||
| enableClipping : Boolean = false Enable the Frustum clipping on the visible polygons. | Shape3D | ||
| enableEvents : Boolean [write-only]
Enables the event system for mouse events.
| Shape3D | ||
| enableForcedDepth : Boolean = false
Should forced depth be enable for this object?.
| Shape3D | ||
| enableInteractivity : Boolean | Shape3D | ||
| enableNearClipping : Boolean = false Enable the Frustum near plane clipping on the visible polygons. | Shape3D | ||
| forcedDepth : Number = 0
The forced depth for this object.
| Shape3D | ||
| geometry : Geometry3D
The geometry of this object.
| Shape3D | ||
| geometryCenter : Vector
This property call allows you to get the geometryCenter offset vector of the Shape.
| Shape3D | ||
![]() | matrix : Matrix4 | ATransformable | |
![]() | modelMatrix : Matrix4
Cached matrix corresponding to the transformation to the 0,0,0 frame system
| Node | |
![]() | name : String
Name of this node.
| Node | |
![]() | out : Vector
Forward direction ( local z ) in parent coordinates.
| ATransformable | |
![]() | pan : Number
Pans this object around the local y axis.
| ATransformable | |
![]() | parent : Node
The parent node of this node.
| Node | |
![]() | roll : Number
Rolls this object around the local z axis.
| ATransformable | |
![]() | rotateX : Number
Rotates this object around an axis parallel to the parents x axis.
| ATransformable | |
![]() | rotateY : Number
Rotates this object around an axis parallel to the parents y axis.
| ATransformable | |
![]() | rotateZ : Number
Rotates this object around an axis paralell to the parents z axis.
| ATransformable | |
![]() | scaleX : Number
x scale of this object.
| ATransformable | |
![]() | scaleY : Number
y scale of this object.
| ATransformable | |
![]() | scaleZ : Number
z scale of this object.
| ATransformable | |
![]() | scene : Scene3D = null
Reference to the scene is it linked to.
| Node | |
![]() | side : Vector
Side direction ( local x ) in parent coordinates.
| ATransformable | |
![]() | target : Vector
The position in the parent frame this object should "look at".
| ATransformable | |
![]() | tilt : Number
Getter for the tilt value
| ATransformable | |
![]() | up : Vector
Up direction ( local y ) in parent coordinates.
| ATransformable | |
| useSingleContainer : Boolean [write-only]
setter that allow user to change the way to render this object.
| Shape3D | ||
![]() | viewMatrix : Matrix4
Cached matrix corresponding to the transformation to the camera frame system
| Node | |
![]() | visible : Boolean = true
Specify the visibility of this node.
| Node | |
![]() | x : Number
x position of this object in its parent frame.
| ATransformable | |
![]() | y : Number
y position of this object in its parent frame.
| ATransformable | |
![]() | z : Number
z position of the node in its parent frame.
| ATransformable | |
| Property | Defined by | ||
|---|---|---|---|
| m_bUseSingleContainer : Boolean = true | Shape3D | ||
| m_nDepth : Number = 0 | Shape3D | ||
| m_oContainer : Sprite | Shape3D | ||
![]() | m_oEB : BubbleEventBroadcaster | Node | |
| m_oGeomCenter : Vector | Shape3D | ||
![]() | m_oPreviousOffsetRotation : Vector | ATransformable | |
![]() | m_tmpMt : Matrix4 | ATransformable | |
![]() | _oScale : Vector | ATransformable | |
![]() | _p : Vector | ATransformable | |
![]() | _vOut : Vector | ATransformable | |
![]() | _vSide : Vector | ATransformable | |
![]() | _vUp : Vector | ATransformable | |
| Method | Defined by | ||
|---|---|---|---|
|
Shape3D(p_sName:String = "", p_oGeometry:Geometry3D = null, p_oAppearance:Appearance = null, p_bUseSingleContainer:Boolean = true)
Creates a 3D object
[Todo: some more explanations] | Shape3D | ||
![]() |
Adds a new child to this node.
| Node | |
![]() |
addEventListener(p_sEvt:String, p_oL:*):void
Adds a listener for the specified event.
| Node | |
|
clear():void
Clears the graphics object of this object's container.
| Shape3D | ||
|
This method returns a clone of this Shape3D.
| Shape3D | ||
|
Tests this node against the camera frustum to get its visibility.
| Shape3D | ||
|
destroy():void
Destroy this object and all its faces
container object is removed, and graphics cleared.
| Shape3D | ||
|
Performs a z-sorting and renders the objects visible polygons.
| Shape3D | ||
![]() |
getChildByName(p_sName:String, p_bRecurs:Boolean = false):Node
Returns the child node with the specified name.
| Node | |
![]() |
getChildFromId(p_nId:uint, p_bRecurs:Boolean = false):Node
Returns the child node with the specified id.
| Node | |
![]() |
getChildList():Array
Returns an array with all child nodes of this node.
| Node | |
![]() |
getPosition(p_sMode:String = "local"):Vector
Returns the position of this group or object.
| ATransformable | |
![]() |
hasParent():Boolean
Tests if this node has a parent.
| Node | |
![]() |
initFrame():void
Initiates the local coordinate system for this object.
| ATransformable | |
![]() |
Tests if the node passed in the argument is parent of this node.
| Node | |
![]() |
lookAt(p_nX:Number, p_nY:Number, p_nZ:Number):void
Makes this object "look at" the specified position in the parent frame.
| ATransformable | |
![]() |
moveForward(p_nD:Number):void
Translates this object along its forward vector ( local z ) in the parent frame.
| ATransformable | |
![]() |
moveHorizontally(p_nD:Number):void
Translates this object parallel to its parent zx plane and in its forward direction.
| ATransformable | |
![]() |
moveLateraly(p_nD:Number):void
Translates this object laterally in its parent frame.
| ATransformable | |
![]() |
moveSideways(p_nD:Number):void
Translates this object along its side vector ( local x ) in the parent frame.
| ATransformable | |
![]() |
moveUpwards(p_nD:Number):void
Translates this object along its up vector ( local y ) in the parent frame.
| ATransformable | |
![]() |
moveVertically(p_nD:Number):void
Translates this object vertically in ots parent frame.
| ATransformable | |
![]() |
remove():void
Removes this node from the node tree, saving its child nodes.
| Node | |
![]() |
removeChildById(p_nId:Number):Boolean
Removes the child node with the specified id.
| Node | |
![]() |
removeChildByName(p_sName:String):Boolean
Removes the child node with the specified name.
| Node | |
![]() |
removeEventListener(p_sEvt:String, p_oL:*):void
Removes a listener for the specified event.
| Node | |
|
Renders this 3D object.
| Shape3D | ||
![]() |
rotateAxis(p_nX:Number, p_nY:Number, p_nZ:Number, p_nAngle:Number):void
Rotate this object around the specified axis in the parent frame by the specified angle.
| ATransformable | |
![]() |
setPosition(p_nX:Number, p_nY:Number, p_nZ:Number):void
Sets the position of this object in coordinates of its parent frame.
| ATransformable | |
|
swapCulling():void
Changes the backface culling side.
| Shape3D | ||
![]() |
swapParent(p_oNewParent:Node):void
Moves this node to another parent node.
| Node | |
|
toString():String
Returns a string representation of this object
| Shape3D | ||
![]() |
translate(p_nX:Number, p_nY:Number, p_nZ:Number):void
Translate this object from it's current position with the specified offsets.
| ATransformable | |
![]() |
Updates this node or object.
| ATransformable | |
|
updateBoundingVolumes():void
Updates the bounding volumes of this object.
| Shape3D | ||
![]() |
updateTransform():void
Updates the transform matrix of the current object/node before it is rendered.
| ATransformable | |
| Method | Defined by | ||
|---|---|---|---|
|
_onInteraction(p_oEvt:Event):void
| Shape3D | ||
| aPolygons | property |
public var aPolygons:ArrayThe array of polygons building this object.
| appearance | property |
appearance:Appearance [read-write]The appearance of this object.
Implementation public function get appearance():Appearance
public function set appearance(value:Appearance):void
| container | property |
container:Sprite [read-only]The contianer for this object. This container property exist if the useSingleContainer is set to true. It is a direct access to the Shape3D container to, for example, apply nice effects such as filters etc.
Implementation public function get container():Sprite
| DEFAULT_APPEARANCE | property |
public static var DEFAULT_APPEARANCE:AppearanceDefault appearance for Shape3D instances. If no apperance is given, this default one will be applied using the DEFAULT_MATERIAL as front and back material
| DEFAULT_MATERIAL | property |
public static var DEFAULT_MATERIAL:MaterialDefault material for the DEFAULT_APPEARANCE object
| depth | property |
depth:Number [read-only]The depth of this object. In case the useSingleContainer mode is enabled (default mode), this value returns the means depth of the Shape in the camera frame. This value is mainly used as a z-sorting value.
Implementation public function get depth():Number
| enableBackFaceCulling | property |
enableBackFaceCulling:Boolean [read-write]Should back face culling be enabled for this object?.
If set to false all faces of this object are drawn.
A true value enables the back face culling algorithm - Default true
public function get enableBackFaceCulling():Boolean
public function set enableBackFaceCulling(value:Boolean):void
| enableClipping | property |
public var enableClipping:Boolean = false
Enable the Frustum clipping on the visible polygons. Enable this when you need a perfect intersection between the camera and some object shapes. In case you need to make the camera look inside and outide a box, or other immerssive things.
Important: Enable the clipping makes process a bit slower, especially with big scenes.
Specify if this object polygons should be clipped against the camera frustum planes.
| enableEvents | property |
enableEvents:Boolean [write-only]Enables the event system for mouse events.
When set to true, the onPress, onRollOver and onRollOut events are broadcast.
The event system is enabled or disabled for all faces of this object.
As an alternative, you have the possibility to enable events only for specific faces.
Once this feature is enabled, the animation is more CPU intensive.
Implementation public function set enableEvents(value:Boolean):void
| enableForcedDepth | property |
public var enableForcedDepth:Boolean = falseShould forced depth be enable for this object?.
If true it is possible to force this object to be drawn at a specific depth,
if false the normal Z-sorting algorithm is applied.
When correctly used, this feature allows you to avoid some Z-sorting problems.
| enableInteractivity | property |
enableInteractivity:Boolean [read-write]Implementation
public function get enableInteractivity():Boolean
public function set enableInteractivity(value:Boolean):void
| enableNearClipping | property |
public var enableNearClipping:Boolean = false
Enable the Frustum near plane clipping on the visible polygons. Enable this when you need a perfect intersection between the front camera plane. This is mainly used when you need the camera to move on a long plane.
Important: Enable the clipping makes process a bit slower, especially with big scenes.
| forcedDepth | property |
public var forcedDepth:Number = 0The forced depth for this object.
To make this feature work, you must enable the ForcedDepth system too.
The higher the depth is, the sooner the more far the object will be represented.
| geometry | property |
geometry:Geometry3D [read-write]The geometry of this object.
Implementation public function get geometry():Geometry3D
public function set geometry(value:Geometry3D):void
| geometryCenter | property |
geometryCenter:Vector [read-write]This property call allows you to get the geometryCenter offset vector of the Shape. Modifying this vector will impact the way the shape is rendered, mainly its rotation center.
Implementation public function get geometryCenter():Vector
public function set geometryCenter(value:Vector):void
| m_bUseSingleContainer | property |
protected var m_bUseSingleContainer:Boolean = true
| m_nDepth | property |
protected var m_nDepth:Number = 0
| m_oContainer | property |
protected var m_oContainer:Sprite
| m_oGeomCenter | property |
protected var m_oGeomCenter:Vector
| useSingleContainer | property |
useSingleContainer:Boolean [write-only]setter that allow user to change the way to render this object. set to true, the shape will be rendered into a single Sprite object, which is accessible through the container property. set to false, the container property does not target anything, but all the polygons will be rendered into their own dedidated container.
If true, this object renders itself on a single container ( Sprite ),
if false, each polygon is rendered on its own container.
public function set useSingleContainer(value:Boolean):void
| Shape3D | () | constructor |
public function Shape3D(p_sName:String = "", p_oGeometry:Geometry3D = null, p_oAppearance:Appearance = null, p_bUseSingleContainer:Boolean = true)Creates a 3D object
[Todo: some more explanations]
Parametersp_sName:String (default = "") — A string identifier for this object
|
|
p_oGeometry:Geometry3D (default = null) — The geometry of this object
|
|
p_oAppearance:Appearance (default = null) — The appearance of this object. If no apperance is given, the DEFAULT_APPEARANCE will be applied.
|
|
p_bUseSingleContainer:Boolean (default = true) — Whether tis object should use a single container to draw on
|
| _onInteraction | () | method |
protected function _onInteraction(p_oEvt:Event):voidParameters
p_oEvt:Event |
| clear | () | method |
public function clear():voidClears the graphics object of this object's container.
The the graphics that were drawn on the Graphics object is erased, and the fill and line style settings are reset.
| clone | () | method |
public function clone(p_sName:String = "", p_bKeepTransform:Boolean = false):Shape3DThis method returns a clone of this Shape3D. The current appearance will be applied, and the geometry is cloned (not referenced to curent one).
Parametersp_sName:String (default = "") — The name of the new shape you are going to create
|
|
p_bKeepTransform:Boolean (default = false) — Boolean value which, if set to true, applies the current local transformations to the cloned shape. Default value is false.
|
Shape3D —
The clone
|
| cull | () | method |
public override function cull(p_oScene:Scene3D, p_oFrustum:Frustum, p_oViewMatrix:Matrix4, p_bChanged:Boolean):voidTests this node against the camera frustum to get its visibility.
If this node and its children are not within the frustum, the node is set to cull and it would not be displayed.
The method also updates the bounding volumes to make the more accurate culling system possible.
First the bounding sphere is updated, and if intersecting,
the bounding box is updated to perform the more precise culling.
[MANDATORY] The update method must be called first!
Parametersp_oScene:Scene3D — The current scene
|
|
p_oFrustum:Frustum — The frustum of the current camera
|
|
p_oViewMatrix:Matrix4 — The view martix of the curren camera
|
|
p_bChanged:Boolean |
| destroy | () | method |
public override function destroy():voidDestroy this object and all its faces container object is removed, and graphics cleared. All polygons have their
| display | () | method |
public function display(p_oScene:Scene3D, p_oContainer:Sprite = null):voidPerforms a z-sorting and renders the objects visible polygons.
The method is called only if the object renders on a single container
- ( useSingleContainer = true ).
p_oScene:Scene3D — The current scene
|
|
p_oContainer:Sprite (default = null) — The container to draw on
|
| render | () | method |
public override function render(p_oScene:Scene3D, p_oCamera:Camera3D):voidRenders this 3D object.
Parametersp_oScene:Scene3D — The current scene
|
|
p_oCamera:Camera3D — The current camera
|
| swapCulling | () | method |
public function swapCulling():voidChanges the backface culling side.
When you want to display a cube and you are the cube, you see its external faces.
The internal faces are not drawn due to back face culling
In case you are inside the cube, by default Sandy's engine still doesn't draw the internal faces (because you should not be in there).
If you need to be only inside the cube, you can call this method to change which side is culled.
The faces will be visible only from the interior of the cube.
If you want to be both on the inside and the outside, you want to make the faces visible from on both sides.
In that case you just have to set enableBackFaceCulling to false.
| toString | () | method |
public override function toString():StringReturns a string representation of this object
ReturnsString — The fully qualified name of this object and its geometry
|
| updateBoundingVolumes | () | method |
public function updateBoundingVolumes():voidUpdates the bounding volumes of this object.