|
Mac OS 9
|
#include <RAVE.h>
Data Fields | |
| float | x |
| float | y |
| float | z |
| float | invW |
| float | r |
| float | g |
| float | b |
| float | a |
| float | uOverW |
| float | vOverW |
| float | kd_r |
| float | kd_g |
| float | kd_b |
| float | ks_r |
| float | ks_g |
| float | ks_b |
TQAVTexture is used for texture mapping. The texture mapping operation is controlled by the kQATag_TextureOp variable, which is a mask of kQATextureOp_None/Modulate/Highlight/Decal. Below is pseudo-code for the texture shading operation:
texPix = TextureLookup (uq/q, vq/q);
if (kQATextureOp_Decal)
{
texPix.r = texPix.a * texPix.r + (1 - texPix.a) * r;
texPix.g = texPix.a * texPix.g + (1 - texPix.a) * g;
texPix.b = texPix.a * texPix.b + (1 - texPix.a) * b;
texPix.a = a;
}
else
{
texPix.a = texPix.a * a;
}
if (kQATextureOp_Modulate)
{
texPix.r *= kd_r; // Clamped to prevent overflow
texPix.g *= kd_g; // Clamped to prevent overflow
texPix.b *= kd_b; // Clamped to prevent overflow
}
if (kQATextureOp_Highlight)
{
texPix.r += ks_r; // Clamped to prevent overflow
texPix.g += ks_g; // Clamped to prevent overflow
texPix.b += ks_b; // Clamped to prevent overflow
}
After computation of texPix, transparency blending (as shown above for TQAVGouraud) is performed.