From: Vic Newsgroups: comp.os.msdos.djgpp Subject: ANOUNCE: clipping tutorial+code Date: Sat, 12 Jul 1997 21:30:11 -0400 Organization: Communications Accesibles Montreal Lines: 31 Message-ID: <33C82FA3.121E@cam.org> Reply-To: tudor AT cam DOT org NNTP-Posting-Host: dynppp-85.hip.cam.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk There was a discussion on rec.games.programming about 3D basic tutorials.It seems there is a lack of info about clipping so I wrote one. It targets newbies in 3D coding that want to learn to do the clipping stuff. The code is fully functional, in C (no ASM). it's at http://www.cam.org/~tudor/cliptut.zip Some speed related stuff: the function that gets the equation of a plane: GCC full optimisations: around 800 000-900 000 per second. GCC pentium optimisations: around 1 000 000 per second. (I know this function is not used in the actual clipping code but it might be useful in, let's say, a Z buffering system) the function that gets the intersection of a line with a plane: GCC full optimisations: around 500 000 per second. GCC pentium optimisations: around 600 000 per second. the function that clips a poly with a plane (triangle): GCC full optimisations: around 130 000-140 000 per second. GCC pentium optimisations: the same. Of course the number of those done per second decreases with the number of points in your poly... for 6 it gets down to 60 000-70 000 the function that clips a poly to the frustum (triangle): GCC full optimisations: around 25 000-30 000 per second. GCC pentium optimisations: the same. what do you think? How fast are they? Any ways to optimise it further? (while keeping it in C only) TIA, Vic.