Added LEFT_EYE and RIGHT_EYE stereo to osg::DisplaySettings/osgUtil::SceneView
Renamed LODBias to LODScale.
This commit is contained in:
@@ -32,19 +32,19 @@ void CollectOccludersVisitor::reset()
|
||||
CullStack::reset();
|
||||
}
|
||||
|
||||
float CollectOccludersVisitor::getDistanceToEyePoint(const Vec3& pos, bool withLODBias) const
|
||||
float CollectOccludersVisitor::getDistanceToEyePoint(const Vec3& pos, bool withLODScale) const
|
||||
{
|
||||
if (withLODBias) return (pos-getEyeLocal()).length()*getLODBias();
|
||||
if (withLODScale) return (pos-getEyeLocal()).length()*getLODScale();
|
||||
else return (pos-getEyeLocal()).length();
|
||||
}
|
||||
|
||||
float CollectOccludersVisitor::getDistanceFromEyePoint(const Vec3& pos, bool withLODBias) const
|
||||
float CollectOccludersVisitor::getDistanceFromEyePoint(const Vec3& pos, bool withLODScale) const
|
||||
{
|
||||
const Matrix& matrix = *_modelviewStack.back();
|
||||
float dist = -(pos[0]*matrix(0,2)+pos[1]*matrix(1,2)+pos[2]*matrix(2,2)+matrix(3,2));
|
||||
|
||||
if (withLODBias) return dist*getLODBias();
|
||||
else return dist*getLODBias();
|
||||
if (withLODScale) return dist*getLODScale();
|
||||
else return dist*getLODScale();
|
||||
}
|
||||
|
||||
void CollectOccludersVisitor::apply(osg::Node& node)
|
||||
|
||||
@@ -5,7 +5,7 @@ using namespace osg;
|
||||
CullStack::CullStack()
|
||||
{
|
||||
_cullingMode = ENABLE_ALL_CULLING;
|
||||
_LODBias = 1.0f;
|
||||
_LODScale = 1.0f;
|
||||
_smallFeatureCullingPixelSize = 2.0f;
|
||||
_frustumVolume=-1.0f;
|
||||
_bbCornerNear = 0;
|
||||
|
||||
@@ -129,6 +129,16 @@ void DisplaySettings::readEnvironmentalVariables()
|
||||
{
|
||||
_stereoMode = VERTICAL_SPLIT;
|
||||
}
|
||||
else
|
||||
if (strcmp(ptr,"LEFT_EYE")==0)
|
||||
{
|
||||
_stereoMode = LEFT_EYE;
|
||||
}
|
||||
else
|
||||
if (strcmp(ptr,"RIGHT_EYE")==0)
|
||||
{
|
||||
_stereoMode = RIGHT_EYE;
|
||||
}
|
||||
}
|
||||
|
||||
if( (ptr = getenv("OSG_STEREO")) != 0)
|
||||
@@ -230,6 +240,8 @@ void DisplaySettings::readCommandLine(std::vector<std::string>& commandLine)
|
||||
else if (*itr=="QUAD_BUFFER") { _stereo = true;_stereoMode = QUAD_BUFFER; ++itr; }
|
||||
else if (*itr=="HORIZONTAL_SPLIT") { _stereo = true;_stereoMode = HORIZONTAL_SPLIT; ++itr; }
|
||||
else if (*itr=="VERTICAL_SPLIT") { _stereo = true;_stereoMode = VERTICAL_SPLIT; ++itr; }
|
||||
else if (*itr=="LEFT_EYE") { _stereo = true;_stereoMode = LEFT_EYE; ++itr; }
|
||||
else if (*itr=="RIGHT_EYE") { _stereo = true;_stereoMode = RIGHT_EYE; ++itr; }
|
||||
else if (*itr=="ON") { _stereo = true; ++itr; }
|
||||
else if (*itr=="OFF") { _stereo = false; ++itr; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user