Replace boost::tuple by std::tuple
This commit is contained in:
@@ -36,7 +36,6 @@
|
||||
#include <mutex>
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
|
||||
#include <osg/AlphaFunc>
|
||||
#include <osg/BlendFunc>
|
||||
@@ -137,7 +136,7 @@ ref_ptr<Uniform> UniformFactoryImpl::getUniform( Effect * effect,
|
||||
}
|
||||
}
|
||||
|
||||
UniformCacheKey key = boost::make_tuple(name, uniformType, val, effect->getName());
|
||||
UniformCacheKey key = std::make_tuple(name, uniformType, val, effect->getName());
|
||||
ref_ptr<Uniform> uniform = uniformCache[key];
|
||||
|
||||
if (uniform.valid()) {
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <mutex>
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#include <osg/Object>
|
||||
#include <osg/observer_ptr>
|
||||
@@ -191,8 +190,8 @@ private:
|
||||
|
||||
std::mutex _mutex;
|
||||
|
||||
typedef boost::tuple<std::string, osg::Uniform::Type, std::string, std::string> UniformCacheKey;
|
||||
typedef boost::tuple<osg::ref_ptr<osg::Uniform>, SGPropertyChangeListener*> UniformCacheValue;
|
||||
typedef std::tuple<std::string, osg::Uniform::Type, std::string, std::string> UniformCacheKey;
|
||||
typedef std::tuple<osg::ref_ptr<osg::Uniform>, SGPropertyChangeListener*> UniformCacheValue;
|
||||
std::map<UniformCacheKey,osg::ref_ptr<osg::Uniform> > uniformCache;
|
||||
|
||||
typedef std::queue<DeferredPropertyListener*> DeferredListenerList;
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
#include <OpenThreads/Mutex>
|
||||
#include <OpenThreads/ScopedLock>
|
||||
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
|
||||
#include <simgear/scene/util/OsgMath.hxx>
|
||||
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
||||
#include <simgear/scene/util/SGSceneFeatures.hxx>
|
||||
@@ -73,9 +71,9 @@ osg::Texture* TextureBuilder::buildFromType(Effect* effect, Pass* pass, const st
|
||||
return EffectBuilder<Texture>::buildFromType(effect, pass, type, props, options);
|
||||
}
|
||||
|
||||
typedef boost::tuple<string, Texture::FilterMode, Texture::FilterMode,
|
||||
Texture::WrapMode, Texture::WrapMode, Texture::WrapMode,
|
||||
string, MipMapTuple, ImageInternalFormat> TexTuple;
|
||||
typedef std::tuple<string, Texture::FilterMode, Texture::FilterMode,
|
||||
Texture::WrapMode, Texture::WrapMode, Texture::WrapMode,
|
||||
string, MipMapTuple, ImageInternalFormat> TexTuple;
|
||||
|
||||
EffectNameValue<TexEnv::Mode> texEnvModesInit[] =
|
||||
{
|
||||
@@ -263,7 +261,7 @@ TexTuple makeTexTuple(Effect* effect, const SGPropertyNode* props,
|
||||
bool setAttrs(const TexTuple& attrs, Texture* tex,
|
||||
const SGReaderWriterOptions* options)
|
||||
{
|
||||
const string& imageName = attrs.get<0>();
|
||||
const string& imageName = std::get<0>(attrs);
|
||||
if (imageName.empty())
|
||||
return false;
|
||||
|
||||
@@ -271,7 +269,7 @@ bool setAttrs(const TexTuple& attrs, Texture* tex,
|
||||
|
||||
// load texture for effect
|
||||
SGReaderWriterOptions::LoadOriginHint origLOH = options->getLoadOriginHint();
|
||||
if(attrs.get<8>() == ImageInternalFormat::Normalized)
|
||||
if (std::get<8>(attrs) == ImageInternalFormat::Normalized)
|
||||
options->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_EFFECTS_NORMALIZED);
|
||||
else
|
||||
options->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_EFFECTS);
|
||||
@@ -286,7 +284,7 @@ bool setAttrs(const TexTuple& attrs, Texture* tex,
|
||||
image = result.getImage();
|
||||
if (image.valid())
|
||||
{
|
||||
image = computeMipmap( image.get(), attrs.get<7>() );
|
||||
image = computeMipmap( image.get(), std::get<7>(attrs) );
|
||||
tex->setImage(GL_FRONT_AND_BACK, image.get());
|
||||
int s = image->s();
|
||||
int t = image->t();
|
||||
@@ -302,11 +300,11 @@ bool setAttrs(const TexTuple& attrs, Texture* tex,
|
||||
}
|
||||
|
||||
// texture->setDataVariance(osg::Object::STATIC);
|
||||
tex->setFilter(Texture::MIN_FILTER, attrs.get<1>());
|
||||
tex->setFilter(Texture::MAG_FILTER, attrs.get<2>());
|
||||
tex->setWrap(Texture::WRAP_S, attrs.get<3>());
|
||||
tex->setWrap(Texture::WRAP_T, attrs.get<4>());
|
||||
tex->setWrap(Texture::WRAP_R, attrs.get<5>());
|
||||
tex->setFilter(Texture::MIN_FILTER, std::get<1>(attrs));
|
||||
tex->setFilter(Texture::MAG_FILTER, std::get<2>(attrs));
|
||||
tex->setWrap(Texture::WRAP_S, std::get<3>(attrs));
|
||||
tex->setWrap(Texture::WRAP_T, std::get<4>(attrs));
|
||||
tex->setWrap(Texture::WRAP_R, std::get<5>(attrs));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -521,7 +519,7 @@ TextureBuilder::Registrar installLightSprite("light-sprite", new LightSpriteBuil
|
||||
}
|
||||
|
||||
// Image names for all sides
|
||||
typedef boost::tuple<string, string, string, string, string, string> CubeMapTuple;
|
||||
typedef std::tuple<string, string, string, string, string, string> CubeMapTuple;
|
||||
|
||||
CubeMapTuple makeCubeMapTuple(Effect* effect, const SGPropertyNode* props)
|
||||
{
|
||||
@@ -610,54 +608,54 @@ Texture* CubeMapBuilder::build(Effect* effect, Pass* pass, const SGPropertyNode*
|
||||
SGReaderWriterOptions::LoadOriginHint origLOH = wOpts->getLoadOriginHint();
|
||||
wOpts->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_EFFECTS);
|
||||
#if OSG_VERSION_LESS_THAN(3,4,1)
|
||||
result = osgDB::readImageFile(_tuple.get<0>(), options);
|
||||
result = osgDB::readImageFile(std::get<0>(_tuple), options);
|
||||
#else
|
||||
result = osgDB::readRefImageFile(_tuple.get<0>(), options);
|
||||
result = osgDB::readRefImageFile(std::get<0>(_tuple), options);
|
||||
#endif
|
||||
if(result.success()) {
|
||||
osg::Image* image = result.getImage();
|
||||
cubeTexture->setImage(TextureCubeMap::POSITIVE_X, image);
|
||||
}
|
||||
#if OSG_VERSION_LESS_THAN(3,4,1)
|
||||
result = osgDB::readImageFile(_tuple.get<1>(), options);
|
||||
result = osgDB::readImageFile(std::get<1>(_tuple), options);
|
||||
#else
|
||||
result = osgDB::readRefImageFile(_tuple.get<1>(), options);
|
||||
result = osgDB::readRefImageFile(std::get<1>(_tuple), options);
|
||||
#endif
|
||||
if(result.success()) {
|
||||
osg::Image* image = result.getImage();
|
||||
cubeTexture->setImage(TextureCubeMap::NEGATIVE_X, image);
|
||||
}
|
||||
#if OSG_VERSION_LESS_THAN(3,4,1)
|
||||
result = osgDB::readImageFile(_tuple.get<2>(), options);
|
||||
result = osgDB::readImageFile(std::get<2>(_tuple), options);
|
||||
#else
|
||||
result = osgDB::readRefImageFile(_tuple.get<2>(), options);
|
||||
result = osgDB::readRefImageFile(std::get<2>(_tuple), options);
|
||||
#endif
|
||||
if(result.success()) {
|
||||
osg::Image* image = result.getImage();
|
||||
cubeTexture->setImage(TextureCubeMap::POSITIVE_Y, image);
|
||||
}
|
||||
#if OSG_VERSION_LESS_THAN(3,4,1)
|
||||
result = osgDB::readImageFile(_tuple.get<3>(), options);
|
||||
result = osgDB::readImageFile(std::get<3>(_tuple), options);
|
||||
#else
|
||||
result = osgDB::readRefImageFile(_tuple.get<3>(), options);
|
||||
result = osgDB::readRefImageFile(std::get<3>(_tuple), options);
|
||||
#endif
|
||||
if(result.success()) {
|
||||
osg::Image* image = result.getImage();
|
||||
cubeTexture->setImage(TextureCubeMap::NEGATIVE_Y, image);
|
||||
}
|
||||
#if OSG_VERSION_LESS_THAN(3,4,1)
|
||||
result = osgDB::readImageFile(_tuple.get<4>(), options);
|
||||
result = osgDB::readImageFile(std::get<4>(_tuple), options);
|
||||
#else
|
||||
result = osgDB::readRefImageFile(_tuple.get<4>(), options);
|
||||
result = osgDB::readRefImageFile(std::get<4>(_tuple), options);
|
||||
#endif
|
||||
if(result.success()) {
|
||||
osg::Image* image = result.getImage();
|
||||
cubeTexture->setImage(TextureCubeMap::POSITIVE_Z, image);
|
||||
}
|
||||
#if OSG_VERSION_LESS_THAN(3,4,1)
|
||||
result = osgDB::readImageFile(_tuple.get<5>(), options);
|
||||
result = osgDB::readImageFile(std::get<5>(_tuple), options);
|
||||
#else
|
||||
result = osgDB::readRefImageFile(_tuple.get<5>(), options);
|
||||
result = osgDB::readRefImageFile(std::get<5>(_tuple), options);
|
||||
#endif
|
||||
if(result.success()) {
|
||||
osg::Image* image = result.getImage();
|
||||
@@ -802,7 +800,7 @@ Texture* Texture3DBuilder::build(Effect* effect, Pass* pass,
|
||||
|
||||
tex = new Texture3D;
|
||||
|
||||
const string& imageName = attrs.get<0>();
|
||||
const string& imageName = std::get<0>(attrs);
|
||||
if (imageName.empty())
|
||||
return NULL;
|
||||
|
||||
@@ -810,7 +808,7 @@ Texture* Texture3DBuilder::build(Effect* effect, Pass* pass,
|
||||
|
||||
// load texture for effect
|
||||
SGReaderWriterOptions::LoadOriginHint origLOH = options->getLoadOriginHint();
|
||||
if(attrs.get<8>() == ImageInternalFormat::Normalized)
|
||||
if (std::get<8>(attrs) == ImageInternalFormat::Normalized)
|
||||
options->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_EFFECTS_NORMALIZED);
|
||||
else
|
||||
options->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_EFFECTS);
|
||||
@@ -840,18 +838,18 @@ Texture* Texture3DBuilder::build(Effect* effect, Pass* pass,
|
||||
}
|
||||
|
||||
image3d->setInternalTextureFormat(image->getInternalTextureFormat());
|
||||
image3d = computeMipmap(image3d.get(), attrs.get<7>());
|
||||
image3d = computeMipmap(image3d.get(), std::get<7>(attrs));
|
||||
tex->setImage(image3d.get());
|
||||
} else {
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "failed to load effect texture file " << imageName);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tex->setFilter(Texture::MIN_FILTER, attrs.get<1>());
|
||||
tex->setFilter(Texture::MAG_FILTER, attrs.get<2>());
|
||||
tex->setWrap(Texture::WRAP_S, attrs.get<3>());
|
||||
tex->setWrap(Texture::WRAP_T, attrs.get<4>());
|
||||
tex->setWrap(Texture::WRAP_R, attrs.get<5>());
|
||||
tex->setFilter(Texture::MIN_FILTER, std::get<1>(attrs));
|
||||
tex->setFilter(Texture::MAG_FILTER, std::get<2>(attrs));
|
||||
tex->setWrap(Texture::WRAP_S, std::get<3>(attrs));
|
||||
tex->setWrap(Texture::WRAP_T, std::get<4>(attrs));
|
||||
tex->setWrap(Texture::WRAP_R, std::get<5>(attrs));
|
||||
|
||||
if (itr == texMap.end())
|
||||
texMap.insert(make_pair(attrs, tex));
|
||||
|
||||
@@ -215,13 +215,13 @@ osg::Vec4 computeColor( osg::Vec4 colors[2][2][2], bool colorValid[2][2][2], Mip
|
||||
{
|
||||
osg::Vec4 result;
|
||||
unsigned int nbComponents = osg::Image::computeNumComponents( pixelFormat );
|
||||
result[0] = computeComponent( 0, colors, colorValid, attrs.get<0>() );
|
||||
result[0] = computeComponent( 0, colors, colorValid, std::get<0>(attrs) );
|
||||
if ( nbComponents >= 2 )
|
||||
result[1] = computeComponent( 1, colors, colorValid, attrs.get<1>() );
|
||||
result[1] = computeComponent( 1, colors, colorValid, std::get<1>(attrs) );
|
||||
if ( nbComponents >= 3 )
|
||||
result[2] = computeComponent( 2, colors, colorValid, attrs.get<2>() );
|
||||
result[2] = computeComponent( 2, colors, colorValid, std::get<2>(attrs) );
|
||||
if ( nbComponents == 4 )
|
||||
result[3] = computeComponent( 3, colors, colorValid, attrs.get<3>() );
|
||||
result[3] = computeComponent( 3, colors, colorValid, std::get<3>(attrs) );
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -265,17 +265,17 @@ osg::Image* computeMipmap( osg::Image* image, MipMapTuple attrs )
|
||||
{
|
||||
bool computeMipmap = false;
|
||||
unsigned int nbComponents = osg::Image::computeNumComponents( image->getPixelFormat() );
|
||||
if ( attrs.get<0>() != AUTOMATIC &&
|
||||
( attrs.get<1>() != AUTOMATIC || nbComponents < 2 ) &&
|
||||
( attrs.get<2>() != AUTOMATIC || nbComponents < 3 ) &&
|
||||
( attrs.get<3>() != AUTOMATIC || nbComponents < 4 ) )
|
||||
if ( std::get<0>(attrs) != AUTOMATIC &&
|
||||
( std::get<1>(attrs) != AUTOMATIC || nbComponents < 2 ) &&
|
||||
( std::get<2>(attrs) != AUTOMATIC || nbComponents < 3 ) &&
|
||||
( std::get<3>(attrs) != AUTOMATIC || nbComponents < 4 ) )
|
||||
{
|
||||
computeMipmap = true;
|
||||
}
|
||||
else if ( attrs.get<0>() != AUTOMATIC ||
|
||||
( attrs.get<1>() != AUTOMATIC && nbComponents >= 2 ) ||
|
||||
( attrs.get<2>() != AUTOMATIC && nbComponents >= 3 ) ||
|
||||
( attrs.get<3>() != AUTOMATIC && nbComponents == 4 ) )
|
||||
else if ( std::get<0>(attrs) != AUTOMATIC ||
|
||||
( std::get<1>(attrs) != AUTOMATIC && nbComponents >= 2 ) ||
|
||||
( std::get<2>(attrs) != AUTOMATIC && nbComponents >= 3 ) ||
|
||||
( std::get<3>(attrs) != AUTOMATIC && nbComponents == 4 ) )
|
||||
{
|
||||
throw BuilderException("invalid mipmap control function combination");
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#ifndef SIMGEAR_MIPMAP_HXX
|
||||
#define SIMGEAR_MIPMAP_HXX 1
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
|
||||
class SGPropertyNode;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace effect {
|
||||
Normalized,
|
||||
};
|
||||
|
||||
typedef boost::tuple<MipMapFunction, MipMapFunction, MipMapFunction, MipMapFunction> MipMapTuple;
|
||||
typedef std::tuple<MipMapFunction, MipMapFunction, MipMapFunction, MipMapFunction> MipMapTuple;
|
||||
|
||||
MipMapTuple makeMipMapTuple(Effect* effect, const SGPropertyNode* props,
|
||||
const SGReaderWriterOptions* options);
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "pt_lights.hxx"
|
||||
|
||||
#include <map>
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
|
||||
#include <osg/Array>
|
||||
#include <osg/Geometry>
|
||||
@@ -78,7 +77,7 @@ static Mutex lightMutex;
|
||||
|
||||
namespace
|
||||
{
|
||||
typedef boost::tuple<float, osg::Vec3, float, float, bool> PointParams;
|
||||
typedef std::tuple<float, osg::Vec3, float, float, bool> PointParams;
|
||||
typedef std::map<PointParams, observer_ptr<Effect> > EffectMap;
|
||||
|
||||
EffectMap effectMap;
|
||||
|
||||
Reference in New Issue
Block a user