gestalt.shape
Class AbstractShape

java.lang.Object
  extended by gestalt.shape.AbstractShape
All Implemented Interfaces:
Drawable, java.io.Serializable
Direct Known Subclasses:
BoundingBoxView, Cube, Disk, JoglBoundingBox, JoglIndexedTriangleMesh, JoglPointCloud, JoglPointSpriteCloud, JoglQuad, JoglQuads, JoglShadowMapDisplay, JoglTerrain, Line, Mesh, Plane, Quad, QuadLine, Quads, Sphere, TesselatedQuad, TransformMatrixView, TransformNode, Triangle, Triangles

public abstract class AbstractShape
extends java.lang.Object
implements Drawable, java.io.Serializable

See Also:
Serialized Form

Constructor Summary
AbstractShape()
           
 
Method Summary
 void add(Drawable theDrawable)
          adds a drawable to the container specified by 'setChildContainer(Vector theChildrenContainer)'
 float[] getSortData()
          returns the position of the shape as an array.
 float getSortValue()
          returns the last sort value.
 int getTransformMode()
          gets the transform mode.
 boolean isActive()
          returns whether the drawable is active.
 boolean isSortable()
          returns whether the this shape is transparent.
 Material material()
          returns a reference to the material.
 Vector3f position()
          returns the position as stored in the 'translation' of the matrix returned by 'transform()'.
 void position(float x, float y)
           
 void position(float x, float y, float z)
           
 void position(Vector3f thePosition)
           
 Vector3f rotation()
          returns the reference to the rotation.
note that this is not the same as the rotation stored in the transform matrix.
 void rotation(float x, float y, float z)
           
 Vector3f scale()
          returns the reference to the scale.
 void scale(float x, float y)
           
 void scale(float x, float y, float z)
           
 void setActive(boolean theVisibility)
          sets the active state of the shape.
 void setChildContainer(java.util.Vector<Drawable> theChildrenContainer)
          sets a reference to a container of children used by 'add()' and 'remove()'.
 void setMaterialRef(Material theMaterial)
          sets the referenced material for this shape.
 void setPositionRef(Vector3f thePosition)
          sets the referenced position that is stored in the 'translation' of the matrix returned by 'transform()'.
 void setRotationRef(Vector3f theRotation)
          sets the referenced rotation for this shape.
 void setScaleRef(Vector3f theScale)
          sets the referenced scale for this shape.
 void setSortValue(float theSortValue)
          caches the current sort value.
 void setTransformMode(int theTransformMode)
          sets the transform mode.
 void setTransformRef(TransformMatrix4f theTransform)
          sets the referenced transform matrix for this shape.
 TransformMatrix4f transform()
          returns the reference to the transform matrix used by this shape.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gestalt.render.Drawable
draw
 

Constructor Detail

AbstractShape

public AbstractShape()
Method Detail

material

public Material material()
returns a reference to the material.

Returns:
Material

setMaterialRef

public void setMaterialRef(Material theMaterial)
sets the referenced material for this shape.

Parameters:
theMaterial - Material

transform

public TransformMatrix4f transform()
returns the reference to the transform matrix used by this shape.

Returns:
TransformMatrix4f

setTransformRef

public void setTransformRef(TransformMatrix4f theTransform)
sets the referenced transform matrix for this shape.

Parameters:
theTransform - TransformMatrix4f

position

public Vector3f position()
returns the position as stored in the 'translation' of the matrix returned by 'transform()'.

Returns:
Vector3f

position

public void position(float x,
                     float y,
                     float z)

position

public void position(float x,
                     float y)

position

public void position(Vector3f thePosition)

setPositionRef

public void setPositionRef(Vector3f thePosition)
sets the referenced position that is stored in the 'translation' of the matrix returned by 'transform()'.

Parameters:
thePosition - Vector3f

scale

public Vector3f scale()
returns the reference to the scale.

Returns:
Vector3f

scale

public void scale(float x,
                  float y,
                  float z)

scale

public void scale(float x,
                  float y)

setScaleRef

public void setScaleRef(Vector3f theScale)
sets the referenced scale for this shape.

Parameters:
theScale - Vector3f

rotation

public Vector3f rotation()
returns the reference to the rotation.
note that this is not the same as the rotation stored in the transform matrix. this rotation defines the rotation about the x, y and z axis in radiants in this order.
the rotation from the matrix and this rotation can be used at the same time.
to specify this behavior 'setTransformMode(int theTransformMode)' can be used.

Returns:
Vector3f

rotation

public void rotation(float x,
                     float y,
                     float z)

setRotationRef

public void setRotationRef(Vector3f theRotation)
sets the referenced rotation for this shape.

Parameters:
theRotation - Vector3f

setTransformMode

public void setTransformMode(int theTransformMode)
sets the transform mode. see 'rotation()'

Parameters:
theTransformMode - int

getTransformMode

public int getTransformMode()
gets the transform mode.

Returns:
int

setActive

public void setActive(boolean theVisibility)
sets the active state of the shape.

Parameters:
theVisibility - boolean

setChildContainer

public void setChildContainer(java.util.Vector<Drawable> theChildrenContainer)
sets a reference to a container of children used by 'add()' and 'remove()'.

Parameters:
theChildrenContainer - Vector
To do:
removed the generic type Vector for 1.4 backwards compatibilty. hmmmm.

getSortValue

public float getSortValue()
Description copied from interface: Drawable
returns the last sort value.

Specified by:
getSortValue in interface Drawable
Returns:
float

getSortData

public float[] getSortData()
returns the position of the shape as an array. this value is used to calculate a sort value.

Specified by:
getSortData in interface Drawable
Returns:
float[]

setSortValue

public void setSortValue(float theSortValue)
Description copied from interface: Drawable
caches the current sort value.

Specified by:
setSortValue in interface Drawable
Parameters:
theSortValue - float

isSortable

public boolean isSortable()
returns whether the this shape is transparent.

Specified by:
isSortable in interface Drawable
Returns:
boolean

isActive

public boolean isActive()
Description copied from interface: Drawable
returns whether the drawable is active. it is commonly implemented so that the drawables 'draw' method will be ommitted if 'isActive' return false, although this behavior can vary depending on the implementation.

Specified by:
isActive in interface Drawable
Returns:
boolean

add

public void add(Drawable theDrawable)
adds a drawable to the container specified by 'setChildContainer(Vector theChildrenContainer)'

Specified by:
add in interface Drawable
Parameters:
theDrawable - Drawable


processing library gestalt_p5 by Patrick Kochlik + Dennis Paul. (c) 2009