Add relative-to-camera rendering for large worlds

This commit is contained in:
Wojtek Figat
2022-06-21 20:03:13 +02:00
parent f3bd0e469c
commit 134c8b99aa
35 changed files with 331 additions and 195 deletions

View File

@@ -80,9 +80,10 @@ struct GeometryLookup
PROFILE_CPU_NAMED("StaticModel");
// Check model meshes
Matrix world;
staticModel->GetWorld(&world);
const bool isDeterminantPositive = staticModel->GetTransform().GetDeterminant() >= 0.0f;
Transform transform = staticModel->GetTransform();
Matrix worldMatrix;
transform.GetWorld(worldMatrix);
const bool isDeterminantPositive = transform.GetDeterminant() >= 0.0f;
auto& lod = staticModel->Model->LODs[0];
for (int32 meshIndex = 0; meshIndex < lod.Meshes.Count(); meshIndex++)
{
@@ -96,9 +97,9 @@ struct GeometryLookup
// Transform triangle vertices from mesh space to world space
Vector3 t0, t1, t2;
Vector3::Transform(t.V0, world, t0);
Vector3::Transform(t.V1, world, t1);
Vector3::Transform(t.V2, world, t2);
Vector3::Transform(t.V0, worldMatrix, t0);
Vector3::Transform(t.V1, worldMatrix, t1);
Vector3::Transform(t.V2, worldMatrix, t2);
// Check if triangles intersects with the brush
if (CollisionsHelper::SphereIntersectsTriangle(brush, t0, t1, t2))