Implemented an osg::minimum and osg::maximum template functions to replace
the std::min/max functions previously used in parts of the osg, since the std::min/max methods do not seem implemented under IRIX.
This commit is contained in:
@@ -108,6 +108,16 @@ const double PI = 3.14159265358979323846;
|
||||
const double PI_2 = 1.57079632679489661923;
|
||||
const double PI_4 = 0.78539816339744830962;
|
||||
|
||||
/** return the minimum of two values, equivilant to std::min.
|
||||
* std::min not used because of STL implementation under IRIX contains no std::min.*/
|
||||
template<typename T>
|
||||
inline T minimum(T lhs,T rhs) { return lhs<rhs?lhs:rhs; }
|
||||
|
||||
/** return the maximum of two values, equivilant to std::max.
|
||||
* std::max not used because of STL implementation under IRIX contains no std::max.*/
|
||||
template<typename T>
|
||||
inline T maximum(T lhs,T rhs) { return lhs>rhs?lhs:rhs; }
|
||||
|
||||
template<typename T>
|
||||
inline T clampTo(T v,T minimum,T maximum) { return v<minimum?minimum:v>maximum?maximum:v; }
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include <osg/ApplicationUsage>
|
||||
|
||||
#include <algorithm>
|
||||
#include <osg/Math>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
@@ -54,7 +53,7 @@ void ApplicationUsage::write(std::ostream& output, const ApplicationUsage::Usage
|
||||
citr!=um.end();
|
||||
++citr)
|
||||
{
|
||||
maxNumCharsInOptions = std::max(maxNumCharsInOptions,(unsigned int)citr->first.length());
|
||||
maxNumCharsInOptions = maximum(maxNumCharsInOptions,(unsigned int)citr->first.length());
|
||||
}
|
||||
|
||||
unsigned int fullWidth = widthOfOutput;
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
#include <osg/Notify>
|
||||
#include <osg/GLU>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace osg;
|
||||
|
||||
State::State()
|
||||
@@ -198,8 +196,8 @@ void State::captureCurrentState(StateSet& stateset) const
|
||||
|
||||
}
|
||||
|
||||
// revert to using std::max for consistency, std::max should be defined by STLport on VS.
|
||||
// // visual studio 6.0 doesn't appear to define std::max?!? So do our own here..
|
||||
// revert to using maximum for consistency, maximum should be defined by STLport on VS.
|
||||
// // visual studio 6.0 doesn't appear to define maximum?!? So do our own here..
|
||||
// template<class T>
|
||||
// T mymax(const T& a,const T& b)
|
||||
// {
|
||||
@@ -225,9 +223,9 @@ void State::apply(const StateSet* dstate)
|
||||
const StateSet::TextureAttributeList& ds_textureAttributeList = dstate->getTextureAttributeList();
|
||||
|
||||
unsigned int unit;
|
||||
unsigned int unitMax = std::max(static_cast<unsigned int>(ds_textureModeList.size()),static_cast<unsigned int>(ds_textureAttributeList.size()));
|
||||
unitMax = std::max(static_cast<unsigned int>(unitMax),static_cast<unsigned int>(_textureModeMapList.size()));
|
||||
unitMax = std::max(static_cast<unsigned int>(unitMax),static_cast<unsigned int>(_textureAttributeMapList.size()));
|
||||
unsigned int unitMax = maximum(static_cast<unsigned int>(ds_textureModeList.size()),static_cast<unsigned int>(ds_textureAttributeList.size()));
|
||||
unitMax = maximum(static_cast<unsigned int>(unitMax),static_cast<unsigned int>(_textureModeMapList.size()));
|
||||
unitMax = maximum(static_cast<unsigned int>(unitMax),static_cast<unsigned int>(_textureAttributeMapList.size()));
|
||||
for(unit=0;unit<unitMax;++unit)
|
||||
{
|
||||
if (setActiveTextureUnit(unit))
|
||||
@@ -262,7 +260,7 @@ void State::apply()
|
||||
applyAttributeMap(_attributeMap);
|
||||
|
||||
unsigned int unit;
|
||||
unsigned int unitMax = std::max(_textureModeMapList.size(),_textureAttributeMapList.size());
|
||||
unsigned int unitMax = maximum(_textureModeMapList.size(),_textureAttributeMapList.size());
|
||||
for(unit=0;unit<unitMax;++unit)
|
||||
{
|
||||
if (setActiveTextureUnit(unit))
|
||||
|
||||
Reference in New Issue
Block a user