forked from teamnwah/openmw-tes3coop
Global map base layer
This commit is contained in:
parent
bec9abd319
commit
75ace9f8b5
5 changed files with 60 additions and 69 deletions
|
@ -22,10 +22,10 @@ source_group(game FILES ${GAME} ${GAME_HEADER})
|
||||||
add_openmw_dir (mwrender
|
add_openmw_dir (mwrender
|
||||||
actors objects renderingmanager animation sky npcanimation vismask
|
actors objects renderingmanager animation sky npcanimation vismask
|
||||||
creatureanimation effectmanager util renderinginterface pathgrid rendermode
|
creatureanimation effectmanager util renderinginterface pathgrid rendermode
|
||||||
bulletdebugdraw
|
bulletdebugdraw globalmap
|
||||||
# camera
|
# camera
|
||||||
# localmap occlusionquery water shadows
|
# localmap occlusionquery water shadows
|
||||||
# characterpreview globalmap ripplesimulation refraction
|
# characterpreview ripplesimulation refraction
|
||||||
# terrainstorage weaponanimation
|
# terrainstorage weaponanimation
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#include "mapwindow.hpp"
|
#include "mapwindow.hpp"
|
||||||
|
|
||||||
#include <OgreSceneNode.h>
|
|
||||||
#include <OgreVector2.h>
|
#include <OgreVector2.h>
|
||||||
|
|
||||||
|
#include <osg/Texture2D>
|
||||||
|
|
||||||
#include <MyGUI_ScrollView.h>
|
#include <MyGUI_ScrollView.h>
|
||||||
#include <MyGUI_ImageBox.h>
|
#include <MyGUI_ImageBox.h>
|
||||||
#include <MyGUI_RenderManager.h>
|
#include <MyGUI_RenderManager.h>
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
|
|
||||||
#include <components/esm/globalmap.hpp>
|
#include <components/esm/globalmap.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
|
#include <components/myguiplatform/myguitexture.hpp>
|
||||||
|
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
@ -559,6 +561,7 @@ namespace MWGui
|
||||||
: WindowPinnableBase("openmw_map_window.layout")
|
: WindowPinnableBase("openmw_map_window.layout")
|
||||||
, NoDrop(drag, mMainWidget)
|
, NoDrop(drag, mMainWidget)
|
||||||
, LocalMapBase(customMarkers)
|
, LocalMapBase(customMarkers)
|
||||||
|
, mGlobalMapTexture(NULL)
|
||||||
, mGlobal(false)
|
, mGlobal(false)
|
||||||
, mGlobalMap(0)
|
, mGlobalMap(0)
|
||||||
//, mGlobalMapRender(0)
|
//, mGlobalMapRender(0)
|
||||||
|
@ -708,19 +711,23 @@ namespace MWGui
|
||||||
|
|
||||||
void MapWindow::renderGlobalMap(Loading::Listener* loadingListener)
|
void MapWindow::renderGlobalMap(Loading::Listener* loadingListener)
|
||||||
{
|
{
|
||||||
#if 0
|
mGlobalMapRender = new MWRender::GlobalMap();
|
||||||
mGlobalMapRender = new MWRender::GlobalMap("");
|
|
||||||
mGlobalMapRender->render(loadingListener);
|
mGlobalMapRender->render(loadingListener);
|
||||||
mGlobalMap->setCanvasSize (mGlobalMapRender->getWidth(), mGlobalMapRender->getHeight());
|
mGlobalMap->setCanvasSize (mGlobalMapRender->getWidth(), mGlobalMapRender->getHeight());
|
||||||
mGlobalMapImage->setSize(mGlobalMapRender->getWidth(), mGlobalMapRender->getHeight());
|
mGlobalMapImage->setSize(mGlobalMapRender->getWidth(), mGlobalMapRender->getHeight());
|
||||||
mGlobalMapImage->setImageTexture("GlobalMap.png");
|
|
||||||
mGlobalMapOverlay->setImageTexture("GlobalMapOverlay");
|
mGlobalMapTexture = new osgMyGUI::OSGTexture(mGlobalMapRender->getBaseTexture());
|
||||||
#endif
|
mGlobalMapImage->setRenderItemTexture(mGlobalMapTexture);
|
||||||
|
mGlobalMapImage->getSubWidgetMain()->_setUVSet(MyGUI::FloatRect(0.f, 0.f, 1.f, 1.f));
|
||||||
|
|
||||||
|
//mGlobalMapOverlay->setImageTexture("GlobalMapOverlay");
|
||||||
}
|
}
|
||||||
|
|
||||||
MapWindow::~MapWindow()
|
MapWindow::~MapWindow()
|
||||||
{
|
{
|
||||||
//delete mGlobalMapRender;
|
delete mGlobalMapTexture;
|
||||||
|
|
||||||
|
delete mGlobalMapRender;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::setCellName(const std::string& cellName)
|
void MapWindow::setCellName(const std::string& cellName)
|
||||||
|
@ -730,7 +737,6 @@ namespace MWGui
|
||||||
|
|
||||||
void MapWindow::addVisitedLocation(const std::string& name, int x, int y)
|
void MapWindow::addVisitedLocation(const std::string& name, int x, int y)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
CellId cell;
|
CellId cell;
|
||||||
cell.first = x;
|
cell.first = x;
|
||||||
cell.second = y;
|
cell.second = y;
|
||||||
|
@ -757,7 +763,6 @@ namespace MWGui
|
||||||
markerWidget->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
markerWidget->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
||||||
markerWidget->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
markerWidget->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::cellExplored(int x, int y)
|
void MapWindow::cellExplored(int x, int y)
|
||||||
|
@ -769,12 +774,11 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
LocalMapBase::onFrame(dt);
|
LocalMapBase::onFrame(dt);
|
||||||
|
|
||||||
#if 0
|
|
||||||
for (std::vector<CellId>::iterator it = mQueuedToExplore.begin(); it != mQueuedToExplore.end(); ++it)
|
for (std::vector<CellId>::iterator it = mQueuedToExplore.begin(); it != mQueuedToExplore.end(); ++it)
|
||||||
{
|
{
|
||||||
mGlobalMapRender->exploreCell(it->first, it->second);
|
mGlobalMapRender->exploreCell(it->first, it->second);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
mQueuedToExplore.clear();
|
mQueuedToExplore.clear();
|
||||||
|
|
||||||
NoDrop::onFrame(dt);
|
NoDrop::onFrame(dt);
|
||||||
|
@ -831,14 +835,12 @@ namespace MWGui
|
||||||
|
|
||||||
void MapWindow::globalMapUpdatePlayer ()
|
void MapWindow::globalMapUpdatePlayer ()
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
// For interiors, position is set by WindowManager via setGlobalMapPlayerPosition
|
// For interiors, position is set by WindowManager via setGlobalMapPlayerPosition
|
||||||
if (MWBase::Environment::get().getWorld ()->isCellExterior ())
|
if (MWBase::Environment::get().getWorld ()->isCellExterior ())
|
||||||
{
|
{
|
||||||
Ogre::Vector3 pos = MWBase::Environment::get().getWorld ()->getPlayerPtr().getRefData ().getBaseNode ()->_getDerivedPosition ();
|
osg::Vec3f pos = MWBase::Environment::get().getWorld ()->getPlayerPtr().getRefData().getPosition().asVec3();
|
||||||
setGlobalMapPlayerPosition(pos.x, pos.y);
|
setGlobalMapPlayerPosition(pos.x(), pos.y());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::notifyPlayerUpdate ()
|
void MapWindow::notifyPlayerUpdate ()
|
||||||
|
@ -848,7 +850,6 @@ namespace MWGui
|
||||||
|
|
||||||
void MapWindow::setGlobalMapPlayerPosition(float worldX, float worldY)
|
void MapWindow::setGlobalMapPlayerPosition(float worldX, float worldY)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
float x, y;
|
float x, y;
|
||||||
mGlobalMapRender->worldPosToImageSpace (worldX, worldY, x, y);
|
mGlobalMapRender->worldPosToImageSpace (worldX, worldY, x, y);
|
||||||
x *= mGlobalMapRender->getWidth();
|
x *= mGlobalMapRender->getWidth();
|
||||||
|
@ -860,7 +861,6 @@ namespace MWGui
|
||||||
MyGUI::IntSize viewsize = mGlobalMap->getSize();
|
MyGUI::IntSize viewsize = mGlobalMap->getSize();
|
||||||
MyGUI::IntPoint viewoffs(static_cast<int>(viewsize.width * 0.5f - x), static_cast<int>(viewsize.height *0.5 - y));
|
MyGUI::IntPoint viewoffs(static_cast<int>(viewsize.width * 0.5f - x), static_cast<int>(viewsize.height *0.5 - y));
|
||||||
mGlobalMap->setViewOffset(viewoffs);
|
mGlobalMap->setViewOffset(viewoffs);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::setGlobalMapPlayerDir(const float x, const float y)
|
void MapWindow::setGlobalMapPlayerDir(const float x, const float y)
|
||||||
|
@ -876,7 +876,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
mMarkers.clear();
|
mMarkers.clear();
|
||||||
|
|
||||||
//mGlobalMapRender->clear();
|
mGlobalMapRender->clear();
|
||||||
mChanged = true;
|
mChanged = true;
|
||||||
|
|
||||||
while (mEventBoxGlobal->getChildCount())
|
while (mEventBoxGlobal->getChildCount())
|
||||||
|
@ -885,7 +885,6 @@ namespace MWGui
|
||||||
|
|
||||||
void MapWindow::write(ESM::ESMWriter &writer, Loading::Listener& progress)
|
void MapWindow::write(ESM::ESMWriter &writer, Loading::Listener& progress)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
ESM::GlobalMap map;
|
ESM::GlobalMap map;
|
||||||
mGlobalMapRender->write(map);
|
mGlobalMapRender->write(map);
|
||||||
|
|
||||||
|
@ -894,12 +893,10 @@ namespace MWGui
|
||||||
writer.startRecord(ESM::REC_GMAP);
|
writer.startRecord(ESM::REC_GMAP);
|
||||||
map.save(writer);
|
map.save(writer);
|
||||||
writer.endRecord(ESM::REC_GMAP);
|
writer.endRecord(ESM::REC_GMAP);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::readRecord(ESM::ESMReader &reader, uint32_t type)
|
void MapWindow::readRecord(ESM::ESMReader &reader, uint32_t type)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
if (type == ESM::REC_GMAP)
|
if (type == ESM::REC_GMAP)
|
||||||
{
|
{
|
||||||
ESM::GlobalMap map;
|
ESM::GlobalMap map;
|
||||||
|
@ -914,7 +911,6 @@ namespace MWGui
|
||||||
addVisitedLocation(cell->mName, it->first, it->second);
|
addVisitedLocation(cell->mName, it->first, it->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::setAlpha(float alpha)
|
void MapWindow::setAlpha(float alpha)
|
||||||
|
|
|
@ -195,6 +195,7 @@ namespace MWGui
|
||||||
void globalMapUpdatePlayer();
|
void globalMapUpdatePlayer();
|
||||||
|
|
||||||
MyGUI::ScrollView* mGlobalMap;
|
MyGUI::ScrollView* mGlobalMap;
|
||||||
|
MyGUI::ITexture* mGlobalMapTexture;
|
||||||
MyGUI::ImageBox* mGlobalMapImage;
|
MyGUI::ImageBox* mGlobalMapImage;
|
||||||
MyGUI::ImageBox* mGlobalMapOverlay;
|
MyGUI::ImageBox* mGlobalMapOverlay;
|
||||||
MyGUI::ImageBox* mPlayerArrowLocal;
|
MyGUI::ImageBox* mPlayerArrowLocal;
|
||||||
|
@ -216,7 +217,7 @@ namespace MWGui
|
||||||
MyGUI::Button* mEventBoxGlobal;
|
MyGUI::Button* mEventBoxGlobal;
|
||||||
MyGUI::Button* mEventBoxLocal;
|
MyGUI::Button* mEventBoxLocal;
|
||||||
|
|
||||||
//MWRender::GlobalMap* mGlobalMapRender;
|
MWRender::GlobalMap* mGlobalMapRender;
|
||||||
|
|
||||||
EditNoteDialog mEditNoteDialog;
|
EditNoteDialog mEditNoteDialog;
|
||||||
ESM::CustomMarker mEditingMarker;
|
ESM::CustomMarker mEditingMarker;
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
#include "globalmap.hpp"
|
#include "globalmap.hpp"
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <climits>
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
|
|
||||||
#include <OgreImage.h>
|
#include <osg/Image>
|
||||||
#include <OgreTextureManager.h>
|
#include <osg/Texture2D>
|
||||||
#include <OgreColourValue.h>
|
|
||||||
#include <OgreHardwareVertexBuffer.h>
|
|
||||||
#include <OgreRoot.h>
|
|
||||||
#include <OgreHardwarePixelBuffer.h>
|
|
||||||
|
|
||||||
#include <components/loadinglistener/loadinglistener.hpp>
|
#include <components/loadinglistener/loadinglistener.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
|
@ -23,9 +18,8 @@
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
|
|
||||||
GlobalMap::GlobalMap(const std::string &cacheDir)
|
GlobalMap::GlobalMap()
|
||||||
: mCacheDir(cacheDir)
|
: mMinX(0), mMaxX(0)
|
||||||
, mMinX(0), mMaxX(0)
|
|
||||||
, mMinY(0), mMaxY(0)
|
, mMinY(0), mMaxY(0)
|
||||||
, mWidth(0)
|
, mWidth(0)
|
||||||
, mHeight(0)
|
, mHeight(0)
|
||||||
|
@ -35,13 +29,10 @@ namespace MWRender
|
||||||
|
|
||||||
GlobalMap::~GlobalMap()
|
GlobalMap::~GlobalMap()
|
||||||
{
|
{
|
||||||
Ogre::TextureManager::getSingleton().remove(mOverlayTexture->getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalMap::render (Loading::Listener* loadingListener)
|
void GlobalMap::render (Loading::Listener* loadingListener)
|
||||||
{
|
{
|
||||||
Ogre::TexturePtr tex;
|
|
||||||
|
|
||||||
const MWWorld::ESMStore &esmStore =
|
const MWWorld::ESMStore &esmStore =
|
||||||
MWBase::Environment::get().getWorld()->getStore();
|
MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
|
||||||
|
@ -67,7 +58,9 @@ namespace MWRender
|
||||||
loadingListener->setProgressRange((mMaxX-mMinX+1) * (mMaxY-mMinY+1));
|
loadingListener->setProgressRange((mMaxX-mMinX+1) * (mMaxY-mMinY+1));
|
||||||
loadingListener->setProgress(0);
|
loadingListener->setProgress(0);
|
||||||
|
|
||||||
std::vector<Ogre::uchar> data (mWidth * mHeight * 3);
|
osg::ref_ptr<osg::Image> image = new osg::Image;
|
||||||
|
image->allocateImage(mWidth, mHeight, 1, GL_RGB, GL_UNSIGNED_BYTE);
|
||||||
|
unsigned char* data = image->data();
|
||||||
|
|
||||||
for (int x = mMinX; x <= mMaxX; ++x)
|
for (int x = mMinX; x <= mMaxX; ++x)
|
||||||
{
|
{
|
||||||
|
@ -139,16 +132,8 @@ namespace MWRender
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ogre::DataStreamPtr stream(new Ogre::MemoryDataStream(&data[0], data.size()));
|
mBaseTexture = new osg::Texture2D;
|
||||||
|
mBaseTexture->setImage(image);
|
||||||
tex = Ogre::TextureManager::getSingleton ().createManual ("GlobalMap.png", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
|
|
||||||
Ogre::TEX_TYPE_2D, mWidth, mHeight, 0, Ogre::PF_B8G8R8, Ogre::TU_STATIC);
|
|
||||||
tex->loadRawData(stream, mWidth, mHeight, Ogre::PF_B8G8R8);
|
|
||||||
|
|
||||||
tex->load();
|
|
||||||
|
|
||||||
mOverlayTexture = Ogre::TextureManager::getSingleton().createManual("GlobalMapOverlay", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
|
|
||||||
Ogre::TEX_TYPE_2D, mWidth, mHeight, 0, Ogre::PF_A8B8G8R8, Ogre::TU_DYNAMIC, this);
|
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
|
@ -172,13 +157,14 @@ namespace MWRender
|
||||||
|
|
||||||
void GlobalMap::exploreCell(int cellX, int cellY)
|
void GlobalMap::exploreCell(int cellX, int cellY)
|
||||||
{
|
{
|
||||||
float originX = static_cast<float>((cellX - mMinX) * mCellSize);
|
//float originX = static_cast<float>((cellX - mMinX) * mCellSize);
|
||||||
// NB y + 1, because we want the top left corner, not bottom left where the origin of the cell is
|
// NB y + 1, because we want the top left corner, not bottom left where the origin of the cell is
|
||||||
float originY = static_cast<float>(mHeight - (cellY + 1 - mMinY) * mCellSize);
|
//float originY = static_cast<float>(mHeight - (cellY + 1 - mMinY) * mCellSize);
|
||||||
|
|
||||||
if (cellX > mMaxX || cellX < mMinX || cellY > mMaxY || cellY < mMinY)
|
if (cellX > mMaxX || cellX < mMinX || cellY > mMaxY || cellY < mMinY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
Ogre::TexturePtr localMapTexture = Ogre::TextureManager::getSingleton().getByName("Cell_"
|
Ogre::TexturePtr localMapTexture = Ogre::TextureManager::getSingleton().getByName("Cell_"
|
||||||
+ boost::lexical_cast<std::string>(cellX) + "_" + boost::lexical_cast<std::string>(cellY));
|
+ boost::lexical_cast<std::string>(cellX) + "_" + boost::lexical_cast<std::string>(cellY));
|
||||||
|
|
||||||
|
@ -208,24 +194,19 @@ namespace MWRender
|
||||||
mOverlayImage.setColourAt(backup.getColourAt(x, y, 0), static_cast<size_t>(originX + x), static_cast<size_t>(originY + y), 0);
|
mOverlayImage.setColourAt(backup.getColourAt(x, y, 0), static_cast<size_t>(originX + x), static_cast<size_t>(originY + y), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalMap::clear()
|
void GlobalMap::clear()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
Ogre::uchar* buffer = OGRE_ALLOC_T(Ogre::uchar, mWidth * mHeight * 4, Ogre::MEMCATEGORY_GENERAL);
|
Ogre::uchar* buffer = OGRE_ALLOC_T(Ogre::uchar, mWidth * mHeight * 4, Ogre::MEMCATEGORY_GENERAL);
|
||||||
memset(buffer, 0, mWidth * mHeight * 4);
|
memset(buffer, 0, mWidth * mHeight * 4);
|
||||||
|
|
||||||
mOverlayImage.loadDynamicImage(&buffer[0], mWidth, mHeight, 1, Ogre::PF_A8B8G8R8, true); // pass ownership of buffer to image
|
mOverlayImage.loadDynamicImage(&buffer[0], mWidth, mHeight, 1, Ogre::PF_A8B8G8R8, true); // pass ownership of buffer to image
|
||||||
|
|
||||||
mOverlayTexture->load();
|
mOverlayTexture->load();
|
||||||
}
|
*/
|
||||||
|
|
||||||
void GlobalMap::loadResource(Ogre::Resource *resource)
|
|
||||||
{
|
|
||||||
Ogre::Texture* tex = static_cast<Ogre::Texture*>(resource);
|
|
||||||
Ogre::ConstImagePtrList list;
|
|
||||||
list.push_back(&mOverlayImage);
|
|
||||||
tex->_loadImages(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalMap::write(ESM::GlobalMap& map)
|
void GlobalMap::write(ESM::GlobalMap& map)
|
||||||
|
@ -235,9 +216,11 @@ namespace MWRender
|
||||||
map.mBounds.mMinY = mMinY;
|
map.mBounds.mMinY = mMinY;
|
||||||
map.mBounds.mMaxY = mMaxY;
|
map.mBounds.mMaxY = mMaxY;
|
||||||
|
|
||||||
|
/*
|
||||||
Ogre::DataStreamPtr encoded = mOverlayImage.encode("png");
|
Ogre::DataStreamPtr encoded = mOverlayImage.encode("png");
|
||||||
map.mImageData.resize(encoded->size());
|
map.mImageData.resize(encoded->size());
|
||||||
encoded->read(&map.mImageData[0], encoded->size());
|
encoded->read(&map.mImageData[0], encoded->size());
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalMap::read(ESM::GlobalMap& map)
|
void GlobalMap::read(ESM::GlobalMap& map)
|
||||||
|
@ -253,6 +236,7 @@ namespace MWRender
|
||||||
|| bounds.mMinY > bounds.mMaxY)
|
|| bounds.mMinY > bounds.mMaxY)
|
||||||
throw std::runtime_error("invalid map bounds");
|
throw std::runtime_error("invalid map bounds");
|
||||||
|
|
||||||
|
/*
|
||||||
Ogre::Image image;
|
Ogre::Image image;
|
||||||
Ogre::DataStreamPtr stream(new Ogre::MemoryDataStream(&map.mImageData[0], map.mImageData.size()));
|
Ogre::DataStreamPtr stream(new Ogre::MemoryDataStream(&map.mImageData[0], map.mImageData.size()));
|
||||||
image.load(stream, "png");
|
image.load(stream, "png");
|
||||||
|
@ -309,5 +293,11 @@ namespace MWRender
|
||||||
mOverlayTexture->convertToImage(mOverlayImage);
|
mOverlayTexture->convertToImage(mOverlayImage);
|
||||||
|
|
||||||
Ogre::TextureManager::getSingleton().remove("@temp");
|
Ogre::TextureManager::getSingleton().remove("@temp");
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Texture2D> GlobalMap::getBaseTexture()
|
||||||
|
{
|
||||||
|
return mBaseTexture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,14 @@
|
||||||
#define GAME_RENDER_GLOBALMAP_H
|
#define GAME_RENDER_GLOBALMAP_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <OgreTexture.h>
|
#include <osg/ref_ptr>
|
||||||
|
|
||||||
|
namespace osg
|
||||||
|
{
|
||||||
|
class Texture2D;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Loading
|
namespace Loading
|
||||||
{
|
{
|
||||||
|
@ -18,10 +24,10 @@ namespace ESM
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
|
|
||||||
class GlobalMap : public Ogre::ManualResourceLoader
|
class GlobalMap
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GlobalMap(const std::string& cacheDir);
|
GlobalMap();
|
||||||
~GlobalMap();
|
~GlobalMap();
|
||||||
|
|
||||||
void render(Loading::Listener* loadingListener);
|
void render(Loading::Listener* loadingListener);
|
||||||
|
@ -37,23 +43,21 @@ namespace MWRender
|
||||||
|
|
||||||
void exploreCell (int cellX, int cellY);
|
void exploreCell (int cellX, int cellY);
|
||||||
|
|
||||||
virtual void loadResource(Ogre::Resource* resource);
|
|
||||||
|
|
||||||
/// Clears the overlay
|
/// Clears the overlay
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
void write (ESM::GlobalMap& map);
|
void write (ESM::GlobalMap& map);
|
||||||
void read (ESM::GlobalMap& map);
|
void read (ESM::GlobalMap& map);
|
||||||
|
|
||||||
private:
|
osg::ref_ptr<osg::Texture2D> getBaseTexture();
|
||||||
std::string mCacheDir;
|
//osg::ref_ptr<osg::Texture2D> getOverlayTexture();
|
||||||
|
|
||||||
|
private:
|
||||||
int mCellSize;
|
int mCellSize;
|
||||||
|
|
||||||
std::vector< std::pair<int,int> > mExploredCells;
|
std::vector< std::pair<int,int> > mExploredCells;
|
||||||
|
|
||||||
Ogre::TexturePtr mOverlayTexture;
|
osg::ref_ptr<osg::Texture2D> mBaseTexture;
|
||||||
Ogre::Image mOverlayImage; // Backup in system memory
|
|
||||||
|
|
||||||
int mWidth;
|
int mWidth;
|
||||||
int mHeight;
|
int mHeight;
|
||||||
|
|
Loading…
Reference in a new issue