Class TextureInfo
See Also: Class MtlMakerCallback, Class Material, Class Matrix3.
class TextureInfo : public BaseInterfaceServer
Description:
This class is available in release 4.0 and later only.
This class describes a texture used by the interactive renderer. This includes all the information about the mapping channel, tiling, etc. A table of these is maintained by the texture data member of class Material.
There are data members related to maps which specify how the texture should be applied. These are specified independently for color and alpha and include a scale. For example, for normal multiplication (modulation) application of a texture, the entries would be:
colorOp = GW_TEX_MODULATE
colorAlphaSource = GW_TEX_TEXTURE
colorScale = GW_TEX_SCALE_1X
alphaOp = GW_TEX_MODULATE
alphaAlphaSource = GW_TEX_TEXTURE
alphaScale = GW_TEX_SCALE_1X
For applying a texture with alpha blending, the entry would be:
colorOp = GW_TEX_ALPHA_BLEND
colorAlphaSource = GW_TEX_TEXTURE
colorScale = GW_TEX_SCALE_1X
alphaOp = GW_TEX_LEAVE
alphaAlphaSource = GW_TEX_TEXTURE
alphaScale = GW_TEX_SCALE_1X
For applying an opacity map, the entry would be:
colorOp = GW_TEX_LEAVE
colorAlphaSource = GW_TEX_TEXTURE
colorScale = GW_TEX_SCALE_1X
alphaOp = GW_TEX_REPLACE
alphaAlphaSource = GW_TEX_TEXTURE
alphaScale = GW_TEX_SCALE_1X
Data Members:
public:
int useTex;
Indicates if the material uses textures. Nonzero indicates textures are used.
int faceMap;
Indicates if the material is face mapped. Nonzero indicates it is.
DWORD_PTR textHandle;
The texture handle.
int uvwSource;
The UVW source used.
UVSOURCE_MESH
Use UVW coordinates from a standard map channel.
UVSOURCE_XYZ
Compute UVW from object XYZ.
UVSOURCE_MESH2
Use UVW2 (Vertex Color) coordinates.
UVSOURCE_WORLDXYZ
Use World XYZ as UVW.
int mapChannel;
The mapping channel used.
Matrix3 textTM;
The texture transformation matrix.
UBYTE tiling[3];
The UVW tiling. One of the following values:
GW_TEX_REPEAT
GW_TEX_MIRROR
GW_TEX_NO_TILING
UBYTE colorOp;
The color texture operation. One of the following values:
GW_TEX_LEAVE
Use the source pixel value
GW_TEX_REPLACE
Use the texture pixel value
GW_TEX_MODULATE
Multiply the source with the texture
GW_TEX_ADD
Add the source and texture
GW_TEX_ADD_SIGNED
Add the source and texture with an 0.5 subtraction
GW_TEX_SUBTRACT
Subtract the source from the texture
GW_TEX_ADD_SMOOTH
Add the source and the texture then subtract their product
GW_TEX_ALPHA_BLEND
Alpha blend the texture with the source
GW_TEX_PREMULT_ALPHA_BLEND
Alpha blend the source with a premultiplied alpha
UBYTE colorAlphaSource;
The color blend alpha source. One of the following values:
GW_TEX_ZERO
Use no alpha value
GW_TEX_SOURCE
Use the source alpha
GW_TEX_TEXTURE
Use the texture alpha
GW_TEX_CONSTANT
Use a constant BGRA color as an alpha
GW_TEX_PREVIOUS
Use the previous texture stage alpha
UBYTE colorScale;
The color scale factor. One of the following values:
GW_TEX_SCALE_1X
Multiply the tex op result by 1
GW_TEX_SCALE_2X
Multiply the tex op result by 2
GW_TEX_SCALE_4X
Multiply the tex op result by 4
UBYTE alphaOp;
The alpha texture operation. One of the following values:
GW_TEX_LEAVE
Use the source pixel value
GW_TEX_REPLACE
Use the texture pixel value
GW_TEX_MODULATE
Multiply the source with the texture
GW_TEX_ADD
Add the source and texture
GW_TEX_ADD_SIGNED
Add the source and texture with an 0.5 subtraction
GW_TEX_SUBTRACT
Subtract the source from the texture
GW_TEX_ADD_SMOOTH
Add the source and the texture then subtract their product
GW_TEX_ALPHA_BLEND
Alpha blend the texture with the source
GW_TEX_PREMULT_ALPHA_BLEND
Alpha blend the source with a premultiplied alpha
UBYTE alphaAlphaSource;
The alpha blend alpha source. One of the following values:
GW_TEX_ZERO
Use no alpha value
GW_TEX_SOURCE
Use the source alpha
GW_TEX_TEXTURE
Use the texture alpha
GW_TEX_CONSTANT
Use a constant BGRA color as an alpha
GW_TEX_PREVIOUS
Use the previous texture stage alpha
UBYTE alphaScale;
The alpha scale factor. One of the following values:
GW_TEX_SCALE_1X
Multiply the tex op result by 1
GW_TEX_SCALE_2X
Multiply the tex op result by 2
GW_TEX_SCALE_4X
Multiply the tex op result by 4
Methods:
public:
Prototype:
TextureInfo();
Remarks:
Constructor. The data members are initialized as follows:
useTex = 1;
faceMap = 0;
textHandle = 0;
uvwSource = UVSOURCE_MESH;
mapChannel = 1;
tiling[0] = tiling[1] = tiling[2] = GW_TEX_REPEAT;
colorOp = GW_TEX_MODULATE;
colorAlphaSource = GW_TEX_TEXTURE;
colorScale = GW_TEX_SCALE_1X;
alphaOp = GW_TEX_LEAVE;
alphaAlphaSource = GW_TEX_TEXTURE;
alphaScale = GW_TEX_SCALE_1X;
Prototype:
~TextureInfo();
Remarks:
Destructor.