org.xith3d.scenegraph.primitives
Class Quad

java.lang.Object
  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.Node
          extended by org.xith3d.scenegraph.Leaf
              extended by org.xith3d.scenegraph.Shape3D
                  extended by org.xith3d.scenegraph.primitives.Quad
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.SpatialNode
Direct Known Subclasses:
Rectangle

public class Quad
extends Shape3D

This is a simple, single textured quad implementation. A Quad is a four-edged polygon, that doesn't necessarily need to be rectangular.
If you just want a rectangular Quad you should consider to use Rectangle instad of Quad.


Field Summary
 
Fields inherited from class org.xith3d.scenegraph.Node
bounds, boundsAutoCompute, boundsDirty, globalIgnoreBounds, instanceBoundsTypeHint, transformGroup, untransformedBounds
 
Fields inherited from class org.xith3d.scenegraph.SceneGraphObject
XITH3D_USERDATAKEY_OLDUSERDATA
 
Constructor Summary
Quad(org.openmali.vecmath2.Point3f[] coords)
          Creates an untextured Quad without alpha channel.
Quad(org.openmali.vecmath2.Point3f[] coords, boolean generateNormals)
          Creates an untextured Quad without alpha channel.
Quad(org.openmali.vecmath2.Point3f[] coords, boolean generateNormals, org.openmali.vecmath2.Colorf color)
          Creates an untextured, but colored Quad.
Quad(org.openmali.vecmath2.Point3f[] coords, boolean generateNormals, java.lang.String texture)
          Creates a textured Quad.
Quad(org.openmali.vecmath2.Point3f[] coords, boolean generateNormals, org.openmali.vecmath2.TexCoord2f[] textureCoords, java.lang.String texture)
          Creates a textured Quad.
Quad(org.openmali.vecmath2.Point3f[] coords, boolean generateNormals, org.openmali.vecmath2.TexCoord2f[] textureCoords, java.lang.String texture, org.openmali.vecmath2.Colorf color)
          Creates a textured Quad.
Quad(org.openmali.vecmath2.Point3f[] coords, boolean generateNormals, org.openmali.vecmath2.TexCoord2f[] textureCoords, Texture texture)
          Creates a textured Quad.
Quad(org.openmali.vecmath2.Point3f[] coords, boolean generateNormals, org.openmali.vecmath2.TexCoord2f[] textureCoords, Texture texture, org.openmali.vecmath2.Colorf color)
          Creates a textured Quad.
Quad(org.openmali.vecmath2.Point3f[] coords, org.openmali.vecmath2.Colorf color)
          Creates an untextured, but colored Quad.
Quad(org.openmali.vecmath2.Point3f[] coords, java.lang.String texture)
          Creates a textured Quad.
Quad(org.openmali.vecmath2.Point3f[] coords, org.openmali.vecmath2.TexCoord2f[] textureCoords, java.lang.String texture)
          Creates a textured Quad.
Quad(org.openmali.vecmath2.Point3f[] coords, org.openmali.vecmath2.TexCoord2f[] textureCoords, java.lang.String texture, org.openmali.vecmath2.Colorf color)
          Creates a textured Quad.
Quad(org.openmali.vecmath2.Point3f[] coords, org.openmali.vecmath2.TexCoord2f[] textureCoords, Texture texture)
          Creates a textured Quad.
Quad(org.openmali.vecmath2.Point3f[] coords, org.openmali.vecmath2.TexCoord2f[] textureCoords, Texture texture, org.openmali.vecmath2.Colorf color)
          Creates a textured Quad.
Quad(org.openmali.vecmath2.Point3f[] coords, Texture texture)
          Creates a textured Quad.
Quad(java.lang.String texture, org.openmali.vecmath2.Tuple3f[] vertices, org.openmali.vecmath2.TexCoord2f[] textureCoords)
          Deprecated. 
Quad(org.openmali.vecmath2.Tuple3f[] vertices)
          Deprecated. 
Quad(org.openmali.vecmath2.Tuple3f[] vertices, org.openmali.vecmath2.Colorf color)
          Deprecated. 
