1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 15:15:31 +00:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Marc Zinnschlag 2015-11-30 12:12:18 +01:00
commit 3a81bed001
14 changed files with 76 additions and 34 deletions

View file

@ -205,7 +205,13 @@ if(APPLE)
endif(APPLE) endif(APPLE)
target_link_libraries(openmw-cs target_link_libraries(openmw-cs
${OPENSCENEGRAPH_LIBRARIES} ${OSG_LIBRARIES}
${OPENTHREADS_LIBRARIES}
${OSGUTIL_LIBRARIES}
${OSGVIEWER_LIBRARIES}
${OSGGA_LIBRARIES}
${OSGFX_LIBRARIES}
${OSGQT_LIBRARIES}
${Boost_SYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}

View file

@ -118,7 +118,13 @@ include_directories(
) )
target_link_libraries(openmw target_link_libraries(openmw
${OPENSCENEGRAPH_LIBRARIES} ${OSG_LIBRARIES}
${OPENTHREADS_LIBRARIES}
${OSGPARTICLE_LIBRARIES}
${OSGUTIL_LIBRARIES}
${OSGDB_LIBRARIES}
${OSGVIEWER_LIBRARIES}
${OSGGA_LIBRARIES}
${Boost_SYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY} ${Boost_THREAD_LIBRARY}
${Boost_FILESYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}

View file

@ -2,7 +2,7 @@
#define GAME_MWDIALOGUE_KEYWORDSEARCH_H #define GAME_MWDIALOGUE_KEYWORDSEARCH_H
#include <map> #include <map>
#include <locale> #include <cctype>
#include <stdexcept> #include <stdexcept>
#include <vector> #include <vector>
#include <algorithm> // std::reverse #include <algorithm> // std::reverse
@ -44,7 +44,7 @@ public:
typename Entry::childen_t::iterator current; typename Entry::childen_t::iterator current;
typename Entry::childen_t::iterator next; typename Entry::childen_t::iterator next;
current = mRoot.mChildren.find (std::tolower (*keyword.begin(), mLocale)); current = mRoot.mChildren.find (tolower (*keyword.begin()));
if (current == mRoot.mChildren.end()) if (current == mRoot.mChildren.end())
return false; return false;
else if (current->second.mKeyword.size() && Misc::StringUtils::ciEqual(current->second.mKeyword, keyword)) else if (current->second.mKeyword.size() && Misc::StringUtils::ciEqual(current->second.mKeyword, keyword))
@ -55,7 +55,7 @@ public:
for (Point i = ++keyword.begin(); i != keyword.end(); ++i) for (Point i = ++keyword.begin(); i != keyword.end(); ++i)
{ {
next = current->second.mChildren.find(std::tolower (*i, mLocale)); next = current->second.mChildren.find(tolower (*i));
if (next == current->second.mChildren.end()) if (next == current->second.mChildren.end())
return false; return false;
if (Misc::StringUtils::ciEqual(next->second.mKeyword, keyword)) if (Misc::StringUtils::ciEqual(next->second.mKeyword, keyword))
@ -89,7 +89,7 @@ public:
// check first character // check first character
typename Entry::childen_t::iterator candidate = mRoot.mChildren.find (std::tolower (*i, mLocale)); typename Entry::childen_t::iterator candidate = mRoot.mChildren.find (tolower (*i));
// no match, on to next character // no match, on to next character
if (candidate == mRoot.mChildren.end ()) if (candidate == mRoot.mChildren.end ())
@ -104,7 +104,7 @@ public:
while ((j + 1) != end) while ((j + 1) != end)
{ {
typename Entry::childen_t::iterator next = candidate->second.mChildren.find (std::tolower (*++j, mLocale)); typename Entry::childen_t::iterator next = candidate->second.mChildren.find (tolower (*++j));
if (next == candidate->second.mChildren.end ()) if (next == candidate->second.mChildren.end ())
{ {
@ -136,7 +136,7 @@ public:
while (k != end && t != candidate->second.mKeyword.end ()) while (k != end && t != candidate->second.mKeyword.end ())
{ {
if (std::tolower (*k, mLocale) != std::tolower (*t, mLocale)) if (tolower (*k) != tolower (*t))
break; break;
++k, ++t; ++k, ++t;
@ -212,7 +212,7 @@ private:
void seed_impl (string_t keyword, value_t value, size_t depth, Entry & entry) void seed_impl (string_t keyword, value_t value, size_t depth, Entry & entry)
{ {
int ch = tolower (keyword.at (depth), mLocale); int ch = tolower (keyword.at (depth));
typename Entry::childen_t::iterator j = entry.mChildren.find (ch); typename Entry::childen_t::iterator j = entry.mChildren.find (ch);
@ -249,7 +249,6 @@ private:
} }
Entry mRoot; Entry mRoot;
std::locale mLocale;
}; };
} }

View file

@ -167,13 +167,15 @@ namespace MWGui
MyGUI::IntSize size(static_cast<int>(Settings::Manager::getFloat(setting + " w", "Windows") * viewSize.width), MyGUI::IntSize size(static_cast<int>(Settings::Manager::getFloat(setting + " w", "Windows") * viewSize.width),
static_cast<int>(Settings::Manager::getFloat(setting + " h", "Windows") * viewSize.height)); static_cast<int>(Settings::Manager::getFloat(setting + " h", "Windows") * viewSize.height));
bool needUpdate = (size.width != mMainWidget->getWidth() || size.height != mMainWidget->getHeight());
mMainWidget->setPosition(pos); mMainWidget->setPosition(pos);
mMainWidget->setSize(size); mMainWidget->setSize(size);
if (size.width != mMainWidget->getWidth() || size.height != mMainWidget->getHeight())
updatePreviewSize();
adjustPanes(); adjustPanes();
if (needUpdate)
updatePreviewSize();
} }
SortFilterItemModel* InventoryWindow::getSortFilterModel() SortFilterItemModel* InventoryWindow::getSortFilterModel()

View file

@ -29,8 +29,6 @@ struct JournalViewModelImpl : JournalViewModel
mutable bool mKeywordSearchLoaded; mutable bool mKeywordSearchLoaded;
mutable KeywordSearchT mKeywordSearch; mutable KeywordSearchT mKeywordSearch;
std::locale mLocale;
JournalViewModelImpl () JournalViewModelImpl ()
{ {
mKeywordSearchLoaded = false; mKeywordSearchLoaded = false;
@ -74,7 +72,7 @@ struct JournalViewModelImpl : JournalViewModel
} }
} }
wchar_t tolower (wchar_t ch) const { return std::tolower (ch, mLocale); } wchar_t tolower (wchar_t ch) const { return tolower (ch); }
bool isEmpty () const bool isEmpty () const
{ {
@ -319,7 +317,7 @@ struct JournalViewModelImpl : JournalViewModel
for (MWBase::Journal::TTopicIter i = journal->topicBegin (); i != journal->topicEnd (); ++i) for (MWBase::Journal::TTopicIter i = journal->topicBegin (); i != journal->topicEnd (); ++i)
{ {
if (i->first [0] != std::tolower (character, mLocale)) if (i->first [0] != tolower (character))
continue; continue;
visitor (i->second.getName()); visitor (i->second.getName());

View file

@ -30,6 +30,7 @@ namespace MWRender
public: public:
DrawOnceCallback () DrawOnceCallback ()
: mRendered(false) : mRendered(false)
, mLastRenderedFrame(0)
{ {
} }
@ -38,13 +39,14 @@ namespace MWRender
if (!mRendered) if (!mRendered)
{ {
mRendered = true; mRendered = true;
mLastRenderedFrame = nv->getTraversalNumber();
traverse(node, nv);
} }
else else
{ {
node->setNodeMask(0); node->setNodeMask(0);
} }
traverse(node, nv);
} }
void redrawNextFrame() void redrawNextFrame()
@ -52,8 +54,14 @@ namespace MWRender
mRendered = false; mRendered = false;
} }
unsigned int getLastRenderedFrame() const
{
return mLastRenderedFrame;
}
private: private:
bool mRendered; bool mRendered;
unsigned int mLastRenderedFrame;
}; };
CharacterPreview::CharacterPreview(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem, CharacterPreview::CharacterPreview(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem,
@ -262,8 +270,11 @@ namespace MWRender
int InventoryPreview::getSlotSelected (int posX, int posY) int InventoryPreview::getSlotSelected (int posX, int posY)
{ {
osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector (new osgUtil::LineSegmentIntersector(osgUtil::Intersector::WINDOW, posX, posY)); osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector (new osgUtil::LineSegmentIntersector(osgUtil::Intersector::WINDOW, posX, posY));
intersector->setIntersectionLimit(osgUtil::LineSegmentIntersector::LIMIT_ONE); intersector->setIntersectionLimit(osgUtil::LineSegmentIntersector::LIMIT_NEAREST);
osgUtil::IntersectionVisitor visitor(intersector); osgUtil::IntersectionVisitor visitor(intersector);
visitor.setTraversalMode(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN);
// Set the traversal number from the last draw, so that the frame switch used for RigGeometry double buffering works correctly
visitor.setTraversalNumber(mDrawOnceCallback->getLastRenderedFrame());
osg::Node::NodeMask nodeMask = mCamera->getNodeMask(); osg::Node::NodeMask nodeMask = mCamera->getNodeMask();
mCamera->setNodeMask(~0); mCamera->setNodeMask(~0);

View file

@ -551,6 +551,8 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha)
stateset->setRenderBinDetails(MWRender::RenderBin_Water, "RenderBin"); stateset->setRenderBinDetails(MWRender::RenderBin_Water, "RenderBin");
node->setStateSet(stateset);
std::vector<osg::ref_ptr<osg::Texture2D> > textures; std::vector<osg::ref_ptr<osg::Texture2D> > textures;
int frameCount = mFallback->getFallbackInt("Water_SurfaceFrameCount"); int frameCount = mFallback->getFallbackInt("Water_SurfaceFrameCount");
std::string texture = mFallback->getFallbackString("Water_SurfaceTexture"); std::string texture = mFallback->getFallbackString("Water_SurfaceTexture");
@ -561,12 +563,15 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha)
textures.push_back(mResourceSystem->getTextureManager()->getTexture2D(texname.str(), osg::Texture::REPEAT, osg::Texture::REPEAT)); textures.push_back(mResourceSystem->getTextureManager()->getTexture2D(texname.str(), osg::Texture::REPEAT, osg::Texture::REPEAT));
} }
if (!textures.size())
return;
float fps = mFallback->getFallbackFloat("Water_SurfaceFPS"); float fps = mFallback->getFallbackFloat("Water_SurfaceFPS");
osg::ref_ptr<NifOsg::FlipController> controller (new NifOsg::FlipController(0, 1.f/fps, textures)); osg::ref_ptr<NifOsg::FlipController> controller (new NifOsg::FlipController(0, 1.f/fps, textures));
controller->setSource(boost::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource)); controller->setSource(boost::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
node->setUpdateCallback(controller); node->setUpdateCallback(controller);
node->setStateSet(stateset);
stateset->setTextureAttributeAndModes(0, textures[0], osg::StateAttribute::ON); stateset->setTextureAttributeAndModes(0, textures[0], osg::StateAttribute::ON);
} }

