Code_TYMPAN  4.4.0
Industrial site acoustic simulation
OGLCamera.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 /*
17  *
18  */
19 
20 #include "OGLCamera.h"
22 
23 #if _WIN32
24  #include <math.h>
25  #include <windows.h>
26 #endif //_WIN32
27 
28 #ifndef MIN
29  #define MIN(a, b) (((a) < (b)) ? (a) : (b))
30 #endif
31 
32 #ifndef MAX
33  #define MAX(a, b) (((a) > (b)) ? (a) : (b))
34 #endif
35 
36 OGLCamera::OGLCamera(NxReal* _from, NxReal* _to, NxReal* _up, int w, int h, CameraType eCameraType)
37 {
38  m_w = w;
39  m_h = h;
40  setFromToUp(_from, _to, _up);
41  setAllAngleStep(0.1);
42  setModeLock(false, false, false);
43  m_zoomFactor = 1.0;
44  m_eCameraType = eCameraType;
45 
46  switch (m_eCameraType)
47  {
48  case PARALLEL:
49  {
50  m_defaultZoomFactor = 0.29; // le facteur par defaut est pour un monde de 400 de MAX(larg,haut) et
51  // un viewport 700 de MIN(larg,haut)
52  }
53  break;
54  case PERSPECTIVE:
55  {
56  m_defaultZoomFactor = 0.5; // le facteur par defaut est pour un monde de 400 de MAX(larg,haut) et
57  // un viewport 700 de MIN(larg,haut)
58  }
59  break;
60  case FREE:
61  {
62  m_defaultZoomFactor = 1; // le facteur par defaut est pour un monde de 400 de MAX(larg,haut) et un
63  // viewport 700 de MIN(larg,haut)
64  }
65  break;
66  }
67 
68  m_angleAz = 0;
69  m_angleEl = 0;
70  m_angleRo = 0;
71  m_translate = NxVec3(0, 0, 0);
72 }
73 
74 void OGLCamera::setSize(int w, int h)
75 {
76  m_w = w;
77  m_h = h;
78 }
79 
81 {
82  switch (m_eCameraType)
83  {
84  case PARALLEL:
85  {
86  glMatrixMode(GL_PROJECTION);
87  glLoadIdentity();
89  1000);
90  gluLookAt(from.x, from.y, from.z, to.x, to.y, to.z, up.x, up.y, up.z);
91  }
92  break;
93  case PERSPECTIVE:
94  {
95  glMatrixMode(GL_PROJECTION);
96  glLoadIdentity();
97  gluPerspective(30 * m_zoomFactor, (double)m_w / m_h, 10, 50000); // Initialement 1, 50000
98  gluLookAt(from.x, from.y, from.z, to.x, to.y, to.z, up.x, up.y, up.z);
99 
100  // Roll
101  glRotatef((float)m_angleRo, (float)front.x, (float)front.y,
102  (float)front.z); /* orbit the front axis */
103  // Elevation
104  NxVec3 elevationVector = up.cross(fromTo);
105  glRotatef((float)-m_angleEl, (float)elevationVector.x, (float)elevationVector.y,
106  (float)elevationVector.z); /* orbit the UP axis */
107  // Azhimut
108  glRotatef((float)-m_angleAz, (float)up.x, (float)up.y, (float)up.z); /* orbit the Y*Z axis */
109  }
110  break;
111  case FREE:
112  {
113  glMatrixMode(GL_PROJECTION);
114  glLoadIdentity();
115  gluPerspective(30 * m_zoomFactor, (double)m_w / m_h, 1, 5000); // Initialement 1, 50000
116  gluLookAt(from.x, from.y, from.z, to.x, to.y, to.z, up.x, up.y, up.z);
117 
118  glTranslatef((float)-flyFromTo.x, (float)-flyFromTo.y, (float)-flyFromTo.z);
119 
120  // Roll
121  glRotatef((float)m_angleRo, (float)front.x, (float)front.y,
122  (float)front.z); /* orbit the front axis */
123  // Elevation
124  NxVec3 elevationVector = up.cross(fromTo);
125  glRotatef((float)-m_angleEl, (float)elevationVector.x, (float)elevationVector.y,
126  (float)elevationVector.z); /* orbit the UP axis */
127  // Azhimut
128  glRotatef((float)-m_angleAz, (float)up.x, (float)up.y, (float)up.z); /* orbit the Y*Z axis */
129 
130  glTranslatef((float)flyFromTo.x, (float)flyFromTo.y, (float)flyFromTo.z);
131 
132  glTranslatef((float)-m_translate.x, (float)-m_translate.y, (float)-m_translate.z);
133  }
134  break;
135  }
136 }
137 
139 {
140  m_eCameraType = eCameraType;
141 }
142 
143 void OGLCamera::move(NxReal* _direction)
144 {
145  from.x += _direction[0];
146  from.y += _direction[1];
147  from.z += _direction[2];
148  to.x += _direction[0];
149  to.y += _direction[1];
150  to.z += _direction[2];
151 }
152 
154 {
155  if (m_eCameraType == FREE)
156  {
159  }
160  else
161  {
162  from += stepFront;
163  to += stepFront;
164  }
165 }
166 
168 {
169  if (m_eCameraType == FREE)
170  {
173  }
174  else
175  {
176  from -= stepFront;
177  to -= stepFront;
178  }
179 }
180 
182 {
183  if (m_eCameraType == FREE)
184  {
185  m_translate += stepUp;
187  }
188  else
189  {
190  from += stepUp;
191  to += stepUp;
192  }
193 }
194 
196 {
197  if (m_eCameraType == FREE)
198  {
199  m_translate -= stepUp;
201  }
202  else
203  {
204  from -= stepUp;
205  to -= stepUp;
206  }
207 }
208 
210 {
211  if (m_eCameraType == FREE)
212  {
215  }
216  else
217  {
218  from += stepLeft;
219  to += stepLeft;
220  }
221 }
222 
224 {
225  if (m_eCameraType == FREE)
226  {
229  }
230  else
231  {
232  from -= stepLeft;
233  to -= stepLeft;
234  }
235 }
236 
238 {
239  if (!modeLockUpDown ||
241  {
243  front.rotate(left);
245  to = from + fromTo;
247  }
248 }
250 {
251  if (!modeLockUpDown ||
253  {
255  front.rotate(left);
257  to = from + fromTo;
259  }
260 }
262 {
263  if (!modeLockUpDown ||
265  {
267  to = from + fromTo;
268  }
269 }
271 {
272  if (!modeLockUpDown ||
274  {
276  to = from + fromTo;
277  }
278 }
279 
281 {
282  if (!modeLockLeftRight ||
284  {
286  front.rotate(up);
287  fromTo.rotate(up);
288  to = from + fromTo;
290  }
291 }
292 
294 {
295  if (!modeLockLeftRight ||
297  {
299  front.rotate(up);
300  fromTo.rotate(up);
301  to = from + fromTo;
303  }
304 }
305 
307 {
308  if (!modeLockUpDown ||
310  {
312  front.rotate(left);
314  from = to - fromTo;
316  }
317 }
319 {
320  if (!modeLockUpDown ||
322  {
324  front.rotate(left);
326  from = to - fromTo;
328  }
329 }
330 
332 {
333  if (!modeLockLeftRight ||
335  {
337  front.rotate(up);
338  fromTo.rotate(up);
339  from = to - fromTo;
341  }
342 }
343 
345 {
346  if (!modeLockLeftRight ||
348  {
350  front.rotate(up);
351  fromTo.rotate(up);
352  from = to - fromTo;
354  }
355 }
356 
358 {
360  {
362  left.rotate(front);
364  }
365 }
366 
368 {
370  {
372  left.rotate(front);
374  }
375 }
376 
377 void OGLCamera::moveUp(NxReal _distance)
378 {
379  from += up * _distance;
380  to += up * _distance;
381 }
382 
384 {
385  from -= up * _distance;
386  to -= up * _distance;
387 }
388 
390 {
391  from += front * _distance;
392  to += front * _distance;
393 }
394 
396 {
397  from -= front * _distance;
398  to -= front * _distance;
399 }
400 
402 {
403  from += left * _distance;
404  to += left * _distance;
405 }
406 
408 {
409  from -= left * _distance;
410  to -= left * _distance;
411 }
412 
414 {
415  if (!modeLockUpDown || (currentUpDown + _angle <= maxUpDown && (currentUpDown += _angle)))
416  {
417  up.rotate(-_angle, left);
418  front.rotate(left);
420  to = from + fromTo;
422  }
423 }
425 {
426  if (!modeLockUpDown || (currentUpDown + _angle <= maxUpDown && (currentUpDown += _angle)))
427  {
428  up.rotate(-_angle, left);
429  front.rotate(left);
431  from = to - fromTo;
433  }
434 }
436 {
437  if (!modeLockUpDown || (currentUpDown - _angle >= minUpDown && (currentUpDown -= _angle)))
438  {
439  up.rotate(_angle, left);
440  front.rotate(left);
442  to = from + fromTo;
444  }
445 }
446 
448 {
449  if (!modeLockUpDown || (currentUpDown + _angle <= maxUpDown && (currentUpDown += _angle)))
450  {
451  fromTo.rotate(-_angle, left);
452  to = from + fromTo;
453  }
454 }
455 
457 {
458  if (!modeLockUpDown || (currentUpDown - _angle >= minUpDown && (currentUpDown -= _angle)))
459  {
460  fromTo.rotate(_angle, left);
461  to = from + fromTo;
462  }
463 }
464 
466 {
467  if (!modeLockLeftRight || (currentLeftRight + _angle <= maxLeftRight && (currentLeftRight += _angle)))
468  {
469  left.rotate(_angle, up);
470  front.rotate(up);
472  to = from + fromTo;
474  }
475 }
476 
478 {
479  if (!modeLockLeftRight || (currentLeftRight - _angle >= minLeftRight && (currentLeftRight -= _angle)))
480  {
481  left.rotate(-_angle, up);
482  front.rotate(up);
484  to = from + fromTo;
486  }
487 }
488 
490 {
491  if (!modeLockUpDown || (currentUpDown - _angle >= minUpDown && (currentUpDown -= _angle)))
492  {
493  up.rotate(_angle, left);
494  front.rotate(left);
496  from = to - fromTo;
498  }
499 }
500 
502 {
503  if (!modeLockLeftRight || (currentLeftRight + _angle <= maxLeftRight && (currentLeftRight += _angle)))
504  {
505  left.rotate(_angle, up);
506  front.rotate(up);
507  fromTo.rotate(up);
508  from = to - fromTo;
510  }
511 }
512 
514 {
515  if (!modeLockLeftRight || (currentLeftRight - _angle >= minLeftRight && (currentLeftRight -= _angle)))
516  {
517  left.rotate(-_angle, up);
518  front.rotate(up);
519  fromTo.rotate(up);
520  from = to - fromTo;
522  }
523 }
524 
526 {
527  if (!modeLockSide || (currentSide + _angle <= maxSide && (currentSide += _angle)))
528  {
529  up.rotate(_angle, front);
530  left.rotate(front);
532  }
533 }
534 
536 {
537  if (!modeLockSide || (currentSide - _angle >= minSide && (currentSide -= _angle)))
538  {
539  up.rotate(-_angle, front);
540  left.rotate(front);
542  }
543 }
544 
545 void OGLCamera::setDistanceStep(NxReal _magnitudeStepUp, NxReal _magnitudeStepFront,
546  NxReal _magnitudeStepLeft)
547 {
549  magnitudeStepUp = _magnitudeStepUp;
552  magnitudeStepFront = _magnitudeStepFront;
555  magnitudeStepLeft = _magnitudeStepLeft;
557 }
558 
560 {
561  NxReal s = sin(_angle), c = cos(_angle);
565 }
566 
567 void OGLCamera::setAngleStep(NxReal _stepAngleUpDown, NxReal _stepAngleLeftRight, NxReal _stepAngleSide)
568 {
569  sinUpDown = sin(_stepAngleUpDown);
570  sinLeftRight = sin(_stepAngleLeftRight);
571  stepAngleUpDown = _stepAngleUpDown;
572  sinSide = sin(_stepAngleSide);
573  cosUpDown = cos(_stepAngleUpDown);
574  stepAngleLeftRight = _stepAngleLeftRight;
575  cosLeftRight = cos(_stepAngleLeftRight);
576  cosSide = cos(_stepAngleSide);
577  stepAngleSide = _stepAngleSide;
578 }
579 
581 {
582  to += NxVec3(_from) - from;
583  from = NxVec3(_from);
585 }
586 
588 {
589  from += NxVec3(_to) - to;
590  to = NxVec3(_to);
592 }
593 
595 {
596  up = NxVec3(_up);
598 }
599 
600 void OGLCamera::setFromToUp(NxReal* _from, NxReal* _to, NxReal* _up)
601 {
602  from = NxVec3(_from);
603  to = NxVec3(_to);
604  up = NxVec3(_up, true);
605  front = NxVec3(to - from, true);
606  fromTo = to - from;
607  left.cross(up, front, true);
608 
610  magnitudeStepUp = 1;
611  magnitudeStepFront = 1;
612  magnitudeStepLeft = 1;
614 }
615 
617 {
618  setFromToUp(from.get(), to.get(), up.get());
619 }
620 
622 {
623  fromTo *= _distanceFromTo / distanceFromTo;
624  distanceFromTo = _distanceFromTo;
625  to = from + fromTo;
626 }
627 
629 {
630  fromTo *= _distanceFromTo / distanceFromTo;
631  distanceFromTo = _distanceFromTo;
632  from = to - fromTo;
633 }
634 
635 void OGLCamera::setModeLock(bool _modeLockUpDown, bool _modeLockLeftRight, bool _modeLockSide)
636 {
637  modeLockUpDown = _modeLockUpDown;
638  modeLockLeftRight = _modeLockLeftRight;
639  modeLockSide = _modeLockSide;
640 }
641 
642 void OGLCamera::setMinMaxCurrentUpDown(NxReal _minUpDown, NxReal _maxUpDown, NxReal _currentUpDown)
643 {
644  minUpDown = _minUpDown;
645  maxUpDown = _maxUpDown;
646  currentUpDown = _currentUpDown;
647 }
648 
649 void OGLCamera::setMinMaxCurrentLeftRight(NxReal _minLeftRight, NxReal _maxLeftRight,
650  NxReal _currentLeftRight)
651 {
652  minLeftRight = _minLeftRight;
653  maxLeftRight = _maxLeftRight;
654  currentLeftRight = _currentLeftRight;
655 }
656 
657 void OGLCamera::setMinMaxCurrentSide(NxReal _minSide, NxReal _maxSide, NxReal _currentSide)
658 {
659  minSide = _minSide;
660  maxSide = _maxSide;
661  currentSide = _currentSide;
662 }
663 
665 {
667  maxSide = currentSide = _angle;
668 }
669 
671 {
672  if (m_eCameraType != FREE)
673  {
674  double dist = from.distance(NxVec3(0, 0, 0));
675  stepLeft = left * magnitudeStepLeft * ((dist + 1) / 1000);
676  stepFront = front * magnitudeStepFront * ((dist + 1) / 1000);
677  stepUp = up * magnitudeStepUp * ((dist + 1) / 1000);
678  }
679  else
680  {
681  flyTo = to + m_translate;
683  flyFromTo = flyTo - flyFrom;
684  flyUp = up; // + m_translate;
686  flyFront = NxVec3(flyTo - flyFrom, true);
687 
688  flyLeft.cross(flyUp, flyFront, true);
689  flyLeft.rotate((M_PI * m_angleAz) / 180, flyUp);
690  flyFront.rotate((M_PI * m_angleAz) / 180, flyUp);
691  flyFront.rotate((M_PI * m_angleEl) / 180, flyLeft);
692 
696  }
697 }
698 
700 {
701  NxVec3 retValue;
702  retValue.x = retValue.y = retValue.z = 0;
703 
704  NxVec3 retValueTmp;
705  retValueTmp.x = retValueTmp.y = retValueTmp.z = 0;
706 
707  glLoadIdentity();
708  GLfloat winX = NAN, winY = NAN, winZ = NAN;
709  GLint viewport[4];
710  GLdouble mvmatrix[16], projmatrix[16];
711  glGetDoublev(GL_MODELVIEW_MATRIX, mvmatrix);
712  glGetDoublev(GL_PROJECTION_MATRIX, projmatrix);
713  glGetIntegerv(GL_VIEWPORT, viewport);
714  winX = (float)display.x;
715  winY = (float)display.y;
716  winZ = (float)display.z;
717  gluUnProject(winX, winY, winZ, mvmatrix, projmatrix, viewport, &retValue.x, &retValue.y, &retValue.z);
718 
719  return retValue;
720 }
721 
723 {
724  NxVec3 retValue;
725  retValue.x = retValue.y = retValue.z = 0;
726 
727  // glLoadIdentity();
728  GLint viewport[4];
729  GLdouble mvmatrix[16], projmatrix[16];
730  glGetDoublev(GL_MODELVIEW_MATRIX, mvmatrix);
731  glGetDoublev(GL_PROJECTION_MATRIX, projmatrix);
732  glGetIntegerv(GL_VIEWPORT, viewport);
733  gluProject(world.x, world.y, world.z, mvmatrix, projmatrix, viewport, &retValue.x, &retValue.y,
734  &retValue.z);
735 
736  return retValue;
737 }
738 
739 void OGLCamera::getViewPort(double* vp)
740 {
741  GLdouble viewport[4];
742  glGetDoublev(GL_VIEWPORT, viewport);
743  vp[0] = viewport[0];
744  vp[1] = viewport[1];
745  vp[2] = viewport[2];
746  vp[3] = viewport[3];
747 }
748 
749 NxVec3 OGLCamera::getCenter(int sizeX, int sizeY)
750 {
751  NxVec3 retValue;
752 
753  GLdouble viewport[4];
754  glGetDoublev(GL_VIEWPORT, viewport);
755 
756  retValue.x = ((viewport[2] + viewport[0]) / 2.0 * (double)sizeX);
757  retValue.y = ((viewport[3] + viewport[1]) / 2.0 * (double)sizeY);
758  return retValue;
759 }
760 
761 void OGLCamera::zoom(double zoomFactor)
762 {
763  if (m_eCameraType != PARALLEL)
764  {
766  if (zoomFactor < 1)
767  {
768  moveFront();
769  }
770  else
771  {
772  moveBack();
773  }
775  }
776  else
777  {
778  m_zoomFactor *= zoomFactor;
779  }
780 }
781 
783 {
784  m_angleAz += (_angle * 500);
786 }
787 
789 {
790  m_angleEl += (_angle * 500);
792 }
793 
795 {
796  m_angleRo += (_angle * 500);
798 }
799 
800 void OGLCamera::resetZoom(int w /*= -1*/, int h /*= -1*/)
801 {
802  if ((w <= 0) && (h <= 0))
803  {
805  }
806  else
807  {
808  GLdouble viewport[4];
809  glGetDoublev(GL_VIEWPORT, viewport);
810  double minSizeViewport = MIN(viewport[2], viewport[3]);
811  double maxSizeBoundingBox = MAX(w, h);
812 
813  if (m_eCameraType == PARALLEL)
814  {
815  m_zoomFactor = m_defaultZoomFactor * (maxSizeBoundingBox / 400) * (700 / minSizeViewport);
816  }
817  else
818  {
819  NxReal fromPersp[3] = {
820  0, 1000 * (maxSizeBoundingBox / 400) * (700 / minSizeViewport) * m_defaultZoomFactor,
821  1000 * (maxSizeBoundingBox / 400) * (700 / minSizeViewport) * m_defaultZoomFactor};
822  setFromToUp(fromPersp, to.get(), up.get());
823  }
824  }
825  m_translate = NxVec3(0, 0, 0);
827 }
828 
830 {
831  m_translate = NxVec3(0, 0, 0);
833 }
834 
835 void OGLCamera::setDefaultZoomFactor(double defaultZoomFactor)
836 {
837  m_defaultZoomFactor = defaultZoomFactor;
838 }
839 
841 {
842  m_angleAz = 0;
843  m_angleEl = 0;
844  m_angleRo = 0;
846 }
847 
848 void OGLCamera::setTranslation(double x, double y, double z)
849 {
850  m_translate = NxVec3(x, y, z);
852 }
853 
854 void OGLCamera::getTranslation(double& x, double& y, double& z)
855 {
856  x = m_translate.x;
857  y = m_translate.y;
858  z = m_translate.z;
859 }
860 
861 void OGLCamera::getPosition(double& x, double& y, double& z)
862 {
863  x = from.x;
864  y = from.y;
865  z = from.z;
866  if (m_angleAz != 0)
867  {
868  double d = from.z; // from.magnitude();
869  x = d * sin(m_angleAz * M_PI / 180.0f);
870  z = d * cos(m_angleAz * M_PI / 180.0f);
871  }
872 
873  x += m_translate.x;
874  y += m_translate.y;
875  z += m_translate.z;
876 }
All base classes related to 3D manipulation.
NxReal s
Definition: NxVec3.cpp:317
NxReal c
Definition: NxVec3.cpp:317
#define NxReal
Definition: NxVec3.h:20
#define MIN(a, b)
Definition: OGLCamera.cpp:29
#define MAX(a, b)
Definition: OGLCamera.cpp:33
CameraType
Definition: OGLCamera.h:38
@ PERSPECTIVE
Definition: OGLCamera.h:40
@ PARALLEL
Definition: OGLCamera.h:39
@ FREE
Definition: OGLCamera.h:41
Definition: NxVec3.h:23
NxReal z
Definition: NxVec3.h:80
NxReal magnitude() const
Definition: NxVec3.cpp:194
void cross(const NxVec3 &left, const NxVec3 &right)
Definition: NxVec3.cpp:207
void rotate(NxReal angle, const NxVec3 &axe)
Definition: NxVec3.cpp:318
NxReal y
Definition: NxVec3.h:80
const NxReal * get() const
Definition: NxVec3.cpp:49
NxReal distance(const NxVec3 &) const
Definition: NxVec3.cpp:199
NxReal x
Definition: NxVec3.h:80
NxVec3 flyTo
Definition: OGLCamera.h:127
double m_angleAz
Definition: OGLCamera.h:141
NxVec3 left
Definition: OGLCamera.h:125
void getViewPort(double *vp)
Definition: OGLCamera.cpp:739
NxVec3 stepUp
Definition: OGLCamera.h:127
void setDefaultZoomFactor(double defaultZoomFactor)
Definition: OGLCamera.cpp:835
void setMinMaxCurrentSide(NxReal _minSide, NxReal _maxSide, NxReal _currentSide)
Definition: OGLCamera.cpp:657
NxReal minSide
Definition: OGLCamera.h:138
NxVec3 getCenter(int sizeX, int sizeY)
Definition: OGLCamera.cpp:749
void moveDown()
Definition: OGLCamera.cpp:195
double m_angleEl
Definition: OGLCamera.h:141
double m_zoomFactor
Definition: OGLCamera.h:141
void setAngleStep(NxReal _stepAngleUpDown, NxReal _stepAngleLeftRight, NxReal _stepAngleSide)
Definition: OGLCamera.cpp:567
NxReal sinLeftRight
Definition: OGLCamera.h:129
void elevation(NxReal _angle)
Definition: OGLCamera.cpp:788
void rotateUpLockSrcKeepUpAndFront()
Definition: OGLCamera.cpp:261
static NxVec3 displayToWorld(NxVec3 display)
Definition: OGLCamera.cpp:699
void azimuth(NxReal _angle)
Definition: OGLCamera.cpp:782
NxVec3 m_translate
Definition: OGLCamera.h:143
NxVec3 flyLeft
Definition: OGLCamera.h:127
void setAllAngleStep(NxReal _angle)
Definition: OGLCamera.cpp:559
double m_angleRo
Definition: OGLCamera.h:141
NxReal stepAngleLeftRight
Definition: OGLCamera.h:129
NxVec3 flyFront
Definition: OGLCamera.h:127
void roll(NxReal _angle)
Definition: OGLCamera.cpp:794
void setModeLock(bool _modeLockUpDown, bool _modeLockLeftRight, bool _modeLockSide)
Definition: OGLCamera.cpp:635
NxReal magnitudeStepLeft
Definition: OGLCamera.h:137
void zoom(double zoomFactor)
Definition: OGLCamera.cpp:761
void getTranslation(double &x, double &y, double &z)
Definition: OGLCamera.cpp:854
void lookAt()
Definition: OGLCamera.cpp:80
void setTo(NxReal *_to)
Definition: OGLCamera.cpp:587
NxReal cosSide
Definition: OGLCamera.h:130
void rotateSideRight()
Definition: OGLCamera.cpp:367
void resetTranslation()
Definition: OGLCamera.cpp:829
static NxVec3 worldToDisplay(NxVec3 world)
Definition: OGLCamera.cpp:722
NxVec3 stepLeft
Definition: OGLCamera.h:127
void moveRight()
Definition: OGLCamera.cpp:223
NxReal currentLeftRight
Definition: OGLCamera.h:138
NxReal stepAngleSide
Definition: OGLCamera.h:130
NxReal cosUpDown
Definition: OGLCamera.h:129
NxVec3 flyUp
Definition: OGLCamera.h:127
void setUp(NxReal *_up)
Definition: OGLCamera.cpp:594
void rotateRightLockSrc()
Definition: OGLCamera.cpp:293
NxReal maxLeftRight
Definition: OGLCamera.h:138
NxVec3 stepFront
Definition: OGLCamera.h:127
void rotateDownLockSrc()
Definition: OGLCamera.cpp:249
NxReal minUpDown
Definition: OGLCamera.h:137
void setCameraType(CameraType eCameraType)
Definition: OGLCamera.cpp:138
NxReal magnitudeStepUp
Definition: OGLCamera.h:137
NxVec3 fromTo
Definition: OGLCamera.h:133
void calculateStepVectors()
Definition: OGLCamera.cpp:670
bool modeLockSide
Definition: OGLCamera.h:135
void rotateSideLeft()
Definition: OGLCamera.cpp:357
void resetZoom(int w=-1, int h=-1)
Definition: OGLCamera.cpp:800
void rotateLeftLockSrc()
Definition: OGLCamera.cpp:280
void resetRotations()
Definition: OGLCamera.cpp:840
void moveLeft()
Definition: OGLCamera.cpp:209
void setMinMaxCurrentUpDown(NxReal _minUpDown, NxReal _maxUpDown, NxReal _currentUpDown)
Definition: OGLCamera.cpp:642
NxVec3 from
Definition: OGLCamera.h:122
void rotateRightLockDst()
Definition: OGLCamera.cpp:344
NxVec3 to
Definition: OGLCamera.h:123
NxReal stepAngleUpDown
Definition: OGLCamera.h:129
NxVec3 flyFrom
Definition: OGLCamera.h:127
void setTranslation(double x, double y, double z)
Definition: OGLCamera.cpp:848
void getPosition(double &x, double &y, double &z)
Definition: OGLCamera.cpp:861
NxReal sinUpDown
Definition: OGLCamera.h:129
void rotateLeftLockDst()
Definition: OGLCamera.cpp:331
OGLCamera(NxReal *_from, NxReal *_to, NxReal *_up, int w, int h, CameraType eCameraType)
Definition: OGLCamera.cpp:36
CameraType m_eCameraType
Definition: OGLCamera.h:142
void setSize(int w, int h)
Definition: OGLCamera.cpp:74
void rotateDownLockDst()
Definition: OGLCamera.cpp:318
NxVec3 flyFromTo
Definition: OGLCamera.h:127
bool modeLockLeftRight
Definition: OGLCamera.h:135
void rotateDownLockSrcKeepUpAndFront()
Definition: OGLCamera.cpp:270
NxReal sinSide
Definition: OGLCamera.h:129
NxReal currentUpDown
Definition: OGLCamera.h:137
NxReal maxSide
Definition: OGLCamera.h:138
NxReal currentSide
Definition: OGLCamera.h:138
double m_defaultZoomFactor
Definition: OGLCamera.h:141
NxReal distanceFromTo
Definition: OGLCamera.h:132
void setDistanceStep(NxReal _magnitudeStepUp, NxReal _magnitudeStepFront, NxReal _magnitudeStepLeft)
Definition: OGLCamera.cpp:545
NxReal magnitudeStepFront
Definition: OGLCamera.h:137
void rotateUpLockSrc()
Definition: OGLCamera.cpp:237
void move(NxReal *_direction)
Definition: OGLCamera.cpp:143
void setDistanceFromToLockTo(NxReal _distanceFromTo)
Definition: OGLCamera.cpp:628
void setDistanceFromToLockFrom(NxReal _distanceFromTo)
Definition: OGLCamera.cpp:621
void moveBack()
Definition: OGLCamera.cpp:167
NxReal minLeftRight
Definition: OGLCamera.h:138
void moveFront()
Definition: OGLCamera.cpp:153
NxReal maxUpDown
Definition: OGLCamera.h:137
NxReal cosLeftRight
Definition: OGLCamera.h:129
void setFromToUp()
Definition: OGLCamera.cpp:616
NxVec3 up
Definition: OGLCamera.h:125
void setFrom(NxReal *_from)
Definition: OGLCamera.cpp:580
void moveUp()
Definition: OGLCamera.cpp:181
void rotateUpLockDst()
Definition: OGLCamera.cpp:306
NxVec3 front
Definition: OGLCamera.h:125
void setAllMinMaxCurrent(NxReal _angle)
Definition: OGLCamera.cpp:664
void setMinMaxCurrentLeftRight(NxReal _minLeftRight, NxReal _maxLeftRight, NxReal _currentLeftRight)
Definition: OGLCamera.cpp:649
bool modeLockUpDown
Definition: OGLCamera.h:135
#define M_PI
Pi.
Definition: color.cpp:25