Quad(org.openmali.vecmath2.Tuple3f[] vertices, java.lang.String texture)
          Deprecated. 
Quad(org.openmali.vecmath2.Tuple3f[] vertices, java.lang.String texture, org.openmali.vecmath2.TexCoord2f[] textureCoords, org.openmali.vecmath2.Colorf color)
          Deprecated. 
Quad(org.openmali.vecmath2.Tuple3f[] vertices, Texture texture, org.openmali.vecmath2.TexCoord2f[] textureCoords)
          Deprecated. 
Quad(org.openmali.vecmath2.Tuple3f[] vertices, Texture texture, org.openmali.vecmath2.TexCoord2f[] textureCoords, org.openmali.vecmath2.Colorf color)
          Deprecated. 
 
Method Summary
protected  TriangleFanArray createGeometry()
           
protected  void generateNormals(Geometry geom)
           
 float getAlpha()
           
 org.openmali.vecmath2.Colorf getColor()
           
 TriangleFanArray getGeometry()
          
 Texture getTexture()
           
 void setAlpha(float alpha)
          Sets this Quad's alpha value. (-1f if not TransparencyAttributes are set.)
 void setColor(org.openmali.vecmath2.Colorf color)
          Sets this Quad's color.
 void setTexture(java.lang.String texture)
          Sets the new Texture for this Quad.
 void setTexture(java.lang.String texture, org.openmali.vecmath2.TexCoord2f[] textureCoordinates)
          Sets the new Texture together with texture-coordinates for this Quad.
 void setTexture(Texture texture)
          Sets the new Texture for this Quad.
 void setTexture(Texture texture, org.openmali.vecmath2.TexCoord2f[] textureCoordinates)
          Sets the new Texture together with texture-coordinates for this Quad.
 void setTextureCoordinates(org.openmali.vecmath2.TexCoord2f[] textureCoordinates)
          Sets the new texture-coordinates for this Quad.
 void setTexturePosition(org.openmali.vecmath2.TexCoord2f[] textureCoordinates)
          Deprecated. please use setTextureCoordinates(TexCoord2f[]) instead.
 void setVertexCoords(org.openmali.vecmath2.Tuple3f[] coords)
          Updates the vertex-coord-data of this Quad.
 void setVertexCoords(org.openmali.vecmath2.Tuple3f[] coords, Geometry geom)
           
 void setVertexCoords(org.openmali.vecmath2.Tuple3f ll, org.openmali.vecmath2.Tuple3f lr, org.openmali.vecmath2.Tuple3f ur, org.openmali.vecmath2.Tuple3f ul)
          Updates the vertex-coord-data of this Quad.
 void update(org.openmali.vecmath2.Tuple3f[] vertices)
          Deprecated. please use setVertexCoords(Tuple3f[]), which abstracts the internal vertex order.
 void update(org.openmali.vecmath2.Tuple3f ll, org.openmali.vecmath2.Tuple3f lr, org.openmali.vecmath2.Tuple3f ul, org.openmali.vecmath2.Tuple3f ur)
          Deprecated. please use setVertexCoords(Tuple3f, Tuple3f, Tuple3f, Tuple3f), which abstracts the internal vertex order.
 
Methods inherited from class org.xith3d.scenegraph.Shape3D
absorbDetails, copy, freeOpenGLResources, getAppearance, getAppearance, getCustomComparable, isBumpMappingEnabled, isShadowReceiver, isVisible, newAppearance, newInstance, setAppearance, setBounds, setBumpMappingEnabled, setBumpMappingEnabled, setCustomComparable, setGeometry, setIsShadowReceiver, setModListener, setVisible, sharedCopy, sharedCopy, traverse, updateBounds, updateBoundsCheap, updateWorldTransform, verifyAppChange
 
Methods inherited from class org.xith3d.scenegraph.Leaf
dump, getPickHost, setPickHost
 
