From 3eca5765c933d348eb16ca36d0e69eec8cb8e943 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 19 Jan 2015 11:29:55 +0000 Subject: [PATCH] Added GeometryPool::s/getUseGeometryShader() hint, and OSG_TERRAIN_USE_GEOMETRY_SHADER env var for setting the default value. git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14660 16af8721-9629-0410-8352-f15c8da7e697 --- include/osgTerrain/GeometryPool | 3 +++ src/osgTerrain/GeometryPool.cpp | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/osgTerrain/GeometryPool b/include/osgTerrain/GeometryPool index e166875f5..8cf2e5992 100644 --- a/include/osgTerrain/GeometryPool +++ b/include/osgTerrain/GeometryPool @@ -110,6 +110,9 @@ class OSGTERRAIN_EXPORT GeometryPool : public osg::Referenced void applyLayers(osgTerrain::TerrainTile* tile, osg::StateSet* stateset); + void setUseGeometryShader(bool flag) { _useGeometryShader = flag; } + bool getUseGeometryShader() const { return _useGeometryShader; } + protected: virtual ~GeometryPool(); diff --git a/src/osgTerrain/GeometryPool.cpp b/src/osgTerrain/GeometryPool.cpp index 242e367bc..267b58059 100644 --- a/src/osgTerrain/GeometryPool.cpp +++ b/src/osgTerrain/GeometryPool.cpp @@ -44,6 +44,19 @@ const osgTerrain::Locator* osgTerrain::computeMasterLocator(const osgTerrain::Te GeometryPool::GeometryPool(): _useGeometryShader(false) { + const char* ptr = 0; + if ((ptr = getenv("OSG_TERRAIN_USE_GEOMETRY_SHADER")) != 0) + { + if (strcmp(ptr,"OFF")==0 || strcmp(ptr,"Off")==0 || strcmp(ptr,"off")==0 || + strcmp(ptr,"FALSE")==0 || strcmp(ptr,"False")==0 || strcmp(ptr,"false")==0) + { + _useGeometryShader = false; + } + else + { + _useGeometryShader = true; + } + } } GeometryPool::~GeometryPool()