mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Lighthacks.
git-svn-id: https://svn.eduke32.com/eduke32@1288 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
13033e9c29
commit
6209446b1f
3 changed files with 55 additions and 13 deletions
|
@ -158,6 +158,9 @@ typedef struct s_prlight {
|
|||
int32_t rtindex;
|
||||
} _prlight;
|
||||
|
||||
extern _prlight staticlights[PR_MAXLIGHTS];
|
||||
extern int32_t staticlightcount;
|
||||
|
||||
// RENDER TARGETS
|
||||
typedef struct s_prrt {
|
||||
GLenum target;
|
||||
|
|
|
@ -7337,6 +7337,7 @@ int32_t loadmaphack(char *filename)
|
|||
T_MDZOFF,
|
||||
T_AWAY1,
|
||||
T_AWAY2,
|
||||
T_LIGHT,
|
||||
};
|
||||
|
||||
static struct { char *text; int32_t tokenid; } legaltokens[] =
|
||||
|
@ -7357,6 +7358,7 @@ int32_t loadmaphack(char *filename)
|
|||
{ "mdzoff", T_MDZOFF },
|
||||
{ "away1", T_AWAY1 },
|
||||
{ "away2", T_AWAY2 },
|
||||
{ "light", T_LIGHT },
|
||||
{ NULL, -1 }
|
||||
};
|
||||
|
||||
|
@ -7371,6 +7373,8 @@ int32_t loadmaphack(char *filename)
|
|||
memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES);
|
||||
memset(spritesmooth, 0, sizeof(spritesmooth));
|
||||
|
||||
staticlightcount = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
tok = scriptfile_gettoken(script);
|
||||
|
@ -7522,6 +7526,38 @@ int32_t loadmaphack(char *filename)
|
|||
}
|
||||
spriteext[whichsprite].flags |= SPREXT_AWAY2;
|
||||
break;
|
||||
case T_LIGHT: // light sector x y z range r g b radius faderadius angle horiz
|
||||
{
|
||||
int32_t value;
|
||||
|
||||
scriptfile_getnumber(script, &value);
|
||||
staticlights[staticlightcount].sector = value;
|
||||
scriptfile_getnumber(script, &value);
|
||||
staticlights[staticlightcount].x = value;
|
||||
scriptfile_getnumber(script, &value);
|
||||
staticlights[staticlightcount].y = value;
|
||||
scriptfile_getnumber(script, &value);
|
||||
staticlights[staticlightcount].z = value;
|
||||
scriptfile_getnumber(script, &value);
|
||||
staticlights[staticlightcount].range = value;
|
||||
scriptfile_getnumber(script, &value);
|
||||
staticlights[staticlightcount].color[0] = value;
|
||||
scriptfile_getnumber(script, &value);
|
||||
staticlights[staticlightcount].color[1] = value;
|
||||
scriptfile_getnumber(script, &value);
|
||||
staticlights[staticlightcount].color[2] = value;
|
||||
scriptfile_getnumber(script, &value);
|
||||
staticlights[staticlightcount].radius = value;
|
||||
scriptfile_getnumber(script, &value);
|
||||
staticlights[staticlightcount].faderadius = value;
|
||||
scriptfile_getnumber(script, &value);
|
||||
staticlights[staticlightcount].angle = value;
|
||||
scriptfile_getnumber(script, &value);
|
||||
staticlights[staticlightcount].horiz = value;
|
||||
|
||||
staticlightcount++;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
// unrecognised token
|
||||
|
|
|
@ -130,6 +130,10 @@ _prlight prlights[PR_MAXLIGHTS];
|
|||
int32_t lightcount;
|
||||
int32_t curlight;
|
||||
|
||||
_prlight staticlights[PR_MAXLIGHTS];
|
||||
int32_t staticlightcount;
|
||||
|
||||
|
||||
GLfloat shadowBias[] =
|
||||
{
|
||||
0.5, 0.0, 0.0, 0.0,
|
||||
|
@ -661,6 +665,13 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
|
|||
pos[1] = -(float)(daposz) / 16.0f;
|
||||
pos[2] = -daposx;
|
||||
|
||||
i = 0;
|
||||
while (i < staticlightcount)
|
||||
{
|
||||
polymer_addlight(staticlights[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
depth = 0;
|
||||
polymer_prepareshadows();
|
||||
|
||||
|
@ -1118,14 +1129,6 @@ static void polymer_displayrooms(int16_t dacursectnum)
|
|||
polymer_drawsector(sectorqueue[front]);
|
||||
polymer_scansprites(sectorqueue[front], localtsprite, &localspritesortcnt);
|
||||
|
||||
// if (!depth && sectorqueue[front] == dacursectnum)
|
||||
// {
|
||||
// mirrorlist[mirrorcount].plane = &prsectors[sectorqueue[front]]->floor;
|
||||
// mirrorlist[mirrorcount].sectnum = sectorqueue[front];
|
||||
// mirrorlist[mirrorcount].wallnum = -1;
|
||||
// mirrorcount++;
|
||||
// }
|
||||
|
||||
doquery = 0;
|
||||
|
||||
i = 0;
|
||||
|
@ -1424,7 +1427,7 @@ static void polymer_drawplane(_prplane* plane)
|
|||
|
||||
curlight = 0;
|
||||
|
||||
while ((curlight == 0) || (curlight < plane->lightcount))
|
||||
while ((curlight == 0) || ((curlight < plane->lightcount) && (curlight < pr_occlusionculling)))
|
||||
{
|
||||
materialbits = polymer_bindmaterial(plane->material, plane->lights, plane->lightcount);
|
||||
|
||||
|
@ -3013,7 +3016,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
|||
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m->indices[surfi]);
|
||||
|
||||
curlight = 0;
|
||||
while ((curlight == 0) || (curlight < modellightcount))
|
||||
while ((curlight == 0) || ((curlight < modellightcount) && (curlight < pr_occlusionculling)))
|
||||
{
|
||||
materialbits = polymer_bindmaterial(mdspritematerial, modellights, modellightcount);
|
||||
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, 0);
|
||||
|
@ -3038,7 +3041,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
|||
}
|
||||
|
||||
curlight = 0;
|
||||
while ((curlight == 0) || (curlight < modellightcount))
|
||||
while ((curlight == 0) || ((curlight < modellightcount) && (curlight < pr_occlusionculling)))
|
||||
{
|
||||
materialbits = polymer_bindmaterial(mdspritematerial, modellights, modellightcount);
|
||||
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, s->tris);
|
||||
|
@ -3450,7 +3453,7 @@ static int32_t polymer_bindmaterial(_prmaterial material, char* lights, int
|
|||
inpos[1] = -prlights[lights[curlight]].z / 16.0f;
|
||||
inpos[2] = -prlights[lights[curlight]].x;
|
||||
|
||||
polymer_transformpoint(inpos, pos, rootmodelviewmatrix);
|
||||
polymer_transformpoint(inpos, pos, curmodelviewmatrix);
|
||||
|
||||
// PR_BIT_SPOT_LIGHT
|
||||
if (programbits & prprogrambits[PR_BIT_SPOT_LIGHT].bit)
|
||||
|
@ -3467,7 +3470,7 @@ static int32_t polymer_bindmaterial(_prmaterial material, char* lights, int
|
|||
indir[1] = inpos[1] - coshorizangs;
|
||||
indir[2] = inpos[2] - sinhorizang * sinang;
|
||||
|
||||
polymer_transformpoint(indir, dir, rootmodelviewmatrix);
|
||||
polymer_transformpoint(indir, dir, curmodelviewmatrix);
|
||||
|
||||
dir[0] -= pos[0];
|
||||
dir[1] -= pos[1];
|
||||
|
|
Loading…
Reference in a new issue