remove bone component cache to decrease memory consumption
caching this is entirely unnecessary, as it changes every frame
This commit is contained in:
parent
6ea1b68a1c
commit
3d2f9e06ed
22 changed files with 79 additions and 113 deletions
|
|
@ -45,6 +45,8 @@
|
|||
#include "modelrenderer.h"
|
||||
#include "actor.h"
|
||||
#include "actorinlines.h"
|
||||
#include "v_video.h"
|
||||
#include "hw_bonebuffer.h"
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
|
@ -394,8 +396,8 @@ void RenderFrameModels(FModelRenderer *renderer, FLevelLocals *Level, const FSpr
|
|||
|
||||
TArray<FTextureID> surfaceskinids;
|
||||
|
||||
TArray<VSMatrix> boneData;
|
||||
int boneStartingPosition = 0;
|
||||
const TArray<VSMatrix> *boneData;
|
||||
int boneStartingPosition = -1;
|
||||
bool evaluatedSingle = false;
|
||||
|
||||
for (unsigned i = 0; i < modelsamount; i++)
|
||||
|
|
@ -520,15 +522,6 @@ void RenderFrameModels(FModelRenderer *renderer, FLevelLocals *Level, const FSpr
|
|||
|
||||
bool nextFrame = smfNext && modelframe != modelframenext;
|
||||
|
||||
if (actor->boneComponentData == nullptr)
|
||||
{
|
||||
auto ptr = Create<DBoneComponents>();
|
||||
ptr->trscomponents.Resize(modelsamount);
|
||||
ptr->trsmatrix.Resize(modelsamount);
|
||||
actor->boneComponentData = ptr;
|
||||
GC::WriteBarrier(actor, ptr);
|
||||
}
|
||||
|
||||
// [RL0] while per-model animations aren't done, DECOUPLEDANIMATIONS does the same as MODELSAREATTACHMENTS
|
||||
if(!evaluatedSingle)
|
||||
{
|
||||
|
|
@ -545,18 +538,24 @@ void RenderFrameModels(FModelRenderer *renderer, FLevelLocals *Level, const FSpr
|
|||
{
|
||||
if(decoupled_frame.frame1 != -1)
|
||||
{
|
||||
boneData = animation->CalculateBones(actor->modelData->prevAnim, decoupled_frame, inter, animationData, actor->boneComponentData, i);
|
||||
boneData = animation->CalculateBones(actor->modelData->prevAnim, decoupled_frame, inter, animationData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
boneData = animation->CalculateBones(nullptr, {nextFrame ? inter : -1.0f, modelframe, modelframenext}, -1.0f, animationData, actor->boneComponentData, i);
|
||||
boneData = animation->CalculateBones(nullptr, {nextFrame ? inter : -1.0f, modelframe, modelframenext}, -1.0f, animationData);
|
||||
}
|
||||
boneStartingPosition = renderer->SetupFrame(animation, 0, 0, 0, boneData, -1);
|
||||
evaluatedSingle = (smf_flags & MDL_MODELSAREATTACHMENTS) || is_decoupled;
|
||||
|
||||
if(smf_flags & MDL_MODELSAREATTACHMENTS || is_decoupled)
|
||||
{
|
||||
boneStartingPosition = boneData ? screen->mBones->UploadBones(*boneData) : -1;
|
||||
evaluatedSingle = true;
|
||||
}
|
||||
|
||||
boneData = nullptr;
|
||||
}
|
||||
|
||||
mdl->RenderFrame(renderer, tex, modelframe, nextFrame ? modelframenext : modelframe, nextFrame ? inter : -1.f, translation, ssidp, boneData, boneStartingPosition);
|
||||
mdl->RenderFrame(renderer, tex, modelframe, nextFrame ? modelframenext : modelframe, nextFrame ? inter : -1.f, translation, ssidp, boneStartingPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue