org.xith3d.scenegraph
Class Appearance

java.lang.Object
  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.NodeComponent
          extended by org.xith3d.scenegraph.Appearance
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject

public class Appearance
extends NodeComponent

Appearance is a component object of a Shape3D node that defines all rendering state attributes for that shape node.


Field Summary
 
Fields inherited from class org.xith3d.scenegraph.SceneGraphObject
XITH3D_USERDATAKEY_OLDUSERDATA
 
Constructor Summary
Appearance()
          Constructs a new Appearance object.
Appearance(java.lang.String texture)
          Constructs a new Appearance object.
Appearance(Texture texture)
          Constructs a new Appearance object.
 
Method Summary
 Appearance cloneNodeComponent(boolean forceDuplicate)
           
protected  void duplicateNodeComponent(NodeComponent originalNodeComponent, boolean forceDuplicate)
           
 void freeOpenGLResources(CanvasPeer canvasPeer)
          This method frees OpenGL resources (names) for all this NodeComponent and all child-components.
 ColoringAttributes getColoringAttributes()
           
 ColoringAttributes getColoringAttributes(boolean forceExistance)
           
 LineAttributes getLineAttributes()
           
 LineAttributes getLineAttributes(boolean forceExistence)
           
 Material getMaterial()
           
 Material getMaterial(boolean forceExistence)
           
 PointAttributes getPointAttributes()
           
 PointAttributes getPointAttributes(boolean forceExistance)
           
 PolygonAttributes getPolygonAttributes()
           
 PolygonAttributes getPolygonAttributes(boolean forceExistence)
           
 RenderingAttributes getRenderingAttributes()
           
 RenderingAttributes getRenderingAttributes(boolean forceExistence)
           
 ShaderProgramContext getShaderProgramContext()
           
 TexCoordGeneration getTexCoordGeneration()
           
 TexCoordGeneration getTexCoordGeneration(boolean forceExistence)
           
 TexCoordGeneration getTexCoordGeneration(int unit)
           
 TexCoordGeneration getTexCoordGeneration(int unit, boolean forceExistence)
           
 Texture getTexture()
           
 Texture getTexture(int unit)
           
 TextureAttributes getTextureAttributes()
           
 TextureAttributes getTextureAttributes(boolean forceExistence)
           
 TextureAttributes getTextureAttributes(int unit)
           
 TextureAttributes getTextureAttributes(int unit, boolean forceExistence)
           
 TextureUnit getTextureUnit(int index)
           
 TextureUnit[] getTextureUnits()
           
 int getTextureUnitsCount()
           
 TransparencyAttributes getTransparencyAttributes()
           
 TransparencyAttributes getTransparencyAttributes(boolean forceExistance)
          Returns this Appearance'es TransparencyAttributes, if they exist.
 boolean isChanged()
           
static boolean isDefaultStatic()
           
 boolean isStatic()
           
 boolean isStaticDirty()
           
 void markStaticDirty()
           
 void setChanged(boolean changed)
           
 void setChangedRecursive(boolean changed)
           
 void setColor(org.openmali.vecmath2.Colorf color)
          Sets the color of this object, creating a ColoringAttributes if needed.
 void setColor(float r, float g, float b)
          Sets the color of this object, creating a ColoringAttributes if needed.
 void setColoringAttributes(ColoringAttributes coloringAttrs)
          Sets the coloring attributes information.
