In a graphics engine I’m working on, I have 2 types of geometry:
- indexed arrays modeled after opengl’s vertex arrays/vbo options
- an OO style where you can add faces/move vertices
Option 1 was very straightforward to implement, but it’s not the easiest to use because you have to manipulate raw primitives. This isn’t really a problem for geometry created in an 3d suite and it can render very quickly.
However, to make it easier to programmatically specify geometry I wanted to provide #2 in my engine, too. I’m stuck between 2 representations:
a. The geometry has a list of positions/normals/texcoords and each face can have indices into those lists
b. The geometry is a list of faces, which hold onto vectors for positions, normals and texcoords
I’m leaning towards style b but I wanted to get opinions, or be convinced that an OO representation of geometry is pointless