Debian Codegraph @

vcg/wrap/gl/camera.h

raw symbols SCIP
1 /****************************************************************************
2 * VCGLib o o *
3 * Visual and Computer Graphics Library o o *
4 * _ O _ *
5 * Copyright(C) 2004 \/)\/ *
6 * Visual Computing Lab /\/| *
7 * ISTI - Italian National Research Council | *
8 * \ *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
20 * for more details. *
21 * *
22 ****************************************************************************/
23 /****************************************************************************
24 History
25 $Log: camera.h,v $
26 Revision 1.15 2007/05/31 09:39:56 cignoni
27 Small gcc compiling issues
28
29 Revision 1.14 2006/12/18 16:02:57 matteodelle
30 minor eroor correction on variable names
31
32 Revision 1.13 2006/12/18 14:28:07 matteodelle
33 *** empty log message ***
34
35 Revision 1.12 2006/12/18 09:46:39 callieri
36 camera+shot revamp: changed field names to something with more sense, cleaning of various functions, correction of minor bugs/incongruences, removal of the infamous reference in shot.
37
38 Revision 1.11 2006/01/10 12:22:34 spinelli
39 add namespace vcg::
40
41 Revision 1.10 2005/10/24 14:42:57 spinelli
42 add namespace vcg:: to GetFrustum(...)
43
44 Revision 1.9 2005/06/29 15:02:29 spinelli
45 aggiunto:
46 - static void CavalieriProj( .. )
47 - static void IsometricProj( .. )
48
49 modificato:
50 - static void TransformGL( .. )
51 - static void SetSubView( .. )
52
53 Revision 1.8 2005/02/22 10:57:05 tommyfranken
54 corrected some syntax errors in GetFrustum
55
56 Revision 1.7 2005/02/21 18:11:47 ganovelli
57 GetFrustum moved from gl/camera to math/camera.h
58
59 Revision 1.6 2004/12/16 14:41:36 ricciodimare
60 *** empty log message ***
61
62 Revision 1.5 2004/12/16 11:08:35 ricciodimare
63 Cambiato il nome del costruttore era rimasto quello vecchio... e tolti alcune righe di codice commentate
64
65 Revision 1.4 2004/12/15 18:45:06 tommyfranken
66 *** empty log message ***
67
68 Revision 1.3 2004/11/03 09:38:21 ganovelli
69 added SetSubView, some comment and put the class back(!)
70
71 Revision 1.2 2004/10/05 19:04:44 ganovelli
72 changed from classes to functions
73
74 Revision 1.1 2004/09/15 22:59:13 ganovelli
75 creation
76
77 ****************************************************************************/
78
79
80 #ifndef __GL_CAMERA
81 #define __GL_CAMERA
82 // VCG
83 #include <vcg/math/camera.h>
84
85 // opengl
86 #include <GL/glew.h>
87
88 template <class CameraType>
89 struct GlCamera{
90
91 typedef typename CameraType::ScalarType ScalarType;
92 typedef typename CameraType::ScalarType S;
93
94
95 /// returns the OpenGL 4x4 PROJECTION matrix that describes the camera (intrinsics)
96 static vcg::Matrix44<ScalarType>
97 MatrixGL(vcg::Camera<S> & cam, vcg::Matrix44<S> &m)
98 {
99 glPushAttrib(GL_TRANSFORM_BIT);
100 glMatrixMode(GL_PROJECTION);
101 glPushMatrix();
102 glLoadIdentity();
103 TransformGL(cam);
104 glGetv(GL_PROJECTION_MATRIX,&m[0][0]);
105 glPopMatrix();
106 glPopAttrib();
107 return m;
108 }
109
110 /// set the OpenGL PROJECTION matrix for the Cavalieri projection
111 static void SetGLCavalieriProj(float x1, float x2, float y1, float y2, float z1, float z2)
112 {
113 GLfloat cavalieri[16];
114
115 cavalieri[0] = 2.0f/(x2-x1); cavalieri[4] = 0;
116 cavalieri[8] = (0.707106f * -2.0f)/(x2-x1); cavalieri[12] = (x2+x1)/(x2-x1);
117 cavalieri[1] = 0; cavalieri[5] = 2.0/(y2-y1);
118 cavalieri[9] = (0.707106f * -2.0f)/(y2-y1); cavalieri[13] = (y2+y1)/(y2-y1);
119 cavalieri[2] = 0; cavalieri[6] = 0;
120 cavalieri[10] = -2.0f/(z2-z1); cavalieri[14] = (z2+z1)/(z2-z1);
121 cavalieri[3] = 0; cavalieri[7] = 0;
122 cavalieri[11] = 0; cavalieri[15] = 1.0f;
123
124 glLoadMatrixf(cavalieri);
125 }
126
127 /// set the OpenGL PROJECTION matrix for the Isometric projection
128 static void SetGLIsometricProj(float x1, float x2, float y1, float y2, float z1, float z2)
129 {
130 GLfloat isometric[16];
131
132 isometric[0] = 1.6f/(x2-x1); isometric[4] = 0;
133 isometric[8] = -1.6f/(x2-x1); isometric[12] = (x2+x1)/(x2-x1);
134 isometric[1] = -1.0f/(y2-y1); isometric[5] = 2.0f/(y2-y1);
135 isometric[9] = -1.0f/(y2-y1); isometric[13] = (y2+y1)/(y2-y1);
136 isometric[2] = 0; isometric[6] = 0;
137 isometric[10] = -2.0f/(z2-z1); isometric[14] = (z2+z1)/(z2-z1);
138 isometric[3] = 0; isometric[7] = 0;
139 isometric[11] = 0; isometric[15] = 1.0f;
140
141 glLoadMatrixf(isometric);
142 }
143
144 /// get OpenGL-like frustum from a vcg camera (intrinsics)
145 static void GetFrustum(vcg::Camera<S> & intrinsics, S & sx,S & dx,S & bt,S & tp,S & f)
146 {
147 intrinsics.GetFrustum(sx,dx,bt,tp,f);
148 }
149
150 /// set the OpenGL PROJECTION matrix to match the camera (intrinsics). requires near and far plane
151 static void TransformGL(vcg::Camera<S> & camera, S nearDist, S farDist )
152 {
153 S sx,dx,bt,tp,nr,fr;
154 camera.GetFrustum(sx,dx,bt,tp,nr);
155
156 assert(glGetError()==0);
157
158 switch(camera.cameraType)
159 {
160 case vcg::PERSPECTIVE: glFrustum(sx,dx,bt,tp,nearDist,farDist); break;
161 case vcg::ORTHO: glOrtho(sx,dx,bt,tp,nearDist,farDist); break;
162 case vcg::ISOMETRIC: SetGLIsometricProj(sx,dx,bt,tp,nearDist,farDist); break;
163 case vcg::CAVALIERI: SetGLCavalieriProj(sx,dx,bt,tp,nearDist,farDist); break;
164 }
165
166 assert(glGetError()==0);
167 };
168
169
170 static void GetViewSize(vcg::Camera<S> & camera, S &width, S &height) {
171 S sx,dx,bt,tp,nr,fr;
172 GetFrustum(camera,sx,dx,bt,tp,nr,fr);
173 width = dx-sx; //right - left = width
174 height = tp-bt; //top - bottom = height
175 };
176
177
178 static void SetSubView(vcg::Camera<S> & camera,vcg::Point2<S> p0,S nearDist, S farDist,vcg::Point2<S> p1){
179 //typedef typename CameraType::ScalarType S;
180 S sx,dx,bt,tp,f;
181 GetFrustum(camera,sx,dx,bt,tp,f);
182 S width = dx-sx; //right - left = width
183 S height = tp-bt; //top - bottom = height
184 /*glFrustum(
185 width* p0[0]+ sx, width* p1[0]+ sx,
186 height* p0[1]+ bt, height* p1[1]+ bt,
187 nr,fr);*/
188
189
190
191 switch(camera.cameraType)
192 {
193 case vcg::PERSPECTIVE: glFrustum( width* p0[0]+ sx, width* p1[0]+ sx, height* p0[1]+ bt, height* p1[1]+bt,nearDist,farDist); break;
194 case vcg::ORTHO: glOrtho(width* p0[0]+sx, width* p1[0]+sx, height* p0[1]+ bt, height* p1[1]+bt,nearDist,farDist); break;
195 //case vcg::ISOMETRIC: IsometricProj(dx-width* p1[0], dx-width* p0[0], tp-height* p1[1], tp-height* p0[1],nearDist,farDist); break;
196 //case vcg::CAVALIERI: CavalieriProj(dx-width* p1[0], dx-width* p0[0], tp-height* p1[1], tp-height* p0[1],nearDist,farDist); break;
197 }
198
199
200 assert(glGetError()==0);
201 };
202 };
203 #endif
204
205
206
207
208
209
210 //private:
211 //
212 // static inline S SQRT( S x) { return sqrt(fabs(x)); }
213 // static inline S CBRT ( S x )
214 // {
215 // if (x == 0) return 0;
216 // else if (x > 0) return pow (x, 1.0 / 3.0);
217 // else return -pow (-x, 1.0 / 3.0);
218 // }
219 // static inline void SINCOS( S x, S & s, S & c)
220 // {
221 // s=sin(x);
222 // c=cos(x);
223 // }
224 // static inline void SINCOSd( double x, double & s, double & c)
225 // {
226 // s=sin(x);
227 // c=cos(x);
228 // }
229 // static inline S CUB( S x ) { return x*x*x; }
230 // static inline S SQR( S x ) { return x*x; }
231 //
232 //public:
233 // void undistorted_to_distorted_sensor_coord (S Xu, S Yu, S & Xd, S & Yd) const
234 // {
235 // const S SQRT3 = S(1.732050807568877293527446341505872366943);
236 // S Ru,Rd,lambda,c,d,Q,R,D,S,T,sinT,cosT;
237 //
238 // if((Xu==0 && Yu==0) || k[0] == 0)
239 // {
240 // Xd = Xu;
241 // Yd = Yu;
242 // return;
243 // }
244 //
245 // Ru = hypot (Xu, Yu); /* SQRT(Xu*Xu+Yu*Yu) */
246 // c = 1 / k[0];
247 // d = -c * Ru;
248 //
249 // Q = c / 3;
250 // R = -d / 2;
251 // D = CUB (Q) + SQR (R);
252 //
253 // if (D >= 0) /* one real root */
254 // {
255 // D = SQRT (D);
256 // S = CBRT (R + D);
257 // T = CBRT (R - D);
258 // Rd = S + T;
259 //
260 // if (Rd < 0)
261 // Rd = SQRT (-1 / (3 * k[0]));
262 // }
263 // else /* three real roots */
264 // {
265 // D = SQRT (-D);
266 // S = CBRT (hypot (R, D));
267 // T = atan2 (D, R) / 3;
268 // SINCOS (T, sinT, cosT);
269 //
270 // /* the larger positive root is 2*S*cos(T) */
271 // /* the smaller positive root is -S*cos(T) + SQRT(3)*S*sin(T) */
272 // /* the negative root is -S*cos(T) - SQRT(3)*S*sin(T) */
273 // Rd = -S * cosT + SQRT3 * S * sinT; /* use the smaller positive root */
274 // }
275 //
276 // lambda = Rd / Ru;
277 //
278 // Xd = Xu * lambda;
279 // Yd = Yu * lambda;
280 // }
281 //
282 //
283 //void correction(double k, float i, float j, float &disi, float &disj)
284 //{
285 // // (i,j) punto nell'immagine distorta
286 // // (disi,disj) punto nell'immagine corretta (undistorted)
287 // float hyp;
288 // float I,J,ni,nj;
289 // float ratio = 1;
290 //
291 // ni = i-viewport[0]/2;
292 // nj = j-viewport[1]/2;
293 // hyp = ni*ni + nj*nj;
294 //
295 // I = ni * (1+ k * hyp);
296 // J = nj * (1+ k * hyp);
297 //
298 // disi = (I*ratio+viewport[0]/2);
299 // disj = (J*ratio+viewport[1]/2);
300 //}
301 //
302 //
303 //
304 //void distorsion( float k ,float i, float j,double & disi, double &disj)
305 //{
306 // // (i,j) punto nell'immagine corretta (undistorted)
307 // // (disi,disj) punto nell'immagine distorta
308 // float hyp;
309 // int _I,_J;
310 // float I,J,ni,nj;
311 // I = i-viewport[0]/2;
312 // J = j-viewport[1]/2;
313 // hyp = sqrt(I*I + J*J);
314 // if((k==0.0) || (hyp <0.001))
315 // {
316 // disi = i;
317 // disj = j;
318 // }
319 // else
320 // {
321 // undistorted_to_distorted_sensor_coord (I, J, disi, disj);
322 // disi += viewport[0]/2;
323 // disj += viewport[1]/2;
324 //
325 //
326 //// hyp = (viewport[0]*viewport[0] + viewport[1]*viewport[1])/4;
327 //// ni = SX/2 + SX/2 * cam.k[0] * hyp;
328 ///// nj = SY/2 + SY/2 * cam.k[0] * hyp;
329 //// float ratio = sqrt(hyp/(ni*ni + nj*nj));
330 // float ratio=1;
331 //
332 //
333 //
334 // //----------- Maple
335 // // float t0,t1,t2,sol;
336 //
337 // //t0 = 1/k*pow((108.0*hyp+12.0*sqrt(3.0)*sqrt((4.0+27.0*hyp*hyp*k)/k))*k*k,0.3333333333333333)/6.0-2.0/pow((108.0*hyp+12.0*sqrt(3.0)*sqrt((4.0+27.0*hyp*hyp*k)/k))*k*k,0.3333333333333333);
338 //
339 //
340 // //t1 = -1/k*pow((108.0*hyp+12.0*sqrt(3.0)*sqrt((4.0+27.0*hyp*hyp*k)/k))*k*k,0.3333333333333333)/12.0+1/pow((108.0*hyp+12.0*sqrt(3.0)*sqrt((4.0+27.0*hyp*
341 // //hyp*k)/k))*k*k,0.3333333333333333)+sqrt(-1.0)*sqrt(3.0)*(1/k*pow((108.0*hyp+
342 // //12.0*sqrt(3.0)*sqrt((4.0+27.0*hyp*hyp*k)/k))*k*k,0.3333333333333333)/6.0+2.0/
343 // //pow((108.0*hyp+12.0*sqrt(3.0)*sqrt((4.0+27.0*hyp*hyp*k)/k))*k*k,
344 // //0.3333333333333333))/2.0;
345 //
346 // //t2 = -1/k*pow((108.0*hyp+12.0*sqrt(3.0)*sqrt((4.0+27.0*hyp*hyp*k)/k))*k*k,0.3333333333333333)/12.0+1/pow((108.0*hyp+12.0*sqrt(3.0)*sqrt((4.0+27.0*hyp*
347 // //hyp*k)/k))*k*k,0.3333333333333333)-sqrt(-1.0)*sqrt(3.0)*(1/k*pow((108.0*hyp+
348 // //12.0*sqrt(3.0)*sqrt((4.0+27.0*hyp*hyp*k)/k))*k*k,0.3333333333333333)/6.0+2.0/
349 // //pow((108.0*hyp+12.0*sqrt(3.0)*sqrt((4.0+27.0*hyp*hyp*k)/k))*k*k,
350 // //0.3333333333333333))/2.0;
351 //
352 // //sol = (t0>t1)?t0:t1;
353 // //sol = (sol<t2)?t2:sol;
354 // //sol = t0;
355 // //ni = sol*I/hyp;
356 // //nj = sol*J/hyp;
357 // ////-----------
358 //
359 // //disi = (ni*ratio+viewport[0]/2);
360 // //disj = (nj*ratio+viewport[1]/2);
361 // }
362 //}
363 // void ResizeGridMap(const int & si,const int & sj ){
364 // int j;
365 // gridMap.resize(sj+1);
366 // for(j=0; j < sj+1; j++)
367 // gridMap[j].resize(si+1);
368 // }
369 // void UpdateGridMap(){
370 // int sj = gridMap.size();
371 // int si = gridMap[0].size();
372 // int i,j;
373 // for(j=0; j < sj; j++)
374 // for(i=0; i < gridMap[0].size(); i++)
375 // // gridMap[i][j] = Point2<scalar> (i/(double)(si-1),j/(double)(sj-1));
376 // {
377 // double disi,disj;
378 // distorsion( k[0] ,(i/(double)(si-1))*viewport[0], (j/(double)(sj-1))*viewport[1],disi,disj);
379 // gridMap[i][j] = Point2<scalar> (disi/viewport[0],disj/viewport[1]);
380 // }
381 // }
382 //
383 // inline Camera()
384 // {
385 // k[0]=k[1]=k[2]=k[3]=0.0;
386 // valid = false;
387 // ortho = false;
388 // ResizeGridMap(100,100);// da spostare altrove
389 // }
390 //
391 // inline bool IsValid()
392 // {
393 // return valid;
394 // }
395 //
396 // inline bool IsOrtho() const
397 // {
398 // return ortho;
399 // }
400 //
401 // inline void SetInvalid()
402 // {
403 // valid = false;
404 // }
405 //
406 // inline void SetOrtho(bool isOrtho=true)
407 // {
408 // ortho = isOrtho;
409 // }
410 //
411 // // Genera una camera standard
412 // void Standard()
413 // {
414 // valid = true;
415 // ortho = false;
416 // view_p = vectorial(0,0,0);
417 // x_axis = vectorial(1,0,0);
418 // y_axis = vectorial(0,1,0);
419 // z_axis = vectorial(0,0,1);
420 // f = 25.75;
421 // s = Point2<S>(0.0074,0.0074);
422 // c = Point2<S>(320,240);
423 // viewport[0] = 640;
424 // viewport[1] = 480;
425 // k[0] = 0;
426 // k[1] = 0;
427 // k[2] = 0;
428 // k[3] = 0;
429 // }
430 //
431 // // Trasla la camera (world coordinate)
432 // inline void Translate( const vectorial & t )
433 // {
434 // view_p += t;
435 // }
436 //
437 // // Trasla la camera (camera coordinate)
438 // inline void Move( const vectorial & t )
439 // {
440 // view_p+= x_axis * t[0]+y_axis * t[1] + z_axis * t[2];
441 // }
442 //
443 // // scala la camera
444 // inline void Scale(const scalar & sc){
445 // view_p *=sc;
446 // s[0]*=sc;
447 // s[1]*=sc;
448 // f*=sc;
449 // //printf("sc\n");
450 // }
451 //
452 //
453 //
454 // // NOTA funziona solo se l'ultima colonna di m e' 0,0,0,1
455 // void Apply( const Matrix44<S> & m )
456 // {
457 // // Passo 1: calcolo pseudo inversa di m
458 // S s11,s12,s13;
459 // S s21,s22,s23;
460 // S s31,s32,s33;
461 // S s41,s42,s43;
462 //
463 // {
464 // S t4 = m[0][0]*m[1][1];
465 // S t6 = m[0][0]*m[2][1];
466 // S t8 = m[1][0]*m[0][1];
467 // S t10 = m[1][0]*m[2][1];
468 // S t12 = m[2][0]*m[0][1];
469 // S t14 = m[2][0]*m[1][1];
470 // S t17 = 1/(t4*m[2][2]-t6*m[1][2]-t8*m[2][2]+t10*m[0][2]+t12*m[1][2]-t14*m[0][2]);
471 // S t27 = m[1][0]*m[2][2];
472 // S t28 = m[2][0]*m[1][2];
473 // S t31 = m[0][0]*m[2][2];
474 // S t32 = m[2][0]*m[0][2];
475 // S t35 = m[0][0]*m[1][2];
476 // S t36 = m[1][0]*m[0][2];
477 // S t49 = m[3][0]*m[1][1];
478 // S t51 = m[3][0]*m[2][1];
479 // S t59 = m[3][0]*m[0][1];
480 // s11 = -(-m[1][1]*m[2][2]+m[2][1]*m[1][2])*t17;
481 // s12 = -( m[0][1]*m[2][2]-m[2][1]*m[0][2])*t17;
482 // s13 = ( m[0][1]*m[1][2]-m[1][1]*m[0][2])*t17;
483 // s21 = (-t27+t28)*t17;
484 // s22 = -(-t31+t32)*t17;
485 // s23 = -( t35-t36)*t17;
486 // s31 = -(-t10+t14)*t17;
487 // s32 = (-t6 +t12)*t17;
488 // s33 = ( t4 -t8 )*t17;
489 // s41 = -(t10*m[3][2]-t27*m[3][1]-t14*m[3][2]+t28*m[3][1]+t49*m[2][2]-t51*m[1][2])*t17;
490 // s42 = -(-t6*m[3][2]+t31*m[3][1]+t12*m[3][2]-t32*m[3][1]-t59*m[2][2]+t51*m[0][2])*t17;
491 // s43 = (-t4*m[3][2]+t35*m[3][1]+t8 *m[3][2]-t36*m[3][1]-t59*m[1][2]+t49*m[0][2])*t17;
492 // 1.0;
493 // }
494 //
495 // //Matrix44<S> t2 = tt*m;
496 // //print(t2);
497 // // Fase 2: Calcolo nuovo punto di vista
498 // {
499 // S t1 = view_p[2]*s31;
500 // S t3 = view_p[2]*s21;
501 // S t5 = s43*s21;
502 // S t7 = s43*s31;
503 // S t9 = view_p[1]*s31;
504 // S t11 = view_p[1]*s21;
505 // S t13 = s42*s31;
506 // S t15 = s42*s21;
507 // S t17 = view_p[0]*s32;
508 // S t19 = view_p[0]*s22;
509 // S t21 = s41*s32;
510 // S t23 = s41*s22;
511 // S t25 = -t1*s22+t3*s32-t5*s32+t7*s22+t9*s23-t11*s33-t13*s23+t15*s33-t17*s23+t19*s33+t21*s23-t23*s33;
512 // S t39 = 1/(s11*s22*s33-s11*s32*s23-s21*s12*s33+s21*s32*s13+s31*s12*s23-s31*s22*s13);
513 // S t41 = view_p[0]*s12;
514 // S t45 = s41*s12;
515 // S t47 = view_p[2]*s11;
516 // S t50 = s43*s11;
517 // S t53 = view_p[1]*s11;
518 // S t56 = s42*s11;
519 // S t59 = t41*s33-t17*s13+t21*s13-t45*s33+t47*s32-t1*s12-t50*s32+t7*s12-t53*s33+t9*s13+t56*s33-t13*s13;
520 // S t73 = t15*s13-t56*s23+t19*s13-t41*s23-t23*s13+t45*s23-t11*s13+t53*s23+t3*s12-t47*s22-t5*s12+t50*s22;
521 //
522 // view_p[0] = t25*t39;
523 // view_p[1] = -t59*t39;
524 // view_p[2] = -t73*t39;
525 // }
526 //
527 // // Fase 3: Calcol nuovo sistema di riferimento
528 // {
529 // S A00 = s11*x_axis[0]+s12*x_axis[1]+s13*x_axis[2];
530 // S A01 = s11*y_axis[0]+s12*y_axis[1]+s13*y_axis[2];
531 // S A02 = s11*z_axis[0]+s12*z_axis[1]+s13*z_axis[2];
532 // // S A03 = 0.0;
533 // S A10 = s21*x_axis[0]+s22*x_axis[1]+s23*x_axis[2];
534 // S A11 = s21*y_axis[0]+s22*y_axis[1]+s23*y_axis[2];
535 // S A12 = s21*z_axis[0]+s22*z_axis[1]+s23*z_axis[2];
536 // // S A13 = 0.0;
537 // S A20 = s31*x_axis[0]+s32*x_axis[1]+s33*x_axis[2];
538 // S A21 = s31*y_axis[0]+s32*y_axis[1]+s33*y_axis[2];
539 // S A22 = s31*z_axis[0]+s32*z_axis[1]+s33*z_axis[2];
540 //
541 // x_axis[0] = A00; x_axis[1] = A10; x_axis[2] = A20;
542 // y_axis[0] = A01; y_axis[1] = A11; y_axis[2] = A21;
543 // z_axis[0] = A02; z_axis[1] = A12; z_axis[2] = A22;
544 // // S A1[2][3] = 0.0;
545 // // S A1[3][0] = 0.0;
546 // // S A1[3][1] = 0.0;
547 // // S A1[3][2] = 0.0;
548 // // S A1[3][3] = 1.0;
549 // }
550 // }
551 //
552 // /*
553 // // Applica una trasformazione
554 // void Apply( const Matrix44<S> & m )
555 // {
556 // Point3<S> tx = view_p+x_axis;
557 // Point3<S> ty = view_p+y_axis;
558 // Point3<S> tz = view_p+z_axis;
559 //
560 // view_p = m.Apply(view_p);
561 //
562 // x_axis = m.Apply(tx) - view_p;
563 // y_axis = m.Apply(ty) - view_p;
564 // z_axis = m.Apply(tz) - view_p;
565 // }
566 //
567 // // Applica una trasformazione ma bene!
568 // void Stable_Apply( const Matrix44<S> & m )
569 // {
570 // Point3<S> tx = view_p+x_axis;
571 // Point3<S> ty = view_p+y_axis;
572 // Point3<S> tz = view_p+z_axis;
573 //
574 // view_p = m.Stable_Apply(view_p);
575 //
576 // x_axis = m.Stable_Apply(tx) - view_p;
577 // y_axis = m.Stable_Apply(ty) - view_p;
578 // z_axis = m.Stable_Apply(tz) - view_p;
579 // }
580 //
581 // */
582 //
583 // void Project( const vectorial & p, Point2<S> & q ) const
584 // {
585 // vectorial dp = p - view_p;
586 // S dx = dp*x_axis;
587 // S dy = dp*y_axis;
588 // S dz = dp*z_axis;
589 //
590 // S tx = dx;
591 // S ty = -dy;
592 // S qx,qy;
593 //
594 // // nota: per le camere ortogonali viewportM vale 1
595 // if(!IsOrtho())
596 // {
597 // tx *= f/dz;
598 // ty *= f/dz;
599 //
600 // undistorted_to_distorted_sensor_coord(tx,ty,qx,qy);
601 //
602 // q[0] = qx/s[0]+c[0];
603 // q[1] = qy/s[1]+c[1];
604 // }
605 // else
606 // {
607 // q[0] = tx/(s[0]*viewportM)+c[0];
608 // q[1] = ty/(s[1]*viewportM)+c[1];
609 // }
610 // }
611 //
612 //#if 1
613 // void Show( FILE * fp )
614 // {
615 // if(valid)
616 // fprintf(fp,
617 // "posiz.: %g %g %g\n"
618 // "x axis: %g %g %g\n"
619 // "y axis: %g %g %g\n"
620 // "z axis: %g %g %g\n"
621 // "focal : %g scale: %g %g center: %g %g\n"
622 // "viewp.: %d %d distorsion: %g %g %g %g\n"
623 // ,view_p[0],view_p[1],view_p[2]
624 // ,x_axis[0],x_axis[1],x_axis[2]
625 // ,y_axis[0],y_axis[1],y_axis[2]
626 // ,z_axis[0],z_axis[1],z_axis[2]
627 // ,f,s[0],s[1],c[0],c[1]
628 // ,viewport[0],viewport[1],k[0],k[1],k[2],k[3]
629 // );
630 // else
631 // fprintf(fp,"Invalid\n");
632 // }
633 //#endif
634 //
635 // // Legge una camera in descrizione tsai binario
636 // static void load_tsai_bin (FILE *fp, tsai_camera_parameters *cp, tsai_calibration_constants *cc)
637 // {
638 // double sa,
639 // ca,
640 // sb,
641 // cb,
642 // sg,
643 // cg;
644 //
645 // fread(&(cp->Ncx),sizeof(double),1,fp);
646 // fread(&(cp->Nfx),sizeof(double),1,fp);
647 // fread(&(cp->dx),sizeof(double),1,fp);
648 // fread(&(cp->dy),sizeof(double),1,fp);
649 // fread(&(cp->dpx),sizeof(double),1,fp);
650 // fread(&(cp->dpy),sizeof(double),1,fp);
651 // fread(&(cp->Cx),sizeof(double),1,fp);
652 // fread(&(cp->Cy),sizeof(double),1,fp);
653 // fread(&(cp->sx),sizeof(double),1,fp);
654 //
655 // fread(&(cc->f),sizeof(double),1,fp);
656 // fread(&(cc->kappa1),sizeof(double),1,fp);
657 // fread(&(cc->Tx),sizeof(double),1,fp);
658 // fread(&(cc->Ty),sizeof(double),1,fp);
659 // fread(&(cc->Tz),sizeof(double),1,fp);
660 // fread(&(cc->Rx),sizeof(double),1,fp);
661 // fread(&(cc->Ry),sizeof(double),1,fp);
662 // fread(&(cc->Rz),sizeof(double),1,fp);
663 //
664 //
665 // SINCOSd (cc->Rx, sa, ca);
666 // SINCOSd (cc->Ry, sb, cb);
667 // SINCOSd (cc->Rz, sg, cg);
668 //
669 // cc->r1 = cb * cg;
670 // cc->r2 = cg * sa * sb - ca * sg;
671 // cc->r3 = sa * sg + ca * cg * sb;
672 // cc->r4 = cb * sg;
673 // cc->r5 = sa * sb * sg + ca * cg;
674 // cc->r6 = ca * sb * sg - cg * sa;
675 // cc->r7 = -sb;
676 // cc->r8 = cb * sa;
677 // cc->r9 = ca * cb;
678 //
679 // fread(&(cc->p1),sizeof(double),1,fp);
680 // fread(&(cc->p2),sizeof(double),1,fp);
681 // }
682 //
683 // void load_tsai (FILE *fp, tsai_camera_parameters *cp, tsai_calibration_constants *cc)
684 // {
685 // double sa,
686 // ca,
687 // sb,
688 // cb,
689 // sg,
690 // cg;
691 //
692 // fscanf (fp, "%lf", &(cp->Ncx));
693 // fscanf (fp, "%lf", &(cp->Nfx));
694 // fscanf (fp, "%lf", &(cp->dx));
695 // fscanf (fp, "%lf", &(cp->dy));
696 // fscanf (fp, "%lf", &(cp->dpx));
697 // fscanf (fp, "%lf", &(cp->dpy));
698 // fscanf (fp, "%lf", &(cp->Cx));
699 // fscanf (fp, "%lf", &(cp->Cy));
700 // fscanf (fp, "%lf", &(cp->sx));
701 //
702 // fscanf (fp, "%lf", &(cc->f));
703 // fscanf (fp, "%lf", &(cc->kappa1));
704 // fscanf (fp, "%lf", &(cc->Tx));
705 // fscanf (fp, "%lf", &(cc->Ty));
706 // fscanf (fp, "%lf", &(cc->Tz));
707 // fscanf (fp, "%lf", &(cc->Rx));
708 // fscanf (fp, "%lf", &(cc->Ry));
709 // fscanf (fp, "%lf", &(cc->Rz));
710 //
711 // SINCOSd (cc->Rx, sa, ca);
712 // SINCOSd (cc->Ry, sb, cb);
713 // SINCOSd (cc->Rz, sg, cg);
714 //
715 // cc->r1 = cb * cg;
716 // cc->r2 = cg * sa * sb - ca * sg;
717 // cc->r3 = sa * sg + ca * cg * sb;
718 // cc->r4 = cb * sg;
719 // cc->r5 = sa * sb * sg + ca * cg;
720 // cc->r6 = ca * sb * sg - cg * sa;
721 // cc->r7 = -sb;
722 // cc->r8 = cb * sa;
723 // cc->r9 = ca * cb;
724 //
725 // fscanf (fp, "%lf", &(cc->p1));
726 // fscanf (fp, "%lf", &(cc->p2));
727 // }
728 //
729 // // Importa una camera dal formato tsai
730 // void import( const tsai_camera_parameters & cp,
731 // const tsai_calibration_constants & cc,
732 // const int image_viewport[2]
733 // )
734 // {
735 // assert(!IsOrtho());
736 // valid = true;
737 // x_axis[0] = cc.r1; x_axis[1] = cc.r2; x_axis[2] = cc.r3;
738 // y_axis[0] = cc.r4; y_axis[1] = cc.r5; y_axis[2] = cc.r6;
739 // z_axis[0] = cc.r7; z_axis[1] = cc.r8; z_axis[2] = cc.r9;
740 //
741 // view_p[0] = - (cc.Tx * x_axis[0] + cc.Ty * y_axis[0] + cc.Tz * z_axis[0]);
742 // view_p[1] = - (cc.Tx * x_axis[1] + cc.Ty * y_axis[1] + cc.Tz * z_axis[1]);
743 // view_p[2] = - (cc.Tx * x_axis[2] + cc.Ty * y_axis[2] + cc.Tz * z_axis[2]);
744 //
745 // s[0] = cp.dpx/cp.sx;
746 // s[1] = cp.dpy;
747 // c[0] = cp.Cx;
748 // c[1] = cp.Cy;
749 //
750 // f = cc.f;
751 // viewport[0] = image_viewport[0];
752 // viewport[1] = image_viewport[1];
753 //
754 // k[0] = cc.kappa1;
755 // k[1] = cc.kappa1;
756 // k[2] = 0;
757 // k[2] = 0;
758 // }
759 //
760 // // Esporta una camera in formato tsai
761 // void export( tsai_camera_parameters & cp,
762 // tsai_calibration_constants & cc,
763 // int image_viewport[2]
764 // )
765 // {
766 // assert(!IsOrtho());
767 // cc.r1 = x_axis[0]; cc.r2 = x_axis[1]; cc.r3= x_axis[2] ;
768 // cc.r4 = y_axis[0]; cc.r5 = y_axis[1]; cc.r6= y_axis[2] ;
769 // cc.r7 = z_axis[0]; cc.r8 = z_axis[1]; cc.r9= z_axis[2] ;
770 //
771 // cc.Tx = - (view_p[0] * x_axis[0] + view_p[1] * x_axis[1] + view_p[2] * x_axis[2]);
772 // cc.Ty = - (view_p[0] * y_axis[0] + view_p[1] * y_axis[1] + view_p[2] * y_axis[2]);
773 // cc.Tz = - (view_p[0] * z_axis[0] + view_p[1] * z_axis[1] + view_p[2] * z_axis[2]);
774 //
775 // cp.dpx = s[0];
776 // cp.dpy = s[1];
777 //
778 // cp.Cx= c[0] ;
779 // cp.Cy= c[1] ;
780 // cp.sx= 1;
781 //
782 // cc.f= f ;
783 //
784 // image_viewport[0] = viewport[0];
785 // image_viewport[1] = viewport[1];
786 //
787 // cc.kappa1= k[0] ;
788 // cc.kappa1= k[1] ;
789 // }
790 //
791 //
792 // void Save(FILE * out)
793 // {
794 // fprintf(out,"VIEW_POINT %f %f %f\n", view_p[0],view_p[1],view_p[2]);
795 // fprintf(out,"X_AXIS %f %f %f\n", x_axis[0],x_axis[1],x_axis[2]);
796 // fprintf(out,"Y_AXIS %f %f %f\n", y_axis[0],y_axis[1],y_axis[2]);
797 // fprintf(out,"Z_AXIS %f %f %f\n", z_axis[0],z_axis[1],z_axis[2]);
798 // fprintf(out,"FOCUS_LENGHT %f \n", f);
799 // fprintf(out,"SCALE %f %f \n", s[0], s[1]);
800 // fprintf(out,"VIEWPORT %d %d \n", viewport[0], viewport[1]);
801 // fprintf(out,"VIEWPORTM %f\n", viewportM);
802 // fprintf(out,"RADIAL_DISTORSION %.10g %.10g \n", k[0],k[1]);
803 // fprintf(out,"CENTER %f %f \n", c[0], c[1]);
804 // fprintf(out,"IS_VALID %d\n", IsValid());
805 // fprintf(out,"END_CAMERA\n");
806 // }
807 //
808 // void Load(FILE * in)
809 // {
810 // char row[255];
811 // Standard();
812 // while(!feof(in))
813 // {
814 // fscanf(in,"%s",row);
815 // if(strcmp(row,"VIEW_POINT")==0)
816 // fscanf(in,"%lg %lg %lg",&view_p[0],&view_p[1],&view_p[2]);
817 // else
818 // if(strcmp(row,"X_AXIS")==0)
819 // fscanf(in,"%lg %lg %lg",& x_axis[0],&x_axis[1],&x_axis[2]);
820 // else
821 // if(strcmp(row,"Y_AXIS")==0)
822 // fscanf(in,"%lg %lg %lg",& y_axis[0],&y_axis[1],&y_axis[2]);
823 // else
824 // if(strcmp(row,"Z_AXIS")==0)
825 // fscanf(in,"%lg %lg %lg",& z_axis[0],&z_axis[1],&z_axis[2]);
826 // else
827 // if(strcmp(row,"FOCUS_LENGHT")==0)
828 // fscanf(in,"%lg",&f);
829 // else
830 // if(strcmp(row,"SCALE")==0)
831 // fscanf(in,"%lg %lg",&s[0],&s[1]);
832 // else
833 // if(strcmp(row,"VIEWPORT")==0)
834 // fscanf(in,"%d %d", &viewport[0],&viewport[1]);
835 // else
836 // if(strcmp(row,"VIEWPORTM")==0)
837 // fscanf(in,"%f", &viewportM);
838 // else
839 // if(strcmp(row,"CENTER")==0)
840 // fscanf(in,"%lg %lg", &c[0],&c[1]);
841 // else
842 // if(strcmp(row,"RADIAL_DISTORSION")==0)
843 // fscanf(in,"%lg %lg", &k[0],&k[1]);
844 // else
845 // if(strcmp(row,"IS_VALID")==0)
846 // fscanf(in,"%d",&valid);
847 // if(strcmp(row,"END_CAMERA")==0)
848 // break;
849 // }
850 // }
851 //
852 //#ifdef __GL_H__
853 //
854 //// Prende in ingresso il bounding box dell'oggetto da inquadrare e setta projection e modelmatrix
855 //// in modo da matchare il piu' possibile quelle della camera. Ovviamente (?) si ignora le distorsioni radiali.
856 //// Nota che bb viene utilizzato solo per settare i near e far plane in maniera sensata.
857 //void SetGL(const Box3<scalar> &bb,scalar subx0=0, scalar subx1=1,scalar suby0=0,scalar suby1=1)
858 //{
859 // scalar _,__;
860 // SetGL(_,__,bb,subx0, subx1, suby0, suby1);
861 //
862 //}
863 //
864 //void SetGL(scalar &znear, scalar &zfar,const Box3<scalar> &bb,scalar subx0=0,
865 // scalar subx1=1,scalar suby0=0,scalar suby1=1)
866 //{
867 // glMatrixMode(GL_PROJECTION);
868 // glLoadIdentity();
869 // scalar left,right;
870 // scalar bottom, top;
871 // scalar w,h;
872 //
873 // // La lunghezza focale <f> e' la distanza del piano immagine dal centro di proiezione.
874 // // il che mappa direttamente nella chiamata glFrustum che prende in ingresso
875 // // le coordinate del piano immagine posto a znear.
876 //
877 // float imleft =-c[0]*s[0];
878 // float imright =(viewport[0]-c[0])*s[0];
879 // float imbottom =-c[1]*s[1];
880 // float imtop =(viewport[1]-c[1])*s[1];
881 // znear = Distance(view_p, bb.Center())-bb.Diag();
882 // zfar = Distance(view_p, bb.Center())+bb.Diag();
883 //
884 // w=imright-imleft;
885 // h=imtop-imbottom;
886 //
887 // // Quindi il frustum giusto sarebbe questo,
888 // // glFrustum(imleft, imright, imbottom, imtop, f, zfar);
889 // // ma per amor di opengl conviene spostare il near plane fino ad essere vicino all'oggetto da inquadrare.
890 // // Cambiare f significa amplificare in maniera proporzionale anche i left right ecc.
891 //
892 // // 8/5/02 Nota che il near plane va spostato verso l'oggetto solo se quello calcolato sopra e' maggiore di 'f'
893 // // nota che potrebbe anche succedere che znear <0 (viewpoint vicino ad un oggetto con il bb allungato);
894 // if(znear<f) znear=f;
895 //
896 // float nof = znear/f;
897 // if(subx0==0 && subx1 == 1 && suby0==0 && suby1 == 1)
898 // {
899 // if(!IsOrtho())
900 // glFrustum(imleft*nof, imright*nof, imbottom*nof, imtop*nof, znear, zfar);
901 // else
902 // glOrtho(imleft*viewportM, imright*viewportM, imbottom*viewportM, imtop*viewportM, znear, zfar);
903 // }
904 // else {// nel caso si voglia fare subboxing
905 // left = imleft+w*subx0;
906 // right = imleft+w*subx1;
907 // bottom = imbottom +h*suby0;
908 // top = imbottom +h*suby1;
909 // {
910 // if(!IsOrtho())
911 // glFrustum(left*nof, right*nof, bottom*nof, top*nof, znear, zfar);
912 // else
913 // glOrtho(left*viewportM, right*viewportM, bottom*viewportM, top*viewportM, znear, zfar);
914 // }
915 // }
916 //
917 // glMatrixMode(GL_MODELVIEW);
918 // glLoadIdentity();
919 // scalar l=max(scalar(1.0),view_p.Norm());
920 // gluLookAt(view_p[0], view_p[1], view_p[2],
921 // view_p[0] + (z_axis[0]*l),
922 // view_p[1] + (z_axis[1]*l),
923 // view_p[2] + (z_axis[2]*l),
924 // y_axis[0],y_axis[1],y_axis[2]);
925 //}
926 //// Sposta la camera a caso di in maniera che l'angolo di variazione rispetto al punt c passato sia inferiore a RadAngle
927 ////
928 //void Jitter(Point3<scalar> c, scalar RadAngle)
929 //{
930 // Point3<scalar> rnd(1.0 - 2.0*scalar(rand())/RAND_MAX,
931 // 1.0 - 2.0*scalar(rand())/RAND_MAX,
932 // 1.0 - 2.0*scalar(rand())/RAND_MAX);
933 // rnd.Normalize();
934 // Matrix44<scalar> m,t0,t1,tr;
935 // Point3<scalar> axis = rnd ^ (view_p-c).Normalize();
936 // scalar RadRandAngle=RadAngle*(1.0 - 2.0*scalar(rand())/RAND_MAX);
937 // t0.Translate(c);
938 // t1.Translate(-c);
939 // m.Rotate(ToDeg(RadRandAngle),axis);
940 // tr=t1*m*t0;
941 // Apply(tr);
942 //}
943 //
944 //
945 //
946 //
947 //void glTexGen(int offx =0, // angolo basso sinistra della
948 // int offy=0, // subtexture per la quale si vogliono settare le coordinate
949 // int sx=1, // Dimensioni in Texel
950 // int sy=1,
951 // int Tx=1, // Dimensioni della texture
952 // int Ty=1)
953 //{
954 // // prendi la rototraslazione che
955 // // trasforma la coordinata nel
956 // // sistema di coordinate della camera
957 // Matrix44d M;
958 // M[0][0] = x_axis[0];
959 // M[0][1] = x_axis[1];
960 // M[0][2] = x_axis[2];
961 // M[0][3] = -view_p* x_axis ;
962 //
963 // M[1][0] = y_axis[0];
964 // M[1][1] = y_axis[1];
965 // M[1][2] = y_axis[2];
966 // M[1][3] = -view_p* y_axis;
967 //
968 // M[2][0] = z_axis[0];
969 // M[2][1] = z_axis[1];
970 // M[2][2] = z_axis[2];
971 // M[2][3] = -view_p* z_axis;
972 //
973 // M[3][0] = 0.0;
974 // M[3][1] = 0.0;
975 // M[3][2] = 0.0;
976 // M[3][3] = 1.0;
977 //
978 // // prendi la matrice di proiezione
979 // Matrix44d P;
980 // P.Zero();
981 //
982 // if(!IsOrtho())// prospettica
983 // {
984 //
985 // P[0][0] = sx/(s[0]*viewport[0]*Tx);
986 // P[0][2] = (1/f)*(offx+0.5*sx)/Tx;
987 //
988 // P[1][1] = sy/(s[1]* viewport[1]*Ty);
989 // P[1][2] = (1/f)*(offy+0.5*sy)/Ty;
990 //
991 // P[2][2] = 1;
992 // P[3][2] = 1/f;
993 // }
994 // else // ortogonale
995 // {
996 // P[0][0] = sx/(s[0]*viewport[0]*viewportM*Tx);
997 // P[0][3] = (offx+0.5*sx)/Tx; // l'effetto e' una traslazione di +1/2
998 //
999 // P[1][1] = sy/(s[1]* viewport[1]*viewportM*Ty);
1000 // P[1][3] = (offy+0.5*sy)/Ty; // l'effetto e' una traslazione di +1/2
1001 //
1002 // P[2][2] = 1;
1003 // P[3][3] = 1;
1004 // }
1005 // // componi
1006 // Matrix44d PM = P*M;
1007 //
1008 // glTexGend(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
1009 // glTexGend(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
1010 // glTexGend(GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
1011 //
1012 // glTexGendv(GL_S,GL_OBJECT_PLANE,&PM[0][0]);
1013 // glTexGendv(GL_T,GL_OBJECT_PLANE,&PM[1][0]);
1014 // glTexGendv(GL_Q,GL_OBJECT_PLANE,&PM[3][0]);
1015 //
1016 // glEnable(GL_TEXTURE_GEN_S);
1017 // glEnable(GL_TEXTURE_GEN_T);
1018 // glDisable(GL_TEXTURE_GEN_R);
1019 // glEnable(GL_TEXTURE_GEN_Q);
1020 //}
1021 //
1022 //// versione per le texture rettangolare NV_TEXTURE_RECTANGLE
1023 //// la differenza da glTexGen e' che il mapping e' in [0..sx]X[0..sy]
1024 //void glTexGen_NV(int sx, // Texture Size
1025 // int sy)
1026 //{
1027 // // prendi la rototraslazione che
1028 // // trasforma la coordinata nel
1029 // // sistema di coordinate della camera
1030 // Matrix44d M;
1031 // M[0][0] = x_axis[0];
1032 // M[0][1] = x_axis[1];
1033 // M[0][2] = x_axis[2];
1034 // M[0][3] = -view_p* x_axis ;
1035 //
1036 // M[1][0] = y_axis[0];
1037 // M[1][1] = y_axis[1];
1038 // M[1][2] = y_axis[2];
1039 // M[1][3] = -view_p* y_axis;
1040 //
1041 // M[2][0] = z_axis[0];
1042 // M[2][1] = z_axis[1];
1043 // M[2][2] = z_axis[2];
1044 // M[2][3] = -view_p* z_axis;
1045 //
1046 // M[3][0] = 0.0;
1047 // M[3][1] = 0.0;
1048 // M[3][2] = 0.0;
1049 // M[3][3] = 1.0;
1050 //
1051 // // prendi la matrice di proiezione
1052 // Matrix44d P;
1053 // P.Zero();
1054 //
1055 // if(!IsOrtho())// prospettica
1056 // {
1057 //
1058 // P[0][0] = sx/(s[0]*viewport[0]);
1059 // P[0][2] = sx*(1/f)*( 0.5);
1060 //
1061 // P[1][1] = sy/(s[1]* viewport[1] );
1062 // P[1][2] = sy*(1/f)*( 0.5);
1063 //
1064 // P[2][2] = 1;
1065 // P[3][2] = 1/f;
1066 // }
1067 // else // ortogonale
1068 // {
1069 // P[0][0] = sx/(s[0]*viewport[0]*viewportM);
1070 // P[0][3] = sx* 0.5 ; // l'effetto e' una traslazione di +1/2
1071 //
1072 // P[1][1] = sy/(s[1]* viewport[1]*viewportM);
1073 // P[1][3] = sy* 0.5 ; // l'effetto e' una traslazione di +1/2
1074 //
1075 // P[2][2] = 1;
1076 // P[3][3] = 1;
1077 // }
1078 // // componi
1079 // Matrix44d PM = P*M;
1080 //
1081 // glTexGend(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
1082 // glTexGend(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
1083 // glTexGend(GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
1084 //
1085 // glTexGendv(GL_S,GL_OBJECT_PLANE,&PM[0][0]);
1086 // glTexGendv(GL_T,GL_OBJECT_PLANE,&PM[1][0]);
1087 // glTexGendv(GL_Q,GL_OBJECT_PLANE,&PM[3][0]);
1088 //
1089 // glEnable(GL_TEXTURE_GEN_S);
1090 // glEnable(GL_TEXTURE_GEN_T);
1091 // glDisable(GL_TEXTURE_GEN_R);
1092 // glEnable(GL_TEXTURE_GEN_Q);
1093 //// glDisable(GL_TEXTURE_GEN_Q);
1094 //
1095 //}
1096 //#endif // __GL_H__
1097 //
1098 //};
1099 //} // End namespace vcg