Xref: utzoo rec.games.programmer:3392 comp.os.msdos.programmer:4596 comp.graphics:17191 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!caen!kuhub.cc.ukans.edu!2fmlcalls From: 2fmlcalls@kuhub.cc.ukans.edu Newsgroups: rec.games.programmer,comp.os.msdos.programmer,comp.graphics Subject: Re: Need hard core help doing some 3d optimizations Message-ID: <1991Apr11.202429.29648@kuhub.cc.ukans.edu> Date: 12 Apr 91 01:24:29 GMT References: <27979@uflorida.cis.ufl.EDU> Organization: University of Kansas Academic Computing Services Lines: 28 > 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. snip > float xa, ya, za; snip > 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 I don't fully follow C, but I know float. Go with scaled integers or longs and use integer division. As well, use scaled integers for your sin/co look=up tables (i.e. sin(45 degrees) = 707 rather than 0.707). When you are through multiplying, do a div 1000 (or C equivalent of integer division). General optimizations - use fewer points. If you get creative you may find you can represent your planes/tanks/whatnots with less points (and thus fewer lines to draw as well). john calhoun