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

Comparing libgender/view.C (file contents):
Revision 1.67 by root, Sun Oct 31 22:54:49 2004 UTC vs.
Revision 1.71 by root, Thu Nov 4 04:46:58 2004 UTC

4 4
5#include "view.h" 5#include "view.h"
6#include "oct.h" 6#include "oct.h"
7 7
8using namespace gl; 8using namespace gl;
9
10pass pass_depth (0);
9 11
10vector<GLuint> occ_query_objects; 12vector<GLuint> occ_query_objects;
11 13
12static GLuint begin_occ_query () 14static GLuint begin_occ_query ()
13{ 15{
182 vislist.clear (); 184 vislist.clear ();
183} 185}
184 186
185#define DEPTH_OFFSET (1. / (GLdouble)(1L << 16)) 187#define DEPTH_OFFSET (1. / (GLdouble)(1L << 16))
186 188
187void view::render (enum pass p) 189void view::render (enum pass_type p, pass &data)
188{ 190{
189 pass = p; 191 pass_type = p;
192 pass_data = &data;
190 193
191 switch (pass) 194 switch (pass_type)
192 { 195 {
193 case DEPTH: 196 case DEPTH:
194 glColorMask (1, 1, 1, 1); 197 glColorMask (1, 1, 1, 1);
195 glDepthMask (1); 198 glDepthMask (1);
196 199
246 } 249 }
247 250
248 for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i) 251 for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i)
249 (*i)->display (*this); 252 (*i)->display (*this);
250 253
251 if (pass == LIGHTED) 254 if (pass_type == DEPTH)
252 printf ("fps %f NF %f:%f vis %d CAM (%d,%d,%d)\n", timer.fps, z_near, z_far, drawn.size (), orig.x, orig.y, orig.z);//D 255 printf ("fps %f NF %f:%f vis %d CAM (%d,%d,%d)\n", timer.fps, z_near, z_far, drawn.size (), orig.x, orig.y, orig.z);//D
253 256
254 drawn.clear (); 257 drawn.clear ();
255 258
256#if 0 259#if 0
270 glDisable (GL_DEPTH_CLAMP_NV); 273 glDisable (GL_DEPTH_CLAMP_NV);
271 } 274 }
272#endif 275#endif
273} 276}
274 277
278void light::enable ()
279{
280 lightpos->set (p);
281}
275 282
283void light::disable ()
284{
285}
286
287static shader::varying_1f camdist;
288static shader::varying_3f lightvec;
289
290void linear_light::vsh ()
291{
292 using namespace shader::compile;
293
294 lightvec = xyz (lightpos - model_view_matrix * vin.vertex);
295 camdist = max (1 - length (lightvec) / radius, 0);
296}
297
298shader::temp_3f linear_light::operator ()()
299{
300 using namespace shader::compile;
301
302 temp_3f res;
303 res = float3 (c.r / 255.F, c.g / 255.F, c.b / 255.F) * (min (intensity * camdist * 0.6F + 0.9F, 1.F));
304
305 return res;
306}
307
308

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines