Jump to content
  • Advertisement
Sign in to follow this  
Duncanf

FVF and deal with different ones

This topic is 5397 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I'm trying to use directx and a physics engine (ODE) together but I'm having lots of trouble converting DirectX meshes (like those created by calls to D3DXCreateText) to a format that ODE can understand (array of ints for indices and 2d array of floats for vertices). I think the reason for it is that I'm not dealing with different FVFs from different meshes and therefore when I'm reading vertex information from the mesh buffer and passing it into other data structs I'm just assuming an FVF without knowing what it is, so the stride isn't exactly right as I traverse the array, so the integrity of the mesh goes right out the window. My question is, with FVF being so annoyingly (but usefully) flexible, whats the best way to find out what the FVF of a mesh is and create a struct of the appropriate size accordingly so it can be use in an array to get the vertex information? I tried cloning the mesh to a simple XYZ FVF, but that strangely hasn't helped. Also, does anyone know what the FVF of meshes created by D3DXCreate... is? If anyone has any experience using DirectX with ODE then I'd love to hear from you. Cheers for any help, Duncan

Share this post


Link to post
Share on other sites
Advertisement
Call the meshes 'GetFVF()' function which will return you a DWORD. Then simply check which bits are set to determine the format. For example if you want to check if the format for a mesh pointed to by pMesh includes XYZ data do the following:

bool XYZ_data_present = false;
DWORD FVF = pMesh->GetFVF();

if(FVF & D3DFVF_XYZ)
{
XYZ_data_present = true;
}

For a full list of the FVF bit flags check the DirectX documentation

Share this post


Link to post
Share on other sites
I've done some experiment with ODE & D3D9 and it works fine. I can send you project but i don't know how much it will help you - havent used dxmesh - just simple hardcoded boxes - it's just 10-20 boxes falling over each other...on top of big static box :)(simple code, no render optimisations - just a try on ODE). it was my first try with ODE... than i moved to Newton Game Dynamics ;)....

Share this post


Link to post
Share on other sites
Well I'd be really interested in having a look if you've handled representing the boxes as meshes in DirectX, then converting those meshes into an ODE format? Or did you just create a box in ODE using one of the utility functions without having to convert the DirectX vertex and index information to the ODE trimesh format?

Cheers for the help Motorherp, I was kinda hoping someone knew an easier way than hand checking each property, but oh well that'll eat up a few lines of code!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!