[iortcw] 12/152: All: Remove ambientLightInt

Simon McVittie smcv at debian.org
Fri Sep 8 10:39:38 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.5a
in repository iortcw.

commit 061060da7013d4875fa361a369540884ae8597e7
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Sun Jan 17 05:45:42 2016 -0500

    All: Remove ambientLightInt
    
    Can cause surfaces to become invisible when shader keyword
    lightingdiffuse is used on world surfaces. The only reason this worked in vanilla
    Q3 and RTCW was due to a typo. See conditional under comment
    'decide which agens we can skip' in tr_shader.c (vanilla)
    
    https://github.com/ioquake/ioq3/commit/0afedc928c064892551dbac15b3f5ae66221ee45
---
 MP/code/rend2/tr_light.c         | 6 ------
 MP/code/rend2/tr_local.h         | 1 -
 MP/code/renderer/tr_light.c      | 6 ------
 MP/code/renderer/tr_local.h      | 1 -
 MP/code/renderer/tr_shade_calc.c | 9 ++++-----
 SP/code/rend2/tr_light.c         | 6 ------
 SP/code/rend2/tr_local.h         | 1 -
 SP/code/renderer/tr_light.c      | 6 ------
 SP/code/renderer/tr_local.h      | 1 -
 SP/code/renderer/tr_shade_calc.c | 9 ++++-----
 10 files changed, 8 insertions(+), 38 deletions(-)

diff --git a/MP/code/rend2/tr_light.c b/MP/code/rend2/tr_light.c
index 75a1fa1..b0ba83a 100644
--- a/MP/code/rend2/tr_light.c
+++ b/MP/code/rend2/tr_light.c
@@ -426,12 +426,6 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) {
 		LogLight( ent );
 	}
 
-	// save out the byte packet version
-	( (byte *)&ent->ambientLightInt )[0] = ri.ftol( ent->ambientLight[0] );
-	( (byte *)&ent->ambientLightInt )[1] = ri.ftol( ent->ambientLight[1] );
-	( (byte *)&ent->ambientLightInt )[2] = ri.ftol( ent->ambientLight[2] );
-	( (byte *)&ent->ambientLightInt )[3] = 0xff;
-
 	// transform the direction to local space
 	VectorNormalize( lightDir );
 	ent->modelLightDir[0] = DotProduct( lightDir, ent->e.axis[0] );
diff --git a/MP/code/rend2/tr_local.h b/MP/code/rend2/tr_local.h
index 9a814df..f5e7e0a 100644
--- a/MP/code/rend2/tr_local.h
+++ b/MP/code/rend2/tr_local.h
@@ -78,7 +78,6 @@ typedef struct {
 	vec3_t		lightDir;		// normalized direction towards light, in world space
 	vec3_t      modelLightDir;  // normalized direction towards light, in model space
 	vec3_t ambientLight;        // color normalized to 0-255
-	int ambientLightInt;            // 32 bit rgba packed
 	vec3_t directedLight;
 	float brightness;
 } trRefEntity_t;
diff --git a/MP/code/renderer/tr_light.c b/MP/code/renderer/tr_light.c
index ad7b039..179ae7c 100644
--- a/MP/code/renderer/tr_light.c
+++ b/MP/code/renderer/tr_light.c
@@ -393,12 +393,6 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) {
 		LogLight( ent );
 	}
 
-	// save out the byte packet version
-	( (byte *)&ent->ambientLightInt )[0] = ri.ftol( ent->ambientLight[0] );
-	( (byte *)&ent->ambientLightInt )[1] = ri.ftol( ent->ambientLight[1] );
-	( (byte *)&ent->ambientLightInt )[2] = ri.ftol( ent->ambientLight[2] );
-	( (byte *)&ent->ambientLightInt )[3] = 0xff;
-
 	// transform the direction to local space
 	VectorNormalize( lightDir );
 	ent->lightDir[0] = DotProduct( lightDir, ent->e.axis[0] );
