mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
Minshade and maxshade parameters for dynamic lighthacks.
git-svn-id: https://svn.eduke32.com/eduke32@1302 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
35691be969
commit
6477b236b2
3 changed files with 41 additions and 7 deletions
|
@ -153,6 +153,7 @@ typedef struct s_prlight {
|
||||||
int32_t x, y, z, horiz, range;
|
int32_t x, y, z, horiz, range;
|
||||||
int16_t angle, faderadius, radius, sector;
|
int16_t angle, faderadius, radius, sector;
|
||||||
char color[3];
|
char color[3];
|
||||||
|
int8_t minshade, maxshade;
|
||||||
GLfloat proj[16];
|
GLfloat proj[16];
|
||||||
GLfloat transform[16];
|
GLfloat transform[16];
|
||||||
float frustum[5 * 4];
|
float frustum[5 * 4];
|
||||||
|
@ -317,6 +318,7 @@ static void polymer_compileprogram(int32_t programbits);
|
||||||
static int32_t polymer_planeinlight(_prplane* plane, _prlight* light);
|
static int32_t polymer_planeinlight(_prplane* plane, _prlight* light);
|
||||||
static void polymer_culllight(char lightindex);
|
static void polymer_culllight(char lightindex);
|
||||||
static void polymer_prepareshadows(void);
|
static void polymer_prepareshadows(void);
|
||||||
|
static void polymer_dostaticlights(void);
|
||||||
// RENDER TARGETS
|
// RENDER TARGETS
|
||||||
static void polymer_initrendertargets(int32_t count);
|
static void polymer_initrendertargets(int32_t count);
|
||||||
|
|
||||||
|
|
|
@ -7526,7 +7526,7 @@ int32_t loadmaphack(char *filename)
|
||||||
}
|
}
|
||||||
spriteext[whichsprite].flags |= SPREXT_AWAY2;
|
spriteext[whichsprite].flags |= SPREXT_AWAY2;
|
||||||
break;
|
break;
|
||||||
case T_LIGHT: // light sector x y z range r g b radius faderadius angle horiz
|
case T_LIGHT: // light sector x y z range r g b radius faderadius angle horiz minshade maxshade
|
||||||
{
|
{
|
||||||
int32_t value;
|
int32_t value;
|
||||||
|
|
||||||
|
@ -7554,6 +7554,10 @@ int32_t loadmaphack(char *filename)
|
||||||
staticlights[staticlightcount].angle = value;
|
staticlights[staticlightcount].angle = value;
|
||||||
scriptfile_getnumber(script, &value);
|
scriptfile_getnumber(script, &value);
|
||||||
staticlights[staticlightcount].horiz = value;
|
staticlights[staticlightcount].horiz = value;
|
||||||
|
scriptfile_getnumber(script, &value);
|
||||||
|
staticlights[staticlightcount].minshade = value;
|
||||||
|
scriptfile_getnumber(script, &value);
|
||||||
|
staticlights[staticlightcount].maxshade = value;
|
||||||
|
|
||||||
staticlightcount++;
|
staticlightcount++;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -697,12 +697,7 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
|
||||||
pos[1] = -(float)(daposz) / 16.0f;
|
pos[1] = -(float)(daposz) / 16.0f;
|
||||||
pos[2] = -daposx;
|
pos[2] = -daposx;
|
||||||
|
|
||||||
i = 0;
|
polymer_dostaticlights();
|
||||||
while (i < staticlightcount)
|
|
||||||
{
|
|
||||||
polymer_addlight(staticlights[i]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
depth = 0;
|
depth = 0;
|
||||||
polymer_prepareshadows();
|
polymer_prepareshadows();
|
||||||
|
@ -3980,6 +3975,39 @@ static void polymer_prepareshadows(void)
|
||||||
sinviewingrangeglobalang = osinviewingrangeglobalang;
|
sinviewingrangeglobalang = osinviewingrangeglobalang;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void polymer_dostaticlights(void)
|
||||||
|
{
|
||||||
|
int32_t i;
|
||||||
|
_prlight light;
|
||||||
|
float fade;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (i < staticlightcount)
|
||||||
|
{
|
||||||
|
if (staticlights[i].minshade == staticlights[i].maxshade)
|
||||||
|
polymer_addlight(staticlights[i]);
|
||||||
|
else {
|
||||||
|
light = staticlights[i];
|
||||||
|
|
||||||
|
fade = sector[light.sector].floorshade;
|
||||||
|
fade -= light.minshade;
|
||||||
|
fade /= light.maxshade - light.minshade;
|
||||||
|
|
||||||
|
if (fade < 0.0f)
|
||||||
|
fade = 0.0f;
|
||||||
|
if (fade > 1.0f)
|
||||||
|
fade = 1.0f;
|
||||||
|
|
||||||
|
light.color[0] *= fade;
|
||||||
|
light.color[1] *= fade;
|
||||||
|
light.color[2] *= fade;
|
||||||
|
|
||||||
|
polymer_addlight(light);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// RENDER TARGETS
|
// RENDER TARGETS
|
||||||
static void polymer_initrendertargets(int32_t count)
|
static void polymer_initrendertargets(int32_t count)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue