source: golgotha/src/render/software/affine_map_unlit_alpha_c.cc

Last change on this file was 80, checked in by Sam Hocevar, 11 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.
File size: 1.5 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "software/r1_software_globals.hh"
10#include "software/inline_fpu.hh"
11
12void texture_scanline_affine_unlit_alpha(w16 *start_pixel,
13                                         sw32 start_x,
14                                         void *_left,//perspective_span *left,
15                                         sw32 width)
16{
17  w32 accumulated_alpha = (1<<12);
18
19  start_pixel = (w16 *)((w8 *)start_pixel + start_x);
20
21  affine_span *left = (affine_span *)_left;
22   
23  left_s = left->s;
24  left_t = left->t;
25
26  width_global = width;
27
28  while (width_global)
29  {
30    w16 texel = *(r1_software_texture_ptr + (left_s>>16) + ((left_t>>16)<<r1_software_twidth_log2));
31               
32    accumulated_alpha += ((w32)(texel) & (w32)(15<<12));
33   
34    if (accumulated_alpha & 65536)
35    {
36      *start_pixel = alpha_table[texel & 4095];
37      accumulated_alpha &= (~65536);
38      accumulated_alpha += (1<<12);
39    }
40   
41    start_pixel++;
42
43    left_s += temp_dsdx;
44    left_t += temp_dtdx;
45
46    width_global--;
47  }
48}
Note: See TracBrowser for help on using the repository browser.