Explorar o código

pgraph: Allow moving a NodePath into a WorkingNodePath efficiently

rdb %!s(int64=3) %!d(string=hai) anos
pai
achega
a44d26bfbf
Modificáronse 2 ficheiros con 15 adicións e 1 borrados
  1. 14 1
      panda/src/pgraph/workingNodePath.I
  2. 1 0
      panda/src/pgraph/workingNodePath.h

+ 14 - 1
panda/src/pgraph/workingNodePath.I

@@ -21,7 +21,20 @@ WorkingNodePath(const NodePath &start) {
   nassertv(!start.is_empty());
   _next = nullptr;
   _start = start._head;
-  _node = start.node();
+  _node = _start->get_node();
+}
+
+/**
+ * Creates a WorkingNodePath that is the same as the indicated NodePath.  This
+ * is generally used to begin the traversal of a scene graph with the root
+ * NodePath.
+ */
+INLINE WorkingNodePath::
+WorkingNodePath(NodePath &&start) {
+  nassertv(!start.is_empty());
+  _next = nullptr;
+  _start = std::move(start._head);
+  _node = _start->get_node();
 }
 
 /**

+ 1 - 0
panda/src/pgraph/workingNodePath.h

@@ -39,6 +39,7 @@
 class EXPCL_PANDA_PGRAPH WorkingNodePath {
 public:
   INLINE WorkingNodePath(const NodePath &start);
+  INLINE WorkingNodePath(NodePath &&start);
   INLINE WorkingNodePath(const WorkingNodePath &copy);
   INLINE WorkingNodePath(const WorkingNodePath &parent, PandaNode *child);
   INLINE ~WorkingNodePath();