mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-01 13:20:29 +00:00
commit
830ecbe101
@ -1,5 +1,8 @@
|
|||||||
#include "fallback.hpp"
|
#include "fallback.hpp"
|
||||||
|
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace Fallback
|
namespace Fallback
|
||||||
{
|
{
|
||||||
bool stob(std::string const& s) {
|
bool stob(std::string const& s) {
|
||||||
@ -18,14 +21,16 @@ namespace Fallback
|
|||||||
}
|
}
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Map::getFallbackFloat(const std::string& fall) const
|
float Map::getFallbackFloat(const std::string& fall) const
|
||||||
{
|
{
|
||||||
std::string fallback=getFallbackString(fall);
|
std::string fallback=getFallbackString(fall);
|
||||||
if(fallback.empty())
|
if(fallback.empty())
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return std::stof(fallback);
|
return boost::lexical_cast<float>(fallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Map::getFallbackInt(const std::string& fall) const
|
int Map::getFallbackInt(const std::string& fall) const
|
||||||
{
|
{
|
||||||
std::string fallback=getFallbackString(fall);
|
std::string fallback=getFallbackString(fall);
|
||||||
@ -43,6 +48,7 @@ namespace Fallback
|
|||||||
else
|
else
|
||||||
return stob(fallback);
|
return stob(fallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Vec4f Map::getFallbackColour(const std::string& fall) const
|
osg::Vec4f Map::getFallbackColour(const std::string& fall) const
|
||||||
{
|
{
|
||||||
std::string sum=getFallbackString(fall);
|
std::string sum=getFallbackString(fall);
|
||||||
|
@ -209,13 +209,21 @@ namespace SceneUtil
|
|||||||
mLights.push_back(l);
|
mLights.push_back(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* similar to the boost::hash_combine */
|
||||||
|
template <class T>
|
||||||
|
inline void hash_combine(std::size_t& seed, const T& v)
|
||||||
|
{
|
||||||
|
std::hash<T> hasher;
|
||||||
|
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||||
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::StateSet> LightManager::getLightListStateSet(const LightList &lightList, unsigned int frameNum)
|
osg::ref_ptr<osg::StateSet> LightManager::getLightListStateSet(const LightList &lightList, unsigned int frameNum)
|
||||||
{
|
{
|
||||||
|
|
||||||
// possible optimization: return a StateSet containing all requested lights plus some extra lights (if a suitable one exists)
|
// possible optimization: return a StateSet containing all requested lights plus some extra lights (if a suitable one exists)
|
||||||
size_t hash = 0;
|
size_t hash = 0;
|
||||||
for (unsigned int i=0; i<lightList.size();++i)
|
for (unsigned int i=0; i<lightList.size();++i)
|
||||||
hash = hash ^ (lightList[i]->mLightSource->getId() << 1); // or use boost::hash_combine
|
hash_combine(hash, lightList[i]->mLightSource->getId());
|
||||||
// original: boost::hash_combine(hash, lightList[i]->mLightSource->getId());
|
|
||||||
|
|
||||||
LightStateSetMap& stateSetCache = mStateSetCache[frameNum%2];
|
LightStateSetMap& stateSetCache = mStateSetCache[frameNum%2];
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "numericeditbox.hpp"
|
#include "numericeditbox.hpp"
|
||||||
|
|
||||||
namespace Gui
|
namespace Gui
|
||||||
@ -36,7 +38,11 @@ namespace Gui
|
|||||||
setCaption(MyGUI::utility::toString(mValue));
|
setCaption(MyGUI::utility::toString(mValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (std::invalid_argument)
|
||||||
|
{
|
||||||
|
setCaption(MyGUI::utility::toString(mValue));
|
||||||
|
}
|
||||||
|
catch (std::out_of_range)
|
||||||
{
|
{
|
||||||
setCaption(MyGUI::utility::toString(mValue));
|
setCaption(MyGUI::utility::toString(mValue));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user