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.27 by root, Wed Oct 6 15:54:23 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 cgGLDisableProfile (vsh_profile);
132 cgGLDisableProfile (fsh_profile);
133 glEnable (GL_DEPTH_CLAMP_NV);
134 glDepthFunc (GL_LEQUAL);
135 glDisable (GL_DEPTH_TEST);
136 glEnable (GL_COLOR_MATERIAL);
137 glDisable (GL_CULL_FACE);
138#if 0
139 cgGLDisableProfile (vsh_profile);
140 cgGLDisableProfile (fsh_profile);
141#endif
142 GLfloat m[4] = { 1, 0, 1, 0 };
143 glColor3f (1, 0, 1);
144 glNormal3f (0.7, 0.5, 0.9);
145 glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, m);
146 glLightModelfv (GL_LIGHT_MODEL_AMBIENT, m);
147
148 static int count; count++;
149 if (farlist.size ())
150 printf ("%d: size %d\n", count, farlist.size ());
151
152 for (vector<octant *>::iterator i = farlist.begin (); i != farlist.end (); ++i)
153 (*i)->draw_bbox (*this);
154
155 farlist.clear ();
156
157 glEnable (GL_DEPTH_TEST);
158 glDisable (GL_DEPTH_CLAMP_NV);
159 }
160
119 glColorMask (1, 1, 1, 0); 161 glColorMask (1, 1, 1, 0);
120 glDepthMask (1); 162 glDepthMask (1);
163
121} 164}
122 165
123 166

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines