com.threed.jpct
Class TextureInfo

java.lang.Object
  extended by com.threed.jpct.TextureInfo

public class TextureInfo
extends java.lang.Object

TextureInfo is jPCT's key to multi texturing. You can use addTriangle() or setTexture() in Object3D to define a polygon or the whole object as multi textured.
You can use any combination of textures and blending modes for a polygon. jPCT will try to optimize the texture state changes when rendering the image. However, don't overuse this feature on a single object, because jPCT can only do so much.
If you are adding more layers than the hardware supports, additional layers will be ignored.


Field Summary
static int MAX_PHYSICAL_TEXTURE_STAGES
          The maximum number of physical texture layers available.
static int MODE_ADD
          Use addition for adding this texture layer
static int MODE_BLEND
          Use blending for adding this texture layer
static int MODE_DECAL
          Use the layer as a decal, i.e. the alpha channel defines the opacity.
static int MODE_MODULATE
          Use multiplication of color values for adding this texture layer
static int MODE_REPLACE
          For the sake of completeness.
 
Constructor Summary
TextureInfo(int texID)
          Creates a new TextureInfo.
TextureInfo(int texID, float u0, float v0, float u1, float v1, float u2, float v2)
          Creates a new TextureInfo.
 
Method Summary
 void add(int texID, float u0, float v0, float u1, float v1, float u2, float v2, int mode)
          Adds another texture layer.
 void add(int texID, int mode)
          Adds another texture layer.
 void set(int texID, int stageCnt, float u0, float v0, float u1, float v1, float u2, float v2, int mode)
          Sets the values of an existing layer.
 void set(int texID, int stageCnt, int mode)
          Sets the values of an existing layer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_MODULATE

public static final int MODE_MODULATE
Use multiplication of color values for adding this texture layer

See Also:
Constant Field Values

MODE_ADD

public static final int MODE_ADD
Use addition for adding this texture layer

See Also:
Constant Field Values

MODE_REPLACE

public static final int MODE_REPLACE
For the sake of completeness. Every texture from a lower stage is replaced by the texture in the stage that uses this mode.

See Also:
Constant Field Values

MODE_BLEND

public static final int MODE_BLEND
Use blending for adding this texture layer

See Also:
Constant Field Values

MODE_DECAL

public static final int MODE_DECAL
Use the layer as a decal, i.e. the alpha channel defines the opacity.

See Also:
Constant Field Values

MAX_PHYSICAL_TEXTURE_STAGES

public static final int MAX_PHYSICAL_TEXTURE_STAGES
The maximum number of physical texture layers available. If the hardware supports more, jPCT will simply ignore them.

See Also:
Constant Field Values
Constructor Detail

TextureInfo

public TextureInfo(int texID,
                   float u0,
                   float v0,
                   float u1,
                   float v1,
                   float u2,
                   float v2)
Creates a new TextureInfo.

Parameters:
texID - int the ID of the Texture as the TextureManager sees it.
u0 - float the u-coordinate for the first vertex
v0 - float the v-coordinate for the first vertex
u1 - float the u-coordinate for the second vertex
v1 - float the v-coordinate for the second vertex
u2 - float the u-coordinate for the third vertex
v2 - float the v-coordinate for the third vertex

TextureInfo

public TextureInfo(int texID)
Creates a new TextureInfo. This is a shortcut to the method above, if the u/v-coordinates are not required.

Parameters:
texID - int the ID of the Texture as the TextureManager sees it.
Method Detail

add

public void add(int texID,
                int mode)
Adds another texture layer. This is a shortcut to the method above, if the u/v-coordinates are not required.

Parameters:
texID - int the Texture's ID
mode - int the combination mode

set

public void set(int texID,
                int stageCnt,
                int mode)
Sets the values of an existing layer. This is a shortcut to the method above, if the u/v-coordinates are not required.

Parameters:
texID - int the ID of the Texture as the TextureManager sees it.
stageCnt - int the stage
mode - int the combination mode

add

public void add(int texID,
                float u0,
                float v0,
                float u1,
                float v1,
                float u2,
                float v2,
                int mode)
Adds another texture layer.

Parameters:
texID - int the ID of the Texture as the TextureManager sees it.
u0 - float the u-coordinate for the first vertex
v0 - float the v-coordinate for the first vertex
u1 - float the u-coordinate for the second vertex
v1 - float the v-coordinate for the second vertex
u2 - float the u-coordinate for the third vertex
v2 - float the v-coordinate for the third vertex
mode - int the combination mode

set

public void set(int texID,
                int stageCnt,
                float u0,
                float v0,
                float u1,
                float v1,
                float u2,
                float v2,
                int mode)
Sets the values of an existing layer.

Parameters:
texID - int the ID of the Texture as the TextureManager sees it.
stageCnt - int the stage
u0 - float the u-coordinate for the first vertex
v0 - float the v-coordinate for the first vertex
u1 - float the u-coordinate for the second vertex
v1 - float the v-coordinate for the second vertex
u2 - float the u-coordinate for the third vertex
v2 - float the v-coordinate for the third vertex
mode - int the combination mode