Original Post
I need help on this one. I don't understand why I'm getting this error.
Vertex shader function usage (D3DDECLUSAGE_NORMAL,0) does not have corresponding usage in the current vertex declaration
This is my code:
in the vertex shader
declaratrion
the actual vertex
I'm actually using the normal field in order to pass a transform matrix through a vertex, but I don't see how that would cause an error. As you can see I have the normal declared everywhere and I'm still getting the error. Anyone know why?
Vertex shader function usage (D3DDECLUSAGE_NORMAL,0) does not have corresponding usage in the current vertex declaration
This is my code:
in the vertex shader
struct VS_INPUT
{
float3 position : POSITION;
float2 texture0 : TEXCOORD0;
float3 matRow1 : TEXCOORD1;
float3 matRow2 : TEXCOORD2;
float3 matRow3 : TEXCOORD3;
float3 matRow4 : TEXCOORD4;
float3 matCol4 : NORMAL;
};
declaratrion
D3DVERTEXELEMENT9 dummyElms[8] = {
{ 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, //position
{ 0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }, //tex coords
{ 0, 20, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 }, //column 4
{ 0, 32, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1 }, //1st row
{ 0, 44, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2 }, //2nd row
{ 0, 56, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 3 }, //3rd row
{ 0, 68, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 4 }, //4th row
D3DDECL_END()
};
the actual vertex
struct _vertex
{
D3DXVECTOR3 vertPos;
D3DXVECTOR2 texCoords;
D3DXVECTOR3 transformMatrixCol4; //this is the normal field
D3DXVECTOR3 transformMatrixRow1;
D3DXVECTOR3 transformMatrixRow2;
D3DXVECTOR3 transformMatrixRow3;
D3DXVECTOR3 transformMatrixRow4;
};
I'm actually using the normal field in order to pass a transform matrix through a vertex, but I don't see how that would cause an error. As you can see I have the normal declared everywhere and I'm still getting the error. Anyone know why?