- fixed all compiler errors.

It mostly works again, but still has a few glitches.
This commit is contained in:
Christoph Oelckers 2019-10-18 19:06:57 +02:00
parent ed415c1fa0
commit dab7c43f7c
15 changed files with 60 additions and 65 deletions

View file

@ -15,11 +15,27 @@ struct mdmodel_t
{ {
int32_t mdnum, shadeoff; int32_t mdnum, shadeoff;
float scale, bscale, zadd, yoffset; float scale, bscale, zadd, yoffset;
FTexture **textures; FTexture *texture;
int32_t flags; int32_t flags;
}; };
struct mdanim_t
{
int32_t startframe, endframe;
int32_t fpssc, flags;
mdanim_t* next;
};
struct mdskinmap_t
{
uint8_t palette, flags, filler[2]; // Build palette number, flags the same as hightiles
int32_t skinnum, surfnum; // Skin identifier, surface number
FTexture* texture;
mdskinmap_t* next;
float param, specpower, specfactor;
};
struct idmodel_t : public mdmodel_t struct idmodel_t : public mdmodel_t
{ {
int32_t numframes, cframe, nframe, fpssc, usesalpha; int32_t numframes, cframe, nframe, fpssc, usesalpha;
@ -29,24 +45,9 @@ struct idmodel_t : public mdmodel_t
int32_t numskins, skinloaded; int32_t numskins, skinloaded;
}; };
typedef struct _mdanim_t
{
int32_t startframe, endframe;
int32_t fpssc, flags;
struct _mdanim_t *next;
} mdanim_t;
#define MDANIM_LOOP 0 #define MDANIM_LOOP 0
#define MDANIM_ONESHOT 1 #define MDANIM_ONESHOT 1
typedef struct _mdskinmap_t
{
uint8_t palette, flags, filler[2]; // Build palette number, flags the same as hightiles
int32_t skinnum, surfnum; // Skin identifier, surface number
FTexture *texture;
struct _mdskinmap_t *next;
float param, specpower, specfactor;
} mdskinmap_t;
//This MD2 code is based on the source code from David Henry (tfc_duke(at)hotmail.com) //This MD2 code is based on the source code from David Henry (tfc_duke(at)hotmail.com)
@ -189,12 +190,12 @@ struct voxmodel_t : public mdmodel_t
vec3f_t piv; vec3f_t piv;
int32_t is8bit; int32_t is8bit;
} voxmodel_t; };
EXTERN mdmodel_t **models; EXTERN mdmodel_t **models;
void updateanimation(md2model_t *m, tspriteptr_t tspr, uint8_t lpal); void updateanimation(md2model_t *m, tspriteptr_t tspr, uint8_t lpal);
FTexture *mdloadskin(idmodel_t *m, int32_t number, int32_t pal, int32_t surf, bool *exact) FTexture* mdloadskin(idmodel_t* m, int32_t number, int32_t pal, int32_t surf, bool* exact);
void mdinit(void); void mdinit(void);
void freeallmodels(void); void freeallmodels(void);
int32_t polymost_mddraw(tspriteptr_t tspr); int32_t polymost_mddraw(tspriteptr_t tspr);

View file

