[ioquake3] 21/50: OpenGL2: Fix black planar projection shadows (cg_shadows 3)

Simon McVittie smcv at debian.org
Sun Jul 23 21:55:23 UTC 2017


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

smcv pushed a commit to branch debian/master
in repository ioquake3.

commit 102c79eb4985464d4e5967cdb760816e120fe089
Author: Zack Middleton <zack at cloemail.com>
Date:   Fri Jun 30 13:48:38 2017 -0500

    OpenGL2: Fix black planar projection shadows (cg_shadows 3)
    
    Restore MD3 code for cg_shadows 2 and 3 like other model formats.
    Fix planar projection shadow deform (cg_shadows 3) to use correct
    light direction. I fixed light direction for stencil shadows
    (cg_shadows 2) but it's still broken.
---
 code/renderergl2/tr_mesh.c    | 26 +++++++++++++++++++++-----
 code/renderergl2/tr_shadows.c |  4 ++--
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/code/renderergl2/tr_mesh.c b/code/renderergl2/tr_mesh.c
index 0d6844a..5f7c4ee 100644
--- a/code/renderergl2/tr_mesh.c
+++ b/code/renderergl2/tr_mesh.c
@@ -385,12 +385,28 @@ void R_AddMD3Surfaces( trRefEntity_t *ent ) {
 			shader = tr.shaders[ surface->shaderIndexes[ ent->e.skinNum % surface->numShaderIndexes ] ];
 		}
 
-		// don't add third_person objects if not viewing through a portal
-		if(!personalModel)
-		{
-			srfVaoMdvMesh_t *vaoSurface = &model->vaoSurfaces[i];
+		// we will add shadows even if the main object isn't visible in the view
+
+		// stencil shadows can't do personal models unless I polyhedron clip
+		if ( !personalModel
+			&& r_shadows->integer == 2 
+			&& fogNum == 0
+			&& !(ent->e.renderfx & ( RF_NOSHADOW | RF_DEPTHHACK ) ) 
+			&& shader->sort == SS_OPAQUE ) {
+			R_AddDrawSurf( (void *)&model->vaoSurfaces[i], tr.shadowShader, 0, qfalse, qfalse, 0 );
+		}
 
-			R_AddDrawSurf((void *)vaoSurface, shader, fogNum, qfalse, qfalse, cubemapIndex );
+		// projection shadows work fine with personal models
+		if ( r_shadows->integer == 3
+			&& fogNum == 0
+			&& (ent->e.renderfx & RF_SHADOW_PLANE )
+			&& shader->sort == SS_OPAQUE ) {
+			R_AddDrawSurf( (void *)&model->vaoSurfaces[i], tr.projectionShadowShader, 0, qfalse, qfalse, 0 );
+		}
+
+		// don't add third_person objects if not viewing through a portal
+		if ( !personalModel ) {
+			R_AddDrawSurf((void *)&model->vaoSurfaces[i], shader, fogNum, qfalse, qfalse, cubemapIndex );
 		}
 
 		surface++;
diff --git a/code/renderergl2/tr_shadows.c b/code/renderergl2/tr_shadows.c
index 7637175..520bc3f 100644
--- a/code/renderergl2/tr_shadows.c
+++ b/code/renderergl2/tr_shadows.c
@@ -162,7 +162,7 @@ void RB_ShadowTessEnd( void ) {
 		return;
 	}
 
-	VectorCopy( backEnd.currentEntity->lightDir, lightDir );
+	VectorCopy( backEnd.currentEntity->modelLightDir, lightDir );
 
 	// project vertexes away from light direction
 	for ( i = 0 ; i < tess.numVertexes ; i++ ) {
@@ -302,7 +302,7 @@ void RB_ProjectionShadowDeform( void ) {
 
 	groundDist = backEnd.or.origin[2] - backEnd.currentEntity->e.shadowPlane;
 
-	VectorCopy( backEnd.currentEntity->lightDir, lightDir );
+	VectorCopy( backEnd.currentEntity->modelLightDir, lightDir );
 	d = DotProduct( lightDir, ground );
 	// don't let the shadows get too long or go negative
 	if ( d < 0.5 ) {

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



More information about the Pkg-games-commits mailing list