Commit ed81dd08 authored by Robert Menzel's avatar Robert Menzel

renamed eye distance as it stores the distance betwen the pipils, not the eyes

parent e35c4847
......@@ -108,11 +108,11 @@ class GenericCamera
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Set the distance between the eyes (only needed for stereo rendering).
* @param _eyeDistance Inter pupil distance in meter(!) (distance between the centers of the eyes)
* Set the distance between the pupils (only needed for stereo rendering).
* @param _interpupillaryDistance Inter pupil distance in meter(!) (distance between the centers of the eyes)
*/
void setEyeDistance( float _eyeDistance ) { mEyeDistance = _eyeDistance; }
float getEyeDistance() const { return mEyeDistance; }
void setInterpupillaryDistance( float _interpupillaryDistance ) { mInterpupillaryDistance = _interpupillaryDistance; }
float getInterpupillaryDistance() const { return mInterpupillaryDistance; }
/**
* Set the projection mode of the camera.
......@@ -358,17 +358,6 @@ class GenericCamera
void FPSstyleLookAround( float _deltaX, float _deltaY );
private:
/// the Matrix with the camera position/orientation.
/// eyeShift is the half of the eyeDistance (can be 0 if we don't want stereo)
/// toeInValue is the value of how many degrees the camera will be looking to the right/left for toe in
//glm::mat4 getCameraMatrix( float _eyeShift = 0.0f, float _toeInValue = 0.0f );
/// the projection matrix
/// for non-symetric projections set eyeShift != 0.
/// this is used for off-axis projections (value in meters, negativ for the left eye)
//glm::mat4 getPerspectiveProjectionMatrix( float _eyeShift = 0.0f );
///
/// States: update the storeStateToString() & setStateFromString() functions whenever adding a new state!
///
......@@ -391,10 +380,10 @@ class GenericCamera
/// Current aspect ratio: width/height.
float mAspectRatio;
/// Distance of the eyes for stereo projection. In that case, the left eye is 0.5*eyeDistance
/// shifted to the left of position and the right eye is 0.5*eyeDistance to the right shifted.
/// Distance of the eyes for stereo projection. In that case, the left eye is 0.5*InterpupillaryDistance
/// shifted to the left of position and the right eye is 0.5*InterpupillaryDistance to the right shifted.
/// We assume that 1 unit equals 1 meter. The mean eye distance is 6.5 cm == 0.065 units
float mEyeDistance;
float mInterpupillaryDistance;
/// Current camera near clipping plane
float mNearClippingPlane;
......
......@@ -27,7 +27,7 @@ GenericCamera::GenericCamera() :
mCurrentEye(EYE_LEFT),
mHorizontalFieldOfView(75.0),
mAspectRatio( 4.0/3.0 ),
mEyeDistance( 0.065 ), // 0.065 m = 6.5 cm = mean human eye distance
mInterpupillaryDistance( 0.064 ), // 0.064 m = 6.4 cm - mean human eye distance: 6.47cm (male), 6.23cm (female)
mNearClippingPlane(0.1), // 10 cm
mFarClippingPlane(5000.0), // 5000 meter
mLookAtDistance(500.0) // half a kilometer away of the screen
......@@ -206,7 +206,7 @@ glm::mat4 GenericCamera::getStereoViewMatrix( bool _leftEye, StereoMode _stereoM
// so only the stereo mode has to be checked.
assert( _stereoMode != MONO && "mono is not a stereo mode!" );
float cameraPositionShiftValue = (mEyeDistance*0.5f); // shift to the right
float cameraPositionShiftValue = (mInterpupillaryDistance*0.5f); // shift to the right
if (_leftEye) cameraPositionShiftValue *= -1.0f; // if left eye shift to the left
if ( (_stereoMode == PARALLEL_SHIFT) || (_stereoMode == OFF_AXIS) ) {
......@@ -316,20 +316,6 @@ glm::mat4 GenericCamera::getMonoInverseViewMatrix() const
return m;
}
enum ProjectionMode
{
ISOMETRIC_PROJECTION = 0,
PERSPECTIVE_PROJECTION
};
enum StereoMode
{
MONO = 0,
PARALLEL_SHIFT,
OFF_AXIS,
TOE_IN
};
glm::mat4 GenericCamera::getStereoProjectionMatrix( bool _leftEye, StereoMode _stereoMode ) const
{
assert( _stereoMode != MONO && "mono is not a stereo mode!" );
......@@ -383,7 +369,7 @@ std::string GenericCamera::storeStateToString() const
if ( mCurrentEye == EYE_RIGHT) state += "EYE_RIGHT | ";
state += toString( mHorizontalFieldOfView ) + " | ";
state += toString( mAspectRatio ) + " | ";
state += toString( mEyeDistance ) + " | ";
state += toString( mInterpupillaryDistance ) + " | ";
state += toString( mNearClippingPlane ) + " | ";
state += toString( mFarClippingPlane ) + " | ";
state += toString( mLookAtDistance ) + " | ";
......@@ -423,13 +409,13 @@ void GenericCamera::setStateFromString( const std::string &_state )
if ( token[pos] == "EYE_RIGHT") mCurrentEye = EYE_RIGHT;
pos++;
mHorizontalFieldOfView = to<float>( token[pos++] );
mAspectRatio = to<float>( token[pos++] );
mEyeDistance = to<float>( token[pos++] );
mNearClippingPlane = to<float>( token[pos++] );
mFarClippingPlane = to<float>( token[pos++] );
mLookAtDistance = to<float>( token[pos++] );
mViewportSize = toUvec2( token[pos++] );
mHorizontalFieldOfView = to<float>( token[pos++] );
mAspectRatio = to<float>( token[pos++] );
mInterpupillaryDistance = to<float>( token[pos++] );
mNearClippingPlane = to<float>( token[pos++] );
mFarClippingPlane = to<float>( token[pos++] );
mLookAtDistance = to<float>( token[pos++] );
mViewportSize = toUvec2( token[pos++] );
}
float GenericCamera::getFocalLenghtInPixel() const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment