Archived

This topic is now archived and is closed to further replies.

keroz

How to use Index vertex Blending in DX9?

Recommended Posts

I define for FVF #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZB4|D3DFVF_LASTBETA_UBYTE4 | D3DFVF_NORMAL); struct VERTEX { float x,y,z; float weight; DWORD Indices; float normal[3]; }; and set renderstate for index vertexblend g_pd3dDevice->SetRenderState( D3DRS_INDEXEDVERTEXBLENDENABLE, TRUE ); g_pd3dDevice->SetRenderState( D3DRS_VERTEXBLEND, D3DVBF_3WEIGHTS ); Load mesh and weight form .x file In render() I use g_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld ); g_pd3dDevice->SetTransform( D3DTS_WORLD1, &matWorld1 ); g_pd3dDevice->SetTransform( D3DTS_WORLD2, &matWorld2 ); DrawSubset(0); but result don''t effect for D3DTS_WORLD1 and D3DTS_WORLD2 Why? and how to use Index vertex blend in DirectX9 ? Help me please.

Share this post


Link to post
Share on other sites
Your vertex needs 3 blending weights. Try changing it to this:

struct VERTEX
{
float x,y,z;
float weight[3];
DWORD Indices;
D3DXVECTOR3 normal;
};


Edit: corrected the type of normal.


[edited by - jacklin on January 7, 2004 3:10:01 PM]

[edited by - jacklin on January 7, 2004 3:11:15 PM]

Share this post


Link to post
Share on other sites
actually, you need 3 floats for the normal too!

I''m not sure if you have the order correct, but that does matter (regardless of the order that you OR them, cause that doesn''t matter)

Share this post


Link to post
Share on other sites