1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00
OpenMW/components/terrain/world.cpp

39 lines
856 B
C++
Raw Normal View History

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