mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
removed MRT setting and figure it out automatically
This commit is contained in:
parent
b8a470efcd
commit
622fb568cf
6 changed files with 23 additions and 18 deletions
|
@ -39,12 +39,12 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
|||
// Load resources
|
||||
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
|
||||
|
||||
// disable MRT if it is unsupported
|
||||
// disable unsupported effects
|
||||
const RenderSystemCapabilities* caps = Root::getSingleton().getRenderSystem()->getCapabilities();
|
||||
if (caps->getNumMultiRenderTargets() < 2)
|
||||
Settings::Manager::setBool("multiple render targets", "Render", false);
|
||||
Settings::Manager::setBool("shader", "Water", false);
|
||||
|
||||
if (Settings::Manager::getBool("multiple render targets", "Render"))
|
||||
if (useMRT())
|
||||
{
|
||||
CompositorManager::getSingleton().addCompositor(mRendering.getViewport(), "gbuffer");
|
||||
CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbuffer", true);
|
||||
|
@ -266,8 +266,11 @@ bool RenderingManager::toggleRenderMode(int mode)
|
|||
if (mRendering.getCamera()->getPolygonMode() == PM_SOLID)
|
||||
{
|
||||
// disable compositors
|
||||
CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbuffer", false);
|
||||
CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbufferFinalizer", false);
|
||||
if (useMRT())
|
||||
{
|
||||
CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbuffer", false);
|
||||
CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbufferFinalizer", false);
|
||||
}
|
||||
|
||||
mRendering.getCamera()->setPolygonMode(PM_WIREFRAME);
|
||||
return true;
|
||||
|
@ -275,7 +278,7 @@ bool RenderingManager::toggleRenderMode(int mode)
|
|||
else
|
||||
{
|
||||
// re-enable compositors
|
||||
if (Settings::Manager::getBool("multiple render targets", "Render"))
|
||||
if (useMRT())
|
||||
{
|
||||
CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbuffer", true);
|
||||
CompositorManager::getSingleton().setCompositorEnabled(mRendering.getViewport(), "gbufferFinalizer", true);
|
||||
|
@ -449,4 +452,9 @@ void RenderingManager::enableLights()
|
|||
mObjects.enableLights();
|
||||
}
|
||||
|
||||
const bool RenderingManager::useMRT()
|
||||
{
|
||||
return Settings::Manager::getBool("shader", "Water");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -81,6 +81,8 @@ class RenderingManager: private RenderingInterface {
|
|||
|
||||
void removeWater();
|
||||
|
||||
static const bool useMRT();
|
||||
|
||||
void preCellChange (MWWorld::Ptr::CellStore* store);
|
||||
///< this event is fired immediately before changing cell
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ THE SOFTWARE.
|
|||
#include "OgreShadowCameraSetupPSSM.h"
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
#include "renderingmanager.hpp"
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
|
@ -558,7 +559,7 @@ namespace Ogre
|
|||
//params->setNamedAutoConstant("lightSpecularColour"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_SPECULAR_COLOUR, i);
|
||||
}
|
||||
|
||||
if (Settings::Manager::getBool("multiple render targets", "Render"))
|
||||
if (MWRender::RenderingManager::useMRT())
|
||||
params->setNamedAutoConstant("far", GpuProgramParameters::ACT_FAR_CLIP_DISTANCE);
|
||||
|
||||
params->setNamedAutoConstant("eyePosObjSpace", GpuProgramParameters::ACT_CAMERA_POSITION_OBJECT_SPACE);
|
||||
|
@ -1032,7 +1033,7 @@ namespace Ogre
|
|||
__FUNCTION__);
|
||||
}
|
||||
|
||||
if (Settings::Manager::getBool("multiple render targets", "Render")) outStream <<
|
||||
if (MWRender::RenderingManager::useMRT()) outStream <<
|
||||
" , out float4 oColor : COLOR \n"
|
||||
" , out float4 oColor1 : COLOR1 \n"
|
||||
" , uniform float far \n";
|
||||
|
@ -1348,7 +1349,7 @@ namespace Ogre
|
|||
// Final return
|
||||
outStream << " oColor = outputCol;\n";
|
||||
|
||||
if (Settings::Manager::getBool("multiple render targets", "Render")) outStream <<
|
||||
if (MWRender::RenderingManager::useMRT()) outStream <<
|
||||
" oColor1 = float4(uvMisc.z / far, 0, 0, 1); \n";
|
||||
|
||||
outStream
|
||||
|
|
|
@ -52,7 +52,7 @@ Water::Water (Ogre::Camera *camera, SkyManager* sky, const ESM::Cell* cell) :
|
|||
// Create rendertarget for reflection
|
||||
int rttsize = Settings::Manager::getInt("rtt size", "Water");
|
||||
|
||||
if (Settings::Manager::getBool("shader", "Water") && Settings::Manager::getBool("multiple render targets", "Render"))
|
||||
if (Settings::Manager::getBool("shader", "Water"))
|
||||
{
|
||||
TexturePtr tex = TextureManager::getSingleton().createManual("WaterReflection",
|
||||
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_2D, rttsize, rttsize, 0, PF_R8G8B8, TU_RENDERTARGET);
|
||||
|
@ -185,7 +185,7 @@ Ogre::MaterialPtr Water::createMaterial()
|
|||
if (mReflectionTarget == 0)
|
||||
mat->removeTechnique(0);
|
||||
|
||||
if (Settings::Manager::getBool("multiple render targets", "Render"))
|
||||
if (Settings::Manager::getBool("shader", "Water"))
|
||||
{
|
||||
CompositorInstance* compositor = CompositorManager::getSingleton().getCompositorChain(mViewport)->getCompositor("gbuffer");
|
||||
|
||||
|
|
|
@ -302,7 +302,7 @@ void NIFLoader::createMaterial(const String &name,
|
|||
|
||||
if (Settings::Manager::getBool("shaders", "Objects"))
|
||||
{
|
||||
bool mrt = Settings::Manager::getBool("multiple render targets", "Render");
|
||||
bool mrt = Settings::Manager::getBool("shader", "Water");
|
||||
|
||||
// Create shader for the material
|
||||
// vertex
|
||||
|
|
|
@ -57,9 +57,3 @@ reflect small statics = false
|
|||
reflect actors = true
|
||||
|
||||
reflect misc = false
|
||||
|
||||
[Render]
|
||||
|
||||
# Only supported on SM3+ cards
|
||||
# If you have a lower end card, this will be disabled automatically
|
||||
multiple render targets = true
|
||||
|
|
Loading…
Reference in a new issue