- removed all GL dependencies from gl_material.h.

This commit is contained in:
Christoph Oelckers 2018-04-24 22:37:52 +02:00
parent 5e8a4b96fe
commit f9a82e66e4
11 changed files with 29 additions and 25 deletions

View File

@ -49,6 +49,7 @@
#include "gl/shaders/gl_presentshader.h"
#include "gl/shaders/gl_postprocessshaderinstance.h"
#include "gl/stereo3d/gl_stereo3d.h"
#include "gl/textures/gl_hwtexture.h"
#include "r_videoscale.h"
//==========================================================================

View File

@ -33,6 +33,7 @@
#include "gl/system/gl_cvars.h"
#include "gl/shaders/gl_shader.h"
#include "gl/renderer/gl_renderer.h"
#include "gl/renderer/gl_colormap.h"
#include "gl/dynlights//gl_lightbuffer.h"
#include "gl/renderer/gl_renderbuffers.h"

View File

@ -29,6 +29,7 @@
#include "gl/system/gl_debug.h"
#include "gl/data/gl_vertexbuffer.h"
#include "gl/shaders/gl_shader.h"
#include "gl/textures/gl_hwtexture.h"
#include "gl_swscene.h"
#include "w_wad.h"
#include "d_player.h"

View File

@ -116,8 +116,8 @@ public:
enum
{
//GLWF_CLAMPX=1, use GLT_* for these!
//GLWF_CLAMPY=2,
GLWF_CLAMPX=1,
GLWF_CLAMPY=2,
GLWF_SKYHACK=4,
GLWF_GLOW=8, // illuminated by glowing flats
GLWF_NOSPLITUPPER=16,

View File

@ -33,6 +33,7 @@
#include "hwrenderer/dynlights/hw_dynlightdata.h"
#include "gl/system/gl_cvars.h"
#include "gl/system/gl_interface.h"
#include "gl/renderer/gl_lightdata.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_portal.h"
@ -601,7 +602,7 @@ bool GLWall::SetWallCoordinates(seg_t * seg, FTexCoordInfo *tci, float textureto
{
bool normalize = false;
if (gltexture->tex->bHasCanvas) normalize = true;
else if (flags & GLT_CLAMPY)
else if (flags & GLWF_CLAMPY)
{
// for negative scales we can get negative coordinates here.
normalize = (tcs[UPLFT].v > tcs[LOLFT].v || tcs[UPRGT].v > tcs[LORGT].v);
@ -651,7 +652,7 @@ void GLWall::CheckTexturePosition(FTexCoordInfo *tci)
if ((tcs[UPLFT].v == 0.f && tcs[UPRGT].v == 0.f && tcs[LOLFT].v <= 1.f && tcs[LORGT].v <= 1.f) ||
(tcs[UPLFT].v >= 0.f && tcs[UPRGT].v >= 0.f && tcs[LOLFT].v == 1.f && tcs[LORGT].v == 1.f))
{
flags |= GLT_CLAMPY;
flags |= GLWF_CLAMPY;
}
}
else
@ -672,7 +673,7 @@ void GLWall::CheckTexturePosition(FTexCoordInfo *tci)
if ((tcs[LOLFT].v == 0.f && tcs[LORGT].v == 0.f && tcs[UPLFT].v <= 1.f && tcs[UPRGT].v <= 1.f) ||
(tcs[LOLFT].v >= 0.f && tcs[LORGT].v >= 0.f && tcs[UPLFT].v == 1.f && tcs[UPRGT].v == 1.f))
{
flags |= GLT_CLAMPY;
flags |= GLWF_CLAMPY;
}
}
@ -688,7 +689,7 @@ void GLWall::CheckTexturePosition(FTexCoordInfo *tci)
if ((tcs[UPLFT].u == 0.f && tcs[LOLFT].u == 0.f && tcs[UPRGT].u <= 1.f && tcs[LORGT].u <= 1.f) ||
(tcs[UPLFT].u >= 0.f && tcs[LOLFT].u >= 0.f && tcs[UPRGT].u == 1.f && tcs[LORGT].u == 1.f))
{
flags |= GLT_CLAMPX;
flags |= GLWF_CLAMPX;
}
}
}
@ -941,15 +942,15 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
if ((textureoffset == 0 && righttex <= tci.mRenderWidth) ||
(textureoffset >= 0 && righttex == tci.mRenderWidth))
{
flags |= GLT_CLAMPX;
flags |= GLWF_CLAMPX;
}
else
{
flags &= ~GLT_CLAMPX;
flags &= ~GLWF_CLAMPX;
}
if (!wrap)
{
flags |= GLT_CLAMPY;
flags |= GLWF_CLAMPY;
}
}
if (mirrory)
@ -1081,7 +1082,7 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
}
// restore some values that have been altered in this function
glseg=glsave;
flags&=~(GLT_CLAMPX|GLT_CLAMPY|GLWF_NOSPLITUPPER|GLWF_NOSPLITLOWER);
flags&=~(GLWF_CLAMPX|GLWF_CLAMPY|GLWF_NOSPLITUPPER|GLWF_NOSPLITLOWER);
RenderStyle = STYLE_Normal;
}
@ -1192,7 +1193,7 @@ void GLWall::BuildFFBlock(seg_t * seg, F3DFloor * rover,
alpha = 1.0f;
lightlevel = savelight;
Colormap = savecolor;
flags &= ~GLT_CLAMPY;
flags &= ~GLWF_CLAMPY;
}

