source: golgotha/src/render/software/readme.txt @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 12 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1Software r1 implementation. uses span buffers, or draws polygons in the order
2received.
3
4if perspective mapping is enabled (via the R1_PERSPECTIVE_CORRECT flag, r1_api->modify_features)
5it will automatically draw smaller polygons as affine
6
7if any texture mapping is enabled, it will draw REALLY small polygons (<5 pixels I think) as just
8a solid color. this is primarily to counteract black lines in the terrain where polygons meet, and
9triangles end up being really tiny
10
11lighting uses 2 lookup tables. theoretically, you only need to lookup 3 bytes total per pixel,
12however due to a lack of registers and the slowness of mixing 16 and 32bit code, the lookups
13are all 32bit values. further description of the tables is in tint_manage.cc and the simplest
14lit mapper is in affine_map_lit_c.cc. All of them "dither" the lighting value, meaning that
15if the lighting value on some line of pixels is 10.5, it will actually alternate between 10 and 11
16when lighting those pixels.
17
183 types of alpha are supported.
191) solid color, half alpha. Smoke trails use this. See solid_blend_half_*cc
202) true texture alpha. the texture must be 4-4-4-4. a lookup is performed on the lower 12 bits
21   to get a true 565 (or whatever the screen format is) for that pixel. the screen pixel is read
22   from memory. the 2 pixels are then lit using the lighting table lookups with a properly scaled
23   alpha value, added together, and stored. look at affine_map_unlit_true_alpha_c.cc
243) dithered alpha. uses the same texture format, but skips pixels based on the accumulated alpha
25   value of the scanline
26
27aside from alpha and lit texturemapping (perspective and affine), there is one other texturemapping
28mode supported: "holy" texturemapping - both affine and perspective. The texture format is the
29same as is used in regular texturemapping, but all texels that are black are skipped
30
31lighting, alpha, and holiness are mutually exclusive. if you try to set a mode that isnt supported
32(for instance, lit alphatextureing) the resulting output is undefined. look at update_tri_function()
33in r1_software.cc. Thats what evaluates the current "state" of the renderer and chooses the
34appropriate "type" of polygon that will be drawn. All types are enumerated in mappers.hh.
35
36I *THINK* only win32 spefic code is in win32_specific.hh and win32_specific.cc. Of course,
37the inline assembly in the texturemappers is not portable, and the fpu state management code
38in inline_fpu.cc is not portable, but otherwise the rest of the code should be.
Note: See TracBrowser for help on using the repository browser.