PDA

Click to See Complete Forum and Search --> : Loading 3ds files into DirectX 8 as mesh


SapphireGreen
Apr 7th, 2002, 06:31 AM
The main questing here is, how?

I can load .X (DirectX's native file), but I need to load 3DS, for greater processing speed. Also, a pointer to somewhere to learn to code my own mesh format would be very helpful. I can't find a tutorial anywhere on the net, it's all for C++.

And don't give the url for www.vbexplorer.com/directx4vb, as vbexplorer has run out of money, and has been disconnected, which means all sites it hosted (including directx4vb) are now down.

However, Jack Hoxely's tutorials (the guy at directx4vb) on www.gamedev.net are a seperate thing, and you can learn your DX there.

But for now, I need something slightly more complex.

Thanks.

Zaei
Apr 7th, 2002, 09:41 AM
Use the convs3ds program that is included with the SDK to convert your meshes over to the .x format. If you want to load straight from a 3ds format, you can try looking over on www.wotsit.org for athe file format description, or you can learn to read C++, and find a tutorial somewhere.

As to creating your own file format, it is very simple. Simply decide on a file format to follow, and do it. For instance, I use a format that follows this format:

typeID
numVertices
numIndices
numFaces
[vertices[0]..[numVertices-1]]
[indices[0]..[numIndices-1]]
Material

I simply parse whatever model format I convert from (ASE), and write in that format. On load, I just fill a vertex buffer and an index buffer, and draw as an indexed triangle list.

Z.

SapphireGreen
Apr 8th, 2002, 05:02 AM
INFORMATION OVERLOAD!


I now know that the listing of vertices is in chunk 0x4100. That's great. How do I write the list of vertices into an array (assuming I know the number of vertices, which has to be read from elsewhere).

In fact, how do I read chunks?

Zaei
Apr 8th, 2002, 08:08 AM
Binary file mode, using the Get method.

Z.

SapphireGreen
Apr 9th, 2002, 07:26 AM
:) - I figured that much. But what I'm really asking, is what does 0x4100 translate to in numbers. Is it binary? Oct? Not Hex I think.

SapphireGreen
Apr 10th, 2002, 06:48 AM
ttt - I really need some help here.

Zaei
Apr 10th, 2002, 08:14 AM
A 0x prefix means its a hexidecimal number. You dont have to translate it at all. C++ will store 0x4100 correctly, and VB will store &h4100 correctly.

Z.

SapphireGreen
Apr 12th, 2002, 02:46 AM
Thanks. Now I can load pot-plants and trees and stuff instead of cubes. :)