I'm not done with this

- I need to figure out how I'm gonna reference the same boneStartIndex between the indices. Maybe some property in smf? The problem is that even though the bone calculations are done just once per instance of the actor when the flag is enabled, the bone buffers are being copied still, and if there's too much data, some will quit uploading because it's full. Besides doing this, I may just see about increasing the buffer size if possible. It's really just not very big.
This commit is contained in:
Shiny Metagross 2022-08-15 17:29:42 -07:00 committed by Christoph Oelckers
parent 3c9a1ffe5e
commit 3f8141ed04
4 changed files with 6 additions and 4 deletions

View File

@ -24,6 +24,6 @@ public:
virtual void SetMaterial(FGameTexture *skin, bool clampNoFilter, int translation) = 0;
virtual void DrawArrays(int start, int count) = 0;
virtual void DrawElements(int numIndices, size_t offset) = 0;
virtual void SetupFrame(FModel* model, unsigned int frame1, unsigned int frame2, unsigned int size, const TArray<VSMatrix>& bones) = 0;
virtual void SetupFrame(FModel* model, unsigned int frame1, unsigned int frame2, unsigned int size, const TArray<VSMatrix>& bones, int boneStartIndex) = 0;
};

View File

@ -495,7 +495,7 @@ int IQMModel::FindFrame(const char* name, bool nodefault)
void IQMModel::RenderFrame(FModelRenderer* renderer, FGameTexture* skin, int frame1, int frame2, double inter, int translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData)
{
renderer->SetupFrame(this, 0, 0, NumVertices, boneData);
renderer->SetupFrame(this, 0, 0, NumVertices, boneData, 0);
FGameTexture* lastSkin = nullptr;
for (int i = 0; i < Meshes.Size(); i++)

View File

@ -136,9 +136,10 @@ void FHWModelRenderer::DrawElements(int numIndices, size_t offset)
//
//===========================================================================
void FHWModelRenderer::SetupFrame(FModel *model, unsigned int frame1, unsigned int frame2, unsigned int size, const TArray<VSMatrix>& bones)
void FHWModelRenderer::SetupFrame(FModel *model, unsigned int frame1, unsigned int frame2, unsigned int size, const TArray<VSMatrix>& bones, int boneStartIndex)
{
auto mdbuff = static_cast<FModelVertexBuffer*>(model->GetVertexBuffer(GetType()));
boneIndexBase = screen->mBones->UploadBones(bones);
state.SetBoneIndexBase(screen->mBones->UploadBones(bones));
state.SetVertexBuffer(mdbuff->vertexBuffer(), frame1, frame2);
if (mdbuff->indexBuffer()) state.SetIndexBuffer(mdbuff->indexBuffer());

View File

@ -39,6 +39,7 @@ class FHWModelRenderer : public FModelRenderer
{
friend class FModelVertexBuffer;
int modellightindex = -1;
int boneIndexBase = -1;
HWDrawInfo *di;
FRenderState &state;
public:
@ -55,7 +56,7 @@ public:
void SetMaterial(FGameTexture *skin, bool clampNoFilter, int translation) override;
void DrawArrays(int start, int count) override;
void DrawElements(int numIndices, size_t offset) override;
void SetupFrame(FModel *model, unsigned int frame1, unsigned int frame2, unsigned int size, const TArray<VSMatrix>& bones) override;
void SetupFrame(FModel *model, unsigned int frame1, unsigned int frame2, unsigned int size, const TArray<VSMatrix>& bones, int boneStartIndex) override;
};