VBO switch also controls random-buildings.
This commit is contained in:
parent
aa27a09801
commit
18ff03acdf
@ -108,7 +108,7 @@ BuildingBoundingBoxCallback::computeBound(const Drawable& drawable) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up the building set based on the material definitions
|
// Set up the building set based on the material definitions
|
||||||
SGBuildingBin::SGBuildingBin(const SGMaterial *mat) {
|
SGBuildingBin::SGBuildingBin(const SGMaterial *mat, bool useVBOs) {
|
||||||
|
|
||||||
material_name = new std::string(mat->get_names()[0]);
|
material_name = new std::string(mat->get_names()[0]);
|
||||||
SG_LOG(SG_TERRAIN, SG_DEBUG, "Building material " << material_name);
|
SG_LOG(SG_TERRAIN, SG_DEBUG, "Building material " << material_name);
|
||||||
@ -161,6 +161,10 @@ BuildingBoundingBoxCallback::computeBound(const Drawable& drawable) const
|
|||||||
sharedGeometry->setFogCoordBinding(osg::Geometry::BIND_PER_VERTEX);
|
sharedGeometry->setFogCoordBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||||
sharedGeometry->setComputeBoundingBoxCallback(new BuildingBoundingBoxCallback);
|
sharedGeometry->setComputeBoundingBoxCallback(new BuildingBoundingBoxCallback);
|
||||||
sharedGeometry->setUseDisplayList(false);
|
sharedGeometry->setUseDisplayList(false);
|
||||||
|
sharedGeometry->setDataVariance(osg::Object::STATIC);
|
||||||
|
if (useVBOs) {
|
||||||
|
sharedGeometry->setUseVertexBufferObjects(true);
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned int j = 0; j < BUILDING_SET_SIZE; j++) {
|
for (unsigned int j = 0; j < BUILDING_SET_SIZE; j++) {
|
||||||
float width;
|
float width;
|
||||||
|
@ -168,7 +168,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SGBuildingBin(const SGMaterial *mat);
|
SGBuildingBin(const SGMaterial *mat, bool useVBOs);
|
||||||
|
|
||||||
~SGBuildingBin() {
|
~SGBuildingBin() {
|
||||||
smallBuildings.clear();
|
smallBuildings.clear();
|
||||||
|
@ -480,7 +480,8 @@ public:
|
|||||||
SGMaterialLib* matlib,
|
SGMaterialLib* matlib,
|
||||||
float building_density,
|
float building_density,
|
||||||
bool use_random_objects,
|
bool use_random_objects,
|
||||||
bool use_random_buildings)
|
bool use_random_buildings,
|
||||||
|
bool useVBOs)
|
||||||
{
|
{
|
||||||
SGMaterialTriangleMap::iterator i;
|
SGMaterialTriangleMap::iterator i;
|
||||||
|
|
||||||
@ -508,7 +509,7 @@ public:
|
|||||||
SGBuildingBin* bin = NULL;
|
SGBuildingBin* bin = NULL;
|
||||||
|
|
||||||
if (building_coverage > 0) {
|
if (building_coverage > 0) {
|
||||||
bin = new SGBuildingBin(mat);
|
bin = new SGBuildingBin(mat, useVBOs);
|
||||||
randomBuildings.push_back(bin);
|
randomBuildings.push_back(bin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1121,6 +1122,7 @@ public:
|
|||||||
bool use_random_buildings = false;
|
bool use_random_buildings = false;
|
||||||
float vegetation_density = 1.0f;
|
float vegetation_density = 1.0f;
|
||||||
float building_density = 1.0f;
|
float building_density = 1.0f;
|
||||||
|
bool useVBOs = false;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Group> randomObjects;
|
osg::ref_ptr<osg::Group> randomObjects;
|
||||||
osg::ref_ptr<osg::Group> forestNode;
|
osg::ref_ptr<osg::Group> forestNode;
|
||||||
@ -1146,6 +1148,8 @@ public:
|
|||||||
= propertyNode->getFloatValue("/sim/rendering/building-density",
|
= propertyNode->getFloatValue("/sim/rendering/building-density",
|
||||||
building_density);
|
building_density);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useVBOs = (_options->getPluginStringData("SimGear::USE_VBOS") == "ON");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1154,7 +1158,8 @@ public:
|
|||||||
_tileGeometryBin->computeRandomObjectsAndBuildings(matlib,
|
_tileGeometryBin->computeRandomObjectsAndBuildings(matlib,
|
||||||
building_density,
|
building_density,
|
||||||
use_random_objects,
|
use_random_objects,
|
||||||
use_random_buildings);
|
use_random_buildings,
|
||||||
|
useVBOs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user