- removed FMaterial references from other high level renderer data like HWFlat and HWSprite.

This commit is contained in:
Christoph Oelckers 2020-04-15 00:29:23 +02:00
parent 1146cf9e08
commit cca3f878f5
11 changed files with 68 additions and 61 deletions

View file

@ -649,6 +649,8 @@ public:
bool isMiscPatch() const { return wrapped.GetUseType() == ETextureType::MiscPatch; } // only used by the intermission screen to decide whether to tile the background image or not. bool isMiscPatch() const { return wrapped.GetUseType() == ETextureType::MiscPatch; } // only used by the intermission screen to decide whether to tile the background image or not.
bool isMultiPatch() const { return wrapped.bMultiPatch; } bool isMultiPatch() const { return wrapped.bMultiPatch; }
bool isFullbrightDisabled() const { return wrapped.isFullbrightDisabled(); } bool isFullbrightDisabled() const { return wrapped.isFullbrightDisabled(); }
bool isFullbright() const { return wrapped.isFullbright(); }
bool expandSprites() const { return wrapped.bExpandSprite; }
bool useWorldPanning() const { return wrapped.UseWorldPanning(); } bool useWorldPanning() const { return wrapped.UseWorldPanning(); }
bool allowNoDecals() const { return wrapped.allowNoDecals(); } bool allowNoDecals() const { return wrapped.allowNoDecals(); }
void SetTranslucent(bool on) { wrapped.bTranslucent = on; } void SetTranslucent(bool on) { wrapped.bTranslucent = on; }
@ -710,7 +712,7 @@ public:
void SetSize(int x, int y) { wrapped.SetSize(x, y); } void SetSize(int x, int y) { wrapped.SetSize(x, y); }
void SetSpriteRect() { wrapped.SetSpriteRect(); } void SetSpriteRect() { wrapped.SetSpriteRect(); }
const SpritePositioningInfo& GetSpritePositioning() { if (wrapped.mTrimResult == -1) wrapped.SetupSpriteData(); return wrapped.spi; } const SpritePositioningInfo& GetSpritePositioning(int which) { /* todo: keep two sets of positioning infd*/ if (wrapped.mTrimResult == -1) wrapped.SetupSpriteData(); return wrapped.spi; }
int GetAreas(FloatRect** pAreas) const { return wrapped.GetAreas(pAreas); } int GetAreas(FloatRect** pAreas) const { return wrapped.GetAreas(pAreas); }
bool GetTranslucency() bool GetTranslucency()

View file

@ -737,7 +737,7 @@ void HWDrawList::SortFlats()
{ {
HWFlat * w1 = flats[a.index]; HWFlat * w1 = flats[a.index];
HWFlat* w2 = flats[b.index]; HWFlat* w2 = flats[b.index];
return w1->gltexture < w2->gltexture; return w1->texture < w2->texture;
}); });
} }
} }

View file

