From fe9fd49fe3ff5c9fc3474238e4955ddf56732cd3 Mon Sep 17 00:00:00 2001 From: kj16609 Date: Mon, 12 Aug 2024 16:38:10 -0400 Subject: [PATCH] Fixes usage of wrong matrix during frustum tests --- src/engine/systems/DrawPair.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/engine/systems/DrawPair.cpp b/src/engine/systems/DrawPair.cpp index 07d5c99..e80c7dd 100644 --- a/src/engine/systems/DrawPair.cpp +++ b/src/engine/systems/DrawPair.cpp @@ -8,6 +8,7 @@ #include +#include "engine/debug/drawers.hpp" #include "engine/gameobjects/components/ModelComponent.hpp" #include "engine/model/Model.hpp" #include "engine/tree/octtree/OctTreeNode.hpp" @@ -51,11 +52,14 @@ namespace fgl::engine { if ( !primitive.ready() ) continue; + const Matrix< MatrixType::ModelToWorld > matrix { obj.getTransform().mat() + * model_transform.mat() }; + // Does this primitive pass the bounds check - if ( !frustum.intersects( model_transform.mat() * primitive.getBoundingBox() ) ) continue; + if ( !frustum.intersects( matrix * primitive.getBoundingBox() ) ) continue; //assert( primitive.m_texture ); - const ModelMatrixInfo matrix_info { .model_matrix = obj.getTransform().mat4(), + const ModelMatrixInfo matrix_info { .model_matrix = matrix, .albedo_id = primitive.getAlbedoTextureID(), .normal_id = primitive.getNormalTextureID() };