Cube
| Kind of class: | public class |
|---|---|
| Package: | org.papervision3d.objects.primitives |
| Inherits from: | TriangleMesh3D < Vertices3D < DisplayObject3D < DisplayObjectContainer3D < EventDispatcher |
| Classpath: | org.papervision3d.objects.primitives.Cube |
| File last modified: | Sunday, 02 March 2008, 15:23:46 |
The Cube class lets you create and display flat rectangle objects.The rectangle can be divided in smaller segments. This is usually done to reduce linear mapping artifacts.Dividing the Cube in the direction of the perspective or vanishing point, helps to reduce this problem. Perspective distortion dissapears when the Cube is facing straignt to the camera, i.e. it is perpendicular with the vanishing point of the scene.
Summary
Constructor
- Cube (materials:MaterialsList, width:Number = 500, depth:Number = 500, height:Number = 500, segmentsS:int = 1, segmentsT:int = 1, segmentsH:int = 1, insideFaces:int = 0, excludeFaces:int = 0, initObject:Object = null)
- Create a new Cube object.
Namespaces
Constants
Constants inherited from DisplayObject3D
Class properties
- NONE : int
- No faces selected.
- FRONT : int
- Front face selection
- BACK : int
- Back face selection
- RIGHT : int
- Right face selection
- LEFT : int
- Left face selection
- TOP : int
- Top face selection
- BOTTOM : int
- Bottom face selection
- ALL : int
- All faces selected.
Class properties inherited from DisplayObject3D
Instance properties
Instance properties inherited from DisplayObject3D
_containerBlendMode _containerSortMode _filters _material _rotationDirty _rotationX _rotationY _rotationZ _scaleDirty _scaleX _scaleY _scaleZ _scene _sorted _transformDirty _useOwnContainer _userData containerBlendMode containerSortMode culled extra faces filters geometry id material materials meshSort name parent rotationX rotationY rotationZ scale scaleX scaleY scaleZ scene sceneX sceneY sceneZ screen screenZ transform useOwnContainer userData view visible world x y z
Instance properties inherited from DisplayObjectContainer3D
Instance methods
Instance methods inherited from TriangleMesh3D
Instance methods inherited from Vertices3D
Instance methods inherited from DisplayObject3D
Instance methods inherited from DisplayObjectContainer3D
Constructor
Cube
public function Cube (
materials:MaterialsList,
width:Number = 500,
depth:Number = 500,
height:Number = 500,
segmentsS:int = 1,
segmentsT:int = 1,
segmentsH:int = 1,
insideFaces:int = 0,
excludeFaces:int = 0,
initObject:Object = null)
Create a new Cube object.
Parameters:
materials :
A MaterialObject3D object that contains the material properties of the object.
Supported materials are: front, back, right, left, top, bottom & all, for example:
var materials:MaterialsList = new MaterialsList(
{
all: new MovieAssetMaterial( "Front", true ), // This is the default material
front: new MovieAssetMaterial( "Front", true ),
back: new MovieAssetMaterial( "Back", true ),
right: new MovieAssetMaterial( "Right", true ),
left: new MovieAssetMaterial( "Left", true ),
top: new MovieAssetMaterial( "Top", true ),
bottom: new MovieAssetMaterial( "Bottom", true )
} );
Supported materials are: front, back, right, left, top, bottom & all, for example:
var materials:MaterialsList = new MaterialsList(
{
all: new MovieAssetMaterial( "Front", true ), // This is the default material
front: new MovieAssetMaterial( "Front", true ),
back: new MovieAssetMaterial( "Back", true ),
right: new MovieAssetMaterial( "Right", true ),
left: new MovieAssetMaterial( "Left", true ),
top: new MovieAssetMaterial( "Top", true ),
bottom: new MovieAssetMaterial( "Bottom", true )
} );
width :
[optional] - Desired width.
depth :
[optional] - Desired depth.
height :
[optional] - Desired height.
segmentsS :
[optional] - Number of segments sagitally (plane perpendicular to width). Defaults to 1.
segmentsT :
[optional] - Number of segments transversally (plane perpendicular to depth). Defaults to segmentsS.
segmentsH :
[optional] - Number of segments horizontally (plane perpendicular to height). Defaults to segmentsS.
insideFaces :
[optional] - Faces that are visible from the inside. Defaults to Cube.NONE.
You can add or sustract faces to your selection. For examples: Cube.FRONT+Cube.BACK or Cube.ALL-Cube.Top.
You can add or sustract faces to your selection. For examples: Cube.FRONT+Cube.BACK or Cube.ALL-Cube.Top.
excludeFaces:
[optional] - Faces that will not be created. Defaults to Cube.NONE.
You can add or sustract faces to your selection. For examples: Cube.FRONT+Cube.BACK or Cube.ALL-Cube.Top.
You can add or sustract faces to your selection. For examples: Cube.FRONT+Cube.BACK or Cube.ALL-Cube.Top.
initObject :
[optional] - An object that contains user defined properties with which to populate the newly created GeometryObject3D.It includes x, y, z, rotationX, rotationY, rotationZ, scaleX, scaleY scaleZ and a user defined extra object.If extra is not an object, it is ignored. All properties of the extra field are copied into the new instance. The properties specified with extra are publicly available.
Class properties
ALL
public static ALL:int = FRONT + BACK + RIGHT + LEFT + TOP + BOTTOM
(read,write)
All faces selected.
BACK
public static BACK:int = 0x02
(read,write)
Back face selection
BOTTOM
public static BOTTOM:int = 0x20
(read,write)
Bottom face selection
FRONT
public static FRONT:int = 0x01
(read,write)
Front face selection
LEFT
public static LEFT:int = 0x08
(read,write)
Left face selection
NONE
public static NONE:int = 0x00
(read,write)
No faces selected.
RIGHT
public static RIGHT:int = 0x04
(read,write)
Right face selection
TOP
public static TOP:int = 0x10
(read,write)
Top face selection