static void setDefaultStatic(boolean b)
           
 void setDrawMode(org.jagatoo.opengl.enums.DrawMode drawMode)
          Changes the draw mode
 void setFaceCullMode(org.jagatoo.opengl.enums.FaceCullMode mode)
          Changes the face culling mode.
 void setLineAttributes(LineAttributes lineAttrs)
          Sets the line attributes information.
 void setMaterial(Material material)
          Sets the material information.
 void setModListener(ScenegraphModificationsListener modListener)
           
 void setPointAttributes(PointAttributes pointAttrs)
          Sets the point attributes information.
 void setPolygonAttributes(PolygonAttributes polygonAttrs)
          Sets the polygon attributes information.
 void setRenderingAttributes(RenderingAttributes renderingAttrs)
          Sets the rendering attributes information.
 void setShaderProgramContext(ShaderProgramContext shaderProgramContext)
          Sets the ShaderProgram information.
 void setStatic(boolean b)
           
 void setTexCoordGeneration(int unit, TexCoordGeneration texCoordGen)
          Sets the TexCoordGeneration of the given TextureUnit.
 void setTexCoordGeneration(TexCoordGeneration texCoordGen)
          Sets the TexCoordGeneration of the first (#0) TextureUnit.
 void setTexture(int unit, java.lang.String texture)
          Sets the Texture of the first (#0) TextureUnit.
 void setTexture(int unit, Texture texture)
          Sets the Texture of the given TextureUnit.
 void setTexture(java.lang.String texture)
          Sets the Texture of the first (#0) TextureUnit.
 void setTexture(Texture texture)
          Sets the Texture of the first (#0) TextureUnit.
 void setTextureAttributes(int unit, TextureAttributes textureAttribs)
          Sets the TextureAttributes of the given TextureUnit.
 void setTextureAttributes(TextureAttributes textureAttribs)
          Sets the TextureAttributes of the first (#0) TextureUnit.
 void setTextureUnit(int index, TextureUnit tu)
           
 void setTextureUnits(TextureUnit... textureUnits)
           
 void setTransparencyAttributes(TransparencyAttributes transparencyAttrs)
          Sets the transparency attributes information.
 long verifyChange(Shape3D shape, OpenGLCapabilities glCaps)
           
 
Methods inherited from class org.xith3d.scenegraph.NodeComponent
freeOpenGLResources, getDuplicateOnCloneTree, getModListener, isChanged2, setDuplicateOnCloneTree
 
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

Appearance

public Appearance()
Constructs a new Appearance object.


Appearance

public Appearance(Texture texture)
Constructs a new Appearance object.

Parameters:
texture -

Appearance

public Appearance(java.lang.String texture)
Constructs a new Appearance object.

Parameters:
texture -
Method Detail

setDefaultStatic

public static final void setDefaultStatic(boolean b)

isDefaultStatic

public static final boolean isDefaultStatic()

setStatic

public final void setStatic(boolean b)

isStatic

public final boolean isStatic()

markStaticDirty

public void markStaticDirty()

isStaticDirty

public final boolean isStaticDirty()

setModListener

public void setModListener(ScenegraphModificationsListener modListener)
Overrides:
setModListener in class NodeComponent

setMaterial

public final void setMaterial(Material material)
Sets the material information.


getMaterial

public final Material getMaterial()
Returns:
the material information.

getMaterial

public final Material getMaterial(boolean forceExistence)
Parameters:
forceExistence - if this appearance has no material, create one and return it.
Returns:
the material information, or create one if necessary

setTexture

public final void setTexture(int unit,
                             Texture texture)
Sets the Texture of the given TextureUnit.

Parameters:
unit -
texture -

setTexture

public final void setTexture(Texture texture)
Sets the Texture of the first (#0) TextureUnit.

Parameters:
texture -

setTexture

public final void setTexture(int unit,
                             java.lang.String texture)
Sets the Texture of the first (#0) TextureUnit.

Parameters:
texture -

setTexture

public final void setTexture(java.lang.String texture)
Sets the Texture of the first (#0) TextureUnit.

Parameters:
texture -

getTexture

public final Texture getTexture(int unit)
Parameters:
unit -
Returns:
the Texture of the requested TextureUnit.

getTexture

public final Texture getTexture()
Returns:
the Texture of the first (#0) TextureUnit.

setTextureAttributes

public final void setTextureAttributes(int unit,
                                       TextureAttributes textureAttribs)
Sets the TextureAttributes of the given TextureUnit.

Parameters:
unit -
textureAttribs -

setTextureAttributes

public final void setTextureAttributes(TextureAttributes textureAttribs)
Sets the TextureAttributes of the first (#0) TextureUnit.

Parameters:
textureAttribs -

getTextureAttributes

public final TextureAttributes getTextureAttributes(int unit)
Parameters:
unit -
Returns:
the TextureAttributes of the requested TextureUnit.

getTextureAttributes

public final TextureAttributes getTextureAttributes(int unit,
                                                    boolean forceExistence)
Parameters:
unit -
Returns:
the TextureAttributes of the requested TextureUnit.

getTextureAttributes

public final TextureAttributes getTextureAttributes()
Returns:
the TextureAttributes of the first (#0) TextureUnit.

getTextureAttributes

public final TextureAttributes getTextureAttributes(boolean forceExistence)
Returns:
the TextureAttributes of the first (#0) TextureUnit.

setTexCoordGeneration

public final void setTexCoordGeneration(int unit,
                                        TexCoordGeneration texCoordGen)
Sets the TexCoordGeneration of the given TextureUnit.

Parameters:
unit -
texCoordGen -

setTexCoordGeneration

public final void setTexCoordGeneration(TexCoordGeneration texCoordGen)
Sets the TexCoordGeneration of the first (#0) TextureUnit.

Parameters:
texCoordGen -

getTexCoordGeneration

public final TexCoordGeneration getTexCoordGeneration(int unit)
Parameters:
unit -
Returns:
the TexCoordGeneration of the requested TextureUnit.

getTexCoordGeneration

public final TexCoordGeneration getTexCoordGeneration(int unit,
                                                      boolean forceExistence)
Parameters:
unit -
Returns:
the TexCoordGeneration of the requested TextureUnit.

getTexCoordGeneration

public final TexCoordGeneration getTexCoordGeneration()
Returns:
the TexCoordGeneration of the first (#0) TextureUnit.

getTexCoordGeneration

public final TexCoordGeneration getTexCoordGeneration(boolean forceExistence)
Returns:
the TexCoordGeneration of the first (#0) TextureUnit.

setTextureUnits

public final void setTextureUnits(TextureUnit... textureUnits)

setTextureUnit

public final void setTextureUnit(int index,
                                 TextureUnit tu)

getTextureUnits

public final TextureUnit[] getTextureUnits()

getTextureUnit

public TextureUnit getTextureUnit(int index)

getTextureUnitsCount

public int getTextureUnitsCount()

setShaderProgramContext

public final void setShaderProgramContext(ShaderProgramContext shaderProgramContext)
Sets the ShaderProgram information.


getShaderProgramContext

public final ShaderProgramContext getShaderProgramContext()
Returns:
the ShaderProgram information

setColoringAttributes

public final void setColoringAttributes(ColoringAttributes coloringAttrs)
Sets the coloring attributes information.


getColoringAttributes

public final ColoringAttributes getColoringAttributes()
Returns:
the coloring attributes information.

getColoringAttributes

public final ColoringAttributes getColoringAttributes(boolean forceExistance)
Returns:
the coloring attributes information.

setTransparencyAttributes

public final void setTransparencyAttributes(TransparencyAttributes transparencyAttrs)
Sets the transparency attributes information.


getTransparencyAttributes

public final TransparencyAttributes getTransparencyAttributes()
Returns:
the transparency attributes information.

getTransparencyAttributes

public final TransparencyAttributes getTransparencyAttributes(boolean forceExistance)
Returns this Appearance'es TransparencyAttributes, if they exist. If they don't exist, they are created depending on the forceExistance parameter.

Parameters:
forceExistance - if true, a new TransparencyAttributes is created and attached, if it doesn't already exist.
Returns:
the TransparencyAttributes for this object

setRenderingAttributes

public final void setRenderingAttributes(RenderingAttributes renderingAttrs)
Sets the rendering attributes information.


getRenderingAttributes

public final RenderingAttributes getRenderingAttributes()
Returns:
the rendering attributes information.

getRenderingAttributes

public final RenderingAttributes getRenderingAttributes(boolean forceExistence)
Returns:
the rendering attributes information.

setPolygonAttributes

public final void setPolygonAttributes(PolygonAttributes polygonAttrs)
Sets the polygon attributes information.


getPolygonAttributes

public final PolygonAttributes getPolygonAttributes()
Returns:
the polygon attributes information.

getPolygonAttributes

public final PolygonAttributes getPolygonAttributes(boolean forceExistence)
Returns:
the polygon attributes information.

setLineAttributes

public final void setLineAttributes(LineAttributes lineAttrs)
Sets the line attributes information.


getLineAttributes

public final LineAttributes getLineAttributes()
Returns:
the line attributes information.

getLineAttributes

public final LineAttributes getLineAttributes(boolean forceExistence)
Returns:
the line attributes information.

setPointAttributes

public final void setPointAttributes(PointAttributes pointAttrs)
Sets the point attributes information.


getPointAttributes

public final PointAttributes getPointAttributes()
Returns:
the point attributes information.

getPointAttributes

public final PointAttributes getPointAttributes(boolean forceExistance)
Returns:
the point attributes information.

setChanged

public void setChanged(boolean changed)
Overrides:
setChanged in class NodeComponent

setChangedRecursive

public void setChangedRecursive(boolean changed)

verifyChange

public final long verifyChange(Shape3D shape,
                               OpenGLCapabilities glCaps)

setColor

public void setColor(org.openmali.vecmath2.Colorf color)
Sets the color of this object, creating a ColoringAttributes if needed.

Parameters:
color - Color value

setColor

public void setColor(float r,
                     float g,
                     float b)
Sets the color of this object, creating a ColoringAttributes if needed.

Parameters:
r - Red value
g - Green value
b - Blue value

setFaceCullMode

public void setFaceCullMode(org.jagatoo.opengl.enums.FaceCullMode mode)
Changes the face culling mode.

Parameters:
mode - The new culling mode. Can be PolygonAttributes.CULL_NONE, PolygonAttributes.CULL_BACK, or PolygonAttributes.CULL_FRONT

setDrawMode

public void setDrawMode(org.jagatoo.opengl.enums.DrawMode drawMode)
Changes the draw mode

Parameters:
drawMode - The new draw mode. Can be PolygonAttributes.POLYGON_FILL, PolygonAttributes.POLYGON_LINE, PolygonAttributes.POLYGON_POINT

isChanged

public boolean isChanged()
Overrides:
isChanged in class NodeComponent

duplicateNodeComponent

protected void duplicateNodeComponent(NodeComponent originalNodeComponent,
                                      boolean forceDuplicate)
Overrides:
duplicateNodeComponent in class NodeComponent

cloneNodeComponent

public Appearance cloneNodeComponent(boolean forceDuplicate)
Specified by:
cloneNodeComponent in class NodeComponent

freeOpenGLResources

public void freeOpenGLResources(CanvasPeer canvasPeer)
This method frees OpenGL resources (names) for all this NodeComponent and all child-components.

Specified by:
freeOpenGLResources in class NodeComponent