@ -96,12 +96,12 @@ void HWDrawInfo::AddFlat(HWFlat *flat, bool fog)
{ {
int list; int list;
if (flat->renderstyle != STYLE_Translucent || flat->alpha < 1.f - FLT_EPSILON || fog || flat->gltexture == nullptr) if (flat->renderstyle != STYLE_Translucent || flat->alpha < 1.f - FLT_EPSILON || fog || flat->texture == nullptr)
{ {
// translucent 3D floors go into the regular translucent list, translucent portals go into the translucent border list. // translucent 3D floors go into the regular translucent list, translucent portals go into the translucent border list.
list = (flat->renderflags&SSRF_RENDER3DPLANES) ? GLDL_TRANSLUCENT : GLDL_TRANSLUCENTBORDER; list = (flat->renderflags&SSRF_RENDER3DPLANES) ? GLDL_TRANSLUCENT : GLDL_TRANSLUCENTBORDER;
} }
else if (flat->gltexture->GetTranslucency()) else if (flat->texture->GetTranslucency())
{ {
if (flat->stack) if (flat->stack)
{ {
@ -118,7 +118,7 @@ void HWDrawInfo::AddFlat(HWFlat *flat, bool fog)
} }
else //if (flat->hacktype != SSRF_FLOODHACK) // The flood hack may later need different treatment but with the current setup can go into the existing render list. else //if (flat->hacktype != SSRF_FLOODHACK) // The flood hack may later need different treatment but with the current setup can go into the existing render list.
{ {
bool masked = flat->gltexture->isMasked() && ((flat->renderflags&SSRF_RENDER3DPLANES) || flat->stack); bool masked = flat->texture->isMasked() && ((flat->renderflags&SSRF_RENDER3DPLANES) || flat->stack);
list = masked ? GLDL_MASKEDFLATS : GLDL_PLAINFLATS; list = masked ? GLDL_MASKEDFLATS : GLDL_PLAINFLATS;
} }
auto newflat = drawlists[list].NewFlat(); auto newflat = drawlists[list].NewFlat();

View file

@ -295,7 +295,7 @@ class HWFlat
public: public:
sector_t * sector; sector_t * sector;
FSection *section; FSection *section;
FMaterial *gltexture; FGameTexture *texture;
TextureManipulation* TextureFx; TextureManipulation* TextureFx;
float z; // the z position of the flat (only valid for non-sloped planes) float z; // the z position of the flat (only valid for non-sloped planes)
@ -369,7 +369,7 @@ public:
float trans; float trans;
int dynlightindex; int dynlightindex;
FMaterial *gltexture; FGameTexture *texture;
AActor * actor; AActor * actor;
particle_t * particle; particle_t * particle;
TArray<lightlist_t> *lightlist; TArray<lightlist_t> *lightlist;
@ -426,7 +426,7 @@ inline float Dist2(float x1,float y1,float x2,float y2)
return sqrtf((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); return sqrtf((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
} }
bool hw_SetPlaneTextureRotation(const HWSectorPlane * secplane, FMaterial * gltexture, VSMatrix &mat); bool hw_SetPlaneTextureRotation(const HWSectorPlane * secplane, FGameTexture * gltexture, VSMatrix &mat);
void hw_GetDynModelLight(AActor *self, FDynLightData &modellightdata); void hw_GetDynModelLight(AActor *self, FDynLightData &modellightdata);
extern const float LARGE_VALUE; extern const float LARGE_VALUE;

View file

@ -45,6 +45,7 @@
#include "hwrenderer/dynlights/hw_lightbuffer.h" #include "hwrenderer/dynlights/hw_lightbuffer.h"
#include "hw_drawstructs.h" #include "hw_drawstructs.h"
#include "hw_renderstate.h" #include "hw_renderstate.h"
#include "texturemanager.h"
#ifdef _DEBUG #ifdef _DEBUG
CVAR(Int, gl_breaksec, -1, 0) CVAR(Int, gl_breaksec, -1, 0)
@ -56,28 +57,28 @@ CVAR(Int, gl_breaksec, -1, 0)
// //
//========================================================================== //==========================================================================
bool hw_SetPlaneTextureRotation(const HWSectorPlane * secplane, FMaterial * gltexture, VSMatrix &dest) bool hw_SetPlaneTextureRotation(const HWSectorPlane * secplane, FGameTexture * gltexture, VSMatrix &dest)
{ {
// only manipulate the texture matrix if needed. // only manipulate the texture matrix if needed.
if (!secplane->Offs.isZero() || if (!secplane->Offs.isZero() ||
secplane->Scale.X != 1. || secplane->Scale.Y != 1 || secplane->Scale.X != 1. || secplane->Scale.Y != 1 ||
secplane->Angle != 0 || secplane->Angle != 0 ||
gltexture->TextureWidth() != 64 || gltexture->GetDisplayWidth() != 64 ||
gltexture->TextureHeight() != 64) gltexture->GetDisplayHeight() != 64)
{ {
float uoffs = secplane->Offs.X / gltexture->TextureWidth(); float uoffs = secplane->Offs.X / gltexture->GetDisplayWidth();
float voffs = secplane->Offs.Y / gltexture->TextureHeight(); float voffs = secplane->Offs.Y / gltexture->GetDisplayHeight();
float xscale1 = secplane->Scale.X; float xscale1 = secplane->Scale.X;
float yscale1 = secplane->Scale.Y; float yscale1 = secplane->Scale.Y;
if (gltexture->hasCanvas()) if (gltexture->isHardwareCanvas())
{ {
yscale1 = 0 - yscale1; yscale1 = 0 - yscale1;
} }
float angle = -secplane->Angle; float angle = -secplane->Angle;
float xscale2 = 64.f / gltexture->TextureWidth(); float xscale2 = 64.f / gltexture->GetDisplayWidth();
float yscale2 = 64.f / gltexture->TextureHeight(); float yscale2 = 64.f / gltexture->GetDisplayHeight();
dest.loadIdentity(); dest.loadIdentity();
dest.scale(xscale1, yscale1, 1.0f); dest.scale(xscale1, yscale1, 1.0f);
@ -203,7 +204,7 @@ void HWFlat::DrawSubsectors(HWDrawInfo *di, FRenderState &state)
void HWFlat::DrawOtherPlanes(HWDrawInfo *di, FRenderState &state) void HWFlat::DrawOtherPlanes(HWDrawInfo *di, FRenderState &state)
{ {
state.SetMaterial(gltexture, CLAMP_NONE, 0, -1); state.SetMaterial(texture, false, CLAMP_NONE, 0, -1);
// Draw the subsectors assigned to it due to missing textures // Draw the subsectors assigned to it due to missing textures
auto pNode = (renderflags&SSRF_RENDERFLOOR) ? auto pNode = (renderflags&SSRF_RENDERFLOOR) ?
@ -235,7 +236,7 @@ void HWFlat::DrawFloodPlanes(HWDrawInfo *di, FRenderState &state)
// This requires a stencil because the projected plane interferes with // This requires a stencil because the projected plane interferes with
// the depth buffer // the depth buffer
state.SetMaterial(gltexture, CLAMP_NONE, 0, -1); state.SetMaterial(texture, false, CLAMP_NONE, 0, -1);
// Draw the subsectors assigned to it due to missing textures // Draw the subsectors assigned to it due to missing textures
auto pNode = (renderflags&SSRF_RENDERFLOOR) ? auto pNode = (renderflags&SSRF_RENDERFLOOR) ?
@ -323,14 +324,14 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
{ {
if (sector->special != GLSector_Skybox) if (sector->special != GLSector_Skybox)
{ {
state.SetMaterial(gltexture, CLAMP_NONE, 0, -1); state.SetMaterial(texture, false, CLAMP_NONE, 0, -1);
state.SetPlaneTextureRotation(&plane, gltexture); state.SetPlaneTextureRotation(&plane, texture);
DrawSubsectors(di, state); DrawSubsectors(di, state);
state.EnableTextureMatrix(false); state.EnableTextureMatrix(false);
} }
else if (!hacktype) else if (!hacktype)
{ {
state.SetMaterial(gltexture, CLAMP_XY, 0, -1); state.SetMaterial(texture, false, CLAMP_XY, 0, -1);
state.SetLightIndex(dynlightindex); state.SetLightIndex(dynlightindex);
state.Draw(DT_TriangleStrip,iboindex, 4); state.Draw(DT_TriangleStrip,iboindex, 4);
flatvertices += 4; flatvertices += 4;
@ -340,7 +341,7 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
else else
{ {
state.SetRenderStyle(renderstyle); state.SetRenderStyle(renderstyle);
if (!gltexture) if (!texture || !texture->isValid())
{ {
state.AlphaFunc(Alpha_GEqual, 0.f); state.AlphaFunc(Alpha_GEqual, 0.f);
state.EnableTexture(false); state.EnableTexture(false);
@ -349,10 +350,10 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
} }
else else
{ {
if (!gltexture->GetTranslucency()) state.AlphaFunc(Alpha_GEqual, gl_mask_threshold); if (!texture->GetTranslucency()) state.AlphaFunc(Alpha_GEqual, gl_mask_threshold);
else state.AlphaFunc(Alpha_GEqual, 0.f); else state.AlphaFunc(Alpha_GEqual, 0.f);
state.SetMaterial(gltexture, CLAMP_NONE, 0, -1); state.SetMaterial(texture, false, CLAMP_NONE, 0, -1);
state.SetPlaneTextureRotation(&plane, gltexture); state.SetPlaneTextureRotation(&plane, texture);
DrawSubsectors(di, state); DrawSubsectors(di, state);
state.EnableTextureMatrix(false); state.EnableTextureMatrix(false);
} }
@ -379,7 +380,7 @@ inline void HWFlat::PutFlat(HWDrawInfo *di, bool fog)
} }
else if (!screen->BuffersArePersistent()) else if (!screen->BuffersArePersistent())
{ {
if (di->Level->HasDynamicLights && gltexture != nullptr && !di->isFullbrightScene() && !(hacktype & (SSRF_PLANEHACK|SSRF_FLOODHACK)) ) if (di->Level->HasDynamicLights && texture != nullptr && !di->isFullbrightScene() && !(hacktype & (SSRF_PLANEHACK|SSRF_FLOODHACK)) )
{ {
SetupLights(di, section->lighthead, lightdata, sector->PortalGroup); SetupLights(di, section->lighthead, lightdata, sector->PortalGroup);
} }
@ -405,9 +406,9 @@ void HWFlat::Process(HWDrawInfo *di, sector_t * model, int whichplane, bool fog)
if (!fog) if (!fog)
{ {
gltexture=FMaterial::ValidateTexture(plane.texture, false, true); texture = TexMan.GetGameTexture(plane.texture, true);
if (!gltexture) return; if (!texture || !texture->isValid()) return;
if (gltexture->isFullbright()) if (texture->isFullbright())
{ {
Colormap.MakeWhite(); Colormap.MakeWhite();
lightlevel=255; lightlevel=255;
@ -415,7 +416,7 @@ void HWFlat::Process(HWDrawInfo *di, sector_t * model, int whichplane, bool fog)
} }
else else
{ {
gltexture = NULL; texture = NULL;
lightlevel = abs(lightlevel); lightlevel = abs(lightlevel);
} }

View file

@ -36,6 +36,7 @@
#include "hwrenderer/data/flatvertices.h" #include "hwrenderer/data/flatvertices.h"
#include "hwrenderer/utility/hw_clock.h" #include "hwrenderer/utility/hw_clock.h"
#include "hwrenderer/utility/hw_lighting.h" #include "hwrenderer/utility/hw_lighting.h"
#include "texturemanager.h"
EXTERN_CVAR(Int, r_mirror_recursions) EXTERN_CVAR(Int, r_mirror_recursions)
EXTERN_CVAR(Bool, gl_portals) EXTERN_CVAR(Bool, gl_portals)
@ -947,12 +948,12 @@ void HWHorizonPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
{ {
Clocker c(PortalAll); Clocker c(PortalAll);
FMaterial * gltexture;
HWSectorPlane * sp = &origin->plane; HWSectorPlane * sp = &origin->plane;
auto &vp = di->Viewpoint; auto &vp = di->Viewpoint;
gltexture = FMaterial::ValidateTexture(sp->texture, false, true); auto texture = TexMan.GetGameTexture(sp->texture, true);
if (!gltexture)
if (!texture || !texture->isValid())
{ {
state.ClearScreen(); state.ClearScreen();
return; return;
@ -960,7 +961,7 @@ void HWHorizonPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
di->SetCameraPos(vp.Pos); di->SetCameraPos(vp.Pos);
if (gltexture && gltexture->isFullbright()) if (texture->isFullbright())
{ {
// glowing textures are always drawn full bright without color // glowing textures are always drawn full bright without color
di->SetColor(state, 255, 0, false, origin->colormap, 1.f); di->SetColor(state, 255, 0, false, origin->colormap, 1.f);
@ -974,10 +975,10 @@ void HWHorizonPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
} }
state.SetMaterial(gltexture, CLAMP_NONE, 0, -1); state.SetMaterial(texture, false, CLAMP_NONE, 0, -1);
state.SetObjectColor(origin->specialcolor); state.SetObjectColor(origin->specialcolor);
state.SetPlaneTextureRotation(sp, gltexture); state.SetPlaneTextureRotation(sp, texture);
state.AlphaFunc(Alpha_GEqual, 0.f); state.AlphaFunc(Alpha_GEqual, 0.f);
state.SetRenderStyle(STYLE_Source); state.SetRenderStyle(STYLE_Source);

View file

@ -522,7 +522,7 @@ public:
else mAlphaThreshold = thresh - 0.001f; else mAlphaThreshold = thresh - 0.001f;
} }
void SetPlaneTextureRotation(HWSectorPlane *plane, FMaterial *texture) void SetPlaneTextureRotation(HWSectorPlane *plane, FGameTexture *texture)
{ {
if (hw_SetPlaneTextureRotation(plane, texture, mTextureMatrix)) if (hw_SetPlaneTextureRotation(plane, texture, mTextureMatrix))
{ {
@ -569,6 +569,12 @@ public:
mTextureModeFlags = mat->GetLayerFlags(); mTextureModeFlags = mat->GetLayerFlags();
} }
void SetMaterial(FGameTexture* tex, bool expandmode, int clampmode, int translation, int overrideshader)
{
expandmode &= tex->expandSprites();
SetMaterial(FMaterial::ValidateTexture(tex->GetTexture(), expandmode), clampmode, translation, overrideshader);
}
void SetClipSplit(float bottom, float top) void SetClipSplit(float bottom, float top)
{ {
mClipSplit[0] = bottom; mClipSplit[0] = bottom;

View file

@ -94,7 +94,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
// Optionally use STYLE_ColorBlend in place of STYLE_Add for fullbright items. // Optionally use STYLE_ColorBlend in place of STYLE_Add for fullbright items.
if (RenderStyle == LegacyRenderStyles[STYLE_Add] && trans > 1.f - FLT_EPSILON && if (RenderStyle == LegacyRenderStyles[STYLE_Add] && trans > 1.f - FLT_EPSILON &&
gl_usecolorblending && !di->isFullbrightScene() && actor && gl_usecolorblending && !di->isFullbrightScene() && actor &&
fullbright && gltexture && !gltexture->GetTranslucency()) fullbright && texture && !texture->GetTranslucency())
{ {
RenderStyle = LegacyRenderStyles[STYLE_ColorAdd]; RenderStyle = LegacyRenderStyles[STYLE_ColorAdd];
} }
@ -106,7 +106,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
{ {
state.AlphaFunc(Alpha_GEqual, 0.f); state.AlphaFunc(Alpha_GEqual, 0.f);
} }
else if (!gltexture || !gltexture->GetTranslucency()) state.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold); else if (!texture || !texture->GetTranslucency()) state.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold);
else state.AlphaFunc(Alpha_Greater, 0.f); else state.AlphaFunc(Alpha_Greater, 0.f);
if (RenderStyle.BlendOp == STYLEOP_Shadow) if (RenderStyle.BlendOp == STYLEOP_Shadow)
@ -197,7 +197,8 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
state.SetFog(0, 0); state.SetFog(0, 0);
} }
if (gltexture) state.SetMaterial(gltexture, CLAMP_XY, translation, OverrideShader); uint32_t spritetype = (actor->renderflags & RF_SPRITETYPEMASK);
if (texture) state.SetMaterial(texture, spritetype == RF_FACESPRITE, CLAMP_XY, translation, OverrideShader);
else if (!modelframe) state.EnableTexture(false); else if (!modelframe) state.EnableTexture(false);
//SetColor(lightlevel, rel, Colormap, trans); //SetColor(lightlevel, rel, Colormap, trans);
@ -818,7 +819,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
int type = thing->renderflags & RF_SPRITETYPEMASK; int type = thing->renderflags & RF_SPRITETYPEMASK;
auto tex = TexMan.GetGameTexture(patch, false); auto tex = TexMan.GetGameTexture(patch, false);
if (!tex || !tex->isValid()) return; if (!tex || !tex->isValid()) return;
auto& spi = tex->GetSpritePositioning(); auto& spi = tex->GetSpritePositioning(type == RF_FACESPRITE);
vt = spi.GetSpriteVT(); vt = spi.GetSpriteVT();
vb = spi.GetSpriteVB(); vb = spi.GetSpriteVB();
@ -842,8 +843,8 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
ur = spi.GetSpriteUL(); ur = spi.GetSpriteUL();
} }
gltexture = FMaterial::ValidateTexture(patch, (type == RF_FACESPRITE), false); texture = TexMan.GetGameTexture(patch, false);
if (!gltexture) if (!texture || !texture->isValid())
return; return;
if (thing->renderflags & RF_SPRITEFLIP) // [SP] Flip back if (thing->renderflags & RF_SPRITEFLIP) // [SP] Flip back
@ -904,7 +905,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
x1 = x2 = x; x1 = x2 = x;
y1 = y2 = y; y1 = y2 = y;
z1 = z2 = z; z1 = z2 = z;
gltexture = nullptr; texture = nullptr;
} }
depth = (float)((x - vp.Pos.X) * vp.TanCos + (y - vp.Pos.Y) * vp.TanSin); depth = (float)((x - vp.Pos.X) * vp.TanCos + (y - vp.Pos.Y) * vp.TanSin);
@ -916,7 +917,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
// allow disabling of the fullbright flag by a brightmap definition // allow disabling of the fullbright flag by a brightmap definition
// (e.g. to do the gun flashes of Doom's zombies correctly. // (e.g. to do the gun flashes of Doom's zombies correctly.
fullbright = (thing->flags5 & MF5_BRIGHT) || fullbright = (thing->flags5 & MF5_BRIGHT) ||
((thing->renderflags & RF_FULLBRIGHT) && (!gltexture || !gltexture->Source()->isFullbrightDisabled())); ((thing->renderflags & RF_FULLBRIGHT) && (!texture || !texture->isFullbrightDisabled()));
lightlevel = fullbright ? 255 : lightlevel = fullbright ? 255 :
hw_ClampLight(rendersector->GetTexture(sector_t::ceiling) == skyflatnum ? hw_ClampLight(rendersector->GetTexture(sector_t::ceiling) == skyflatnum ?
@ -1035,7 +1036,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
RenderStyle.DestAlpha = STYLEALPHA_InvSrc; RenderStyle.DestAlpha = STYLEALPHA_InvSrc;
} }
} }
if ((gltexture && gltexture->GetTranslucency()) || (RenderStyle.Flags & STYLEF_RedIsAlpha) || (modelframe && thing->RenderStyle != DefaultRenderStyle())) if ((texture && texture->GetTranslucency()) || (RenderStyle.Flags & STYLEF_RedIsAlpha) || (modelframe && thing->RenderStyle != DefaultRenderStyle()))
{ {
if (hw_styleflags == STYLEHW_Solid) if (hw_styleflags == STYLEHW_Solid)
{ {
@ -1163,7 +1164,7 @@ void HWSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *
ThingColor.a = 255; ThingColor.a = 255;
modelframe=nullptr; modelframe=nullptr;
gltexture=nullptr; texture=nullptr;
topclip = LARGE_VALUE; topclip = LARGE_VALUE;
bottomclip = -LARGE_VALUE; bottomclip = -LARGE_VALUE;
index = 0; index = 0;
@ -1191,7 +1192,7 @@ void HWSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *
ur = 1; ur = 1;
vt = 0; vt = 0;
vb = 1; vb = 1;
gltexture = FMaterial::ValidateTexture(lump, true, false); texture = TexMan.GetGameTexture(lump, false);
} }
} }

View file

@ -103,8 +103,8 @@ void HWWall::RenderMirrorSurface(HWDrawInfo *di, FRenderState &state)
state.SetRenderStyle(STYLE_Add); state.SetRenderStyle(STYLE_Add);
state.AlphaFunc(Alpha_Greater, 0); state.AlphaFunc(Alpha_Greater, 0);
FMaterial * pat = FMaterial::ValidateTexture(TexMan.mirrorTexture, false, false); auto tex = TexMan.GetGameTexture(TexMan.mirrorTexture, false);
state.SetMaterial(pat, CLAMP_NONE, 0, -1); state.SetMaterial(tex, false, CLAMP_NONE, 0, -1);
flags &= ~HWWall::HWF_GLOW; flags &= ~HWWall::HWF_GLOW;
RenderWall(di, state, HWWall::RWF_BLANK); RenderWall(di, state, HWWall::RWF_BLANK);
@ -156,8 +156,7 @@ void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags)
state.SetGlowParams(topglowcolor, bottomglowcolor); state.SetGlowParams(topglowcolor, bottomglowcolor);
state.SetGlowPlanes(frontsector->ceilingplane, frontsector->floorplane); state.SetGlowPlanes(frontsector->ceilingplane, frontsector->floorplane);
} }
auto mat = FMaterial::ValidateTexture(texture->GetTexture(), false, true); state.SetMaterial(texture, false, flags & 3, 0, -1);
state.SetMaterial(mat, flags & 3, 0, -1);
if (type == RENDERWALL_M2SNF) if (type == RENDERWALL_M2SNF)
{ {

View file

@ -94,9 +94,9 @@ void HWDrawInfo::DrawPSprite(HUDSprite *huds, FRenderState &state)
} }
else else
{ {
float thresh = (huds->tex->GetTranslucency() || huds->OverrideShader != -1) ? 0.f : gl_mask_sprite_threshold; float thresh = (huds->texture->GetTranslucency() || huds->OverrideShader != -1) ? 0.f : gl_mask_sprite_threshold;
state.AlphaFunc(Alpha_GEqual, thresh); state.AlphaFunc(Alpha_GEqual, thresh);
state.SetMaterial(huds->tex, CLAMP_XY_NOMIP, (huds->weapon->Flags & PSPF_PLAYERTRANSLATED) ? huds->owner->Translation : 0, huds->OverrideShader); state.SetMaterial(huds->texture, true, CLAMP_XY_NOMIP, (huds->weapon->Flags & PSPF_PLAYERTRANSLATED) ? huds->owner->Translation : 0, huds->OverrideShader);
state.Draw(DT_TriangleStrip, huds->mx, 4); state.Draw(DT_TriangleStrip, huds->mx, 4);
} }
@ -419,7 +419,7 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
auto tex = TexMan.GetGameTexture(lump, false); auto tex = TexMan.GetGameTexture(lump, false);
if (!tex || !tex->isValid()) return false; if (!tex || !tex->isValid()) return false;
auto& spi = tex->GetSpritePositioning(); auto& spi = tex->GetSpritePositioning(1);
float vw = (float)viewwidth; float vw = (float)viewwidth;
float vh = (float)viewheight; float vh = (float)viewheight;
@ -473,10 +473,7 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
verts.first[2].Set(x2, y1, 0, u2, v1); verts.first[2].Set(x2, y1, 0, u2, v1);
verts.first[3].Set(x2, y2, 0, u2, v2); verts.first[3].Set(x2, y2, 0, u2, v2);
FMaterial* mat = FMaterial::ValidateTexture(lump, true, false); texture = tex;
if (!mat) return false;
this->tex = mat;
return true; return true;
} }

View file

@ -8,7 +8,7 @@ class AActor;
enum area_t : int; enum area_t : int;
struct FSpriteModelFrame; struct FSpriteModelFrame;
struct HWDrawInfo; struct HWDrawInfo;
class FMaterial; class FGameTexture;
struct WeaponPosition struct WeaponPosition
@ -29,7 +29,7 @@ struct HUDSprite
{ {
AActor *owner; AActor *owner;
DPSprite *weapon; DPSprite *weapon;
FMaterial *tex; FGameTexture *texture;
FSpriteModelFrame *mframe; FSpriteModelFrame *mframe;
FColormap cm; FColormap cm;