|
|
|
@ -629,7 +629,7 @@ namespace MWRender
|
|
|
|
|
|
|
|
|
|
for (int view : {0, 1})
|
|
|
|
|
{
|
|
|
|
|
auto projectionMatrix = sm.computeEyeProjection(view, true);
|
|
|
|
|
auto projectionMatrix = sm.computeEyeProjection(view, SceneUtil::AutoDepth::isReversed());
|
|
|
|
|
auto viewOffsetMatrix = sm.computeEyeViewOffset(view);
|
|
|
|
|
for (int col : {0, 1, 2})
|
|
|
|
|
viewOffsetMatrix(3, col) = 0;
|
|
|
|
@ -644,23 +644,15 @@ namespace MWRender
|
|
|
|
|
{
|
|
|
|
|
auto& sm = Stereo::Manager::instance();
|
|
|
|
|
auto* projectionMatrixUniform = stateset->getUniform("projectionMatrix");
|
|
|
|
|
auto projectionMatrix = sm.computeEyeProjection(0, true);
|
|
|
|
|
auto viewOffsetMatrix = sm.computeEyeViewOffset(0);
|
|
|
|
|
for (int col : {0, 1, 2})
|
|
|
|
|
viewOffsetMatrix(3, col) = 0;
|
|
|
|
|
|
|
|
|
|
projectionMatrixUniform->set(viewOffsetMatrix * projectionMatrix);
|
|
|
|
|
auto projectionMatrix = sm.computeEyeProjection(0, SceneUtil::AutoDepth::isReversed());
|
|
|
|
|
projectionMatrixUniform->set(projectionMatrix);
|
|
|
|
|
}
|
|
|
|
|
void applyRight(osg::StateSet* stateset, osgUtil::CullVisitor* /*cv*/) override
|
|
|
|
|
{
|
|
|
|
|
auto& sm = Stereo::Manager::instance();
|
|
|
|
|
auto* projectionMatrixUniform = stateset->getUniform("projectionMatrix");
|
|
|
|
|
auto projectionMatrix = sm.computeEyeProjection(1, true);
|
|
|
|
|
auto viewOffsetMatrix = sm.computeEyeViewOffset(1);
|
|
|
|
|
for (int col : {0, 1, 2})
|
|
|
|
|
viewOffsetMatrix(3, col) = 0;
|
|
|
|
|
|
|
|
|
|
projectionMatrixUniform->set(viewOffsetMatrix * projectionMatrix);
|
|
|
|
|
auto projectionMatrix = sm.computeEyeProjection(1, SceneUtil::AutoDepth::isReversed());
|
|
|
|
|
projectionMatrixUniform->set(projectionMatrix);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|