1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

use openmw define system

This commit is contained in:
glassmancody.info 2021-10-23 13:46:39 -07:00
parent 8c3b00164e
commit 40b6bbbdf3
2 changed files with 5 additions and 4 deletions

View File

@ -559,7 +559,7 @@ namespace Shader
if (auto partsys = dynamic_cast<osgParticle::ParticleSystem*>(&node)) if (auto partsys = dynamic_cast<osgParticle::ParticleSystem*>(&node))
{ {
writableStateSet->setDefine("SOFT_PARTICLES", "1", osg::StateAttribute::ON); defineMap["softParticles"] = "1";
auto depth = SceneUtil::createDepth(); auto depth = SceneUtil::createDepth();
depth->setWriteMask(false); depth->setWriteMask(false);
@ -568,6 +568,8 @@ namespace Shader
writableStateSet->addUniform(new osg::Uniform("opaqueDepthTex", 2)); writableStateSet->addUniform(new osg::Uniform("opaqueDepthTex", 2));
writableStateSet->setTextureAttributeAndModes(2, mOpaqueDepthTex, osg::StateAttribute::ON); writableStateSet->setTextureAttributeAndModes(2, mOpaqueDepthTex, osg::StateAttribute::ON);
} }
else
defineMap["softParticles"] = "0";
std::string shaderPrefix; std::string shaderPrefix;
if (!node.getUserValue("shaderPrefix", shaderPrefix)) if (!node.getUserValue("shaderPrefix", shaderPrefix))

View File

@ -1,6 +1,5 @@
#version 120 #version 120
#pragma import_defines(FORCE_OPAQUE) #pragma import_defines(FORCE_OPAQUE)
#pragma import_defines(SOFT_PARTICLES)
#if @useUBO #if @useUBO
#extension GL_ARB_uniform_buffer_object : require #extension GL_ARB_uniform_buffer_object : require
@ -81,7 +80,7 @@ varying vec3 passNormal;
#include "parallax.glsl" #include "parallax.glsl"
#include "alpha.glsl" #include "alpha.glsl"
#if defined(SOFT_PARTICLES) && SOFT_PARTICLES #if @softParticles
#include "softparticles.glsl" #include "softparticles.glsl"
#endif #endif
@ -225,7 +224,7 @@ void main()
#endif #endif
gl_FragData[0].xyz = mix(gl_FragData[0].xyz, gl_Fog.color.xyz, fogValue); gl_FragData[0].xyz = mix(gl_FragData[0].xyz, gl_Fog.color.xyz, fogValue);
#if defined(SOFT_PARTICLES) && SOFT_PARTICLES #if @softParticles
gl_FragData[0].a *= calcSoftParticleFade(); gl_FragData[0].a *= calcSoftParticleFade();
#endif #endif