Microsoft DirectX 8.0 (C++)

Setting Vertex Declaration

To use vector tweening, you must first set up a custom vertex type that uses a second normal or a second position. The following code example shows a sample declaration that includes both a second point and a second position.

struct TEX_VERTEX
{
    D3DVECTOR position;
    D3DVECTOR normal;
    D3DVECTOR position2;
    D3DVECTOR normal2;
};

//Create a vertex buffer with the type TEX_VERTEX.

The next step is to set the current declaration. The code example below shows how to do this.

DWORD decl[]
{
    D3DVSD_STREAM(0),
    D3DVSD_REG( D3DVSDE_POSITION, D3DVSDT_FLOAT3 ) // Position 1
    D3DVSD_REG( D3DVSDE_NORMAL, D3DVSDT_FLOAT3 )   // Normal 1
    D3DVSD_REG( D3DVSDE_POSITION2, D3DVSDT_FLOAT3) // Position 2
    D3DVSD_REG( D3DVSDE_NORMAL2, D3DVSDT_FLOAT3 )  // Normal 2
    D3DVSD_END()
};

For more information on creating a custom vertex type and a vertex buffer, see Creating a Vertex Buffer.

For more information on creating a vertex shader declaration, see Vertex Shader Declaration.

Notes  When vertex tweening is enabled, a second position or a second normal must be present in the current declaration.