delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/02/13:18:56

From: ellman AT xs4all DOT nl ()
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ALLEGRO: get_camera_matrix normals
Date: 2 Apr 1997 12:18:45 GMT
Organization: XS4ALL
Message-ID: <5htir5$mkp$1@news0.xs4all.nl>
References: <199704020136 DOT LAA01617 AT solwarra DOT gbrmpa DOT gov DOT au>
NNTP-Posting-Host: xs1.xs4all.nl
Lines: 55
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <199704020136 DOT LAA01617 AT solwarra DOT gbrmpa DOT gov DOT au>,
Leath Muller <leathm AT solwarra DOT gbrmpa DOT gov DOT au> wrote:
>> 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?

xfront, yfront, zfront isthe direction the camera is looking.
xup, yup, and zup just tell you which way the top of the screen is relative
to world-space.

I have found that most of the time, if you don't want any tilting, you can
leave the 'up' vector unchanged, but be careful not to point the camera in
the same direction as the 'up' vector, or you could end up crashing with an
FPE. To avoid this, and get a more realistic camera effect, when rotating
the camera around any axis that isn't (0,1,0), use the same matrix that you
used to rotate the 'front' vector to rotate the 'up' vector. The up vector
will remain perpendicular to the front fector.

I figured this out whilst modifying Allegro's ex22.c so that you could view
the cubes from any angle.

>I don't know about Allegro, but everything else I have ever used (D3D, OpenGL,
>etc) wants the yup of the camera to be perpendicular of the forward projection
>vector (the cross product of the plane from the camera position (eye) to the
>viewing position)... Does Allegro have the equivalent of a gluLookAt() routine?

Some pseudocode for gluLookAt(point):
(all variables are vectors)

gluLookAt(point)
{
	front_vector = point - camera_position;
}

>> 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?
>
>Floats are usually faster on the pentium - check previous mail archives, this
>was a huge topic not long ago...

Now they tell me :(
Allegro uses lookup tables for the fixed math versions of functions like
cos, sin, tan, sqrt. Are the Pentium's floating point equivalents much slower?

In which cases are floats faster than fixed?

AE.

--
Andrei Ellman - URL: http://www.xs4all.nl/~ellman/ae-a - ae1 AT york DOT ac DOT uk
"All I wanna do is have some fun     :-)     || ae-a AT minster DOT york DOT ac DOT uk
 I've got the feeling I'm not the only one"  || mailto:ellman AT xs4all DOT nl
     -- Sheryl Crow      :-)    ||       It's what you make of it.

- Raw text -


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