Code_TYMPAN  4.2.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 
21 
22 #include "OGLCamera.h"
24 
25 #if _WIN32
26 #include <windows.h>
27 #endif //_WIN32
28 
29 #ifndef MIN
30 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
31 #endif
32 
33 #ifndef MAX
34 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
35 #endif
36 
37 OGLCamera::OGLCamera(NxReal* _from, NxReal* _to, NxReal* _up, int w, int h, CameraType eCameraType)
38 {
39  m_w = w;
40  m_h = h;
41  setFromToUp(_from, _to, _up);
42  setAllAngleStep(0.1);
43  setModeLock(false, false, false);
44  m_zoomFactor = 1.0;
45  m_eCameraType = eCameraType;
46 
47  switch (m_eCameraType)
48  {
49  case PARALLEL:
50  {
51  m_defaultZoomFactor = 0.29; // le facteur par defaut est pour un monde de 400 de MAX(larg,haut) et 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 un viewport 700 de MIN(larg,haut)
57  }
58  break;
59  case FREE:
60  {
61  m_defaultZoomFactor = 1; // le facteur par defaut est pour un monde de 400 de MAX(larg,haut) et un viewport 700 de MIN(larg,haut)
62  }
63  break;
64  }
65 
66  m_angleAz = 0;
67  m_angleEl = 0;
68  m_angleRo = 0;
69  m_translate = NxVec3(0, 0, 0);
70 }
71 
72 void OGLCamera::setSize(int w, int h)
73 {
74  m_w = w;
75  m_h = h;
76 }
77 
79 {
80  switch (m_eCameraType)
81  {
82  case PARALLEL:
83  {
84  glMatrixMode(GL_PROJECTION);
85  glLoadIdentity();
86  glOrtho(-m_w * m_zoomFactor, m_w * m_zoomFactor, -m_h * m_zoomFactor, m_h * m_zoomFactor, 1, 1000);
87  gluLookAt(from.x, from.y, from.z, to.x, to.y, to.z, up.x, up.y, up.z);
88  }
89  break;
90  case PERSPECTIVE:
91  {
92  glMatrixMode(GL_PROJECTION);
93  glLoadIdentity();
94  gluPerspective(30 * m_zoomFactor, (double)m_w / m_h, 10, 50000); // Initialement 1, 50000
95  gluLookAt(from.x, from.y, from.z, to.x, to.y, to.z, up.x, up.y, up.z);
96 
97  //Roll
98  glRotatef((float)m_angleRo, (float)front.x, (float)front.y, (float)front.z);/* orbit the front axis */
99  //Elevation
100  NxVec3 elevationVector = up.cross(fromTo);
101  glRotatef((float) - m_angleEl, (float)elevationVector.x, (float)elevationVector.y, (float)elevationVector.z); /* orbit the UP axis */
102  //Azhimut
103  glRotatef((float) - m_angleAz, (float)up.x, (float)up.y, (float)up.z); /* orbit the Y*Z axis */
104  }
105  break;
106  case FREE:
107  {
108  glMatrixMode(GL_PROJECTION);
109  glLoadIdentity();
110  gluPerspective(30 * m_zoomFactor, (double)m_w / m_h, 1, 5000); // Initialement 1, 50000
111  gluLookAt(from.x, from.y, from.z, to.x, to.y, to.z, up.x, up.y, up.z);
112 
113  glTranslatef((float) - flyFromTo.x, (float) - flyFromTo.y, (float) - flyFromTo.z);
114 
115  //Roll
116  glRotatef((float)m_angleRo, (float)front.x, (float)front.y, (float)front.z);/* orbit the front axis */
117  //Elevation
118  NxVec3 elevationVector = up.cross(fromTo);
119  glRotatef((float) - m_angleEl, (float)elevationVector.x, (float)elevationVector.y, (float)elevationVector.z); /* orbit the UP axis */
120  //Azhimut
121  glRotatef((float) - m_angleAz, (float)up.x, (float)up.y, (float)up.z); /* orbit the Y*Z axis */
122 
123  glTranslatef((float)flyFromTo.x, (float)flyFromTo.y, (float)flyFromTo.z);
124 
125  glTranslatef((float) - m_translate.x, (float) - m_translate.y, (float) - m_translate.z);
126  }
127  break;
128  }
129 }
130 
132 {
133  m_eCameraType = eCameraType;
134 }
135 
136 void OGLCamera::move(NxReal* _direction)
137 {
138  from.x += _direction[0]; from.y += _direction[1]; from.z += _direction[2];
139  to.x += _direction[0]; to.y += _direction[1]; to.z += _direction[2];
140 }
141 
143 {
144  if (m_eCameraType == FREE)
145  {
148  }
149  else
150  {
151  from += stepFront;
152  to += stepFront;
153  }
154 }
155 
157 {
158  if (m_eCameraType == FREE)
159  {
162  }
163  else
164  {
165  from -= stepFront;
166  to -= stepFront;
167  }
168 }
169 
171 {
172  if (m_eCameraType == FREE)
173  {
174  m_translate += stepUp;
176  }
177  else
178  {
179  from += stepUp;
180  to += stepUp;
181  }
182 }
183 
185 {
186  if (m_eCameraType == FREE)
187  {
188  m_translate -= stepUp;
190  }
191  else
192  {
193  from -= stepUp;
194  to -= stepUp;
195  }
196 }
197 
199 {
200  if (m_eCameraType == FREE)
201  {
204  }
205  else
206  {
207  from += stepLeft;
208  to += stepLeft;
209  }
210 }
211 
213 {
214  if (m_eCameraType == FREE)
215  {
218  }
219  else
220  {
221  from -= stepLeft;
222  to -= stepLeft;
223  }
224 }
225 
227 {
229  {
231  front.rotate(left);
233  to = from + fromTo;
235  }
236 }
238 {
240  {
242  front.rotate(left);
244  to = from + fromTo;
246  }
247 }
249 {
251  {
253  to = from + fromTo;
254  }
255 }
257 {
259  {
261  to = from + fromTo;
262  }
263 }
264 
266 {
268  {
270  front.rotate(up);
271  fromTo.rotate(up);
272  to = from + fromTo;
274  }
275 }
276 
278 {
280  {
282  front.rotate(up);
283  fromTo.rotate(up);
284  to = from + fromTo;
286  }
287 }
288 
290 {
292  {
294  front.rotate(left);
296  from = to - fromTo;
298  }
299 }
301 {
303  {
305  front.rotate(left);
307  from = to - fromTo;
309  }
310 }
311 
313 {
315  {
317  front.rotate(up);
318  fromTo.rotate(up);
319  from = to - fromTo;
321  }
322 }
323 
325 {
327  {
329  front.rotate(up);
330  fromTo.rotate(up);
331  from = to - fromTo;
333  }
334 }
335 
337 {
339  {
341  left.rotate(front);
343  }
344 }
345 
347 {
349  {
351  left.rotate(front);
353  }
354 }
355 
356 void OGLCamera::moveUp(NxReal _distance)
357 {
358  from += up * _distance;
359  to += up * _distance;
360 }
361 
363 {
364  from -= up * _distance;
365  to -= up * _distance;
366 }
367 
369 {
370  from += front * _distance;
371  to += front * _distance;
372 }
373 
375 {
376  from -= front * _distance;
377  to -= front * _distance;
378 }
379 
381 {
382  from += left * _distance;
383  to += left * _distance;
384 }
385 
387 {
388  from -= left * _distance;
389  to -= left * _distance;
390 }
391 
393 {
394  if (!modeLockUpDown || (currentUpDown + _angle <= maxUpDown && (currentUpDown += _angle)))
395  {
396  up.rotate(-_angle, left);
397  front.rotate(left);
399  to = from + fromTo;
401  }
402 }
404 {
405  if (!modeLockUpDown || (currentUpDown + _angle <= maxUpDown && (currentUpDown += _angle)))
406  {
407  up.rotate(-_angle, left);
408  front.rotate(left);
410  from = to - fromTo;
412  }
413 }
415 {
416  if (!modeLockUpDown || (currentUpDown - _angle >= minUpDown && (currentUpDown -= _angle)))
417  {
418  up.rotate(_angle, left);
419  front.rotate(left);
421  to = from + fromTo;
423  }
424 }
425 
427 {
428  if (!modeLockUpDown || (currentUpDown + _angle <= maxUpDown && (currentUpDown += _angle)))
429  {
430  fromTo.rotate(-_angle, left);
431  to = from + fromTo;
432  }
433 }
434 
436 {
437  if (!modeLockUpDown || (currentUpDown - _angle >= minUpDown && (currentUpDown -= _angle)))
438  {
439  fromTo.rotate(_angle, left);
440  to = from + fromTo;
441  }
442 }
443 
445 {
446  if (!modeLockLeftRight || (currentLeftRight + _angle <= maxLeftRight && (currentLeftRight += _angle)))
447  {
448  left.rotate(_angle, up);
449  front.rotate(up);
451  to = from + fromTo;
453  }
454 }
455 
457 {
458  if (!modeLockLeftRight || (currentLeftRight - _angle >= minLeftRight && (currentLeftRight -= _angle)))
459  {
460  left.rotate(-_angle, up);
461  front.rotate(up);
463  to = from + fromTo;
465  }
466 }
467 
468 
469 
471 {
472  if (!modeLockUpDown || (currentUpDown - _angle >= minUpDown && (currentUpDown -= _angle)))
473  {
474  up.rotate(_angle, left);
475  front.rotate(left);
477  from = to - fromTo;
479  }
480 }
481 
483 {
484  if (!modeLockLeftRight || (currentLeftRight + _angle <= maxLeftRight && (currentLeftRight += _angle)))
485  {
486  left.rotate(_angle, up);
487  front.rotate(up);
488  fromTo.rotate(up);
489  from = to - fromTo;
491  }
492 }
493 
495 {
496  if (!modeLockLeftRight || (currentLeftRight - _angle >= minLeftRight && (currentLeftRight -= _angle)))
497  {
498  left.rotate(-_angle, up);
499  front.rotate(up);
500  fromTo.rotate(up);
501  from = to - fromTo;
503  }
504 }
505 
507 {
508  if (!modeLockSide || (currentSide + _angle <= maxSide && (currentSide += _angle)))
509  {
510  up.rotate(_angle, front);
511  left.rotate(front);
513  }
514 }
515 
517 {
518  if (!modeLockSide || (currentSide - _angle >= minSide && (currentSide -= _angle)))
519  {
520  up.rotate(-_angle, front);
521  left.rotate(front);
523  }
524 }
525 
526 void OGLCamera::setDistanceStep(NxReal _magnitudeStepUp, NxReal _magnitudeStepFront, NxReal _magnitudeStepLeft)
527 {
529  magnitudeStepUp = _magnitudeStepUp;
532  magnitudeStepFront = _magnitudeStepFront;
535  magnitudeStepLeft = _magnitudeStepLeft;
537 }
538 
540 {
541  NxReal s = sin(_angle), c = cos(_angle);
545 }
546 
547 void OGLCamera::setAngleStep(NxReal _stepAngleUpDown, NxReal _stepAngleLeftRight, NxReal _stepAngleSide)
548 {
549  sinUpDown = sin(_stepAngleUpDown);
550  sinLeftRight = sin(_stepAngleLeftRight);
551  stepAngleUpDown = _stepAngleUpDown;
552  sinSide = sin(_stepAngleSide);
553  cosUpDown = cos(_stepAngleUpDown);
554  stepAngleLeftRight = _stepAngleLeftRight;
555  cosLeftRight = cos(_stepAngleLeftRight);
556  cosSide = cos(_stepAngleSide);
557  stepAngleSide = _stepAngleSide;
558 }
559 
561 {
562  to += NxVec3(_from) - from;
563  from = NxVec3(_from);
565 }
566 
568 {
569  from += NxVec3(_to) - to;
570  to = NxVec3(_to);
572 }
573 
575 {
576  up = NxVec3(_up);
578 }
579 
580 void OGLCamera::setFromToUp(NxReal* _from, NxReal* _to, NxReal* _up)
581 {
582  from = NxVec3(_from);
583  to = NxVec3(_to);
584  up = NxVec3(_up, true);
585  front = NxVec3(to - from, true);
586  fromTo = to - from;
587  left.cross(up, front, true);
588 
590  magnitudeStepUp = 1;
591  magnitudeStepFront = 1;
592  magnitudeStepLeft = 1;
594 }
595 
597 {
598  setFromToUp(from.get(), to.get(), up.get());
599 }
600 
602 {
603  fromTo *= _distanceFromTo / distanceFromTo;
604  distanceFromTo = _distanceFromTo;
605  to = from + fromTo;
606 }
607 
609 {
610  fromTo *= _distanceFromTo / distanceFromTo;
611  distanceFromTo = _distanceFromTo;
612  from = to - fromTo;
613 }
614 
615 void OGLCamera::setModeLock(bool _modeLockUpDown, bool _modeLockLeftRight, bool _modeLockSide)
616 {
617  modeLockUpDown = _modeLockUpDown;
618  modeLockLeftRight = _modeLockLeftRight;
619  modeLockSide = _modeLockSide;
620 }
621 
622 void OGLCamera::setMinMaxCurrentUpDown(NxReal _minUpDown, NxReal _maxUpDown, NxReal _currentUpDown)
623 {
624  minUpDown = _minUpDown;
625  maxUpDown = _maxUpDown;
626  currentUpDown = _currentUpDown;
627 }
628 
629 void OGLCamera::setMinMaxCurrentLeftRight(NxReal _minLeftRight, NxReal _maxLeftRight, NxReal _currentLeftRight)
630 {
631  minLeftRight = _minLeftRight;
632  maxLeftRight = _maxLeftRight;
633  currentLeftRight = _currentLeftRight;
634 }
635 
636 void OGLCamera::setMinMaxCurrentSide(NxReal _minSide, NxReal _maxSide, NxReal _currentSide)
637 {
638  minSide = _minSide;
639  maxSide = _maxSide;
640  currentSide = _currentSide;
641 }
642 
644 {
645  minUpDown
646  = maxUpDown
647  = currentUpDown
648  = minLeftRight
649  = maxLeftRight
651  = minSide
652  = maxSide
653  = currentSide
654  = _angle;
655 }
656 
658 {
659  if (m_eCameraType != FREE)
660  {
661  double dist = from.distance(NxVec3(0, 0, 0));
662  stepLeft = left * magnitudeStepLeft * ((dist + 1) / 1000);
663  stepFront = front * magnitudeStepFront * ((dist + 1) / 1000);
664  stepUp = up * magnitudeStepUp * ((dist + 1) / 1000);
665  }
666  else
667  {
668  flyTo = to + m_translate;
670  flyFromTo = flyTo - flyFrom;
671  flyUp = up;// + m_translate;
673  flyFront = NxVec3(flyTo - flyFrom, true);
674 
675  flyLeft.cross(flyUp, flyFront, true);
676  flyLeft.rotate((M_PI * m_angleAz) / 180, flyUp);
677  flyFront.rotate((M_PI * m_angleAz) / 180, flyUp);
678  flyFront.rotate((M_PI * m_angleEl) / 180, flyLeft);
679 
683  }
684 }
685 
687 {
688  NxVec3 retValue;
689  retValue.x = retValue.y = retValue.z = 0;
690 
691  NxVec3 retValueTmp;
692  retValueTmp.x = retValueTmp.y = retValueTmp.z = 0;
693 
694  glLoadIdentity();
695  GLfloat winX, winY, winZ;
696  GLint viewport[4];
697  GLdouble mvmatrix[16], projmatrix[16];
698  glGetDoublev(GL_MODELVIEW_MATRIX, mvmatrix);
699  glGetDoublev(GL_PROJECTION_MATRIX, projmatrix);
700  glGetIntegerv(GL_VIEWPORT, viewport);
701  winX = (float)display.x;
702  winY = (float)display.y;
703  winZ = (float)display.z;
704  gluUnProject(winX, winY, winZ, mvmatrix, projmatrix, viewport, &retValue.x, &retValue.y, &retValue.z);
705 
706  return retValue;
707 }
708 
710 {
711  NxVec3 retValue;
712  retValue.x = retValue.y = retValue.z = 0;
713 
714  //glLoadIdentity();
715  GLint viewport[4];
716  GLdouble mvmatrix[16], projmatrix[16];
717  glGetDoublev(GL_MODELVIEW_MATRIX, mvmatrix);
718  glGetDoublev(GL_PROJECTION_MATRIX, projmatrix);
719  glGetIntegerv(GL_VIEWPORT, viewport);
720  gluProject(world.x, world.y, world.z, mvmatrix, projmatrix, viewport, &retValue.x, &retValue.y, &retValue.z);
721 
722  return retValue;
723 }
724 
725 void OGLCamera::getViewPort(double* vp)
726 {
727  GLdouble viewport[4];
728  glGetDoublev(GL_VIEWPORT, viewport);
729  vp[0] = viewport[0];
730  vp[1] = viewport[1];
731  vp[2] = viewport[2];
732  vp[3] = viewport[3];
733 }
734 
735 NxVec3 OGLCamera::getCenter(int sizeX, int sizeY)
736 {
737  NxVec3 retValue;
738 
739  GLdouble viewport[4];
740  glGetDoublev(GL_VIEWPORT, viewport);
741 
742  retValue.x = ((viewport[2] + viewport[0]) / 2.0 * (double)sizeX);
743  retValue.y = ((viewport[3] + viewport[1]) / 2.0 * (double)sizeY);
744  return retValue;
745 }
746 
747 void OGLCamera::zoom(double zoomFactor)
748 {
749  if (m_eCameraType != PARALLEL)
750  {
752  if (zoomFactor < 1)
753  {
754  moveFront();
755  }
756  else
757  {
758  moveBack();
759  }
761  }
762  else
763  {
764  m_zoomFactor *= zoomFactor;
765  }
766 }
767 
769 {
770  m_angleAz += (_angle * 500);
772 }
773 
775 {
776  m_angleEl += (_angle * 500);
778 }
779 
781 {
782  m_angleRo += (_angle * 500);
784 }
785 
786 void OGLCamera::resetZoom(int w /*= -1*/, int h /*= -1*/)
787 {
788  if ((w <= 0) && (h <= 0))
789  {
791  }
792  else
793  {
794  GLdouble viewport[4];
795  glGetDoublev(GL_VIEWPORT, viewport);
796  double minSizeViewport = MIN(viewport[2], viewport[3]);
797  double maxSizeBoundingBox = MAX(w, h);
798 
799  if (m_eCameraType == PARALLEL)
800  {
801  m_zoomFactor = m_defaultZoomFactor * (maxSizeBoundingBox / 400) * (700 / minSizeViewport);
802  }
803  else
804  {
805  NxReal fromPersp[3] = {0, 1000 * (maxSizeBoundingBox / 400)* (700 / minSizeViewport)* m_defaultZoomFactor, 1000 * (maxSizeBoundingBox / 400)* (700 / minSizeViewport)* m_defaultZoomFactor};
806  setFromToUp(fromPersp, to.get(), up.get());
807  }
808  }
809  m_translate = NxVec3(0, 0, 0);
811 }
812 
814 {
815  m_translate = NxVec3(0, 0, 0);
817 }
818 
819 void OGLCamera::setDefaultZoomFactor(double defaultZoomFactor)
820 {
821  m_defaultZoomFactor = defaultZoomFactor ;
822 }
823 
825 {
826  m_angleAz = 0;
827  m_angleEl = 0;
828  m_angleRo = 0;
830 }
831 
832 void OGLCamera::setTranslation(double x, double y, double z)
833 {
834  m_translate = NxVec3(x, y, z);
836 }
837 
838 void OGLCamera::getTranslation(double& x, double& y, double& z)
839 {
840  x = m_translate.x;
841  y = m_translate.y;
842  z = m_translate.z;
843 }
844 
845 void OGLCamera::getPosition(double& x, double& y, double& z)
846 {
847  x = from.x;
848  y = from.y;
849  z = from.z;
850  if (m_angleAz != 0)
851  {
852  double d = from.z; //from.magnitude();
853  x = d * sin(m_angleAz * M_PI / 180.0f);
854  z = d * cos(m_angleAz * M_PI / 180.0f);
855  }
856 
857  x += m_translate.x;
858  y += m_translate.y;
859  z += m_translate.z;
860 }
void moveDown()
Definition: OGLCamera.cpp:184
void moveRight()
Definition: OGLCamera.cpp:212
void setMinMaxCurrentLeftRight(NxReal _minLeftRight, NxReal _maxLeftRight, NxReal _currentLeftRight)
Definition: OGLCamera.cpp:629
CameraType m_eCameraType
Definition: OGLCamera.h:166
NxVec3 front
Definition: OGLCamera.h:117
NxReal y
Definition: NxVec3.h:80
Definition: NxVec3.h:22
void getTranslation(double &x, double &y, double &z)
Definition: OGLCamera.cpp:838
void rotateDownLockSrc()
Definition: OGLCamera.cpp:237
void lookAt()
Definition: OGLCamera.cpp:78
void rotateRightLockDst()
Definition: OGLCamera.cpp:324
void resetTranslation()
Definition: OGLCamera.cpp:813
void setAllMinMaxCurrent(NxReal _angle)
Definition: OGLCamera.cpp:643
void setTranslation(double x, double y, double z)
Definition: OGLCamera.cpp:832
void azimuth(NxReal _angle)
Definition: OGLCamera.cpp:768
NxVec3 getCenter(int sizeX, int sizeY)
Definition: OGLCamera.cpp:735
bool modeLockSide
Definition: OGLCamera.h:147
NxReal sinSide
Definition: OGLCamera.h:134
NxVec3 flyFrom
Definition: OGLCamera.h:117
NxReal stepAngleLeftRight
Definition: OGLCamera.h:134
NxReal currentLeftRight
Definition: OGLCamera.h:151
#define MIN(a, b)
Definition: OGLCamera.cpp:30
void rotateUpLockSrc()
Definition: OGLCamera.cpp:226
NxReal stepAngleSide
Definition: OGLCamera.h:134
Definition: OGLCamera.h:37
void rotate(NxReal angle, const NxVec3 &axe)
Definition: NxVec3.cpp:346
void moveFront()
Definition: OGLCamera.cpp:142
void setModeLock(bool _modeLockUpDown, bool _modeLockLeftRight, bool _modeLockSide)
Definition: OGLCamera.cpp:615
void rotateSideLeft()
Definition: OGLCamera.cpp:336
NxReal maxLeftRight
Definition: OGLCamera.h:151
void setTo(NxReal *_to)
Definition: OGLCamera.cpp:567
static NxVec3 worldToDisplay(NxVec3 world)
Definition: OGLCamera.cpp:709
void getPosition(double &x, double &y, double &z)
Definition: OGLCamera.cpp:845
#define NxReal
Definition: NxVec3.h:20
void calculateStepVectors()
Definition: OGLCamera.cpp:657
void setFromToUp()
Definition: OGLCamera.cpp:596
void setDefaultZoomFactor(double defaultZoomFactor)
Definition: OGLCamera.cpp:819
void setFrom(NxReal *_from)
Definition: OGLCamera.cpp:560
NxReal s
Definition: NxVec3.cpp:345
void moveBack()
Definition: OGLCamera.cpp:156
NxReal currentUpDown
Definition: OGLCamera.h:151
NxReal stepAngleUpDown
Definition: OGLCamera.h:134
NxReal magnitude() const
Definition: NxVec3.cpp:212
void moveLeft()
Definition: OGLCamera.cpp:198
NxReal magnitudeStepUp
Definition: OGLCamera.h:151
NxVec3 flyUp
Definition: OGLCamera.h:117
NxReal cosSide
Definition: OGLCamera.h:134
void setMinMaxCurrentUpDown(NxReal _minUpDown, NxReal _maxUpDown, NxReal _currentUpDown)
Definition: OGLCamera.cpp:622
void rotateUpLockDst()
Definition: OGLCamera.cpp:289
static NxVec3 displayToWorld(NxVec3 display)
Definition: OGLCamera.cpp:686
void setDistanceFromToLockTo(NxReal _distanceFromTo)
Definition: OGLCamera.cpp:608
void setAllAngleStep(NxReal _angle)
Definition: OGLCamera.cpp:539
NxReal magnitudeStepFront
Definition: OGLCamera.h:151
NxReal c
Definition: NxVec3.cpp:345
void setDistanceFromToLockFrom(NxReal _distanceFromTo)
Definition: OGLCamera.cpp:601
void setAngleStep(NxReal _stepAngleUpDown, NxReal _stepAngleLeftRight, NxReal _stepAngleSide)
Definition: OGLCamera.cpp:547
double m_angleRo
Definition: OGLCamera.h:165
NxReal cosLeftRight
Definition: OGLCamera.h:134
void setSize(int w, int h)
Definition: OGLCamera.cpp:72
NxReal minUpDown
Definition: OGLCamera.h:151
void moveUp()
Definition: OGLCamera.cpp:170
NxReal minSide
Definition: OGLCamera.h:151
void roll(NxReal _angle)
Definition: OGLCamera.cpp:780
void resetRotations()
Definition: OGLCamera.cpp:824
#define MAX(a, b)
Definition: OGLCamera.cpp:34
NxReal currentSide
Definition: OGLCamera.h:151
const NxReal * get() const
Definition: NxVec3.cpp:53
void resetZoom(int w=-1, int h=-1)
Definition: OGLCamera.cpp:786
NxReal cosUpDown
Definition: OGLCamera.h:134
double m_angleAz
Definition: OGLCamera.h:165
void rotateRightLockSrc()
Definition: OGLCamera.cpp:277
bool modeLockUpDown
Definition: OGLCamera.h:147
NxReal x
Definition: NxVec3.h:80
void rotateLeftLockSrc()
Definition: OGLCamera.cpp:265
NxVec3 from
Definition: OGLCamera.h:117
void cross(const NxVec3 &left, const NxVec3 &right)
Definition: NxVec3.cpp:227
NxVec3 to
Definition: OGLCamera.h:117
void zoom(double zoomFactor)
Definition: OGLCamera.cpp:747
void rotateSideRight()
Definition: OGLCamera.cpp:346
bool modeLockLeftRight
Definition: OGLCamera.h:147
NxVec3 fromTo
Definition: OGLCamera.h:145
void elevation(NxReal _angle)
Definition: OGLCamera.cpp:774
void setCameraType(CameraType eCameraType)
Definition: OGLCamera.cpp:131
void move(NxReal *_direction)
Definition: OGLCamera.cpp:136
void rotateLeftLockDst()
Definition: OGLCamera.cpp:312
NxReal maxUpDown
Definition: OGLCamera.h:151
double m_angleEl
Definition: OGLCamera.h:165
void rotateDownLockDst()
Definition: OGLCamera.cpp:300
NxReal z
Definition: NxVec3.h:80
void rotateUpLockSrcKeepUpAndFront()
Definition: OGLCamera.cpp:248
NxReal maxSide
Definition: OGLCamera.h:151
NxReal sinLeftRight
Definition: OGLCamera.h:134
NxVec3 up
Definition: OGLCamera.h:117
NxReal minLeftRight
Definition: OGLCamera.h:151
NxVec3 flyFront
Definition: OGLCamera.h:117
NxVec3 m_translate
Definition: OGLCamera.h:167
NxReal sinUpDown
Definition: OGLCamera.h:134
NxVec3 left
Definition: OGLCamera.h:117
void setDistanceStep(NxReal _magnitudeStepUp, NxReal _magnitudeStepFront, NxReal _magnitudeStepLeft)
Definition: OGLCamera.cpp:526
NxVec3 stepFront
Definition: OGLCamera.h:117
double m_zoomFactor
Definition: OGLCamera.h:165
#define M_PI
Pi.
Definition: color.cpp:24
OGLCamera(NxReal *_from, NxReal *_to, NxReal *_up, int w, int h, CameraType eCameraType)
Definition: OGLCamera.cpp:37
void setMinMaxCurrentSide(NxReal _minSide, NxReal _maxSide, NxReal _currentSide)
Definition: OGLCamera.cpp:636
NxReal distanceFromTo
Definition: OGLCamera.h:144
void rotateDownLockSrcKeepUpAndFront()
Definition: OGLCamera.cpp:256
void setUp(NxReal *_up)
Definition: OGLCamera.cpp:574
NxVec3 flyLeft
Definition: OGLCamera.h:117
NxReal distance(const NxVec3 &) const
Definition: NxVec3.cpp:218
NxReal magnitudeStepLeft
Definition: OGLCamera.h:151
CameraType
Definition: OGLCamera.h:37
NxVec3 flyFromTo
Definition: OGLCamera.h:117
double m_defaultZoomFactor
Definition: OGLCamera.h:165
NxVec3 stepUp
Definition: OGLCamera.h:117
void getViewPort(double *vp)
Definition: OGLCamera.cpp:725
NxVec3 flyTo
Definition: OGLCamera.h:117
NxVec3 stepLeft
Definition: OGLCamera.h:117