Methods inherited from class org.xith3d.scenegraph.Node
cloneNode, detach, duplicateNode, freeOpenGLResources, getBounds, getBoundsAutoCompute, getBoundsType, getBoundsTypeHint, getDefaultPickable, getIndentString, getInheritedNodeAttributes, getModListener, getOrderedChild, getOrderedState, getParent, getRoot, getShadowAttachment, getShowBounds, getTransformGroup, getTreeCell, getWorldBounds, getWorldTransform, getWorldTransform, isBillboard, isIgnoreBounds, isOccluder, isPickable, isRenderable, isUpdatableNode, mergeInheritedClipper, mergeInheritedNodes, mergeInheritedScissorRect, popGlobalIgnoreBounds, printBounds, pushGlobalIgnoreBounds, setBoundsAutoCompute, setBoundsDirty, setBoundsDirtyUpward, setBoundsTypeHint, setDefaultPickable, setGlobalIgnoreBounds, setIgnoreBounds, setIsOccluder, setOrderedChild, setParent, setPickable, setPickableRecursive, setPickableRecursive, setRenderable, setShadowAttachment, setShowBounds, setTransformGroup, setTreeCell, traverse, unmergeInheritedFog, unmergeInheritedLight, unmergeInheritedNodes, updateOrderedChild, updateTransformGroup
 
Methods inherited from class org.xith3d.scenegraph.SceneGraphObject
getName, getUserData, getUserData, getUserDataMap, isLive, setLive, setName, setUserData, setUserData, setUserDataRecursive, setUserDataRecursive, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            boolean generateNormals,
            org.openmali.vecmath2.TexCoord2f[] textureCoords,
            Texture texture,
            org.openmali.vecmath2.Colorf color)
Creates a textured Quad.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
generateNormals -
textureCoords - the texture coordinates for the Quad (ll, lr, ur, ul)
texture - the texture
color - the color for the ColoringAttributes

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            boolean generateNormals,
            org.openmali.vecmath2.TexCoord2f[] textureCoords,
            java.lang.String texture,
            org.openmali.vecmath2.Colorf color)
Creates a textured Quad.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
generateNormals -
textureCoords - the texture coordinates for the Quad (ll, lr, ur, ul)
texture - the name of the texture (loaded with the TextureLoader)
color - the color for the ColoringAttributes

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            boolean generateNormals,
            org.openmali.vecmath2.TexCoord2f[] textureCoords,
            Texture texture)
Creates a textured Quad.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
generateNormals -
textureCoords - the texture coordinates for the Quad (ll, lr, ur, ul)
texture - the name of the texture (loaded with the TextureLoader)

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            boolean generateNormals,
            org.openmali.vecmath2.TexCoord2f[] textureCoords,
            java.lang.String texture)
Creates a textured Quad.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
generateNormals -
texture - the name of the texture (loaded with the TextureLoader)
textureCoords - the texture coordinates for the Quad (ll, lr, ur, ul)

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            boolean generateNormals,
            org.openmali.vecmath2.Colorf color)
Creates an untextured, but colored Quad.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
generateNormals -
color - the color to use for coloring this Quad

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            boolean generateNormals,
            java.lang.String texture)
Creates a textured Quad.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
generateNormals -
texture - the name of the texture (loaded with the TextureLoader)

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            boolean generateNormals)
Creates an untextured Quad without alpha channel.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
generateNormals -

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            org.openmali.vecmath2.TexCoord2f[] textureCoords,
            Texture texture,
            org.openmali.vecmath2.Colorf color)
Creates a textured Quad.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
textureCoords - the texture coordinates for the Quad (ll, lr, ur, ul)
texture - the texture
color - the color for the ColoringAttributes

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            org.openmali.vecmath2.TexCoord2f[] textureCoords,
            java.lang.String texture,
            org.openmali.vecmath2.Colorf color)
Creates a textured Quad.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
textureCoords - the texture coordinates for the Quad (ll, lr, ur, ul)
texture - the name of the texture (loaded with the TextureLoader)
color - the color for the ColoringAttributes

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            org.openmali.vecmath2.TexCoord2f[] textureCoords,
            Texture texture)
