void-packages/srcpkgs/simgear/patches/fix-osg_versions.patch

188 lines
5.9 KiB
Diff

--- simgear/canvas/elements/CanvasText.cxx 2015-02-18 21:10:39.000000000 +0100
+++ simgear/canvas/elements/CanvasText.cxx 2015-10-31 11:45:28.423416396 +0100
@@ -159,13 +159,17 @@
if( empty() )
return pos;
-
+#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;
if( global_i == _begin )
// before first character of line
pos.x() = coords[_begin * 4].x();
else if( global_i == _end )
// After Last character of line
pos.x() = coords[(_end - 1) * 4 + 2].x();
@@ -194,7 +198,12 @@
return cursorPos(0);
GlyphQuads::Glyphs const& 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
float const HIT_FRACTION = 0.6;
float const character_width = _text->getCharacterHeight()
@@ -627,7 +636,12 @@
const GlyphQuads& quads = _textureGlyphQuadMap.begin()->second;
const GlyphQuads::Glyphs& glyphs = quads._glyphs;
- const GlyphQuads::Coords2& coords = quads._coords;
+#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;
float wr = _characterHeight / getCharacterAspectRatio();
--- simgear/scene/material/Technique.cxx 2015-02-18 21:10:39.000000000 +0100
+++ simgear/scene/material/Technique.cxx 2015-10-31 11:50:38.266385757 +0100
@@ -326,9 +326,15 @@
= 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
}
};
@@ -357,7 +363,11 @@
= 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
}
};
--- simgear/scene/sky/CloudShaderGeometry.cxx 2015-02-18 21:10:39.000000000 +0100
+++ simgear/scene/sky/CloudShaderGeometry.cxx 2015-10-31 11:53:28.855368888 +0100
@@ -128,7 +128,11 @@
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 };
--- simgear/scene/tgdb/ShaderGeometry.cxx 2015-02-18 21:10:39.000000000 +0100
+++ simgear/scene/tgdb/ShaderGeometry.cxx 2015-10-31 11:55:05.748359307 +0100
@@ -47,7 +47,11 @@
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();
--- simgear/scene/util/SGSceneFeatures.cxx 2015-02-18 21:10:39.000000000 +0100
+++ simgear/scene/util/SGSceneFeatures.cxx 2015-10-31 12:02:22.654316104 +0100
@@ -25,11 +25,13 @@
#include "SGSceneFeatures.hxx"
+#include <osg/Version>
#include <osg/FragmentProgram>
#include <osg/VertexProgram>
#include <osg/Point>
#include <osg/PointSprite>
#include <osg/Texture>
+#include <osg/GLExtensions>
#include <OpenThreads/Mutex>
#include <OpenThreads/ScopedLock>
@@ -84,12 +84,18 @@
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)
@@ -98,11 +104,16 @@
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)
@@ -111,6 +122,10 @@
return false;
return true;
+#else
+ const osg::GLExtensions* ex = osg::GLExtensions::Get(contextId, true);
+ return ex && ex->isVertexProgramSupported;
+#endif
}
bool
@@ -124,6 +139,7 @@
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)
@@ -131,5 +147,9 @@
if (!pe->isPointParametersSupported())
return false;
return true;
+#else
+ const osg::GLExtensions* ex = osg::GLExtensions::Get(contextId, true);
+ return ex && ex->isPointParametersSupported;
+#endif
}