vertex formats

Started by
1 comment, last by VytsL 19 years, 2 months ago
I need to pass additional information with my vertex to VS. Here is my FVF: static DWORD const FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEXCOORDSIZE3( 0 ); I am trying to use D3DFVF_TEXCOORDSIZE3( 0 ) to pass additional info. But in VS it looks like data I pass in (placement) is always == 0, 0, 0. : VSOutput GrassLod1VS( float3 pos : POSITION, float3 normal : NORMAL, float3 color : COLOR, float3 placement : TEXTURECOORD0 ) I am not familiar with VS debugging, but it looks I'll have to learn it :) If instead I try to use D3DFVF_XYZB5, I receive results which I don't understand at all. Please, help. I need solution not only how to add 3 floats to my vertex, but say how to add 10 floats. Thanks in advance :) P.S. I am not using PS in my HLSL Effect file, ie texturing goes thru fixed pipeline
Advertisement
If you are using DirectX9, you should upgrade to vertex declarations, instead of FVFs. Yes, they are more code, but they give you *much* more control over your vertex structure. You undoubtedly need this when writing your own Vertex/Pixel shaders (as opposed to using the FFP). Check out this topic.

Here is the D3DVERTEXELEMENT9 array you would use for your VS input:

D3DVERTEXELEMENT9 simple_decl[] ={  {0, 0,  D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},  {0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0},  {0, 24, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0},  {0, 36, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},  D3DDECL_END() // this macro is needed as the last item!};

Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Ok, but isn't this TEXCOORD equivalent to FVF TEXCOORD? Declaration is ok, but I want to understand how to pass custom data with vertex. For example, vs_1_1 isn't even compiling if I don't return TEXCOORD from it. Maybe that means, that TEXCOORD isn't supposed to be used in VS?

Anyway thanks for reply :)

This topic is closed to new replies.

Advertisement