Creates a textured Quad.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
textureCoords - the texture coordinates for the Quad (ll, lr, ur, ul)
texture - the name of the texture (loaded with the TextureLoader)

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            org.openmali.vecmath2.TexCoord2f[] textureCoords,
            java.lang.String texture)
Creates a textured Quad.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
textureCoords - the texture coordinates for the Quad (ll, lr, ur, ul)
texture - the name of the texture (loaded with the TextureLoader)

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            org.openmali.vecmath2.Colorf color)
Creates an untextured, but colored Quad.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
color - the color to use for coloring this Quad

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            Texture texture)
Creates a textured Quad.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
texture - the texture

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords,
            java.lang.String texture)
Creates a textured Quad.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)
texture - the name of the texture (loaded with the TextureLoader)

Quad

public Quad(org.openmali.vecmath2.Point3f[] coords)
Creates an untextured Quad without alpha channel.

Parameters:
coords - the vertex-coords of the Quad (ll, lr, ur, ul)

Quad

@Deprecated
public Quad(org.openmali.vecmath2.Tuple3f[] vertices,
                       Texture texture,
                       org.openmali.vecmath2.TexCoord2f[] textureCoords,
                       org.openmali.vecmath2.Colorf color)
Deprecated. 

Creates a textured Quad.

Parameters:
vertices - the vertices of the Quad
texture - the texture
textureCoords - the texture coordinates for the Quad (ll, lr, ul, ur)
color - the color for the ColoringAttributes

Quad

@Deprecated
public Quad(org.openmali.vecmath2.Tuple3f[] vertices,
                       java.lang.String texture,
                       org.openmali.vecmath2.TexCoord2f[] textureCoords,
                       org.openmali.vecmath2.Colorf color)
Deprecated. 

Creates a textured Quad.

Parameters:
vertices - the vertices of the Quad
texture - the name of the texture (loaded with the TextureLoader)
textureCoords - the texture coordinates for the Quad (ll, lr, ul, ur)
color - the color for the ColoringAttributes

Quad

@Deprecated
public Quad(org.openmali.vecmath2.Tuple3f[] vertices,
                       Texture texture,
                       org.openmali.vecmath2.TexCoord2f[] textureCoords)
Deprecated. 

Creates a textured Quad.

Parameters:
vertices - the vertices of the Quad
texture - the name of the texture (loaded with the TextureLoader)
textureCoords - the texture coordinates for the Quad (ll, lr, ul, ur)

Quad

@Deprecated
public Quad(java.lang.String texture,
                       org.openmali.vecmath2.Tuple3f[] vertices,
                       org.openmali.vecmath2.TexCoord2f[] textureCoords)
Deprecated. 

Creates a textured Quad.

Parameters:
vertices - the vertices of the Quad
texture - the name of the texture (loaded with the TextureLoader)
textureCoords - the texture coordinates for the Quad (ll, lr, ul, ur)

Quad

@Deprecated
public Quad(org.openmali.vecmath2.Tuple3f[] vertices,
                       org.openmali.vecmath2.Colorf color)
Deprecated. 

Creates an untextured, but colored Quad.

Parameters:
vertices - the vertices of the Quad
color - the color to use for coloring this Quad

Quad

@Deprecated
public Quad(org.openmali.vecmath2.Tuple3f[] vertices,
                       java.lang.String texture)
Deprecated. 

Creates a textured Quad.

Parameters:
vertices - the vertices of the Quad
texture - the name of the texture (loaded with the TextureLoader)

Quad

@Deprecated
public Quad(org.openmali.vecmath2.Tuple3f[] vertices)
Deprecated. 

Creates an untextured Quad without alpha channel.

Parameters:
vertices - the vertices of the Quad
Method Detail

update

@Deprecated
public void update(org.openmali.vecmath2.Tuple3f[] vertices)
Deprecated. please use setVertexCoords(Tuple3f[]), which abstracts the internal vertex order.

Updates the vertex data of this Quad.

