diff --git a/panda/src/sgmanip/nodePath.I b/panda/src/sgmanip/nodePath.I index c1132159af..9efbb72aa9 100644 --- a/panda/src/sgmanip/nodePath.I +++ b/panda/src/sgmanip/nodePath.I @@ -904,20 +904,6 @@ set_hpr(const NodePath &other, float h, float p, float r) { set_hpr(other, LPoint3f(h, p, r)); } -//////////////////////////////////////////////////////////////////// -// Function: NodePath::get_hpr -// Access: Public -// Description: Returns the relative orientation of the bottom node -// as seen from the other node. -//////////////////////////////////////////////////////////////////// -INLINE LVecBase3f NodePath:: -get_hpr(const NodePath &other) const { - LMatrix4f mat = get_mat(other); - LVector3f scale, hpr, pos; - decompose_matrix(mat, scale, hpr, pos); - return hpr; -} - INLINE float NodePath:: get_h(const NodePath &other) const { return get_hpr(other)[0]; diff --git a/panda/src/sgmanip/nodePath.cxx b/panda/src/sgmanip/nodePath.cxx index 24e7382c50..d6c3bb7c93 100644 --- a/panda/src/sgmanip/nodePath.cxx +++ b/panda/src/sgmanip/nodePath.cxx @@ -1327,6 +1327,20 @@ get_hpr() const { return hpr; } +//////////////////////////////////////////////////////////////////// +// Function: NodePath::get_hpr +// Access: Public +// Description: Retrieves the rotation component of the transform. +//////////////////////////////////////////////////////////////////// +LVecBase3f NodePath:: +get_hpr(float roll) const { + nassertr(has_arcs(), LVecBase3f(0.0, 0.0, 0.0)); + LMatrix4f mat = get_mat(); + LVecBase3f scale, hpr, pos; + decompose_matrix(mat, scale, hpr, pos, roll); + return hpr; +} + //////////////////////////////////////////////////////////////////// // Function: NodePath::set_scale // Access: Public @@ -1752,6 +1766,34 @@ set_r(const NodePath &other, float r) { set_mat(other, mat); } +//////////////////////////////////////////////////////////////////// +// Function: NodePath::get_hpr +// Access: Public +// Description: Returns the relative orientation of the bottom node +// as seen from the other node. +//////////////////////////////////////////////////////////////////// +LVecBase3f NodePath:: +get_hpr(const NodePath &other) const { + LMatrix4f mat = get_mat(other); + LVector3f scale, hpr, pos; + decompose_matrix(mat, scale, hpr, pos); + return hpr; +} + +//////////////////////////////////////////////////////////////////// +// Function: NodePath::get_hpr +// Access: Public +// Description: Returns the relative orientation of the bottom node +// as seen from the other node. +//////////////////////////////////////////////////////////////////// +LVecBase3f NodePath:: +get_hpr(const NodePath &other, float roll) const { + LMatrix4f mat = get_mat(other); + LVector3f scale, hpr, pos; + decompose_matrix(mat, scale, hpr, pos, roll); + return hpr; +} + //////////////////////////////////////////////////////////////////// // Function: NodePath::set_scale // Access: Public diff --git a/panda/src/sgmanip/nodePath.h b/panda/src/sgmanip/nodePath.h index 949a914119..fe829bbb3b 100644 --- a/panda/src/sgmanip/nodePath.h +++ b/panda/src/sgmanip/nodePath.h @@ -285,6 +285,7 @@ PUBLISHED: void set_p(float p); void set_r(float r); LVecBase3f get_hpr() const; + LVecBase3f get_hpr(float roll) const; INLINE float get_h() const; INLINE float get_p() const; INLINE float get_r() const; @@ -368,7 +369,8 @@ PUBLISHED: void set_h(const NodePath &other, float h); void set_p(const NodePath &other, float p); void set_r(const NodePath &other, float r); - INLINE LVecBase3f get_hpr(const NodePath &other) const; + LVecBase3f get_hpr(const NodePath &other) const; + LVecBase3f get_hpr(const NodePath &other, float roll) const; INLINE float get_h(const NodePath &other) const; INLINE float get_p(const NodePath &other) const; INLINE float get_r(const NodePath &other) const;