- 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

@ -227,7 +227,7 @@ int FUE1Model::FindFrame( const char *name )
return -1;
}
void FUE1Model::RenderFrame( FModelRenderer *renderer, FGameTexture *skin, int frame, int frame2, double inter, int translation, const TArray<FTextureID>& surfaceskinids)
void FUE1Model::RenderFrame( FModelRenderer *renderer, FGameTexture *skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids)
{
// the moment of magic
if ( (frame >= numFrames) || (frame2 >= numFrames) ) return;
@ -246,9 +246,8 @@ void FUE1Model::RenderFrame( FModelRenderer *renderer, FGameTexture *skin, int f
FGameTexture *sskin = skin;
if ( !sskin )
{
int ssIndex = groups[i].texNum + curMDLIndex * MD3_MAX_SURFACES;
if (surfaceskinids[ssIndex].isValid())
sskin = TexMan.GetGameTexture(surfaceskinids[ssIndex], true);
if (surfaceskinids && surfaceskinids[i].isValid())
sskin = TexMan.GetGameTexture(surfaceskinids[i], true);
if ( !sskin )
{
vofs += vsize;
@ -305,13 +304,12 @@ void FUE1Model::BuildVertexBuffer( FModelRenderer *renderer )
vbuf->UnlockVertexBuffer();
}
void FUE1Model::AddSkins( uint8_t *hitlist )
void FUE1Model::AddSkins( uint8_t *hitlist, const FTextureID* surfaceskinids)
{
for (int i = 0; i < numGroups; i++)
{
int ssIndex = groups[i].texNum + curMDLIndex * MD3_MAX_SURFACES;
if (curSpriteMDLFrame && curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
hitlist[curSpriteMDLFrame->surfaceskinIDs[ssIndex].GetIndex()] |= FTextureManager::HIT_Flat;
if (surfaceskinids && surfaceskinids[i].isValid())
hitlist[surfaceskinids[i].GetIndex()] |= FTextureManager::HIT_Flat;
}
}