1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 07:53:53 +00:00

Merge remote-tracking branch 'scrawl/opencs'

This commit is contained in:
Marc Zinnschlag 2015-07-18 11:58:20 +02:00
commit e921552053
8 changed files with 21 additions and 18 deletions

View file

@ -62,7 +62,7 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec
CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager)
: mEncoder (encoding), mPathgrids (mCells), mRefs (mCells),
mResourcesManager (resourcesManager), mReader (0), mDialogue (0), mReaderIndex(0), mResourceSystem(resourcesManager.getVFS())
mResourcesManager (resourcesManager), mReader (0), mDialogue (0), mReaderIndex(0), mResourceSystem(new Resource::ResourceSystem(resourcesManager.getVFS()))
{
int index = 0;
@ -537,14 +537,14 @@ CSMWorld::Data::~Data()
delete mReader;
}
Resource::ResourceSystem* CSMWorld::Data::getResourceSystem()
boost::shared_ptr<Resource::ResourceSystem> CSMWorld::Data::getResourceSystem()
{
return &mResourceSystem;
return mResourceSystem;
}
const Resource::ResourceSystem* CSMWorld::Data::getResourceSystem() const
boost::shared_ptr<const Resource::ResourceSystem> CSMWorld::Data::getResourceSystem() const
{
return &mResourceSystem;
return mResourceSystem;
}
const CSMWorld::IdCollection<ESM::Global>& CSMWorld::Data::getGlobals() const

View file

@ -113,7 +113,7 @@ namespace CSMWorld
std::map<std::string, std::map<ESM::RefNum, std::string> > mRefLoadCache;
int mReaderIndex;
Resource::ResourceSystem mResourceSystem;
boost::shared_ptr<Resource::ResourceSystem> mResourceSystem;
std::vector<boost::shared_ptr<ESM::ESMReader> > mReaders;
@ -138,9 +138,9 @@ namespace CSMWorld
const VFS::Manager* getVFS() const;
Resource::ResourceSystem* getResourceSystem();
boost::shared_ptr<Resource::ResourceSystem> getResourceSystem();
const Resource::ResourceSystem* getResourceSystem() const;
boost::shared_ptr<const Resource::ResourceSystem> getResourceSystem() const;
const IdCollection<ESM::Global>& getGlobals() const;

View file

@ -71,7 +71,7 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::st
const ESM::Land* esmLand = land.getRecord(mId).get().mLand.get();
if(esmLand && esmLand->mDataTypes&ESM::Land::DATA_VHGT)
{
mTerrain.reset(new Terrain::TerrainGrid(mCellNode, data.getResourceSystem(), NULL, new TerrainStorage(mData), Element_Terrain<<1));
mTerrain.reset(new Terrain::TerrainGrid(mCellNode, data.getResourceSystem().get(), NULL, new TerrainStorage(mData), Element_Terrain<<1));
mTerrain->loadCell(esmLand->mX,
esmLand->mY);

View file

@ -116,7 +116,7 @@ const CSMWorld::CellRef& CSVRender::Object::getReference() const
CSVRender::Object::Object (CSMWorld::Data& data, osg::Group* parentNode,
const std::string& id, bool referenceable, bool forceBaseToZero)
: mData (data), mBaseNode(0), mParentNode(parentNode), mResourceSystem(data.getResourceSystem()), mForceBaseToZero (forceBaseToZero)
: mData (data), mBaseNode(0), mParentNode(parentNode), mResourceSystem(data.getResourceSystem().get()), mForceBaseToZero (forceBaseToZero)
{
mBaseNode = new osg::PositionAttitudeTransform;
parentNode->addChild(mBaseNode);

View file

@ -8,7 +8,7 @@
CSVRender::PreviewWidget::PreviewWidget (CSMWorld::Data& data,
const std::string& id, bool referenceable, QWidget *parent)
: SceneWidget (data.getResourceSystem()->getSceneManager(), parent), mData (data), mObject(data, mRootNode, id, referenceable)
: SceneWidget (data.getResourceSystem(), parent), mData (data), mObject(data, mRootNode, id, referenceable)
{
mView->setCameraManipulator(new osgGA::TrackballManipulator);

View file

@ -13,6 +13,7 @@
#include <osg/LightModel>
#include <components/resource/scenemanager.hpp>
#include <components/resource/resourcesystem.hpp>
#include "../widget/scenetoolmode.hpp"
#include "../../model/settings/usersettings.hpp"
@ -132,9 +133,9 @@ void CompositeViewer::update()
// ---------------------------------------------------
SceneWidget::SceneWidget(Resource::SceneManager* sceneManager, QWidget *parent, Qt::WindowFlags f)
SceneWidget::SceneWidget(boost::shared_ptr<Resource::ResourceSystem> resourceSystem, QWidget *parent, Qt::WindowFlags f)
: RenderWidget(parent, f)
, mSceneManager(sceneManager)
, mResourceSystem(resourceSystem)
, mLighting(NULL)
, mHasDefaultAmbient(false)
{
@ -147,7 +148,7 @@ SceneWidget::SceneWidget(Resource::SceneManager* sceneManager, QWidget *parent,
SceneWidget::~SceneWidget()
{
// Since we're holding on to the scene templates past the existance of this graphics context, we'll need to manually release the created objects
mSceneManager->releaseGLObjects(mView->getCamera()->getGraphicsContext()->getState());
mResourceSystem->getSceneManager()->releaseGLObjects(mView->getCamera()->getGraphicsContext()->getState());
}
void SceneWidget::setLighting(Lighting *lighting)

View file

@ -4,6 +4,8 @@
#include <QWidget>
#include <QTimer>
#include <boost/shared_ptr.hpp>
#include "lightingday.hpp"
#include "lightingnight.hpp"
#include "lightingbright.hpp"
@ -13,7 +15,7 @@
namespace Resource
{
class SceneManager;
class ResourceSystem;
}
namespace osg
@ -57,7 +59,7 @@ namespace CSVRender
{
Q_OBJECT
public:
SceneWidget(Resource::SceneManager* sceneManager, QWidget* parent = 0, Qt::WindowFlags f = 0);
SceneWidget(boost::shared_ptr<Resource::ResourceSystem> resourceSystem, QWidget* parent = 0, Qt::WindowFlags f = 0);
virtual ~SceneWidget();
CSVWidget::SceneToolMode *makeLightingSelector (CSVWidget::SceneToolbar *parent);
@ -73,7 +75,7 @@ namespace CSVRender
void setAmbient(const osg::Vec4f& ambient);
Resource::SceneManager* mSceneManager;
boost::shared_ptr<Resource::ResourceSystem> mResourceSystem;
Lighting* mLighting;

View file

@ -24,7 +24,7 @@
#include "editmode.hpp"
CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidget* parent)
: SceneWidget (document.getData().getResourceSystem()->getSceneManager(), parent), mSceneElements(0), mRun(0), mDocument(document),
: SceneWidget (document.getData().getResourceSystem(), parent), mSceneElements(0), mRun(0), mDocument(document),
mInteractionMask (0)
{
setAcceptDrops(true);