From: Stuart Buchanan Date: Fri, 25 May 2012 18:47:45 +0000 (+0100) Subject: Add logging for the total number of random buildings generated. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c6d2e32f059d5169674272a2b991d7f7d9ef425d;p=simgear.git Add logging for the total number of random buildings generated. --- diff --git a/simgear/scene/tgdb/SGBuildingBin.cxx b/simgear/scene/tgdb/SGBuildingBin.cxx index 8378a613..fb3b82d9 100644 --- a/simgear/scene/tgdb/SGBuildingBin.cxx +++ b/simgear/scene/tgdb/SGBuildingBin.cxx @@ -69,6 +69,7 @@ namespace simgear typedef std::map > 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; 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 = quadbuilding.getRoot(); - + ref_ptr group = quadbuilding.getRoot(); mt->addChild(group); - delete bin; - } + delete bin; + } buildings.clear(); diff --git a/simgear/scene/tgdb/obj.cxx b/simgear/scene/tgdb/obj.cxx index 08606a06..12798da2 100644 --- a/simgear/scene/tgdb/obj.cxx +++ b/simgear/scene/tgdb/obj.cxx @@ -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); } }