mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Light priority system.
git-svn-id: https://svn.eduke32.com/eduke32@1305 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
567c0bdd86
commit
b7449a87b9
5 changed files with 76 additions and 38 deletions
|
@ -148,11 +148,12 @@ typedef struct s_prprogrambit {
|
||||||
// LIGHTS
|
// LIGHTS
|
||||||
#define PR_MAXLIGHTS 128
|
#define PR_MAXLIGHTS 128
|
||||||
#define SHADOW_DEPTH_OFFSET 30
|
#define SHADOW_DEPTH_OFFSET 30
|
||||||
|
#define PR_MAXLIGHTPRIORITY 3
|
||||||
|
|
||||||
typedef struct s_prlight {
|
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], priority;
|
||||||
int8_t minshade, maxshade;
|
int8_t minshade, maxshade;
|
||||||
GLfloat proj[16];
|
GLfloat proj[16];
|
||||||
GLfloat transform[16];
|
GLfloat transform[16];
|
||||||
|
@ -324,7 +325,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);
|
||||||
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);
|
static void polymer_applylights(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 minshade maxshade
|
case T_LIGHT: // light sector x y z range r g b radius faderadius angle horiz minshade maxshade priority
|
||||||
{
|
{
|
||||||
int32_t value;
|
int32_t value;
|
||||||
|
|
||||||
|
@ -7558,6 +7558,8 @@ int32_t loadmaphack(char *filename)
|
||||||
staticlights[staticlightcount].minshade = value;
|
staticlights[staticlightcount].minshade = value;
|
||||||
scriptfile_getnumber(script, &value);
|
scriptfile_getnumber(script, &value);
|
||||||
staticlights[staticlightcount].maxshade = value;
|
staticlights[staticlightcount].maxshade = value;
|
||||||
|
scriptfile_getnumber(script, &value);
|
||||||
|
staticlights[staticlightcount].priority = value;
|
||||||
|
|
||||||
staticlightcount++;
|
staticlightcount++;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
// CVARS
|
// CVARS
|
||||||
int32_t pr_maxlightpasses = 5;
|
int32_t pr_maxlightpasses = 5;
|
||||||
|
int32_t pr_maxlightpriority = PR_MAXLIGHTPRIORITY;
|
||||||
int32_t pr_fov = 426; // appears to be the classic setting.
|
int32_t pr_fov = 426; // appears to be the classic setting.
|
||||||
int32_t pr_billboardingmode = 1;
|
int32_t pr_billboardingmode = 1;
|
||||||
int32_t pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2: multiple-times, 3: flood
|
int32_t pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2: multiple-times, 3: flood
|
||||||
|
@ -704,21 +705,7 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
|
||||||
|
|
||||||
polymer_resetlights();
|
polymer_resetlights();
|
||||||
|
|
||||||
polymer_dostaticlights();
|
polymer_applylights();
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (i < gamelightcount)
|
|
||||||
{
|
|
||||||
polymer_addlight(gamelights[i]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (i < framelightcount)
|
|
||||||
{
|
|
||||||
polymer_addlight(framelights[i]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
depth = 0;
|
depth = 0;
|
||||||
polymer_prepareshadows();
|
polymer_prepareshadows();
|
||||||
|
@ -3996,15 +3983,25 @@ static void polymer_prepareshadows(void)
|
||||||
sinviewingrangeglobalang = osinviewingrangeglobalang;
|
sinviewingrangeglobalang = osinviewingrangeglobalang;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void polymer_dostaticlights(void)
|
static void polymer_applylights(void)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i, curpriority;
|
||||||
_prlight light;
|
_prlight light;
|
||||||
float fade;
|
float fade;
|
||||||
|
|
||||||
|
curpriority = 0;
|
||||||
|
while (curpriority < PR_MAXLIGHTPRIORITY)
|
||||||
|
{
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < staticlightcount)
|
while (i < staticlightcount)
|
||||||
{
|
{
|
||||||
|
if ((staticlights[i].priority != curpriority) ||
|
||||||
|
(staticlights[i].priority > pr_maxlightpriority))
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (staticlights[i].minshade == staticlights[i].maxshade)
|
if (staticlights[i].minshade == staticlights[i].maxshade)
|
||||||
polymer_addlight(staticlights[i]);
|
polymer_addlight(staticlights[i]);
|
||||||
else {
|
else {
|
||||||
|
@ -4027,6 +4024,36 @@ static void polymer_dostaticlights(void)
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (i < gamelightcount)
|
||||||
|
{
|
||||||
|
if ((gamelights[i].priority != curpriority) ||
|
||||||
|
(gamelights[i].priority > pr_maxlightpriority))
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
polymer_addlight(gamelights[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (i < framelightcount)
|
||||||
|
{
|
||||||
|
if ((framelights[i].priority != curpriority) ||
|
||||||
|
(framelights[i].priority > pr_maxlightpriority))
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
polymer_addlight(framelights[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
curpriority++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RENDER TARGETS
|
// RENDER TARGETS
|
||||||
|
|
|
@ -3583,6 +3583,8 @@ static void G_MoveActors(void)
|
||||||
gamelights[gamelightcount].color[1] = 255;
|
gamelights[gamelightcount].color[1] = 255;
|
||||||
gamelights[gamelightcount].color[2] = 255;
|
gamelights[gamelightcount].color[2] = 255;
|
||||||
|
|
||||||
|
gamelights[gamelightcount].priority = 0;
|
||||||
|
|
||||||
gamelightcount++;
|
gamelightcount++;
|
||||||
|
|
||||||
if (ud.multimode < 2)
|
if (ud.multimode < 2)
|
||||||
|
|
|
@ -7383,6 +7383,8 @@ PALONLY:
|
||||||
framelights[framelightcount].color[1] = 80;
|
framelights[framelightcount].color[1] = 80;
|
||||||
framelights[framelightcount].color[2] = 0;
|
framelights[framelightcount].color[2] = 0;
|
||||||
|
|
||||||
|
framelights[framelightcount].priority = 0;
|
||||||
|
|
||||||
if ((DynamicTileMap[s->picnum] == ATOMICHEALTH__STATIC) ||
|
if ((DynamicTileMap[s->picnum] == ATOMICHEALTH__STATIC) ||
|
||||||
(DynamicTileMap[s->picnum] == FREEZEBLAST__STATIC))
|
(DynamicTileMap[s->picnum] == FREEZEBLAST__STATIC))
|
||||||
{
|
{
|
||||||
|
@ -7430,6 +7432,8 @@ PALONLY:
|
||||||
framelights[framelightcount].color[1] = 80;
|
framelights[framelightcount].color[1] = 80;
|
||||||
framelights[framelightcount].color[2] = 0;
|
framelights[framelightcount].color[2] = 0;
|
||||||
|
|
||||||
|
framelights[framelightcount].priority = 0;
|
||||||
|
|
||||||
framelightcount++;
|
framelightcount++;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -7451,6 +7455,8 @@ PALONLY:
|
||||||
framelights[framelightcount].color[1] = 0;
|
framelights[framelightcount].color[1] = 0;
|
||||||
framelights[framelightcount].color[2] = 255;
|
framelights[framelightcount].color[2] = 255;
|
||||||
|
|
||||||
|
framelights[framelightcount].priority = 0;
|
||||||
|
|
||||||
framelightcount++;
|
framelightcount++;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue