]> git.mxchange.org Git - simgear.git/commitdiff
Work around apparent OSG 3.2.0 normal binding bug.
authorStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Fri, 6 Dec 2013 22:12:52 +0000 (22:12 +0000)
committerStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Fri, 6 Dec 2013 22:12:52 +0000 (22:12 +0000)
simgear/scene/tgdb/SGBuildingBin.cxx

index 3149f844a9519fd31672e06aa67b354742d23caa..042c56f67a34db6b0437e6ed1d7efc8ce2881d27 100644 (file)
@@ -158,7 +158,6 @@ BuildingBoundingBoxCallback::computeBound(const Drawable& drawable) const
       t->reserve(BUILDING_SET_SIZE * VERTICES_PER_BUILDING);
       n->reserve(BUILDING_SET_SIZE * VERTICES_PER_BUILDING);
 
-      sharedGeometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
       sharedGeometry->setFogCoordBinding(osg::Geometry::BIND_PER_VERTEX);
       sharedGeometry->setComputeBoundingBoxCallback(new BuildingBoundingBoxCallback);
       sharedGeometry->setUseDisplayList(false);
@@ -638,6 +637,10 @@ BuildingBoundingBoxCallback::computeBound(const Drawable& drawable) const
       sharedGeometry->setVertexArray(v);
       sharedGeometry->setTexCoordArray(0, t);
       sharedGeometry->setNormalArray(n);
+
+      // Work around a bug in OSG 3.2.0 where BIND_PER_VERTEX appears
+      // not to take effect if the normal array is set subsequently.
+      sharedGeometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
     }
   }