You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
858 B
C++
39 lines
858 B
C++
#include "world.hpp"
|
|
|
|
#include <osg/Group>
|
|
#include <osgUtil/IncrementalCompileOperation>
|
|
|
|
#include "storage.hpp"
|
|
|
|
namespace Terrain
|
|
{
|
|
|
|
World::World(osg::Group* parent, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico,
|
|
Storage* storage, int nodeMask)
|
|
: mStorage(storage)
|
|
, mParent(parent)
|
|
, mResourceSystem(resourceSystem)
|
|
, mIncrementalCompileOperation(ico)
|
|
{
|
|
mTerrainRoot = new osg::Group;
|
|
mTerrainRoot->setNodeMask(nodeMask);
|
|
mTerrainRoot->getOrCreateStateSet()->setRenderingHint(osg::StateSet::OPAQUE_BIN);
|
|
mTerrainRoot->setName("Terrain Root");
|
|
|
|
mParent->addChild(mTerrainRoot);
|
|
}
|
|
|
|
World::~World()
|
|
{
|
|
mParent->removeChild(mTerrainRoot);
|
|
|
|
delete mStorage;
|
|
}
|
|
|
|
float World::getHeightAt(const osg::Vec3f &worldPos)
|
|
{
|
|
return mStorage->getHeightAt(worldPos);
|
|
}
|
|
|
|
}
|