Skip to content

Commit

Permalink
Server: Removed the GL Texture Manager subsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Feb 19, 2013
1 parent 2f280c1 commit a005e8b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 27 deletions.
7 changes: 5 additions & 2 deletions doomsday/client/include/gl/gl_texmanager.h
Expand Up @@ -27,13 +27,16 @@
#ifndef LIBDENG_GL_TEXMANAGER_H
#define LIBDENG_GL_TEXMANAGER_H

#ifndef __CLIENT__
# error "GL Texture Manager only exists in the Client"
#endif

#ifndef __cplusplus
# error "gl/gl_texmanager.h requires C++"
#endif

#include "sys_opengl.h"

//#include "filehandle.h"
#include "gl/texturecontent.h"
#include "resource/image.h"
#include "resource/r_data.h" // For flaretexid_t, lightingtexid_t, etc...
Expand Down Expand Up @@ -64,7 +67,7 @@ void GL_TexRegister();
* Called before real texture management is up and running, during engine
* early init.
*/
DENG_EXTERN_C void GL_EarlyInitTextureManager();
void GL_EarlyInitTextureManager();

void GL_InitTextureManager();

Expand Down
16 changes: 8 additions & 8 deletions doomsday/client/src/gl/gl_tex.cpp
Expand Up @@ -17,19 +17,19 @@
* http://www.gnu.org/licenses</small>
*/

#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <cctype>

#include "de_platform.h"
#include "de_base.h"
#include "de_console.h"

#include "color.h"
#include "gl/gl_tex.h"
#include "resource/colorpalettes.h"
#include "resource/r_data.h"

#include "gl/gl_tex.h"

static uint8_t* scratchBuffer = NULL;
static size_t scratchBufferSize = 0;

Expand Down Expand Up @@ -770,9 +770,9 @@ boolean GL_PalettizeImage(uint8_t* out, int outformat, const colorpalette_t* pal
ColorPalette_Color(palette, *in, out);
if(applyTexGamma)
{
out[CR] = gammaTable[out[CR]];
out[CG] = gammaTable[out[CG]];
out[CB] = gammaTable[out[CB]];
out[CR] = texGammaLut[out[CR]];
out[CG] = texGammaLut[out[CG]];
out[CB] = texGammaLut[out[CB]];
}

if(outformat == 4)
Expand Down
22 changes: 5 additions & 17 deletions doomsday/client/src/gl/gl_texmanager.cpp
Expand Up @@ -55,7 +55,6 @@ int mipmapping = 5;
int filterUI = 1;
int texQuality = TEXQ_BEST;
int upscaleAndSharpenPatches = 0;
byte gammaTable[256];

#ifdef __CLIENT__

Expand Down Expand Up @@ -97,8 +96,6 @@ void GL_DoUpdateTexParams();

static int hashDetailVariantSpecification(detailvariantspecification_t const &spec);

static void calcGammaTable();

static bool interpretPcx(de::FileHandle &hndl, String filePath, image_t &img);
static bool interpretPng(de::FileHandle &hndl, String filePath, image_t &img);
static bool interpretJpg(de::FileHandle &hndl, String filePath, image_t &img);
Expand Down Expand Up @@ -1051,7 +1048,7 @@ static uploadcontentmethod_t prepareDetailVariantFromImage(TextureVariant &tex,
void GL_EarlyInitTextureManager()
{
GL_InitSmartFilterHQ2x();
calcGammaTable();
R_BuildTexGammaLut();

variantSpecs = NULL;
memset(detailVariantSpecs, 0, sizeof(detailVariantSpecs));
Expand Down Expand Up @@ -1222,15 +1219,6 @@ void GL_ShutdownTextureManager()
initedOk = false;
}

static void calcGammaTable()
{
double invGamma = 1.0f - MINMAX_OF(0, texGamma, 1); // Clamp to a sane range.
for(int i = 0; i < 256; ++i)
{
gammaTable[i] = byte(255.0f * pow(double(i / 255.0f), invGamma));
}
}

void GL_LoadSystemTextures()
{
if(novideo || !initedOk) return;
Expand Down Expand Up @@ -1827,9 +1815,9 @@ void GL_UploadTextureContent(texturecontent_t const &content)

for(long i = 0; i < numPels; ++i)
{
dst[CR] = gammaTable[src[CR]];
dst[CG] = gammaTable[src[CG]];
dst[CB] = gammaTable[src[CB]];
dst[CR] = texGammaLut[src[CR]];
dst[CG] = texGammaLut[src[CG]];
dst[CB] = texGammaLut[src[CB]];
if(comps == 4)
dst[CA] = src[CA];

Expand Down Expand Up @@ -2708,7 +2696,7 @@ void GL_DoUpdateTexGamma()
{
if(initedOk)
{
calcGammaTable();
R_BuildTexGammaLut();
GL_TexReset();
}

Expand Down

0 comments on commit a005e8b

Please sign in to comment.