source: golgotha/src/render/software/r1_software_globals.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: 3.0 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.hh"
10#include "software/r1_software_globals.hh"
11
12r1_software_class r1_software_class_instance;
13
14//global information about the current rendering buffer
15
16i4_bool r1_software_render_buffer_is_locked = i4_F;
17w16    *r1_software_render_buffer_ptr       = 0; //pointer to buffer memory
18sw32    r1_software_render_buffer_bpl       = 0; //bytes per line
19sw32    r1_software_render_buffer_wpl       = 0; //words per line
20sw32    r1_software_render_buffer_height    = 0;
21w8      r1_software_render_expand_type      = 0; //expanding type
22
23//the directdraw surface which "owns" the buffer
24IDirectDrawSurface3 *r1_software_render_surface = 0;
25
26//global texturemap information (describes the current
27//texturemap being used to draw polygons)
28
29w16 *r1_software_texture_ptr    = 0;
30w8   r1_software_twidth_log2    = 0;
31sw32 r1_software_texture_width  = 0; 
32sw32 r1_software_texture_height = 0;
33
34//------------------------
35//rest of global variables
36//------------------------
37
38sw32  left_l;
39
40sw32  left_s;
41sw32  left_t;
42float left_z;
43
44sw32  right_s;
45sw32  right_t;
46float right_z;
47
48sw32 dsdx_frac,dtdx_frac;
49sw32 temp_dsdx,temp_dtdx;
50
51sw32  s_t_carry[2];
52sw32  dldx_fixed;
53sw32  num_subdivisions;
54
55sw32 s_mask;// = ((r1_software_texture_width -1)<<16) | 0xFFFF;
56sw32 t_mask;// = ((r1_software_texture_height-1)<<16) | 0xFFFF;
57
58float ooz_right;
59float soz_right;
60float toz_right;
61
62w32 pre_blend_and;
63w32 post_blend_and;
64
65sw32  width_global; 
66sw32  num_leftover;
67
68//cur_grads is a global set of gradients used by the scanline texturemappers
69//(it needs to be global so that no extra pointer referencing occurs in the asm code)
70tri_gradients cur_grads;
71
72//the 4444 alpha lookup table (2^4 * 2^4 * 2^4 = 2^12 = 4096)
73w16 alpha_table[4096];
74
75w8 small_poly_type;
76w8 big_poly_type;
77
78//we probably only need 16 of these lookups
79float inverse_leftover_lookup[64];
80
81void inverse_leftover_lookup_init()
82{
83  sw32 i;
84 
85  inverse_leftover_lookup[0] = 0.f;
86
87  for (i=1; i<64; i++)
88  {
89    inverse_leftover_lookup[i] = 1.f / (float)i;
90  }
91}
92
93//unfortunately there is no decent sorted line primitive. all lines get
94//drawn at the end of the frame, if there are any.
95
96software_line software_lines[max_soft_lines];
97sw32          num_buffered_lines=0;
98
99tri_area_struct triangle_info[32];
100float           total_poly_area;
101
102//fpu control word storage (used in inline_fpu.hh)
103w16 old_ceil_word;
104w16 new_ceil_word;
105
106w16 old_trunc_word;
107w16 new_trunc_word;
108
109w16 old_single_word;
110w16 new_single_word;
111
112i4_bool do_amd3d = i4_F;
Note: See TracBrowser for help on using the repository browser.