diff --git a/components/esmterrain/storage.cpp b/components/esmterrain/storage.cpp index 2242ed554..d1138a147 100644 --- a/components/esmterrain/storage.cpp +++ b/components/esmterrain/storage.cpp @@ -98,7 +98,7 @@ namespace ESMTerrain min = defaultHeight; max = defaultHeight; - return true; + return false; } void Storage::fixNormal (osg::Vec3f& normal, int cellX, int cellY, int col, int row) diff --git a/components/terrain/chunkmanager.cpp b/components/terrain/chunkmanager.cpp index ab660dfb9..94c521d5b 100644 --- a/components/terrain/chunkmanager.cpp +++ b/components/terrain/chunkmanager.cpp @@ -17,26 +17,6 @@ #include "texturemanager.hpp" #include "compositemaprenderer.hpp" -namespace -{ - class StaticBoundingBoxCallback : public osg::Drawable::ComputeBoundingBoxCallback - { - public: - StaticBoundingBoxCallback(const osg::BoundingBox& bounds) - : mBoundingBox(bounds) - { - } - - virtual osg::BoundingBox computeBound(const osg::Drawable&) const - { - return mBoundingBox; - } - - private: - osg::BoundingBox mBoundingBox; - }; -} - namespace Terrain { @@ -102,10 +82,6 @@ osg::ref_ptr ChunkManager::createCompositeMapRTT(osg::ref_ptr ChunkManager::createChunk(float chunkSize, const osg::Vec2f &chunkCenter) { - float minH, maxH; - if (!mStorage->getMinMaxHeights(chunkSize, chunkCenter, minH, maxH)) - return NULL; // no terrain defined - osg::Vec2f worldCenter = chunkCenter*mStorage->getCellWorldSize(); osg::ref_ptr transform (new SceneUtil::PositionAttitudeTransform); transform->setPosition(osg::Vec3f(worldCenter.x(), worldCenter.y(), 0.f)); @@ -134,16 +110,7 @@ osg::ref_ptr ChunkManager::createChunk(float chunkSize, const osg::Ve geometry->addPrimitiveSet(mBufferCache.getIndexBuffer(numVerts, 0)); - - // we already know the bounding box, so no need to let OSG compute it. - osg::Vec3f min(-0.5f*mStorage->getCellWorldSize()*chunkSize, - -0.5f*mStorage->getCellWorldSize()*chunkSize, - minH); - osg::Vec3f max (0.5f*mStorage->getCellWorldSize()*chunkSize, - 0.5f*mStorage->getCellWorldSize()*chunkSize, - maxH); - osg::BoundingBox bounds(min, max); - geometry->setComputeBoundingBoxCallback(new StaticBoundingBoxCallback(bounds)); + geometry->getBound(); std::vector layerList; std::vector > blendmaps;