29 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
33 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
86 glMatrixMode(GL_PROJECTION);
95 glMatrixMode(GL_PROJECTION);
105 glRotatef((
float)-
m_angleEl, (
float)elevationVector.
x, (
float)elevationVector.
y,
106 (
float)elevationVector.
z);
113 glMatrixMode(GL_PROJECTION);
125 glRotatef((
float)-
m_angleEl, (
float)elevationVector.
x, (
float)elevationVector.
y,
126 (
float)elevationVector.
z);
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];
380 to +=
up * _distance;
386 to -=
up * _distance;
546 NxReal _magnitudeStepLeft)
561 NxReal s = sin(_angle),
c = cos(_angle);
702 retValue.
x = retValue.
y = retValue.
z = 0;
705 retValueTmp.
x = retValueTmp.
y = retValueTmp.
z = 0;
708 GLfloat winX = NAN, winY = NAN, winZ = NAN;
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);
725 retValue.
x = retValue.
y = retValue.
z = 0;
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,
741 GLdouble viewport[4];
742 glGetDoublev(GL_VIEWPORT, viewport);
753 GLdouble viewport[4];
754 glGetDoublev(GL_VIEWPORT, viewport);
756 retValue.
x = ((viewport[2] + viewport[0]) / 2.0 * (
double)sizeX);
757 retValue.
y = ((viewport[3] + viewport[1]) / 2.0 * (
double)sizeY);
802 if ((w <= 0) && (h <= 0))
808 GLdouble viewport[4];
809 glGetDoublev(GL_VIEWPORT, viewport);
810 double minSizeViewport =
MIN(viewport[2], viewport[3]);
811 double maxSizeBoundingBox =
MAX(w, h);
All base classes related to 3D manipulation.
void cross(const NxVec3 &left, const NxVec3 &right)
void rotate(NxReal angle, const NxVec3 &axe)
const NxReal * get() const
NxReal distance(const NxVec3 &) const
void getViewPort(double *vp)
void setDefaultZoomFactor(double defaultZoomFactor)
void setMinMaxCurrentSide(NxReal _minSide, NxReal _maxSide, NxReal _currentSide)
NxVec3 getCenter(int sizeX, int sizeY)
void setAngleStep(NxReal _stepAngleUpDown, NxReal _stepAngleLeftRight, NxReal _stepAngleSide)
void elevation(NxReal _angle)
void rotateUpLockSrcKeepUpAndFront()
static NxVec3 displayToWorld(NxVec3 display)
void azimuth(NxReal _angle)
void setAllAngleStep(NxReal _angle)
NxReal stepAngleLeftRight
void setModeLock(bool _modeLockUpDown, bool _modeLockLeftRight, bool _modeLockSide)
void zoom(double zoomFactor)
void getTranslation(double &x, double &y, double &z)
static NxVec3 worldToDisplay(NxVec3 world)
void rotateRightLockSrc()
void setCameraType(CameraType eCameraType)
void calculateStepVectors()
void resetZoom(int w=-1, int h=-1)
void setMinMaxCurrentUpDown(NxReal _minUpDown, NxReal _maxUpDown, NxReal _currentUpDown)
void rotateRightLockDst()
void setTranslation(double x, double y, double z)
void getPosition(double &x, double &y, double &z)
OGLCamera(NxReal *_from, NxReal *_to, NxReal *_up, int w, int h, CameraType eCameraType)
void setSize(int w, int h)
void rotateDownLockSrcKeepUpAndFront()
double m_defaultZoomFactor
void setDistanceStep(NxReal _magnitudeStepUp, NxReal _magnitudeStepFront, NxReal _magnitudeStepLeft)
NxReal magnitudeStepFront
void move(NxReal *_direction)
void setDistanceFromToLockTo(NxReal _distanceFromTo)
void setDistanceFromToLockFrom(NxReal _distanceFromTo)
void setFrom(NxReal *_from)
void setAllMinMaxCurrent(NxReal _angle)
void setMinMaxCurrentLeftRight(NxReal _minLeftRight, NxReal _maxLeftRight, NxReal _currentLeftRight)