- got rid of the state variables in the model class entirely.

This is *not* the right way to reduce function parameter count. The data in question is far easier evaluated at the calling site and passed as a parameter.
This commit is contained in:
Christoph Oelckers 2022-07-23 10:35:01 +02:00
commit 9875850c19
13 changed files with 43 additions and 53 deletions

View file

@ -302,14 +302,13 @@ void FMD3Model::BuildVertexBuffer(FModelRenderer *renderer)
//
//===========================================================================
void FMD3Model::AddSkins(uint8_t *hitlist)
void FMD3Model::AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids)
{
for (unsigned i = 0; i < Surfaces.Size(); i++)
{
int ssIndex = i + curMDLIndex * MD3_MAX_SURFACES;
if (curSpriteMDLFrame && curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
if (surfaceskinids && surfaceskinids[i].isValid())
{
hitlist[curSpriteMDLFrame->surfaceskinIDs[ssIndex].GetIndex()] |= FTextureManager::HIT_Flat;
hitlist[surfaceskinids[i].GetIndex()] |= FTextureManager::HIT_Flat;
}
MD3Surface * surf = &Surfaces[i];
@ -344,7 +343,7 @@ int FMD3Model::FindFrame(const char * name)
//
//===========================================================================
void FMD3Model::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frameno, int frameno2, double inter, int translation, const TArray<FTextureID>& surfaceskinids)
void FMD3Model::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frameno, int frameno2, double inter, int translation, const FTextureID* surfaceskinids)
{
if ((unsigned)frameno >= Frames.Size() || (unsigned)frameno2 >= Frames.Size()) return;
@ -358,10 +357,9 @@ void FMD3Model::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int f
FGameTexture *surfaceSkin = skin;
if (!surfaceSkin)
{
int ssIndex = i + curMDLIndex * MD3_MAX_SURFACES;
if (surfaceskinids[ssIndex].isValid())
if (surfaceskinids && surfaceskinids[i].isValid())
{
surfaceSkin = TexMan.GetGameTexture(surfaceskinids[ssIndex], true);
surfaceSkin = TexMan.GetGameTexture(surfaceskinids[i], true);
}
else if (surf->numSkins > 0 && surf->Skins[0].isValid())
{