From a4141bfaf51570dd3d691d7ceb76339080c0192c Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 15 Oct 2004 06:53:41 +0000 Subject: [PATCH] revert an optimization to shadow volume generation that saved a little cpu time but cost a lot of gpu fillrate, and caused shadows to randomly invert sometimes git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4629 d7cf8633-e32d-0410-b094-e92efae38249 --- r_shadow.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/r_shadow.c b/r_shadow.c index ad071ac8..12da8519 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -503,6 +503,7 @@ void R_Shadow_PrepareShadowMark(int numtris) int R_Shadow_ConstructShadowVolume(int innumvertices, int innumtris, const int *inelement3i, const int *inneighbor3i, const float *invertex3f, int *outnumvertices, int *outelement3i, float *outvertex3f, const float *projectorigin, float projectdistance, int numshadowmarktris, const int *shadowmarktris) { int i, j, tris = 0, vr[3], t, outvertices = 0; + float f, temp[3]; const int *e, *n; const float *v; @@ -540,22 +541,12 @@ int R_Shadow_ConstructShadowVolume(int innumvertices, int innumtris, const int * vertexupdate[e[j]] = vertexupdatenum; vertexremap[e[j]] = outvertices; v = invertex3f + e[j] * 3; -#if 1 - outvertex3f[0] = v[0]; - outvertex3f[1] = v[1]; - outvertex3f[2] = v[2]; - outvertex3f[3] = v[0] + 1000000 * (v[0] - projectorigin[0]); - outvertex3f[4] = v[1] + 1000000 * (v[1] - projectorigin[1]); - outvertex3f[5] = v[2] + 1000000 * (v[2] - projectorigin[2]); -#else -{ -float f, temp[3]; + // project one copy of the vertex to the sphere radius of the light + // (FIXME: would projecting it to the light box be better?) VectorSubtract(v, projectorigin, temp); f = projectdistance / VectorLength(temp); VectorCopy(v, outvertex3f); VectorMA(projectorigin, f, temp, (outvertex3f + 3)); -} -#endif outvertex3f += 6; outvertices += 2; } -- 2.39.2