diff --git a/MP/code/renderer/tr_local.h b/MP/code/renderer/tr_local.h
index c31ef75..0bcb1e0 100644
--- a/MP/code/renderer/tr_local.h
+++ b/MP/code/renderer/tr_local.h
@@ -71,7 +71,6 @@ typedef struct {
 	qboolean lightingCalculated;
 	vec3_t lightDir;            // normalized direction towards light
 	vec3_t ambientLight;        // color normalized to 0-255
-	int ambientLightInt;            // 32 bit rgba packed
 	vec3_t directedLight;
 	float brightness;
 } trRefEntity_t;
diff --git a/MP/code/renderer/tr_shade_calc.c b/MP/code/renderer/tr_shade_calc.c
index 732f2ec..7cd1e05 100644
--- a/MP/code/renderer/tr_shade_calc.c
+++ b/MP/code/renderer/tr_shade_calc.c
@@ -1175,7 +1175,6 @@ static void RB_CalcDiffuseColor_altivec( unsigned char *colors )
 	int				i;
 	float			*v, *normal;
 	trRefEntity_t	*ent;
-	int				ambientLightInt;
 	vec3_t			lightDir;
 	int				numVertexes;
 	vector unsigned char vSel = VECCONST_UINT8(0x00, 0x00, 0x00, 0xff,
@@ -1192,7 +1191,6 @@ static void RB_CalcDiffuseColor_altivec( unsigned char *colors )
 	vector signed short jVecShort;
 	vector unsigned char jVecChar, normalPerm;
 	ent = backEnd.currentEntity;
-	ambientLightInt = ent->ambientLightInt;
 	// A lot of this could be simplified if we made sure
 	// entities light info was 16-byte aligned.
 	jVecChar = vec_lvsl(0, ent->ambientLight);
@@ -1246,13 +1244,11 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors )
 	float			*v, *normal;
 	float			incoming;
 	trRefEntity_t	*ent;
-	int				ambientLightInt;
 	vec3_t			ambientLight;
 	vec3_t			lightDir;
 	vec3_t			directedLight;
 	int				numVertexes;
 	ent = backEnd.currentEntity;
-	ambientLightInt = ent->ambientLightInt;
 	VectorCopy( ent->ambientLight, ambientLight );
 	VectorCopy( ent->directedLight, directedLight );
 	VectorCopy( ent->lightDir, lightDir );
@@ -1264,7 +1260,10 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors )
 	for (i = 0 ; i < numVertexes ; i++, v += 4, normal += 4) {
 		incoming = DotProduct (normal, lightDir);
 		if ( incoming <= 0 ) {
-			*(int *)&colors[i*4] = ambientLightInt;
+			colors[i * 4 + 0] = ri.ftol( ent->ambientLight[0] );
+			colors[i * 4 + 1] = ri.ftol( ent->ambientLight[1] );
+			colors[i * 4 + 2] = ri.ftol( ent->ambientLight[2] );
+			colors[i * 4 + 3] = 255;
 			continue;
 		} 
 		j = ri.ftol(ambientLight[0] + incoming * directedLight[0]);
diff --git a/SP/code/rend2/tr_light.c b/SP/code/rend2/tr_light.c
index b2b6df2..9fd6a19 100644
--- a/SP/code/rend2/tr_light.c
+++ b/SP/code/rend2/tr_light.c
@@ -427,12 +427,6 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) {
 		LogLight( ent );
 	}
 
-	// save out the byte packet version
-	( (byte *)&ent->ambientLightInt )[0] = ri.ftol( ent->ambientLight[0] );
-	( (byte *)&ent->ambientLightInt )[1] = ri.ftol( ent->ambientLight[1] );
-	( (byte *)&ent->ambientLightInt )[2] = ri.ftol( ent->ambientLight[2] );
-	( (byte *)&ent->ambientLightInt )[3] = 0xff;
-
 	// transform the direction to local space
 	VectorNormalize( lightDir );
 	ent->modelLightDir[0] = DotProduct( lightDir, ent->e.axis[0] );
diff --git a/SP/code/rend2/tr_local.h b/SP/code/rend2/tr_local.h
index f5aa092..c6df856 100644
--- a/SP/code/rend2/tr_local.h
+++ b/SP/code/rend2/tr_local.h
@@ -78,7 +78,6 @@ typedef struct {
 	vec3_t		lightDir;		// normalized direction towards light, in world space
 	vec3_t      modelLightDir;  // normalized direction towards light, in model space
 	vec3_t ambientLight;        // color normalized to 0-255
-	int ambientLightInt;            // 32 bit rgba packed
 	vec3_t directedLight;
 	float brightness;
 } trRefEntity_t;
