1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-10 03:39:55 +00:00

LocalMap no longer depends on osgViewer

This commit is contained in:
scrawl 2016-08-16 22:37:44 +02:00
parent b2ae45f0eb
commit 8bfcf259a3
3 changed files with 6 additions and 16 deletions

View File

@ -282,7 +282,7 @@ namespace MWGui
mRecharge = new Recharge();
mMenu = new MainMenu(w, h, mResourceSystem->getVFS(), mVersionDescription);
mLocalMapRender = new MWRender::LocalMap(mViewer);
mLocalMapRender = new MWRender::LocalMap(mViewer->getSceneData()->asGroup());
mMap = new MapWindow(mCustomMarkers, mDragAndDrop, mLocalMapRender);
trackWindow(mMap, "map");
mStatsWindow = new StatsWindow(mDragAndDrop);

View File

@ -7,11 +7,10 @@
#include <osg/LightModel>
#include <osg/Texture2D>
#include <osg/ComputeBoundsVisitor>
#include <osg/LightSource>
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <components/esm/fogstate.hpp>
#include <components/esm/loadcell.hpp>
#include <components/settings/settings.hpp>
@ -68,16 +67,14 @@ namespace
namespace MWRender
{
LocalMap::LocalMap(osgViewer::Viewer* viewer)
: mViewer(viewer)
LocalMap::LocalMap(osg::Group* root)
: mRoot(root)
, mMapResolution(Settings::Manager::getInt("local map resolution", "Map"))
, mMapWorldSize(8192.f)
, mCellDistance(Settings::Manager::getInt("local map cell distance", "Map"))
, mAngle(0.f)
, mInterior(false)
{
mRoot = mViewer->getSceneData()->asGroup();
SceneUtil::FindByNameVisitor find("Scene Root");
mRoot->accept(find);
mSceneRoot = find.mFoundNode;
@ -310,7 +307,7 @@ void LocalMap::requestExteriorMap(const MWWorld::CellStore* cell)
int x = cell->getCell()->getGridX();
int y = cell->getCell()->getGridY();
osg::BoundingSphere bound = mViewer->getSceneData()->getBound();
osg::BoundingSphere bound = mSceneRoot->getBound();
float zmin = bound.center().z() - bound.radius();
float zmax = bound.center().z() + bound.radius();

View File

@ -19,11 +19,6 @@ namespace ESM
struct FogTexture;
}
namespace osgViewer
{
class Viewer;
}
namespace osg
{
class Texture2D;
@ -41,7 +36,7 @@ namespace MWRender
class LocalMap
{
public:
LocalMap(osgViewer::Viewer* viewer);
LocalMap(osg::Group* root);
~LocalMap();
/**
@ -106,8 +101,6 @@ namespace MWRender
osg::Group* getRoot();
private:
osg::ref_ptr<osgViewer::Viewer> mViewer;
osg::ref_ptr<osg::Group> mRoot;
osg::ref_ptr<osg::Node> mSceneRoot;