Fixes shadow bug.

git-svn-id: https://svn.eduke32.com/eduke32@1290 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2009-04-01 17:58:22 +00:00
parent 9c03ef1101
commit a4c5af4d37

View file

@ -3803,10 +3803,25 @@ static void polymer_culllight(char lightindex)
static void polymer_prepareshadows(void) static void polymer_prepareshadows(void)
{ {
int16_t oviewangle, oglobalang;
int32_t ocosglobalang, osinglobalang;
int32_t ocosviewingrangeglobalang, osinviewingrangeglobalang;
int32_t i, j; int32_t i, j;
int32_t gx, gy, gz; int32_t gx, gy, gz;
int32_t oldoverridematerial; int32_t oldoverridematerial;
// for wallvisible()
gx = globalposx;
gy = globalposy;
gz = globalposz;
// build globals used by drawmasks
oviewangle = viewangle;
oglobalang = globalang;
ocosglobalang = cosglobalang;
osinglobalang = singlobalang;
ocosviewingrangeglobalang = cosviewingrangeglobalang;
osinviewingrangeglobalang = sinviewingrangeglobalang;
i = j = 0; i = j = 0;
while ((i < lightcount) && (j < 4)) while ((i < lightcount) && (j < 4))
@ -3830,10 +3845,17 @@ static void polymer_prepareshadows(void)
bglEnable(GL_POLYGON_OFFSET_FILL); bglEnable(GL_POLYGON_OFFSET_FILL);
bglPolygonOffset(5, SHADOW_DEPTH_OFFSET); bglPolygonOffset(5, SHADOW_DEPTH_OFFSET);
// for wallvisible() globalposx = prlights[i].x;
gx = globalposx; globalposy = prlights[i].y;
gy = globalposy; globalposz = prlights[i].z;
gz = globalposz;
// build globals used by rotatesprite
viewangle = prlights[i].angle;
globalang = (prlights[i].angle&2047);
cosglobalang = sintable[(globalang+512)&2047];
singlobalang = sintable[globalang&2047];
cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange);
sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange);
oldoverridematerial = overridematerial; oldoverridematerial = overridematerial;
// smooth model shadows // smooth model shadows
@ -3848,10 +3870,6 @@ static void polymer_prepareshadows(void)
overridematerial = oldoverridematerial; overridematerial = oldoverridematerial;
globalposx = gx;
globalposy = gy;
globalposz = gz;
bglDisable(GL_POLYGON_OFFSET_FILL); bglDisable(GL_POLYGON_OFFSET_FILL);
bglMatrixMode(GL_PROJECTION); bglMatrixMode(GL_PROJECTION);
@ -3864,6 +3882,17 @@ static void polymer_prepareshadows(void)
} }
i++; i++;
} }
globalposx = gx;
globalposy = gy;
globalposz = gz;
viewangle = oviewangle;
globalang = oglobalang;
cosglobalang = ocosglobalang;
singlobalang = osinglobalang;
cosviewingrangeglobalang = ocosviewingrangeglobalang;
sinviewingrangeglobalang = osinviewingrangeglobalang;
} }
// RENDER TARGETS // RENDER TARGETS