Sign in to follow this  
VytsL

vertex formats

Recommended Posts

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

Share this post


Link to post
Share on other sites
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!
};


Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this