1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

39 lines
856 B
C++
Raw Normal View History

#include "world.hpp"
2015-06-03 01:18:36 +02:00
#include <osg/Group>
#include <osgUtil/IncrementalCompileOperation>
#include "storage.hpp"
namespace Terrain
{
2015-06-03 01:18:36 +02:00
World::World(osg::Group* parent, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico,
Storage* storage, int nodeMask)
: mStorage(storage)
2015-04-25 13:37:42 -05:00
, mCache(storage->getCellVertices())
2015-06-03 01:18:36 +02:00
, mParent(parent)
, mResourceSystem(resourceSystem)
, mIncrementalCompileOperation(ico)
{
2015-06-03 01:18:36 +02:00
mTerrainRoot = new osg::Group;
mTerrainRoot->setNodeMask(nodeMask);
mTerrainRoot->getOrCreateStateSet()->setRenderingHint(osg::StateSet::OPAQUE_BIN);
mParent->addChild(mTerrainRoot);
}
World::~World()
{
2015-06-03 01:18:36 +02:00
mParent->removeChild(mTerrainRoot);
delete mStorage;
}
2015-06-03 01:18:36 +02:00
float World::getHeightAt(const osg::Vec3f &worldPos)
{
return mStorage->getHeightAt(worldPos);
}
}