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

Comparing libgender/view.C (file contents):
Revision 1.23 by root, Wed Oct 6 05:24:03 2004 UTC vs.
Revision 1.29 by root, Wed Oct 6 15:57:51 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 ()
73 generation++; 76 generation++;
74 77
75 reset_projection (); 78 reset_projection ();
76 79
77 // check occlusion queries here 80 // check occlusion queries here
81#if 0
78 for (vector<octant *>::iterator i = checklist.begin (); i != checklist.end (); ++i) 82 for (vector<octant *>::iterator i = checklist.begin (); i != checklist.end (); ++i)
79 //printf ("%p %d\n", *i, occ_query_result ((*i)->occ_query)); 83 //printf ("%p %d\n", *i, occ_query_result ((*i)->occ_query));
80 occ_query_result ((*i)->occ_query); 84 occ_query_result ((*i)->occ_query);
81 85
82 checklist.clear (); 86 checklist.clear ();
87#endif
83 88
84 world.detect_visibility (*this); 89 world.detect_visibility (*this);
85} 90}
86 91
87void view::end () 92void view::end ()
101 glEnable (GL_POLYGON_OFFSET_FILL); 106 glEnable (GL_POLYGON_OFFSET_FILL);
102 glPolygonOffset (0, 1); 107 glPolygonOffset (0, 1);
103 glDepthFunc (GL_LESS); 108 glDepthFunc (GL_LESS);
104 glDisable (GL_LIGHTING); 109 glDisable (GL_LIGHTING);
105 glColorMask (0, 0, 0, 0); 110 glColorMask (0, 0, 0, 0);
106 //cgGLDisableProfile (vsh_profile); 111 cgGLEnableProfile (vsh_profile);// z-fighting??
107 cgGLDisableProfile (fsh_profile); 112 cgGLDisableProfile (fsh_profile);
108 } 113 }
109 else 114 else
110 { 115 {
111#if 0
112 glEnable (GL_MINMAX); 116 glEnable (GL_MINMAX);
113#endif
114 glDisable (GL_POLYGON_OFFSET_FILL); 117 glDisable (GL_POLYGON_OFFSET_FILL);
115 glDepthFunc (GL_LESS); 118 glDepthFunc (GL_LESS);
116 glDepthMask (0); 119 glDepthMask (0);
117 cgGLEnableProfile (vsh_profile); 120 cgGLEnableProfile (vsh_profile);
118 cgGLEnableProfile (fsh_profile); 121 cgGLEnableProfile (fsh_profile);
121 for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i) 124 for (vector<octant *>::iterator i = vislist.begin (); i != vislist.end (); ++i)
122 (*i)->display (*this); 125 (*i)->display (*this);
123 126
124 drawn.clear (); 127 drawn.clear ();
125 128
129 if (mode == view::LIGHTED)
130 {
131 glEnable (GL_DEPTH_CLAMP_NV);
132 glDepthFunc (GL_LEQUAL);
133 glEnable (GL_COLOR_MATERIAL);
134 glDisable (GL_CULL_FACE);
135#if 0
136 cgGLDisableProfile (vsh_profile);
137 cgGLDisableProfile (fsh_profile);
138#endif
139 glShadeModel (GL_FLAT);
140 GLfloat m[4] = { 1, 0, 1, 0 };
141 glColor3f (1, 0, 1);
142 //glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, m);
143 //glLightModelfv (GL_LIGHT_MODEL_AMBIENT, m);
144
145 static int count; count++;
146 if (farlist.size ())
147 printf ("%d: size %d\n", count, farlist.size ());
148
149 for (vector<octant *>::iterator i = farlist.begin (); i != farlist.end (); ++i)
150 (*i)->draw_bbox (*this);
151
152 farlist.clear ();
153
154 glEnable (GL_DEPTH_TEST);
155 glDisable (GL_DEPTH_CLAMP_NV);
156 glShadeModel (GL_SMOOTH);
157 }
158
126 glColorMask (1, 1, 1, 0); 159 glColorMask (1, 1, 1, 0);
127 glDepthMask (1); 160 glDepthMask (1);
161
128} 162}
129 163
130 164

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines