]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/tgdb/obj.cxx
Merge commit 'b846e33' into next
[simgear.git] / simgear / scene / tgdb / obj.cxx
index 54e3ef164735a99f0e205606b949a4cbf00a665d..fd6d42e29e13d5c5d6d6f077123622057514e8d4 100644 (file)
@@ -382,6 +382,7 @@ struct SGTileGeometryBin {
       if (mat)
         eg->setEffect(mat->get_effect());
       eg->addDrawable(geometry);
+      eg->runGenerators(geometry);  // Generate extra data needed by effect
       if (group)
         group->addChild(eg);
     }
@@ -610,13 +611,13 @@ SGLoadBTG(const std::string& path, SGMaterialLib *matlib, bool calc_lights, bool
              i < tileGeometryBin.randomModels.getNumModels(); i++) {
           SGMatModelBin::MatModel obj
             = tileGeometryBin.randomModels.getMatModel(i);
-          osg::Node* node = sgGetRandomModel(obj.model);
+          osg::Node* node = sgGetRandomModel(obj.model, seed);
         
           // Create a matrix to place the object in the correct
           // location, and then apply the rotation matrix created
           // above, with an additional random heading rotation if appropriate.
           osg::Matrix transformMat;
-          transformMat = osg::Matrix::translate(obj.position.osg());
+          transformMat = osg::Matrix::translate(toOsg(obj.position));
           if (obj.model->get_heading_type() == SGMatModel::HEADING_RANDOM) {
             // Rotate the object around the z axis.
             double hdg = mt_rand(&seed) * M_PI * 2;
@@ -758,8 +759,8 @@ SGLoadBTG(const std::string& path, SGMaterialLib *matlib, bool calc_lights, bool
   // The toplevel transform for that tile.
   osg::MatrixTransform* transform = new osg::MatrixTransform;
   transform->setName(path);
-  transform->setMatrix(osg::Matrix::rotate(hlOr.osg())*
-                       osg::Matrix::translate(center.osg()));
+  transform->setMatrix(osg::Matrix::rotate(toOsg(hlOr))*
+                       osg::Matrix::translate(toOsg(center)));
   transform->addChild(terrainGroup);
   if (lightGroup->getNumChildren() > 0) {
     osg::LOD* lightLOD = new osg::LOD;