ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/view.C
(Generate patch)

Comparing libgender/view.C (file contents):
Revision 1.18 by root, Wed Oct 6 01:41:30 2004 UTC vs.
Revision 1.28 by root, Wed Oct 6 15:57:26 2004 UTC

1#include <cmath> 1#include <cmath>
2
3#include <GL/gl.h>
4#include <GL/glext.h>
2 5
3#include "oct.h" 6#include "oct.h"
4#include "view.h" 7#include "view.h"
5 8
6view::view () 9view::view ()
66} 69}
67 70
68void view::begin () 71void view::begin ()
69{ 72{
70 vismap.clear (); 73 vismap.clear ();
74 vislist.clear ();
71 75
72 generation++; 76 generation++;
73 77
74 reset_projection (); 78 reset_projection ();
75 79
76 // check occlusion queries here 80 // check occlusion queries here
81#if 0
82 for (vector<octant *>::iterator i = checklist.begin (); i != checklist.end (); ++i)
83 //printf ("%p %d\n", *i, occ_query_result ((*i)->occ_query));
84 occ_query_result ((*i)->occ_query);
85
77 checklist.clear (); 86 checklist.clear ();
87#endif
78 88
79 world.detect_visibility (*this); 89 world.detect_visibility (*this);
80} 90}
81 91
82void view::end () 92void view::end ()
96 glEnable (GL_POLYGON_OFFSET_FILL); 106 glEnable (GL_POLYGON_OFFSET_FILL);
97 glPolygonOffset (0, 1); 107 glPolygonOffset (0, 1);
98 glDepthFunc (GL_LESS); 108 glDepthFunc (GL_LESS);
99 glDisable (GL_LIGHTING); 109 glDisable (GL_LIGHTING);
100 glColorMask (0, 0, 0, 0); 110 glColorMask (0, 0, 0, 0);
101 //cgGLDisableProfile (CG_PROFILE_ARBVP1); 111 cgGLEnableProfile (vsh_profile);// z-fighting??
102 cgGLDisableProfile (CG_PROFILE_ARBFP1); 112 cgGLDisableProfile (fsh_profile);
103 } 113 }
104 else 114 else
105 { 115 {
106 glEnable (GL_MINMAX); 116 glEnable (GL_MINMAX);
107 glDisable (GL_POLYGON_OFFSET_FILL); 117 glDisable (GL_POLYGON_OFFSET_FILL);
108 glDepthFunc (GL_LESS); 118 glDepthFunc (GL_LESS);
109 glDepthMask (0); 119 glDepthMask (0);
110 cgGLEnableProfile (CG_PROFILE_ARBVP1); 120 cgGLEnableProfile (vsh_profile);
111 cgGLEnableProfile (CG_PROFILE_ARBFP1); 121 cgGLEnableProfile (fsh_profile);
112 } 122 }
113 123
114 for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i) 124 for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i)
115 (*i)->display (*this); 125 (*i)->display (*this);
116 126
117 drawn.clear (); 127 drawn.clear ();
118 128
129 if (mode == view::LIGHTED)
130 {
131 glEnable (GL_DEPTH_CLAMP_NV);
132 glDepthFunc (GL_LEQUAL);
133 glDisable (GL_DEPTH_TEST);
134 glEnable (GL_COLOR_MATERIAL);
135 glDisable (GL_CULL_FACE);
136#if 0
137 cgGLDisableProfile (vsh_profile);
138 cgGLDisableProfile (fsh_profile);
139#endif
140 glShadeModel (GL_FLAT);
141 GLfloat m[4] = { 1, 0, 1, 0 };
142 glColor3f (1, 0, 1);
143 //glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, m);
144 //glLightModelfv (GL_LIGHT_MODEL_AMBIENT, m);
145
146 static int count; count++;
147 if (farlist.size ())
148 printf ("%d: size %d\n", count, farlist.size ());
149
150 for (vector<octant *>::iterator i = farlist.begin (); i != farlist.end (); ++i)
151 (*i)->draw_bbox (*this);
152
153 farlist.clear ();
154
155 glEnable (GL_DEPTH_TEST);
156 glDisable (GL_DEPTH_CLAMP_NV);
157 glShadeModel (GL_SMOOTH);
158 }
159
119 glColorMask (1, 1, 1, 0); 160 glColorMask (1, 1, 1, 0);
120 glDepthMask (1); 161 glDepthMask (1);
162
121} 163}
122 164
123 165

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines