mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:23:54 +00:00
Merge branch 'only_when_necassary' into 'master'
Conditional soft particles See merge request OpenMW/openmw!2078
This commit is contained in:
commit
85a8359b36
3 changed files with 8 additions and 0 deletions
|
@ -548,6 +548,7 @@ namespace MWRender
|
||||||
|
|
||||||
mPostProcessor = new PostProcessor(*this, viewer, mRootNode, resourceSystem->getVFS());
|
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()->setOpaqueDepthTex(mPostProcessor->getTexture(PostProcessor::Tex_OpaqueDepth, 0), mPostProcessor->getTexture(PostProcessor::Tex_OpaqueDepth, 1));
|
||||||
|
resourceSystem->getSceneManager()->setSoftParticles(mPostProcessor->softParticlesEnabled());
|
||||||
resourceSystem->getSceneManager()->setSupportsNormalsRT(mPostProcessor->getSupportsNormalsRT());
|
resourceSystem->getSceneManager()->setSupportsNormalsRT(mPostProcessor->getSupportsNormalsRT());
|
||||||
|
|
||||||
// water goes after terrain for correct waterculling order
|
// water goes after terrain for correct waterculling order
|
||||||
|
|
|
@ -198,6 +198,9 @@ namespace Resource
|
||||||
void setSupportsNormalsRT(bool supports) { mSupportsNormalsRT = supports; }
|
void setSupportsNormalsRT(bool supports) { mSupportsNormalsRT = supports; }
|
||||||
bool getSupportsNormalsRT() const { return mSupportsNormalsRT; }
|
bool getSupportsNormalsRT() const { return mSupportsNormalsRT; }
|
||||||
|
|
||||||
|
void setSoftParticles(bool enabled) { mSoftParticles = enabled; }
|
||||||
|
bool getSoftParticles() const { return mSoftParticles; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Shader::ShaderVisitor* createShaderVisitor(const std::string& shaderPrefix = "objects");
|
Shader::ShaderVisitor* createShaderVisitor(const std::string& shaderPrefix = "objects");
|
||||||
|
@ -216,6 +219,7 @@ namespace Resource
|
||||||
bool mConvertAlphaTestToAlphaToCoverage;
|
bool mConvertAlphaTestToAlphaToCoverage;
|
||||||
bool mSupportsNormalsRT;
|
bool mSupportsNormalsRT;
|
||||||
std::array<osg::ref_ptr<osg::Texture>, 2> mOpaqueDepthTex;
|
std::array<osg::ref_ptr<osg::Texture>, 2> mOpaqueDepthTex;
|
||||||
|
bool mSoftParticles = false;
|
||||||
|
|
||||||
osg::ref_ptr<Resource::SharedStateManager> mSharedStateManager;
|
osg::ref_ptr<Resource::SharedStateManager> mSharedStateManager;
|
||||||
mutable std::mutex mSharedStateMutex;
|
mutable std::mutex mSharedStateMutex;
|
||||||
|
|
|
@ -20,6 +20,9 @@ namespace SceneUtil
|
||||||
{
|
{
|
||||||
void ProcessExtraDataVisitor::setupSoftEffect(osg::Node& node, float size, bool falloff)
|
void ProcessExtraDataVisitor::setupSoftEffect(osg::Node& node, float size, bool falloff)
|
||||||
{
|
{
|
||||||
|
if (!mSceneMgr->getSoftParticles())
|
||||||
|
return;
|
||||||
|
|
||||||
const int unitSoftEffect = mSceneMgr->getShaderManager().reserveGlobalTextureUnits(Shader::ShaderManager::Slot::OpaqueDepthTexture);
|
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);
|
static const osg::ref_ptr<SceneUtil::AutoDepth> depth = new SceneUtil::AutoDepth(osg::Depth::LESS, 0, 1, false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue