From b549133b3e0778a8fcb6c712c523aad0f11187cf Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 16 Mar 2020 14:55:42 +0100 Subject: [PATCH] collide: protect info print with is_info() check This prevents an unnecessary sqrt --- panda/src/collide/collisionPolygon.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/panda/src/collide/collisionPolygon.cxx b/panda/src/collide/collisionPolygon.cxx index 24c8230d2f..a2e7b7d44f 100644 --- a/panda/src/collide/collisionPolygon.cxx +++ b/panda/src/collide/collisionPolygon.cxx @@ -440,10 +440,12 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { LVector3 normal = (has_effective_normal() && sphere->get_respect_effective_normal()) ? get_effective_normal() : get_normal(); #ifndef NDEBUG if (!IS_THRESHOLD_EQUAL(normal.length_squared(), 1.0f, 0.001)) { - collide_cat.info() - << "polygon within " << entry.get_into_node_path() - << " has normal " << normal << " of length " << normal.length() - << "\n"; + if (collide_cat.is_info()) { + collide_cat.info() + << "polygon within " << entry.get_into_node_path() + << " has normal " << normal << " of length " << normal.length() + << "\n"; + } normal.normalize(); } #endif