forked from mirror/openmw-tes3mp
Fallback system rewritten, added light fallbacks
This commit is contained in:
parent
ef72894b81
commit
521bebd2f4
12 changed files with 163 additions and 141 deletions
|
@ -53,7 +53,7 @@ add_openmw_dir (mwworld
|
||||||
containerstore actiontalk actiontake manualref player cellfunctors failedaction
|
containerstore actiontalk actiontake manualref player cellfunctors failedaction
|
||||||
cells localscripts customdata weather inventorystore ptr actionopen actionread
|
cells localscripts customdata weather inventorystore ptr actionopen actionread
|
||||||
actionequip timestamp actionalchemy cellstore actionapply actioneat
|
actionequip timestamp actionalchemy cellstore actionapply actioneat
|
||||||
esmstore store recordcmp
|
esmstore store recordcmp fallback
|
||||||
)
|
)
|
||||||
|
|
||||||
add_openmw_dir (mwclass
|
add_openmw_dir (mwclass
|
||||||
|
|
|
@ -103,12 +103,8 @@ namespace MWBase
|
||||||
|
|
||||||
virtual void getTriangleBatchCount(unsigned int &triangles, unsigned int &batches) = 0;
|
virtual void getTriangleBatchCount(unsigned int &triangles, unsigned int &batches) = 0;
|
||||||
|
|
||||||
virtual void setFallbackValues (const std::map<std::string, std::string>& fallbackMap) = 0;
|
|
||||||
|
|
||||||
virtual std::string getFallback (const std::string& key) const = 0;
|
virtual std::string getFallback (const std::string& key) const = 0;
|
||||||
|
|
||||||
virtual std::string getFallback (const std::string& key, const std::string& def) const = 0;
|
|
||||||
|
|
||||||
virtual MWWorld::Player& getPlayer() = 0;
|
virtual MWWorld::Player& getPlayer() = 0;
|
||||||
|
|
||||||
virtual const MWWorld::ESMStore& getStore() const = 0;
|
virtual const MWWorld::ESMStore& getStore() const = 0;
|
||||||
|
|
|
@ -16,16 +16,31 @@
|
||||||
#include "renderconst.hpp"
|
#include "renderconst.hpp"
|
||||||
|
|
||||||
using namespace MWRender;
|
using namespace MWRender;
|
||||||
|
float Objects::lightLinearValue()
|
||||||
|
{
|
||||||
|
return mFallback->getFallbackFloat("LightAttenuation_LinearValue");
|
||||||
|
}
|
||||||
|
float Objects::lightLinearRadiusMult()
|
||||||
|
{
|
||||||
|
return mFallback->getFallbackFloat("LightAttenuation_LinearRadiusMult");
|
||||||
|
}
|
||||||
|
float Objects::lightQuadraticValue()
|
||||||
|
{
|
||||||
|
return mFallback->getFallbackFloat("LightAttenuation_QuadraticValue");
|
||||||
|
}
|
||||||
|
float Objects::lightQuadraticRadiusMult()
|
||||||
|
{
|
||||||
|
return mFallback->getFallbackFloat("LightAttenuation_QuadraticRadiusMult");
|
||||||
|
}
|
||||||
|
|
||||||
/// \todo Replace these, once fallback values from the ini file are available.
|
bool Objects::lightOutQuadInLin()
|
||||||
float Objects::lightLinearValue = 3;
|
{
|
||||||
float Objects::lightLinearRadiusMult = 1;
|
return mFallback->getFallbackBool("LightAttenuation_OutQuadInLin");
|
||||||
|
}
|
||||||
float Objects::lightQuadraticValue = 16;
|
bool Objects::lightQuadratic()
|
||||||
float Objects::lightQuadraticRadiusMult = 1;
|
{
|
||||||
|
return mFallback->getFallbackBool("LightAttenuation_UseQuadratic");
|
||||||
bool Objects::lightOutQuadInLin = true;
|
}
|
||||||
bool Objects::lightQuadratic = false;
|
|
||||||
|
|
||||||
int Objects::uniqueID = 0;
|
int Objects::uniqueID = 0;
|
||||||
|
|
||||||
|
@ -269,14 +284,14 @@ void Objects::insertLight (const MWWorld::Ptr& ptr, Ogre::Entity* skelBase, Ogre
|
||||||
|
|
||||||
if (!quadratic)
|
if (!quadratic)
|
||||||
{
|
{
|
||||||
float r = radius * lightLinearRadiusMult;
|
float r = radius * lightLinearRadiusMult();
|
||||||
float attenuation = lightLinearValue / r;
|
float attenuation = lightLinearValue() / r;
|
||||||
light->setAttenuation(r*10, 0, attenuation, 0);
|
light->setAttenuation(r*10, 0, attenuation, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float r = radius * lightQuadraticRadiusMult;
|
float r = radius * lightQuadraticRadiusMult();
|
||||||
float attenuation = lightQuadraticValue / pow(r, 2);
|
float attenuation = lightQuadraticValue() / pow(r, 2);
|
||||||
light->setAttenuation(r*10, 0, 0, attenuation);
|
light->setAttenuation(r*10, 0, 0, attenuation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <OgreAxisAlignedBox.h>
|
#include <OgreAxisAlignedBox.h>
|
||||||
|
|
||||||
#include <openengine/ogre/renderer.hpp>
|
#include <openengine/ogre/renderer.hpp>
|
||||||
|
#include "../mwworld/fallback.hpp"
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
|
@ -56,21 +57,21 @@ class Objects{
|
||||||
Ogre::SceneNode* mRootNode;
|
Ogre::SceneNode* mRootNode;
|
||||||
bool mIsStatic;
|
bool mIsStatic;
|
||||||
static int uniqueID;
|
static int uniqueID;
|
||||||
|
MWWorld::Fallback* mFallback;
|
||||||
|
float lightLinearValue();
|
||||||
|
float lightLinearRadiusMult();
|
||||||
|
|
||||||
static float lightLinearValue;
|
bool lightQuadratic();
|
||||||
static float lightLinearRadiusMult;
|
float lightQuadraticValue();
|
||||||
|
float lightQuadraticRadiusMult();
|
||||||
|
|
||||||
static bool lightQuadratic;
|
bool lightOutQuadInLin();
|
||||||
static float lightQuadraticValue;
|
|
||||||
static float lightQuadraticRadiusMult;
|
|
||||||
|
|
||||||
static bool lightOutQuadInLin;
|
|
||||||
|
|
||||||
void clearSceneNode (Ogre::SceneNode *node);
|
void clearSceneNode (Ogre::SceneNode *node);
|
||||||
///< Remove all movable objects from \a node.
|
///< Remove all movable objects from \a node.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Objects(OEngine::Render::OgreRenderer& renderer): mRenderer (renderer), mIsStatic(false) {}
|
Objects(OEngine::Render::OgreRenderer& renderer, MWWorld::Fallback* fallback): mRenderer (renderer), mIsStatic(false), mFallback(fallback) {}
|
||||||
~Objects(){}
|
~Objects(){}
|
||||||
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
||||||
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool light=false);
|
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool light=false);
|
||||||
|
|
|
@ -48,9 +48,10 @@ using namespace Ogre;
|
||||||
namespace MWRender {
|
namespace MWRender {
|
||||||
|
|
||||||
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir,
|
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir,
|
||||||
const boost::filesystem::path& cacheDir, OEngine::Physic::PhysicEngine* engine)
|
const boost::filesystem::path& cacheDir, OEngine::Physic::PhysicEngine* engine,MWWorld::Fallback* fallback)
|
||||||
: mRendering(_rend)
|
: mRendering(_rend)
|
||||||
, mObjects(mRendering)
|
, mFallback(fallback)
|
||||||
|
, mObjects(mRendering,mFallback)
|
||||||
, mActors(mRendering, this)
|
, mActors(mRendering, this)
|
||||||
, mAmbientMode(0)
|
, mAmbientMode(0)
|
||||||
, mSunEnabled(0)
|
, mSunEnabled(0)
|
||||||
|
|
|
@ -60,7 +60,7 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RenderingManager(OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir,
|
RenderingManager(OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir,
|
||||||
const boost::filesystem::path& cacheDir, OEngine::Physic::PhysicEngine* engine);
|
const boost::filesystem::path& cacheDir, OEngine::Physic::PhysicEngine* engine,MWWorld::Fallback* fallback);
|
||||||
virtual ~RenderingManager();
|
virtual ~RenderingManager();
|
||||||
|
|
||||||
void togglePOV() {
|
void togglePOV() {
|
||||||
|
@ -220,6 +220,8 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
|
||||||
|
|
||||||
bool mSunEnabled;
|
bool mSunEnabled;
|
||||||
|
|
||||||
|
MWWorld::Fallback* mFallback;
|
||||||
|
|
||||||
SkyManager* mSkyManager;
|
SkyManager* mSkyManager;
|
||||||
|
|
||||||
OcclusionQuery* mOcclusionQuery;
|
OcclusionQuery* mOcclusionQuery;
|
||||||
|
|
46
apps/openmw/mwworld/fallback.cpp
Normal file
46
apps/openmw/mwworld/fallback.cpp
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#include "fallback.hpp"
|
||||||
|
#include "boost/lexical_cast.hpp"
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
std::string Fallback::getFallbackString(const std::string& fall) const
|
||||||
|
{
|
||||||
|
std::map<std::string,std::string>::const_iterator it;
|
||||||
|
if((it = mFallbackMap.find(fall)) == mFallbackMap.end())
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
float Fallback::getFallbackFloat(const std::string& fall) const
|
||||||
|
{
|
||||||
|
std::string fallback=getFallbackString(fall);
|
||||||
|
if(fallback=="")
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return boost::lexical_cast<float>(fallback);
|
||||||
|
}
|
||||||
|
bool Fallback::getFallbackBool(const std::string& fall) const
|
||||||
|
{
|
||||||
|
std::string fallback=getFallbackString(fall);
|
||||||
|
if(fallback=="")
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return boost::lexical_cast<bool>(fallback);
|
||||||
|
}
|
||||||
|
Ogre::ColourValue Fallback::getFallbackColour(const std::string& fall) const
|
||||||
|
{
|
||||||
|
std::string sum=getFallbackString(fall);
|
||||||
|
if(sum=="")
|
||||||
|
return Ogre::ColourValue(0,0,0);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string ret[3];
|
||||||
|
unsigned int j=0;
|
||||||
|
for(unsigned int i=0;i<sum.length();i++){
|
||||||
|
if(sum[i]==',') j++;
|
||||||
|
else ret[j]+=sum[i];
|
||||||
|
}
|
||||||
|
return Ogre::ColourValue(boost::lexical_cast<int>(ret[0])/255.f,boost::lexical_cast<int>(ret[1])/255.f,boost::lexical_cast<int>(ret[2])/255.f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
apps/openmw/mwworld/fallback.hpp
Normal file
17
apps/openmw/mwworld/fallback.hpp
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef GAME_MWWORLD_FALLBACK_H
|
||||||
|
#define GAME_MWWORLD_FALLBACK_H
|
||||||
|
#include <OgreColourValue.h>
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
class Fallback
|
||||||
|
{
|
||||||
|
const std::map<std::string,std::string> mFallbackMap;
|
||||||
|
public:
|
||||||
|
Fallback(const std::map<std::string,std::string> fallback):mFallbackMap(fallback){};
|
||||||
|
std::string getFallbackString(const std::string& fall) const;
|
||||||
|
float getFallbackFloat(const std::string& fall) const;
|
||||||
|
bool getFallbackBool(const std::string& fall) const;
|
||||||
|
Ogre::ColourValue getFallbackColour(const std::string& fall) const;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -4,7 +4,6 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/soundmanager.hpp"
|
#include "../mwbase/soundmanager.hpp"
|
||||||
|
@ -19,100 +18,68 @@ using namespace MWWorld;
|
||||||
using namespace MWSound;
|
using namespace MWSound;
|
||||||
|
|
||||||
#define lerp(x, y) (x * (1-factor) + y * factor)
|
#define lerp(x, y) (x * (1-factor) + y * factor)
|
||||||
std::string WeatherManager::getFallback (const std::string& key) const
|
|
||||||
{
|
|
||||||
std::map<std::string,std::string>::const_iterator it;
|
|
||||||
if((it = mFallback.find(key)) == mFallback.end())
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return it->second;
|
|
||||||
}
|
|
||||||
std::string WeatherManager::getFallbackString(const std::string& fall) const
|
|
||||||
{
|
|
||||||
return getFallback(fall);
|
|
||||||
}
|
|
||||||
|
|
||||||
float WeatherManager::getFallbackFloat(const std::string& fall) const
|
|
||||||
{
|
|
||||||
std::string fallback=getFallbackString(fall);
|
|
||||||
return boost::lexical_cast<float>(fallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
ColourValue WeatherManager::getFallbackColour(const std::string& fall) const
|
|
||||||
{
|
|
||||||
std::string sum;
|
|
||||||
std::string ret[3];
|
|
||||||
sum=getFallback(fall);
|
|
||||||
unsigned int j=0;
|
|
||||||
for(unsigned int i=0;i<sum.length();i++){
|
|
||||||
if(sum[i]==',') j++;
|
|
||||||
else ret[j]+=sum[i];
|
|
||||||
}
|
|
||||||
return ColourValue(boost::lexical_cast<int>(ret[0])/255.f,boost::lexical_cast<int>(ret[1])/255.f,boost::lexical_cast<int>(ret[2])/255.f);
|
|
||||||
}
|
|
||||||
void WeatherManager::setFallbackWeather(Weather& weather,const std::string& name)
|
void WeatherManager::setFallbackWeather(Weather& weather,const std::string& name)
|
||||||
{
|
{
|
||||||
std::string upper=name;
|
std::string upper=name;
|
||||||
upper[0]=toupper(name[0]);
|
upper[0]=toupper(name[0]);
|
||||||
weather.mCloudsMaximumPercent = getFallbackFloat("Weather_"+upper+"_Clouds_Maximum_Percent");
|
weather.mCloudsMaximumPercent = mFallback->getFallbackFloat("Weather_"+upper+"_Clouds_Maximum_Percent");
|
||||||
weather.mTransitionDelta = getFallbackFloat("Weather_"+upper+"_Transition_Delta");
|
weather.mTransitionDelta = mFallback->getFallbackFloat("Weather_"+upper+"_Transition_Delta");
|
||||||
weather.mSkySunriseColor=getFallbackColour("Weather_"+upper+"_Sky_Sunrise_Color");
|
weather.mSkySunriseColor=mFallback->getFallbackColour("Weather_"+upper+"_Sky_Sunrise_Color");
|
||||||
weather.mSkyDayColor = getFallbackColour("Weather_"+upper+"_Sky_Day_Color");
|
weather.mSkyDayColor = mFallback->getFallbackColour("Weather_"+upper+"_Sky_Day_Color");
|
||||||
weather.mSkySunsetColor = getFallbackColour("Weather_"+upper+"_Sky_Sunset_Color");
|
weather.mSkySunsetColor = mFallback->getFallbackColour("Weather_"+upper+"_Sky_Sunset_Color");
|
||||||
weather.mSkyNightColor = getFallbackColour("Weather_"+upper+"_Sky_Night_Color");
|
weather.mSkyNightColor = mFallback->getFallbackColour("Weather_"+upper+"_Sky_Night_Color");
|
||||||
weather.mFogSunriseColor = getFallbackColour("Weather_"+upper+"_Fog_Sunrise_Color");
|
weather.mFogSunriseColor = mFallback->getFallbackColour("Weather_"+upper+"_Fog_Sunrise_Color");
|
||||||
weather.mFogDayColor = getFallbackColour("Weather_"+upper+"_Fog_Day_Color");
|
weather.mFogDayColor = mFallback->getFallbackColour("Weather_"+upper+"_Fog_Day_Color");
|
||||||
weather.mFogSunsetColor = getFallbackColour("Weather_"+upper+"_Fog_Sunset_Color");
|
weather.mFogSunsetColor = mFallback->getFallbackColour("Weather_"+upper+"_Fog_Sunset_Color");
|
||||||
weather.mFogNightColor = getFallbackColour("Weather_"+upper+"_Fog_Night_Color");
|
weather.mFogNightColor = mFallback->getFallbackColour("Weather_"+upper+"_Fog_Night_Color");
|
||||||
weather.mAmbientSunriseColor = getFallbackColour("Weather_"+upper+"_Ambient_Sunrise_Color");
|
weather.mAmbientSunriseColor = mFallback->getFallbackColour("Weather_"+upper+"_Ambient_Sunrise_Color");
|
||||||
weather.mAmbientDayColor = getFallbackColour("Weather_"+upper+"_Ambient_Day_Color");
|
weather.mAmbientDayColor = mFallback->getFallbackColour("Weather_"+upper+"_Ambient_Day_Color");
|
||||||
weather.mAmbientSunsetColor = getFallbackColour("Weather_"+upper+"_Ambient_Sunset_Color");
|
weather.mAmbientSunsetColor = mFallback->getFallbackColour("Weather_"+upper+"_Ambient_Sunset_Color");
|
||||||
weather.mAmbientNightColor = getFallbackColour("Weather_"+upper+"_Ambient_Night_Color");
|
weather.mAmbientNightColor = mFallback->getFallbackColour("Weather_"+upper+"_Ambient_Night_Color");
|
||||||
weather.mSunSunriseColor = getFallbackColour("Weather_"+upper+"_Sun_Sunrise_Color");
|
weather.mSunSunriseColor = mFallback->getFallbackColour("Weather_"+upper+"_Sun_Sunrise_Color");
|
||||||
weather.mSunDayColor = getFallbackColour("Weather_"+upper+"_Sun_Day_Color");
|
weather.mSunDayColor = mFallback->getFallbackColour("Weather_"+upper+"_Sun_Day_Color");
|
||||||
weather.mSunSunsetColor = getFallbackColour("Weather_"+upper+"_Sun_Sunset_Color");
|
weather.mSunSunsetColor = mFallback->getFallbackColour("Weather_"+upper+"_Sun_Sunset_Color");
|
||||||
weather.mSunNightColor = getFallbackColour("Weather_"+upper+"_Sun_Night_Color");
|
weather.mSunNightColor = mFallback->getFallbackColour("Weather_"+upper+"_Sun_Night_Color");
|
||||||
weather.mSunDiscSunsetColor = getFallbackColour("Weather_"+upper+"_Sun_Disc_Sunset_Color");
|
weather.mSunDiscSunsetColor = mFallback->getFallbackColour("Weather_"+upper+"_Sun_Disc_Sunset_Color");
|
||||||
weather.mLandFogDayDepth = getFallbackFloat("Weather_"+upper+"_Land_Fog_Day_Depth");
|
weather.mLandFogDayDepth = mFallback->getFallbackFloat("Weather_"+upper+"_Land_Fog_Day_Depth");
|
||||||
weather.mLandFogNightDepth = getFallbackFloat("Weather_"+upper+"_Land_Fog_Night_Depth");
|
weather.mLandFogNightDepth = mFallback->getFallbackFloat("Weather_"+upper+"_Land_Fog_Night_Depth");
|
||||||
weather.mWindSpeed = getFallbackFloat("Weather_"+upper+"_Wind_Speed");
|
weather.mWindSpeed = mFallback->getFallbackFloat("Weather_"+upper+"_Wind_Speed");
|
||||||
weather.mCloudSpeed = getFallbackFloat("Weather_"+upper+"_Cloud_Speed");
|
weather.mCloudSpeed = mFallback->getFallbackFloat("Weather_"+upper+"_Cloud_Speed");
|
||||||
weather.mGlareView = getFallbackFloat("Weather_"+upper+"_Glare_View");
|
weather.mGlareView = mFallback->getFallbackFloat("Weather_"+upper+"_Glare_View");
|
||||||
mWeatherSettings[name] = weather;
|
mWeatherSettings[name] = weather;
|
||||||
}
|
}
|
||||||
|
|
||||||
WeatherManager::WeatherManager(MWRender::RenderingManager* rendering,const std::map<std::string,std::string>& fallbackMap) :
|
WeatherManager::WeatherManager(MWRender::RenderingManager* rendering,MWWorld::Fallback* fallback) :
|
||||||
mHour(14), mCurrentWeather("clear"), mFirstUpdate(true), mWeatherUpdateTime(0),
|
mHour(14), mCurrentWeather("clear"), mFirstUpdate(true), mWeatherUpdateTime(0),
|
||||||
mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50), mThunderSoundDelay(0),
|
mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50), mThunderSoundDelay(0),
|
||||||
mRemainingTransitionTime(0), mMonth(0), mDay(0),
|
mRemainingTransitionTime(0), mMonth(0), mDay(0),
|
||||||
mTimePassed(0), mFallback(fallbackMap)
|
mTimePassed(0), mFallback(fallback)
|
||||||
{
|
{
|
||||||
mRendering = rendering;
|
mRendering = rendering;
|
||||||
//Globals
|
//Globals
|
||||||
mThunderSoundID0 = getFallbackString("Weather_Thunderstorm_Thunder_Sound_ID_0");
|
mThunderSoundID0 = mFallback->getFallbackString("Weather_Thunderstorm_Thunder_Sound_ID_0");
|
||||||
mThunderSoundID1 = getFallbackString("Weather_Thunderstorm_Thunder_Sound_ID_1");
|
mThunderSoundID1 = mFallback->getFallbackString("Weather_Thunderstorm_Thunder_Sound_ID_1");
|
||||||
mThunderSoundID2 = getFallbackString("Weather_Thunderstorm_Thunder_Sound_ID_2");
|
mThunderSoundID2 = mFallback->getFallbackString("Weather_Thunderstorm_Thunder_Sound_ID_2");
|
||||||
mThunderSoundID3 = getFallbackString("Weather_Thunderstorm_Thunder_Sound_ID_3");
|
mThunderSoundID3 = mFallback->getFallbackString("Weather_Thunderstorm_Thunder_Sound_ID_3");
|
||||||
mSunriseTime = getFallbackFloat("Weather_Sunrise_Time");
|
mSunriseTime = mFallback->getFallbackFloat("Weather_Sunrise_Time");
|
||||||
mSunsetTime = getFallbackFloat("Weather_Sunset_Time");
|
mSunsetTime = mFallback->getFallbackFloat("Weather_Sunset_Time");
|
||||||
mSunriseDuration = getFallbackFloat("Weather_Sunrise_Duration");
|
mSunriseDuration = mFallback->getFallbackFloat("Weather_Sunrise_Duration");
|
||||||
mSunsetDuration = getFallbackFloat("Weather_Sunset_Duration");
|
mSunsetDuration = mFallback->getFallbackFloat("Weather_Sunset_Duration");
|
||||||
mWeatherUpdateTime = getFallbackFloat("Weather_Hours_Between_Weather_Changes");
|
mWeatherUpdateTime = mFallback->getFallbackFloat("Weather_Hours_Between_Weather_Changes");
|
||||||
mThunderFrequency = getFallbackFloat("Weather_Thunderstorm_Thunder_Frequency");
|
mThunderFrequency = mFallback->getFallbackFloat("Weather_Thunderstorm_Thunder_Frequency");
|
||||||
mThunderThreshold = getFallbackFloat("Weather_Thunderstorm_Thunder_Threshold");
|
mThunderThreshold = mFallback->getFallbackFloat("Weather_Thunderstorm_Thunder_Threshold");
|
||||||
mThunderSoundDelay = 0.25;
|
mThunderSoundDelay = 0.25;
|
||||||
//Weather
|
//Weather
|
||||||
Weather clear;
|
Weather clear;
|
||||||
clear.mCloudTexture = "tx_sky_clear.dds";
|
clear.mCloudTexture = "tx_sky_clear.dds";
|
||||||
setFallbackWeather(clear,"clear");
|
setFallbackWeather(clear,"clear");
|
||||||
|
|
||||||
Weather cloudy;
|
Weather cloudy;
|
||||||
cloudy.mCloudTexture = "tx_sky_cloudy.dds";
|
cloudy.mCloudTexture = "tx_sky_cloudy.dds";
|
||||||
setFallbackWeather(cloudy,"cloudy");
|
setFallbackWeather(cloudy,"cloudy");
|
||||||
|
|
||||||
Weather foggy;
|
Weather foggy;
|
||||||
foggy.mCloudTexture = "tx_sky_foggy.dds";
|
foggy.mCloudTexture = "tx_sky_foggy.dds";
|
||||||
setFallbackWeather(foggy,"foggy");
|
setFallbackWeather(foggy,"foggy");
|
||||||
|
|
||||||
Weather thunderstorm;
|
Weather thunderstorm;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <OgreString.h>
|
#include <OgreString.h>
|
||||||
#include <OgreColourValue.h>
|
#include <OgreColourValue.h>
|
||||||
|
#include "fallback.hpp"
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
class RenderingManager;
|
class RenderingManager;
|
||||||
|
@ -112,7 +112,7 @@ namespace MWWorld
|
||||||
class WeatherManager
|
class WeatherManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WeatherManager(MWRender::RenderingManager*,const std::map<std::string,std::string>& fallbackMap);
|
WeatherManager(MWRender::RenderingManager*,MWWorld::Fallback* fallback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the weather in the specified region
|
* Change the weather in the specified region
|
||||||
|
@ -141,11 +141,7 @@ namespace MWWorld
|
||||||
private:
|
private:
|
||||||
float mHour;
|
float mHour;
|
||||||
int mDay, mMonth;
|
int mDay, mMonth;
|
||||||
std::map<std::string,std::string> mFallback;
|
MWWorld::Fallback* mFallback;
|
||||||
std::string getFallback (const std::string& key) const;
|
|
||||||
std::string getFallbackString(const std::string& fall) const;
|
|
||||||
float getFallbackFloat(const std::string& fall) const;
|
|
||||||
Ogre::ColourValue getFallbackColour(const std::string& fall) const;
|
|
||||||
void setFallbackWeather(Weather& weather,const std::string& name);
|
void setFallbackWeather(Weather& weather,const std::string& name);
|
||||||
MWRender::RenderingManager* mRendering;
|
MWRender::RenderingManager* mRendering;
|
||||||
|
|
||||||
|
|
|
@ -154,24 +154,9 @@ namespace MWWorld
|
||||||
mRendering->skyDisable();
|
mRendering->skyDisable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::setFallbackValues (const std::map<std::string,std::string>& fallbackMap)
|
|
||||||
{
|
|
||||||
mFallback = fallbackMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string World::getFallback (const std::string& key) const
|
std::string World::getFallback (const std::string& key) const
|
||||||
{
|
{
|
||||||
return getFallback(key, "");
|
return mFallback.getFallbackString(key);
|
||||||
}
|
|
||||||
|
|
||||||
std::string World::getFallback (const std::string& key, const std::string& def) const
|
|
||||||
{
|
|
||||||
std::map<std::string,std::string>::const_iterator it;
|
|
||||||
if((it = mFallback.find(key)) == mFallback.end())
|
|
||||||
{
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
return it->second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
World::World (OEngine::Render::OgreRenderer& renderer,
|
World::World (OEngine::Render::OgreRenderer& renderer,
|
||||||
|
@ -181,17 +166,16 @@ namespace MWWorld
|
||||||
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride)
|
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride)
|
||||||
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
||||||
mSky (true), mCells (mStore, mEsm),
|
mSky (true), mCells (mStore, mEsm),
|
||||||
mNumFacing(0), mActivationDistanceOverride (mActivationDistanceOverride),
|
mNumFacing(0), mActivationDistanceOverride (mActivationDistanceOverride),mFallback(fallbackMap)
|
||||||
mFallback (fallbackMap)
|
|
||||||
{
|
{
|
||||||
mPhysics = new PhysicsSystem(renderer);
|
mPhysics = new PhysicsSystem(renderer);
|
||||||
mPhysEngine = mPhysics->getEngine();
|
mPhysEngine = mPhysics->getEngine();
|
||||||
|
|
||||||
mRendering = new MWRender::RenderingManager(renderer, resDir, cacheDir, mPhysEngine);
|
mRendering = new MWRender::RenderingManager(renderer, resDir, cacheDir, mPhysEngine,&mFallback);
|
||||||
|
|
||||||
mPhysEngine->setSceneManager(renderer.getScene());
|
mPhysEngine->setSceneManager(renderer.getScene());
|
||||||
|
|
||||||
mWeatherManager = new MWWorld::WeatherManager(mRendering,fallbackMap);
|
mWeatherManager = new MWWorld::WeatherManager(mRendering,&mFallback);
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
// NOTE: We might need to reserve one more for the running game / save.
|
// NOTE: We might need to reserve one more for the running game / save.
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "cells.hpp"
|
#include "cells.hpp"
|
||||||
#include "localscripts.hpp"
|
#include "localscripts.hpp"
|
||||||
#include "timestamp.hpp"
|
#include "timestamp.hpp"
|
||||||
|
#include "fallback.hpp"
|
||||||
|
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ namespace MWWorld
|
||||||
|
|
||||||
class World : public MWBase::World
|
class World : public MWBase::World
|
||||||
{
|
{
|
||||||
|
MWWorld::Fallback mFallback;
|
||||||
MWRender::RenderingManager* mRendering;
|
MWRender::RenderingManager* mRendering;
|
||||||
|
|
||||||
MWWorld::WeatherManager* mWeatherManager;
|
MWWorld::WeatherManager* mWeatherManager;
|
||||||
|
@ -82,7 +84,6 @@ namespace MWWorld
|
||||||
float mFaced1Distance;
|
float mFaced1Distance;
|
||||||
float mFaced2Distance;
|
float mFaced2Distance;
|
||||||
int mNumFacing;
|
int mNumFacing;
|
||||||
std::map<std::string,std::string> mFallback;
|
|
||||||
|
|
||||||
unsigned long lastTick;
|
unsigned long lastTick;
|
||||||
Ogre::Timer mTimer;
|
Ogre::Timer mTimer;
|
||||||
|
@ -132,12 +133,8 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual void getTriangleBatchCount(unsigned int &triangles, unsigned int &batches);
|
virtual void getTriangleBatchCount(unsigned int &triangles, unsigned int &batches);
|
||||||
|
|
||||||
virtual void setFallbackValues (const std::map<std::string,std::string>& fallbackMap);
|
|
||||||
|
|
||||||
virtual std::string getFallback (const std::string& key) const;
|
virtual std::string getFallback (const std::string& key) const;
|
||||||
|
|
||||||
virtual std::string getFallback (const std::string& key, const std::string& def) const;
|
|
||||||
|
|
||||||
virtual Player& getPlayer();
|
virtual Player& getPlayer();
|
||||||
|
|
||||||
virtual const MWWorld::ESMStore& getStore() const;
|
virtual const MWWorld::ESMStore& getStore() const;
|
||||||
|
|
Loading…
Reference in a new issue