From 96437d95fa62e0694e1c8bf4e289df0d0f320523 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 20 Oct 2016 10:36:23 +0200 Subject: [PATCH] - use the new ZDoom code for retrieving a sky's cap color to avoid redundancies. --- src/gl/textures/gl_texture.cpp | 37 +--------------------------------- src/gl/textures/gl_texture.h | 1 - src/textures/textures.h | 4 ---- 3 files changed, 1 insertion(+), 41 deletions(-) diff --git a/src/gl/textures/gl_texture.cpp b/src/gl/textures/gl_texture.cpp index ce6ff398c..8aaa98ae6 100644 --- a/src/gl/textures/gl_texture.cpp +++ b/src/gl/textures/gl_texture.cpp @@ -167,7 +167,7 @@ void gl_GenerateGlobalBrightmapFromColormap() // component becomes one. // //=========================================================================== -PalEntry averageColor(const DWORD *data, int size, int maxout) +static PalEntry averageColor(const DWORD *data, int size, int maxout) { int i; unsigned int r, g, b; @@ -216,10 +216,7 @@ FTexture::MiscGLInfo::MiscGLInfo() throw() GlowColor = 0; GlowHeight = 128; bSkybox = false; - FloorSkyColor = 0; - CeilingSkyColor = 0; bFullbright = false; - bSkyColorDone = false; bBrightmapChecked = false; bDisableFullbright = false; bNoFilter = false; @@ -326,38 +323,6 @@ void FTexture::GetGlowColor(float *data) data[2]=gl_info.GlowColor.b/255.0f; } -//=========================================================================== -// -// Gets the average color of a texture for use as a sky cap color -// -//=========================================================================== - -PalEntry FTexture::GetSkyCapColor(bool bottom) -{ - PalEntry col; - int w; - int h; - - if (!gl_info.bSkyColorDone) - { - gl_info.bSkyColorDone = true; - - unsigned char *buffer = GLRenderer->GetTextureBuffer(this, w, h); - - if (buffer) - { - gl_info.CeilingSkyColor = averageColor((DWORD *) buffer, w * MIN(30, h), 0); - if (h>30) - { - gl_info.FloorSkyColor = averageColor(((DWORD *) buffer)+(h-30)*w, w * 30, 0); - } - else gl_info.FloorSkyColor = gl_info.CeilingSkyColor; - delete[] buffer; - } - } - return bottom? gl_info.FloorSkyColor : gl_info.CeilingSkyColor; -} - //=========================================================================== // // Finds gaps in the texture which can be skipped by the renderer diff --git a/src/gl/textures/gl_texture.h b/src/gl/textures/gl_texture.h index 9ee9b27f9..455678f85 100644 --- a/src/gl/textures/gl_texture.h +++ b/src/gl/textures/gl_texture.h @@ -24,7 +24,6 @@ protected: void gl_GenerateGlobalBrightmapFromColormap(); -PalEntry averageColor(const DWORD *data, int size, int maxout); diff --git a/src/textures/textures.h b/src/textures/textures.h index 518787dc0..cc5bba389 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -307,8 +307,6 @@ public: FGLTexture *SystemTexture[2]; FTexture *Brightmap; PalEntry GlowColor; - PalEntry FloorSkyColor; - PalEntry CeilingSkyColor; int GlowHeight; FloatRect *areas; int areacount; @@ -318,7 +316,6 @@ public: bool bGlowing:1; // Texture glows bool bFullbright:1; // always draw fullbright bool bSkybox:1; // This is a skybox - bool bSkyColorDone:1; // Fill color for sky char bBrightmapChecked:1; // Set to 1 if brightmap has been checked bool bDisableFullbright:1; // This texture will not be displayed as fullbright sprite bool bNoFilter:1; @@ -331,7 +328,6 @@ public: MiscGLInfo gl_info; void GetGlowColor(float *data); - PalEntry GetSkyCapColor(bool bottom); bool isGlowing() { return gl_info.bGlowing; } bool isFullbright() { return gl_info.bFullbright; } void CreateDefaultBrightmap();