mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-06-03 10:21:48 +00:00
- 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:
parent
76c8214d67
commit
9875850c19
13 changed files with 43 additions and 53 deletions
|
@ -628,7 +628,7 @@ int FOBJModel::FindFrame(const char* name)
|
|||
* @param inter The amount to interpolate the two frames.
|
||||
* @param translation The translation for the skin
|
||||
*/
|
||||
void FOBJModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frameno, int frameno2, double inter, int translation, const TArray<FTextureID>& surfaceskinids)
|
||||
void FOBJModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frameno, int frameno2, double inter, int translation, const FTextureID* surfaceskinids)
|
||||
{
|
||||
// Prevent the model from rendering if the frame number is < 0
|
||||
if (frameno < 0 || frameno2 < 0) return;
|
||||
|
@ -640,10 +640,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 && surfaceskinids[ssIndex].isValid())
|
||||
if (surfaceskinids && surfaceskinids[i].isValid())
|
||||
{
|
||||
userSkin = TexMan.GetGameTexture(surfaceskinids[ssIndex], true);
|
||||
userSkin = TexMan.GetGameTexture(surfaceskinids[i], true);
|
||||
}
|
||||
else if (surf->skin.isValid())
|
||||
{
|
||||
|
@ -668,18 +667,17 @@ void FOBJModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int f
|
|||
*
|
||||
* @param hitlist The list of textures
|
||||
*/
|
||||
void FOBJModel::AddSkins(uint8_t* hitlist)
|
||||
void FOBJModel::AddSkins(uint8_t* hitlist, const FTextureID* surfaceskinids)
|
||||
{
|
||||
for (size_t i = 0; i < surfaces.Size(); i++)
|
||||
{
|
||||
size_t ssIndex = i + curMDLIndex * MD3_MAX_SURFACES;
|
||||
if (curSpriteMDLFrame && i < MD3_MAX_SURFACES && curSpriteMDLFrame->surfaceskinIDs[ssIndex].isValid())
|
||||
if (surfaceskinids && i < MD3_MAX_SURFACES && surfaceskinids[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[surfaceskinids[i].GetIndex()] |= FTextureManager::HIT_Flat;
|
||||
return; // No need to precache skin that was replaced
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue