mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@1331 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
45897cf581
commit
779eda41da
2 changed files with 73 additions and 47 deletions
|
@ -3,8 +3,8 @@
|
||||||
ENGINELIB=libengine.a
|
ENGINELIB=libengine.a
|
||||||
EDITORLIB=libbuild.a
|
EDITORLIB=libbuild.a
|
||||||
|
|
||||||
SDLCONFIG = /usr/local/bin/sdl-config
|
# SDLCONFIG = /usr/local/bin/sdl-config
|
||||||
# SDLCONFIG = sdl-config
|
SDLCONFIG = sdl-config
|
||||||
|
|
||||||
ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG))
|
ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG))
|
||||||
SDLROOT = /usr/local
|
SDLROOT = /usr/local
|
||||||
|
|
|
@ -665,6 +665,7 @@ void polymer_loadboard(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
polymer_getsky();
|
polymer_getsky();
|
||||||
|
polymer_resetlights();
|
||||||
|
|
||||||
if (pr_verbosity >= 1) OSD_Printf("PR : Board loaded.\n");
|
if (pr_verbosity >= 1) OSD_Printf("PR : Board loaded.\n");
|
||||||
}
|
}
|
||||||
|
@ -695,7 +696,7 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
|
||||||
|
|
||||||
depth = 0;
|
depth = 0;
|
||||||
|
|
||||||
if (pr_shadows)
|
if (pr_shadows && lightcount > 0 && pr_shadowcount > 0)
|
||||||
polymer_prepareshadows();
|
polymer_prepareshadows();
|
||||||
|
|
||||||
bglMatrixMode(GL_MODELVIEW);
|
bglMatrixMode(GL_MODELVIEW);
|
||||||
|
@ -982,11 +983,12 @@ void polymer_drawsprite(int32_t snum)
|
||||||
bglPopMatrix();
|
bglPopMatrix();
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < 4)
|
do
|
||||||
{
|
{
|
||||||
polymer_transformpoint(&inbuffer[i * 5], &spriteplane.buffer[i * 5], spritemodelview);
|
polymer_transformpoint(&inbuffer[i * 5], &spriteplane.buffer[i * 5], spritemodelview);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
while (i < 4);
|
||||||
|
|
||||||
polymer_buffertoplane(spriteplane.buffer, NULL, 4, spriteplane.plane, spriteplane.t, spriteplane.b, spriteplane.n);
|
polymer_buffertoplane(spriteplane.buffer, NULL, 4, spriteplane.plane, spriteplane.t, spriteplane.b, spriteplane.n);
|
||||||
|
|
||||||
|
@ -1071,7 +1073,7 @@ static void polymer_displayrooms(int16_t dacursectnum)
|
||||||
// depth-only occlusion testing pass
|
// depth-only occlusion testing pass
|
||||||
// overridematerial = 0;
|
// overridematerial = 0;
|
||||||
|
|
||||||
while (front != back)
|
do
|
||||||
{
|
{
|
||||||
sec = §or[sectorqueue[front]];
|
sec = §or[sectorqueue[front]];
|
||||||
|
|
||||||
|
@ -1082,7 +1084,7 @@ static void polymer_displayrooms(int16_t dacursectnum)
|
||||||
doquery = 0;
|
doquery = 0;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < sec->wallnum)
|
do
|
||||||
{
|
{
|
||||||
polymer_drawwall(sectorqueue[front], sec->wallptr + i);
|
polymer_drawwall(sectorqueue[front], sec->wallptr + i);
|
||||||
|
|
||||||
|
@ -1093,9 +1095,10 @@ static void polymer_displayrooms(int16_t dacursectnum)
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
while (i < sec->wallnum);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < sec->wallnum)
|
do
|
||||||
{
|
{
|
||||||
if ((wall[sec->wallptr + i].nextsector != -1) &&
|
if ((wall[sec->wallptr + i].nextsector != -1) &&
|
||||||
(wallvisible(sec->wallptr + i)) &&
|
(wallvisible(sec->wallptr + i)) &&
|
||||||
|
@ -1184,9 +1187,10 @@ static void polymer_displayrooms(int16_t dacursectnum)
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
while (i < sec->wallnum);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < sec->wallnum)
|
do
|
||||||
{
|
{
|
||||||
if ((queryid[sec->wallptr + i]) &&
|
if ((queryid[sec->wallptr + i]) &&
|
||||||
(!drawingstate[wall[sec->wallptr + i].nextsector]))
|
(!drawingstate[wall[sec->wallptr + i].nextsector]))
|
||||||
|
@ -1213,9 +1217,11 @@ static void polymer_displayrooms(int16_t dacursectnum)
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
while (i < sec->wallnum);
|
||||||
|
|
||||||
front++;
|
front++;
|
||||||
}
|
}
|
||||||
|
while (front != back);
|
||||||
|
|
||||||
// do the actual shaded drawing
|
// do the actual shaded drawing
|
||||||
// overridematerial = 0xFFFFFFFF;
|
// overridematerial = 0xFFFFFFFF;
|
||||||
|
@ -1318,9 +1324,9 @@ static void polymer_displayrooms(int16_t dacursectnum)
|
||||||
}
|
}
|
||||||
|
|
||||||
spritesortcnt = localspritesortcnt;
|
spritesortcnt = localspritesortcnt;
|
||||||
Bmemcpy(tsprite, localtsprite, sizeof(spritetype) * MAXSPRITESONSCREEN);
|
Bmemcpy(tsprite, localtsprite, sizeof(spritetype) * localspritesortcnt);
|
||||||
maskwallcnt = localmaskwallcnt;
|
maskwallcnt = localmaskwallcnt;
|
||||||
Bmemcpy(maskwall, localmaskwall, sizeof(int16_t) * MAXWALLSB);
|
Bmemcpy(maskwall, localmaskwall, sizeof(int16_t) * localmaskwallcnt);
|
||||||
|
|
||||||
if (depth)
|
if (depth)
|
||||||
{
|
{
|
||||||
|
@ -1404,7 +1410,7 @@ static void polymer_drawplane(_prplane* plane)
|
||||||
|
|
||||||
curlight = 0;
|
curlight = 0;
|
||||||
|
|
||||||
while ((curlight == 0) || ((curlight < plane->lightcount) && (curlight < pr_maxlightpasses)))
|
do
|
||||||
{
|
{
|
||||||
materialbits = polymer_bindmaterial(plane->material, plane->lights, plane->lightcount);
|
materialbits = polymer_bindmaterial(plane->material, plane->lights, plane->lightcount);
|
||||||
|
|
||||||
|
@ -1428,6 +1434,7 @@ static void polymer_drawplane(_prplane* plane)
|
||||||
|
|
||||||
curlight++;
|
curlight++;
|
||||||
}
|
}
|
||||||
|
while ((curlight == 0) || ((curlight < plane->lightcount) && (curlight < pr_maxlightpasses)));
|
||||||
|
|
||||||
if (plane->vbo && (pr_vbos > 0))
|
if (plane->vbo && (pr_vbos > 0))
|
||||||
{
|
{
|
||||||
|
@ -1555,7 +1562,7 @@ static int32_t polymer_updatesector(int16_t sectnum)
|
||||||
// geometry
|
// geometry
|
||||||
wal = &wall[sec->wallptr];
|
wal = &wall[sec->wallptr];
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < sec->wallnum)
|
do
|
||||||
{
|
{
|
||||||
if ((-wal->x != s->verts[(i*3)+2]))
|
if ((-wal->x != s->verts[(i*3)+2]))
|
||||||
{
|
{
|
||||||
|
@ -1571,6 +1578,7 @@ static int32_t polymer_updatesector(int16_t sectnum)
|
||||||
i++;
|
i++;
|
||||||
wal = &wall[sec->wallptr + i];
|
wal = &wall[sec->wallptr + i];
|
||||||
}
|
}
|
||||||
|
while (i < sec->wallnum);
|
||||||
|
|
||||||
if ((s->controlstate == 2) ||
|
if ((s->controlstate == 2) ||
|
||||||
needfloor ||
|
needfloor ||
|
||||||
|
@ -1583,7 +1591,7 @@ static int32_t polymer_updatesector(int16_t sectnum)
|
||||||
|
|
||||||
wal = &wall[sec->wallptr];
|
wal = &wall[sec->wallptr];
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < sec->wallnum)
|
do
|
||||||
{
|
{
|
||||||
getzsofslope(sectnum, wal->x, wal->y, &ceilz, &florz);
|
getzsofslope(sectnum, wal->x, wal->y, &ceilz, &florz);
|
||||||
s->floor.buffer[(i*5)+1] = -(float)(florz) / 16.0f;
|
s->floor.buffer[(i*5)+1] = -(float)(florz) / 16.0f;
|
||||||
|
@ -1592,6 +1600,7 @@ static int32_t polymer_updatesector(int16_t sectnum)
|
||||||
i++;
|
i++;
|
||||||
wal = &wall[sec->wallptr + i];
|
wal = &wall[sec->wallptr + i];
|
||||||
}
|
}
|
||||||
|
while (i < sec->wallnum);
|
||||||
|
|
||||||
s->floorz = sec->floorz;
|
s->floorz = sec->floorz;
|
||||||
s->ceilingz = sec->ceilingz;
|
s->ceilingz = sec->ceilingz;
|
||||||
|
@ -1617,7 +1626,7 @@ static int32_t polymer_updatesector(int16_t sectnum)
|
||||||
|
|
||||||
wal = &wall[sec->wallptr];
|
wal = &wall[sec->wallptr];
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < sec->wallnum)
|
do
|
||||||
{
|
{
|
||||||
j = 2;
|
j = 2;
|
||||||
curstat = sec->floorstat;
|
curstat = sec->floorstat;
|
||||||
|
@ -1626,7 +1635,7 @@ static int32_t polymer_updatesector(int16_t sectnum)
|
||||||
curxpanning = sec->floorxpanning;
|
curxpanning = sec->floorxpanning;
|
||||||
curypanning = sec->floorypanning;
|
curypanning = sec->floorypanning;
|
||||||
|
|
||||||
while (j)
|
do
|
||||||
{
|
{
|
||||||
if (j == 1)
|
if (j == 1)
|
||||||
{
|
{
|
||||||
|
@ -1687,9 +1696,11 @@ static int32_t polymer_updatesector(int16_t sectnum)
|
||||||
|
|
||||||
j--;
|
j--;
|
||||||
}
|
}
|
||||||
|
while (j);
|
||||||
i++;
|
i++;
|
||||||
wal = &wall[sec->wallptr + i];
|
wal = &wall[sec->wallptr + i];
|
||||||
}
|
}
|
||||||
|
while (i < sec->wallnum);
|
||||||
|
|
||||||
s->floorstat = sec->floorstat;
|
s->floorstat = sec->floorstat;
|
||||||
s->ceilingstat = sec->ceilingstat;
|
s->ceilingstat = sec->ceilingstat;
|
||||||
|
@ -2407,7 +2418,7 @@ static void polymer_buffertoplane(GLfloat* buffer, GLushort* indices, in
|
||||||
return; // corrupt sector (E3L4, I'm looking at you)
|
return; // corrupt sector (E3L4, I'm looking at you)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
do
|
while (i < indicecount)
|
||||||
{
|
{
|
||||||
vec1[0] = buffer[(INDICE(1)) + 0] - buffer[(INDICE(0)) + 0]; //x1
|
vec1[0] = buffer[(INDICE(1)) + 0] - buffer[(INDICE(0)) + 0]; //x1
|
||||||
vec1[1] = buffer[(INDICE(1)) + 1] - buffer[(INDICE(0)) + 1]; //y1
|
vec1[1] = buffer[(INDICE(1)) + 1] - buffer[(INDICE(0)) + 1]; //y1
|
||||||
|
@ -2428,10 +2439,10 @@ static void polymer_buffertoplane(GLfloat* buffer, GLushort* indices, in
|
||||||
if (norm >= 15000) // hack to work around a precision issue with slopes
|
if (norm >= 15000) // hack to work around a precision issue with slopes
|
||||||
{
|
{
|
||||||
// normalize the normal/plane equation and calculate its plane norm
|
// normalize the normal/plane equation and calculate its plane norm
|
||||||
norm = -sqrt(norm);
|
norm = 1.0f/(-sqrt(norm));
|
||||||
plane[0] /= norm;
|
plane[0] *= norm;
|
||||||
plane[1] /= norm;
|
plane[1] *= norm;
|
||||||
plane[2] /= norm;
|
plane[2] *= norm;
|
||||||
plane[3] = -(plane[0] * buffer[0] + plane[1] * buffer[1] + plane[2] * buffer[2]);
|
plane[3] = -(plane[0] * buffer[0] + plane[1] * buffer[1] + plane[2] * buffer[2]);
|
||||||
|
|
||||||
// calculate T and B
|
// calculate T and B
|
||||||
|
@ -2471,28 +2482,27 @@ static void polymer_buffertoplane(GLfloat* buffer, GLushort* indices, in
|
||||||
|
|
||||||
// normalize T, B and N
|
// normalize T, B and N
|
||||||
norm = t[0] * t[0] + t[1] * t[1] + t[2] * t[2];
|
norm = t[0] * t[0] + t[1] * t[1] + t[2] * t[2];
|
||||||
norm = sqrt(norm);
|
norm = 1.0f/sqrt(norm);
|
||||||
t[0] /= norm;
|
t[0] *= norm;
|
||||||
t[1] /= norm;
|
t[1] *= norm;
|
||||||
t[2] /= norm;
|
t[2] *= norm;
|
||||||
|
|
||||||
norm = b[0] * b[0] + b[1] * b[1] + b[2] * b[2];
|
norm = b[0] * b[0] + b[1] * b[1] + b[2] * b[2];
|
||||||
norm = sqrt(norm);
|
norm = 1.0f/sqrt(norm);
|
||||||
b[0] /= norm;
|
b[0] *= norm;
|
||||||
b[1] /= norm;
|
b[1] *= norm;
|
||||||
b[2] /= norm;
|
b[2] *= norm;
|
||||||
|
|
||||||
norm = n[0] * n[0] + n[1] * n[1] + n[2] * n[2];
|
norm = n[0] * n[0] + n[1] * n[1] + n[2] * n[2];
|
||||||
norm = sqrt(norm);
|
norm = 1.0f/sqrt(norm);
|
||||||
n[0] /= norm;
|
n[0] *= norm;
|
||||||
n[1] /= norm;
|
n[1] *= norm;
|
||||||
n[2] /= norm;
|
n[2] *= norm;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i+= 3;
|
i+= 3;
|
||||||
}
|
}
|
||||||
while (i < indicecount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void polymer_crossproduct(GLfloat* in_a, GLfloat* in_b, GLfloat* out)
|
static inline void polymer_crossproduct(GLfloat* in_a, GLfloat* in_b, GLfloat* out)
|
||||||
|
@ -2670,7 +2680,7 @@ static void polymer_drawartsky(int16_t tilenum)
|
||||||
GLfloat height = 2.45f / 2.0f;
|
GLfloat height = 2.45f / 2.0f;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < 5)
|
do
|
||||||
{
|
{
|
||||||
if (!waloff[tilenum + i])
|
if (!waloff[tilenum + i])
|
||||||
loadtile(tilenum + i);
|
loadtile(tilenum + i);
|
||||||
|
@ -2678,15 +2688,17 @@ static void polymer_drawartsky(int16_t tilenum)
|
||||||
glpics[i] = pth ? pth->glpic : 0;
|
glpics[i] = pth ? pth->glpic : 0;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
while (i < 5);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
j = (1<<pskybits);
|
j = (1<<pskybits);
|
||||||
while (i < j)
|
do
|
||||||
{
|
{
|
||||||
bglBindTexture(GL_TEXTURE_2D, glpics[pskyoff[i]]);
|
bglBindTexture(GL_TEXTURE_2D, glpics[pskyoff[i]]);
|
||||||
polymer_drawartskyquad(i, (i + 1) & (j - 1), height);
|
polymer_drawartskyquad(i, (i + 1) & (j - 1), height);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
while (i < j);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void polymer_drawartskyquad(int32_t p1, int32_t p2, GLfloat height)
|
static void polymer_drawartskyquad(int32_t p1, int32_t p2, GLfloat height)
|
||||||
|
@ -2726,7 +2738,7 @@ static void polymer_drawskybox(int16_t tilenum)
|
||||||
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, skyboxdatavbo);
|
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, skyboxdatavbo);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < 6)
|
do
|
||||||
{
|
{
|
||||||
drawingskybox = i + 1;
|
drawingskybox = i + 1;
|
||||||
pth = gltexcache(tilenum, 0, 4);
|
pth = gltexcache(tilenum, 0, 4);
|
||||||
|
@ -2744,6 +2756,7 @@ static void polymer_drawskybox(int16_t tilenum)
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
while (i < 6);
|
||||||
drawingskybox = 0;
|
drawingskybox = 0;
|
||||||
|
|
||||||
if (pr_vbos > 0)
|
if (pr_vbos > 0)
|
||||||
|
@ -2875,14 +2888,15 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
||||||
else globalnoeffect=1; //mdloadskin reads this
|
else globalnoeffect=1; //mdloadskin reads this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
color[3] = 1.0;
|
||||||
|
|
||||||
if (tspr->cstat & 2)
|
if (tspr->cstat & 2)
|
||||||
{
|
{
|
||||||
if (!(tspr->cstat&512))
|
if (!(tspr->cstat&512))
|
||||||
color[3] = 0.66;
|
color[3] = 0.66;
|
||||||
else
|
else
|
||||||
color[3] = 0.33;
|
color[3] = 0.33;
|
||||||
} else
|
}
|
||||||
color[3] = 1.0;
|
|
||||||
|
|
||||||
if (pr_gpusmoothing)
|
if (pr_gpusmoothing)
|
||||||
mdspritematerial.frameprogress = m->interpol;
|
mdspritematerial.frameprogress = m->interpol;
|
||||||
|
@ -3018,7 +3032,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
||||||
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m->indices[surfi]);
|
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m->indices[surfi]);
|
||||||
|
|
||||||
curlight = 0;
|
curlight = 0;
|
||||||
while ((curlight == 0) || ((curlight < modellightcount) && (curlight < pr_maxlightpasses)))
|
do
|
||||||
{
|
{
|
||||||
materialbits = polymer_bindmaterial(mdspritematerial, modellights, modellightcount);
|
materialbits = polymer_bindmaterial(mdspritematerial, modellights, modellightcount);
|
||||||
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, 0);
|
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, 0);
|
||||||
|
@ -3026,6 +3040,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
||||||
|
|
||||||
curlight++;
|
curlight++;
|
||||||
}
|
}
|
||||||
|
while ((curlight == 0) || ((curlight < modellightcount) && (curlight < pr_maxlightpasses)));
|
||||||
|
|
||||||
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||||
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||||
|
@ -3043,7 +3058,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
||||||
}
|
}
|
||||||
|
|
||||||
curlight = 0;
|
curlight = 0;
|
||||||
while ((curlight == 0) || ((curlight < modellightcount) && (curlight < pr_maxlightpasses)))
|
do
|
||||||
{
|
{
|
||||||
materialbits = polymer_bindmaterial(mdspritematerial, modellights, modellightcount);
|
materialbits = polymer_bindmaterial(mdspritematerial, modellights, modellightcount);
|
||||||
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, s->tris);
|
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, s->tris);
|
||||||
|
@ -3051,6 +3066,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
||||||
|
|
||||||
curlight++;
|
curlight++;
|
||||||
}
|
}
|
||||||
|
while ((curlight == 0) || ((curlight < modellightcount) && (curlight < pr_maxlightpasses)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bglDisableClientState(GL_NORMAL_ARRAY);
|
bglDisableClientState(GL_NORMAL_ARRAY);
|
||||||
|
@ -3752,7 +3768,7 @@ static void polymer_resetlights(void)
|
||||||
|
|
||||||
static void polymer_addlight(_prlight light)
|
static void polymer_addlight(_prlight light)
|
||||||
{
|
{
|
||||||
if (light.sector == -1)
|
if (light.sector == -1 || light.sector >= numsectors)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (lightcount < PR_MAXLIGHTS)
|
if (lightcount < PR_MAXLIGHTS)
|
||||||
|
@ -3807,7 +3823,7 @@ static void polymer_addlight(_prlight light)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t polymer_planeinlight(_prplane* plane, _prlight* light)
|
static int32_t polymer_planeinlight(_prplane* plane, _prlight* light)
|
||||||
{
|
{
|
||||||
float lightpos[3];
|
float lightpos[3];
|
||||||
int i, j, k, l;
|
int i, j, k, l;
|
||||||
|
@ -3815,28 +3831,33 @@ static int32_t polymer_planeinlight(_prplane* plane, _prlight* light)
|
||||||
if (light->radius)
|
if (light->radius)
|
||||||
return polymer_planeinfrustum(plane, light->frustum);
|
return polymer_planeinfrustum(plane, light->frustum);
|
||||||
|
|
||||||
|
if (plane->vertcount < 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
lightpos[0] = light->y;
|
lightpos[0] = light->y;
|
||||||
lightpos[1] = -light->z / 16.0f;
|
lightpos[1] = -light->z / 16.0f;
|
||||||
lightpos[2] = -light->x;
|
lightpos[2] = -light->x;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
while (i < 3)
|
do
|
||||||
{
|
{
|
||||||
j = k = l = 0;
|
j = k = l = 0;
|
||||||
|
|
||||||
while (j < plane->vertcount)
|
do
|
||||||
{
|
{
|
||||||
if (plane->buffer[(j * 5) + i] > (lightpos[i] + light->range)) k++;
|
if (plane->buffer[(j * 5) + i] > (lightpos[i] + light->range)) k++;
|
||||||
if (plane->buffer[(j * 5) + i] < (lightpos[i] - light->range)) l++;
|
if (plane->buffer[(j * 5) + i] < (lightpos[i] - light->range)) l++;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
while (j < plane->vertcount);
|
||||||
|
|
||||||
if ((k == plane->vertcount) || (l == plane->vertcount))
|
if ((k == plane->vertcount) || (l == plane->vertcount))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
while (i < 3);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -3857,11 +3878,13 @@ static inline void polymer_culllight(char lightindex)
|
||||||
front = 0;
|
front = 0;
|
||||||
back = 1;
|
back = 1;
|
||||||
Bmemset(cullingstate, 0, sizeof(int16_t) * MAXSECTORS);
|
Bmemset(cullingstate, 0, sizeof(int16_t) * MAXSECTORS);
|
||||||
|
Bmemset(sectorqueue, 0, sizeof(int16_t) * MAXSECTORS);
|
||||||
|
|
||||||
cullingstate[light->sector] = 1;
|
cullingstate[light->sector] = 1;
|
||||||
|
|
||||||
sectorqueue[0] = light->sector;
|
sectorqueue[0] = light->sector;
|
||||||
|
|
||||||
while (front != back)
|
do
|
||||||
{
|
{
|
||||||
s = prsectors[sectorqueue[front]];
|
s = prsectors[sectorqueue[front]];
|
||||||
sec = §or[sectorqueue[front]];
|
sec = §or[sectorqueue[front]];
|
||||||
|
@ -3882,7 +3905,7 @@ static inline void polymer_culllight(char lightindex)
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < sec->wallnum)
|
do
|
||||||
{
|
{
|
||||||
w = prwalls[sec->wallptr + i];
|
w = prwalls[sec->wallptr + i];
|
||||||
|
|
||||||
|
@ -3922,8 +3945,10 @@ static inline void polymer_culllight(char lightindex)
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
while (i < sec->wallnum);
|
||||||
front++;
|
front++;
|
||||||
}
|
}
|
||||||
|
while (front != back);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void polymer_prepareshadows(void)
|
static void polymer_prepareshadows(void)
|
||||||
|
@ -4027,7 +4052,7 @@ static void polymer_applylights(void)
|
||||||
float fade;
|
float fade;
|
||||||
|
|
||||||
curpriority = 0;
|
curpriority = 0;
|
||||||
while (curpriority < PR_MAXLIGHTPRIORITY)
|
do
|
||||||
{
|
{
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < staticlightcount)
|
while (i < staticlightcount)
|
||||||
|
@ -4091,6 +4116,7 @@ static void polymer_applylights(void)
|
||||||
}
|
}
|
||||||
curpriority++;
|
curpriority++;
|
||||||
}
|
}
|
||||||
|
while (curpriority < PR_MAXLIGHTPRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// RENDER TARGETS
|
// RENDER TARGETS
|
||||||
|
|
Loading…
Reference in a new issue