Here's the rendering list version of the function.Once again,it works identically to the 16-bit version:
原文中这里有一个函数...
For a demo of the 8-bit lighting system,check out DEMOII8_5_8b.CPP|EXE.It's identical to 16-bit
demo (it uses the same controls) except that it's 8-bit! Notice that the lighting doesn't look too bad
compared to the 16-bit version.Figure 8.34 is a screenshot of the demo running.
However,palettes count here,boys and girls.For this demo,the system uses the default 8-bit palette
form the first Tricks,which PALDATA2.PAL. PALDATA2.BMP is a blank bitmap with that bitmap,so
you can load and look at the colors for the palette.Amazingly,you may say,"That looks like agood palette,"
but it's only good for colors that are in the palette.When you try to find a shade of fuchsia that's not in the
palette,the nearest neighbor algorithm ends up with light brown or something else horrific,and the lighting
looks bad.
To remedy this,you must use a palette that has a very small color space but a large inten-
sity space.For example,if you're making aDoom clone,you would pick a palette with a lot of
grays,browns,and such colord,and nothing more,and 8-16 shades of each,That way,all possible
shandes of each color are in the palette,so the lookup table doesn't have ridiculous entries
in it.
第一段。。。。。
|