From 1ececc94ea3d04c3e1dcebb662b8668aeaf56d3f Mon Sep 17 00:00:00 2001 From: plagman Date: Wed, 12 Jan 2011 02:31:50 +0000 Subject: [PATCH] Perform the highpal lookup after the diffuse modulation and detail to hit more range in the highpalookup map. This shuffles a fair bit of lighting model around, so I wouldn't be surprised if I broke something. git-svn-id: https://svn.eduke32.com/eduke32@1757 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/polymer.h | 4 +- polymer/eduke32/build/src/polymer.c | 76 ++++++++++++------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index 1e6b04ec1..e4a5de13a 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -68,10 +68,10 @@ typedef enum { PR_BIT_LIGHTING_PASS, PR_BIT_NORMAL_MAP, PR_BIT_DIFFUSE_MAP, - PR_BIT_HIGHPALOOKUP_MAP, - PR_BIT_DIFFUSE_MAP2, PR_BIT_DIFFUSE_DETAIL_MAP, PR_BIT_DIFFUSE_MODULATION, + PR_BIT_HIGHPALOOKUP_MAP, + PR_BIT_DIFFUSE_MAP2, 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 8ecab0a46..b145a919e 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -259,6 +259,43 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = { " diffuseTexel = texture2D(diffuseMap, commonTexCoord.st);\n" "\n", }, + { + 1 << PR_BIT_DIFFUSE_DETAIL_MAP, + // vert_def + "uniform vec2 detailScale;\n" + "varying vec2 fragDetailScale;\n" + "\n", + // vert_prog + " fragDetailScale = detailScale;\n" + " if (isNormalMapped == 0)\n" + " gl_TexCoord[1] = vec4(detailScale, 1.0, 1.0) * gl_MultiTexCoord0;\n" + "\n", + // frag_def + "uniform sampler2D detailMap;\n" + "varying vec2 fragDetailScale;\n" + "\n", + // frag_prog + " if (isNormalMapped == 0)\n" + " diffuseTexel *= texture2D(detailMap, gl_TexCoord[1].st);\n" + " else\n" + " diffuseTexel *= texture2D(detailMap, commonTexCoord.st * fragDetailScale);\n" + " diffuseTexel.rgb *= 2.0;\n" + "\n", + }, + { + 1 << PR_BIT_DIFFUSE_MODULATION, + // vert_def + "", + // vert_prog + " gl_FrontColor = gl_Color;\n" + "\n", + // frag_def + "", + // frag_prog + " if (isLightingPass == 0)\n" + " diffuseTexel *= vec4(gl_Color);\n" + "\n", + }, { 1 << PR_BIT_HIGHPALOOKUP_MAP, // vert_def @@ -285,43 +322,6 @@ _prprogrambit prprogrambits[PR_BIT_COUNT] = { " result *= diffuseTexel;\n" "\n", }, - { - 1 << PR_BIT_DIFFUSE_DETAIL_MAP, - // vert_def - "uniform vec2 detailScale;\n" - "varying vec2 fragDetailScale;\n" - "\n", - // vert_prog - " fragDetailScale = detailScale;\n" - " if (isNormalMapped == 0)\n" - " gl_TexCoord[1] = vec4(detailScale, 1.0, 1.0) * gl_MultiTexCoord0;\n" - "\n", - // frag_def - "uniform sampler2D detailMap;\n" - "varying vec2 fragDetailScale;\n" - "\n", - // frag_prog - " if (isNormalMapped == 0)\n" - " result *= texture2D(detailMap, gl_TexCoord[1].st);\n" - " else\n" - " result *= texture2D(detailMap, commonTexCoord.st * fragDetailScale);\n" - " result.rgb *= 2.0;\n" - "\n", - }, - { - 1 << PR_BIT_DIFFUSE_MODULATION, - // vert_def - "", - // vert_prog - " gl_FrontColor = gl_Color;\n" - "\n", - // frag_def - "", - // frag_prog - " if (isLightingPass == 0)\n" - " result *= vec4(gl_Color);\n" - "\n", - }, { 1 << PR_BIT_SPECULAR_MAP, // vert_def @@ -4276,7 +4276,7 @@ static int32_t polymer_bindmaterial(_prmaterial material, int16_t* lights, programbits |= prprogrambits[PR_BIT_HIGHPALOOKUP_MAP].bit; // PR_BIT_DIFFUSE_DETAIL_MAP - if (!curlight && r_detailmapping && material.detailmap) + if (r_detailmapping && material.detailmap) programbits |= prprogrambits[PR_BIT_DIFFUSE_DETAIL_MAP].bit; // PR_BIT_DIFFUSE_MODULATION