Updates to the camera code related to stereo, adding fusion distance.

This commit is contained in:
Robert Osfield
2001-12-20 16:35:38 +00:00
parent 1326f4616d
commit 8aa72d85cf
5 changed files with 61 additions and 41 deletions

View File

@@ -103,8 +103,7 @@ void RenderStage::draw(osg::State& state,RenderLeaf*& previous)
// set up projection
const Matrix& projectionMat = _camera->getProjectionMatrix();
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glMultMatrixf(projectionMat.ptr());
glLoadMatrixf(projectionMat.ptr());
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
@@ -117,7 +116,7 @@ void RenderStage::draw(osg::State& state,RenderLeaf*& previous)
// set up camera modelview.
const Matrix& modelView = _camera->getModelViewMatrix();
glMultMatrixf(modelView.ptr());
glLoadMatrixf(modelView.ptr());
if (getLightingMode()==RenderStageLighting::SKY_LIGHT && light)

View File

@@ -331,15 +331,6 @@ void SceneView::draw()
left_camera->adjustEyeOffsetForStereo(osg::Vec3(-iod*0.5,0.0f,0.0f),screenDistance);
right_camera->adjustEyeOffsetForStereo(osg::Vec3(iod*0.5,0.0f,0.0f),screenDistance);
osg::ColorMatrix* cm = new osg::ColorMatrix;
cm->setMatrix(osg::Matrix(0.3f,0.3f,0.3f,0.0f,
0.6f,0.6f,0.6f,0.0f,
0.1f,0.1f,0.1f,0.0f,
0.0f,0.0f,0.0f,1.0f));
_globalState->setAttribute(cm);
osg::ColorMask* red = new osg::ColorMask;
osg::ColorMask* green = new osg::ColorMask;

View File

@@ -184,6 +184,7 @@ bool TrackballManipulator::calcMovement()
// return if there is no movement.
if (dx==0 && dy==0) return false;
float focalLength = (_camera->getCenterPoint()-_camera->getEyePoint()).length();
unsigned int buttonMask = _ga_t1->getButtonMask();
if (buttonMask==GUIEventAdapter::LEFT_BUTTON)
{
@@ -229,8 +230,9 @@ bool TrackballManipulator::calcMovement()
{
// pan model.
float scale = 0.0015f*_camera->getFocalLength();
float scale = 0.0015f*focalLength;
osg::Vec3 uv = _camera->getUpVector();
osg::Vec3 sv = _camera->getSideVector();
@@ -240,7 +242,7 @@ bool TrackballManipulator::calcMovement()
mat.makeTranslate(dv.x(),dv.y(),dv.z());
_camera->transformLookAt(mat);
return true;
}
@@ -249,7 +251,7 @@ bool TrackballManipulator::calcMovement()
// zoom model.
float fd = _camera->getFocalLength();
float fd = focalLength;
float scale = 1.0f-dy*0.001f;
if (fd*scale>_modelScale*_minimumZoomScale)
{