So I'm slowly writing a software renderer, and I'm currently implementing a file reader. I don't care what format I use, so long as it's simple enough that I can load vertex (and eventually texture) data.
So I've decided on .obj for the time being, because it seems simple. When I look at the file, I see something like:
So from what I can tell, the v's are obviously the vertex's, and the f's are the faces of the cube. I guess that would be fine, but I've written my engine so far with a poly object that has state/attribute data to eventually implement culling, or specify solid polys or whatever.
If I'm going to use a poly object, do I need to write some code to parse faces into polygons? If this is the case, how do I determine what coordinates belong to which polygon? In the case of the first face, is v1,2,3 from the first poly, and v2,3,4 in the second? I believe verticies are written in clockwise order in OBJ files?
I guess I'm just confused. I could try to use a vertex based render list instead of a polygon based list (please excuse my obvious ignorance, I'm learning as I go), but then I wouldn't know if a polygon was culled or clipped or whatever.
So I'm guessing I just need to interpolate the polygons from the face and vertex data?
THANKS!
So I've decided on .obj for the time being, because it seems simple. When I look at the file, I see something like:
Code:
# Blender3D v249 OBJ File: cube.blend
# [url]www.blender3d.org[/url]
mtllib cube.mtl
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -1.000000
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
usemtl Material
s off
f 1 2 3 4
f 5 8 7 6
f 1 5 6 2
f 2 6 7 3
f 3 7 8 4
f 5 1 4 8
So from what I can tell, the v's are obviously the vertex's, and the f's are the faces of the cube. I guess that would be fine, but I've written my engine so far with a poly object that has state/attribute data to eventually implement culling, or specify solid polys or whatever.
If I'm going to use a poly object, do I need to write some code to parse faces into polygons? If this is the case, how do I determine what coordinates belong to which polygon? In the case of the first face, is v1,2,3 from the first poly, and v2,3,4 in the second? I believe verticies are written in clockwise order in OBJ files?
I guess I'm just confused. I could try to use a vertex based render list instead of a polygon based list (please excuse my obvious ignorance, I'm learning as I go), but then I wouldn't know if a polygon was culled or clipped or whatever.
So I'm guessing I just need to interpolate the polygons from the face and vertex data?
THANKS!