View File

@ -327,7 +327,7 @@ void GLWall::RenderTextured(int rflags)
if (type == RENDERWALL_M2SNF)
{
if (flags & GLT_CLAMPY)
if (flags & GLWF_CLAMPY)
{
if (tmode == TM_MODULATE) gl_RenderState.SetTextureMode(TM_CLAMPY);
}

View File

@ -34,6 +34,7 @@
#include "gl/system/gl_cvars.h"
#include "gl/system/gl_debug.h"
#include "gl/renderer/gl_renderer.h"
#include "gl/renderer/gl_colormap.h"
#include "gl/textures/gl_material.h"
#include "gl/textures/gl_samplers.h"

View File

@ -16,18 +16,13 @@ class FCanvasTexture;
class AActor;
typedef TMap<int, bool> SpriteHits;
// For error catching while changing parameters.
enum EInvalid
{
Invalid = 0
};
enum
{
GLT_CLAMPX=1,
GLT_CLAMPY=2
};
class FHardwareTexture
{
public:

View File

@ -30,6 +30,7 @@
#include "gl/system/gl_interface.h"
#include "gl/system/gl_framebuffer.h"
#include "gl/renderer/gl_renderer.h"
#include "gl/textures/gl_hwtexture.h"
#include "gl/textures/gl_material.h"
#include "gl/shaders/gl_shader.h"
@ -634,7 +635,7 @@ void FMaterial::FlushAll()
{
for(int i=mMaterials.Size()-1;i>=0;i--)
{
mMaterials[i]->Clean(true);
mMaterials[i]->mBaseLayer->Clean(true);
}
// This is for shader layers. All shader layers must be managed by the texture manager
// so this will catch everything.
@ -652,3 +653,9 @@ void FMaterial::ClearLastTexture()
{
last = NULL;
}
void FMaterial::Clean(bool f)
{
// This somehow needs to deal with the other layers as well, but they probably need some form of reference counting to work properly...
mBaseLayer->Clean(f);
}

View File

@ -4,8 +4,6 @@
#include "m_fixed.h"
#include "textures/textures.h"
#include "gl/textures/gl_hwtexture.h"
#include "gl/renderer/gl_colormap.h"
#include "i_system.h"
#include "r_defs.h"
@ -112,10 +110,7 @@ public:
void Bind(int clamp, int translation);
void Clean(bool f)
{
mBaseLayer->Clean(f);
}
void Clean(bool f);
void BindToFrameBuffer();
// Patch drawing utilities

View File

@ -44,6 +44,8 @@
#include "r_data/r_translate.h"
#include <vector>
typedef TMap<int, bool> SpriteHits;
enum MaterialShaderIndex
{
SHADER_Default,