From 658c3b66f1af834e0976a71375a97d52e65a3a97 Mon Sep 17 00:00:00 2001 From: plagman Date: Tue, 18 Jan 2011 01:34:39 +0000 Subject: [PATCH] Fix the lighting model so that lights don't get the modulated diffuse (defeats the purpose if they do, since you wouldn't be able to light a fully shaded room). That means the highpal lookup has to be performed twice now, once with the modulated diffuse to apply to the result and once with no modulation to make a diffuse that the lighting code can use. That means that lighting isn't 100% accurate with respect to the highpal result, but that's the best approach I could think of. git-svn-id: https://svn.eduke32.com/eduke32@1773 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/polymer.h | 2 +- polymer/eduke32/build/src/polymer.c | 30 +++++++++++++------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index e4a5de13a..a099e0e51 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -70,8 +70,8 @@ typedef enum { PR_BIT_DIFFUSE_MAP, PR_BIT_DIFFUSE_DETAIL_MAP, PR_BIT_DIFFUSE_MODULATION, - PR_BIT_HIGHPALOOKUP_MAP, PR_BIT_DIFFUSE_MAP2, + PR_BIT_HIGHPALOOKUP_MAP, PR_BIT_SPECULAR_MAP, PR_BIT_SPECULAR_MATERIAL, PR_BIT_MIRROR_MAP, diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 7d20f5413..fb7613167 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -293,20 +293,7 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = { "", // frag_prog " if (isLightingPass == 0)\n" - " diffuseTexel *= vec4(gl_Color);\n" - "\n", - }, - { - 1 << PR_BIT_HIGHPALOOKUP_MAP, - // vert_def - "", - // vert_prog - "", - // frag_def - "uniform sampler3D highPalookupMap;\n" - "\n", - // frag_prog - " diffuseTexel.rgb = texture3D(highPalookupMap, diffuseTexel.rgb).rgb;\n" + " result *= vec4(gl_Color);\n" "\n", }, { @@ -322,6 +309,21 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = { " result *= diffuseTexel;\n" "\n", }, + { + 1 << PR_BIT_HIGHPALOOKUP_MAP, + // vert_def + "", + // vert_prog + "", + // frag_def + "uniform sampler3D highPalookupMap;\n" + "\n", + // frag_prog + " if (isLightingPass == 0)\n" + " result.rgb = texture3D(highPalookupMap, result.rgb).rgb;\n" + " diffuseTexel.rgb = texture3D(highPalookupMap, diffuseTexel.rgb).rgb;\n" + "\n", + }, { 1 << PR_BIT_SPECULAR_MAP, // vert_def