Article View: rec.games.programmer
Article #1919Re: Plotting Pixels
From: Geoffrey M Silverton
Date: Sun, 10 Jan 1993 19:01
Date: Sun, 10 Jan 1993 19:01
34 lines
2023 bytes
2023 bytes
In article <725904224.0@njackn.fidonet.org>, Jacob.Hartog@f99.n121.z1.fidonet.org (Jacob Hartog) writes:
> I'm writing a wolf-3d/Ultima Underworld type game and have encountered
> something of a stumbling block. My algorithms for stretching the bitmaps and
> those for finding where the images should be stretched, work fast enough,
> butthe time necessary to plot pixels to my virtual screen alone takes too much
> time for the game to work. Any suggestions?
You should be able to draw the wall pixels quickly (no multiplies in the
inner loop). The way I did it was with a video memory pointer (v) and
a bitmap vertical position done in fixed point (16 bits integer, 16 bits
fraction).
n16VPos (fixed point) is the vertical bitmap position and n16VStep (fixed
point) is the vertical bitmap step (bitmap pixels per video pixel). Log2Width
is the power of two of the width of my bitmap. BitmapHPos is the horizontal
position in the bitmap. My inner loop looks something like this:
for (number of screen pixels...)
{
*v = *(Bitmap + BitmapHPos + ((n16VPos>>16)<<Log2Width)); // copy to screen
v += VideoScreenWidth; // down on screen
n16VPos += n16VStep; // down in bitmap
}
I couldn't think of a way of doing the ceilings and floors without two
divides in the inner loop. Isn't too slow on my '386 though.
*** Just out of curiosity, how many people on rec.games.programmer are writing
Wolf3D-type games?
Geoff
(geoffs@engin.umich.edu)
Technical Details
Message-ID:
<W2f=Jv-@engin.umich.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!caen!geoffsReferences:
<725904224.0@njackn.fidonet.org>Show Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!caen!geoffs From: geoffs@yangtze.engin.umich.edu (Geoffrey M Silverton) Subject: Re: Plotting Pixels Message-ID: <W2f=Jv-@engin.umich.edu> Date: Sun, 10 Jan 93 14:01:11 EST Organization: University of Michigan Engineering, Ann Arbor References: <725904224.0@njackn.fidonet.org> Originator: geoffs@yangtze.engin.umich.edu Nntp-Posting-Host: yangtze.engin.umich.edu Lines: 35