Change Unit to Units to keep consistent with OpenGL naming.

This commit is contained in:
Robert Osfield 2006-07-17 11:43:26 +00:00
parent 460ea4586e
commit 2ef59b73e9
4 changed files with 22 additions and 22 deletions

View File

@ -69,14 +69,14 @@ class OSG_EXPORT PolygonOffset : public StateAttribute
static void setFactorMultiplier(float multiplier);
static float getFactorMultiplier();
static void setUnitMultiplier(float multiplier);
static float getUnitMultiplier();
static void setUnitsMultiplier(float multiplier);
static float getUnitsMultiplier();
static bool areUnitAndMultipliersSet();
static bool areUnitsAndMultipliersSet();
/** Checks with the OpenGL driver to try and pick multiplier approrpriate for the hardware.
note, requires a valid graphics context to be current. */
static void setFactorAndUnitMultipliersUsingBestGuessForDriver();
static void setFactorAndUnitsMultipliersUsingBestGuessForDriver();
protected :

View File

@ -17,7 +17,7 @@
using namespace osg;
static float s_FactorMultipler = 1.0f;
static float s_UnitMultipler = 1.0f;
static float s_UnitsMultipler = 1.0f;
static bool s_MultiplerSet = false;
void PolygonOffset::setFactorMultiplier(float multiplier)
@ -31,24 +31,24 @@ float PolygonOffset::getFactorMultiplier()
return s_FactorMultipler;
}
void PolygonOffset::setUnitMultiplier(float multiplier)
void PolygonOffset::setUnitsMultiplier(float multiplier)
{
s_MultiplerSet = true;
s_UnitMultipler = multiplier;
s_UnitsMultipler = multiplier;
}
float PolygonOffset::getUnitMultiplier()
float PolygonOffset::getUnitsMultiplier()
{
return s_UnitMultipler;
return s_UnitsMultipler;
}
bool PolygonOffset::areUnitAndMultipliersSet()
bool PolygonOffset::areUnitsAndMultipliersSet()
{
return s_MultiplerSet;
}
void PolygonOffset::setFactorAndUnitMultipliersUsingBestGuessForDriver()
void PolygonOffset::setFactorAndUnitsMultipliersUsingBestGuessForDriver()
{
s_MultiplerSet = true;
// osg::notify(osg::NOTICE)<<"PolygonOffset::setFactorAndUnitMultipliersUsingBestGuessForDriver()"<<std::endl;
@ -60,8 +60,8 @@ void PolygonOffset::setFactorAndUnitMultipliersUsingBestGuessForDriver()
(strstr((const char*)renderer,"RADEON")!=0))
{
setFactorMultiplier(1.0f);
setUnitMultiplier(128.0f);
osg::notify(osg::INFO)<<"PolygonOffset::setFactorAndUnitMultipliersUsingBestGuessForDriver() apply ATI workaround."<<std::endl;
setUnitsMultiplier(128.0f);
osg::notify(osg::INFO)<<"PolygonOffset::setFactorAndUnitsMultipliersUsingBestGuessForDriver() apply ATI workaround."<<std::endl;
}
}
}
@ -85,8 +85,8 @@ PolygonOffset::~PolygonOffset()
void PolygonOffset::apply(State&) const
{
if (!s_MultiplerSet) setFactorAndUnitMultipliersUsingBestGuessForDriver();
if (!s_MultiplerSet) setFactorAndUnitsMultipliersUsingBestGuessForDriver();
glPolygonOffset(_factor * s_FactorMultipler,
_units * s_UnitMultipler);
_units * s_UnitsMultipler);
}

View File

@ -1107,14 +1107,14 @@ bool ViewerEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActio
case '*' :
{
osg::PolygonOffset::setUnitMultiplier(osg::PolygonOffset::getUnitMultiplier()*1.1f);
osg::notify(osg::NOTICE)<<"osg::PolygonOffset::getUnitMultiplier()="<<osg::PolygonOffset::getUnitMultiplier()<<std::endl;
osg::PolygonOffset::setUnitsMultiplier(osg::PolygonOffset::getUnitsMultiplier()*1.1f);
osg::notify(osg::NOTICE)<<"osg::PolygonOffset::getUnitsMultiplier()="<<osg::PolygonOffset::getUnitsMultiplier()<<std::endl;
return true;
}
case '/' :
{
osg::PolygonOffset::setUnitMultiplier(osg::PolygonOffset::getUnitMultiplier()/1.1f);
osg::notify(osg::NOTICE)<<"osg::PolygonOffset::getUnitMultiplier()="<<osg::PolygonOffset::getUnitMultiplier()<<std::endl;
osg::PolygonOffset::setUnitsMultiplier(osg::PolygonOffset::getUnitsMultiplier()/1.1f);
osg::notify(osg::NOTICE)<<"osg::PolygonOffset::getUnitsMultiplier()="<<osg::PolygonOffset::getUnitsMultiplier()<<std::endl;
return true;
}
#else

View File

@ -1448,9 +1448,9 @@ void Text::drawImplementation(osg::State& state) const
if(_backdropType != NONE)
{
if (!osg::PolygonOffset::areUnitAndMultipliersSet())
if (!osg::PolygonOffset::areUnitsAndMultipliersSet())
{
osg::PolygonOffset::setFactorAndUnitMultipliersUsingBestGuessForDriver();
osg::PolygonOffset::setFactorAndUnitsMultipliersUsingBestGuessForDriver();
}
// Do I really need to do this for glPolygonOffset?
@ -1494,7 +1494,7 @@ void Text::drawImplementation(osg::State& state) const
{
state.setVertexPointer( 3, GL_FLOAT, 0, &(transformedBackdropCoords.front()));
glPolygonOffset(2.0f * osg::PolygonOffset::getFactorMultiplier(),
3.0f * osg::PolygonOffset::getUnitMultiplier() * (max_backdrop_index-backdrop_index) );
3.0f * osg::PolygonOffset::getUnitsMultiplier() * (max_backdrop_index-backdrop_index) );
glDrawArrays(GL_QUADS,0,transformedBackdropCoords.size());
}
}