From 45ae8d5ffa778c5a35c3de7037f90d9d3adabb19 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 8 Feb 2017 18:39:24 +0100 Subject: [PATCH] Add support for GL_AMBIENT colorMode to shaders as required by particle systems --- components/shader/shadervisitor.cpp | 3 +++ files/shaders/lighting.glsl | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/components/shader/shadervisitor.cpp b/components/shader/shadervisitor.cpp index 041b568df..799781303 100644 --- a/components/shader/shadervisitor.cpp +++ b/components/shader/shadervisitor.cpp @@ -272,6 +272,9 @@ namespace Shader { switch (reqs.mVertexColorMode) { + case GL_AMBIENT: + defineMap["colorMode"] = "3"; + break; default: case GL_AMBIENT_AND_DIFFUSE: defineMap["colorMode"] = "2"; diff --git a/files/shaders/lighting.glsl b/files/shaders/lighting.glsl index d62b61b52..7b8486fbe 100644 --- a/files/shaders/lighting.glsl +++ b/files/shaders/lighting.glsl @@ -5,7 +5,10 @@ vec4 doLighting(vec3 viewPos, vec3 viewNormal, vec4 vertexColor) vec3 lightDir; float d; -#if @colorMode == 2 +#if @colorMode == 3 + vec4 diffuse = gl_FrontMaterial.diffuse; + vec3 ambient = vertexColor.xyz; +#elif @colorMode == 2 vec4 diffuse = vertexColor; vec3 ambient = vertexColor.xyz; #else