void Camera::reset() { projectionType = 0; fovy = 45; left = -1.0; right = 1.0; bottom = -1.0; top = 1.0; zNear = 0.1; zFar = 20.0; xDepth = 0.0; yDepth = 0.0; zDepth = 0.0; xAngle = 0.0; yAngle = 0.0; zAngle = 0.0; xHead = 0.0; yHead = 0.0; zHead = 0.0; xHeadAngle = 0.0; yHeadAngle = 0.0; zHeadAngle = 0.0; oldTranslationVector = initialTranslationVector; translationVector = oldTranslationVector; calculateTranslationVector(); }
void Camera::headMovement(int usernum, double x, double y, double z) { //mm to meters and cast to float calculateTranslationVector(); getModelViewMatrix(); vec4 originCentric = modelViewMatrix * vec4(x/250.0,y/250.0,z/250.0,1.0); if (originCentric.z != 0) { float ysin = originCentric.x/originCentric.z; float xcos = originCentric.y/originCentric.z; if (ysin > 1) ysin = 1; else if (ysin < -1) ysin = -1; if (xcos > 1) xcos = 1; else if (xcos < -1) xcos = -1; yHeadAngle = -atan(ysin); xHeadAngle = -atan(xcos); } moveCamera(xHead-(float)(x/250.0), yHead -(float)(y/250.0), zHead +(float)(z/250.0)); xHead = (float)(x/250.0); yHead = (float)(y/250.0); zHead = -(float)(z/250.0); // printf("%d - (%6.2f, %6.2f, %6.2f) ==> (%6.2f,%6.2f,%6.2f), yaw=%f, pitch=%f\n", usernum,x,y,z,xHead, yHead, zHead, xHeadAngle, yHeadAngle); }
void Camera::moveCamera(float _xDepth, float _yDepth, float _zDepth) { oldTranslationVector = translationVector; xDepth = _xDepth; yDepth = _yDepth; zDepth = _zDepth; calculateTranslationVector(); }
void SpelchkCamera::moveCamera( float xDepth, float yDepth, float zDepth ) { _oldTranslationVector = _translationVector; _oldCameraPosition = _cameraPosition; _xDepth = xDepth; _yDepth = yDepth; _zDepth = zDepth; calculateTranslationVector(); calculateCameraPosition(); }
void Camera::rotateCamera(float _xAngle, float _yAngle, float _zAngle) { xAngle += _xAngle; yAngle += _yAngle; zAngle += _zAngle; // Keep camera from flipping over if(xAngle > 90.0) { xAngle = 90.0; } else if(xAngle < -90) { xAngle = -90; } calculateTranslationVector(); }
void SpelchkCamera::rotateCamera( float xAngle, float yAngle, float zAngle ) { _xAngle += xAngle; _yAngle += yAngle; _zAngle += zAngle; // Keep camera from flipping over if ( _xAngle > 90.0 ) { _xAngle = 90.0; } else if ( _xAngle < -90 ) { _xAngle = -90; } calculateTranslationVector(); }
void SpelchkCamera::reset() { _projectionType = 0; _fovy = 45; _left = -1.0; _right = 1.0; _bottom = -1.0; _top = 1.0; _zNear = 0.1; _zFar = 20.0; _xDepth = 0.0; _yDepth = 0.0; _zDepth = 0.0; _xAngle = 0.0; _yAngle = 0.0; _zAngle = 0.0; _xHead = 0.0; _yHead = 0.0; _zHead = 0.0; _xHeadAngle = 0.0; _yHeadAngle = 0.0; _zHeadAngle = 0.0; _oldTranslationVector = _initialTranslationVector; _translationVector = _oldTranslationVector; _oldCameraPosition = _initialTranslationVector; _cameraPosition = _oldCameraPosition; calculateTranslationVector(); calculateCameraPosition(); }