Merge pull request #1717 from akortunov/default_terrain

Render default land texture for Wilderness cells with distant terrain
pull/436/head
Bret Curtis 7 years ago committed by GitHub
commit b4098b24b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -189,36 +189,23 @@ public:
node->setViewDataMap(mViewDataMap); node->setViewDataMap(mViewDataMap);
parent->addChild(node); parent->addChild(node);
if (center.x() - size > mMaxX if (node->getSize() > mMinSize)
|| center.x() + size < mMinX {
|| center.y() - size > mMaxY addChildren(node);
|| center.y() + size < mMinY )
// Out of bounds of the actual terrain - this will happen because
// we rounded the size up to the next power of two
{
// Still create and return an empty node so as to not break the assumption that each QuadTreeNode has either 4 or 0 children.
return node; return node;
} }
if (node->getSize() <= mMinSize)
{
// We arrived at a leaf // We arrived at a leaf
float minZ, maxZ; float minZ, maxZ;
if (mStorage->getMinMaxHeights(size, center, minZ, maxZ)) mStorage->getMinMaxHeights(size, center, minZ, maxZ);
{
float cellWorldSize = mStorage->getCellWorldSize(); float cellWorldSize = mStorage->getCellWorldSize();
osg::BoundingBox boundingBox(osg::Vec3f((center.x()-size)*cellWorldSize, (center.y()-size)*cellWorldSize, minZ), osg::BoundingBox boundingBox(osg::Vec3f((center.x()-size)*cellWorldSize, (center.y()-size)*cellWorldSize, minZ),
osg::Vec3f((center.x()+size)*cellWorldSize, (center.y()+size)*cellWorldSize, maxZ)); osg::Vec3f((center.x()+size)*cellWorldSize, (center.y()+size)*cellWorldSize, maxZ));
node->setBoundingBox(boundingBox); node->setBoundingBox(boundingBox);
}
return node;
}
else
{
addChildren(node);
return node; return node;
} }
}
osg::ref_ptr<RootNode> getRootNode() osg::ref_ptr<RootNode> getRootNode()
{ {

Loading…
Cancel
Save