Xref: utzoo rec.games.programmer:3389 comp.os.msdos.programmer:4591 comp.graphics:17182 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!rex!uflorida!reef.cis.ufl.edu!jdb From: jdb@reef.cis.ufl.edu (Brian K. W. Hook) Newsgroups: rec.games.programmer,comp.os.msdos.programmer,comp.graphics Subject: Need hard core help doing some 3d optimizations Message-ID: <27979@uflorida.cis.ufl.EDU> Date: 12 Apr 91 00:07:59 GMT Sender: news@uflorida.cis.ufl.EDU Organization: UF CIS Dept. Lines: 36 I just ran Turbo Profiler on some code of mine, and it looks like roughly 90% of my CPU time is being shoved into one function. Any help on the optimizations would be really appreciated. E-mail would be preferred, however posts are fine too. void Calc3D ( int WorldX, int WorldY, int WorldZ, int MX, int MY, int MZ, int *DisplayX, int *DisplayY) { float xa, ya, za; WorldX=-WorldX; xa=_yawCosFactor*WorldX-_yawSinFactor*WorldZ; za=_yawSinFactor*WorldX+_yawCosFactor*WorldZ; WorldX=_rollCosFactor*xa+_rollSinFactor*WY; ya=_rollCosFactor*WorldY-_rollSinFactor*xa; WorldZ=_pitchCosFactor*za-_pitchSinFactor*ya; WorldY=_pitchSinFactor*za+_pitchCosFactor*ya; WorldX+=MX; WorldY+=MY; WorldZ+=MZ; *DisplayX=AngPerspFactor*WorldX/WorldZ; *DisplayY=AngPerspFactor*WorldY/WorldZ; } AngPerspFactor is a float, as are the assorted factors. I have already used a COS and SIN lookup table in another part of the module to expedite things, but this is really slowing things down considerably. Any help is appreciated. Brian