Restore compatibility with stable OSG (3.0.1)

This commit is contained in:
Thomas Geymayer 2013-06-30 21:25:21 +02:00
parent d4b48cec5d
commit 14eccc70da
2 changed files with 19 additions and 5 deletions

View File

@ -20,7 +20,7 @@
#include <simgear/canvas/Canvas.hxx>
#include <simgear/canvas/CanvasSystemAdapter.hxx>
#include <simgear/scene/util/parse_color.hxx>
#include <simgear/structure/OSGVersion.hxx>
#include <osg/Version>
#include <osgText/Text>
namespace simgear
@ -175,7 +175,7 @@ namespace canvas
if( !bb.valid() )
return bb;
#if SG_OSG_VERSION_LESS_THAN(3,1,0)
#if OSG_VERSION_LESS_THAN(3,1,0)
// TODO bounding box still doesn't seem always right (eg. with center
// horizontal alignment not completely accurate)
bb._min.y() += _offset.y();

View File

@ -22,6 +22,8 @@
#include "Effect.hxx"
#include "Technique.hxx"
#include <osg/Version>
#include <osgUtil/CullVisitor>
#include <osgUtil/TangentSpaceGenerator>
@ -80,15 +82,27 @@ void EffectGeode::runGenerators(osg::Geometry *geometry)
int n = _effect->getGenerator(Effect::TANGENT);
tsg->generate(geometry, 0); // 0 is normal_unit, but I have no idea what that is!
if (n != -1 && !geometry->getVertexAttribArray(n))
geometry->setVertexAttribArray(n, tsg->getTangentArray());
#if OSG_MIN_VERSION_REQUIRED(3,1,8)
geometry->setVertexAttribArray(n, tsg->getTangentArray(), osg::Array::BIND_PER_VERTEX);
#else
geometry->setVertexAttribData(n, osg::Geometry::ArrayData(tsg->getTangentArray(), osg::Geometry::BIND_PER_VERTEX,GL_FALSE));
#endif
n = _effect->getGenerator(Effect::BINORMAL);
if (n != -1 && !geometry->getVertexAttribArray(n))
geometry->setVertexAttribArray(n, tsg->getBinormalArray());
#if OSG_MIN_VERSION_REQUIRED(3,1,8)
geometry->setVertexAttribArray(n, tsg->getBinormalArray(), osg::Array::BIND_PER_VERTEX);
#else
geometry->setVertexAttribData(n, osg::Geometry::ArrayData(tsg->getBinormalArray(), osg::Geometry::BIND_PER_VERTEX,GL_FALSE));
#endif
n = _effect->getGenerator(Effect::NORMAL);
if (n != -1 && !geometry->getVertexAttribArray(n))
geometry->setVertexAttribArray(n, tsg->getNormalArray());
#if OSG_MIN_VERSION_REQUIRED(3,1,8)
geometry->setVertexAttribArray(n, tsg->getNormalArray(), osg::Array::BIND_PER_VERTEX);
#else
geometry->setVertexAttribData(n, osg::Geometry::ArrayData(tsg->getNormalArray(), osg::Geometry::BIND_PER_VERTEX,GL_FALSE));
#endif
}
}