2009-09-25 21:57:47 +00:00
|
|
|
#ifndef __GL_LIGHTDATA
|
|
|
|
#define __GL_LIGHTDATA
|
|
|
|
|
2009-09-25 23:09:24 +00:00
|
|
|
#include "v_palette.h"
|
|
|
|
#include "r_blend.h"
|
|
|
|
#include "gl/renderer/gl_colormap.h"
|
|
|
|
|
2009-10-07 12:45:34 +00:00
|
|
|
bool gl_BrightmapsActive();
|
|
|
|
bool gl_GlowActive();
|
|
|
|
|
2011-06-12 09:08:10 +00:00
|
|
|
inline int gl_ClampLight(int lightlevel)
|
|
|
|
{
|
|
|
|
return clamp(lightlevel, 0, 255);
|
|
|
|
}
|
|
|
|
|
2009-09-25 21:57:47 +00:00
|
|
|
void gl_GetRenderStyle(FRenderStyle style, bool drawopaque, bool allowcolorblending,
|
|
|
|
int *tm, int *sb, int *db, int *be);
|
|
|
|
void gl_SetFogParams(int _fogdensity, PalEntry _outsidefogcolor, int _outsidefogdensity, int _skyfog);
|
2009-09-25 23:09:24 +00:00
|
|
|
|
2009-09-25 21:57:47 +00:00
|
|
|
int gl_CalcLightLevel(int lightlevel, int rellight, bool weapon);
|
|
|
|
PalEntry gl_CalcLightColor(int light, PalEntry pe, int blendfactor);
|
2009-09-25 23:09:24 +00:00
|
|
|
void gl_GetLightColor(int lightlevel, int rellight, const FColormap * cm, float * pred, float * pgreen, float * pblue, bool weapon=false);
|
|
|
|
void gl_SetColor(int light, int rellight, const FColormap * cm, float alpha, PalEntry ThingColor = 0xffffff, bool weapon=false);
|
|
|
|
void gl_SetColor(int light, int rellight, const FColormap * cm, float *red, float *green, float *blue, PalEntry ThingColor=0xffffff, bool weapon=false);
|
|
|
|
|
2009-09-25 21:57:47 +00:00
|
|
|
float gl_GetFogDensity(int lightlevel, PalEntry fogcolor);
|
2010-08-14 07:38:10 +00:00
|
|
|
struct sector_t;
|
|
|
|
bool gl_CheckFog(sector_t *frontsector, sector_t *backsector);
|
2009-09-25 21:57:47 +00:00
|
|
|
|
2009-09-25 23:09:24 +00:00
|
|
|
void gl_SetFog(int lightlevel, int rellight, const FColormap *cm, bool isadditive);
|
|
|
|
|
|
|
|
inline bool gl_isBlack(PalEntry color)
|
|
|
|
{
|
|
|
|
return color.r + color.g + color.b == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool gl_isWhite(PalEntry color)
|
|
|
|
{
|
|
|
|
return color.r + color.g + color.b == 3*0xff;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern DWORD gl_fixedcolormap;
|
|
|
|
|
|
|
|
inline bool gl_isFullbright(PalEntry color, int lightlevel)
|
|
|
|
{
|
|
|
|
return gl_fixedcolormap || (gl_isWhite(color) && lightlevel==255);
|
|
|
|
}
|
|
|
|
|
|
|
|
__forceinline void gl_Desaturate(int gray, int ired, int igreen, int iblue, BYTE & red, BYTE & green, BYTE & blue, int fac)
|
|
|
|
{
|
|
|
|
red = (ired*(31-fac) + gray*fac)/31;
|
|
|
|
green = (igreen*(31-fac) + gray*fac)/31;
|
|
|
|
blue = (iblue*(31-fac) + gray*fac)/31;
|
|
|
|
}
|
|
|
|
|
|
|
|
void gl_ModifyColor(BYTE & red, BYTE & green, BYTE & blue, int cm);
|
|
|
|
|
2009-12-29 23:20:51 +00:00
|
|
|
extern int fogdensity;
|
|
|
|
extern int outsidefogdensity;
|
|
|
|
extern int skyfog;
|
2009-09-25 21:57:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|