[ODE] Help using ODE with DirectX
Jon Watte
hplus-ode at mindcontrol.org
Wed Aug 25 08:59:11 MST 2004
1) define a struct that matches the FVF; something like:
struct DXVertex {
float x, y, z;
float u, v;
};
2) Lock() the vertex buffer
3) cast the void* from the vertex buffer to your DXVertex struct
4) Define a vertex format to use for ODE; typically:
struct ODEVertex {
float x, y, z;
};
5) new[] or malloc() a big enough array of these vertices, and make sure that this array won't ever go away (because ODE doesn't copy the data)
6) copy the x, y, z bits of each vertex to the destination:
for( int i = 0; i < numVertices; ++i ) {
ode[i].x = dx[i].x;
ode[i].y = dx[i].y;
ode[i].z = dx[i].z;
}
7) Unlock the DX vertex buffer
8) Do the same thing for the index buffer, except there you're probably converting from WORD (DX format index) to int (ODE format index).
9) You're done.
Now, it seems to me that any programmer ought to be able to figure this out, as it's very basic data structure manipulation, so maybe you actually meant to ask some other question?
Cheers,
/ h+
-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf Of
Duncan Frostick
Sent: Tuesday, August 24, 2004 4:18 PM
To: ode at q12.org
Subject: [ODE] Help using ODE with DirectX
Hi all, I'm trying to take meshes in directx format and add them to ODE
as trimeshes. The winding order has to be reversed, but that's trivial,
I'm having trouble copying the data in the vertex and index buffers of
the direct3d mesh and placing them into an ODE trimesh. To avoid a
lengthy explaination of my code and pointlessly complex question - my
question is simple, how did you transfer the vertex and index
information which is in direct3d FVF format from the mesh and into ODE?
I'm hoping there's someone on this list that has used DirectX and ODE
together before!
Cheers, Duncan
P.s. I had a look at Si Browns buggy test code as advised by the wiki,
but I couldn't see anything that would help me - I'm really bad at
interpreting other peoples software designs, especially when learning
this all for new.
_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode
More information about the ODE
mailing list