@ -805,7 +805,7 @@ static md2model_t *md2load(buildvfs_kfd fil, const char *filnam)
// the MD2 is now loaded internally - let's begin the MD3 conversion process // the MD2 is now loaded internally - let's begin the MD3 conversion process
//OSD_Printf("Beginning md3 conversion.\n"); //OSD_Printf("Beginning md3 conversion.\n");
m3 = (md3model_t *)Xcalloc(1, sizeof(md3model_t)); m3 = (md3model_t *)Xcalloc(1, sizeof(md3model_t));
m3->mdnum = 3; m3->texture = nullptr m3->scale = m->scale; m3->mdnum = 3; m3->texture = nullptr; m3->scale = m->scale;
m3->head.id = IDP3_MAGIC; m3->head.vers = 15; m3->head.id = IDP3_MAGIC; m3->head.vers = 15;
m3->head.flags = 0; m3->head.flags = 0;
@ -911,7 +911,7 @@ static md2model_t *md2load(buildvfs_kfd fil, const char *filnam)
sk->texture = TileFiles.GetTexture(fn); sk->texture = TileFiles.GetTexture(fn);
if (!sk->texture) if (!sk->texture)
{ {
initprintf("Unable to load %s as model skin\n", skinfn); initprintf("Unable to load %s as model skin\n", m->skinfn);
} }
} }
m3->skinmap = sk; m3->skinmap = sk;
@ -1743,7 +1743,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
det = tex = r_detailmapping ? mdloadskin((md2model_t *) m, tile2model[Ptile2tile(tspr->picnum, lpal)].skinnum, DETAILPAL, surfi, nullptr) : nullptr; det = tex = r_detailmapping ? mdloadskin((md2model_t *) m, tile2model[Ptile2tile(tspr->picnum, lpal)].skinnum, DETAILPAL, surfi, nullptr) : nullptr;
if (det) if (det)
{ {
for (sk = m->skinmap; sk; sk = sk->next) for (auto sk = m->skinmap; sk; sk = sk->next)
if ((int32_t) sk->palette == DETAILPAL && sk->skinnum == tile2model[Ptile2tile(tspr->picnum, lpal)].skinnum && sk->surfnum == surfi) if ((int32_t) sk->palette == DETAILPAL && sk->skinnum == tile2model[Ptile2tile(tspr->picnum, lpal)].skinnum && sk->surfnum == surfi)
detscale = sk->param; detscale = sk->param;
} }

View file

@ -267,8 +267,7 @@ void polymost_glreset()
} }
else else
{ {
TileFiles.CleatTextureCache(); TileFiles.ClearTextureCache();
clearskins(INVALIDATE_ALL);
} }
if (polymosttext) if (polymosttext)
@ -5255,7 +5254,7 @@ void polymost_fillpolygon(int32_t npoints)
if (gloy1 != -1) polymostSet2dView(); //disables blending, texturing, and depth testing if (gloy1 != -1) polymostSet2dView(); //disables blending, texturing, and depth testing
GLInterface.EnableAlphaTest(true); GLInterface.EnableAlphaTest(true);
GLInterface.SetTexture(TileFiles.tiles[globalpicnum], globalpal, DAMETH_NOMASK); GLInterface.SetTexture(TileFiles.tiles[globalpicnum], globalpal, DAMETH_NOMASK, -1);
uint8_t const maskprops = (globalorientation>>7)&DAMETH_MASKPROPS; uint8_t const maskprops = (globalorientation>>7)&DAMETH_MASKPROPS;
handle_blend(maskprops > DAMETH_MASK, 0, maskprops == DAMETH_TRANS2); handle_blend(maskprops > DAMETH_MASK, 0, maskprops == DAMETH_TRANS2);
@ -5587,7 +5586,7 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
//OSD_Printf("precached %d %d type %d\n", dapicnum, dapalnum, datype); //OSD_Printf("precached %d %d type %d\n", dapicnum, dapalnum, datype);
hicprecaching = 1; hicprecaching = 1;
GLInterface.SetTexture(TileFiles.tiles[dapicnum], dapalnum, 0); GLInterface.SetTexture(TileFiles.tiles[dapicnum], dapalnum, 0, -1);
hicprecaching = 0; hicprecaching = 0;
if (datype == 0 || !usemodels) return; if (datype == 0 || !usemodels) return;
@ -5600,8 +5599,8 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
for (int i = 0; i <= surfaces; i++) for (int i = 0; i <= surfaces; i++)
{ {
auto tex = mdloadskin((md2model_t *)models[mid], 0, dapalnum, i); auto tex = mdloadskin((md2model_t *)models[mid], 0, dapalnum, i, nullptr);
if (tex) GLInterface.SetTexture(tex, dapalnum, 0); if (tex) GLInterface.SetTexture(tex, dapalnum, 0, -1);
} }
} }

