From Neil Salter, added osgSim::SphereSegment and osgSim::ScalarBar, and

osgspheresegment and osgscalarbar, and osgsimulation examples.
This commit is contained in:
Robert Osfield
2003-09-01 09:36:03 +00:00
parent 5400f8293b
commit 144ac14b07
25 changed files with 3214 additions and 5 deletions

View File

@@ -0,0 +1,26 @@
#include <osgSim/ScalarsToColors>
using namespace osgSim;
ScalarsToColors::ScalarsToColors(float scalarMin, float scalarMax): _min(scalarMin), _max(scalarMax)
{
}
osg::Vec4 ScalarsToColors::getColor(float scalar) const
{
if(scalar<_min) return osg::Vec4(0.0f,0.0f,0.0f,0.0f);
if(scalar>_max) return osg::Vec4(0.0f,0.0f,0.0f,0.0f);
float c = (_min+scalar)/(_max-_min);
return osg::Vec4(c,c,c,1.0);
}
float ScalarsToColors::getMin() const
{
return _min;
}
float ScalarsToColors::getMax() const
{
return _max;
}