- renamed low level texture class.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@473 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
Christoph Oelckers 2009-09-22 14:48:12 +00:00
parent 1732827ed1
commit a00125631d
8 changed files with 99 additions and 36 deletions

View file

@ -1,4 +1,69 @@
September 22, 2009 (Changes by Graf Zahl)
- Added a check to Dehacked code which tries to set the blend color.
It must set it to 0 if the alpha is 0 to avoid problems with special
colormap detection.
- Changed SPECIALCOLORMAP_MASK again so that it does not interfere with
any valid setting. It must use a value with a 0-alpha because these
are guaranteed not to be produced by the DECORATE code elsewhere.
- Fixed precision issues with AddFixedColormap's search for identical colormaps.
- Added custom colormap support to texture composition code.
- Fixed initialization of FSpecialColormap::GrayscaleToColor. This is not
a mapping from the palette but from a [0,255] grayscale ramp and used to
apply colormaps to true color images for texture composition.
September 21, 2009
- For hardware 2D, apply fixed colormaps when copying to video memory instead
of doing it directly during the rendering, in order to improve visual
fidelity for colormaps that aren't grayscale.
- Added support for defining the full color range of a special colormap.
- Moved the code for specialcolormap and colormapstyle in D3DFB::SetStyle()
at the end of the normally-colored block so that they get all the proper
texture format setup.
- Fixed: In letterbox modes, the clipping window needs to be adjusted down.
September 21, 2009 (Changes by Graf Zahl)
- Fixed: When drawing with a special colormap the quad's flags weren't cleared
which could cause crashes.
- Added custom special colormaps to DECORATE.
- Cleaned up special colormap code and removed lots of dependencies on the
knowledge of the tables' contents.
September 20, 2009 (Changes by Graf Zahl)
- Changed call to R_DrawRemainingPlayerSprites into a virtual function
of DFrameBuffer because its implementation is specific to the software
renderer and needs to be overridable.
September 19, 2009
- Fixed: Wall drawing handled fixed light levels improperly (but did not
completely ignore them, either).
- Separated light level fixing out of player_t's fixedcolormap parameter.
Using a fixed light level (e.g. PowerTorch) will no longer wipe out
colored lighting.
- Moved the blending rectangle drawing into a separate discrete stage, since
doing it while copying the 3D view window to the display now blends
underneath the weapon instead of on top of it.
- Consolidated the special colormaps into a single 2D table.
- Tweaked the special colormaps slightly to make the true color results more
closely match the paletted approximations.
- fb_d3d9_shaders.h was getting unwieldy, so I moved the shaders out of the
executable and into zdoom.pk3. Shaders are still precompiled so I don't need
to pull in a dependancy on D3DX.
- Added a few more shaders to accomodate drawing weapons with all the in-game
lighting models. These are accessed with the new DrawTexture tags
DTA_SpecialColormap and DTA_ColormapStyle.
- Player weapon sprites are now drawn using Direct3D and receive all the
benefits thereof.
September 17, 2009 (Changes by Graf Zahl)
- Fixed: Unmorphing while invulnerable was blocked.
- Various cleanup changes.
- fixed Dog's class name in DEHSUPP.
- Renamed plane flags from SECF_* to PLANEF_*.
- Changed Heretic's plat raise type to use a flag to block further sector movement
instead of keeping the dead thinker around to block the sector.
September 16, 2009 (Changes by Graf Zahl) September 16, 2009 (Changes by Graf Zahl)
- Fixed: A_LookEx did not work for monsters having the MF_NOSECTOR flag.
- Fixed: The deprecated flag handler for the old bounce flags needs to clear - Fixed: The deprecated flag handler for the old bounce flags needs to clear
BOUNCE_MBF and BOUNCE_UseSeeSound, too, when clearing one of these flags. BOUNCE_MBF and BOUNCE_UseSeeSound, too, when clearing one of these flags.
- Fixed: When adding the AVOIDMELEE code the code was accidentally changed so that - Fixed: When adding the AVOIDMELEE code the code was accidentally changed so that
@ -16896,7 +16961,7 @@ November 14, 2000
into c_cvars.cpp. Virtual inline functions are not inlined and cause the into c_cvars.cpp. Virtual inline functions are not inlined and cause the
function to be generated for every source file the class is used in. function to be generated for every source file the class is used in.
- Fixed bug with Transfer_CeilingLight special. I was or'ing CeilingLight - Fixed bug with Transfer_CeilingLight special. I was or'ing CeilingLight
with SECF_ABSLIGHTING instead of CeilingFlags. with PLANEF_ABSLIGHTING instead of CeilingFlags.
November 11, 2000 November 11, 2000
- Slopes don't work in mirrors. :-( - Slopes don't work in mirrors. :-(

View file

@ -95,7 +95,7 @@ public:
private: private:
static const int WIDTH = 64, HEIGHT = 64; static const int WIDTH = 64, HEIGHT = 64;
BYTE BurnArray[WIDTH * (HEIGHT + 5)]; BYTE BurnArray[WIDTH * (HEIGHT + 5)];
GLRendererOld::GLTexture *BurnTexture; GLRendererOld::FHardwareTexture *BurnTexture;
int Density; int Density;
int BurnTime; int BurnTime;
}; };
@ -134,7 +134,7 @@ bool OpenGLFrameBuffer::WipeStartScreen(int type)
return false; return false;
} }
wipestartscreen = new GLRendererOld::GLTexture(Width, Height, false, false); wipestartscreen = new GLRendererOld::FHardwareTexture(Width, Height, false, false);
wipestartscreen->CreateTexture(NULL, Width, Height, false, 0, CM_DEFAULT); wipestartscreen->CreateTexture(NULL, Width, Height, false, 0, CM_DEFAULT);
gl.Finish(); gl.Finish();
wipestartscreen->Bind(0, CM_DEFAULT); wipestartscreen->Bind(0, CM_DEFAULT);
@ -157,7 +157,7 @@ bool OpenGLFrameBuffer::WipeStartScreen(int type)
void OpenGLFrameBuffer::WipeEndScreen() void OpenGLFrameBuffer::WipeEndScreen()
{ {
wipeendscreen = new GLRendererOld::GLTexture(Width, Height, false, false); wipeendscreen = new GLRendererOld::FHardwareTexture(Width, Height, false, false);
wipeendscreen->CreateTexture(NULL, Width, Height, false, 0, CM_DEFAULT); wipeendscreen->CreateTexture(NULL, Width, Height, false, 0, CM_DEFAULT);
gl.Flush(); gl.Flush();
wipeendscreen->Bind(0, CM_DEFAULT); wipeendscreen->Bind(0, CM_DEFAULT);
@ -442,7 +442,7 @@ bool OpenGLFrameBuffer::Wiper_Burn::Run(int ticks, OpenGLFrameBuffer *fb)
} }
if (BurnTexture != NULL) delete BurnTexture; if (BurnTexture != NULL) delete BurnTexture;
BurnTexture = new GLRendererOld::GLTexture(WIDTH, HEIGHT, false, false); BurnTexture = new GLRendererOld::FHardwareTexture(WIDTH, HEIGHT, false, false);
// Update the burn texture with the new burn data // Update the burn texture with the new burn data
BYTE rgb_buffer[WIDTH*HEIGHT*4]; BYTE rgb_buffer[WIDTH*HEIGHT*4];

