Microsoft DirectX 8.0 (Visual Basic)

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.

Private Type TEX_VERTEX
    Position As D3DVECTOR
    Normal As D3DVECTOR
    Position2 As D3DVECTOR
    Normal2 As D3DVECTOR
};

' 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.

Dim decl(5) As Long

decl(0) = D3DVSD_STREAM(0)
decl(1) = D3DVSD_REG( D3DVSDE_POSITION, D3DVSDT_FLOAT3 ) 'Position 1
decl(2) = D3DVSD_REG( D3DVSDE_NORMAL, D3DVSDT_FLOAT3 )   'Normal 1
decl(3) = D3DVSD_REG( D3DVSDE_POSITION2, D3DVSDT_FLOAT3) 'Position 2
decl(4) = D3DVSD_REG( D3DVSDE_NORMAL2, D3DVSDT_FLOAT3 )  'Normal 2
decl(5) = 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.