anl.aida.viz3d
Class VSpatial

java.lang.Object
  extended by anl.aida.viz3d.VSpatial
Direct Known Subclasses:
CompositeGeometry, LabeledShape, StackItem2, StackRenderer2, VGeometry, VLabel, VNode

public abstract class VSpatial
extends java.lang.Object

Abstract base class for items in the scene graph.


Field Summary
protected  MaterialAppearence appearence
           
protected  BoundingSphere boundingSphere
           
protected  java.util.Map<java.lang.Object,java.lang.Object> clientMap
           
protected  boolean dirty
           
 java.lang.String id
           
protected  javax.vecmath.AxisAngle4f localRotation
           
protected  float localScale
           
protected  javax.vecmath.Vector3f localTrans
           
protected  VSpatial parent
           
protected  boolean visible
           
protected  javax.vecmath.Matrix3f worldRotation
           
protected  float worldScale
           
protected  javax.vecmath.Vector3f worldTrans
           
 
Constructor Summary
VSpatial()
           
 
Method Summary
protected abstract  void doDraw(javax.media.opengl.GL gl)
          Does the actual drawing.
protected  BoundingSphere doGetBoundingSphere()
          Gets the actual bounding sphere.
 void draw(javax.media.opengl.GL gl)
          Draws this Vspatial.
 BoundingSphere getBoundingSphere()
          Gets this VSpatial's BoundingSphere in the world frame.
 BoundingSphere getLocalBoundingSphere()
          Gets this VSpatial's BoundingSphere in its local frame.
 MaterialAppearence getMaterialAppearence()
          Gets the MaterialAppearence of this VSpatial.
 VSpatial getParent()
          Gets the parent of this Vspatial.
 java.lang.Object getProperty(java.lang.Object key)
          Gets a client property from this VSpatial.
 javax.vecmath.Vector3f getTranslation()
          Gets the translation of this node.
 javax.vecmath.Matrix4f getWorldToLocalTransform()
          Gets the world to local transform for this VSpatial.
abstract  void intersects(javax.vecmath.Point3f rayOrigin, javax.vecmath.Vector3f rayDirection, Accumulator accumulator)
          Performs an intersection these on this VSpatial with the specified ray.
 boolean isVisible()
          Gets whether or not this Vspatial is visible.
protected  void markAsDirty()
           
protected  void percolateDirtyUp()
           
 void putProperty(java.lang.Object key, java.lang.Object val)
          Puts a client property with the specified key in the VSpatial
 void rotate(float angle, float x, float y, float z)
          Rotates this Vspatial by angle degrees around the vector (x, y, z).
 void rotate(javax.vecmath.Quat4f rotation)
          Rotates this VSpatial by the specified quaternion.
 void scale(float scale)
          Scales this Vspatial along the x, y, and z axes.
 void setMaterialAppearence(MaterialAppearence app)
          Sets the MaterialAppearence of this VSpatial.
protected  void setParent(VSpatial parent)
          Sets the parent for this Vspatial.
 void setVisible(boolean visible)
          Sets the visibility of this Vspatial.
 javax.vecmath.Point3f transform(javax.vecmath.Point3f pt)
          Transforms the specified point using this Vspatial's local transforms.
 void translate(float x, float y, float z)
          Translates this Vspatial by x, y and z.
 void translate(javax.vecmath.Tuple3f tuple)
          Translates this Vspatial by the x, y, and z components of the specified point.
 void updateWorldTransformation()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localTrans

protected javax.vecmath.Vector3f localTrans

worldTrans

protected javax.vecmath.Vector3f worldTrans

localScale

protected float localScale

worldScale

protected float worldScale

localRotation

protected javax.vecmath.AxisAngle4f localRotation

worldRotation

protected javax.vecmath.Matrix3f worldRotation

appearence

protected MaterialAppearence appearence

visible

protected boolean visible

dirty

protected boolean dirty

parent

protected VSpatial parent

boundingSphere

protected BoundingSphere boundingSphere

clientMap

protected java.util.Map<java.lang.Object,java.lang.Object> clientMap

id

public java.lang.String id
Constructor Detail

VSpatial

public VSpatial()
Method Detail

putProperty

