Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Accessing an objects vertex positions and indice positions

Author
Message
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 5th Dec 2007 01:58 Edited at: 5th Dec 2007 04:20
Ok, so yeah, I'm working on a physics library for the gdk. But one thing I need to know is how to access the data in IDirect3DVertexBuffer9 and IDirect3DIndexBuffer9. I'm asking here because I know a few people know how to do this. I've looked and so far the only way I have of accessing it is to make a pointer to a void object and get the data, but it still doesn't make much sense to me. So how would I do this? To give you more of an idea of what I'm doing, I'm trying to get an array filled with vertex data and index data.

Edit - I solved this. For those planning on adding physics or anything that needs index or vertex buffers, I'm adding it as part of my library(which I'll release a physics independent also). The vertex and index buffer will automaticlly be stored inside the object class I'm making(which is actually called dObjectNode).

Edit 2 - Ok, new problem. When working with the SObject struct, there is a pointer to a mesh list. Now, would I access the mesh lists draw buffer by just doing:


So would that be a viable way to get the vertex and index buffers of a mesh?

WC Physics - PhysX wrapper for Dark GDK.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Dec 2007 14:56
I believe so, yes, although you need to remember that a mesh does not necessarily correspond to a limb - you can have mesh-less limbs. ppFrameList does that, but you need to check that the frame contains a mesh.

I say 'believe so' because I've never accessed it that way myself - I use the pVertexData/pIndices and then set bVBRefreshRequired to true - all of these are held in the mesh structure.

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 5th Dec 2007 17:32 Edited at: 5th Dec 2007 18:22
Well, I just need the vertex and index buffer from the base frame. But by meshless limb, do you mean literally it has no visual data?

Edit - New question. Would you get the number of faces in a mesh by taking the number of vertices and dividing that by 3? I'm thinking thats how it would work...

WC Physics - PhysX wrapper for Dark GDK.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Dec 2007 18:23
Yes.



If you take a look at the comments in the sFrame structure you'll see that the mesh data is optional.

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 5th Dec 2007 19:20
Ok, thank you so much IanM. This helps a ton.

WC Physics - PhysX wrapper for Dark GDK.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Dec 2007 20:36
You edited your post and I almost missed your other question - If you take a look at the sMesh structure you'll see the number of faces is one of the values held there.

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code

Login to post a reply

Server time is: 2024-09-29 05:23:09
Your offset time is: 2024-09-29 05:23:09