1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 16:29:55 +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))
{
writableStateSet->setDefine("SOFT_PARTICLES", "1", osg::StateAttribute::ON);
defineMap["softParticles"] = "1";
auto depth = SceneUtil::createDepth();
depth->setWriteMask(false);
@ -568,6 +568,8 @@ namespace Shader
writableStateSet->addUniform(new osg::Uniform("opaqueDepthTex", 2));
writableStateSet->setTextureAttributeAndModes(2, mOpaqueDepthTex, osg::StateAttribute::ON);
}
else
defineMap["softParticles"] = "0";
std::string shaderPrefix;
if (!node.getUserValue("shaderPrefix", shaderPrefix))

View file

@ -1,6 +1,5 @@
#version 120
#pragma import_defines(FORCE_OPAQUE)
#pragma import_defines(SOFT_PARTICLES)
#if @useUBO
#extension GL_ARB_uniform_buffer_object : require
@ -81,7 +80,7 @@ varying vec3 passNormal;
#include "parallax.glsl"
#include "alpha.glsl"
#if defined(SOFT_PARTICLES) && SOFT_PARTICLES
#if @softParticles
#include "softparticles.glsl"
#endif
@ -225,7 +224,7 @@ void main()
#endif
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();
#endif