www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/21/05:32:38

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Rotation in allegro
Date: Fri, 19 Sep 1997 20:58:19 +0100
Organization: None
Distribution: world
Message-ID: <nIjKWLBbltI0Ewde@talula.demon.co.uk>
References: <34228b2c DOT 0 AT 139 DOT 134 DOT 5 DOT 33>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 37
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019