Mail Archives: djgpp/1997/09/21/05:32:38
Herman Schoenfeld writes:
> Can you give me a quick example on how you think a vertex/face/world
>structure should be. I've seen many in your examples and dont really know an
>optimum choice.
This topic is really more appropriate for a forum like
comp.graphics.algorithms, but what the hell...
How best to structure things obviously depends on the details of your
engine (techniques like BSP trees require special formats to be use),
but a typical layout might go something like:
world:
Contains a list of objects. Each object has a position and
orientation. The orientation could be stored as a set of three
axis rotations, but in a full 3 degrees of freedom environment
it is usually easier to store unit vectors facing in front and
up from the object, since that prevents gimbal artifacts as you
rotate it...
object:
Contains a list of polygons, and a list of the vertices that
they use. The vertices will be in the local coordinate system of
the object, with zero at the centre of the object, and one of
the axis facing in front of it. You could store a seperate set
of vertices for each polygon, but since in many situations you
will find a single vertex being shared between multiple polys,
it can be more efficient to use a single list of all the
vertices used by the object. In that case, the polygon structure
can refer to vertices using an index into this array...
Hope that helps!
--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.
- Raw text -