From 28aba7f1a649abd41bf82db97cad8ec8da042c56 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 6 Nov 2003 04:51:08 +0000 Subject: [PATCH] add clear_transform --- panda/src/pgraph/nodePath.I | 22 ++++++++++++++++++++++ panda/src/pgraph/nodePath.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/panda/src/pgraph/nodePath.I b/panda/src/pgraph/nodePath.I index 12a23ec683..20393a4f86 100644 --- a/panda/src/pgraph/nodePath.I +++ b/panda/src/pgraph/nodePath.I @@ -458,6 +458,16 @@ get_transform() const { 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 // Access: Published @@ -469,6 +479,18 @@ set_transform(const TransformState *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 // Access: Published diff --git a/panda/src/pgraph/nodePath.h b/panda/src/pgraph/nodePath.h index ba5a0f0d7f..756ba068c6 100644 --- a/panda/src/pgraph/nodePath.h +++ b/panda/src/pgraph/nodePath.h @@ -238,8 +238,10 @@ PUBLISHED: INLINE CPT(RenderState) get_net_state() const; INLINE const TransformState *get_transform() const; + INLINE void clear_transform(); INLINE void set_transform(const TransformState *transform); CPT(TransformState) get_transform(const NodePath &other) const; + INLINE void clear_transform(const NodePath &other); void set_transform(const NodePath &other, const TransformState *transform); INLINE CPT(TransformState) get_net_transform() const;