Article View: rec.games.programmer
Article #1419Need hard core help doing some 3d optimizations
From: Brian K. W. Hook
Date: Fri, 12 Apr 1991 00:07
Date: Fri, 12 Apr 1991 00:07
36 lines
1555 bytes
1555 bytes
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
Technical Details
Message-ID:
<27979@uflorida.cis.ufl.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!rex!uflorida!reef.cis.ufl.edu!jdbShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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