Fix large worlds rendering of meshes

Add `Double4x4` for higher precision matrices operations

#2985
This commit is contained in:
Wojtek Figat
2025-02-11 13:01:48 +01:00
parent 21f8dab5de
commit aa8add7b38
13 changed files with 338 additions and 9 deletions

View File

@@ -15,6 +15,7 @@
#include "Engine/Content/Content.h"
#include "Engine/Core/Cache.h"
#include "Engine/Core/Collections/CollectionPoolCache.h"
#include "Engine/Core/Math/Double4x4.h"
#include "Engine/Debug/Exceptions/JsonParseException.h"
#include "Engine/Graphics/RenderTask.h"
#include "Engine/Graphics/RenderView.h"
@@ -785,6 +786,27 @@ void Actor::GetLocalToWorldMatrix(Matrix& localToWorld) const
#endif
}
void Actor::GetWorldToLocalMatrix(Double4x4& worldToLocal) const
{
GetLocalToWorldMatrix(worldToLocal);
worldToLocal.Invert();
}
void Actor::GetLocalToWorldMatrix(Double4x4& localToWorld) const
{
#if 0
_transform.GetWorld(localToWorld);
#else
_localTransform.GetWorld(localToWorld);
if (_parent)
{
Double4x4 parentToWorld;
_parent->GetLocalToWorldMatrix(parentToWorld);
localToWorld = localToWorld * parentToWorld;
}
#endif
}
void Actor::LinkPrefab(const Guid& prefabId, const Guid& prefabObjectId)
{
ASSERT(prefabId.IsValid());