From 5bb16ab016a8dbe88becd5fe38a665f45af5ad26 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 5 Aug 2018 15:09:26 +0200 Subject: [PATCH] Revert "Sdk/DebugSystem: Fix OBB drawing" This reverts commit a12c72186f96554941207bcbada74fa29dc53fdb. --- SDK/src/NDK/Systems/DebugSystem.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/SDK/src/NDK/Systems/DebugSystem.cpp b/SDK/src/NDK/Systems/DebugSystem.cpp index 204737e9a..0da17c352 100644 --- a/SDK/src/NDK/Systems/DebugSystem.cpp +++ b/SDK/src/NDK/Systems/DebugSystem.cpp @@ -59,6 +59,7 @@ namespace Ndk { NazaraAssert(m_entityOwner, "DebugRenderable has no owner"); + const DebugComponent& entityDebug = m_entityOwner->GetComponent(); const GraphicsComponent& entityGfx = m_entityOwner->GetComponent(); Nz::Boxf aabb = entityGfx.GetBoundingVolume().aabb; @@ -85,14 +86,16 @@ namespace Ndk { NazaraAssert(m_entityOwner, "DebugRenderable has no owner"); + const DebugComponent& entityDebug = m_entityOwner->GetComponent(); const GraphicsComponent& entityGfx = m_entityOwner->GetComponent(); - Nz::OrientedBoxf entityObb = entityGfx.GetBoundingVolume().obb; - Nz::Boxf obb(entityObb.GetCorner(Nz::BoxCorner_NearLeftTop), entityObb.GetCorner(Nz::BoxCorner_FarRightBottom)); + Nz::Boxf obb = entityGfx.GetBoundingVolume().obb.localBox; - Nz::Matrix4f transformMatrix = Nz::Matrix4f::Identity(); - transformMatrix.SetScale(obb.GetLengths()); - transformMatrix.SetTranslation(obb.GetCenter()); + Nz::Matrix4f transformMatrix = instanceData.transformMatrix; + Nz::Vector3f obbCenter = transformMatrix.Transform(obb.GetCenter(), 0.f); //< Apply rotation/scale to obb center, to display it at a correct position + + transformMatrix.ApplyScale(obb.GetLengths()); + transformMatrix.ApplyTranslation(obbCenter); renderQueue->AddMesh(0, m_material, m_meshData, Nz::Boxf::Zero(), transformMatrix, scissorRect); }