Bläddra i källkod

provide interface to workaround hpr problem

David Rose 24 år sedan
förälder
incheckning
03b2acbfd2
3 ändrade filer med 45 tillägg och 15 borttagningar
  1. 0 14
      panda/src/sgmanip/nodePath.I
  2. 42 0
      panda/src/sgmanip/nodePath.cxx
  3. 3 1
      panda/src/sgmanip/nodePath.h

+ 0 - 14
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];

+ 42 - 0
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

+ 3 - 1
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;