Optimize PrevWorld updating during scene rendering

This commit is contained in:
Wojtek Figat
2022-11-03 00:08:30 +01:00
parent 949f16fba8
commit b2a9ee495a
4 changed files with 37 additions and 63 deletions

View File

@@ -269,18 +269,12 @@ void StaticModel::Draw(RenderContext& renderContext)
return;
}
Matrix world;
renderContext.View.GetWorldMatrix(_transform, world);
const Float3 translation = _transform.Translation - renderContext.View.Origin;
Matrix::Transformation(_transform.Scale, _transform.Orientation, translation, world);
GEOMETRY_DRAW_STATE_EVENT_BEGIN(_drawState, world);
if (_vertexColorsDirty)
FlushVertexColors();
#if USE_EDITOR
// Disable motion blur effects in editor without play mode enabled to hide minor artifacts on objects moving
if (!Editor::IsPlayMode)
_drawState.PrevWorld = world;
#endif
Mesh::DrawInfo draw;
draw.Buffer = &Entries;
draw.World = &world;
@@ -307,18 +301,12 @@ void StaticModel::Draw(RenderContextBatch& renderContextBatch)
return;
const RenderContext& renderContext = renderContextBatch.GetMainContext();
Matrix world;
renderContext.View.GetWorldMatrix(_transform, world);
const Float3 translation = _transform.Translation - renderContext.View.Origin;
Matrix::Transformation(_transform.Scale, _transform.Orientation, translation, world);
GEOMETRY_DRAW_STATE_EVENT_BEGIN(_drawState, world);
if (_vertexColorsDirty)
FlushVertexColors();
#if USE_EDITOR
// Disable motion blur effects in editor without play mode enabled to hide minor artifacts on objects moving
if (!Editor::IsPlayMode)
_drawState.PrevWorld = world;
#endif
Mesh::DrawInfo draw;
draw.Buffer = &Entries;
draw.World = &world;