mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-24 21:09:43 +00:00
Merge branch 'master' into minimap
This commit is contained in:
commit
b2bdf0ebf3
5 changed files with 81 additions and 20 deletions
|
@ -95,5 +95,5 @@ else()
|
||||||
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/launcher.qss")
|
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/launcher.qss")
|
||||||
|
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/files/launcher.cfg
|
configure_file(${CMAKE_SOURCE_DIR}/files/launcher.cfg
|
||||||
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}launcher.cfg")
|
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/launcher.cfg")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -182,7 +182,9 @@ void HUD::setPlayerPos(const float x, const float y)
|
||||||
}
|
}
|
||||||
|
|
||||||
MapWindow::MapWindow()
|
MapWindow::MapWindow()
|
||||||
: Layout("openmw_map_window_layout.xml"), mGlobal(false)
|
: Layout("openmw_map_window_layout.xml")
|
||||||
|
, mGlobal(false)
|
||||||
|
, mVisible(false)
|
||||||
{
|
{
|
||||||
setCoord(500,0,320,300);
|
setCoord(500,0,320,300);
|
||||||
setText("WorldButton", "World");
|
setText("WorldButton", "World");
|
||||||
|
@ -272,6 +274,17 @@ void MapWindow::onWorldButtonClicked(MyGUI::Widget* _sender)
|
||||||
mButton->setCaption( mGlobal ? "Local" : "World" );
|
mButton->setCaption( mGlobal ? "Local" : "World" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LocalMapBase::LocalMapBase()
|
||||||
|
: mCurX(0)
|
||||||
|
, mCurY(0)
|
||||||
|
, mInterior(false)
|
||||||
|
, mLocalMap(NULL)
|
||||||
|
, mPrefix()
|
||||||
|
, mChanged(true)
|
||||||
|
, mLayout(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void LocalMapBase::init(MyGUI::ScrollView* widget, OEngine::GUI::Layout* layout)
|
void LocalMapBase::init(MyGUI::ScrollView* widget, OEngine::GUI::Layout* layout)
|
||||||
{
|
{
|
||||||
mLocalMap = widget;
|
mLocalMap = widget;
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace MWGui
|
||||||
class LocalMapBase
|
class LocalMapBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
LocalMapBase();
|
||||||
void init(MyGUI::ScrollView* widget, OEngine::GUI::Layout* layout);
|
void init(MyGUI::ScrollView* widget, OEngine::GUI::Layout* layout);
|
||||||
|
|
||||||
void setCellPrefix(const std::string& prefix);
|
void setCellPrefix(const std::string& prefix);
|
||||||
|
@ -85,6 +86,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MapWindow();
|
MapWindow();
|
||||||
|
virtual ~MapWindow(){}
|
||||||
|
|
||||||
void setVisible(bool b);
|
void setVisible(bool b);
|
||||||
void setPlayerPos(const float x, const float y);
|
void setPlayerPos(const float x, const float y);
|
||||||
|
|
|
@ -88,19 +88,61 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh)
|
||||||
NifOgre::NIFLoader::load(mesh);
|
NifOgre::NIFLoader::load(mesh);
|
||||||
Ogre::Entity *ent = mRenderer.getScene()->createEntity(mesh);
|
Ogre::Entity *ent = mRenderer.getScene()->createEntity(mesh);
|
||||||
|
|
||||||
|
Ogre::Vector3 extents = ent->getBoundingBox().getSize();
|
||||||
|
extents *= insert->getScale();
|
||||||
|
// float size = std::max(std::max(extents.x, extents.y), extents.z);
|
||||||
|
|
||||||
|
/*
|
||||||
|
bool small = (size < 250); /// \todo config value
|
||||||
|
|
||||||
|
// do not fade out doors. that will cause holes and look stupid
|
||||||
|
if (ptr.getTypeName().find("Door") != std::string::npos)
|
||||||
|
small = false;
|
||||||
|
*/
|
||||||
|
const bool small = false;
|
||||||
|
|
||||||
|
if (mBounds.find(ptr.getCell()) == mBounds.end())
|
||||||
|
mBounds[ptr.getCell()] = Ogre::AxisAlignedBox::BOX_NULL;
|
||||||
|
|
||||||
|
Ogre::AxisAlignedBox bounds = ent->getBoundingBox();
|
||||||
|
bounds.scale(insert->getScale());
|
||||||
|
mBounds[ptr.getCell()].merge(bounds);
|
||||||
|
|
||||||
if(!mIsStatic)
|
if(!mIsStatic)
|
||||||
{
|
{
|
||||||
insert->attachObject(ent);
|
insert->attachObject(ent);
|
||||||
|
|
||||||
|
ent->setRenderingDistance(small ? 2500 : 0); /// \todo config value
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Ogre::StaticGeometry* sg = 0;
|
Ogre::StaticGeometry* sg = 0;
|
||||||
if(mStaticGeometry.find(ptr.getCell()) == mStaticGeometry.end())
|
|
||||||
|
if (small)
|
||||||
|
{
|
||||||
|
if( mStaticGeometrySmall.find(ptr.getCell()) == mStaticGeometrySmall.end())
|
||||||
{
|
{
|
||||||
uniqueID = uniqueID +1;
|
uniqueID = uniqueID +1;
|
||||||
sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
|
sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
|
||||||
//Create the scenenode and put it in the map
|
mStaticGeometrySmall[ptr.getCell()] = sg;
|
||||||
|
|
||||||
|
sg->setRenderingDistance(2500); /// \todo config value
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sg = mStaticGeometrySmall[ptr.getCell()];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( mStaticGeometry.find(ptr.getCell()) == mStaticGeometry.end())
|
||||||
|
{
|
||||||
|
|
||||||
|
uniqueID = uniqueID +1;
|
||||||
|
sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
|
||||||
mStaticGeometry[ptr.getCell()] = sg;
|
mStaticGeometry[ptr.getCell()] = sg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sg = mStaticGeometry[ptr.getCell()];
|
||||||
|
}
|
||||||
|
|
||||||
// This specifies the size of a single batch region.
|
// This specifies the size of a single batch region.
|
||||||
// If it is set too high:
|
// If it is set too high:
|
||||||
|
@ -110,16 +152,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh)
|
||||||
// - there will be too many batches.
|
// - there will be too many batches.
|
||||||
sg->setRegionDimensions(Ogre::Vector3(2500,2500,2500));
|
sg->setRegionDimensions(Ogre::Vector3(2500,2500,2500));
|
||||||
|
|
||||||
mBounds[ptr.getCell()] = Ogre::AxisAlignedBox::BOX_NULL;
|
|
||||||
mBounds[ptr.getCell()].merge(ent->getBoundingBox());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sg = mStaticGeometry[ptr.getCell()];
|
|
||||||
}
|
|
||||||
|
|
||||||
sg->addEntity(ent,insert->_getDerivedPosition(),insert->_getDerivedOrientation(),insert->_getDerivedScale());
|
sg->addEntity(ent,insert->_getDerivedPosition(),insert->_getDerivedOrientation(),insert->_getDerivedScale());
|
||||||
mBounds[ptr.getCell()].merge(insert->_getDerivedPosition());
|
|
||||||
|
|
||||||
mRenderer.getScene()->destroyEntity(ent);
|
mRenderer.getScene()->destroyEntity(ent);
|
||||||
}
|
}
|
||||||
|
@ -206,6 +239,13 @@ void Objects::removeCell(MWWorld::Ptr::CellStore* store)
|
||||||
mRenderer.getScene()->destroyStaticGeometry (sg);
|
mRenderer.getScene()->destroyStaticGeometry (sg);
|
||||||
sg = 0;
|
sg = 0;
|
||||||
}
|
}
|
||||||
|
if(mStaticGeometrySmall.find(store) != mStaticGeometrySmall.end())
|
||||||
|
{
|
||||||
|
Ogre::StaticGeometry* sg = mStaticGeometrySmall[store];
|
||||||
|
mStaticGeometrySmall.erase(store);
|
||||||
|
mRenderer.getScene()->destroyStaticGeometry (sg);
|
||||||
|
sg = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(mBounds.find(store) != mBounds.end())
|
if(mBounds.find(store) != mBounds.end())
|
||||||
mBounds.erase(store);
|
mBounds.erase(store);
|
||||||
|
@ -218,6 +258,11 @@ void Objects::buildStaticGeometry(ESMS::CellStore<MWWorld::RefData>& cell)
|
||||||
Ogre::StaticGeometry* sg = mStaticGeometry[&cell];
|
Ogre::StaticGeometry* sg = mStaticGeometry[&cell];
|
||||||
sg->build();
|
sg->build();
|
||||||
}
|
}
|
||||||
|
if(mStaticGeometrySmall.find(&cell) != mStaticGeometrySmall.end())
|
||||||
|
{
|
||||||
|
Ogre::StaticGeometry* sg = mStaticGeometrySmall[&cell];
|
||||||
|
sg->build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ogre::AxisAlignedBox Objects::getDimensions(MWWorld::Ptr::CellStore* cell)
|
Ogre::AxisAlignedBox Objects::getDimensions(MWWorld::Ptr::CellStore* cell)
|
||||||
|
|
|
@ -14,6 +14,7 @@ class Objects{
|
||||||
OEngine::Render::OgreRenderer &mRenderer;
|
OEngine::Render::OgreRenderer &mRenderer;
|
||||||
std::map<MWWorld::Ptr::CellStore *, Ogre::SceneNode *> mCellSceneNodes;
|
std::map<MWWorld::Ptr::CellStore *, Ogre::SceneNode *> mCellSceneNodes;
|
||||||
std::map<MWWorld::Ptr::CellStore *, Ogre::StaticGeometry*> mStaticGeometry;
|
std::map<MWWorld::Ptr::CellStore *, Ogre::StaticGeometry*> mStaticGeometry;
|
||||||
|
std::map<MWWorld::Ptr::CellStore *, Ogre::StaticGeometry*> mStaticGeometrySmall;
|
||||||
std::map<MWWorld::Ptr::CellStore *, Ogre::AxisAlignedBox> mBounds;
|
std::map<MWWorld::Ptr::CellStore *, Ogre::AxisAlignedBox> mBounds;
|
||||||
Ogre::SceneNode* mMwRoot;
|
Ogre::SceneNode* mMwRoot;
|
||||||
bool mIsStatic;
|
bool mIsStatic;
|
||||||
|
|
Loading…
Reference in a new issue