Multiple Texture Coordinates in D3D7
I am trying to do lightmapping in my program. So here is my vertex
structure:
typedef struct _SK_VERTEX
{
float x, y, z; // Position
float tu, tv; // Texture Coord
float lu, lv; // Lightmap Coord
}
Here is my vertex format (I''ve tried both, same results)
#define SK_VERTEXFORMAT ( D3DFVF_XYZ / D3DFVF_TEX2 )
- or -
#define SK_VERTEXFORMAT ( D3DFVF_XYZ / D3DFVF_TEX2 / D3DFVF_TEXCOORDSIZE2(0)
/ D3DFVF_TEXCOORDSIZE2(1) )
And my texture portion of the rendering:
pDevice->SetTexture( 0, p->Texture );
if ( p->Lightmap )
{
pDevice->SetTexture( 1, p->Lightmap );
pDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_MODULATE );
}
The problem is that the lightmap appears to be using the normal Texture
coordinates as well. For example. if my texture is scaled down (coords of
0.0 to 8.0), then the lightmap is also scaled (and duplicated).
So whats wrong is there something else I have to tell D3D to do
Single-Pass Texture Blending?
Thanks
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement