瀏覽代碼

add TransformState::get_inverse()

David Rose 20 年之前
父節點
當前提交
9cf428352d
共有 2 個文件被更改,包括 15 次插入0 次删除
  1. 13 0
      panda/src/pgraph/transformState.I
  2. 2 0
      panda/src/pgraph/transformState.h

+ 13 - 0
panda/src/pgraph/transformState.I

@@ -624,6 +624,19 @@ get_mat3() const {
                    _mat(3, 0), _mat(3, 1), _mat(3, 3));
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: TransformState::get_inverse
+//       Access: Published
+//  Description: Returns the inverse of this transform.  If you are
+//               going to immediately compose this result with another
+//               TransformState, it is faster to do it in one
+//               operation with invert_compose().
+////////////////////////////////////////////////////////////////////
+INLINE CPT(TransformState) TransformState::
+get_inverse() const {
+  return invert_compose(TransformState::make_identity());
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: TransformState::get_geom_rendering
 //       Access: Published

+ 2 - 0
panda/src/pgraph/transformState.h

@@ -161,6 +161,8 @@ PUBLISHED:
   CPT(TransformState) compose(const TransformState *other) const;
   CPT(TransformState) invert_compose(const TransformState *other) const;
 
+  INLINE CPT(TransformState) get_inverse() const;
+
   INLINE int get_geom_rendering(int geom_rendering) const;
 
   int unref() const;