Advertisement

Vertex Class Design Considerations

Started by June 24, 2004 08:27 PM
2 comments, last by _DarkWIng_ 20 years, 5 months ago
While revising my vertex/polygon classes, I came across this certain design consideration. When storing normals and texture coordinates, should I store these in the polygon structure or the vertex structure? Polygons access vertices through vertex indices. If I put the information in the vertex structure, then I will have to duplicate vertices on edges and all that. If I put the information in the polygon structure, then I will have to pass more parameters to some of my functions? What do you think?
- fyhuang [ site ]
ideally you should be rendering using vertex arrays (vertex buffer object extension on top of that).. in this case you must put everything in the vertex structure, and all vertices must be in a continuous block of memory.
Advertisement
I'm not worrying about the rendering yet -- I'm using vertex arrays for that, but I am doing the vertex class for things such as BSP trees and all that. Say you had a 90 degree wall:

    |    |    |______NORMALS:    |   -|    |______       |


If I put the normals in the vertices, for flat shading I would have to have two identical vertices (with different normals) at the corner.
- fyhuang [ site ]
If you want to use VA/VBO you'll have to put them in vertices (and duplicate them if needed). No point in fighting that :).
You should never let your fears become the boundaries of your dreams.

This topic is closed to new replies.

Advertisement