diff --git a/SP/code/renderer/tr_light.c b/SP/code/renderer/tr_light.c
index 02ec0e5..e366672 100644
--- a/SP/code/renderer/tr_light.c
+++ b/SP/code/renderer/tr_light.c
@@ -393,12 +393,6 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ) {
 		LogLight( ent );
 	}
 
-	// save out the byte packet version
-	( (byte *)&ent->ambientLightInt )[0] = ri.ftol( ent->ambientLight[0] );
-	( (byte *)&ent->ambientLightInt )[1] = ri.ftol( ent->ambientLight[1] );
-	( (byte *)&ent->ambientLightInt )[2] = ri.ftol( ent->ambientLight[2] );
-	( (byte *)&ent->ambientLightInt )[3] = 0xff;
-
 	// transform the direction to local space
 	VectorNormalize( lightDir );
 	ent->lightDir[0] = DotProduct( lightDir, ent->e.axis[0] );
diff --git a/SP/code/renderer/tr_local.h b/SP/code/renderer/tr_local.h
index a8db891..17070d2 100644
--- a/SP/code/renderer/tr_local.h
+++ b/SP/code/renderer/tr_local.h
@@ -71,7 +71,6 @@ typedef struct {
 	qboolean lightingCalculated;
 	vec3_t lightDir;            // normalized direction towards light
 	vec3_t ambientLight;        // color normalized to 0-255
-	int ambientLightInt;            // 32 bit rgba packed
 	vec3_t directedLight;
 	float brightness;
 } trRefEntity_t;
diff --git a/SP/code/renderer/tr_shade_calc.c b/SP/code/renderer/tr_shade_calc.c
index c9ff99d..5daebec 100644
--- a/SP/code/renderer/tr_shade_calc.c
+++ b/SP/code/renderer/tr_shade_calc.c
@@ -1180,7 +1180,6 @@ static void RB_CalcDiffuseColor_altivec( unsigned char *colors )
 	int				i;
 	float			*v, *normal;
 	trRefEntity_t	*ent;
-	int				ambientLightInt;
 	vec3_t			lightDir;
 	int				numVertexes;
 	vector unsigned char vSel = VECCONST_UINT8(0x00, 0x00, 0x00, 0xff,
@@ -1197,7 +1196,6 @@ static void RB_CalcDiffuseColor_altivec( unsigned char *colors )
 	vector signed short jVecShort;
 	vector unsigned char jVecChar, normalPerm;
 	ent = backEnd.currentEntity;
-	ambientLightInt = ent->ambientLightInt;
 	// A lot of this could be simplified if we made sure
 	// entities light info was 16-byte aligned.
 	jVecChar = vec_lvsl(0, ent->ambientLight);
@@ -1251,14 +1249,12 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors )
 	float			*v, *normal;
 	float			incoming;
 	trRefEntity_t	*ent;
-	int				ambientLightInt;
 	vec3_t			ambientLight;
 	vec3_t			lightDir;
 	vec3_t			directedLight;
 	int				numVertexes;
 
 	ent = backEnd.currentEntity;
-	ambientLightInt = ent->ambientLightInt;
 	VectorCopy( ent->ambientLight, ambientLight );
 	VectorCopy( ent->directedLight, directedLight );
 	VectorCopy( ent->lightDir, lightDir );
@@ -1270,7 +1266,10 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors )
 	for (i = 0 ; i < numVertexes ; i++, v += 4, normal += 4) {
 		incoming = DotProduct (normal, lightDir);
 		if ( incoming <= 0 ) {
-			*(int *)&colors[i * 4] = ambientLightInt;
+			colors[i * 4 + 0] = ri.ftol( ent->ambientLight[0] );
+			colors[i * 4 + 1] = ri.ftol( ent->ambientLight[1] );
+			colors[i * 4 + 2] = ri.ftol( ent->ambientLight[2] );
+			colors[i * 4 + 3] = 255;
 			continue;
 		}
 		j = ri.ftol( ambientLight[0] + incoming * directedLight[0] );

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list