Original Post
How does one go about filling this structure in to create a mesh?
Quote:
Original post by Trip99
Are you using the D3DX mesh? If so you can use the clone op
D3DVERTEXELEMENT9 { WORD Stream; // This is the stream this element resides in WORD Offset; // Offset from the beginning of the vertex data. Get this by adding up the size of the types defined before this element. BYTE Type; // The data type (ie D3DDECLTYPE_FLOAT3) BYTE Method; // Use D3DDECLMETHOD_DEFAULT here BYTE Usage; // Defines what the data will be used for (this is the semantic in your shader - ie D3DDECLUSAGE_POSITION) BYTE UsageIndex; // Modifies the usage data to allow the user to specify multiple usage types.}D3DVERTEXELEMENT9 simple_decl[] ={ {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0}, {0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, D3DDECL_END() // this macro is needed as the last item!};// d3dDevice is your LPDIRECT3DDEVICE9// simpleDecl is the array of D3DVERTEXELEMENT9s we defined aboveIDirect3DVertexDeclaration9* myVertexDecl;d3dDevice->CreateVertexDeclaration(simple_decl, &myVertexDecl);// d3dDevice is your LPDIRECT3DDEVICE9// myVertexDecl is the LPDIRECT3DVERTEXDECLARATION9 that we defined aboved3dDevice->SetVertexDeclaration( myVertexDecl );// You are now ready to go!// Set all your stream sources, and DrawIndexedPrimitive()Quote:
Original post by Alex Swinney
How does one go about filling this structure in to create a mesh?
Quote:
Original post by Namethatnobodyelsetook Quote:
Original post by Alex Swinney
How does one go about filling this structure in to create a mesh?
You don't create a mesh out of D3DVERTEXELEMENT9s, it just describes the contents of the VB (or in the case of streams, all the VBs).
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more