How to use Index vertex Blending in DX9?

Started by
3 comments, last by keroz 20 years, 3 months ago
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.
Advertisement
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]
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)
I try to change it and it run correct. Thank you very much.
Actually, D3DXVECTOR3 is 3 floats

This topic is closed to new replies.

Advertisement