mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-13 07:57:51 +00:00
- added some functionality to FDynamicColormap to allow not creating
the colormap data if it isn't needed by the renderer. SVN r635 (trunk)
This commit is contained in:
parent
d12ede252f
commit
3eb741e391
6 changed files with 36 additions and 3 deletions
|
@ -1,4 +1,6 @@
|
||||||
December 24, 2007 (Changes by Graf Zahl)
|
December 24, 2007 (Changes by Graf Zahl)
|
||||||
|
- added some functionality to FDynamicColormap to allow not creating
|
||||||
|
the colormap data.
|
||||||
- also replaced the AM crosshair drawer by a DCanvas::DrawPixel function.
|
- also replaced the AM crosshair drawer by a DCanvas::DrawPixel function.
|
||||||
- moved the AM line drawer into DCanvas as a virtual function. While testing
|
- moved the AM line drawer into DCanvas as a virtual function. While testing
|
||||||
this code I discovered that the antialias precalculation was never used
|
this code I discovered that the antialias precalculation was never used
|
||||||
|
|
|
@ -180,7 +180,7 @@ FFont * V_GetFont(const char *name)
|
||||||
if (strlen(name) > 8)
|
if (strlen(name) > 8)
|
||||||
{
|
{
|
||||||
fullname.Format("%s.fon", name);
|
fullname.Format("%s.fon", name);
|
||||||
lump = Wads.CheckNumForFullName(name);
|
lump = Wads.CheckNumForFullName(fullname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -659,14 +659,18 @@ FDynamicColormap *GetSpecialLights (PalEntry color, PalEntry fade, int desaturat
|
||||||
|
|
||||||
// Not found. Create it.
|
// Not found. Create it.
|
||||||
colormap = new FDynamicColormap;
|
colormap = new FDynamicColormap;
|
||||||
colormap->Maps = new BYTE[NUMCOLORMAPS*256];
|
|
||||||
colormap->Next = NormalLight.Next;
|
colormap->Next = NormalLight.Next;
|
||||||
colormap->Color = color;
|
colormap->Color = color;
|
||||||
colormap->Fade = fade;
|
colormap->Fade = fade;
|
||||||
colormap->Desaturate = desaturate;
|
colormap->Desaturate = desaturate;
|
||||||
NormalLight.Next = colormap;
|
NormalLight.Next = colormap;
|
||||||
|
|
||||||
|
if (screen->UsesColormap())
|
||||||
|
{
|
||||||
|
colormap->Maps = new BYTE[NUMCOLORMAPS*256];
|
||||||
colormap->BuildLights ();
|
colormap->BuildLights ();
|
||||||
|
}
|
||||||
|
else colormap->Maps = NULL;
|
||||||
|
|
||||||
return colormap;
|
return colormap;
|
||||||
}
|
}
|
||||||
|
@ -788,6 +792,24 @@ void FDynamicColormap::ChangeColorFade (PalEntry lightcolor, PalEntry fadecolor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FDynamicColormap::RebuildAllLights()
|
||||||
|
{
|
||||||
|
if (screen->UsesColormap())
|
||||||
|
{
|
||||||
|
FDynamicColormap *cm;
|
||||||
|
|
||||||
|
for (cm = &NormalLight; cm != NULL; cm = cm->Next)
|
||||||
|
{
|
||||||
|
if (cm->Maps == NULL)
|
||||||
|
{
|
||||||
|
cm->Maps = new BYTE[NUMCOLORMAPS*256];
|
||||||
|
cm->BuildLights ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CCMD (testcolor)
|
CCMD (testcolor)
|
||||||
{
|
{
|
||||||
FString colorstring;
|
FString colorstring;
|
||||||
|
|
|
@ -71,6 +71,7 @@ struct FDynamicColormap
|
||||||
void ChangeColor (PalEntry lightcolor, int desaturate);
|
void ChangeColor (PalEntry lightcolor, int desaturate);
|
||||||
void ChangeColorFade (PalEntry lightcolor, PalEntry fadecolor);
|
void ChangeColorFade (PalEntry lightcolor, PalEntry fadecolor);
|
||||||
void BuildLights ();
|
void BuildLights ();
|
||||||
|
static void RebuildAllLights();
|
||||||
|
|
||||||
BYTE *Maps;
|
BYTE *Maps;
|
||||||
PalEntry Color;
|
PalEntry Color;
|
||||||
|
|
|
@ -328,6 +328,11 @@ void DCanvas::Dim (PalEntry color, float damount, int x1, int y1, int w, int h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DCanvas::UsesColormap() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int V_GetColorFromString (const DWORD *palette, const char *cstr)
|
int V_GetColorFromString (const DWORD *palette, const char *cstr)
|
||||||
{
|
{
|
||||||
int c[3], i, p;
|
int c[3], i, p;
|
||||||
|
|
|
@ -179,6 +179,9 @@ public:
|
||||||
// Calculate gamma table
|
// Calculate gamma table
|
||||||
void CalcGamma (float gamma, BYTE gammalookup[256]);
|
void CalcGamma (float gamma, BYTE gammalookup[256]);
|
||||||
|
|
||||||
|
// Can be overridden so that the colormaps for sector color/fade won't be built.
|
||||||
|
virtual bool UsesColormap() const;
|
||||||
|
|
||||||
// Text drawing functions -----------------------------------------------
|
// Text drawing functions -----------------------------------------------
|
||||||
|
|
||||||
virtual void SetFont (FFont *font);
|
virtual void SetFont (FFont *font);
|
||||||
|
|
Loading…
Reference in a new issue