Revert "Dynamic number of models per frame instead of a hard limit of four. (#1298)"
This reverts commit 769d60a64f.
This commit is contained in:
parent
cdb3fcce03
commit
d6987ff6b2
6 changed files with 31 additions and 77 deletions
|
|
@ -15,15 +15,15 @@ void FlushModels();
|
|||
extern TDeletingArray<FModel*> Models;
|
||||
extern TArray<FSpriteModelFrame> SpriteModelFrames;
|
||||
|
||||
#define MAX_MODELS_PER_FRAME 4
|
||||
#define MD3_MAX_SURFACES 32
|
||||
|
||||
struct FSpriteModelFrame
|
||||
{
|
||||
uint8_t modelsAmount = 0;
|
||||
TArray<int> modelIDs;
|
||||
TArray<FTextureID> skinIDs;
|
||||
TArray<FTextureID> surfaceskinIDs;
|
||||
TArray<int> modelframes;
|
||||
int modelIDs[MAX_MODELS_PER_FRAME];
|
||||
FTextureID skinIDs[MAX_MODELS_PER_FRAME];
|
||||
FTextureID surfaceskinIDs[MAX_MODELS_PER_FRAME][MD3_MAX_SURFACES];
|
||||
int modelframes[MAX_MODELS_PER_FRAME];
|
||||
float xscale, yscale, zscale;
|
||||
// [BB] Added zoffset, rotation parameters and flags.
|
||||
// Added xoffset, yoffset
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright(C) 2006-2016 Christoph Oelckers
|
||||
|
|
@ -306,10 +306,9 @@ void FMD3Model::AddSkins(uint8_t *hitlist)
|
|||
{
|
||||
for (unsigned i = 0; i < Surfaces.Size(); i++)
|
||||
{
|
||||
int ssIndex = i + curMDLIndex * MD3_MAX_SURFACES;
|
||||
if (curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
|
||||
if (curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
|
||||
{
|
||||
hitlist[curSpriteMDLFrame->surfaceskinIDs[ssIndex].GetIndex()] |= FTextureManager::HIT_Flat;
|
||||
hitlist[curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].GetIndex()] |= FTextureManager::HIT_Flat;
|
||||
}
|
||||
|
||||
MD3Surface * surf = &Surfaces[i];
|
||||
|
|
@ -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 (curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
|
||||
if (curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
|
||||
{
|
||||
surfaceSkin = TexMan.GetGameTexture(curSpriteMDLFrame->surfaceskinIDs[ssIndex], true);
|
||||
surfaceSkin = TexMan.GetGameTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i], true);
|
||||
}
|
||||
else if (surf->numSkins > 0 && surf->Skins[0].isValid())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -638,10 +638,9 @@ void FOBJModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int f
|
|||
FGameTexture *userSkin = skin;
|
||||
if (!userSkin)
|
||||
{
|
||||
int ssIndex = i + curMDLIndex * MD3_MAX_SURFACES;
|
||||
if (i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
|
||||
if (i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
|
||||
{
|
||||
userSkin = TexMan.GetGameTexture(curSpriteMDLFrame->surfaceskinIDs[ssIndex], true);
|
||||
userSkin = TexMan.GetGameTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i], true);
|
||||
}
|
||||
else if (surf->skin.isValid())
|
||||
{
|
||||
|
|
@ -670,14 +669,13 @@ void FOBJModel::AddSkins(uint8_t* hitlist)
|
|||
{
|
||||
for (size_t i = 0; i < surfaces.Size(); i++)
|
||||
{
|
||||
size_t ssIndex = i + curMDLIndex * MD3_MAX_SURFACES;
|
||||
if (i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
|
||||
if (i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].isValid())
|
||||
{
|
||||
// Precache skins manually reassigned by the user.
|
||||
// On OBJs with lots of skins, such as Doom map OBJs exported from GZDB,
|
||||
// there may be too many skins for the user to manually change, unless
|
||||
// the limit is bumped or surfaceskinIDs is changed to a TArray<FTextureID>.
|
||||
hitlist[curSpriteMDLFrame->surfaceskinIDs[ssIndex].GetIndex()] |= FTextureManager::HIT_Flat;
|
||||
hitlist[curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][i].GetIndex()] |= FTextureManager::HIT_Flat;
|
||||
return; // No need to precache skin that was replaced
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -242,9 +242,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 (curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
|
||||
sskin = TexMan.GetGameTexture(curSpriteMDLFrame->surfaceskinIDs[ssIndex], true);
|
||||
if ( curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum].isValid() )
|
||||
sskin = TexMan.GetGameTexture(curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum], true);
|
||||
if ( !sskin )
|
||||
{
|
||||
vofs += vsize;
|
||||
|
|
@ -303,13 +302,9 @@ void FUE1Model::BuildVertexBuffer( FModelRenderer *renderer )
|
|||
|
||||
void FUE1Model::AddSkins( uint8_t *hitlist )
|
||||
{
|
||||
for (int i = 0; i < numGroups; i++)
|
||||
{
|
||||
int ssIndex = groups[i].texNum + curMDLIndex * MD3_MAX_SURFACES;
|
||||
if (curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
|
||||
hitlist[curSpriteMDLFrame->surfaceskinIDs[ssIndex].GetIndex()] |= FTextureManager::HIT_Flat;
|
||||
}
|
||||
|
||||
for ( int i=0; i<numGroups; i++ )
|
||||
if ( curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum].isValid() )
|
||||
hitlist[curSpriteMDLFrame->surfaceskinIDs[curMDLIndex][groups[i].texNum].GetIndex()] |= FTextureManager::HIT_Flat;
|
||||
}
|
||||
|
||||
FUE1Model::~FUE1Model()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue