mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
- fixed model vertex buffer setup.
Setting the buffer and its attribute bindings must be one step, not twp. With Vulkan this is a single API call. This removes the now obsolete SetVertexBuffer method from the model renderer's interface.
This commit is contained in:
parent
a62cd64138
commit
51acf3053c
8 changed files with 4 additions and 31 deletions
|
@ -110,11 +110,6 @@ IModelVertexBuffer *FGLModelRenderer::CreateVertexBuffer(bool needindex, bool si
|
||||||
return new FModelVertexBuffer(needindex, singleframe);
|
return new FModelVertexBuffer(needindex, singleframe);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGLModelRenderer::SetVertexBuffer(IModelVertexBuffer *buffer)
|
|
||||||
{
|
|
||||||
static_cast<FModelVertexBuffer*>(buffer)->Bind(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FGLModelRenderer::ResetVertexBuffer()
|
void FGLModelRenderer::ResetVertexBuffer()
|
||||||
{
|
{
|
||||||
GLRenderer->mVBO->Bind(state);
|
GLRenderer->mVBO->Bind(state);
|
||||||
|
@ -168,18 +163,6 @@ FModelVertexBuffer::FModelVertexBuffer(bool needindex, bool singleframe)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void FModelVertexBuffer::Bind(FRenderState &state)
|
|
||||||
{
|
|
||||||
state.SetVertexBuffer(mVertexBuffer, mIndexFrame[0], mIndexFrame[1]);
|
|
||||||
if (mIndexBuffer) state.SetIndexBuffer(mIndexBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
FModelVertexBuffer::~FModelVertexBuffer()
|
FModelVertexBuffer::~FModelVertexBuffer()
|
||||||
{
|
{
|
||||||
if (mIndexBuffer) delete mIndexBuffer;
|
if (mIndexBuffer) delete mIndexBuffer;
|
||||||
|
@ -242,4 +225,7 @@ void FModelVertexBuffer::SetupFrame(FModelRenderer *renderer, unsigned int frame
|
||||||
{
|
{
|
||||||
mIndexFrame[0] = frame1;
|
mIndexFrame[0] = frame1;
|
||||||
mIndexFrame[1] = frame2;
|
mIndexFrame[1] = frame2;
|
||||||
|
auto state = static_cast<FGLModelRenderer*>(renderer)->state;
|
||||||
|
state.SetVertexBuffer(mVertexBuffer, mIndexFrame[0], mIndexFrame[1]);
|
||||||
|
if (mIndexBuffer) state.SetIndexBuffer(mIndexBuffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,11 +49,11 @@ public:
|
||||||
void UnlockIndexBuffer() override;
|
void UnlockIndexBuffer() override;
|
||||||
|
|
||||||
void SetupFrame(FModelRenderer *renderer, unsigned int frame1, unsigned int frame2, unsigned int size) override;
|
void SetupFrame(FModelRenderer *renderer, unsigned int frame1, unsigned int frame2, unsigned int size) override;
|
||||||
void Bind(FRenderState &state);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGLModelRenderer : public FModelRenderer
|
class FGLModelRenderer : public FModelRenderer
|
||||||
{
|
{
|
||||||
|
friend class FModelVertexBuffer;
|
||||||
int modellightindex = -1;
|
int modellightindex = -1;
|
||||||
FDrawInfo *di;
|
FDrawInfo *di;
|
||||||
FRenderState &state;
|
FRenderState &state;
|
||||||
|
@ -64,7 +64,6 @@ public:
|
||||||
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
||||||
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
|
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
|
||||||
IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) override;
|
IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) override;
|
||||||
void SetVertexBuffer(IModelVertexBuffer *buffer) override;
|
|
||||||
void ResetVertexBuffer() override;
|
void ResetVertexBuffer() override;
|
||||||
VSMatrix GetViewToWorldMatrix() override;
|
VSMatrix GetViewToWorldMatrix() override;
|
||||||
void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
||||||
|
|
|
@ -143,10 +143,6 @@ IModelVertexBuffer *PolyModelRenderer::CreateVertexBuffer(bool needindex, bool s
|
||||||
return new PolyModelVertexBuffer(needindex, singleframe);
|
return new PolyModelVertexBuffer(needindex, singleframe);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyModelRenderer::SetVertexBuffer(IModelVertexBuffer *buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void PolyModelRenderer::ResetVertexBuffer()
|
void PolyModelRenderer::ResetVertexBuffer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ public:
|
||||||
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
||||||
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
|
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
|
||||||
IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) override;
|
IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) override;
|
||||||
void SetVertexBuffer(IModelVertexBuffer *buffer) override;
|
|
||||||
void ResetVertexBuffer() override;
|
void ResetVertexBuffer() override;
|
||||||
VSMatrix GetViewToWorldMatrix() override;
|
VSMatrix GetViewToWorldMatrix() override;
|
||||||
void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
||||||
|
|
|
@ -270,7 +270,6 @@ void FModelRenderer::RenderFrameModels(const FSpriteModelFrame *smf, const FStat
|
||||||
FModel * mdl = Models[smf->modelIDs[i]];
|
FModel * mdl = Models[smf->modelIDs[i]];
|
||||||
FTexture *tex = smf->skinIDs[i].isValid() ? TexMan(smf->skinIDs[i]) : nullptr;
|
FTexture *tex = smf->skinIDs[i].isValid() ? TexMan(smf->skinIDs[i]) : nullptr;
|
||||||
mdl->BuildVertexBuffer(this);
|
mdl->BuildVertexBuffer(this);
|
||||||
SetVertexBuffer(mdl->GetVertexBuffer(this));
|
|
||||||
|
|
||||||
mdl->PushSpriteMDLFrame(smf, i);
|
mdl->PushSpriteMDLFrame(smf, i);
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,6 @@ public:
|
||||||
|
|
||||||
virtual IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) = 0;
|
virtual IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) = 0;
|
||||||
|
|
||||||
virtual void SetVertexBuffer(IModelVertexBuffer *buffer) = 0;
|
|
||||||
virtual void ResetVertexBuffer() = 0;
|
virtual void ResetVertexBuffer() = 0;
|
||||||
|
|
||||||
virtual VSMatrix GetViewToWorldMatrix() = 0;
|
virtual VSMatrix GetViewToWorldMatrix() = 0;
|
||||||
|
|
|
@ -218,10 +218,6 @@ namespace swrenderer
|
||||||
return new SWModelVertexBuffer(needindex, singleframe);
|
return new SWModelVertexBuffer(needindex, singleframe);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SWModelRenderer::SetVertexBuffer(IModelVertexBuffer *buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SWModelRenderer::ResetVertexBuffer()
|
void SWModelRenderer::ResetVertexBuffer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,6 @@ namespace swrenderer
|
||||||
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
void BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
||||||
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
|
void EndDrawModel(AActor *actor, FSpriteModelFrame *smf) override;
|
||||||
IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) override;
|
IModelVertexBuffer *CreateVertexBuffer(bool needindex, bool singleframe) override;
|
||||||
void SetVertexBuffer(IModelVertexBuffer *buffer) override;
|
|
||||||
void ResetVertexBuffer() override;
|
void ResetVertexBuffer() override;
|
||||||
VSMatrix GetViewToWorldMatrix() override;
|
VSMatrix GetViewToWorldMatrix() override;
|
||||||
void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
void BeginDrawHUDModel(AActor *actor, const VSMatrix &objectToWorldMatrix, bool mirrored) override;
|
||||||
|
|
Loading…
Reference in a new issue