public void putProperty(java.lang.Object key,
                        java.lang.Object val)
Puts a client property with the specified key in the VSpatial

Parameters:
key - the property key
val - the property value

getProperty

public java.lang.Object getProperty(java.lang.Object key)
Gets a client property from this VSpatial.

Parameters:
key - the property key
Returns:
the property value or null if no such property is found.

doDraw

protected abstract void doDraw(javax.media.opengl.GL gl)
Does the actual drawing.

Parameters:
gl -

draw

public void draw(javax.media.opengl.GL gl)
Draws this Vspatial.

Parameters:
gl - the GL used to draw.

updateWorldTransformation

public void updateWorldTransformation()

markAsDirty

protected void markAsDirty()

isVisible

public boolean isVisible()
Gets whether or not this Vspatial is visible.

Returns:
true if this node is visible, otherwise false.

rotate

public void rotate(float angle,
                   float x,
                   float y,
                   float z)
Rotates this Vspatial by angle degrees around the vector (x, y, z).

Parameters:
angle - the angle of rotation, in degrees
x - the x coordinate of the rotation vector
y - the y coordinate of the rotation vector
z - the z coordinate of the rotation vector

rotate

public void rotate(javax.vecmath.Quat4f rotation)
Rotates this VSpatial by the specified quaternion.

Parameters:
rotation - the amount to rotate

scale

public void scale(float scale)
Scales this Vspatial along the x, y, and z axes.

Parameters:
x - the x scale factor
y - the y scale factor
z - the z scale factor

setMaterialAppearence

public void setMaterialAppearence(MaterialAppearence app)
Sets the MaterialAppearence of this VSpatial.

Parameters:
app - the new appearence

getMaterialAppearence

public MaterialAppearence getMaterialAppearence()
Gets the MaterialAppearence of this VSpatial.

Returns:
the MaterialAppearence of this VSpatial.

setVisible

public void setVisible(boolean visible)
Sets the visibility of this Vspatial.

Parameters:
visible - the new visibility property

translate

public void translate(float x,
                      float y,
                      float z)
Translates this Vspatial by x, y and z.

Parameters:
x - the x coordinate of the translation vector
y - the z coordinate of the translation vector
z - the y coordinate of the translation vector

translate

public void translate(javax.vecmath.Tuple3f tuple)
Translates this Vspatial by the x, y, and z components of the specified point.

Parameters:
pt - the point to translate with

getParent

public VSpatial getParent()
Gets the parent of this Vspatial.

Returns:
the parent of this Vspatial.

setParent

protected void setParent(VSpatial parent)
Sets the parent for this Vspatial.

Parameters:
parent - the parent node

getWorldToLocalTransform

public javax.vecmath.Matrix4f getWorldToLocalTransform()
Gets the world to local transform for this VSpatial.


getTranslation

public javax.vecmath.Vector3f getTranslation()
Gets the translation of this node.

Returns:
the translation of this node.

transform

public javax.vecmath.Point3f transform(javax.vecmath.Point3f pt)
Transforms the specified point using this Vspatial's local transforms.

Parameters:
pt - the point to transform.
Returns:
the transformed point

getLocalBoundingSphere

public BoundingSphere getLocalBoundingSphere()
Gets this VSpatial's BoundingSphere in its local frame.

Returns:
this VSpatial's BoundingSphere in its local frame.

percolateDirtyUp

protected void percolateDirtyUp()

getBoundingSphere

public BoundingSphere getBoundingSphere()
Gets this VSpatial's BoundingSphere in the world frame.

Returns:
this VSpatial's BoundingSphere in the world frame.

doGetBoundingSphere

protected BoundingSphere doGetBoundingSphere()
Gets the actual bounding sphere. This is called by getBoundingSphere once the worldTransforms have been updated.

Returns:
this VSpatial's BoundingSphere.

intersects

public abstract void intersects(javax.vecmath.Point3f rayOrigin,
                                javax.vecmath.Vector3f rayDirection,
                                Accumulator accumulator)
Performs an intersection these on this VSpatial with the specified ray. If the intersection passes, this VSpatial should be added to the Accumulator.

Parameters:
rayOrigin - the ray's origin
rayDirection - the ray's direction
accumulator - the accumulator to add the VSpatial to