source: golgotha/src/golg/map_vis.hh @ 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.8 KB
RevLine 
[80]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#ifndef G1_MAP_VIS_HH
10#define G1_MAP_VIS_HH
11
12#include "arch.hh"
13#include "math/num_type.hh"
14#include "math/transform.hh"
15#include "poly/poly.hh"
16
17class i4_image16;
18
19class g1_visible_projection
20{
21  i4_float cx1,cy1,cx2,cy2;
22  i4_transform_class *trans;
23
24public:
25  // used by poly_clip template function
26  i4_float intersect(i4_vertex_class *v1, i4_vertex_class *v2, int plane);
27  void project(i4_vertex_class *v)
28  {
29    v->px=v->v.x;
30    v->py=v->v.y;
31  }
32 
33  enum { MAX_CELLS=3000 };
34
35  struct point { i4_float x,y; };
36
37  struct cell
38  {
39    w16 x,y;
40    i4_float z;
41  };
42
43  cell list[MAX_CELLS];
44
45  w32 t_cells;
46 
47  void add(w16 x, w16 y, i4_float z)
48  {
49    if (t_cells<MAX_CELLS)
50    {
51      list[t_cells].x=x;
52      list[t_cells].y=y;
53      list[t_cells].z=z;
54      t_cells++;
55    }   
56  }
57
58  // used by poly_draw template function
59  i4_bool do_z() { return i4_T; }       // do you want w value for each pixel write? (1/z)
60  i4_bool do_st() { return i4_F; }      // do you want texture coordinates?
61  int do_light() { return 0; }          // return 0 for no light
62  i4_bool do_p() { return i4_F; }       // no perspective
63  i4_bool do_spans() { return i4_F; }   // no unrolling
64
65
66  class screen_pointer
67  {
68    int x,y;
69    g1_visible_projection *v;
70
71  public:
72    void move_to(int _x, int _y, g1_visible_projection &vp) { x=_x; y=_y; }
73    screen_pointer &operator+=(int v) { x+=v; return *this; }
74    void next_line(g1_visible_projection &vp) { y++; }
75    int get_twidth(g1_visible_projection &ref)
76    {
77      return 0;
78    }
79
80    w16 * get_ptr(g1_visible_projection &ref)
81    {
82      return NULL;
83    }
84
85    i4_float * get_lookup(g1_visible_projection &ref)
86    {
87      return NULL;
88    }
89
90    w16 * get_tptr(g1_visible_projection &ref)
91    {
92      return NULL;
93    }
94
95    w32 get_screen_width(g1_visible_projection &ref)
96    {
97      return 0;
98    }
99
100    void write(int s, int t,
101               i4_float w,
102               i4_float r, i4_float g, i4_float b,
103               g1_visible_projection &vp)
104    {
105      vp.add(x,y,w);
106    }
107  };
108
109
110  g1_visible_projection(i4_transform_class &t,
111                        w32 n_points,
112                        point *p,
113                        w32 map_w, w32 map_h);
114};
115
116
117#endif
118
119
120
121
122
Note: See TracBrowser for help on using the repository browser.