View file

@ -4,7 +4,6 @@
#include "lz4.h" #include "lz4.h"
#include "hightile.h" #include "hightile.h"
#include "polymost.h" #include "polymost.h"
#include "texcache.h"
#include "scriptfile.h" #include "scriptfile.h"
#include "xxhash.h" #include "xxhash.h"
#include "kplib.h" #include "kplib.h"
@ -109,9 +108,9 @@ FHardwareTexture* GLInstance::LoadTexture(FTexture* tex, int textype, int palid)
FHardwareTexture *hwtex; FHardwareTexture *hwtex;
if (textype == TT_INDEXED) if (textype == TT_INDEXED)
auto hwtex = CreateIndexedTexture(tex); hwtex = CreateIndexedTexture(tex);
else else
auto hwtex = CreateTrueColorTexture(tex, textype == TT_HICREPLACE? -1 : palid, textype == TT_BRIGHTMAP); hwtex = CreateTrueColorTexture(tex, textype == TT_HICREPLACE? -1 : palid, textype == TT_BRIGHTMAP);
tex->SetHardwareTexture(palid, hwtex); tex->SetHardwareTexture(palid, hwtex);
return hwtex; return hwtex;
@ -135,7 +134,7 @@ bool GLInstance::SetTextureInternal(FTexture* tex, int palette, int method, int
int lookuppal = 0; int lookuppal = 0;
VSMatrix texmat; VSMatrix texmat;
auto rep = usehightile? currentTexture->FindReplacement(palette) : nullptr; auto rep = usehightile? tex->FindReplacement(palette) : nullptr;
if (rep) if (rep)
{ {
// Hightile replacements have only one texture representation and it is always the base. // Hightile replacements have only one texture representation and it is always the base.
@ -170,7 +169,7 @@ bool GLInstance::SetTextureInternal(FTexture* tex, int palette, int method, int
float detscalex = detscale, detscaley = detscale; float detscalex = detscale, detscaley = detscale;
if (!(method & DAMETH_MODEL)) if (!(method & DAMETH_MODEL))
{ {
auto drep = currentTexture->FindReplacement(DETAILPAL); auto drep = tex->FindReplacement(DETAILPAL);
if (drep) if (drep)
{ {
det = drep->faces[0]; det = drep->faces[0];
@ -200,7 +199,7 @@ bool GLInstance::SetTextureInternal(FTexture* tex, int palette, int method, int
{ {
if (!(method & DAMETH_MODEL)) if (!(method & DAMETH_MODEL))
{ {
auto drep = currentTexture->FindReplacement(DETAILPAL); auto drep = tex->FindReplacement(DETAILPAL);
if (drep) if (drep)
{ {
glow = drep->faces[0]; glow = drep->faces[0];
@ -217,7 +216,7 @@ bool GLInstance::SetTextureInternal(FTexture* tex, int palette, int method, int
{ {
if (TextureType == TT_HICREPLACE) if (TextureType == TT_HICREPLACE)
{ {
auto brep = currentTexture->FindReplacement(BRIGHTPAL); auto brep = tex->FindReplacement(BRIGHTPAL);
if (brep) if (brep)
{ {
auto htex = LoadTexture(brep->faces[0], TT_HICREPLACE, 0); auto htex = LoadTexture(brep->faces[0], TT_HICREPLACE, 0);
@ -237,6 +236,7 @@ bool GLInstance::SetTextureInternal(FTexture* tex, int palette, int method, int
} }
} }
} }
else return false;
float al = 0; float al = 0;
if (TextureType == TT_HICREPLACE) if (TextureType == TT_HICREPLACE)
@ -245,6 +245,7 @@ bool GLInstance::SetTextureInternal(FTexture* tex, int palette, int method, int
(tex->alphaThreshold >= 0.f ? tex->alphaThreshold : 0.f); (tex->alphaThreshold >= 0.f ? tex->alphaThreshold : 0.f);
} }
GLInterface.SetAlphaThreshold(al); GLInterface.SetAlphaThreshold(al);
return true;
} }

View file

@ -849,7 +849,6 @@ void voxfree(voxmodel_t *m)
DO_FREE_AND_NULL(m->mytex); DO_FREE_AND_NULL(m->mytex);
DO_FREE_AND_NULL(m->quad); DO_FREE_AND_NULL(m->quad);
DO_FREE_AND_NULL(m->texid);
Xfree(m); Xfree(m);
} }
@ -877,8 +876,7 @@ voxmodel_t *voxload(const char *filnam)
vm->siz.x = voxsiz.x; vm->siz.y = voxsiz.y; vm->siz.z = voxsiz.z; vm->siz.x = voxsiz.x; vm->siz.y = voxsiz.y; vm->siz.z = voxsiz.z;
vm->piv.x = voxpiv.x; vm->piv.y = voxpiv.y; vm->piv.z = voxpiv.z; vm->piv.x = voxpiv.x; vm->piv.y = voxpiv.y; vm->piv.z = voxpiv.z;
vm->is8bit = is8bit; vm->is8bit = is8bit;
vm->texture = nullptr;
vm->texid = (FHardwareTexture * *)Xcalloc(MAXPALOOKUPS, sizeof(FHardwareTexture*));
} }
DO_FREE_AND_NULL(shcntmal); DO_FREE_AND_NULL(shcntmal);
@ -990,8 +988,6 @@ voxmodel_t *loadkvxfrombuf(const char *kvxbuffer, int32_t length)
vm->siz.x = voxsiz.x; vm->siz.y = voxsiz.y; vm->siz.z = voxsiz.z; vm->siz.x = voxsiz.x; vm->siz.y = voxsiz.y; vm->siz.z = voxsiz.z;
vm->piv.x = voxpiv.x; vm->piv.y = voxpiv.y; vm->piv.z = voxpiv.z; vm->piv.x = voxpiv.x; vm->piv.y = voxpiv.y; vm->piv.z = voxpiv.z;
vm->is8bit = 1; vm->is8bit = 1;
vm->texid = (FHardwareTexture **)Xcalloc(MAXPALOOKUPS, sizeof(FHardwareTexture *));
} }
DO_FREE_AND_NULL(shcntmal); DO_FREE_AND_NULL(shcntmal);
@ -1132,10 +1128,12 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr)
int prevClamp = GLInterface.GetClamp(); int prevClamp = GLInterface.GetClamp();
GLInterface.SetClamp(0); GLInterface.SetClamp(0);
#if 0
if (!m->texid[globalpal]) if (!m->texid[globalpal])
m->texid[globalpal] = gloadtex(m->mytex, m->mytexx, m->mytexy, m->is8bit, globalpal); m->texid[globalpal] = gloadtex(m->mytex, m->mytexx, m->mytexy, m->is8bit, globalpal);
GLInterface.BindTexture(0, m->texid[globalpal]); GLInterface.BindTexture(0, m->texid[globalpal], -1);
#endif
auto data = GLInterface.AllocVertices(m->qcnt * 4); auto data = GLInterface.AllocVertices(m->qcnt * 4);
auto vt = data.second; auto vt = data.second;

View file

@ -100,7 +100,7 @@ void FBitmap::CopyPixelDataRGB(int originx, int originy, const uint8_t *patch, i
template<class TDest, class TBlend> template<class TDest, class TBlend>
void iCopyPaletted(uint8_t *buffer, const uint8_t * patch, int srcwidth, int srcheight, int Pitch, void iCopyPaletted(uint8_t *buffer, const uint8_t * patch, int srcwidth, int srcheight, int Pitch,
int step_x, int step_y, int rotate, PalEntry * palette) int step_x, int step_y, int rotate, const PalEntry * palette)
{ {
int x,y,pos; int x,y,pos;
@ -133,7 +133,7 @@ typedef void (*CopyPalettedFunc)(uint8_t *buffer, const uint8_t * patch, int src
// //
//=========================================================================== //===========================================================================
void FBitmap::CopyPixelData(int originx, int originy, const uint8_t * patch, int srcwidth, int srcheight, void FBitmap::CopyPixelData(int originx, int originy, const uint8_t * patch, int srcwidth, int srcheight,
int step_x, int step_y, int rotate, PalEntry * palette) int step_x, int step_y, int rotate, const PalEntry * palette)
{ {
uint8_t *buffer = data + 4*originx + Pitch*originy; uint8_t *buffer = data + 4*originx + Pitch*originy;
iCopyPaletted<cBGRA, bCopy>(buffer, patch, srcwidth, srcheight, Pitch, iCopyPaletted<cBGRA, bCopy>(buffer, patch, srcwidth, srcheight, Pitch,

View file

@ -204,7 +204,7 @@ public:
int srcheight, int step_x, int step_y, int rotate, int ct, int srcheight, int step_x, int step_y, int rotate, int ct,
/* for PNG tRNS */ int r=0, int g=0, int b=0); /* for PNG tRNS */ int r=0, int g=0, int b=0);
void CopyPixelData(int originx, int originy, const uint8_t * patch, int srcwidth, int srcheight, void CopyPixelData(int originx, int originy, const uint8_t * patch, int srcwidth, int srcheight,
int step_x, int step_y, int rotate, PalEntry * palette); int step_x, int step_y, int rotate, const PalEntry * palette);
void Blit(int originx, int originy, const FBitmap &src) void Blit(int originx, int originy, const FBitmap &src)

View file

@ -79,7 +79,7 @@ picanm_t tileConvertAnimFormat(int32_t const picanimraw)
// //
//========================================================================== //==========================================================================
FBitmap FTileTexture::GetBgraBitmap(PalEntry* remap, int* ptrans) FBitmap FTileTexture::GetBgraBitmap(const PalEntry* remap, int* ptrans)
{ {
FBitmap bmp; FBitmap bmp;
TArray<uint8_t> buffer; TArray<uint8_t> buffer;
@ -232,7 +232,7 @@ void BuildFiles::CloseAllMapArt()
// //
//=========================================================================== //===========================================================================
void BuildFiles::CleatTextureCache(bool artonly) void BuildFiles::ClearTextureCache(bool artonly)
{ {
for (auto tex : AllTiles) for (auto tex : AllTiles)
{ {
@ -262,7 +262,7 @@ void BuildFiles::InvalidateTile(int num)
tex->DeleteHardwareTextures(); tex->DeleteHardwareTextures();
for (auto &rep : tex->Hightiles) for (auto &rep : tex->Hightiles)
{ {
for (auto &reptex : rep.Faces) for (auto &reptex : rep.faces)
{ {
if (reptex) reptex->DeleteHardwareTextures(); if (reptex) reptex->DeleteHardwareTextures();
} }

View file

@ -131,7 +131,7 @@ public:
} }
FImageSource *GetImage() const override { return mImage; } FImageSource *GetImage() const override { return mImage; }
FBitmap GetBgraBitmap(PalEntry *p, int *trans) override; FBitmap GetBgraBitmap(const PalEntry *p, int *trans) override;
}; };

View file

@ -69,7 +69,7 @@ FImageTexture::FImageTexture(FImageSource *img, const char *name)
// //
//=========================================================================== //===========================================================================
FBitmap FImageTexture::GetBgraBitmap(PalEntry *p, int *trans) FBitmap FImageTexture::GetBgraBitmap(const PalEntry *p, int *trans)
{ {
FBitmap bmp; FBitmap bmp;
bmp.Create(Size.x, Size.y); bmp.Create(Size.x, Size.y);

View file

@ -16,7 +16,7 @@ public:
bool fliptop; bool fliptop;
FSkyBox(const char *name); FSkyBox(const char *name);
FBitmap GetBgraBitmap(PalEntry *, int *trans) override; FBitmap GetBgraBitmap(const PalEntry *, int *trans) override;
FImageSource *GetImage() const override; FImageSource *GetImage() const override;

View file

@ -90,7 +90,7 @@ FTexture::~FTexture ()
// //
//=========================================================================== //===========================================================================
FBitmap FTexture::GetBgraBitmap(PalEntry *remap, int *ptrans) FBitmap FTexture::GetBgraBitmap(const PalEntry *remap, int *ptrans)
{ {
FBitmap bmp; FBitmap bmp;
bmp.Create(Size.x, Size.y); bmp.Create(Size.x, Size.y);
@ -288,7 +288,7 @@ bool FTexture::ProcessData(unsigned char * buffer, int w, int h, bool ispatch)
// //
//=========================================================================== //===========================================================================
FTextureBuffer FTexture::CreateTexBuffer(PalEntry * remap, int flags) FTextureBuffer FTexture::CreateTexBuffer(const PalEntry * remap, int flags)
{ {
FTextureBuffer result; FTextureBuffer result;

View file

@ -176,7 +176,6 @@ struct FTextureBuffer
mBuffer = other.mBuffer; mBuffer = other.mBuffer;
mWidth = other.mWidth; mWidth = other.mWidth;
mHeight = other.mHeight; mHeight = other.mHeight;
mContentId = other.mContentId;
other.mBuffer = nullptr; other.mBuffer = nullptr;
} }
@ -185,7 +184,6 @@ struct FTextureBuffer
mBuffer = other.mBuffer; mBuffer = other.mBuffer;
mWidth = other.mWidth; mWidth = other.mWidth;
mHeight = other.mHeight; mHeight = other.mHeight;
mContentId = other.mContentId;
other.mBuffer = nullptr; other.mBuffer = nullptr;
return *this; return *this;
} }
@ -223,7 +221,7 @@ public:
virtual void Create8BitPixels(uint8_t* buffer); virtual void Create8BitPixels(uint8_t* buffer);
virtual const uint8_t* Get8BitPixels(); virtual const uint8_t* Get8BitPixels();
virtual uint8_t* GetWritableBuffer() { return nullptr; } // For dynamic tiles. Requesting this must also invalidate the texture. virtual uint8_t* GetWritableBuffer() { return nullptr; } // For dynamic tiles. Requesting this must also invalidate the texture.
virtual FBitmap GetBgraBitmap(PalEntry *remap, int *trans = nullptr); virtual FBitmap GetBgraBitmap(const PalEntry *remap, int *trans = nullptr);
static int SmoothEdges(unsigned char * buffer,int w, int h); static int SmoothEdges(unsigned char * buffer,int w, int h);
static PalEntry averageColor(const uint32_t *data, int size, int maxout); static PalEntry averageColor(const uint32_t *data, int size, int maxout);
@ -236,7 +234,7 @@ public:
int GetTopOffset() const { return PicAnim.yofs; } int GetTopOffset() const { return PicAnim.yofs; }
picanm_t& GetAnim() { return PicAnim; } // This must be modifiable. There's quite a bit of code messing around with the flags in here. picanm_t& GetAnim() { return PicAnim; } // This must be modifiable. There's quite a bit of code messing around with the flags in here.
rottile_t& GetRotTile() { return RotTile; } rottile_t& GetRotTile() { return RotTile; }
FTextureBuffer CreateTexBuffer(PalEntry *palette, int flags = 0); FTextureBuffer CreateTexBuffer(const PalEntry *palette, int flags = 0);
bool GetTranslucency(); bool GetTranslucency();
void CheckTrans(unsigned char * buffer, int size, int trans); void CheckTrans(unsigned char * buffer, int size, int trans);
bool ProcessData(unsigned char * buffer, int w, int h, bool ispatch); bool ProcessData(unsigned char * buffer, int w, int h, bool ispatch);
@ -313,7 +311,7 @@ protected:
TMap<int, FHardwareTexture*> HardwareTextures; // Note: These must be deleted by the backend. When the texture manager is taken down it may already be too late to delete them. TMap<int, FHardwareTexture*> HardwareTextures; // Note: These must be deleted by the backend. When the texture manager is taken down it may already be too late to delete them.
FTexture (const char *name = NULL); FTexture (const char *name = NULL);
friend class BuildFiles; friend struct BuildFiles;
}; };
class FTileTexture : public FTexture class FTileTexture : public FTexture
@ -324,7 +322,7 @@ public:
useType = Art; useType = Art;
} }
void SetName(const char* name) { Name = name; } void SetName(const char* name) { Name = name; }
FBitmap GetBgraBitmap(PalEntry* remap, int* ptrans) override; FBitmap GetBgraBitmap(const PalEntry* remap, int* ptrans) override;
void Create8BitPixels(uint8_t* buffer) override; void Create8BitPixels(uint8_t* buffer) override;
}; };
@ -548,7 +546,7 @@ struct BuildFiles
void tileSetExternal(int tilenum, int width, int height, uint8_t* data); void tileSetExternal(int tilenum, int width, int height, uint8_t* data);
int findUnusedTile(void); int findUnusedTile(void);
int tileCreateRotated(int owner); int tileCreateRotated(int owner);
void CleatTextureCache(bool artonly = false); void ClearTextureCache(bool artonly = false);
void InvalidateTile(int num); void InvalidateTile(int num);
}; };

View file

@ -207,8 +207,9 @@ void GLInstance::RestoreTextureProps()
{ {
// todo: reset everything that's needed to ensure proper functionality // todo: reset everything that's needed to ensure proper functionality
VSMatrix identity(0); VSMatrix identity(0);
GLInterface.SetMatrix(Matrix_Texture, &identity); if (MatrixChange & 1) GLInterface.SetMatrix(Matrix_Texture, &identity);
GLInterface.SetMatrix(Matrix_Detail, &identity); if (MatrixChange & 2) GLInterface.SetMatrix(Matrix_Detail, &identity);
MatrixChange = 0;
} }
@ -228,7 +229,6 @@ void GLInstance::Draw(EDrawType type, size_t start, size_t count)
if (activeShader == polymostShader) if (activeShader == polymostShader)
{ {
applied = ApplyTextureProps();
renderState.UsePalette = texv && texv->isIndexed(); renderState.UsePalette = texv && texv->isIndexed();
renderState.Apply(polymostShader); renderState.Apply(polymostShader);
} }
@ -240,7 +240,7 @@ void GLInstance::Draw(EDrawType type, size_t start, size_t count)
glVertexAttrib3f(0, p->x, p->y, p->z); glVertexAttrib3f(0, p->x, p->y, p->z);
} }
glEnd(); glEnd();
if (applied) RestoreTextureProps(); if (MatrixChange) RestoreTextureProps();
} }
int GLInstance::GetTextureID() int GLInstance::GetTextureID()

View file

@ -391,10 +391,8 @@ public:
bool SetModelTexture(FTexture *tex, int palette, float xpanning, float ypanning, FTexture *det, float detscale, FTexture *glow) bool SetModelTexture(FTexture *tex, int palette, float xpanning, float ypanning, FTexture *det, float detscale, FTexture *glow)
{ {
return SetTextureInternal(tex, palette, DAMETH_MODEL, -1, xpanning, ypanning, det, detscale, glow); return SetTextureInternal(tex, palette, 8/*DAMETH_MODEL*/, -1, xpanning, ypanning, det, detscale, glow);
} }
)
}; };
extern GLInstance GLInterface; extern GLInstance GLInterface;