From 49e157c65d03e4fc4ba24ce7733e2972c6b3862d Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 15 Jul 2002 18:18:06 +0000 Subject: [PATCH] compare quats better --- panda/src/pgraph/transformState.cxx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/panda/src/pgraph/transformState.cxx b/panda/src/pgraph/transformState.cxx index 5ef26bc144..e4fdb715f1 100644 --- a/panda/src/pgraph/transformState.cxx +++ b/panda/src/pgraph/transformState.cxx @@ -220,18 +220,27 @@ operator < (const TransformState &other) const { return 0; } - if ((_flags & (F_components_given | F_hpr_given)) == - (F_components_given | F_hpr_given)) { + if ((_flags & (F_components_given | F_hpr_given | F_quat_given)) == + (F_components_given | F_hpr_given | F_quat_given)) { // If the transform was specified componentwise, compare them // componentwise. int c = _pos.compare_to(other._pos); if (c != 0) { return c < 0; } - c = _hpr.compare_to(other._hpr); - if (c != 0) { - return c < 0; + + if ((_flags & F_hpr_given) != 0) { + c = _hpr.compare_to(other._hpr); + if (c != 0) { + return c < 0; + } + } else if ((_flags & F_quat_given) != 0) { + c = _quat.compare_to(other._quat); + if (c != 0) { + return c < 0; + } } + c = _scale.compare_to(other._scale); return c < 0; }