1
0
Fork 0

Optionally use SCREEN_SIZE_PIXEL for LOD

This patch enables AIModels to use the size on the screen for LOD instead
of distance from eye point.
With /sim/rendering/static-lod/ai-range-mode-pixel set to true
/sim/rendering/static-lod/ai-detailed now contains the minimum size of the
model on the screen to be displayed. Values of 10-50 seem to make some sense.
This commit is contained in:
Torsten Dreyer 2014-11-19 17:26:58 +01:00
parent 5f0bffde58
commit e46ab5faa3

View file

@ -336,7 +336,8 @@ void FGAIBase::updateInterior()
void FGAIBase::updateLOD()
{
double maxRangeDetail = fgGetDouble("/sim/rendering/static-lod/ai-detailed", 10000.0);
double maxRangeBare = fgGetDouble("/sim/rendering/static-lod/ai-bare", 20000.0);
// double maxRangeBare = fgGetDouble("/sim/rendering/static-lod/ai-bare", 20000.0);
_maxRangeInterior = fgGetDouble("/sim/rendering/static-lod/ai-interior", 50.0);
if (_model.valid())
{
@ -348,8 +349,14 @@ void FGAIBase::updateLOD()
}
else
{
_model->setRange(0, 0.0, maxRangeDetail);
_model->setRange(1, maxRangeDetail,maxRangeBare);
if( fgGetBool("/sim/rendering/static-lod/ai-range-mode-pixel", false ) )
{
_model->setRangeMode( osg::LOD::PIXEL_SIZE_ON_SCREEN );
_model->setRange(0, maxRangeDetail, 100000 );
} else {
_model->setRangeMode( osg::LOD:: DISTANCE_FROM_EYE_POINT);
_model->setRange(0, 0.0, maxRangeDetail);
}
}
}
}