Parameters:
vertices - The new vertices (ll, lr, ul, ur)

update

@Deprecated
public void update(org.openmali.vecmath2.Tuple3f ll,
                              org.openmali.vecmath2.Tuple3f lr,
                              org.openmali.vecmath2.Tuple3f ul,
                              org.openmali.vecmath2.Tuple3f ur)
Deprecated. please use setVertexCoords(Tuple3f, Tuple3f, Tuple3f, Tuple3f), which abstracts the internal vertex order.

Updates the vertex data of this Quad.

Parameters:
ll - New vertex-coord of the lower-left corner
lr - New vertex-coord of the lower-right corner
ur - New vertex-coord of the upper-right corner
ul - New vertex-coord of the upper-left corner

setVertexCoords

public void setVertexCoords(org.openmali.vecmath2.Tuple3f[] coords,
                            Geometry geom)

setVertexCoords

public void setVertexCoords(org.openmali.vecmath2.Tuple3f ll,
                            org.openmali.vecmath2.Tuple3f lr,
                            org.openmali.vecmath2.Tuple3f ur,
                            org.openmali.vecmath2.Tuple3f ul)
Updates the vertex-coord-data of this Quad.

Parameters:
ll - New vertex-coord of the lower-left corner
lr - New vertex-coord of the lower-right corner
ur - New vertex-coord of the upper-right corner
ul - New vertex-coord of the upper-left corner

setVertexCoords

public void setVertexCoords(org.openmali.vecmath2.Tuple3f[] coords)
Updates the vertex-coord-data of this Quad.

Parameters:
coords - The new vertex-coords (ll, lr, ur, ul)

setColor

public void setColor(org.openmali.vecmath2.Colorf color)
Sets this Quad's color.

Parameters:
color - the new color

getColor

public org.openmali.vecmath2.Colorf getColor()
Returns:
this Quad's color or null, if no ColoringAtributes are set

setAlpha

public void setAlpha(float alpha)
Sets this Quad's alpha value. (-1f if not TransparencyAttributes are set.)


getAlpha

public float getAlpha()
Returns:
this Quad's alpha value. (-1f if not TransparencyAttributes are set.)

setTexturePosition

@Deprecated
public void setTexturePosition(org.openmali.vecmath2.TexCoord2f[] textureCoordinates)
Deprecated. please use setTextureCoordinates(TexCoord2f[]) instead.

Sets the new texture-coordinates for this Quad.

Parameters:
textureCoordinates - the texture coordinate for this Quad (ll, lr, ul, ur)

setTextureCoordinates

public void setTextureCoordinates(org.openmali.vecmath2.TexCoord2f[] textureCoordinates)
Sets the new texture-coordinates for this Quad.

Parameters:
textureCoordinates - the texture coordinate for this Quad (ll, lr, ur, ul)

setTexture

public void setTexture(Texture texture)
Sets the new Texture for this Quad.

Parameters:
texture - the new Texture

setTexture

public void setTexture(Texture texture,
                       org.openmali.vecmath2.TexCoord2f[] textureCoordinates)
Sets the new Texture together with texture-coordinates for this Quad.

Parameters:
texture - the new Texture
textureCoordinates - the texture coordinate for this Quad (ll, lr, ur, ul)

setTexture

public void setTexture(java.lang.String texture,
                       org.openmali.vecmath2.TexCoord2f[] textureCoordinates)
Sets the new Texture together with texture-coordinates for this Quad.

Parameters:
texture - the new Texture resource
textureCoordinates - the texture coordinate for this Quad (ll, lr, ur, ul)

setTexture

public void setTexture(java.lang.String texture)
Sets the new Texture for this Quad.

Parameters:
texture - the new Texture resource

getTexture

public Texture getTexture()
Returns:
this Quad's Texture or null

getGeometry

public TriangleFanArray getGeometry()

Overrides:
getGeometry in class Shape3D
Returns:
the Geometry for this object.

createGeometry

protected TriangleFanArray createGeometry()

generateNormals

protected void generateNormals(Geometry geom)