Converted osg::LOD from used n+1 successive ranges to n min/max ranges,

one min/max pair per child. Converted the rest of the OSG to use the new
osg::LOD node.
This commit is contained in:
Robert Osfield
2002-10-06 20:33:13 +00:00
parent 84332f5b77
commit 70861ef70e
19 changed files with 240 additions and 195 deletions

View File

@@ -6,7 +6,6 @@
#include <osg/Billboard>
#include <osg/Geode>
#include <osg/Group>
#include <osg/LOD>
#include <osg/Notify>
#include <osgDB/Registry>
@@ -80,18 +79,6 @@ class DrawableDrawCallback : public osg::Drawable::DrawCallback
}
};
struct LODCallback : public osg::LOD::EvaluateLODCallback
{
/** Compute the child to select.*/
virtual int evaluateLODChild(const osg::LOD* lod, const osg::Vec3& eye_local, float bias) const
{
std::cout<<"evaluateLODChild callback - pre lod->evaluateLODChild"<<std::endl;
int result = lod->evaluateLODChild(eye_local,bias);
std::cout<<"evaluateLODChild callback - post lod->evaluateLODChild"<<std::endl;
return result;
}
};
struct TransformCallback : public osg::Transform::ComputeTransformCallback
{
/** Get the transformation matrix which moves from local coords to world coords.*/
@@ -170,12 +157,6 @@ class InsertCallbacksVisitor : public osg::NodeVisitor
node.setComputeTransformCallback(new TransformCallback());
apply((osg::Node&)node);
}
virtual void apply(osg::LOD& node)
{
node.setEvaluateLODCallback(new LODCallback());
apply((osg::Node&)node);
}
};
int main( int argc, char **argv )

View File

@@ -99,8 +99,7 @@ int main( int argc, char **argv )
// standard LOD settings
impostor->addChild(model);
impostor->setRange(0,0.0f);
impostor->setRange(1,1e7f);
impostor->setRange(0,0.0f,1e7f);
impostor->setCenter(bs.center());
// impostor specfic settings.