mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 00:35:23 +00:00
Merge remote-tracking branch 'scrawl/master'
This commit is contained in:
commit
16b3927f17
@ -19,7 +19,7 @@ source_group(game FILES ${GAME} ${GAME_HEADER})
|
||||
add_openmw_dir (mwrender
|
||||
renderingmanager debugging sky camera animation npcanimation creatureanimation activatoranimation
|
||||
actors objects renderinginterface localmap occlusionquery water shadows
|
||||
compositors characterpreview externalrendering globalmap videoplayer ripplesimulation refraction
|
||||
characterpreview externalrendering globalmap videoplayer ripplesimulation refraction
|
||||
terrainstorage
|
||||
)
|
||||
|
||||
|
@ -80,7 +80,6 @@ namespace MWBase
|
||||
Render_CollisionDebug,
|
||||
Render_Wireframe,
|
||||
Render_Pathgrid,
|
||||
Render_Compositors,
|
||||
Render_BoundingBoxes
|
||||
};
|
||||
|
||||
|
@ -413,10 +413,6 @@ namespace MWDialogue
|
||||
|
||||
void DialogueManager::goodbyeSelected()
|
||||
{
|
||||
// Do not close the dialogue window if the player has to answer a question
|
||||
if (mIsInChoice)
|
||||
return;
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue);
|
||||
|
||||
// Apply disposition change to NPC's base disposition
|
||||
@ -474,6 +470,8 @@ namespace MWDialogue
|
||||
|
||||
void DialogueManager::goodbye()
|
||||
{
|
||||
mIsInChoice = true;
|
||||
|
||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||
|
||||
win->goodbye();
|
||||
|
@ -302,6 +302,8 @@ namespace MWGui
|
||||
|
||||
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
if (!mEnabled || MWBase::Environment::get().getDialogueManager()->isInChoice())
|
||||
return;
|
||||
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include "loadingscreen.hpp"
|
||||
|
||||
#include <OgreRenderWindow.h>
|
||||
#include <OgreCompositorManager.h>
|
||||
#include <OgreCompositorChain.h>
|
||||
|
||||
#include <openengine/ogre/fader.hpp>
|
||||
|
||||
@ -199,28 +197,7 @@ namespace MWGui
|
||||
|
||||
MWBase::Environment::get().getInputManager()->update(0, true);
|
||||
|
||||
Ogre::CompositorChain* chain = Ogre::CompositorManager::getSingleton().getCompositorChain(mWindow->getViewport(0));
|
||||
|
||||
bool hasCompositor = chain->getCompositor ("gbufferFinalizer");
|
||||
|
||||
|
||||
if (!hasCompositor)
|
||||
{
|
||||
mWindow->getViewport(0)->setClearEveryFrame(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!mFirstLoad)
|
||||
{
|
||||
mBackgroundMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(chain->getCompositor ("gbufferFinalizer")->getTextureInstance ("no_mrt_output", 0)->getName());
|
||||
mRectangle->setVisible(true);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i<chain->getNumCompositors(); ++i)
|
||||
{
|
||||
Ogre::CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0), chain->getCompositor(i)->getCompositor()->getName(), false);
|
||||
}
|
||||
}
|
||||
mWindow->getViewport(0)->setClearEveryFrame(false);
|
||||
|
||||
// First, swap buffers from last draw, then, queue an update of the
|
||||
// window contents, but don't swap buffers (which would have
|
||||
@ -231,15 +208,8 @@ namespace MWGui
|
||||
|
||||
mWindow->update(false);
|
||||
|
||||
if (!hasCompositor)
|
||||
mWindow->getViewport(0)->setClearEveryFrame(true);
|
||||
else
|
||||
{
|
||||
for (unsigned int i = 0; i<chain->getNumCompositors(); ++i)
|
||||
{
|
||||
Ogre::CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0), chain->getCompositor(i)->getCompositor()->getName(), true);
|
||||
}
|
||||
}
|
||||
mWindow->getViewport(0)->setClearEveryFrame(true);
|
||||
|
||||
|
||||
mRectangle->setVisible(false);
|
||||
|
||||
|
@ -1,108 +0,0 @@
|
||||
#include "compositors.hpp"
|
||||
|
||||
#include <OgreViewport.h>
|
||||
#include <OgreCompositorManager.h>
|
||||
#include <OgreCompositorChain.h>
|
||||
#include <OgreCompositionTargetPass.h>
|
||||
|
||||
using namespace MWRender;
|
||||
|
||||
Compositors::Compositors(Ogre::Viewport* vp) :
|
||||
mViewport(vp)
|
||||
, mEnabled(true)
|
||||
{
|
||||
}
|
||||
|
||||
Compositors::~Compositors()
|
||||
{
|
||||
Ogre::CompositorManager::getSingleton().removeCompositorChain(mViewport);
|
||||
}
|
||||
|
||||
void Compositors::setEnabled (const bool enabled)
|
||||
{
|
||||
for (CompositorMap::iterator it=mCompositors.begin();
|
||||
it != mCompositors.end(); ++it)
|
||||
{
|
||||
Ogre::CompositorManager::getSingleton().setCompositorEnabled(mViewport, it->first, enabled && it->second.first);
|
||||
}
|
||||
mEnabled = enabled;
|
||||
}
|
||||
|
||||
void Compositors::recreate()
|
||||
{
|
||||
Ogre::CompositorManager::getSingleton().removeCompositorChain(mViewport);
|
||||
|
||||
CompositorMap temp = mCompositors;
|
||||
mCompositors.clear();
|
||||
|
||||
for (CompositorMap::iterator it=temp.begin();
|
||||
it != temp.end(); ++it)
|
||||
{
|
||||
addCompositor(it->first, it->second.second);
|
||||
setCompositorEnabled(it->first, mEnabled && it->second.first);
|
||||
}
|
||||
}
|
||||
|
||||
void Compositors::addCompositor (const std::string& name, const int priority)
|
||||
{
|
||||
int id = 0;
|
||||
|
||||
for (CompositorMap::iterator it=mCompositors.begin();
|
||||
it != mCompositors.end(); ++it)
|
||||
{
|
||||
if (it->second.second > priority)
|
||||
break;
|
||||
++id;
|
||||
}
|
||||
Ogre::CompositorManager::getSingleton().addCompositor (mViewport, name, id);
|
||||
|
||||
mCompositors[name] = std::make_pair(false, priority);
|
||||
}
|
||||
|
||||
void Compositors::setCompositorEnabled (const std::string& name, const bool enabled)
|
||||
{
|
||||
mCompositors[name].first = enabled;
|
||||
Ogre::CompositorManager::getSingleton().setCompositorEnabled (mViewport, name, enabled && mEnabled);
|
||||
}
|
||||
|
||||
void Compositors::removeAll()
|
||||
{
|
||||
Ogre::CompositorManager::getSingleton().removeCompositorChain(mViewport);
|
||||
|
||||
mCompositors.clear();
|
||||
}
|
||||
|
||||
bool Compositors::anyCompositorEnabled()
|
||||
{
|
||||
for (CompositorMap::iterator it=mCompositors.begin();
|
||||
it != mCompositors.end(); ++it)
|
||||
{
|
||||
if (it->second.first && mEnabled)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Compositors::countTrianglesBatches(unsigned int &triangles, unsigned int &batches)
|
||||
{
|
||||
triangles = 0;
|
||||
batches = 0;
|
||||
|
||||
Ogre::CompositorInstance* c = NULL;
|
||||
Ogre::CompositorChain* chain = Ogre::CompositorManager::getSingleton().getCompositorChain (mViewport);
|
||||
// accumulate tris & batches from all compositors with all their render targets
|
||||
for (unsigned int i=0; i < chain->getNumCompositors(); ++i)
|
||||
{
|
||||
if (chain->getCompositor(i)->getEnabled())
|
||||
{
|
||||
c = chain->getCompositor(i);
|
||||
for (unsigned int j = 0; j < c->getTechnique()->getNumTargetPasses(); ++j)
|
||||
{
|
||||
std::string textureName = c->getTechnique()->getTargetPass(j)->getOutputName();
|
||||
Ogre::RenderTarget* rt = c->getRenderTarget(textureName);
|
||||
triangles += rt->getTriangleCount();
|
||||
batches += rt->getBatchCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
#ifndef GAME_MWRENDER_COMPOSITORS_H
|
||||
#define GAME_MWRENDER_COMPOSITORS_H
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
class Viewport;
|
||||
}
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
typedef std::map < std::string, std::pair<bool, int> > CompositorMap;
|
||||
|
||||
/// \brief Manages a set of compositors for one viewport
|
||||
class Compositors
|
||||
{
|
||||
public:
|
||||
Compositors(Ogre::Viewport* vp);
|
||||
virtual ~Compositors();
|
||||
|
||||
/**
|
||||
* enable or disable all compositors globally
|
||||
*/
|
||||
void setEnabled (const bool enabled);
|
||||
|
||||
void setViewport(Ogre::Viewport* vp) { mViewport = vp; }
|
||||
|
||||
/// recreate compositors (call this after viewport size changes)
|
||||
void recreate();
|
||||
|
||||
bool toggle() { setEnabled(!mEnabled); return mEnabled; }
|
||||
|
||||
/**
|
||||
* enable or disable a specific compositor
|
||||
* @note enable has no effect if all compositors are globally disabled
|
||||
*/
|
||||
void setCompositorEnabled (const std::string& name, const bool enabled);
|
||||
|
||||
/**
|
||||
* @param name of compositor
|
||||
* @param priority, lower number will be first in the chain
|
||||
*/
|
||||
void addCompositor (const std::string& name, const int priority);
|
||||
|
||||
bool anyCompositorEnabled();
|
||||
|
||||
void countTrianglesBatches(unsigned int &triangles, unsigned int &batches);
|
||||
|
||||
void removeAll ();
|
||||
|
||||
protected:
|
||||
/// maps compositor name to its "enabled" state
|
||||
CompositorMap mCompositors;
|
||||
|
||||
bool mEnabled;
|
||||
|
||||
Ogre::Viewport* mViewport;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -8,10 +8,6 @@
|
||||
#include <OgreViewport.h>
|
||||
#include <OgreCamera.h>
|
||||
#include <OgreTextureManager.h>
|
||||
#include <OgreCompositorManager.h>
|
||||
#include <OgreCompositorChain.h>
|
||||
#include <OgreCompositionTargetPass.h>
|
||||
#include <OgreCompositionPass.h>
|
||||
#include <OgreHardwarePixelBuffer.h>
|
||||
#include <OgreControllerManager.h>
|
||||
#include <OgreMeshManager.h>
|
||||
@ -43,7 +39,6 @@
|
||||
#include "shadows.hpp"
|
||||
#include "localmap.hpp"
|
||||
#include "water.hpp"
|
||||
#include "compositors.hpp"
|
||||
#include "npcanimation.hpp"
|
||||
#include "externalrendering.hpp"
|
||||
#include "globalmap.hpp"
|
||||
@ -87,8 +82,6 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b
|
||||
mRendering.getWindow()->addListener(this);
|
||||
mRendering.setWindowListener(this);
|
||||
|
||||
mCompositors = new Compositors(mRendering.getViewport());
|
||||
|
||||
mWater = 0;
|
||||
|
||||
// material system
|
||||
@ -157,8 +150,6 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b
|
||||
sh::Factory::getInstance ().setGlobalSetting ("viewproj_fix", "false");
|
||||
sh::Factory::getInstance ().setSharedParameter ("vpRow2Fix", sh::makeProperty<sh::Vector4> (new sh::Vector4(0,0,0,0)));
|
||||
|
||||
applyCompositors();
|
||||
|
||||
mRootNode = mRendering.getScene()->getRootSceneNode();
|
||||
mRootNode->createChildSceneNode("player");
|
||||
|
||||
@ -198,7 +189,6 @@ RenderingManager::~RenderingManager ()
|
||||
delete mTerrain;
|
||||
delete mLocalMap;
|
||||
delete mOcclusionQuery;
|
||||
delete mCompositors;
|
||||
delete mWater;
|
||||
delete mVideoPlayer;
|
||||
delete mActors;
|
||||
@ -478,29 +468,21 @@ bool RenderingManager::toggleRenderMode(int mode)
|
||||
{
|
||||
if (mRendering.getCamera()->getPolygonMode() == PM_SOLID)
|
||||
{
|
||||
mCompositors->setEnabled(false);
|
||||
|
||||
mRendering.getCamera()->setPolygonMode(PM_WIREFRAME);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mCompositors->setEnabled(true);
|
||||
|
||||
mRendering.getCamera()->setPolygonMode(PM_SOLID);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (mode == MWBase::World::Render_BoundingBoxes)
|
||||
else //if (mode == MWBase::World::Render_BoundingBoxes)
|
||||
{
|
||||
bool show = !mRendering.getScene()->getShowBoundingBoxes();
|
||||
mRendering.getScene()->showBoundingBoxes(show);
|
||||
return show;
|
||||
}
|
||||
else //if (mode == MWBase::World::Render_Compositors)
|
||||
{
|
||||
return mCompositors->toggle();
|
||||
}
|
||||
}
|
||||
|
||||
void RenderingManager::configureFog(MWWorld::Ptr::CellStore &mCell)
|
||||
@ -745,11 +727,6 @@ Ogre::Vector4 RenderingManager::boundingBoxToScreen(Ogre::AxisAlignedBox bounds)
|
||||
return Vector4(min_x, min_y, max_x, max_y);
|
||||
}
|
||||
|
||||
Compositors* RenderingManager::getCompositors()
|
||||
{
|
||||
return mCompositors;
|
||||
}
|
||||
|
||||
void RenderingManager::processChangedSettings(const Settings::CategorySettingVector& settings)
|
||||
{
|
||||
bool changeRes = false;
|
||||
@ -795,7 +772,6 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec
|
||||
}
|
||||
else if (it->second == "shader" && it->first == "Water")
|
||||
{
|
||||
applyCompositors();
|
||||
sh::Factory::getInstance ().setGlobalSetting ("simple_water", Settings::Manager::getBool("shader", "Water") ? "false" : "true");
|
||||
rebuild = true;
|
||||
mRendering.getViewport ()->setClearEveryFrame (true);
|
||||
@ -883,28 +859,16 @@ void RenderingManager::windowResized(int x, int y)
|
||||
Settings::Manager::setInt("resolution x", "Video", x);
|
||||
Settings::Manager::setInt("resolution y", "Video", y);
|
||||
mRendering.adjustViewport();
|
||||
mCompositors->recreate();
|
||||
|
||||
mVideoPlayer->setResolution (x, y);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->windowResized(x,y);
|
||||
}
|
||||
|
||||
void RenderingManager::applyCompositors()
|
||||
{
|
||||
}
|
||||
|
||||
void RenderingManager::getTriangleBatchCount(unsigned int &triangles, unsigned int &batches)
|
||||
{
|
||||
if (mCompositors->anyCompositorEnabled())
|
||||
{
|
||||
mCompositors->countTrianglesBatches(triangles, batches);
|
||||
}
|
||||
else
|
||||
{
|
||||
triangles = mRendering.getWindow()->getTriangleCount();
|
||||
batches = mRendering.getWindow()->getBatchCount();
|
||||
}
|
||||
batches = mRendering.getWindow()->getBatchCount();
|
||||
triangles = mRendering.getWindow()->getTriangleCount();
|
||||
}
|
||||
|
||||
void RenderingManager::setupPlayer(const MWWorld::Ptr &ptr)
|
||||
|
@ -48,7 +48,6 @@ namespace MWRender
|
||||
class Shadows;
|
||||
class LocalMap;
|
||||
class Water;
|
||||
class Compositors;
|
||||
class ExternalRendering;
|
||||
class GlobalMap;
|
||||
class VideoPlayer;
|
||||
@ -96,7 +95,6 @@ public:
|
||||
void renderPlayer(const MWWorld::Ptr &ptr);
|
||||
|
||||
SkyManager* getSkyManager();
|
||||
Compositors* getCompositors();
|
||||
|
||||
void toggleLight();
|
||||
bool toggleRenderMode(int mode);
|
||||
@ -224,8 +222,6 @@ private:
|
||||
|
||||
void setMenuTransparency(float val);
|
||||
|
||||
void applyCompositors();
|
||||
|
||||
bool mSunEnabled;
|
||||
|
||||
MWWorld::Fallback* mFallback;
|
||||
@ -269,8 +265,6 @@ private:
|
||||
|
||||
MWRender::Shadows* mShadows;
|
||||
|
||||
MWRender::Compositors* mCompositors;
|
||||
|
||||
VideoPlayer* mVideoPlayer;
|
||||
};
|
||||
|
||||
|
@ -133,8 +133,6 @@ namespace MWRender {
|
||||
RenderingManager* mRendering;
|
||||
SkyManager* mSky;
|
||||
|
||||
std::string mCompositorName;
|
||||
|
||||
Ogre::MaterialPtr mMaterial;
|
||||
|
||||
bool mUnderwaterEffect;
|
||||
|
@ -203,6 +203,7 @@ namespace MWWorld
|
||||
|
||||
void Scene::changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos)
|
||||
{
|
||||
mRendering.enableTerrain(true);
|
||||
Nif::NIFFile::CacheLock cachelock;
|
||||
|
||||
Loading::Listener* loadingListener = MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
||||
@ -436,8 +437,6 @@ namespace MWWorld
|
||||
|
||||
MWBase::Environment::get().getWorld()->positionToIndex (position.pos[0], position.pos[1], x, y);
|
||||
|
||||
mRendering.enableTerrain(true);
|
||||
|
||||
changeCell (x, y, position, true);
|
||||
}
|
||||
|
||||
|
@ -71,8 +71,6 @@ namespace MWWorld
|
||||
void loadCell (CellStore *cell, Loading::Listener* loadingListener);
|
||||
|
||||
void changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos);
|
||||
///< Move from exterior to interior or from interior cell to a different
|
||||
/// interior cell.
|
||||
|
||||
CellStore* getCurrentCell ();
|
||||
|
||||
|
@ -1095,7 +1095,7 @@ namespace MWWorld
|
||||
|
||||
MWWorld::Ptr World::safePlaceObject(const MWWorld::Ptr& ptr,MWWorld::CellStore &Cell,ESM::Position pos)
|
||||
{
|
||||
return copyObjectToCell(ptr,Cell,pos);
|
||||
return copyObjectToCell(ptr,Cell,pos,false);
|
||||
}
|
||||
|
||||
void World::indexToPosition (int cellX, int cellY, float &x, float &y, bool centre) const
|
||||
@ -1516,7 +1516,7 @@ namespace MWWorld
|
||||
// copy the object and set its count
|
||||
int origCount = object.getRefData().getCount();
|
||||
object.getRefData().setCount(amount);
|
||||
Ptr dropped = copyObjectToCell(object, *cell, pos);
|
||||
Ptr dropped = copyObjectToCell(object, *cell, pos, true);
|
||||
object.getRefData().setCount(origCount);
|
||||
|
||||
// only the player place items in the world, so no need to check actor
|
||||
@ -1537,13 +1537,13 @@ namespace MWWorld
|
||||
}
|
||||
|
||||
|
||||
Ptr World::copyObjectToCell(const Ptr &object, CellStore &cell, const ESM::Position &pos)
|
||||
Ptr World::copyObjectToCell(const Ptr &object, CellStore &cell, const ESM::Position &pos, bool adjustPos)
|
||||
{
|
||||
/// \todo add searching correct cell for position specified
|
||||
MWWorld::Ptr dropped =
|
||||
MWWorld::Class::get(object).copyToCell(object, cell, pos);
|
||||
|
||||
if (object.getClass().isActor())
|
||||
if (object.getClass().isActor() || adjustPos)
|
||||
{
|
||||
Ogre::Vector3 min, max;
|
||||
if (mPhysics->getObjectAABB(object, min, max)) {
|
||||
|
@ -114,8 +114,7 @@ namespace MWWorld
|
||||
bool moveObjectImp (const Ptr& ptr, float x, float y, float z);
|
||||
///< @return true if the active cell (cell player is in) changed
|
||||
|
||||
|
||||
Ptr copyObjectToCell(const Ptr &ptr, CellStore &cell, const ESM::Position &pos);
|
||||
Ptr copyObjectToCell(const Ptr &ptr, CellStore &cell, const ESM::Position &pos, bool adjustPos=true);
|
||||
|
||||
void updateWindowManager ();
|
||||
void performUpdateSceneQueries ();
|
||||
|
@ -220,9 +220,8 @@ namespace Terrain
|
||||
++neededTextureUnits; // layer texture
|
||||
|
||||
// Check if this layer has a normal map
|
||||
if (mNormalMapping && !mLayerList[layerOffset].mNormalMap.empty())
|
||||
if (mNormalMapping && !mLayerList[layerIndex].mNormalMap.empty() && !renderCompositeMap)
|
||||
++neededTextureUnits; // normal map
|
||||
|
||||
if (neededTextureUnits <= remainingTextureUnits)
|
||||
{
|
||||
// We can fit another!
|
||||
@ -335,6 +334,8 @@ namespace Terrain
|
||||
// Make sure the pass index is fed to the permutation handler, because blendmap components may be different
|
||||
p->mShaderProperties.setProperty ("pass_index", sh::makeProperty(new sh::IntValue(layerOffset)));
|
||||
|
||||
assert ((int)p->mTexUnits.size() == OGRE_MAX_TEXTURE_LAYERS - remainingTextureUnits);
|
||||
|
||||
layerOffset += numLayersInThisPass;
|
||||
}
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ float2 blendUV = (UV - 0.5) * (16.0 / (16.0+1.0)) + 0.5;
|
||||
|
||||
float4 albedo = float4(0,0,0,1);
|
||||
|
||||
float2 layerUV = UV * 16;
|
||||
float2 layerUV = float2(UV.x, 1.f-UV.y) * 16; // Reverse Y, required to get proper tangents
|
||||
float2 thisLayerUV;
|
||||
float4 normalTex;
|
||||
|
||||
@ -355,8 +355,6 @@ float2 blendUV = (UV - 0.5) * (16.0 / (16.0+1.0)) + 0.5;
|
||||
#endif
|
||||
|
||||
thisLayerUV = layerUV;
|
||||
// required to play nicely with the tangents
|
||||
thisLayerUV.y *= -1;
|
||||
#if @shPropertyBool(use_parallax_@shIterator)
|
||||
thisLayerUV += TSeyeDir.xy * ( normalTex.a * PARALLAX_SCALE + PARALLAX_BIAS );
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user