View file

@ -177,7 +177,15 @@ target_link_libraries(components
${Boost_FILESYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY} ${Boost_THREAD_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}
${OPENSCENEGRAPH_LIBRARIES} ${OSG_LIBRARIES}
${OPENTHREADS_LIBRARIES}
${OSGPARTICLE_LIBRARIES}
${OSGUTIL_LIBRARIES}
${OSGDB_LIBRARIES}
${OSGVIEWER_LIBRARIES}
${OSGGA_LIBRARIES}
${OSGFX_LIBRARIES}
${OSGANIMATION_LIBRARIES}
${BULLET_LIBRARIES} ${BULLET_LIBRARIES}
${SDL2_LIBRARY} ${SDL2_LIBRARY}
# For MyGUI platform # For MyGUI platform

View file

@ -28,8 +28,8 @@ namespace Files
for (std::size_t i=0; i<len; ++i) for (std::size_t i=0; i<len; ++i)
{ {
char l = std::tolower (left[i]); char l = tolower (left[i]);
char r = std::tolower (right[i]); char r = tolower (right[i]);
if (l!=r) if (l!=r)
return false; return false;

View file

@ -4,7 +4,6 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include <string> #include <string>
#include <locale>
#include <cctype> #include <cctype>
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
@ -25,12 +24,11 @@ namespace Files
return left<right; return left<right;
std::size_t min = std::min (left.length(), right.length()); std::size_t min = std::min (left.length(), right.length());
std::locale loc;
for (std::size_t i=0; i<min; ++i) for (std::size_t i=0; i<min; ++i)
{ {
char l = std::tolower (left[i], loc); char l = tolower (left[i]);
char r = std::tolower (right[i], loc); char r = tolower (right[i]);
if (l<r) if (l<r)
return true; return true;

View file

@ -100,7 +100,7 @@ namespace
virtual void traverse(osg::NodeVisitor& nv) virtual void traverse(osg::NodeVisitor& nv)
{ {
if (nv.getTraversalMode() != osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN) if (nv.getTraversalMode() != osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN && nv.getVisitorType() != osg::NodeVisitor::UPDATE_VISITOR)
osg::Group::traverse(nv); osg::Group::traverse(nv);
else else
{ {

View file

@ -62,7 +62,16 @@ btCollisionShape* BulletShape::duplicateCollisionShape(btCollisionShape *shape)
// work around btScaledBvhTriangleMeshShape bug ( https://code.google.com/p/bullet/issues/detail?id=371 ) in older bullet versions // work around btScaledBvhTriangleMeshShape bug ( https://code.google.com/p/bullet/issues/detail?id=371 ) in older bullet versions
btTriangleMesh* oldMesh = static_cast<btTriangleMesh*>(trishape->getMeshInterface()); btTriangleMesh* oldMesh = static_cast<btTriangleMesh*>(trishape->getMeshInterface());
btTriangleMesh* newMesh = new btTriangleMesh(*oldMesh); btTriangleMesh* newMesh = new btTriangleMesh(*oldMesh);
TriangleMeshShape* newShape = new TriangleMeshShape(newMesh, true);
// Do not build a new bvh (not needed, since it's the same as the original shape's bvh)
bool buildBvh = true;
if (trishape->getOptimizedBvh())
buildBvh = false;
TriangleMeshShape* newShape = new TriangleMeshShape(newMesh, true, buildBvh);
// Set original shape's bvh via pointer
// The pointer is safe because the BulletShapeInstance keeps a ref_ptr to the original BulletShape
if (!buildBvh)
newShape->setOptimizedBvh(trishape->getOptimizedBvh());
#endif #endif
return newShape; return newShape;
} }

View file

@ -60,8 +60,8 @@ namespace Resource
// Subclass btBhvTriangleMeshShape to auto-delete the meshInterface // Subclass btBhvTriangleMeshShape to auto-delete the meshInterface
struct TriangleMeshShape : public btBvhTriangleMeshShape struct TriangleMeshShape : public btBvhTriangleMeshShape
{ {
TriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression) TriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true)
: btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression) : btBvhTriangleMeshShape(meshInterface, useQuantizedAabbCompression, buildBvh)
{ {
} }

View file

@ -1,7 +1,7 @@
#include "manager.hpp" #include "manager.hpp"
#include <cctype>
#include <stdexcept> #include <stdexcept>
#include <locale>
#include "archive.hpp" #include "archive.hpp"
@ -15,7 +15,7 @@ namespace
char nonstrict_normalize_char(char ch) char nonstrict_normalize_char(char ch)
{ {
return ch == '\\' ? '/' : std::tolower(ch,std::locale::classic()); return ch == '\\' ? '/' : tolower(ch);
} }
void normalize_path(std::string& path, bool strict) void normalize_path(std::string& path, bool strict)