Pass ticFrac to the model renderer as a parameter

This also removes the rather pointless gl_RenderModel functions because with their two lines of content they can just be placed inline.
This commit is contained in:
Christoph Oelckers 2018-06-19 09:18:27 +02:00
parent 8787905fed
commit 46d73e7b4b
8 changed files with 9 additions and 33 deletions

View file

@ -338,27 +338,3 @@ void FModelVertexBuffer::SetupFrame(FModelRenderer *renderer, unsigned int frame
} }
} }
} }
//===========================================================================
//
// gl_RenderModel
//
//===========================================================================
void gl_RenderModel(GLSprite * spr, int mli)
{
FGLModelRenderer renderer(mli);
renderer.RenderModel(spr->x, spr->y, spr->z, spr->modelframe, spr->actor);
}
//===========================================================================
//
// gl_RenderHUDModel
//
//===========================================================================
void gl_RenderHUDModel(DPSprite *psp, float ofsX, float ofsY, int mli)
{
FGLModelRenderer renderer(mli);
renderer.RenderHUDModel(psp, ofsX, ofsY);
}

View file

@ -51,5 +51,3 @@ public:
void DrawElements(int numIndices, size_t offset) override; void DrawElements(int numIndices, size_t offset) override;
}; };
void gl_RenderModel(GLSprite * spr, int mli);
void gl_RenderHUDModel(DPSprite *psp, float ofsx, float ofsy, int mli);

View file

@ -276,7 +276,8 @@ void FDrawInfo::DrawSprite(GLSprite *sprite, int pass)
} }
else else
{ {
gl_RenderModel(sprite, sprite->dynlightindex); FGLModelRenderer renderer(sprite->dynlightindex);
renderer.RenderModel(sprite->x, sprite->y, sprite->z, sprite->modelframe, sprite->actor, r_viewpoint.TicFrac);
} }
} }

View file

@ -66,7 +66,8 @@ void FDrawInfo::DrawPSprite (HUDSprite *huds)
if (huds->mframe) if (huds->mframe)
{ {
gl_RenderState.AlphaFunc(GL_GEQUAL, 0); gl_RenderState.AlphaFunc(GL_GEQUAL, 0);
gl_RenderHUDModel(huds->weapon, huds->mx, huds->my, huds->lightindex); FGLModelRenderer renderer(huds->lightindex);
renderer.RenderHUDModel(huds->weapon, huds->mx, huds->my);
} }
else else
{ {

View file

@ -37,7 +37,7 @@ void PolyRenderModel(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_
{ {
PolyModelRenderer renderer(thread, worldToClip, stencilValue); PolyModelRenderer renderer(thread, worldToClip, stencilValue);
renderer.AddLights(actor); renderer.AddLights(actor);
renderer.RenderModel(x, y, z, smf, actor); renderer.RenderModel(x, y, z, smf, actor, r_viewpoint.TicFrac);
PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f); PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f);
} }

View file

@ -54,7 +54,7 @@ extern TDeletingArray<FVoxelDef *> VoxelDefs;
DeletingModelArray Models; DeletingModelArray Models;
void FModelRenderer::RenderModel(float x, float y, float z, FSpriteModelFrame *smf, AActor *actor) void FModelRenderer::RenderModel(float x, float y, float z, FSpriteModelFrame *smf, AActor *actor, double ticFrac)
{ {
// Setup transformation. // Setup transformation.
@ -128,7 +128,7 @@ void FModelRenderer::RenderModel(float x, float y, float z, FSpriteModelFrame *s
if (actor->renderflags & RF_INTERPOLATEANGLES) if (actor->renderflags & RF_INTERPOLATEANGLES)
{ {
// [Nash] use interpolated angles // [Nash] use interpolated angles
DRotator Angles = actor->InterpolatedAngles(r_viewpoint.TicFrac); DRotator Angles = actor->InterpolatedAngles(ticFrac);
angle = Angles.Yaw.Degrees; angle = Angles.Yaw.Degrees;
} }

View file

@ -60,7 +60,7 @@ class FModelRenderer
public: public:
virtual ~FModelRenderer() { } virtual ~FModelRenderer() { }
void RenderModel(float x, float y, float z, FSpriteModelFrame *modelframe, AActor *actor); void RenderModel(float x, float y, float z, FSpriteModelFrame *modelframe, AActor *actor, double ticFrac);
void RenderHUDModel(DPSprite *psp, float ofsx, float ofsy); void RenderHUDModel(DPSprite *psp, float ofsx, float ofsy);
virtual ModelRendererType GetType() const = 0; virtual ModelRendererType GetType() const = 0;

View file

@ -76,7 +76,7 @@ namespace swrenderer
{ {
SWModelRenderer renderer(thread, clip3DFloor, &WorldToClip, MirrorWorldToClip); SWModelRenderer renderer(thread, clip3DFloor, &WorldToClip, MirrorWorldToClip);
renderer.AddLights(actor); renderer.AddLights(actor);
renderer.RenderModel(x, y, z, smf, actor); renderer.RenderModel(x, y, z, smf, actor, r_viewpoint.TicFrac);
PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f); PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f);
} }