This is an automated email from the git hooks/post-receive script. smcv pushed a commit to annotated tag 1.42d in repository iortcw.
commit a3a0a23ad620e8fee7b9eb7caa7be7196813411f Author: Zack Middleton <zturtle...@gmail.com> Date: Thu May 7 23:38:05 2015 -0500 Rend2: Fix player on fire effect Add support for alphaGen normalzfade, except the zombie effect part. Add support for negative deform wave frequency only effecting Z using amount based on fireRiseDir. --- MP/code/rend2/glsl/generic_vp.glsl | 55 +++++++++++++++ MP/code/rend2/tr_glsl.c | 9 ++- MP/code/rend2/tr_local.h | 4 ++ MP/code/rend2/tr_shade.c | 136 +++++++++++++++++++++++++++++++++++++ MP/code/rend2/tr_shader.c | 1 + SP/code/rend2/glsl/generic_vp.glsl | 55 +++++++++++++++ SP/code/rend2/tr_glsl.c | 9 ++- SP/code/rend2/tr_local.h | 4 ++ SP/code/rend2/tr_shade.c | 136 +++++++++++++++++++++++++++++++++++++ SP/code/rend2/tr_shader.c | 1 + 10 files changed, 408 insertions(+), 2 deletions(-) diff --git a/MP/code/rend2/glsl/generic_vp.glsl b/MP/code/rend2/glsl/generic_vp.glsl index e04b201..1cc6484 100644 --- a/MP/code/rend2/glsl/generic_vp.glsl +++ b/MP/code/rend2/glsl/generic_vp.glsl @@ -43,6 +43,10 @@ uniform mat4 u_ModelViewProjectionMatrix; uniform vec4 u_BaseColor; uniform vec4 u_VertColor; +#if defined(USE_DEFORM_VERTEXES) || defined(USE_RGBAGEN) +uniform vec3 u_FireRiseDir; +#endif + #if defined(USE_RGBAGEN) uniform int u_ColorGen; uniform int u_AlphaGen; @@ -50,6 +54,8 @@ uniform vec3 u_AmbientLight; uniform vec3 u_DirectedLight; uniform vec3 u_ModelLightDir; uniform float u_PortalRange; +uniform float u_ZFadeLowest; +uniform float u_ZFadeHighest; #endif #if defined(USE_VERTEX_ANIMATION) @@ -68,6 +74,20 @@ vec3 DeformPosition(const vec3 pos, const vec3 normal, const vec2 st) float frequency = u_DeformParams[3]; float spread = u_DeformParams[4]; + // a negative frequency is for Z deformation based on normal + float zDeformScale = 0; + if (frequency < 0) + { + zDeformScale = 1; + frequency *= -1; + + if (frequency > 999) + { + frequency -= 999; + zDeformScale = -1; + } + } + if (u_DeformGen == DGEN_BULGE) { phase *= st.x; @@ -105,6 +125,20 @@ vec3 DeformPosition(const vec3 pos, const vec3 normal, const vec2 st) func = sin(value); } + if (zDeformScale != 0) + { + vec3 dir = u_FireRiseDir * (0.4 + 0.6 * u_FireRiseDir.z); + float nDot = dot(dir, normal); + float scale = base + func * amplitude; + + if (nDot * scale > 0) + { + return pos + dir * nDot * scale * zDeformScale; + } + + return pos; + } + return pos + normal * (base + func * amplitude); } #endif @@ -178,6 +212,27 @@ vec4 CalcColor(vec3 position, vec3 normal) { color.a = clamp(length(viewer) / u_PortalRange, 0.0, 1.0); } + else if (u_AlphaGen == AGEN_NORMALZFADE) + { + float nDot = dot(normal, u_FireRiseDir); + float halfRange = (u_ZFadeHighest - u_ZFadeLowest) / 2.0; + + if (nDot < u_ZFadeHighest) { + if (nDot > u_ZFadeLowest) { + float frac; + if (nDot < u_ZFadeLowest + halfRange) { + frac = ( nDot - u_ZFadeLowest ) / halfRange; + } else { + frac = 1.0 - ( nDot - u_ZFadeLowest - halfRange ) / halfRange; + } + color.a *= clamp(frac, 0.0, 1.0); + } else { + color.a = 0; + } + } else { + color.a = 0; + } + } return color; } diff --git a/MP/code/rend2/tr_glsl.c b/MP/code/rend2/tr_glsl.c index ca8e5a5..ba62e26 100644 --- a/MP/code/rend2/tr_glsl.c +++ b/MP/code/rend2/tr_glsl.c @@ -146,6 +146,10 @@ static uniformInfo_t uniformsInfo[] = { "u_PrimaryLightRadius", GLSL_FLOAT }, { "u_CubeMapInfo", GLSL_VEC4 }, + + { "u_FireRiseDir", GLSL_VEC3 }, + { "u_ZFadeLowest", GLSL_FLOAT }, + { "u_ZFadeHighest", GLSL_FLOAT }, }; @@ -302,9 +306,11 @@ static void GLSL_GetShaderHeader( GLenum shaderType, const GLcharARB *extra, cha "#define alphaGen_t\n" "#define AGEN_LIGHTING_SPECULAR %i\n" "#define AGEN_PORTAL %i\n" + "#define AGEN_NORMALZFADE %i\n" "#endif\n", AGEN_LIGHTING_SPECULAR, - AGEN_PORTAL)); + AGEN_PORTAL, + AGEN_NORMALZFADE)); Q_strcat(dest, size, va("#ifndef texenv_t\n" @@ -1528,6 +1534,7 @@ shaderProgram_t *GLSL_GetGenericShaderProgram(int stage, glfog_t *glFog) { case AGEN_LIGHTING_SPECULAR: case AGEN_PORTAL: + case AGEN_NORMALZFADE: shaderAttribs |= GENERICDEF_USE_RGBAGEN; break; default: diff --git a/MP/code/rend2/tr_local.h b/MP/code/rend2/tr_local.h index 77da8c2..13968e5 100644 --- a/MP/code/rend2/tr_local.h +++ b/MP/code/rend2/tr_local.h @@ -779,6 +779,10 @@ typedef enum UNIFORM_CUBEMAPINFO, + UNIFORM_FIRERISEDIR, + UNIFORM_ZFADELOWEST, + UNIFORM_ZFADEHIGHEST, + UNIFORM_COUNT } uniform_t; diff --git a/MP/code/rend2/tr_shade.c b/MP/code/rend2/tr_shade.c index 402538e..c9bc81c 100644 --- a/MP/code/rend2/tr_shade.c +++ b/MP/code/rend2/tr_shade.c @@ -418,6 +418,23 @@ static void ProjectDlightTexture( void ) { { GLSL_SetUniformFloat5(sp, UNIFORM_DEFORMPARAMS, deformParams); GLSL_SetUniformFloat(sp, UNIFORM_TIME, tess.shaderTime); + + if (tess.shader->deforms[0].deformationWave.frequency < 0) + { + vec3_t worldUp; + + if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) { + VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 ); + } + + if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis + VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp ); + } else { + VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp ); + } + + GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp); + } } vector[0] = dl->color[0]; @@ -602,6 +619,13 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t vertColor[3] = 0.0f; break; case AGEN_NORMALZFADE: + baseColor[3] = pStage->constantColor[3] / 255.0f; + if (backEnd.currentEntity && backEnd.currentEntity->e.hModel) + { + baseColor[3] *= ((unsigned char *)backEnd.currentEntity->e.shaderRGBA)[3] / 255.0f; + } + vertColor[3] = 0.0f; + break; case AGEN_VERTEX: baseColor[3] = 0.0f; vertColor[3] = 1.0f; @@ -797,6 +821,24 @@ static void ForwardDlight( void ) { GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation); + if ((deformGen != DGEN_NONE && tess.shader->deforms[0].deformationWave.frequency < 0 ) + || pStage->alphaGen == AGEN_NORMALZFADE) + { + vec3_t worldUp; + + if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) { + VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 ); + } + + if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis + VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp ); + } else { + VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp ); + } + + GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp); + } + GLSL_SetUniformInt(sp, UNIFORM_DEFORMGEN, deformGen); if (deformGen != DGEN_NONE) { @@ -830,6 +872,27 @@ static void ForwardDlight( void ) { { GLSL_SetUniformFloat(sp, UNIFORM_PORTALRANGE, tess.shader->portalRange); } + else if (pStage->alphaGen == AGEN_NORMALZFADE) + { + float lowest, highest; + //qboolean zombieEffect = qfalse; + + lowest = pStage->zFadeBounds[0]; + if ( lowest == -1000 ) { // use entity alpha + lowest = backEnd.currentEntity->e.shaderTime; + //zombieEffect = qtrue; + } + highest = pStage->zFadeBounds[1]; + if ( highest == -1000 ) { // use entity alpha + highest = backEnd.currentEntity->e.shaderTime; + //zombieEffect = qtrue; + } + + // TODO: Handle normalzfade zombie effect + + GLSL_SetUniformFloat(sp, UNIFORM_ZFADELOWEST, lowest); + GLSL_SetUniformFloat(sp, UNIFORM_ZFADEHIGHEST, highest); + } GLSL_SetUniformInt(sp, UNIFORM_COLORGEN, pStage->rgbGen); GLSL_SetUniformInt(sp, UNIFORM_ALPHAGEN, pStage->alphaGen); @@ -1087,6 +1150,23 @@ static void RB_FogPass( int wolfFog ) { { GLSL_SetUniformFloat5(sp, UNIFORM_DEFORMPARAMS, deformParams); GLSL_SetUniformFloat(sp, UNIFORM_TIME, tess.shaderTime); + + if (tess.shader->deforms[0].deformationWave.frequency < 0) + { + vec3_t worldUp; + + if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) { + VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 ); + } + + if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis + VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp ); + } else { + VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp ); + } + + GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp); + } } if (wolfFog) @@ -1273,6 +1353,24 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) GLSL_SetUniformVec3(sp, UNIFORM_LOCALVIEWORIGIN, backEnd.or.viewOrigin); GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation); + + if ((deformGen != DGEN_NONE && tess.shader->deforms[0].deformationWave.frequency < 0 ) + || pStage->alphaGen == AGEN_NORMALZFADE) + { + vec3_t worldUp; + + if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) { + VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 ); + } + + if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis + VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp ); + } else { + VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp ); + } + + GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp); + } GLSL_SetUniformInt(sp, UNIFORM_DEFORMGEN, deformGen); if (deformGen != DGEN_NONE) @@ -1345,6 +1443,27 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) { GLSL_SetUniformFloat(sp, UNIFORM_PORTALRANGE, tess.shader->portalRange); } + else if (pStage->alphaGen == AGEN_NORMALZFADE) + { + float lowest, highest; + //qboolean zombieEffect = qfalse; + + lowest = pStage->zFadeBounds[0]; + if ( lowest == -1000 ) { // use entity alpha + lowest = backEnd.currentEntity->e.shaderTime; + //zombieEffect = qtrue; + } + highest = pStage->zFadeBounds[1]; + if ( highest == -1000 ) { // use entity alpha + highest = backEnd.currentEntity->e.shaderTime; + //zombieEffect = qtrue; + } + + // TODO: Handle normalzfade zombie effect + + GLSL_SetUniformFloat(sp, UNIFORM_ZFADELOWEST, lowest); + GLSL_SetUniformFloat(sp, UNIFORM_ZFADEHIGHEST, highest); + } GLSL_SetUniformInt(sp, UNIFORM_COLORGEN, pStage->rgbGen); GLSL_SetUniformInt(sp, UNIFORM_ALPHAGEN, pStage->alphaGen); @@ -1558,6 +1677,23 @@ static void RB_RenderShadowmap( shaderCommands_t *input ) { GLSL_SetUniformFloat5(sp, UNIFORM_DEFORMPARAMS, deformParams); GLSL_SetUniformFloat(sp, UNIFORM_TIME, tess.shaderTime); + + if (tess.shader->deforms[0].deformationWave.frequency < 0) + { + vec3_t worldUp; + + if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) { + VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 ); + } + + if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis + VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp ); + } else { + VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp ); + } + + GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp); + } } VectorCopy(backEnd.viewParms.or.origin, vector); diff --git a/MP/code/rend2/tr_shader.c b/MP/code/rend2/tr_shader.c index d568044..48b6083 100644 --- a/MP/code/rend2/tr_shader.c +++ b/MP/code/rend2/tr_shader.c @@ -2363,6 +2363,7 @@ static int CollapseStagesToGLSL(void) { case AGEN_LIGHTING_SPECULAR: case AGEN_PORTAL: + case AGEN_NORMALZFADE: skip = qtrue; break; default: diff --git a/SP/code/rend2/glsl/generic_vp.glsl b/SP/code/rend2/glsl/generic_vp.glsl index e04b201..1cc6484 100644 --- a/SP/code/rend2/glsl/generic_vp.glsl +++ b/SP/code/rend2/glsl/generic_vp.glsl @@ -43,6 +43,10 @@ uniform mat4 u_ModelViewProjectionMatrix; uniform vec4 u_BaseColor; uniform vec4 u_VertColor; +#if defined(USE_DEFORM_VERTEXES) || defined(USE_RGBAGEN) +uniform vec3 u_FireRiseDir; +#endif + #if defined(USE_RGBAGEN) uniform int u_ColorGen; uniform int u_AlphaGen; @@ -50,6 +54,8 @@ uniform vec3 u_AmbientLight; uniform vec3 u_DirectedLight; uniform vec3 u_ModelLightDir; uniform float u_PortalRange; +uniform float u_ZFadeLowest; +uniform float u_ZFadeHighest; #endif #if defined(USE_VERTEX_ANIMATION) @@ -68,6 +74,20 @@ vec3 DeformPosition(const vec3 pos, const vec3 normal, const vec2 st) float frequency = u_DeformParams[3]; float spread = u_DeformParams[4]; + // a negative frequency is for Z deformation based on normal + float zDeformScale = 0; + if (frequency < 0) + { + zDeformScale = 1; + frequency *= -1; + + if (frequency > 999) + { + frequency -= 999; + zDeformScale = -1; + } + } + if (u_DeformGen == DGEN_BULGE) { phase *= st.x; @@ -105,6 +125,20 @@ vec3 DeformPosition(const vec3 pos, const vec3 normal, const vec2 st) func = sin(value); } + if (zDeformScale != 0) + { + vec3 dir = u_FireRiseDir * (0.4 + 0.6 * u_FireRiseDir.z); + float nDot = dot(dir, normal); + float scale = base + func * amplitude; + + if (nDot * scale > 0) + { + return pos + dir * nDot * scale * zDeformScale; + } + + return pos; + } + return pos + normal * (base + func * amplitude); } #endif @@ -178,6 +212,27 @@ vec4 CalcColor(vec3 position, vec3 normal) { color.a = clamp(length(viewer) / u_PortalRange, 0.0, 1.0); } + else if (u_AlphaGen == AGEN_NORMALZFADE) + { + float nDot = dot(normal, u_FireRiseDir); + float halfRange = (u_ZFadeHighest - u_ZFadeLowest) / 2.0; + + if (nDot < u_ZFadeHighest) { + if (nDot > u_ZFadeLowest) { + float frac; + if (nDot < u_ZFadeLowest + halfRange) { + frac = ( nDot - u_ZFadeLowest ) / halfRange; + } else { + frac = 1.0 - ( nDot - u_ZFadeLowest - halfRange ) / halfRange; + } + color.a *= clamp(frac, 0.0, 1.0); + } else { + color.a = 0; + } + } else { + color.a = 0; + } + } return color; } diff --git a/SP/code/rend2/tr_glsl.c b/SP/code/rend2/tr_glsl.c index ca8e5a5..ba62e26 100644 --- a/SP/code/rend2/tr_glsl.c +++ b/SP/code/rend2/tr_glsl.c @@ -146,6 +146,10 @@ static uniformInfo_t uniformsInfo[] = { "u_PrimaryLightRadius", GLSL_FLOAT }, { "u_CubeMapInfo", GLSL_VEC4 }, + + { "u_FireRiseDir", GLSL_VEC3 }, + { "u_ZFadeLowest", GLSL_FLOAT }, + { "u_ZFadeHighest", GLSL_FLOAT }, }; @@ -302,9 +306,11 @@ static void GLSL_GetShaderHeader( GLenum shaderType, const GLcharARB *extra, cha "#define alphaGen_t\n" "#define AGEN_LIGHTING_SPECULAR %i\n" "#define AGEN_PORTAL %i\n" + "#define AGEN_NORMALZFADE %i\n" "#endif\n", AGEN_LIGHTING_SPECULAR, - AGEN_PORTAL)); + AGEN_PORTAL, + AGEN_NORMALZFADE)); Q_strcat(dest, size, va("#ifndef texenv_t\n" @@ -1528,6 +1534,7 @@ shaderProgram_t *GLSL_GetGenericShaderProgram(int stage, glfog_t *glFog) { case AGEN_LIGHTING_SPECULAR: case AGEN_PORTAL: + case AGEN_NORMALZFADE: shaderAttribs |= GENERICDEF_USE_RGBAGEN; break; default: diff --git a/SP/code/rend2/tr_local.h b/SP/code/rend2/tr_local.h index a7c480f..8690d96 100644 --- a/SP/code/rend2/tr_local.h +++ b/SP/code/rend2/tr_local.h @@ -784,6 +784,10 @@ typedef enum UNIFORM_CUBEMAPINFO, + UNIFORM_FIRERISEDIR, + UNIFORM_ZFADELOWEST, + UNIFORM_ZFADEHIGHEST, + UNIFORM_COUNT } uniform_t; diff --git a/SP/code/rend2/tr_shade.c b/SP/code/rend2/tr_shade.c index cd847ef..ed8a489 100644 --- a/SP/code/rend2/tr_shade.c +++ b/SP/code/rend2/tr_shade.c @@ -412,6 +412,23 @@ static void ProjectDlightTexture( void ) { { GLSL_SetUniformFloat5(sp, UNIFORM_DEFORMPARAMS, deformParams); GLSL_SetUniformFloat(sp, UNIFORM_TIME, tess.shaderTime); + + if (tess.shader->deforms[0].deformationWave.frequency < 0) + { + vec3_t worldUp; + + if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) { + VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 ); + } + + if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis + VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp ); + } else { + VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp ); + } + + GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp); + } } vector[0] = dl->color[0]; @@ -596,6 +613,13 @@ static void ComputeShaderColors( shaderStage_t *pStage, vec4_t baseColor, vec4_t vertColor[3] = 0.0f; break; case AGEN_NORMALZFADE: + baseColor[3] = pStage->constantColor[3] / 255.0f; + if (backEnd.currentEntity && backEnd.currentEntity->e.hModel) + { + baseColor[3] *= ((unsigned char *)backEnd.currentEntity->e.shaderRGBA)[3] / 255.0f; + } + vertColor[3] = 0.0f; + break; case AGEN_VERTEX: baseColor[3] = 0.0f; vertColor[3] = 1.0f; @@ -791,6 +815,24 @@ static void ForwardDlight( void ) { GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation); + if ((deformGen != DGEN_NONE && tess.shader->deforms[0].deformationWave.frequency < 0 ) + || pStage->alphaGen == AGEN_NORMALZFADE) + { + vec3_t worldUp; + + if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) { + VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 ); + } + + if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis + VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp ); + } else { + VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp ); + } + + GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp); + } + GLSL_SetUniformInt(sp, UNIFORM_DEFORMGEN, deformGen); if (deformGen != DGEN_NONE) { @@ -824,6 +866,27 @@ static void ForwardDlight( void ) { { GLSL_SetUniformFloat(sp, UNIFORM_PORTALRANGE, tess.shader->portalRange); } + else if (pStage->alphaGen == AGEN_NORMALZFADE) + { + float lowest, highest; + //qboolean zombieEffect = qfalse; + + lowest = pStage->zFadeBounds[0]; + if ( lowest == -1000 ) { // use entity alpha + lowest = backEnd.currentEntity->e.shaderTime; + //zombieEffect = qtrue; + } + highest = pStage->zFadeBounds[1]; + if ( highest == -1000 ) { // use entity alpha + highest = backEnd.currentEntity->e.shaderTime; + //zombieEffect = qtrue; + } + + // TODO: Handle normalzfade zombie effect + + GLSL_SetUniformFloat(sp, UNIFORM_ZFADELOWEST, lowest); + GLSL_SetUniformFloat(sp, UNIFORM_ZFADEHIGHEST, highest); + } GLSL_SetUniformInt(sp, UNIFORM_COLORGEN, pStage->rgbGen); GLSL_SetUniformInt(sp, UNIFORM_ALPHAGEN, pStage->alphaGen); @@ -1081,6 +1144,23 @@ static void RB_FogPass( int wolfFog ) { { GLSL_SetUniformFloat5(sp, UNIFORM_DEFORMPARAMS, deformParams); GLSL_SetUniformFloat(sp, UNIFORM_TIME, tess.shaderTime); + + if (tess.shader->deforms[0].deformationWave.frequency < 0) + { + vec3_t worldUp; + + if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) { + VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 ); + } + + if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis + VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp ); + } else { + VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp ); + } + + GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp); + } } if (wolfFog) @@ -1267,6 +1347,24 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) GLSL_SetUniformVec3(sp, UNIFORM_LOCALVIEWORIGIN, backEnd.or.viewOrigin); GLSL_SetUniformFloat(sp, UNIFORM_VERTEXLERP, glState.vertexAttribsInterpolation); + + if ((deformGen != DGEN_NONE && tess.shader->deforms[0].deformationWave.frequency < 0 ) + || pStage->alphaGen == AGEN_NORMALZFADE) + { + vec3_t worldUp; + + if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) { + VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 ); + } + + if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis + VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp ); + } else { + VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp ); + } + + GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp); + } GLSL_SetUniformInt(sp, UNIFORM_DEFORMGEN, deformGen); if (deformGen != DGEN_NONE) @@ -1339,6 +1437,27 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input ) { GLSL_SetUniformFloat(sp, UNIFORM_PORTALRANGE, tess.shader->portalRange); } + else if (pStage->alphaGen == AGEN_NORMALZFADE) + { + float lowest, highest; + //qboolean zombieEffect = qfalse; + + lowest = pStage->zFadeBounds[0]; + if ( lowest == -1000 ) { // use entity alpha + lowest = backEnd.currentEntity->e.shaderTime; + //zombieEffect = qtrue; + } + highest = pStage->zFadeBounds[1]; + if ( highest == -1000 ) { // use entity alpha + highest = backEnd.currentEntity->e.shaderTime; + //zombieEffect = qtrue; + } + + // TODO: Handle normalzfade zombie effect + + GLSL_SetUniformFloat(sp, UNIFORM_ZFADELOWEST, lowest); + GLSL_SetUniformFloat(sp, UNIFORM_ZFADEHIGHEST, highest); + } GLSL_SetUniformInt(sp, UNIFORM_COLORGEN, pStage->rgbGen); GLSL_SetUniformInt(sp, UNIFORM_ALPHAGEN, pStage->alphaGen); @@ -1553,6 +1672,23 @@ static void RB_RenderShadowmap( shaderCommands_t *input ) { GLSL_SetUniformFloat5(sp, UNIFORM_DEFORMPARAMS, deformParams); GLSL_SetUniformFloat(sp, UNIFORM_TIME, tess.shaderTime); + + if (tess.shader->deforms[0].deformationWave.frequency < 0) + { + vec3_t worldUp; + + if ( VectorCompare( backEnd.currentEntity->e.fireRiseDir, vec3_origin ) ) { + VectorSet( backEnd.currentEntity->e.fireRiseDir, 0, 0, 1 ); + } + + if ( backEnd.currentEntity->e.hModel ) { // world surfaces dont have an axis + VectorRotate( backEnd.currentEntity->e.fireRiseDir, backEnd.currentEntity->e.axis, worldUp ); + } else { + VectorCopy( backEnd.currentEntity->e.fireRiseDir, worldUp ); + } + + GLSL_SetUniformVec3(sp, UNIFORM_FIRERISEDIR, worldUp); + } } VectorCopy(backEnd.viewParms.or.origin, vector); diff --git a/SP/code/rend2/tr_shader.c b/SP/code/rend2/tr_shader.c index d821eaa..282b061 100644 --- a/SP/code/rend2/tr_shader.c +++ b/SP/code/rend2/tr_shader.c @@ -2384,6 +2384,7 @@ static int CollapseStagesToGLSL(void) { case AGEN_LIGHTING_SPECULAR: case AGEN_PORTAL: + case AGEN_NORMALZFADE: skip = qtrue; break; default: -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git _______________________________________________ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits