| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- // Filename: qpnodePathComponent.I
- // Created by: drose (25Feb02)
- //
- ////////////////////////////////////////////////////////////////////
- //
- // PANDA 3D SOFTWARE
- // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
- //
- // All use of this software is subject to the terms of the Panda 3d
- // Software license. You should have received a copy of this license
- // along with this source code; you will also find a current copy of
- // the license at http://www.panda3d.org/license.txt .
- //
- // To contact the maintainers of this program write to
- // [email protected] .
- //
- ////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////
- // Function: qpNodePathComponent::CData::Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE qpNodePathComponent::CData::
- CData() {
- _length = 1;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: qpNodePathComponent::CData::Copy Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE qpNodePathComponent::CData::
- CData(const qpNodePathComponent::CData ©) :
- _next(copy._next),
- _length(copy._length)
- {
- }
- ////////////////////////////////////////////////////////////////////
- // Function: qpNodePathComponent::Constructor
- // Access: Private
- // Description: Constructs a new qpNodePathComponent from the
- // indicated node. Don't try to call this directly; ask
- // the PandaNode to do it for you.
- ////////////////////////////////////////////////////////////////////
- INLINE qpNodePathComponent::
- qpNodePathComponent(PandaNode *node, qpNodePathComponent *next) :
- _node(node),
- _key(0)
- {
- #ifdef DO_MEMORY_USAGE
- MemoryUsage::update_type(this, get_class_type());
- #endif
- CDWriter cdata(_cycler);
- cdata->_next = next;
- if (next != (qpNodePathComponent *)NULL) {
- cdata->_length = next->get_length() + 1;
- }
- }
- ////////////////////////////////////////////////////////////////////
- // Function: qpNodePathComponent::Copy Constructor
- // Access: Private
- // Description: qpNodePathComponents should not be copied.
- ////////////////////////////////////////////////////////////////////
- INLINE qpNodePathComponent::
- qpNodePathComponent(const qpNodePathComponent ©) {
- nassertv(false);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: qpNodePathComponent::Copy Assignment Operator
- // Access: Private
- // Description: qpNodePathComponents should not be copied.
- ////////////////////////////////////////////////////////////////////
- INLINE void qpNodePathComponent::
- operator = (const qpNodePathComponent ©) {
- nassertv(false);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: qpNodePathComponent::Destructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE qpNodePathComponent::
- ~qpNodePathComponent() {
- nassertv(_node != (PandaNode *)NULL);
- _node->delete_component(this);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: qpNodePathComponent::get_node
- // Access: Public
- // Description: Returns the node referenced by this component.
- ////////////////////////////////////////////////////////////////////
- INLINE PandaNode *qpNodePathComponent::
- get_node() const {
- // We don't have to bother checking if the component has been
- // collapsed here, since the _node pointer will still be the same
- // even if it has.
- nassertr(_node != (PandaNode *)NULL, _node);
- return _node;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: qpNodePathComponent::is_collapsed
- // Access: Public
- // Description: Returns true if this component has been collapsed
- // with another component. In this case, the component
- // itself is invalid, and the collapsed component should
- // be used instead.
- ////////////////////////////////////////////////////////////////////
- INLINE bool qpNodePathComponent::
- is_collapsed() const {
- CDReader cdata(_cycler);
- return (cdata->_length == 0);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: qpNodePathComponent::get_collapsed
- // Access: Public
- // Description: If is_collapsed() returns true, this is the component
- // that this one has been collapsed with, and should be
- // replaced with.
- ////////////////////////////////////////////////////////////////////
- INLINE qpNodePathComponent *qpNodePathComponent::
- get_collapsed() const {
- nassertr(is_collapsed(), (qpNodePathComponent *)NULL);
- CDReader cdata(_cycler);
- return cdata->_next;
- }
|