forked from mirror/openmw-tes3mp
Merge branch 'master' of github.com:OpenMW/openmw
This commit is contained in:
commit
29f5cb46ac
28 changed files with 746 additions and 506 deletions
|
@ -26,7 +26,7 @@ opencs_units (model/world
|
||||||
|
|
||||||
opencs_units_noqt (model/world
|
opencs_units_noqt (model/world
|
||||||
universalid record commands columnbase scriptcontext cell refidcollection
|
universalid record commands columnbase scriptcontext cell refidcollection
|
||||||
refidadapter refiddata refidadapterimp ref collectionbase refcollection columns infocollection tablemimedata cellcoordinates cellselection resources resourcesmanager scope
|
refidadapter refiddata refidadapterimp ref collectionbase refcollection columns infocollection tablemimedata cellcoordinates cellselection resources resourcesmanager scope landtexture land
|
||||||
)
|
)
|
||||||
|
|
||||||
opencs_hdrs_noqt (model/world
|
opencs_hdrs_noqt (model/world
|
||||||
|
@ -76,7 +76,7 @@ opencs_units (view/widget
|
||||||
|
|
||||||
opencs_units (view/render
|
opencs_units (view/render
|
||||||
scenewidget worldspacewidget pagedworldspacewidget unpagedworldspacewidget
|
scenewidget worldspacewidget pagedworldspacewidget unpagedworldspacewidget
|
||||||
previewwidget
|
previewwidget terrainstorage
|
||||||
)
|
)
|
||||||
|
|
||||||
opencs_units_noqt (view/render
|
opencs_units_noqt (view/render
|
||||||
|
|
|
@ -539,6 +539,16 @@ CSMWorld::IdCollection<ESM::DebugProfile>& CSMWorld::Data::getDebugProfiles()
|
||||||
return mDebugProfiles;
|
return mDebugProfiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CSMWorld::IdCollection<CSMWorld::Land>& CSMWorld::Data::getLand() const
|
||||||
|
{
|
||||||
|
return mLand;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CSMWorld::IdCollection<CSMWorld::LandTexture>& CSMWorld::Data::getLandTextures() const
|
||||||
|
{
|
||||||
|
return mLandTextures;
|
||||||
|
}
|
||||||
|
|
||||||
const CSMWorld::Resources& CSMWorld::Data::getResources (const UniversalId& id) const
|
const CSMWorld::Resources& CSMWorld::Data::getResources (const UniversalId& id) const
|
||||||
{
|
{
|
||||||
return mResourcesManager.get (id.getType());
|
return mResourcesManager.get (id.getType());
|
||||||
|
@ -573,8 +583,11 @@ void CSMWorld::Data::merge()
|
||||||
|
|
||||||
int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base, bool project)
|
int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base, bool project)
|
||||||
{
|
{
|
||||||
delete mReader;
|
// Don't delete the Reader yet. Some record types store a reference to the Reader to handle on-demand loading
|
||||||
|
boost::shared_ptr<ESM::ESMReader> ptr(mReader);
|
||||||
|
mReaders.push_back(ptr);
|
||||||
mReader = 0;
|
mReader = 0;
|
||||||
|
|
||||||
mDialogue = 0;
|
mDialogue = 0;
|
||||||
mRefLoadCache.clear();
|
mRefLoadCache.clear();
|
||||||
|
|
||||||
|
@ -598,8 +611,11 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Stage::Messages& messages)
|
||||||
|
|
||||||
if (!mReader->hasMoreRecs())
|
if (!mReader->hasMoreRecs())
|
||||||
{
|
{
|
||||||
delete mReader;
|
// Don't delete the Reader yet. Some record types store a reference to the Reader to handle on-demand loading
|
||||||
|
boost::shared_ptr<ESM::ESMReader> ptr(mReader);
|
||||||
|
mReaders.push_back(ptr);
|
||||||
mReader = 0;
|
mReader = 0;
|
||||||
|
|
||||||
mDialogue = 0;
|
mDialogue = 0;
|
||||||
mRefLoadCache.clear();
|
mRefLoadCache.clear();
|
||||||
return true;
|
return true;
|
||||||
|
@ -626,6 +642,9 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Stage::Messages& messages)
|
||||||
case ESM::REC_ENCH: mEnchantments.load (*mReader, mBase); break;
|
case ESM::REC_ENCH: mEnchantments.load (*mReader, mBase); break;
|
||||||
case ESM::REC_BODY: mBodyParts.load (*mReader, mBase); break;
|
case ESM::REC_BODY: mBodyParts.load (*mReader, mBase); break;
|
||||||
|
|
||||||
|
case ESM::REC_LTEX: mLandTextures.load (*mReader, mBase); break;
|
||||||
|
case ESM::REC_LAND: mLand.load(*mReader, mBase); break;
|
||||||
|
|
||||||
case ESM::REC_CELL:
|
case ESM::REC_CELL:
|
||||||
{
|
{
|
||||||
mCells.load (*mReader, mBase);
|
mCells.load (*mReader, mBase);
|
||||||
|
@ -775,7 +794,9 @@ bool CSMWorld::Data::hasId (const std::string& id) const
|
||||||
getCells().searchId (id)!=-1 ||
|
getCells().searchId (id)!=-1 ||
|
||||||
getEnchantments().searchId (id)!=-1 ||
|
getEnchantments().searchId (id)!=-1 ||
|
||||||
getBodyParts().searchId (id)!=-1 ||
|
getBodyParts().searchId (id)!=-1 ||
|
||||||
getReferenceables().searchId (id)!=-1;
|
getReferenceables().searchId (id)!=-1 ||
|
||||||
|
getLand().searchId (id) != -1 ||
|
||||||
|
getLandTextures().searchId (id) != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSMWorld::Data::count (RecordBase::State state) const
|
int CSMWorld::Data::count (RecordBase::State state) const
|
||||||
|
@ -795,7 +816,9 @@ int CSMWorld::Data::count (RecordBase::State state) const
|
||||||
count (state, mCells) +
|
count (state, mCells) +
|
||||||
count (state, mEnchantments) +
|
count (state, mEnchantments) +
|
||||||
count (state, mBodyParts) +
|
count (state, mBodyParts) +
|
||||||
count (state, mReferenceables);
|
count (state, mReferenceables) +
|
||||||
|
count (state, mLand) +
|
||||||
|
count (state, mLandTextures);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMWorld::Data::setDescription (const std::string& description)
|
void CSMWorld::Data::setDescription (const std::string& description)
|
||||||
|
@ -838,6 +861,8 @@ std::vector<std::string> CSMWorld::Data::getIds (bool listDeleted) const
|
||||||
appendIds (ids, mEnchantments, listDeleted);
|
appendIds (ids, mEnchantments, listDeleted);
|
||||||
appendIds (ids, mBodyParts, listDeleted);
|
appendIds (ids, mBodyParts, listDeleted);
|
||||||
appendIds (ids, mReferenceables, listDeleted);
|
appendIds (ids, mReferenceables, listDeleted);
|
||||||
|
appendIds (ids, mLand, listDeleted);
|
||||||
|
appendIds (ids, mLandTextures, listDeleted);
|
||||||
|
|
||||||
std::sort (ids.begin(), ids.end());
|
std::sort (ids.begin(), ids.end());
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include "idcollection.hpp"
|
#include "idcollection.hpp"
|
||||||
#include "universalid.hpp"
|
#include "universalid.hpp"
|
||||||
#include "cell.hpp"
|
#include "cell.hpp"
|
||||||
|
#include "land.hpp"
|
||||||
|
#include "landtexture.hpp"
|
||||||
#include "refidcollection.hpp"
|
#include "refidcollection.hpp"
|
||||||
#include "refcollection.hpp"
|
#include "refcollection.hpp"
|
||||||
#include "infocollection.hpp"
|
#include "infocollection.hpp"
|
||||||
|
@ -74,6 +76,8 @@ namespace CSMWorld
|
||||||
InfoCollection mTopicInfos;
|
InfoCollection mTopicInfos;
|
||||||
InfoCollection mJournalInfos;
|
InfoCollection mJournalInfos;
|
||||||
IdCollection<Cell> mCells;
|
IdCollection<Cell> mCells;
|
||||||
|
IdCollection<LandTexture> mLandTextures;
|
||||||
|
IdCollection<Land> mLand;
|
||||||
RefIdCollection mReferenceables;
|
RefIdCollection mReferenceables;
|
||||||
RefCollection mRefs;
|
RefCollection mRefs;
|
||||||
IdCollection<ESM::Filter> mFilters;
|
IdCollection<ESM::Filter> mFilters;
|
||||||
|
@ -88,6 +92,8 @@ namespace CSMWorld
|
||||||
bool mProject;
|
bool mProject;
|
||||||
std::map<std::string, std::map<ESM::RefNum, std::string> > mRefLoadCache;
|
std::map<std::string, std::map<ESM::RefNum, std::string> > mRefLoadCache;
|
||||||
|
|
||||||
|
std::vector<boost::shared_ptr<ESM::ESMReader> > mReaders;
|
||||||
|
|
||||||
// not implemented
|
// not implemented
|
||||||
Data (const Data&);
|
Data (const Data&);
|
||||||
Data& operator= (const Data&);
|
Data& operator= (const Data&);
|
||||||
|
@ -195,6 +201,10 @@ namespace CSMWorld
|
||||||
|
|
||||||
IdCollection<ESM::DebugProfile>& getDebugProfiles();
|
IdCollection<ESM::DebugProfile>& getDebugProfiles();
|
||||||
|
|
||||||
|
const IdCollection<CSMWorld::Land>& getLand() const;
|
||||||
|
|
||||||
|
const IdCollection<CSMWorld::LandTexture>& getLandTextures() const;
|
||||||
|
|
||||||
/// Throws an exception, if \a id does not match a resources list.
|
/// Throws an exception, if \a id does not match a resources list.
|
||||||
const Resources& getResources (const UniversalId& id) const;
|
const Resources& getResources (const UniversalId& id) const;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ int CSMWorld::IdTable::columnCount (const QModelIndex & parent) const
|
||||||
|
|
||||||
QVariant CSMWorld::IdTable::data (const QModelIndex & index, int role) const
|
QVariant CSMWorld::IdTable::data (const QModelIndex & index, int role) const
|
||||||
{
|
{
|
||||||
if (role!=Qt::DisplayRole && role!=Qt::EditRole)
|
if ((role!=Qt::DisplayRole && role!=Qt::EditRole) || index.row() < 0 || index.column() < 0)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if (role==Qt::EditRole && !mIdCollection->getColumn (index.column()).isEditable())
|
if (role==Qt::EditRole && !mIdCollection->getColumn (index.column()).isEditable())
|
||||||
|
|
28
apps/opencs/model/world/land.cpp
Normal file
28
apps/opencs/model/world/land.cpp
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#include "land.hpp"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
namespace CSMWorld
|
||||||
|
{
|
||||||
|
|
||||||
|
Land::Land()
|
||||||
|
{
|
||||||
|
mLand.reset(new ESM::Land());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Land::load(ESM::ESMReader &esm)
|
||||||
|
{
|
||||||
|
mLand->load(esm);
|
||||||
|
|
||||||
|
std::ostringstream stream;
|
||||||
|
stream << "#" << mLand->mX << " " << mLand->mY;
|
||||||
|
|
||||||
|
mId = stream.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Land::blank()
|
||||||
|
{
|
||||||
|
/// \todo
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
29
apps/opencs/model/world/land.hpp
Normal file
29
apps/opencs/model/world/land.hpp
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef CSM_WORLD_LAND_H
|
||||||
|
#define CSM_WORLD_LAND_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <components/esm/loadland.hpp>
|
||||||
|
|
||||||
|
namespace CSMWorld
|
||||||
|
{
|
||||||
|
/// \brief Wrapper for Land record. Encodes X and Y cell index in the ID.
|
||||||
|
///
|
||||||
|
/// \todo Add worldspace support to the Land record.
|
||||||
|
/// \todo Add a proper copy constructor (currently worked around using shared_ptr)
|
||||||
|
struct Land
|
||||||
|
{
|
||||||
|
Land();
|
||||||
|
|
||||||
|
boost::shared_ptr<ESM::Land> mLand;
|
||||||
|
|
||||||
|
std::string mId;
|
||||||
|
|
||||||
|
/// Loads the metadata and ID
|
||||||
|
void load (ESM::ESMReader &esm);
|
||||||
|
|
||||||
|
void blank();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
21
apps/opencs/model/world/landtexture.cpp
Normal file
21
apps/opencs/model/world/landtexture.cpp
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#include "landtexture.hpp"
|
||||||
|
|
||||||
|
#include <components/esm/esmreader.hpp>
|
||||||
|
|
||||||
|
namespace CSMWorld
|
||||||
|
{
|
||||||
|
|
||||||
|
void LandTexture::load(ESM::ESMReader &esm)
|
||||||
|
{
|
||||||
|
ESM::LandTexture::load(esm);
|
||||||
|
|
||||||
|
int plugin = esm.getIndex();
|
||||||
|
|
||||||
|
std::ostringstream stream;
|
||||||
|
|
||||||
|
stream << mIndex << "_" << plugin;
|
||||||
|
|
||||||
|
mId = stream.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
22
apps/opencs/model/world/landtexture.hpp
Normal file
22
apps/opencs/model/world/landtexture.hpp
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef CSM_WORLD_LANDTEXTURE_H
|
||||||
|
#define CSM_WORLD_LANDTEXTURE_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <components/esm/loadltex.hpp>
|
||||||
|
|
||||||
|
namespace CSMWorld
|
||||||
|
{
|
||||||
|
/// \brief Wrapper for LandTexture record. Encodes mIndex and the plugin index (obtained from ESMReader)
|
||||||
|
/// in the ID.
|
||||||
|
///
|
||||||
|
/// \attention The mId field of the ESM::LandTexture struct is not used.
|
||||||
|
struct LandTexture : public ESM::LandTexture
|
||||||
|
{
|
||||||
|
std::string mId;
|
||||||
|
|
||||||
|
void load (ESM::ESMReader &esm);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -10,6 +10,9 @@
|
||||||
#include "../../model/world/columns.hpp"
|
#include "../../model/world/columns.hpp"
|
||||||
#include "../../model/world/data.hpp"
|
#include "../../model/world/data.hpp"
|
||||||
|
|
||||||
|
#include "elements.hpp"
|
||||||
|
#include "terrainstorage.hpp"
|
||||||
|
|
||||||
bool CSVRender::Cell::removeObject (const std::string& id)
|
bool CSVRender::Cell::removeObject (const std::string& id)
|
||||||
{
|
{
|
||||||
std::map<std::string, Object *>::iterator iter =
|
std::map<std::string, Object *>::iterator iter =
|
||||||
|
@ -67,6 +70,18 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, Ogre::SceneManager *sceneManager,
|
||||||
int rows = references.rowCount();
|
int rows = references.rowCount();
|
||||||
|
|
||||||
addObjects (0, rows-1);
|
addObjects (0, rows-1);
|
||||||
|
|
||||||
|
const CSMWorld::IdCollection<CSMWorld::Land>& land = mData.getLand();
|
||||||
|
int landIndex = land.searchId(mId);
|
||||||
|
if (landIndex != -1)
|
||||||
|
{
|
||||||
|
mTerrain.reset(new Terrain::TerrainGrid(sceneManager, new TerrainStorage(mData), Element_Terrain, true,
|
||||||
|
Terrain::Align_XY));
|
||||||
|
|
||||||
|
const ESM::Land* esmLand = land.getRecord(mId).get().mLand.get();
|
||||||
|
mTerrain->loadCell(esmLand->mX,
|
||||||
|
esmLand->mY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSVRender::Cell::~Cell()
|
CSVRender::Cell::~Cell()
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include <OgreVector3.h>
|
#include <OgreVector3.h>
|
||||||
|
|
||||||
|
#include <components/terrain/terraingrid.hpp>
|
||||||
|
|
||||||
#include "object.hpp"
|
#include "object.hpp"
|
||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
|
@ -29,6 +31,7 @@ namespace CSVRender
|
||||||
std::string mId;
|
std::string mId;
|
||||||
Ogre::SceneNode *mCellNode;
|
Ogre::SceneNode *mCellNode;
|
||||||
std::map<std::string, Object *> mObjects;
|
std::map<std::string, Object *> mObjects;
|
||||||
|
std::auto_ptr<Terrain::TerrainGrid> mTerrain;
|
||||||
|
|
||||||
/// Ignored if cell does not have an object with the given ID.
|
/// Ignored if cell does not have an object with the given ID.
|
||||||
///
|
///
|
||||||
|
|
|
@ -50,7 +50,7 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
|
||||||
{
|
{
|
||||||
int index = cells.searchId (iter->getId (mWorldspace));
|
int index = cells.searchId (iter->getId (mWorldspace));
|
||||||
|
|
||||||
if (index!=0 && cells.getRecord (index).mState!=CSMWorld::RecordBase::State_Deleted &&
|
if (index > 0 && cells.getRecord (index).mState!=CSMWorld::RecordBase::State_Deleted &&
|
||||||
mCells.find (*iter)==mCells.end())
|
mCells.find (*iter)==mCells.end())
|
||||||
{
|
{
|
||||||
if (setCamera)
|
if (setCamera)
|
||||||
|
|
43
apps/opencs/view/render/terrainstorage.cpp
Normal file
43
apps/opencs/view/render/terrainstorage.cpp
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
#include "terrainstorage.hpp"
|
||||||
|
|
||||||
|
namespace CSVRender
|
||||||
|
{
|
||||||
|
|
||||||
|
TerrainStorage::TerrainStorage(const CSMWorld::Data &data)
|
||||||
|
: mData(data)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ESM::Land* TerrainStorage::getLand(int cellX, int cellY)
|
||||||
|
{
|
||||||
|
std::ostringstream stream;
|
||||||
|
stream << "#" << cellX << " " << cellY;
|
||||||
|
|
||||||
|
// The cell isn't guaranteed to have Land. This is because the terrain implementation
|
||||||
|
// has to wrap the vertices of the last row and column to the next cell, which may be a nonexisting cell
|
||||||
|
int index = mData.getLand().searchId(stream.str());
|
||||||
|
if (index == -1)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
ESM::Land* land = mData.getLand().getRecord(index).get().mLand.get();
|
||||||
|
int mask = ESM::Land::DATA_VHGT | ESM::Land::DATA_VNML | ESM::Land::DATA_VCLR | ESM::Land::DATA_VTEX;
|
||||||
|
if (!land->isDataLoaded(mask))
|
||||||
|
land->loadData(mask);
|
||||||
|
return land;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ESM::LandTexture* TerrainStorage::getLandTexture(int index, short plugin)
|
||||||
|
{
|
||||||
|
std::ostringstream stream;
|
||||||
|
stream << index << "_" << plugin;
|
||||||
|
|
||||||
|
return &mData.getLandTextures().getRecord(stream.str()).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TerrainStorage::getBounds(float &minX, float &maxX, float &minY, float &maxY)
|
||||||
|
{
|
||||||
|
// not needed at the moment - this returns the bounds of the whole world, but we only edit individual cells
|
||||||
|
throw std::runtime_error("getBounds not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
29
apps/opencs/view/render/terrainstorage.hpp
Normal file
29
apps/opencs/view/render/terrainstorage.hpp
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef OPENCS_RENDER_TERRAINSTORAGE_H
|
||||||
|
#define OPENCS_RENDER_TERRAINSTORAGE_H
|
||||||
|
|
||||||
|
#include <components/esmterrain/storage.hpp>
|
||||||
|
|
||||||
|
#include "../../model/world/data.hpp"
|
||||||
|
|
||||||
|
namespace CSVRender
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A bridge between the terrain component and OpenCS's terrain data storage.
|
||||||
|
*/
|
||||||
|
class TerrainStorage : public ESMTerrain::Storage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TerrainStorage(const CSMWorld::Data& data);
|
||||||
|
private:
|
||||||
|
const CSMWorld::Data& mData;
|
||||||
|
|
||||||
|
virtual ESM::Land* getLand (int cellX, int cellY);
|
||||||
|
virtual const ESM::LandTexture* getLandTexture(int index, short plugin);
|
||||||
|
|
||||||
|
virtual void getBounds(float& minX, float& maxX, float& minY, float& maxY);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -478,7 +478,7 @@ void OMW::Engine::go()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the main rendering loop
|
// Start the main rendering loop
|
||||||
while (!mEnvironment.get().getStateManager()->hasQuitRequest())
|
while (!MWBase::Environment::get().getStateManager()->hasQuitRequest())
|
||||||
Ogre::Root::getSingleton().renderOneFrame();
|
Ogre::Root::getSingleton().renderOneFrame();
|
||||||
|
|
||||||
// Save user settings
|
// Save user settings
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace MWClass
|
||||||
|
|
||||||
virtual int getItemMaxHealth (const MWWorld::Ptr& ptr) const;
|
virtual int getItemMaxHealth (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return item max health or throw an exception, if class does not have item health
|
///< Return item max health or throw an exception, if class does not have item health
|
||||||
/// (default implementation: throw an exceoption)
|
/// (default implementation: throw an exception)
|
||||||
|
|
||||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
|
|
|
@ -246,10 +246,7 @@ namespace MWMechanics
|
||||||
const ESM::Spell* spell, const MagicEffects* effects)
|
const ESM::Spell* spell, const MagicEffects* effects)
|
||||||
{
|
{
|
||||||
float resistance = getEffectResistance(effectId, actor, caster, spell, effects);
|
float resistance = getEffectResistance(effectId, actor, caster, spell, effects);
|
||||||
if (resistance >= 0)
|
return 1 - resistance / 100.f;
|
||||||
return 1 - resistance / 100.f;
|
|
||||||
else
|
|
||||||
return -(resistance-100) / 100.f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if the given affect can be applied to the target. If \a castByPlayer, emits a message box on failure.
|
/// Check if the given affect can be applied to the target. If \a castByPlayer, emits a message box on failure.
|
||||||
|
|
|
@ -51,6 +51,10 @@ namespace MWMechanics
|
||||||
float getEffectResistance (short effectId, const MWWorld::Ptr& actor, const MWWorld::Ptr& caster,
|
float getEffectResistance (short effectId, const MWWorld::Ptr& actor, const MWWorld::Ptr& caster,
|
||||||
const ESM::Spell* spell = NULL, const MagicEffects* effects = NULL);
|
const ESM::Spell* spell = NULL, const MagicEffects* effects = NULL);
|
||||||
|
|
||||||
|
/// Get an effect multiplier for applying an effect cast by the given actor in the given spell (optional).
|
||||||
|
/// @return effect multiplier from 0 to 2. (100% net resistance to 100% net weakness)
|
||||||
|
/// @param effects Override the actor's current magicEffects. Useful if there are effects currently
|
||||||
|
/// being applied (but not applied yet) that should also be considered.
|
||||||
float getEffectMultiplier(short effectId, const MWWorld::Ptr& actor, const MWWorld::Ptr& caster,
|
float getEffectMultiplier(short effectId, const MWWorld::Ptr& actor, const MWWorld::Ptr& caster,
|
||||||
const ESM::Spell* spell = NULL, const MagicEffects* effects = NULL);
|
const ESM::Spell* spell = NULL, const MagicEffects* effects = NULL);
|
||||||
|
|
||||||
|
|
|
@ -120,11 +120,14 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b
|
||||||
// Set default texture filtering options
|
// Set default texture filtering options
|
||||||
TextureFilterOptions tfo;
|
TextureFilterOptions tfo;
|
||||||
std::string filter = Settings::Manager::getString("texture filtering", "General");
|
std::string filter = Settings::Manager::getString("texture filtering", "General");
|
||||||
|
#ifndef ANDROID
|
||||||
if (filter == "anisotropic") tfo = TFO_ANISOTROPIC;
|
if (filter == "anisotropic") tfo = TFO_ANISOTROPIC;
|
||||||
else if (filter == "trilinear") tfo = TFO_TRILINEAR;
|
else if (filter == "trilinear") tfo = TFO_TRILINEAR;
|
||||||
else if (filter == "bilinear") tfo = TFO_BILINEAR;
|
else if (filter == "bilinear") tfo = TFO_BILINEAR;
|
||||||
else /*if (filter == "none")*/ tfo = TFO_NONE;
|
else /*if (filter == "none")*/ tfo = TFO_NONE;
|
||||||
|
#else
|
||||||
|
tfo = TFO_NONE;
|
||||||
|
#endif
|
||||||
MaterialManager::getSingleton().setDefaultTextureFiltering(tfo);
|
MaterialManager::getSingleton().setDefaultTextureFiltering(tfo);
|
||||||
MaterialManager::getSingleton().setDefaultAnisotropy( (filter == "anisotropic") ? Settings::Manager::getInt("anisotropy", "General") : 1 );
|
MaterialManager::getSingleton().setDefaultAnisotropy( (filter == "anisotropic") ? Settings::Manager::getInt("anisotropy", "General") : 1 );
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual MWMechanics::CreatureStats& getCreatureStats (const Ptr& ptr) const;
|
virtual MWMechanics::CreatureStats& getCreatureStats (const Ptr& ptr) const;
|
||||||
///< Return creature stats or throw an exception, if class does not have creature stats
|
///< Return creature stats or throw an exception, if class does not have creature stats
|
||||||
/// (default implementation: throw an exceoption)
|
/// (default implementation: throw an exception)
|
||||||
|
|
||||||
virtual bool hasToolTip (const Ptr& ptr) const;
|
virtual bool hasToolTip (const Ptr& ptr) const;
|
||||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||||
|
@ -106,7 +106,7 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual MWMechanics::NpcStats& getNpcStats (const Ptr& ptr) const;
|
virtual MWMechanics::NpcStats& getNpcStats (const Ptr& ptr) const;
|
||||||
///< Return NPC stats or throw an exception, if class does not have NPC stats
|
///< Return NPC stats or throw an exception, if class does not have NPC stats
|
||||||
/// (default implementation: throw an exceoption)
|
/// (default implementation: throw an exception)
|
||||||
|
|
||||||
virtual bool hasItemHealth (const Ptr& ptr) const;
|
virtual bool hasItemHealth (const Ptr& ptr) const;
|
||||||
///< \return Item health data available? (default implementation: false)
|
///< \return Item health data available? (default implementation: false)
|
||||||
|
@ -123,7 +123,7 @@ namespace MWWorld
|
||||||
/// of the given attacker, and whoever is hit.
|
/// of the given attacker, and whoever is hit.
|
||||||
/// \param type - type of attack, one of the MWMechanics::CreatureStats::AttackType
|
/// \param type - type of attack, one of the MWMechanics::CreatureStats::AttackType
|
||||||
/// enums. ignored for creature attacks.
|
/// enums. ignored for creature attacks.
|
||||||
/// (default implementation: throw an exceoption)
|
/// (default implementation: throw an exception)
|
||||||
|
|
||||||
virtual void onHit(const MWWorld::Ptr &ptr, float damage, bool ishealth, const MWWorld::Ptr &object, const MWWorld::Ptr &attacker, bool successful) const;
|
virtual void onHit(const MWWorld::Ptr &ptr, float damage, bool ishealth, const MWWorld::Ptr &object, const MWWorld::Ptr &attacker, bool successful) const;
|
||||||
///< Alerts \a ptr that it's being hit for \a damage points to health if \a ishealth is
|
///< Alerts \a ptr that it's being hit for \a damage points to health if \a ishealth is
|
||||||
|
@ -139,7 +139,7 @@ namespace MWWorld
|
||||||
///< Sets a new current health value for the actor, optionally specifying the object causing
|
///< Sets a new current health value for the actor, optionally specifying the object causing
|
||||||
/// the change. Use this instead of using CreatureStats directly as this will make sure the
|
/// the change. Use this instead of using CreatureStats directly as this will make sure the
|
||||||
/// correct dialog and actor states are properly handled when being hurt or healed.
|
/// correct dialog and actor states are properly handled when being hurt or healed.
|
||||||
/// (default implementation: throw an exceoption)
|
/// (default implementation: throw an exception)
|
||||||
|
|
||||||
virtual boost::shared_ptr<Action> activate (const Ptr& ptr, const Ptr& actor) const;
|
virtual boost::shared_ptr<Action> activate (const Ptr& ptr, const Ptr& actor) const;
|
||||||
///< Generate action for activation (default implementation: return a null action).
|
///< Generate action for activation (default implementation: return a null action).
|
||||||
|
@ -151,11 +151,11 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual ContainerStore& getContainerStore (const Ptr& ptr) const;
|
virtual ContainerStore& getContainerStore (const Ptr& ptr) const;
|
||||||
///< Return container store or throw an exception, if class does not have a
|
///< Return container store or throw an exception, if class does not have a
|
||||||
/// container store (default implementation: throw an exceoption)
|
/// container store (default implementation: throw an exception)
|
||||||
|
|
||||||
virtual InventoryStore& getInventoryStore (const Ptr& ptr) const;
|
virtual InventoryStore& getInventoryStore (const Ptr& ptr) const;
|
||||||
///< Return inventory store or throw an exception, if class does not have a
|
///< Return inventory store or throw an exception, if class does not have a
|
||||||
/// inventory store (default implementation: throw an exceoption)
|
/// inventory store (default implementation: throw an exception)
|
||||||
|
|
||||||
virtual bool hasInventoryStore (const Ptr& ptr) const;
|
virtual bool hasInventoryStore (const Ptr& ptr) const;
|
||||||
///< Does this object have an inventory store, i.e. equipment slots? (default implementation: false)
|
///< Does this object have an inventory store, i.e. equipment slots? (default implementation: false)
|
||||||
|
|
|
@ -98,6 +98,8 @@ struct Land
|
||||||
void load(ESMReader &esm);
|
void load(ESMReader &esm);
|
||||||
void save(ESMWriter &esm) const;
|
void save(ESMWriter &esm) const;
|
||||||
|
|
||||||
|
void blank() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actually loads data
|
* Actually loads data
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,4 +19,10 @@ void LandTexture::save(ESMWriter &esm) const
|
||||||
esm.writeHNCString("DATA", mTexture);
|
esm.writeHNCString("DATA", mTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LandTexture::blank()
|
||||||
|
{
|
||||||
|
mTexture.clear();
|
||||||
|
mIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,9 @@ struct LandTexture
|
||||||
std::string mId, mTexture;
|
std::string mId, mTexture;
|
||||||
int mIndex;
|
int mIndex;
|
||||||
|
|
||||||
|
void blank();
|
||||||
|
///< Set record to default state (does not touch the ID).
|
||||||
|
|
||||||
void load(ESMReader &esm);
|
void load(ESMReader &esm);
|
||||||
void save(ESMWriter &esm) const;
|
void save(ESMWriter &esm) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,22 +53,22 @@ AndroidPath::AndroidPath(const std::string& application_name)
|
||||||
|
|
||||||
boost::filesystem::path AndroidPath::getUserConfigPath() const
|
boost::filesystem::path AndroidPath::getUserConfigPath() const
|
||||||
{
|
{
|
||||||
return getEnv("XDG_CONFIG_HOME", "/sdcard/morrowind/config") / mName;
|
return getEnv("XDG_CONFIG_HOME", "/sdcard/libopenmw/config") / mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path AndroidPath::getUserDataPath() const
|
boost::filesystem::path AndroidPath::getUserDataPath() const
|
||||||
{
|
{
|
||||||
return getEnv("XDG_DATA_HOME", "/sdcard/morrowind/share") / mName;
|
return getEnv("XDG_DATA_HOME", "/sdcard/libopenmw/share") / mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path AndroidPath::getCachePath() const
|
boost::filesystem::path AndroidPath::getCachePath() const
|
||||||
{
|
{
|
||||||
return getEnv("XDG_CACHE_HOME", "/sdcard/morrowind/cache") / mName;
|
return getEnv("XDG_CACHE_HOME", "/sdcard/libopenmw/cache") / mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::path AndroidPath::getGlobalConfigPath() const
|
boost::filesystem::path AndroidPath::getGlobalConfigPath() const
|
||||||
{
|
{
|
||||||
boost::filesystem::path globalPath("/sdcard/morrowind/");
|
boost::filesystem::path globalPath("/sdcard/libopenmw/");
|
||||||
return globalPath / mName;
|
return globalPath / mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ boost::filesystem::path AndroidPath::getLocalPath() const
|
||||||
|
|
||||||
boost::filesystem::path AndroidPath::getGlobalDataPath() const
|
boost::filesystem::path AndroidPath::getGlobalDataPath() const
|
||||||
{
|
{
|
||||||
boost::filesystem::path globalDataPath("/sdcard/morrowind/data");
|
boost::filesystem::path globalDataPath("/sdcard/libopenmw/data");
|
||||||
return globalDataPath / mName;
|
return globalDataPath / mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
// Scroll in y direction
|
// Scroll in y direction
|
||||||
float2 scrolledUV = UV + float2(0,1) * cloudAnimationTimer * 0.003;
|
float2 scrolledUV = UV + float2(0,1) * cloudAnimationTimer * 0.003;
|
||||||
|
|
||||||
float4 albedo = shSample(diffuseMap1, scrolledUV) * (1-cloudBlendFactor) + shSample(diffuseMap2, scrolledUV) * cloudBlendFactor;
|
float4 albedo = shSample(diffuseMap1, scrolledUV) * (1.0-cloudBlendFactor) + shSample(diffuseMap2, scrolledUV) * cloudBlendFactor;
|
||||||
|
|
||||||
shOutputColour(0) = float4(cloudColour, 1) * albedo * float4(1,1,1, cloudOpacity * alphaFade);
|
shOutputColour(0) = float4(cloudColour, 1) * albedo * float4(1,1,1, cloudOpacity * alphaFade);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,8 +45,8 @@ shUniform(float4x4, projection) @shAutoConstant(projection, projection_matrix)
|
||||||
|
|
||||||
shOutputColour(0).a = shSample(alphaMap, UV).a * materialDiffuse.a;
|
shOutputColour(0).a = shSample(alphaMap, UV).a * materialDiffuse.a;
|
||||||
|
|
||||||
shOutputColour(0).rgb += (1-tex.a) * shOutputColour(0).a * atmosphereColour.rgb; //fill dark side of moon with atmosphereColour
|
shOutputColour(0).rgb += (1.0-tex.a) * shOutputColour(0).a * atmosphereColour.rgb; //fill dark side of moon with atmosphereColour
|
||||||
shOutputColour(0).rgb += (1-materialDiffuse.a) * atmosphereColour.rgb; //fade bump
|
shOutputColour(0).rgb += (1.0-materialDiffuse.a) * atmosphereColour.rgb; //fade bump
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
depth.y = shOutputPosition.w;
|
depth.y = shOutputPosition.w;
|
||||||
|
|
||||||
// clamp z to zero. seem to do the trick. :-/
|
// clamp z to zero. seem to do the trick. :-/
|
||||||
shOutputPosition.z = max(shOutputPosition.z, 0);
|
shOutputPosition.z = max(shOutputPosition.z, 0.0);
|
||||||
|
|
||||||
#if ALPHA
|
#if ALPHA
|
||||||
UV = uv0;
|
UV = uv0;
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
discard;
|
discard;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
shOutputColour(0) = float4(finalDepth, finalDepth, finalDepth, 1);
|
shOutputColour(0) = float4(finalDepth, finalDepth, finalDepth, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,19 +14,19 @@
|
||||||
{
|
{
|
||||||
float4x4 worldviewFixed = worldview;
|
float4x4 worldviewFixed = worldview;
|
||||||
#if !SH_GLSL
|
#if !SH_GLSL
|
||||||
worldviewFixed[0][3] = 0;
|
worldviewFixed[0][3] = 0.0;
|
||||||
worldviewFixed[1][3] = 0;
|
worldviewFixed[1][3] = 0.0;
|
||||||
worldviewFixed[2][3] = 0;
|
worldviewFixed[2][3] = 0.0;
|
||||||
#else
|
#else
|
||||||
worldviewFixed[3][0] = 0;
|
worldviewFixed[3][0] = 0.0;
|
||||||
worldviewFixed[3][1] = 0;
|
worldviewFixed[3][1] = 0.0;
|
||||||
worldviewFixed[3][2] = 0;
|
worldviewFixed[3][2] = 0.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
shOutputPosition = shMatrixMult(proj, shMatrixMult(worldviewFixed, shInputPosition));
|
shOutputPosition = shMatrixMult(proj, shMatrixMult(worldviewFixed, shInputPosition));
|
||||||
UV = uv0;
|
UV = uv0;
|
||||||
|
|
||||||
fade = (shInputPosition.z > 50) ? 1 : 0;
|
fade = (shInputPosition.z > 50.0) ? 1.0 : 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -102,10 +102,10 @@
|
||||||
|
|
||||||
|
|
||||||
#if !SH_GLSL
|
#if !SH_GLSL
|
||||||
float4x4 scalemat = float4x4( 0.5, 0, 0, 0.5,
|
float4x4 scalemat = float4x4( 0.5, 0.0, 0.0, 0.5,
|
||||||
0, -0.5, 0, 0.5,
|
0.0, -0.5, 0.0, 0.5,
|
||||||
0, 0, 0.5, 0.5,
|
0.0, 0.0, 0.5, 0.5,
|
||||||
0, 0, 0, 1 );
|
0.0, 0.0, 0.0, 1.0 );
|
||||||
#else
|
#else
|
||||||
mat4 scalemat = mat4(0.5, 0.0, 0.0, 0.0,
|
mat4 scalemat = mat4(0.5, 0.0, 0.0, 0.0,
|
||||||
0.0, -0.5, 0.0, 0.0,
|
0.0, -0.5, 0.0, 0.0,
|
||||||
|
@ -148,7 +148,7 @@
|
||||||
#define SMALL_WAVES_Y 0.1
|
#define SMALL_WAVES_Y 0.1
|
||||||
|
|
||||||
#define WAVE_CHOPPYNESS 0.15 // wave choppyness
|
#define WAVE_CHOPPYNESS 0.15 // wave choppyness
|
||||||
#define WAVE_SCALE 75 // overall wave scale
|
#define WAVE_SCALE 75.0 // overall wave scale
|
||||||
|
|
||||||
#define BUMP 1.5 // overall water surface bumpiness
|
#define BUMP 1.5 // overall water surface bumpiness
|
||||||
#define REFL_BUMP 0.08 // reflection distortion amount
|
#define REFL_BUMP 0.08 // reflection distortion amount
|
||||||
|
@ -159,7 +159,7 @@
|
||||||
|
|
||||||
#define SUN_EXT float3(0.45, 0.55, 0.68) //sunlight extinction
|
#define SUN_EXT float3(0.45, 0.55, 0.68) //sunlight extinction
|
||||||
|
|
||||||
#define SPEC_HARDNESS 256 // specular highlights hardness
|
#define SPEC_HARDNESS 256.0 // specular highlights hardness
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
@ -260,7 +260,7 @@
|
||||||
|
|
||||||
#if SHADOWS || SHADOWS_PSSM
|
#if SHADOWS || SHADOWS_PSSM
|
||||||
float fadeRange = shadowFar_fadeStart.x - shadowFar_fadeStart.y;
|
float fadeRange = shadowFar_fadeStart.x - shadowFar_fadeStart.y;
|
||||||
float fade = 1-((depthPassthrough - shadowFar_fadeStart.y) / fadeRange);
|
float fade = 1.0-((depthPassthrough - shadowFar_fadeStart.y) / fadeRange);
|
||||||
shadow = (depthPassthrough > shadowFar_fadeStart.x) ? 1.0 : ((depthPassthrough > shadowFar_fadeStart.y) ? 1.0-((1.0-shadow)*fade) : shadow);
|
shadow = (depthPassthrough > shadowFar_fadeStart.x) ? 1.0 : ((depthPassthrough > shadowFar_fadeStart.y) ? 1.0-((1.0-shadow)*fade) : shadow);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -270,9 +270,9 @@
|
||||||
|
|
||||||
|
|
||||||
float2 screenCoords = screenCoordsPassthrough.xy / screenCoordsPassthrough.z;
|
float2 screenCoords = screenCoordsPassthrough.xy / screenCoordsPassthrough.z;
|
||||||
screenCoords.y = (1-shSaturate(renderTargetFlipping))+renderTargetFlipping*screenCoords.y;
|
screenCoords.y = (1.0-shSaturate(renderTargetFlipping))+renderTargetFlipping*screenCoords.y;
|
||||||
|
|
||||||
float2 nCoord = float2(0,0);
|
float2 nCoord = float2(0.0,0.0);
|
||||||
|
|
||||||
nCoord = UV * (WAVE_SCALE * 0.05) + WIND_DIR * waterTimer * (WIND_SPEED*0.04);
|
nCoord = UV * (WAVE_SCALE * 0.05) + WIND_DIR * waterTimer * (WIND_SPEED*0.04);
|
||||||
float3 normal0 = 2.0 * shSample(normalMap, nCoord + float2(-waterTimer*0.015,-waterTimer*0.005)).rgb - 1.0;
|
float3 normal0 = 2.0 * shSample(normalMap, nCoord + float2(-waterTimer*0.015,-waterTimer*0.005)).rgb - 1.0;
|
||||||
|
@ -297,7 +297,7 @@
|
||||||
|
|
||||||
float4 worldPosition = shMatrixMult(wMat, float4(position.xyz, 1));
|
float4 worldPosition = shMatrixMult(wMat, float4(position.xyz, 1));
|
||||||
float2 relPos = (worldPosition.xy - rippleCenter.xy) / rippleAreaLength + 0.5;
|
float2 relPos = (worldPosition.xy - rippleCenter.xy) / rippleAreaLength + 0.5;
|
||||||
float3 normal_ripple = normalize(shSample(rippleNormalMap, relPos.xy).xyz * 2 - 1);
|
float3 normal_ripple = normalize(shSample(rippleNormalMap, relPos.xy).xyz * 2.0 - 1.0);
|
||||||
|
|
||||||
//normal = normalize(normal + normal_ripple);
|
//normal = normalize(normal + normal_ripple);
|
||||||
normal = normalize(float3(normal.x * BUMP + normal_ripple.x, normal.y * BUMP + normal_ripple.y, normal.z));
|
normal = normalize(float3(normal.x * BUMP + normal_ripple.x, normal.y * BUMP + normal_ripple.y, normal.z));
|
||||||
|
@ -315,7 +315,7 @@
|
||||||
float3 vVec = normalize(position.xyz - cameraPos.xyz);
|
float3 vVec = normalize(position.xyz - cameraPos.xyz);
|
||||||
|
|
||||||
|
|
||||||
float isUnderwater = (cameraPos.z > 0) ? 0.0 : 1.0;
|
float isUnderwater = (cameraPos.z > 0.0) ? 0.0 : 1.0;
|
||||||
|
|
||||||
// sunlight scattering
|
// sunlight scattering
|
||||||
float3 pNormal = float3(0,0,1);
|
float3 pNormal = float3(0,0,1);
|
||||||
|
@ -327,7 +327,7 @@
|
||||||
float3 scatterColour = shLerp(float3(SCATTER_COLOUR)*float3(1.0,0.4,0.0), SCATTER_COLOUR, shSaturate(1.0-exp(-waterSunFade_sunHeight.y*SUN_EXT)));
|
float3 scatterColour = shLerp(float3(SCATTER_COLOUR)*float3(1.0,0.4,0.0), SCATTER_COLOUR, shSaturate(1.0-exp(-waterSunFade_sunHeight.y*SUN_EXT)));
|
||||||
|
|
||||||
// fresnel
|
// fresnel
|
||||||
float ior = (cameraPos.z>0)?(1.333/1.0):(1.0/1.333); //air to water; water to air
|
float ior = (cameraPos.z>0.0)?(1.333/1.0):(1.0/1.333); //air to water; water to air
|
||||||
float fresnel = fresnel_dielectric(-vVec, normal, ior);
|
float fresnel = fresnel_dielectric(-vVec, normal, ior);
|
||||||
|
|
||||||
fresnel = shSaturate(fresnel);
|
fresnel = shSaturate(fresnel);
|
||||||
|
@ -342,7 +342,7 @@
|
||||||
float3 refraction = shSample(refractionMap, (screenCoords-(normal.xy*REFR_BUMP))*1.0).rgb;
|
float3 refraction = shSample(refractionMap, (screenCoords-(normal.xy*REFR_BUMP))*1.0).rgb;
|
||||||
|
|
||||||
// brighten up the refraction underwater
|
// brighten up the refraction underwater
|
||||||
refraction = (cameraPos.z < 0) ? shSaturate(refraction * 1.5) : refraction;
|
refraction = (cameraPos.z < 0.0) ? shSaturate(refraction * 1.5) : refraction;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// specular
|
// specular
|
||||||
|
@ -358,9 +358,9 @@
|
||||||
shOutputColour(0).xyz = shLerp (shOutputColour(0).xyz, fogColor, fogValue);
|
shOutputColour(0).xyz = shLerp (shOutputColour(0).xyz, fogColor, fogValue);
|
||||||
|
|
||||||
#if REFRACTION
|
#if REFRACTION
|
||||||
shOutputColour(0).w = 1;
|
shOutputColour(0).w = 1.0;
|
||||||
#else
|
#else
|
||||||
shOutputColour(0).w = shSaturate(fresnel*2 + specular);
|
shOutputColour(0).w = shSaturate(fresnel*2.0 + specular);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue