Raise minimum OSG version to 3.4.1
This commit is contained in:
@@ -240,7 +240,7 @@ else()
|
||||
endif()
|
||||
endif(ENABLE_SOUND)
|
||||
|
||||
find_package(OpenSceneGraph 3.2.0 REQUIRED osgText osgSim osgDB osgParticle osgGA osgViewer osgUtil)
|
||||
find_package(OpenSceneGraph 3.4.1 REQUIRED osgText osgSim osgDB osgParticle osgGA osgViewer osgUtil)
|
||||
|
||||
if (MSVC)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSCENEGRAPH_INCLUDE_DIRS})
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include <osg/ShadeModel>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/FrameBufferObject> // for GL_DEPTH_STENCIL_EXT on Windows
|
||||
#include <osg/Version>
|
||||
#include <osgUtil/RenderBin>
|
||||
|
||||
#include <cassert>
|
||||
@@ -276,11 +275,7 @@ namespace canvas
|
||||
{
|
||||
osg::NodeCallback* cull_callback =
|
||||
camera
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
? camera->getCullCallback()
|
||||
#else
|
||||
? dynamic_cast<osg::NodeCallback*>(camera->getCullCallback())
|
||||
#endif
|
||||
: 0;
|
||||
|
||||
clear();
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <osg/Drawable>
|
||||
#include <osg/Geode>
|
||||
#include <osg/StateAttribute>
|
||||
#include <osg/Version>
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
@@ -365,13 +364,7 @@ namespace canvas
|
||||
|
||||
// Drawables have a bounding box...
|
||||
if( _drawable )
|
||||
return _drawable->
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
getBound()
|
||||
#else
|
||||
getBoundingBox()
|
||||
#endif
|
||||
.contains(osg::Vec3f(local_pos, 0));
|
||||
return _drawable->getBoundingBox().contains(osg::Vec3f(local_pos, 0));
|
||||
else if( _scene_group.valid() )
|
||||
// ... for other elements, i.e. groups only a bounding sphere is available
|
||||
return _scene_group->getBound().contains(osg::Vec3f(parent_pos, 0));
|
||||
@@ -643,11 +636,7 @@ namespace canvas
|
||||
osg::BoundingBox Element::getBoundingBox() const
|
||||
{
|
||||
if( _drawable )
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
return _drawable->getBound();
|
||||
#else
|
||||
return _drawable->getBoundingBox();
|
||||
#endif
|
||||
|
||||
osg::BoundingBox bb;
|
||||
|
||||
@@ -670,12 +659,7 @@ namespace canvas
|
||||
return osg::BoundingBox();
|
||||
|
||||
osg::BoundingBox transformed;
|
||||
const osg::BoundingBox& bb =
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
_drawable->getBound();
|
||||
#else
|
||||
_drawable->getBoundingBox();
|
||||
#endif
|
||||
const osg::BoundingBox& bb = _drawable->getBoundingBox();
|
||||
|
||||
for(int i = 0; i < 4; ++i)
|
||||
transformed.expandBy( bb.corner(i) * m );
|
||||
|
||||
@@ -179,13 +179,7 @@ namespace canvas
|
||||
&& child->getNameString() == "visible"
|
||||
&& child->getBoolValue() )
|
||||
{
|
||||
CullCallback* cb =
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
static_cast<CullCallback*>
|
||||
#else
|
||||
dynamic_cast<CullCallback*>
|
||||
#endif
|
||||
( _geom->getCullCallback() );
|
||||
CullCallback* cb = dynamic_cast<CullCallback*>( _geom->getCullCallback() );
|
||||
|
||||
if( cb )
|
||||
cb->cullNextFrame();
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <simgear/misc/strutils.hxx>
|
||||
|
||||
#include <osg/Drawable>
|
||||
#include <osg/Version>
|
||||
|
||||
#include <vg/openvg.h>
|
||||
#include <cassert>
|
||||
@@ -559,12 +558,8 @@ namespace canvas
|
||||
/**
|
||||
* Compute the bounding box
|
||||
*/
|
||||
osg::BoundingBox
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
computeBound()
|
||||
#else
|
||||
computeBoundingBox()
|
||||
#endif
|
||||
osg::BoundingBox computeBoundingBox()
|
||||
|
||||
const override
|
||||
{
|
||||
if( _path == VG_INVALID_HANDLE || (_attributes_dirty & PATH) )
|
||||
|
||||
@@ -61,11 +61,7 @@ namespace canvas
|
||||
SGVec2i sizeForWidth(int w);
|
||||
#endif
|
||||
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
osg::BoundingBox computeBound() const override;
|
||||
#else
|
||||
osg::BoundingBox computeBoundingBox() const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
friend class TextLine;
|
||||
@@ -173,13 +169,9 @@ namespace canvas
|
||||
|
||||
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,6)
|
||||
// TODO: need 3.5.6 version of this.
|
||||
#else
|
||||
#if OSG_VERSION_LESS_THAN(3,3,5)
|
||||
GlyphQuads::Coords2 const& coords = _quads->_coords;
|
||||
#else
|
||||
GlyphQuads::Coords2 refCoords = _quads->_coords;
|
||||
GlyphQuads::Coords2::element_type &coords = *refCoords.get();
|
||||
#endif
|
||||
|
||||
size_t global_i = _begin + i;
|
||||
|
||||
@@ -217,13 +209,9 @@ namespace canvas
|
||||
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,6)
|
||||
// TODO: need 3.5.7 version of this.
|
||||
return cursorPos(0);
|
||||
#else
|
||||
#if OSG_VERSION_LESS_THAN(3,3,5)
|
||||
GlyphQuads::Coords2 const& coords = _quads->_coords;
|
||||
#else
|
||||
GlyphQuads::Coords2 refCoords = _quads->_coords;
|
||||
GlyphQuads::Coords2::element_type &coords = *refCoords.get();
|
||||
#endif
|
||||
|
||||
GlyphQuads::Glyphs const& glyphs = _quads->_glyphs;
|
||||
|
||||
@@ -649,28 +637,9 @@ namespace canvas
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
osg::BoundingBox Text::TextOSG::computeBound() const
|
||||
#else
|
||||
osg::BoundingBox Text::TextOSG::computeBoundingBox() const
|
||||
#endif
|
||||
{
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
osg::BoundingBox bb = osgText::Text::computeBound();
|
||||
#else
|
||||
osg::BoundingBox bb = osgText::Text::computeBoundingBox();
|
||||
#endif
|
||||
|
||||
#if OSG_VERSION_LESS_THAN(3,1,0)
|
||||
if( bb.valid() )
|
||||
{
|
||||
// TODO bounding box still doesn't seem always right (eg. with center
|
||||
// horizontal alignment not completely accurate)
|
||||
bb._min.y() += _offset.y();
|
||||
bb._max.y() += _offset.y();
|
||||
}
|
||||
#endif
|
||||
|
||||
osg::BoundingBox bb = osgText::Text::computeBoundingBox();
|
||||
return bb;
|
||||
}
|
||||
|
||||
@@ -685,12 +654,8 @@ namespace canvas
|
||||
|
||||
const GlyphQuads& quads = _textureGlyphQuadMap.begin()->second;
|
||||
const GlyphQuads::Glyphs& glyphs = quads._glyphs;
|
||||
#if OSG_VERSION_LESS_THAN(3,3,5)
|
||||
GlyphQuads::Coords2 const& coords = quads._coords;
|
||||
#else
|
||||
GlyphQuads::Coords2 refCoords = quads._coords;
|
||||
GlyphQuads::Coords2::element_type &coords = *refCoords.get();
|
||||
#endif
|
||||
|
||||
const GlyphQuads::LineNumbers& line_numbers = quads._lineNumbers;
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#define SIMGEAR_EFFECT_GEODE_HXX 1
|
||||
|
||||
#include <osg/Geode>
|
||||
#include <osg/Version>
|
||||
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
@@ -31,9 +30,6 @@ class EffectGeode : public osg::Geode
|
||||
{
|
||||
public:
|
||||
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
typedef DrawableList::iterator DrawablesIterator;
|
||||
#else
|
||||
class DrawablesIterator:
|
||||
public boost::iterator_adaptor<
|
||||
DrawablesIterator,
|
||||
@@ -62,7 +58,6 @@ class EffectGeode : public osg::Geode
|
||||
return base_reference()->get()->asDrawable();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
EffectGeode();
|
||||
EffectGeode(const EffectGeode& rhs,
|
||||
@@ -75,13 +70,9 @@ class EffectGeode : public osg::Geode
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
virtual void releaseGLObjects(osg::State* = 0) const;
|
||||
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
DrawablesIterator drawablesBegin() { return _drawables.begin(); }
|
||||
DrawablesIterator drawablesEnd() { return _drawables.end(); }
|
||||
#else
|
||||
|
||||
DrawablesIterator drawablesBegin() { return DrawablesIterator(_children.begin()); }
|
||||
DrawablesIterator drawablesEnd() { return DrawablesIterator(_children.end()); }
|
||||
#endif
|
||||
|
||||
void runGenerators(osg::Geometry *geometry);
|
||||
private:
|
||||
|
||||
@@ -142,14 +142,9 @@ Technique::processDrawables(const EffectGeode::DrawablesIterator& begin,
|
||||
{
|
||||
Drawable* drawable = itr->get();
|
||||
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
const BoundingBox& bb = drawable->getBound();
|
||||
osg::Drawable::CullCallback* cull = drawable->getCullCallback();
|
||||
#else
|
||||
const BoundingBox& bb = drawable->getBoundingBox();
|
||||
osg::Drawable::CullCallback* cull =
|
||||
dynamic_cast<osg::Drawable::CullCallback*>(drawable->getCullCallback());
|
||||
#endif
|
||||
|
||||
if( (cull && cull->cull(cv, drawable, &cv->getRenderInfo()))
|
||||
|| (isCullingActive && cv->isCulled(bb)) )
|
||||
@@ -322,15 +317,9 @@ public:
|
||||
= GL2Extensions::Get(static_cast<unsigned>(contextId), true);
|
||||
if (!extensions)
|
||||
return;
|
||||
#if OSG_VERSION_LESS_THAN(3,3,4)
|
||||
if (!extensions->isGlslSupported())
|
||||
return;
|
||||
value = extensions->getLanguageVersion();
|
||||
#else
|
||||
if (!extensions->isGlslSupported)
|
||||
return;
|
||||
value = extensions->glslLanguageVersion;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
@@ -359,11 +348,7 @@ public:
|
||||
= GL2Extensions::Get(static_cast<unsigned>(contextId), true);
|
||||
if (!extensions)
|
||||
return;
|
||||
#if OSG_VERSION_LESS_THAN(3,3,4)
|
||||
value = extensions->isGlslSupported();
|
||||
#else
|
||||
value = extensions->isGlslSupported;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -273,11 +273,7 @@ bool setAttrs(const TexTuple& attrs, Texture* tex,
|
||||
options->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_EFFECTS_NORMALIZED);
|
||||
else
|
||||
options->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_EFFECTS);
|
||||
#if OSG_VERSION_LESS_THAN(3,4,2)
|
||||
result = osgDB::readImageFile(imageName, options);
|
||||
#else
|
||||
result = osgDB::readRefImageFile(imageName, options);
|
||||
#endif
|
||||
options->setLoadOriginHint(origLOH);
|
||||
osg::ref_ptr<osg::Image> image;
|
||||
if (result.success())
|
||||
@@ -607,56 +603,34 @@ Texture* CubeMapBuilder::build(Effect* effect, Pass* pass, const SGPropertyNode*
|
||||
SGReaderWriterOptions* wOpts = (SGReaderWriterOptions*)options;
|
||||
SGReaderWriterOptions::LoadOriginHint origLOH = wOpts->getLoadOriginHint();
|
||||
wOpts->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_EFFECTS);
|
||||
#if OSG_VERSION_LESS_THAN(3,4,1)
|
||||
result = osgDB::readImageFile(std::get<0>(_tuple), options);
|
||||
#else
|
||||
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(std::get<1>(_tuple), options);
|
||||
#else
|
||||
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(std::get<2>(_tuple), options);
|
||||
#else
|
||||
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(std::get<3>(_tuple), options);
|
||||
#else
|
||||
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(std::get<4>(_tuple), options);
|
||||
#else
|
||||
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(std::get<5>(_tuple), options);
|
||||
#else
|
||||
result = osgDB::readRefImageFile(std::get<5>(_tuple), options);
|
||||
#endif
|
||||
if(result.success()) {
|
||||
osg::Image* image = result.getImage();
|
||||
cubeTexture->setImage(TextureCubeMap::NEGATIVE_Z, image);
|
||||
@@ -681,11 +655,8 @@ Texture* CubeMapBuilder::build(Effect* effect, Pass* pass, const SGPropertyNode*
|
||||
return cubeTexture.release();
|
||||
|
||||
osgDB::ReaderWriter::ReadResult result;
|
||||
#if OSG_VERSION_LESS_THAN(3,4,1)
|
||||
result = osgDB::readImageFile(texname, options);
|
||||
#else
|
||||
result = osgDB::readRefImageFile(texname, options);
|
||||
#endif
|
||||
|
||||
if(result.success()) {
|
||||
osg::Image* image = result.getImage();
|
||||
image->flipVertical(); // Seems like the image coordinates are somewhat funny, flip to get better ones
|
||||
@@ -812,11 +783,7 @@ Texture* Texture3DBuilder::build(Effect* effect, Pass* pass,
|
||||
options->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_EFFECTS_NORMALIZED);
|
||||
else
|
||||
options->setLoadOriginHint(SGReaderWriterOptions::LoadOriginHint::ORIGIN_EFFECTS);
|
||||
#if OSG_VERSION_LESS_THAN(3,4,2)
|
||||
result = osgDB::readImageFile(imageName, options);
|
||||
#else
|
||||
result = osgDB::readRefImageFile(imageName, options);
|
||||
#endif
|
||||
options->setLoadOriginHint(origLOH);
|
||||
osg::ref_ptr<osg::Image> image;
|
||||
if (result.success())
|
||||
|
||||
@@ -226,11 +226,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
||||
}
|
||||
else
|
||||
{
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
osg::Image* image = osgDB::readImageFile(fullMaskPath, options);
|
||||
#else
|
||||
osg::Image* image = osgDB::readRefImageFile(fullMaskPath, options);
|
||||
#endif
|
||||
if (image && image->valid())
|
||||
{
|
||||
Texture2DRef object_mask = new osg::Texture2D;
|
||||
|
||||
@@ -216,11 +216,7 @@ public:
|
||||
if (pagedLOD.getMinRange(i) <= 0) {
|
||||
osg::ref_ptr<const osgDB::Options> options;
|
||||
options = getOptions(pagedLOD.getDatabaseOptions(), pagedLOD.getDatabasePath());
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
node = osgDB::readNodeFile(pagedLOD.getFileName(i), options.get());
|
||||
#else
|
||||
node = osgDB::readRefNodeFile(pagedLOD.getFileName(i), options.get());
|
||||
#endif
|
||||
}
|
||||
if (!node.valid())
|
||||
node = new osg::Group;
|
||||
@@ -261,11 +257,7 @@ public:
|
||||
osg::ref_ptr<const osgDB::Options> options;
|
||||
options = getOptions(proxyNode.getDatabaseOptions(), proxyNode.getDatabasePath());
|
||||
osg::ref_ptr<osg::Node> node;
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
node = osgDB::readNodeFile(proxyNode.getFileName(i), options.get());
|
||||
#else
|
||||
node = osgDB::readRefNodeFile(proxyNode.getFileName(i), options.get());
|
||||
#endif
|
||||
if (!node.valid())
|
||||
node = new osg::Group;
|
||||
if (i < proxyNode.getNumChildren())
|
||||
@@ -362,11 +354,8 @@ SGSharedPtr<BVHNode>
|
||||
BVHPageNodeOSG::load(const std::string& name, const osg::ref_ptr<const osg::Referenced>& options)
|
||||
{
|
||||
osg::ref_ptr<osg::Node> node;
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
node = osgDB::readNodeFile(name, dynamic_cast<const osgDB::Options*>(options.get()));
|
||||
#else
|
||||
node = osgDB::readRefNodeFile(name, dynamic_cast<const osgDB::Options*>(options.get()));
|
||||
#endif
|
||||
|
||||
if (!node.valid())
|
||||
return SGSharedPtr<BVHNode>();
|
||||
|
||||
|
||||
@@ -586,11 +586,7 @@ ModelRegistry::readImage(const string& fileName,
|
||||
osg::ref_ptr<osg::Node> DefaultCachePolicy::find(const string& fileName, const Options* opt)
|
||||
{
|
||||
Registry* registry = Registry::instance();
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
osg::ref_ptr<osg::Object> cachedObject = registry->getFromObjectCache(fileName);
|
||||
#else
|
||||
osg::ref_ptr<osg::Object> cachedObject = registry->getRefFromObjectCache(fileName);
|
||||
#endif
|
||||
|
||||
ref_ptr<osg::Node> cachedNode = dynamic_cast<osg::Node*>(cachedObject.get());
|
||||
if (cachedNode.valid())
|
||||
|
||||
@@ -338,11 +338,8 @@ sgLoad3DModel_internal(const SGPath& path,
|
||||
|
||||
options->setDatabasePath(texturepath.utf8Str());
|
||||
osgDB::ReaderWriter::ReadResult modelResult;
|
||||
#if OSG_VERSION_LESS_THAN(3,4,1)
|
||||
modelResult = osgDB::readNodeFile(modelpath.utf8Str(), options.get());
|
||||
#else
|
||||
modelResult = osgDB::readRefNodeFile(modelpath.utf8Str(), options.get());
|
||||
#endif
|
||||
|
||||
if (!modelResult.validNode())
|
||||
throw sg_io_exception("Failed to load 3D model:" + modelResult.message(),
|
||||
modelpath);
|
||||
|
||||
@@ -41,17 +41,9 @@ SGLoadTexture2D(bool staticTexture, const std::string& path,
|
||||
{
|
||||
osg::ref_ptr<osg::Image> image;
|
||||
if (options)
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
image = osgDB::readImageFile(path, options);
|
||||
#else
|
||||
image = osgDB::readRefImageFile(path, options);
|
||||
#endif
|
||||
else
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
image = osgDB::readImageFile(path);
|
||||
#else
|
||||
image = osgDB::readRefImageFile(path);
|
||||
#endif
|
||||
|
||||
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
|
||||
texture->setImage(image);
|
||||
@@ -152,11 +144,7 @@ Texture2D* TextureUpdateVisitor::textureReplace(int unit, const StateAttribute*
|
||||
if (fullLiveryFile.empty() || fullLiveryFile == *fullFilePath)
|
||||
return 0;
|
||||
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
Image* newImage = readImageFile(fullLiveryFile);
|
||||
#else
|
||||
osg::ref_ptr<Image> newImage = readRefImageFile(fullLiveryFile);
|
||||
#endif
|
||||
if (!newImage)
|
||||
return 0;
|
||||
|
||||
@@ -166,11 +154,7 @@ Texture2D* TextureUpdateVisitor::textureReplace(int unit, const StateAttribute*
|
||||
return 0;
|
||||
|
||||
newTexture->setImage(newImage);
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
if (newImage->valid())
|
||||
#else
|
||||
if (newImage.valid())
|
||||
#endif
|
||||
{
|
||||
newTexture->setMaxAnisotropy(SGSceneFeatures::instance()->getTextureFilter());
|
||||
}
|
||||
|
||||
@@ -116,11 +116,7 @@ osg::Node* loadFile(const string& path, SGReaderWriterOptions* options)
|
||||
options->setInstantiateEffects(true);
|
||||
}
|
||||
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
ref_ptr<Node> model = readNodeFile(path, options);
|
||||
#else
|
||||
ref_ptr<Node> model = readRefNodeFile(path, options);
|
||||
#endif
|
||||
if (!model)
|
||||
return 0;
|
||||
else
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <simgear/props/props.hxx>
|
||||
#include <simgear/props/props_io.hxx>
|
||||
#include <simgear/scene/util/OsgMath.hxx>
|
||||
#include <simgear/structure/OSGVersion.hxx>
|
||||
|
||||
#include <osgParticle/SmokeTrailEffect>
|
||||
#include <osgParticle/FireEffect>
|
||||
|
||||
@@ -128,11 +128,7 @@ void CloudShaderGeometry::drawImplementation(RenderInfo& renderInfo) const
|
||||
sortData.frameSorted = frameNumber;
|
||||
}
|
||||
|
||||
#if OSG_VERSION_LESS_THAN(3,3,4)
|
||||
const Extensions* extensions = getExtensions(state.getContextID(),true);
|
||||
#else
|
||||
const GLExtensions* extensions = GLExtensions::Get(state.getContextID(), true);
|
||||
#endif
|
||||
GLfloat ua1[3] = { (GLfloat) alpha_factor,
|
||||
(GLfloat) shade_factor,
|
||||
(GLfloat) cloud_height };
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/buffered_value>
|
||||
#include <osg/Version>
|
||||
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
#include <simgear/math/sg_random.h>
|
||||
@@ -98,13 +97,7 @@ class CloudShaderGeometry : public osg::Drawable
|
||||
{ return _cloudsprites[i]; }
|
||||
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
|
||||
virtual osg::BoundingBox
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
computeBound()
|
||||
#else
|
||||
computeBoundingBox()
|
||||
#endif
|
||||
const
|
||||
virtual osg::BoundingBox computeBoundingBox() const
|
||||
{
|
||||
return _bbox;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <simgear/structure/OSGVersion.hxx>
|
||||
#include <osg/AlphaFunc>
|
||||
#include <osg/BlendFunc>
|
||||
#include <osg/CullFace>
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <simgear/structure/OSGVersion.hxx>
|
||||
#include <osg/Array>
|
||||
#include <osg/AlphaFunc>
|
||||
#include <osg/BlendFunc>
|
||||
|
||||
@@ -209,11 +209,7 @@ ReaderWriterSPT::readObject(const std::string& fileName, const osgDB::Options* o
|
||||
imageFileName = osgDB::concatPaths(imageFileName, "Globe");
|
||||
imageFileName = osgDB::concatPaths(imageFileName, "world.topo.bathy.200407.3x4096x2048.png");
|
||||
}
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
if (osg::Image* image = osgDB::readImageFile(imageFileName, options)) {
|
||||
#else
|
||||
if (osg::Image* image = osgDB::readRefImageFile(imageFileName, options)) {
|
||||
#endif
|
||||
osg::Texture2D* texture = new osg::Texture2D;
|
||||
texture->setImage(image);
|
||||
texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::REPEAT);
|
||||
@@ -261,11 +257,7 @@ ReaderWriterSPT::createTree(const BucketBox& bucketBox, const LocalOptions& opti
|
||||
if (bucketBox.getIsBucketSize()) {
|
||||
std::string fileName;
|
||||
fileName = bucketBox.getBucket().gen_index_str() + std::string(".stg");
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
return osgDB::readNodeFile(fileName, options._options);
|
||||
#else
|
||||
return osgDB::readRefNodeFile(fileName, options._options);
|
||||
#endif
|
||||
} else if (!topLevel && options.isPageLevel(bucketBox.getStartLevel())) {
|
||||
return createPagedLOD(bucketBox, options);
|
||||
} else {
|
||||
@@ -323,11 +315,8 @@ ReaderWriterSPT::createPagedLOD(const BucketBox& bucketBox, const LocalOptions&
|
||||
std::string fileName = osgDB::findDataFile(lodPath + extensions[i], options._options);
|
||||
if (fileName.empty())
|
||||
continue;
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(fileName, options._options);
|
||||
#else
|
||||
|
||||
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFile(fileName, options._options);
|
||||
#endif
|
||||
if (!node.valid())
|
||||
continue;
|
||||
pagedLOD->addChild(node.get(), range, std::numeric_limits<float>::max());
|
||||
@@ -425,11 +414,7 @@ ReaderWriterSPT::getLowLODStateSet(const LocalOptions& options) const
|
||||
localOptions = static_cast<osgDB::Options*>(options._options->clone(osg::CopyOp()));
|
||||
localOptions->setObjectCacheHint(osgDB::Options::CACHE_ALL);
|
||||
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
osg::ref_ptr<osg::Object> object = osgDB::readObjectFile("state.spt", localOptions.get());
|
||||
#else
|
||||
osg::ref_ptr<osg::Object> object = osgDB::readRefObjectFile("state.spt", localOptions.get());
|
||||
#endif
|
||||
if (!dynamic_cast<osg::StateSet*>(object.get()))
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -163,11 +163,7 @@ struct ReaderWriterSTG::_ModelBin {
|
||||
proxy->setCenterMode(osg::ProxyNode::UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED);
|
||||
node = proxy;
|
||||
} else {
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
node = osgDB::readNodeFile(o._name, o._options.get());
|
||||
#else
|
||||
node = osgDB::readRefNodeFile(o._name, o._options.get());
|
||||
#endif
|
||||
if (!node.valid()) {
|
||||
SG_LOG(SG_TERRAIN, SG_ALERT, o._errorLocation << ": Failed to load "
|
||||
<< o._token << " '" << o._name << "'");
|
||||
@@ -582,11 +578,8 @@ struct ReaderWriterSTG::_ModelBin {
|
||||
if (_foundBase) {
|
||||
for (auto stgObject : _objectList) {
|
||||
osg::ref_ptr<osg::Node> node;
|
||||
#if OSG_VERSION_LESS_THAN(3,4,0)
|
||||
node = osgDB::readNodeFile(stgObject._name, stgObject._options.get());
|
||||
#else
|
||||
node = osgDB::readRefNodeFile(stgObject._name, stgObject._options.get());
|
||||
#endif
|
||||
|
||||
if (!node.valid()) {
|
||||
SG_LOG(SG_TERRAIN, SG_ALERT, stgObject._errorLocation << ": Failed to load "
|
||||
<< stgObject._token << " '" << stgObject._name << "'");
|
||||
|
||||
@@ -103,13 +103,7 @@ SGVasiDrawable::drawImplementation(osg::RenderInfo& renderInfo) const
|
||||
draw(eyePoint, _lights[i]);
|
||||
}
|
||||
|
||||
osg::BoundingBox
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
SGVasiDrawable::computeBound()
|
||||
#else
|
||||
SGVasiDrawable::computeBoundingBox()
|
||||
#endif
|
||||
const
|
||||
osg::BoundingBox SGVasiDrawable::computeBoundingBox() const
|
||||
{
|
||||
osg::BoundingBox bb;
|
||||
for (unsigned i = 0; i < _lights.size(); ++i)
|
||||
|
||||
@@ -50,13 +50,7 @@ public:
|
||||
const SGVec3f& up);
|
||||
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
|
||||
virtual osg::BoundingBox
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
computeBound()
|
||||
#else
|
||||
computeBoundingBox()
|
||||
#endif
|
||||
const;
|
||||
virtual osg::BoundingBox computeBoundingBox() const;
|
||||
|
||||
private:
|
||||
SGVec4f getColor(float angleDeg) const;
|
||||
|
||||
@@ -47,11 +47,8 @@ void ShaderGeometry::addObject(const Vec3& position, float scale,
|
||||
void ShaderGeometry::drawImplementation(osg::RenderInfo& renderInfo) const
|
||||
{
|
||||
State& state = *renderInfo.getState();
|
||||
#if OSG_VERSION_LESS_THAN(3,3,4)
|
||||
const Extensions* extensions = getExtensions(state.getContextID(), true);
|
||||
#else
|
||||
const GLExtensions* extensions = GLExtensions::Get(state.getContextID(), true);
|
||||
#endif
|
||||
|
||||
Vec4Array::const_iterator citer = _posScaleArray->begin();
|
||||
Vec4Array::const_iterator cend = _posScaleArray->end();
|
||||
FloatArray::const_iterator viter = _vertexAttribArray->begin();
|
||||
@@ -64,20 +61,9 @@ void ShaderGeometry::drawImplementation(osg::RenderInfo& renderInfo) const
|
||||
}
|
||||
}
|
||||
|
||||
BoundingBox
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
ShaderGeometry::computeBound()
|
||||
#else
|
||||
ShaderGeometry::computeBoundingBox()
|
||||
#endif
|
||||
const
|
||||
BoundingBox ShaderGeometry::computeBoundingBox() const
|
||||
{
|
||||
const BoundingBox& geom_box =
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
_geometry->getBound();
|
||||
#else
|
||||
_geometry->getBoundingBox();
|
||||
#endif
|
||||
const BoundingBox& geom_box = _geometry->getBoundingBox();
|
||||
|
||||
BoundingBox bb;
|
||||
const Vec4Array* posScales = _posScaleArray.get();
|
||||
|
||||
@@ -60,13 +60,7 @@ class ShaderGeometry : public osg::Drawable
|
||||
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
|
||||
|
||||
virtual osg::BoundingBox
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
computeBound()
|
||||
#else
|
||||
computeBoundingBox()
|
||||
#endif
|
||||
const;
|
||||
virtual osg::BoundingBox computeBoundingBox() const;
|
||||
|
||||
void setGeometry(osg::Geometry* geometry)
|
||||
{
|
||||
|
||||
@@ -43,12 +43,7 @@ SGEnlargeBoundingBox::SGEnlargeBoundingBox(const SGEnlargeBoundingBox& cb,
|
||||
osg::BoundingBox
|
||||
SGEnlargeBoundingBox::computeBound(const osg::Drawable& drawable) const
|
||||
{
|
||||
osg::BoundingBox bound =
|
||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||
drawable.computeBound();
|
||||
#else
|
||||
drawable.computeBoundingBox();
|
||||
#endif
|
||||
osg::BoundingBox bound = drawable.computeBoundingBox();
|
||||
|
||||
if (!bound.valid())
|
||||
return bound;
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
SGEnlargeBoundingBox(float offset = 0);
|
||||
SGEnlargeBoundingBox(const SGEnlargeBoundingBox& cb, const osg::CopyOp&);
|
||||
META_Object(osg, SGEnlargeBoundingBox);
|
||||
virtual osg::BoundingBox computeBound(const osg::Drawable& drawable) const;
|
||||
osg::BoundingBox computeBound(const osg::Drawable& drawable) const override;
|
||||
|
||||
private:
|
||||
float _offset;
|
||||
|
||||
@@ -97,48 +97,22 @@ SGSceneFeatures::applyTextureCompression(osg::Texture* texture) const
|
||||
bool
|
||||
SGSceneFeatures::getHavePointSprites(unsigned contextId) const
|
||||
{
|
||||
#if OSG_VERSION_LESS_THAN(3,3,4)
|
||||
return osg::PointSprite::isPointSpriteSupported(contextId);
|
||||
#else
|
||||
const osg::GLExtensions* ex = osg::GLExtensions::Get(contextId, true);
|
||||
return ex && ex->isPointSpriteSupported;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
SGSceneFeatures::getHaveFragmentPrograms(unsigned contextId) const
|
||||
{
|
||||
#if OSG_VERSION_LESS_THAN(3,3,4)
|
||||
const osg::FragmentProgram::Extensions* fpe;
|
||||
fpe = osg::FragmentProgram::getExtensions(contextId, true);
|
||||
if (!fpe)
|
||||
return false;
|
||||
if (!fpe->isFragmentProgramSupported())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
#else
|
||||
const osg::GLExtensions* ex = osg::GLExtensions::Get(contextId, true);
|
||||
return ex && ex->isFragmentProgramSupported;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
SGSceneFeatures::getHaveVertexPrograms(unsigned contextId) const
|
||||
{
|
||||
#if OSG_VERSION_LESS_THAN(3,3,4)
|
||||
const osg::VertexProgram::Extensions* vpe;
|
||||
vpe = osg::VertexProgram::getExtensions(contextId, true);
|
||||
if (!vpe)
|
||||
return false;
|
||||
if (!vpe->isVertexProgramSupported())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
#else
|
||||
const osg::GLExtensions* ex = osg::GLExtensions::Get(contextId, true);
|
||||
return ex && ex->isVertexProgramSupported;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -152,16 +126,6 @@ SGSceneFeatures::getHaveShaderPrograms(unsigned contextId) const
|
||||
bool
|
||||
SGSceneFeatures::getHavePointParameters(unsigned contextId) const
|
||||
{
|
||||
#if OSG_VERSION_LESS_THAN(3,3,4)
|
||||
const osg::Point::Extensions* pe;
|
||||
pe = osg::Point::getExtensions(contextId, true);
|
||||
if (!pe)
|
||||
return false;
|
||||
if (!pe->isPointParametersSupported())
|
||||
return false;
|
||||
return true;
|
||||
#else
|
||||
const osg::GLExtensions* ex = osg::GLExtensions::Get(contextId, true);
|
||||
return ex && ex->isPointParametersSupported;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ include (SimGearComponent)
|
||||
|
||||
set(HEADERS
|
||||
OSGUtils.hxx
|
||||
OSGVersion.hxx
|
||||
SGAtomic.hxx
|
||||
SGBinding.hxx
|
||||
SGExpression.hxx
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
// OSGVersion.hxx - transform OpenSceneGraph version to something useful
|
||||
//
|
||||
// Copyright (C) 2008 Tim Moore timoore@redhat.com
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the
|
||||
// Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
// Boston, MA 02110-1301, USA.
|
||||
|
||||
#ifndef SIMGEAR_OSGVERSION_HXX
|
||||
#define SIMGEAR_OSGVERSION_HXX 1
|
||||
#include <osg/Version>
|
||||
#define SG_OSG_VERSION \
|
||||
((OPENSCENEGRAPH_MAJOR_VERSION*10000)\
|
||||
+ (OPENSCENEGRAPH_MINOR_VERSION*1000) + OPENSCENEGRAPH_PATCH_VERSION)
|
||||
|
||||
#define SG_OSG_VERSION_GREATER_EQUAL(MAJOR, MINOR, PATCH) \
|
||||
((OPENSCENEGRAPH_MAJOR_VERSION > (MAJOR)) || \
|
||||
(OPENSCENEGRAPH_MAJOR_VERSION == (MAJOR) && \
|
||||
(OPENSCENEGRAPH_MINOR_VERSION > (MINOR) || \
|
||||
(OPENSCENEGRAPH_MINOR_VERSION == (MINOR) && \
|
||||
OPENSCENEGRAPH_PATCH_VERSION >= (PATCH)))))
|
||||
|
||||
#define SG_OSG_VERSION_GREATER_THAN(MAJOR, MINOR, PATCH) \
|
||||
((OPENSCENEGRAPH_MAJOR_VERSION > (MAJOR)) || \
|
||||
(OPENSCENEGRAPH_MAJOR_VERSION == (MAJOR) && \
|
||||
(OPENSCENEGRAPH_MINOR_VERSION > (MINOR) || \
|
||||
(OPENSCENEGRAPH_MINOR_VERSION == (MINOR) && \
|
||||
OPENSCENEGRAPH_PATCH_VERSION > (PATCH)))))
|
||||
|
||||
#define SG_OSG_VERSION_LESS_THAN(MAJOR, MINOR, PATCH) \
|
||||
(!SG_OSG_VERSION_GREATER_EQUAL(MAJOR, MINOR, PATCH))
|
||||
|
||||
#define SG_OSG_VERSION_LESS_EQUAL(MAJOR, MINOR, PATCH) \
|
||||
(!SG_OSG_VERSION_GREATER_THAN(MAJOR, MINOR, PATCH))
|
||||
|
||||
#define SG_OSG_MIN_VERSION_REQUIRED(MAJOR, MINOR, PATCH) \
|
||||
SG_OSG_VERSION_GREATER_EQUAL(MAJOR, MINOR, PATCH)
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user