Fix transform scaling applying to nested objects when drawing

#1796 #1350
This commit is contained in:
Wojtek Figat
2024-02-20 23:55:06 +01:00
parent e5cfd872b2
commit 9a21cfd092
13 changed files with 51 additions and 30 deletions

View File

@@ -335,8 +335,8 @@ void StaticModel::Draw(RenderContext& renderContext)
return;
}
Matrix world;
const Float3 translation = _transform.Translation - renderContext.View.Origin;
Matrix::Transformation(_transform.Scale, _transform.Orientation, translation, world);
GetLocalToWorldMatrix(world);
renderContext.View.GetWorldMatrix(world);
GEOMETRY_DRAW_STATE_EVENT_BEGIN(_drawState, world);
if (_vertexColorsDirty)
FlushVertexColors();
@@ -369,8 +369,8 @@ void StaticModel::Draw(RenderContextBatch& renderContextBatch)
return;
const RenderContext& renderContext = renderContextBatch.GetMainContext();
Matrix world;
const Float3 translation = _transform.Translation - renderContext.View.Origin;
Matrix::Transformation(_transform.Scale, _transform.Orientation, translation, world);
GetLocalToWorldMatrix(world);
renderContext.View.GetWorldMatrix(world);
GEOMETRY_DRAW_STATE_EVENT_BEGIN(_drawState, world);
if (_vertexColorsDirty)
FlushVertexColors();