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 / Retrieve directX mesh from object? ID3DXMesh*

Author
Message
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 5th Oct 2009 01:31
Is there a sequence of commands that can give me direct access to an objects mesh in this form (ID3DXMesh*)?

I ask as I have a couple of functions which will take a directX mesh and create a physX actor out of it and so hopefully making it relatively simple to recreate my world in PhysX.


Another way of doing it is to use D3DXLoadMeshFromX(), but this would mean I load my object X-File twice, once with DarkGDK to create my object and then again with that command, also I can't actually get that to work at the moment, it keeps failing but that maybe in another help thread soon lol.

Thanks in advance.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 5th Oct 2009 04:20
DarkGDK doesnt use the ID3DXMesh abstraction at all. All of its object data is used and manipulated in the .DBO format. GDK parses the X file when you call dbLoadObject(), but it does so by parsing the file directly into DBO format, it doesnt use directX meshes in any way that we can have access to. Internally it may load an X file into a LPD3DXMESH then transfer the data over into the DBO structure(I believe it doesnt though, but I dont know for certain, the DBO structure has no directX mesh interfaces that are part of it)

Using the command dbGetObject(or more accurately, the pointer returned from that command) you can access the internal structure of the object, including its vertex and index information, and using that you could pass it to your PhysX world if you need an exact duplicate of the mesh. Usually though, most physics interaction is done using collision boxes or spheres or capsules, but rarely detauiled meshes. If you are planning to pass something like a character mesh to the physics world, it may be an idea to reduce it's polycount first as far as you can(if you are using DX meshes, look at using some D3DX mesh decimation commands)... (I use a similar method in my own engine but with ODE rather than physx)

If it ain't broke.... DONT FIX IT !!!
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 5th Oct 2009 12:52
Thanks Mista Wilson,
I guess I will try to change the functions I have so they take a DBO instead of a DirectX mesh, this is probably slightly beyond me at the moment but I am sure I will figure it out with some research.

I am using triangle meshes purly for terrain, I plan on using simple shapes and boxes for my models etc..


A simpler but crude solution would be to use:


But it keeps failing(D3DERR_INVALIDCALL), anyone know what else I need to do to load a directX mesh using the above function?
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 5th Oct 2009 13:29
I guess you could just copy the data from the DBO, its has vertex/index buffers that you can access, it shouldnt really be too much different from copying the data from a directx mesh. Just have to take into account the DBO format and how it stores thinsg is all.... You can have a look at DBOData.h for the structure of the format and what it contains etc.

If it ain't broke.... DONT FIX IT !!!
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 5th Oct 2009 21:49
An object's data is stored in the sObject structure.

Login to post a reply

Server time is: 2024-11-20 13:17:46
Your offset time is: 2024-11-20 13:17:46