Browse Source

add clear_transform

David Rose 22 years ago
parent
commit
28aba7f1a6
2 changed files with 24 additions and 0 deletions
  1. 22 0
      panda/src/pgraph/nodePath.I
  2. 2 0
      panda/src/pgraph/nodePath.h

+ 22 - 0
panda/src/pgraph/nodePath.I

@@ -458,6 +458,16 @@ get_transform() const {
   return node()->get_transform();
   return node()->get_transform();
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: NodePath::clear_transform
+//       Access: Published
+//  Description: Sets the transform object on this node to identity.
+////////////////////////////////////////////////////////////////////
+INLINE void NodePath::
+clear_transform() {
+  set_transform(TransformState::make_identity());
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: NodePath::set_transform
 //     Function: NodePath::set_transform
 //       Access: Published
 //       Access: Published
@@ -469,6 +479,18 @@ set_transform(const TransformState *transform) {
   node()->set_transform(transform);
   node()->set_transform(transform);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: NodePath::clear_transform
+//       Access: Published
+//  Description: Sets the transform object on this node to identity,
+//               relative to the other node.  This effectively places
+//               this node at the same position as the other node.
+////////////////////////////////////////////////////////////////////
+INLINE void NodePath::
+clear_transform(const NodePath &other) {
+  set_transform(other, TransformState::make_identity());
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: NodePath::get_net_transform
 //     Function: NodePath::get_net_transform
 //       Access: Published
 //       Access: Published

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

@@ -238,8 +238,10 @@ PUBLISHED:
   INLINE CPT(RenderState) get_net_state() const;
   INLINE CPT(RenderState) get_net_state() const;
 
 
   INLINE const TransformState *get_transform() const;
   INLINE const TransformState *get_transform() const;
+  INLINE void clear_transform();
   INLINE void set_transform(const TransformState *transform);
   INLINE void set_transform(const TransformState *transform);
   CPT(TransformState) get_transform(const NodePath &other) const;
   CPT(TransformState) get_transform(const NodePath &other) const;
+  INLINE void clear_transform(const NodePath &other);
   void set_transform(const NodePath &other, const TransformState *transform);
   void set_transform(const NodePath &other, const TransformState *transform);
   INLINE CPT(TransformState) get_net_transform() const;
   INLINE CPT(TransformState) get_net_transform() const;