Change the matrix interface on RenderState so the backend doesn't have to try detect changes on each Apply

Include the texture matrix in the mesh builder
This commit is contained in:
Magnus Norddahl 2023-05-06 00:34:42 +02:00
commit eba0bee9f6
17 changed files with 126 additions and 136 deletions

View file

@ -73,14 +73,15 @@ void FHWModelRenderer::BeginDrawModel(FRenderStyle style, FSpriteModelFrame *smf
state.SetCulling((mirrored ^ portalState.isMirrored()) ? Cull_CCW : Cull_CW);
}
state.mModelMatrix = objectToWorldMatrix;
state.EnableModelMatrix(true);
VSMatrix normalModelMatrix;
normalModelMatrix.computeNormalMatrix(objectToWorldMatrix);
state.SetModelMatrix(objectToWorldMatrix, normalModelMatrix);
}
void FHWModelRenderer::EndDrawModel(FRenderStyle style, FSpriteModelFrame *smf)
{
state.SetBoneIndexBase(-1);
state.EnableModelMatrix(false);
state.SetModelMatrix(VSMatrix::identity(), VSMatrix::identity());
state.SetDepthFunc(DF_Less);
if (!(style == DefaultRenderStyle()) && !(smf->flags & MDL_DONTCULLBACKFACES))
state.SetCulling(Cull_None);
@ -106,14 +107,15 @@ void FHWModelRenderer::BeginDrawHUDModel(FRenderStyle style, const VSMatrix &obj
state.SetCulling((mirrored ^ portalState.isMirrored()) ? Cull_CW : Cull_CCW);
}
state.mModelMatrix = objectToWorldMatrix;
state.EnableModelMatrix(true);
VSMatrix normalModelMatrix;
normalModelMatrix.computeNormalMatrix(objectToWorldMatrix);
state.SetModelMatrix(objectToWorldMatrix, normalModelMatrix);
}
void FHWModelRenderer::EndDrawHUDModel(FRenderStyle style)
{
state.SetBoneIndexBase(-1);
state.EnableModelMatrix(false);
state.SetModelMatrix(VSMatrix::identity(), VSMatrix::identity());
state.SetDepthFunc(DF_Less);
if (!(style == DefaultRenderStyle()))