com.threed.jpct
Class TextureInfo

java.lang.Object
  extended bycom.threed.jpct.TextureInfo

public class TextureInfo
extends java.lang.Object

TextureInfo is jPCT's key to multi texturing. Multi texturing is supported by the OpenGL renderer only. You may still use the software renderer to render such a scene, but it will simply ignore the additional texture stages. 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, jPCT will switch to multi pass rendering automatically. Due to the way the OpenGL pipeline is specified, this may produce different results compared to one pass multi texturing. This happens most when using transparency, fog or blending modes like MODE_ADD, when the card's internal accuracy is higher than the framebuffer's.


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_ADD_SIGNED
          Use a signed add for adding this texture layer, i.e. 50% grey means no change, everything above will be added and everything below will be subtracted.
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.
static int MODE_SUBTRACT
          Use subtraction for this texture layer
 
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. This may make sense in other engines, but due to the way how jPCT works, it's almost pointless in jPCT.

See Also:
Constant Field Values

MODE_BLEND

public static final int MODE_BLEND
Use blending for adding this texture layer. If this is used, Config.glBlendingAffectsAlpha has no effect on that polygon.

See Also:
Constant Field Values

MODE_ADD_SIGNED

public static final int MODE_ADD_SIGNED
Use a signed add for adding this texture layer, i.e. 50% grey means no change, everything above will be added and everything below will be subtracted.

See Also:
Constant Field Values

MODE_SUBTRACT

public static final int MODE_SUBTRACT
Use subtraction for 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. The hardware may support less, in which case jPCT will switch to multi pass rendering on one layer if the number of used layers exceeds the hardware's capabilities. 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