]> git.mxchange.org Git - simgear.git/commitdiff
Add logging for the total number of random buildings generated.
authorStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Fri, 25 May 2012 18:47:45 +0000 (19:47 +0100)
committerStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Fri, 25 May 2012 18:47:45 +0000 (19:47 +0100)
simgear/scene/tgdb/SGBuildingBin.cxx
simgear/scene/tgdb/obj.cxx

index 8378a61396801086e288e375273b9f1f9bd38391..fb3b82d996d1759553267b96ccb150236778ddaf 100644 (file)
@@ -69,6 +69,7 @@ namespace simgear
   
 typedef std::map<std::string, osg::observer_ptr<osg::StateSet> > BuildingStateSetMap;
 static BuildingStateSetMap statesetmap;
+static int numBuildings;
 
 void addBuildingToLeafGeode(Geode* geode, const SGBuildingBin::Building& building)
 {
@@ -602,6 +603,8 @@ osg::Group* createRandomBuildings(SGBuildingBinList buildings, const osg::Matrix
       
     BOOST_FOREACH(bin, buildings)
     {      
+        numBuildings = numBuildings + bin->getNumBuildings();
+        SG_LOG(SG_TERRAIN, SG_DEBUG, "Total random buildings generated: " << numBuildings);
       
         ref_ptr<Effect> effect;
         EffectMap::iterator iter = buildingEffectMap.find(bin->texture);
@@ -643,11 +646,10 @@ osg::Group* createRandomBuildings(SGBuildingBinList buildings, const osg::Matrix
                        BuildingTransformer(transInv));
         quadbuilding.buildQuadTree(rotatedBuildings.begin(), rotatedBuildings.end());
         
-        ref_ptr<Group> group = quadbuilding.getRoot();
-        
+        ref_ptr<Group> group = quadbuilding.getRoot();        
         mt->addChild(group);  
-        delete bin;      
-    }
+        delete bin;  
+    }        
     
     buildings.clear();
     
index 08606a0673ead1f579021bd726f10f13137841b2..12798da2605e472e4891a0f7dd34bf2dc7be0033 100644 (file)
@@ -726,13 +726,15 @@ struct SGTileGeometryBin {
         for (l = triangle_buildings.begin(); l != triangle_buildings.end(); ++l) {
           bin->insert(*l);
         }
+        
+        triangle_buildings.clear();
       }
       
-      SG_LOG(SG_INPUT, SG_DEBUG, "Random Buildings: " << bin->getNumBuildings());
-      SG_LOG(SG_INPUT, SG_DEBUG, "  Dropped due to mask: " << mask_dropped);
-      SG_LOG(SG_INPUT, SG_DEBUG, "  Dropped due to triangle edge: " << triangle_dropped);
-      SG_LOG(SG_INPUT, SG_DEBUG, "  Dropped due to random object: " << random_dropped);
-      SG_LOG(SG_INPUT, SG_DEBUG, "  Dropped due to other building: " << building_dropped);
+      SG_LOG(SG_TERRAIN, SG_DEBUG, "Random Buildings: " << bin->getNumBuildings());
+      SG_LOG(SG_TERRAIN, SG_DEBUG, "  Dropped due to mask: " << mask_dropped);
+      SG_LOG(SG_TERRAIN, SG_DEBUG, "  Dropped due to triangle edge: " << triangle_dropped);
+      SG_LOG(SG_TERRAIN, SG_DEBUG, "  Dropped due to random object: " << random_dropped);
+      SG_LOG(SG_TERRAIN, SG_DEBUG, "  Dropped due to other building: " << building_dropped);
     }
   }