org.xith3d.effects.bumpmapping
Class BumpMappingFactory

java.lang.Object
  extended by org.xith3d.effects.bumpmapping.BumpMappingFactory
Direct Known Subclasses:
AssemblyBumpMappingFactory, GLSLBumpMappingFactory

public abstract class BumpMappingFactory
extends java.lang.Object

The BumpmappingFactory is capable of preparing a Shape3D for Bumpmapping. the underlying methods to calculate tangets/bitangets and to load the appropriate shaders are also public to use them for different perposes.


Constructor Summary
BumpMappingFactory()
           
 
Method Summary
 int getBiTangentsTextureUnit()
           
 int getBiTangentsVertexAttribute()
           
 Light getLight()
           
 int getNormalMapTextureUnit()
           
protected  int getStoreIndex1()
           
protected  int getStoreIndex2()
           
static TangentsFactory getTangentsFactory()
           
 TangentsFactory.TangentsStoreMode getTangentsStoreMode()
           
 int getTangentsTextureUnit()
           
 int getTangentsVertexAttribute()
           
static Texture loadNormalMap(java.lang.String textureName)
          Loads the normal-map-Texture.
 void prepareForBumpMapping(Shape3D shape, java.lang.String normalMapTex)
          Prepares the given Shape3D for BumpMapping.
abstract  void prepareForBumpMapping(Shape3D shape, Texture normalMapTex)
          Prepares the given Shape3D for BumpMapping.
 void setBiTangentsTextureUnit(int textureUnit)
          Sets the texture-unit to be used to store the bitangents.
 void setBiTangentsVertexAttribute(int vertexAttribIndex)
          Sets the vertex-attribute-index to be used to store the bitangents.
 void setLight(Light light)
           
 void setNormalMapTextureUnit(int textureUnit)
          Sets the texture-unit to be used for the normal map Texture.
 void setTangentsStoreMode(TangentsFactory.TangentsStoreMode mode)
          Sets the store-mode for the tangents and bitangents.
 void setTangentsTextureUnit(int textureUnit)
          Sets the texture-unit to be used to store the tangents.
 void setTangentsVertexAttribute(int vertexAttribIndex)
          Sets the vertex-attribute-index to be used to store the tangents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BumpMappingFactory

public BumpMappingFactory()
Method Detail

getTangentsFactory

public static final TangentsFactory getTangentsFactory()

setNormalMapTextureUnit

public void setNormalMapTextureUnit(int textureUnit)
Sets the texture-unit to be used for the normal map Texture.

Parameters:
textureUnit -

getNormalMapTextureUnit

public int getNormalMapTextureUnit()
Returns:
the texture-unit to be used for the normal map Texture.

setTangentsTextureUnit

public void setTangentsTextureUnit(int textureUnit)
Sets the texture-unit to be used to store the tangents.

Parameters:
textureUnit -

getTangentsTextureUnit

public int getTangentsTextureUnit()
Returns:
the texture-unit to be used to store the tangents.

setBiTangentsTextureUnit

public void setBiTangentsTextureUnit(int textureUnit)
Sets the texture-unit to be used to store the bitangents.

Parameters:
textureUnit -

getBiTangentsTextureUnit

public int getBiTangentsTextureUnit()
Returns:
the texture-unit to be used to store the bitangents.

setTangentsVertexAttribute

public void setTangentsVertexAttribute(int vertexAttribIndex)
Sets the vertex-attribute-index to be used to store the tangents.

Parameters:
vertexAttribIndex -

getTangentsVertexAttribute

public int getTangentsVertexAttribute()
Returns:
the vertex-attribute-index to be used to store the tangents.

setBiTangentsVertexAttribute

public void setBiTangentsVertexAttribute(int vertexAttribIndex)
Sets the vertex-attribute-index to be used to store the bitangents.

Parameters:
vertexAttribIndex -

getBiTangentsVertexAttribute

public int getBiTangentsVertexAttribute()
Returns:
the vertex-attribute-index to be used to store the bitangents.

setTangentsStoreMode

public void setTangentsStoreMode(TangentsFactory.TangentsStoreMode mode)
Sets the store-mode for the tangents and bitangents.

Parameters:
mode -

getTangentsStoreMode

public TangentsFactory.TangentsStoreMode getTangentsStoreMode()
Returns:
the store-mode for the tangents and bitangents.

getStoreIndex1

protected int getStoreIndex1()

getStoreIndex2

protected int getStoreIndex2()

setLight

public void setLight(Light light)

getLight

public Light getLight()

loadNormalMap

public static Texture loadNormalMap(java.lang.String textureName)
Loads the normal-map-Texture.

Parameters:
textureName -
Returns:
the normal-map-Texture.

prepareForBumpMapping

public abstract void prepareForBumpMapping(Shape3D shape,
                                           Texture normalMapTex)
                                    throws java.io.IOException
Prepares the given Shape3D for BumpMapping.
This calculates the tangets and bitangets and stores them in the texture units 1 and 2.
It also attaches a vertex- and fragment shader to calculate bumpmapping.

Parameters:
shape -
normalMapTex -
Throws:
java.io.IOException

prepareForBumpMapping

public final void prepareForBumpMapping(Shape3D shape,
                                        java.lang.String normalMapTex)
                                 throws java.io.IOException
Prepares the given Shape3D for BumpMapping.
This calculates the tangets and bitangets and stores them in the texture units 1 and 2.
It also attaches a vertex- and fragment shader to calculate bumpmapping.

Parameters:
shape -
normalMapTex -
Throws:
java.io.IOException