View file

@ -7,7 +7,7 @@
#endif #endif
namespace GLRendererOld namespace GLRendererOld
{ {
class GLTexture; class FHardwareTexture;
} }
extern long gl_frameMS; extern long gl_frameMS;
@ -104,8 +104,8 @@ private:
class Wiper_Crossfade; friend class Wiper_Crossfade; class Wiper_Crossfade; friend class Wiper_Crossfade;
Wiper *ScreenWipe; Wiper *ScreenWipe;
GLRendererOld::GLTexture *wipestartscreen; GLRendererOld::FHardwareTexture *wipestartscreen;
GLRendererOld::GLTexture *wipeendscreen; GLRendererOld::FHardwareTexture *wipeendscreen;
public: public:
AActor * LastCamera; AActor * LastCamera;

View file

@ -64,14 +64,14 @@ namespace GLRendererOld
// Static texture data // Static texture data
// //
//=========================================================================== //===========================================================================
unsigned int GLTexture::lastbound[GLTexture::MAX_TEXTURES]; unsigned int FHardwareTexture::lastbound[FHardwareTexture::MAX_TEXTURES];
//=========================================================================== //===========================================================================
// //
// STATIC - Gets the maximum size of hardware textures // STATIC - Gets the maximum size of hardware textures
// //
//=========================================================================== //===========================================================================
int GLTexture::GetTexDimension(int value) int FHardwareTexture::GetTexDimension(int value)
{ {
if (value > gl.max_texturesize) return gl.max_texturesize; if (value > gl.max_texturesize) return gl.max_texturesize;
if (gl.flags&RFL_NPOT_TEXTURE) return value; if (gl.flags&RFL_NPOT_TEXTURE) return value;
@ -90,7 +90,7 @@ int GLTexture::GetTexDimension(int value)
// strange crashes deep inside the GL driver when I didn't do it! // strange crashes deep inside the GL driver when I didn't do it!
// //
//=========================================================================== //===========================================================================
void GLTexture::LoadImage(unsigned char * buffer,int w, int h, unsigned int & glTexID,int wrapparam, bool alphatexture, int texunit) void FHardwareTexture::LoadImage(unsigned char * buffer,int w, int h, unsigned int & glTexID,int wrapparam, bool alphatexture, int texunit)
{ {
int rh,rw; int rh,rw;
int texformat=TexFormat[gl_texture_format]; int texformat=TexFormat[gl_texture_format];
@ -197,7 +197,7 @@ void GLTexture::LoadImage(unsigned char * buffer,int w, int h, unsigned int & gl
// Creates a texture // Creates a texture
// //
//=========================================================================== //===========================================================================
GLTexture::GLTexture(int _width, int _height, bool _mipmap, bool wrap) FHardwareTexture::FHardwareTexture(int _width, int _height, bool _mipmap, bool wrap)
{ {
mipmap=_mipmap; mipmap=_mipmap;
texwidth=_width; texwidth=_width;
@ -209,8 +209,8 @@ GLTexture::GLTexture(int _width, int _height, bool _mipmap, bool wrap)
} }
else else
{ {
scalexfac=MIN<float>(1.f,(float)texwidth/GLTexture::GetTexDimension(texwidth)); scalexfac=MIN<float>(1.f,(float)texwidth/FHardwareTexture::GetTexDimension(texwidth));
scaleyfac=MIN<float>(1.f,(float)texheight/GLTexture::GetTexDimension(texheight)); scaleyfac=MIN<float>(1.f,(float)texheight/FHardwareTexture::GetTexDimension(texheight));
} }
int cm_arraysize = CM_FIRSTSPECIALCOLORMAP + SpecialColormaps.Size(); int cm_arraysize = CM_FIRSTSPECIALCOLORMAP + SpecialColormaps.Size();
@ -225,7 +225,7 @@ GLTexture::GLTexture(int _width, int _height, bool _mipmap, bool wrap)
// Frees all associated resources // Frees all associated resources
// //
//=========================================================================== //===========================================================================
void GLTexture::Clean(bool all) void FHardwareTexture::Clean(bool all)
{ {
int cm_arraysize = CM_FIRSTSPECIALCOLORMAP + SpecialColormaps.Size(); int cm_arraysize = CM_FIRSTSPECIALCOLORMAP + SpecialColormaps.Size();
@ -260,7 +260,7 @@ void GLTexture::Clean(bool all)
// Destroys the texture // Destroys the texture
// //
//=========================================================================== //===========================================================================
GLTexture::~GLTexture() FHardwareTexture::~FHardwareTexture()
{ {
Clean(true); Clean(true);
delete [] glTexID; delete [] glTexID;
@ -273,7 +273,7 @@ GLTexture::~GLTexture()
// //
//=========================================================================== //===========================================================================
unsigned * GLTexture::GetTexID(int cm, int translation) unsigned * FHardwareTexture::GetTexID(int cm, int translation)
{ {
if (cm < 0 || cm >= CM_FIRSTSPECIALCOLORMAP + SpecialColormaps.Size()) cm=CM_DEFAULT; if (cm < 0 || cm >= CM_FIRSTSPECIALCOLORMAP + SpecialColormaps.Size()) cm=CM_DEFAULT;
@ -305,7 +305,7 @@ unsigned * GLTexture::GetTexID(int cm, int translation)
// Binds this patch // Binds this patch
// //
//=========================================================================== //===========================================================================
unsigned int GLTexture::Bind(int texunit, int cm,int translation, int clampmode) unsigned int FHardwareTexture::Bind(int texunit, int cm,int translation, int clampmode)
{ {
unsigned int * pTexID=GetTexID(cm, translation); unsigned int * pTexID=GetTexID(cm, translation);
@ -322,7 +322,7 @@ unsigned int GLTexture::Bind(int texunit, int cm,int translation, int clampmode)
} }
void GLTexture::Unbind(int texunit) void FHardwareTexture::Unbind(int texunit)
{ {
if (lastbound[texunit] != 0) if (lastbound[texunit] != 0)
{ {
@ -339,7 +339,7 @@ void GLTexture::Unbind(int texunit)
// (re-)creates the texture // (re-)creates the texture
// //
//=========================================================================== //===========================================================================
unsigned int GLTexture::CreateTexture(unsigned char * buffer, int w, int h, bool wrap, int texunit, unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int h, bool wrap, int texunit,
int cm, int translation) int cm, int translation)
{ {
if (cm < 0 || cm >= CM_FIRSTSPECIALCOLORMAP + SpecialColormaps.Size()) cm=CM_DEFAULT; if (cm < 0 || cm >= CM_FIRSTSPECIALCOLORMAP + SpecialColormaps.Size()) cm=CM_DEFAULT;
@ -362,7 +362,7 @@ unsigned int GLTexture::CreateTexture(unsigned char * buffer, int w, int h, bool
// clamping mode and only set when it really changes // clamping mode and only set when it really changes
// //
//=========================================================================== //===========================================================================
void GLTexture::SetTextureClamp(int newclampmode) void FHardwareTexture::SetTextureClamp(int newclampmode)
{ {
if (!gl_clamp_per_texture || (clampmode&GLT_CLAMPX) != (newclampmode&GLT_CLAMPX)) if (!gl_clamp_per_texture || (clampmode&GLT_CLAMPX) != (newclampmode&GLT_CLAMPX))
{ {

View file

@ -22,7 +22,7 @@ enum
GLT_CLAMPY=2 GLT_CLAMPY=2
}; };
class GLTexture class FHardwareTexture
{ {
friend void gl_RenderTextureView(FCanvasTexture *Texture, AActor * Viewpoint, int FOV); friend void gl_RenderTextureView(FCanvasTexture *Texture, AActor * Viewpoint, int FOV);
@ -61,8 +61,8 @@ private:
unsigned * GetTexID(int cm, int translation); unsigned * GetTexID(int cm, int translation);
public: public:
GLTexture(int w, int h, bool mip, bool wrap); FHardwareTexture(int w, int h, bool mip, bool wrap);
~GLTexture(); ~FHardwareTexture();
static void Unbind(int texunit); static void Unbind(int texunit);

View file

@ -723,8 +723,8 @@ void GL1Renderer::RenderTextureView(FCanvasTexture *Texture, AActor * Viewpoint,
gl_fixedcolormap=CM_DEFAULT; gl_fixedcolormap=CM_DEFAULT;
bounds.left=bounds.top=0; bounds.left=bounds.top=0;
bounds.width=GLTexture::GetTexDimension(gltex->GetWidth(FGLTexture::GLUSE_TEXTURE)); bounds.width=FHardwareTexture::GetTexDimension(gltex->GetWidth(FGLTexture::GLUSE_TEXTURE));
bounds.height=GLTexture::GetTexDimension(gltex->GetHeight(FGLTexture::GLUSE_TEXTURE)); bounds.height=FHardwareTexture::GetTexDimension(gltex->GetHeight(FGLTexture::GLUSE_TEXTURE));
gl.Flush(); gl.Flush();
RenderViewpoint(Viewpoint, &bounds, FOV, (float)width/height, (float)width/height, false); RenderViewpoint(Viewpoint, &bounds, FOV, (float)width/height, (float)width/height, false);

View file

@ -2,7 +2,7 @@
** gltexture.cpp ** gltexture.cpp
** The texture classes for hardware rendering ** The texture classes for hardware rendering
** (Even though they are named 'gl' there is nothing hardware dependent ** (Even though they are named 'gl' there is nothing hardware dependent
** in this file. That is all encapsulated in the GLTexture class.) ** in this file. That is all encapsulated in the FHardwareTexture class.)
** **
**--------------------------------------------------------------------------- **---------------------------------------------------------------------------
** Copyright 2004-2005 Christoph Oelckers ** Copyright 2004-2005 Christoph Oelckers
@ -804,7 +804,7 @@ const WorldTextureInfo * FGLTexture::GetWorldTextureInfo()
{ {
if (tex->UseType==FTexture::TEX_Null) return NULL; // Cannot register a NULL texture! if (tex->UseType==FTexture::TEX_Null) return NULL; // Cannot register a NULL texture!
if (!gltexture) gltexture=new GLTexture(Width[GLUSE_TEXTURE], Height[GLUSE_TEXTURE], true, true); if (!gltexture) gltexture=new FHardwareTexture(Width[GLUSE_TEXTURE], Height[GLUSE_TEXTURE], true, true);
if (gltexture) return (WorldTextureInfo*)this; if (gltexture) return (WorldTextureInfo*)this;
return NULL; return NULL;
} }
@ -821,7 +821,7 @@ const PatchTextureInfo * FGLTexture::GetPatchTextureInfo()
if (tex->UseType==FTexture::TEX_Null) return NULL; // Cannot register a NULL texture! if (tex->UseType==FTexture::TEX_Null) return NULL; // Cannot register a NULL texture!
if (!glpatch) if (!glpatch)
{ {
glpatch=new GLTexture(Width[GLUSE_PATCH], Height[GLUSE_PATCH], false, false); glpatch=new FHardwareTexture(Width[GLUSE_PATCH], Height[GLUSE_PATCH], false, false);
} }
if (glpatch) return (PatchTextureInfo*)this; if (glpatch) return (PatchTextureInfo*)this;
return NULL; return NULL;
@ -855,7 +855,7 @@ void FGLTexture::SetupShader(int clampmode, int warped, int &cm, int translation
} }
else else
{ {
GLTexture::Unbind(1); FHardwareTexture::Unbind(1);
usebright = false; usebright = false;
} }
@ -908,10 +908,6 @@ const WorldTextureInfo * FGLTexture::Bind(int texunit, int cm, int clampmode, in
} }
} }
if (cm > 0)
__asm nop
// Bind it to the system. // Bind it to the system.
// clamping in x-direction may cause problems when rendering segs // clamping in x-direction may cause problems when rendering segs
if (!gltexture->Bind(texunit, cm, translation, gl_render_precise? clampmode&GLT_CLAMPY : clampmode)) if (!gltexture->Bind(texunit, cm, translation, gl_render_precise? clampmode&GLT_CLAMPY : clampmode))

View file

@ -55,7 +55,7 @@ public:
class WorldTextureInfo class WorldTextureInfo
{ {
protected: protected:
GLTexture * gltexture; FHardwareTexture * gltexture;
float scalex; float scalex;
float scaley; float scaley;
@ -85,7 +85,7 @@ public:
class PatchTextureInfo class PatchTextureInfo
{ {
protected: protected:
GLTexture * glpatch; FHardwareTexture * glpatch;
void Clean(bool all) void Clean(bool all)
{ {
@ -110,6 +110,7 @@ public:
}; };
//=========================================================================== //===========================================================================
// //
// this is the texture maintenance class for OpenGL. // this is the texture maintenance class for OpenGL.
@ -240,6 +241,7 @@ public:
}; };
void gl_EnableTexture(bool on); void gl_EnableTexture(bool on);
} }