mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
New userdef structure: "global_r", "global_g", "global_b"
Set the tinting RGB values of textures being rendered. Can be used in DISPLAYROOMS or before rotatesprite (similar to setaspect). Remember to reset the values afterwards. Patch from Fox. git-svn-id: https://svn.eduke32.com/eduke32@6591 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
392d5fc942
commit
67438d0cd2
7 changed files with 39 additions and 0 deletions
|
@ -858,6 +858,7 @@ extern int32_t usevoxels, voxscale[MAXVOXELS];
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
extern int32_t usemodels, usehightile;
|
extern int32_t usemodels, usehightile;
|
||||||
extern int32_t rendmode;
|
extern int32_t rendmode;
|
||||||
|
extern uint8_t globalr, globalg, globalb;
|
||||||
#endif
|
#endif
|
||||||
EXTERN uint16_t h_xsize[MAXTILES], h_ysize[MAXTILES];
|
EXTERN uint16_t h_xsize[MAXTILES], h_ysize[MAXTILES];
|
||||||
EXTERN int8_t h_xoffs[MAXTILES], h_yoffs[MAXTILES];
|
EXTERN int8_t h_xoffs[MAXTILES], h_yoffs[MAXTILES];
|
||||||
|
|
|
@ -71,6 +71,20 @@ static inline void hictinting_apply_ub(uint8_t *color, int32_t palnum)
|
||||||
color[2] = (uint8_t)(color[2] * (float)tint.b * (1.f/255.f));
|
color[2] = (uint8_t)(color[2] * (float)tint.b * (1.f/255.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void globaltinting_apply(float *color)
|
||||||
|
{
|
||||||
|
color[0] *= (float)globalr * (1.f/255.f);
|
||||||
|
color[1] *= (float)globalg * (1.f/255.f);
|
||||||
|
color[2] *= (float)globalb * (1.f/255.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void globaltinting_apply_ub(uint8_t *color)
|
||||||
|
{
|
||||||
|
color[0] = (uint8_t)(color[0] * (float)globalr * (1.f/255.f));
|
||||||
|
color[1] = (uint8_t)(color[1] * (float)globalg * (1.f/255.f));
|
||||||
|
color[2] = (uint8_t)(color[2] * (float)globalb * (1.f/255.f));
|
||||||
|
}
|
||||||
|
|
||||||
// texcacheheader cachead.flags bits
|
// texcacheheader cachead.flags bits
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -4209,6 +4209,8 @@ static void polymer_drawartsky(int16_t tilenum, char palnum, int8_t shad
|
||||||
// global tinting
|
// global tinting
|
||||||
if ((pth->flags & PTH_HIGHTILE) && have_basepal_tint())
|
if ((pth->flags & PTH_HIGHTILE) && have_basepal_tint())
|
||||||
hictinting_apply(glcolors[i], MAXPALOOKUPS-1);
|
hictinting_apply(glcolors[i], MAXPALOOKUPS-1);
|
||||||
|
|
||||||
|
globaltinting_apply(glcolors[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
@ -4301,6 +4303,8 @@ static void polymer_drawskybox(int16_t tilenum, char palnum, int8_t shad
|
||||||
// global tinting
|
// global tinting
|
||||||
if ((pth->flags & PTH_HIGHTILE) && have_basepal_tint())
|
if ((pth->flags & PTH_HIGHTILE) && have_basepal_tint())
|
||||||
hictinting_apply(color, MAXPALOOKUPS-1);
|
hictinting_apply(color, MAXPALOOKUPS-1);
|
||||||
|
|
||||||
|
globaltinting_apply(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
bglColor4f(color[0], color[1], color[2], 1.0);
|
bglColor4f(color[0], color[1], color[2], 1.0);
|
||||||
|
@ -4527,6 +4531,8 @@ static void polymer_drawmdsprite(uspritetype *tspr)
|
||||||
if (!usinghighpal && have_basepal_tint())
|
if (!usinghighpal && have_basepal_tint())
|
||||||
hictinting_apply_ub(color, MAXPALOOKUPS-1);
|
hictinting_apply_ub(color, MAXPALOOKUPS-1);
|
||||||
|
|
||||||
|
globaltinting_apply_ub(color);
|
||||||
|
|
||||||
if (tspr->cstat & 2)
|
if (tspr->cstat & 2)
|
||||||
{
|
{
|
||||||
if (!(tspr->cstat&512))
|
if (!(tspr->cstat&512))
|
||||||
|
@ -4966,6 +4972,7 @@ static _prbucket* polymer_getbuildmaterial(_prmaterial* material, int16_t tile
|
||||||
material->shadeoffset = shade;
|
material->shadeoffset = shade;
|
||||||
material->visibility = (uint8_t)(vis+16);
|
material->visibility = (uint8_t)(vis+16);
|
||||||
|
|
||||||
|
globaltinting_apply_ub(material->diffusemodulation);
|
||||||
// all the stuff below is mutually exclusive with artmapping
|
// all the stuff below is mutually exclusive with artmapping
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -5013,6 +5020,8 @@ static _prbucket* polymer_getbuildmaterial(_prmaterial* material, int16_t tile
|
||||||
if ((pth->flags & PTH_HIGHTILE) && !usinghighpal && have_basepal_tint())
|
if ((pth->flags & PTH_HIGHTILE) && !usinghighpal && have_basepal_tint())
|
||||||
hictinting_apply_ub(material->diffusemodulation, MAXPALOOKUPS-1);
|
hictinting_apply_ub(material->diffusemodulation, MAXPALOOKUPS-1);
|
||||||
|
|
||||||
|
globaltinting_apply_ub(material->diffusemodulation);
|
||||||
|
|
||||||
// PR_BIT_GLOW_MAP
|
// PR_BIT_GLOW_MAP
|
||||||
if (r_fullbrights && pth->flags & PTH_HASFULLBRIGHT)
|
if (r_fullbrights && pth->flags & PTH_HASFULLBRIGHT)
|
||||||
material->glowmap = pth->ofb->glpic;
|
material->glowmap = pth->ofb->glpic;
|
||||||
|
|
|
@ -32,6 +32,7 @@ extern char textfont[2048], smalltextfont[2048];
|
||||||
int32_t rendmode=0;
|
int32_t rendmode=0;
|
||||||
int32_t usemodels=1;
|
int32_t usemodels=1;
|
||||||
int32_t usehightile=1;
|
int32_t usehightile=1;
|
||||||
|
uint8_t globalr=255, globalg=255, globalb=255;
|
||||||
|
|
||||||
typedef struct { float x, cy[2], fy[2]; int32_t tag; int16_t n, p, ctag, ftag; } vsptyp;
|
typedef struct { float x, cy[2], fy[2]; int32_t tag; int16_t n, p, ctag, ftag; } vsptyp;
|
||||||
#define VSPMAX 2048 //<- careful!
|
#define VSPMAX 2048 //<- careful!
|
||||||
|
@ -1922,6 +1923,8 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
||||||
// global tinting
|
// global tinting
|
||||||
if ((pth->flags & PTH_HIGHTILE) && have_basepal_tint())
|
if ((pth->flags & PTH_HIGHTILE) && have_basepal_tint())
|
||||||
hictinting_apply(pc, MAXPALOOKUPS-1);
|
hictinting_apply(pc, MAXPALOOKUPS-1);
|
||||||
|
|
||||||
|
globaltinting_apply(pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bglColor4f(pc[0], pc[1], pc[2], pc[3]);
|
bglColor4f(pc[0], pc[1], pc[2], pc[3]);
|
||||||
|
|
|
@ -1243,6 +1243,9 @@ const memberlabel_t UserdefsLabels[]=
|
||||||
{ "menu_slidebarz", USERDEFS_MENU_SLIDEBARZ, 0, 0 },
|
{ "menu_slidebarz", USERDEFS_MENU_SLIDEBARZ, 0, 0 },
|
||||||
{ "menu_slidebarmargin", USERDEFS_MENU_SLIDEBARMARGIN, 0, 0 },
|
{ "menu_slidebarmargin", USERDEFS_MENU_SLIDEBARMARGIN, 0, 0 },
|
||||||
{ "menu_slidecursorz", USERDEFS_MENU_SLIDECURSORZ, 0, 0 },
|
{ "menu_slidecursorz", USERDEFS_MENU_SLIDECURSORZ, 0, 0 },
|
||||||
|
{ "global_r", USERDEFS_GLOBAL_R, 0, 0 },
|
||||||
|
{ "global_g", USERDEFS_GLOBAL_G, 0, 0 },
|
||||||
|
{ "global_b", USERDEFS_GLOBAL_B, 0, 0 },
|
||||||
{ NULL, -1, 0, 0 } // END OF LIST
|
{ NULL, -1, 0, 0 } // END OF LIST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -541,6 +541,9 @@ enum UserdefsLabel_t
|
||||||
USERDEFS_MENU_SLIDEBARZ,
|
USERDEFS_MENU_SLIDEBARZ,
|
||||||
USERDEFS_MENU_SLIDEBARMARGIN,
|
USERDEFS_MENU_SLIDEBARMARGIN,
|
||||||
USERDEFS_MENU_SLIDECURSORZ,
|
USERDEFS_MENU_SLIDECURSORZ,
|
||||||
|
USERDEFS_GLOBAL_R,
|
||||||
|
USERDEFS_GLOBAL_G,
|
||||||
|
USERDEFS_GLOBAL_B,
|
||||||
USERDEFS_END
|
USERDEFS_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -185,6 +185,9 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum)
|
||||||
case USERDEFS_MENU_SLIDEBARZ: labelNum = ud.menu_slidebarz; break;
|
case USERDEFS_MENU_SLIDEBARZ: labelNum = ud.menu_slidebarz; break;
|
||||||
case USERDEFS_MENU_SLIDEBARMARGIN: labelNum = ud.menu_slidebarmargin; break;
|
case USERDEFS_MENU_SLIDEBARMARGIN: labelNum = ud.menu_slidebarmargin; break;
|
||||||
case USERDEFS_MENU_SLIDECURSORZ: labelNum = ud.menu_slidecursorz; break;
|
case USERDEFS_MENU_SLIDECURSORZ: labelNum = ud.menu_slidecursorz; break;
|
||||||
|
case USERDEFS_GLOBAL_R: labelNum = globalr; break;
|
||||||
|
case USERDEFS_GLOBAL_G: labelNum = globalg; break;
|
||||||
|
case USERDEFS_GLOBAL_B: labelNum = globalb; break;
|
||||||
default: labelNum = -1; break;
|
default: labelNum = -1; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,6 +323,9 @@ void __fastcall VM_SetUserdef(int32_t const labelNum, int32_t const iSet)
|
||||||
case USERDEFS_MENU_SLIDEBARZ: ud.menu_slidebarz = iSet; break;
|
case USERDEFS_MENU_SLIDEBARZ: ud.menu_slidebarz = iSet; break;
|
||||||
case USERDEFS_MENU_SLIDEBARMARGIN: ud.menu_slidebarmargin = iSet; break;
|
case USERDEFS_MENU_SLIDEBARMARGIN: ud.menu_slidebarmargin = iSet; break;
|
||||||
case USERDEFS_MENU_SLIDECURSORZ: ud.menu_slidecursorz = iSet; break;
|
case USERDEFS_MENU_SLIDECURSORZ: ud.menu_slidecursorz = iSet; break;
|
||||||
|
case USERDEFS_GLOBAL_R: globalr = iSet; break;
|
||||||
|
case USERDEFS_GLOBAL_G: globalg = iSet; break;
|
||||||
|
case USERDEFS_GLOBAL_B: globalb = iSet; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue