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 / Extracting terrain information

Author
Message
Jizzah
19
Years of Service
User Offline
Joined: 9th Dec 2004
Location:
Posted: 16th Dec 2004 16:32
How would one go about extracting the mesh information for the terrain that is created using a height map and a call to one of the dbTerrain functions. I want to place this information into a physics engine, but do not know how to extract this information. I do not see a function to iterate through the vertex or index arrays that make up the terrain.

Someone mentioned using a "memblock" to retrieve this information unfortunetly the memblock is not defined in the SDK. I know its a set of BYTES but there is no 'struct' defining what the different type of memblocks are. Basically I'm going to have a vehicle on this terrain. I know there is terrain collision going on, as the camera doesn't go beneath the terrain when you move it around, but the models I place on the terrain don't fit well. I might have to turn on some collision information for the models (still figuring out the SDK) but I don't know if I have to define my own AABB or if the program supplies one for the model itself. I actually have gotten real far in my 'hobby' project and I must say it wouldn't have gone this fast with any other "SDK" I have used.

Just a general nudge in the right direction would be sufficient I do not requre code example. So either a general usage for implementing vehicle physics using the code in the engine, or how to extract the polys to use an "outside" engine. Plus I like finding out how to code it as you learn a lot just banging around As usual, TIA for any help!
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 18th Dec 2004 05:45
I don't have Dark SDK so I don't know what commands are included. But in DBP if the terrain is under 21845 polys it would be to make mesh from object, make memblock from mesh, and then extract the data depending on the terrains FVF format. The first dword is it's format. The second DWORD is it's number of verts, the third DWORD is the size of each vertex in bytes, and the rest of the information will depend on the format.

If the terrain is over 21844 polys you will want to use something like this as DBP's make mesh from object command is bugged and DBP will crash over this number of polys:
`do this for every limb of the terrain
make object from limb
convert object fvf to 2 `this will get rid of all unneeded data but the vertex positions
make mesh from object
delete object made from limb
make memblock from mesh
delete mesh
`now you can access the vertex data needed for collision/physics
`The first dword is it's format. The second DWORD is it's number of verts, the third DWORD is the size of each vertex in bytes, and the from position 12 until the last position of the memblock will follow this pattern:
memblock float #,12 = vert x pos
memblock float #,16 = vert y pos
memblock float #,20 = vert z pos
memblock float #,24 = vert x pos
memblock float #,28 = vert y pos
memblock float #,32 = vert z pos
over and over until the last position in the memblock.

I have no idea how much of this will pertain to Dark SDK but I hope it may help some.

Jizzah
19
Years of Service
User Offline
Joined: 9th Dec 2004
Location:
Posted: 18th Dec 2004 08:14
Lost in Thought: Awesome! That was just the "nudge" and lot more, I was looking for. Thanks I'll go ahead and look into that!

Login to post a reply

Server time is: 2024-04-25 13:59:59
Your offset time is: 2024-04-25 13:59:59