delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/18/02:21:24

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Q for the 3D gurus
Date: Sun, 15 Jun 1997 17:41:55 +0100
Organization: None
Distribution: world
Message-ID: <$kgMtLATtBpzEwIH@talula.demon.co.uk>
References: <33A1C937 DOT 34DC AT cam DOT org>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 23
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Vic writes:
>So I guess the problem is in my function for setting the frustum (since 
>the actual poly clipper just calls the intersect functions on a bunch 
>of arrays)...
>does anyone know a good way of setting the frustum? Should I set it
>according to the resolution? Or to the variables set by set_viewport ?

The usual approach is to clip to the near plane, z=n (where n is set by
the programmer depending on how close objects can come to the camera
before they should be rejected), and to the four side planes x=z, y=z,
x=-z, and y=-z. You might also want to add a far clipping plane z=f, but
it's often more efficient just to do distance culling on a polygon basis
rather than bothering to clip for it...

The benefit of using fixed side planes is that most of the code in the
clip routine can be collapsed down to a few special cases: testing
intersections with x=z is a lot simpler and more efficient than
accepting any arbitrary 3d plane!


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