Merge branch 'only_when_necassary' into 'master'

Conditional soft particles

See merge request OpenMW/openmw!2078
LTO-timing^2
psi29a 3 years ago
commit 85a8359b36

@ -548,6 +548,7 @@ namespace MWRender
mPostProcessor = new PostProcessor(*this, viewer, mRootNode, resourceSystem->getVFS());
resourceSystem->getSceneManager()->setOpaqueDepthTex(mPostProcessor->getTexture(PostProcessor::Tex_OpaqueDepth, 0), mPostProcessor->getTexture(PostProcessor::Tex_OpaqueDepth, 1));
resourceSystem->getSceneManager()->setSoftParticles(mPostProcessor->softParticlesEnabled());
resourceSystem->getSceneManager()->setSupportsNormalsRT(mPostProcessor->getSupportsNormalsRT());
// water goes after terrain for correct waterculling order

@ -198,6 +198,9 @@ namespace Resource
void setSupportsNormalsRT(bool supports) { mSupportsNormalsRT = supports; }
bool getSupportsNormalsRT() const { return mSupportsNormalsRT; }
void setSoftParticles(bool enabled) { mSoftParticles = enabled; }
bool getSoftParticles() const { return mSoftParticles; }
private:
Shader::ShaderVisitor* createShaderVisitor(const std::string& shaderPrefix = "objects");
@ -216,6 +219,7 @@ namespace Resource
bool mConvertAlphaTestToAlphaToCoverage;
bool mSupportsNormalsRT;
std::array<osg::ref_ptr<osg::Texture>, 2> mOpaqueDepthTex;
bool mSoftParticles = false;
osg::ref_ptr<Resource::SharedStateManager> mSharedStateManager;
mutable std::mutex mSharedStateMutex;

@ -20,6 +20,9 @@ namespace SceneUtil
{
void ProcessExtraDataVisitor::setupSoftEffect(osg::Node& node, float size, bool falloff)
{
if (!mSceneMgr->getSoftParticles())
return;
const int unitSoftEffect = mSceneMgr->getShaderManager().reserveGlobalTextureUnits(Shader::ShaderManager::Slot::OpaqueDepthTexture);
static const osg::ref_ptr<SceneUtil::AutoDepth> depth = new SceneUtil::AutoDepth(osg::Depth::LESS, 0, 1, false);

Loading…
Cancel
Save