Friday, February 8, 2008

This is what happens when I'm bored

Long story short, I made a very rough draft of a format for storing 3D mesh info. This is the data for a single cube:

vertices [
0 [-1.0,-1.0,1.0]
1 [-1.0,1.0,1.0]
2 [1.0,1.0,1.0]
3 [1.0,-1.0,1.0]
4 [-1.0,-1.0,-1.0]
5 [-1.0,1.0,-1.0]
6 [1.0,1.0,-1.0]
7 [1.0,-1.0,-1.0]
]
object [
worldPosition [0,0,0]
face 0 [0,1,2,3]
face 1 [3,2,6,7]
face 2 [4,0,3,7]
face 3 [2,1,5,6]
face 4 [7,6,5,4]
face 5 [4,5,1,0]
]

Next step: write a simple importer/exporter!
Admittedly, this won't be very useful, but it was a very good learning experience, at least so far.

2 comments:

Tonio said...

Pretty similar to the .obj format. You might like to check it out and render something that's close to an industry standard.

Danny L. said...

Yeah, I realized that after taking a closer look at .obj. But I have learned at least one thing about how Unity stores mesh info so far that I might not have realized otherwise. I figure it's good as a learning experience, plus I might be able to use it for loading meshes from the web or something.