www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/04/18:11:21

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ALLEGRO: get_camera_matrix normals
Date: Fri, 4 Apr 1997 20:18:47 +0100
Organization: None
Distribution: world
Message-ID: <N7Jw5FAXQVRzEwun@talula.demon.co.uk>
References: <19970402010432 DOT AAA7397 AT hometown>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 39
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Jeff Bachtel writes:
>In the docs for 'get_camera_matrix' it mentions that xup, yup, and 
>zup need not be normal, does this also mean that they can be used as 
>a point the camera is 'looking' at? 

Absolutely. Although they are a vector rather than a point, so if you
want to specify the orientation by a point which is somewhere above the
camera, you'll have to subtract the camera position from the point to
convert it into a directional vector.

The only important thing is that the up vector should be non zero, and
different to the in-front vector. Between them the camera position and
front vector only leave one degree of freedom which the camera could be
rotated around, so the up vector is only required to resolve this one
angle, rather then being treated as a full 3d vector. This means that it
can be any length, and doesn't need to be at right angles to the front
vector.

>Also, what is the performance hit 
>on using floats for everything (in 3d) on a Pentium. I heard that in 
>most cases it was actually faster than fixed, is this true?

It can vary. Integers are usually quite a bit better for addition and
comparison, but floating point division and multiplication is often
faster. In particular, the pentium integer unit can execute in parallel
with floating point calculations, which is very useful for things like
perspective correct texture mapping, as you can start up a divide
calculation and then go on to do other integer calculations while the
fpu is thinking, essentially getting the divide for free.

Although it's worth bearing in mind that pentium floating point
optimisation is one of gcc's weakest areas. In my experience it does
very well with integer code, but I've seen it output some really dumb
bits of fpu code...


--
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