source: golgotha/src/render/software/affine_map_unlit_true_alpha_c.cc @ 80

Last change on this file since 80 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: 2.1 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_true_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    register w32 alpha_texel = *(r1_software_texture_ptr + (left_s>>16) + ((left_t>>16)<<r1_software_twidth_log2));
31               
32    register w32 l_lookup = (alpha_texel & (w16)(15<<12)) >> (8-NUM_LIGHT_SHADES_LOG2);
33
34    if (l_lookup)
35    {
36      register w32 texel = (w32)alpha_table[alpha_texel & 4095];
37
38      //lookup low bits
39      register w32 output_texel = ((w32 *)(software_color_tables))[l_lookup + (texel & 0xFF)];
40
41      //lookup high bits
42      output_texel += ((w32 *)(software_color_tables)+ctable_size)[l_lookup + (texel>>8)];
43
44      l_lookup ^= (NUM_LIGHT_SHADES<<8);
45     
46      if (l_lookup)
47      {
48        texel       = (w32)*start_pixel;
49
50        //lookup low bits
51        output_texel += ((w32 *)(software_color_tables))[l_lookup + (texel & 0xFF)];
52
53        //lookup high bits
54        output_texel += ((w32 *)(software_color_tables)+ctable_size)[l_lookup + (texel>>8)];
55      }
56
57      *start_pixel = (w16)(output_texel);
58    }
59   
60    start_pixel++;
61
62    left_s += temp_dsdx;
63    left_t += temp_dtdx;
64
65    width_global--;
66  }
67}
Note: See TracBrowser for help on using the repository browser.