Panda3D
nodePath.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file nodePath.I
10  * @author drose
11  * @date 2002-02-25
12  */
13 
14 /**
15  * This constructs an empty NodePath with no nodes.
16  */
17 INLINE NodePath::
19  _error_type(ET_ok),
20  _backup_key(0)
21 {
22 }
23 
24 /**
25  * This constructs a new NodePath with a single node. An ordinary, unattached
26  * PandaNode is created with the indicated name.
27  */
28 INLINE NodePath::
29 NodePath(const std::string &top_node_name, Thread *current_thread) :
30  _error_type(ET_ok)
31 {
32  PandaNode *top_node = new PandaNode(top_node_name);
33  int pipeline_stage = current_thread->get_pipeline_stage();
34  _head = top_node->get_generic_component(false, pipeline_stage, current_thread);
35  _backup_key = 0;
36 }
37 
38 /**
39  * This constructs a NodePath for the indicated node. If the node does not
40  * have any parents, this creates a singleton NodePath; otherwise, it
41  * automatically finds the path from the node to the root. If the node has
42  * multiple paths to the root, one path is chosen arbitrarily and a warning
43  * message is printed (but see also NodePath::any_path(), below).
44  */
45 INLINE NodePath::
46 NodePath(PandaNode *node, Thread *current_thread) :
47  _error_type(ET_ok)
48 {
49  if (node != nullptr) {
50  int pipeline_stage = current_thread->get_pipeline_stage();
51  _head = node->get_generic_component(false, pipeline_stage, current_thread);
52  }
53  _backup_key = 0;
54 }
55 
56 /**
57  * Returns a new NodePath that represents any arbitrary path from the root to
58  * the indicated node. This is the same thing that would be returned by
59  * NodePath(node), except that no warning is issued if the path is ambiguous.
60  */
61 INLINE NodePath NodePath::
62 any_path(PandaNode *node, Thread *current_thread) {
63  NodePath result;
64  if (node != nullptr) {
65  int pipeline_stage = current_thread->get_pipeline_stage();
66  result._head = node->get_generic_component(true, pipeline_stage,
67  current_thread);
68  }
69  return result;
70 }
71 
72 /**
73  *
74  */
75 INLINE NodePath::
76 NodePath(const NodePath &copy) :
77  _head(copy._head),
78  _backup_key(copy._backup_key),
79  _error_type(copy._error_type)
80 {
81 }
82 
83 /**
84  *
85  */
86 INLINE void NodePath::
87 operator = (const NodePath &copy) {
88  _head = copy._head;
89  _backup_key = copy._backup_key;
90  _error_type = copy._error_type;
91 }
92 
93 /**
94  *
95  */
96 INLINE NodePath::
97 NodePath(NodePath &&from) noexcept :
98  _head(std::move(from._head)),
99  _backup_key(from._backup_key),
100  _error_type(from._error_type)
101 {
102 }
103 
104 /**
105  *
106  */
107 INLINE void NodePath::
108 operator = (NodePath &&from) noexcept {
109  _head = std::move(from._head);
110  _backup_key = from._backup_key;
111  _error_type = from._error_type;
112 }
113 
114 /**
115  * Sets this NodePath to the empty NodePath. It will no longer point to any
116  * node.
117  */
118 INLINE void NodePath::
119 clear() {
120  _head.clear();
121  _backup_key = 0;
122  _error_type = ET_ok;
123 }
124 
125 /**
126  * Creates a NodePath with the ET_not_found error type set.
127  */
128 INLINE NodePath NodePath::
130  NodePath result;
131  result._error_type = ET_not_found;
132  return result;
133 }
134 
135 /**
136  * Creates a NodePath with the ET_removed error type set.
137  */
138 INLINE NodePath NodePath::
140  NodePath result;
141  result._error_type = ET_removed;
142  return result;
143 }
144 
145 /**
146  * Creates a NodePath with the ET_fail error type set.
147  */
148 INLINE NodePath NodePath::
149 fail() {
150  NodePath result;
151  result._error_type = ET_fail;
152  return result;
153 }
154 
155 /**
156  * Certain operations, such as find() or find_all_matches(), require a
157  * traversal of the scene graph to search for the target node or nodes. This
158  * traversal does not attempt to detect cycles, so an arbitrary cap is set on
159  * the depth of the traversal as a poor man's cycle detection, in the event
160  * that a cycle has inadvertently been introduced into the scene graph.
161  *
162  * There may be other reasons you'd want to truncate a search before the
163  * bottom of the scene graph has been reached. In any event, this function
164  * sets the limit on the number of levels that a traversal will continue, and
165  * hence the maximum length of a path that may be returned by a traversal.
166  *
167  * This is a static method, and so changing this parameter affects all of the
168  * NodePaths in the universe.
169  */
170 INLINE void NodePath::
171 set_max_search_depth(int max_search_depth) {
172  _max_search_depth = max_search_depth;
173 }
174 
175 /**
176  * Returns the current setting of the search depth limit. See
177  * set_max_search_depth.
178  */
179 INLINE int NodePath::
181  return _max_search_depth;
182 }
183 
184 /**
185  * Returns true if the NodePath contains no nodes.
186  */
187 INLINE bool NodePath::
188 is_empty() const {
189  return (_head == nullptr);
190 }
191 
192 /**
193  * Returns true if the NodePath contains exactly one node.
194  */
195 INLINE bool NodePath::
196 is_singleton(Thread *current_thread) const {
197  int pipeline_stage = current_thread->get_pipeline_stage();
198  return (_head != nullptr && _head->is_top_node(pipeline_stage, current_thread));
199 }
200 
201 /**
202  * If is_empty() is true, this returns a code that represents the reason why
203  * the NodePath is empty.
204  */
205 INLINE NodePath::ErrorType NodePath::
206 get_error_type() const {
207  return _error_type;
208 }
209 
210 /**
211  * Returns the top node of the path, or NULL if the path is empty. This
212  * requires iterating through the path.
213  */
214 INLINE PandaNode *NodePath::
215 get_top_node(Thread *current_thread) const {
216  if (is_empty()) {
217  return nullptr;
218  }
219 
220  return get_top(current_thread).node();
221 }
222 
223 /**
224  * Returns the referenced node of the path.
225  */
226 INLINE PandaNode *NodePath::
227 node() const {
228  nassertr_always(!is_empty(), nullptr);
229  return _head->get_node();
230 }
231 
232 /**
233  * Returns an integer that is guaranteed to be the same for all NodePaths that
234  * represent the same node instance, and different for all NodePaths that
235  * represent a different node instance.
236  *
237  * The same key will be returned for a particular instance as long as at least
238  * one NodePath exists that represents that instance; if all NodePaths for a
239  * particular instance destruct and a new one is later created, it may have a
240  * different index. However, a given key will never be reused for a different
241  * instance (unless the app has been running long enough that we overflow the
242  * integer key value).
243  */
244 INLINE int NodePath::
245 get_key() const {
246  if (is_empty()) {
247  return _backup_key;
248  }
249  return _head->get_key();
250 }
251 
252 /**
253  * Adds the NodePath into the running hash. This is intended to be used by
254  * lower-level code that computes a hash for each NodePath. It modifies the
255  * hash value passed in by a unique adjustment for each NodePath, and returns
256  * the modified hash.
257  *
258  * This is similar to the unique integer returned by get_key(), but it is not
259  * guaranteed to remain unique beyond the lifetime of this particular
260  * NodePath. Once this NodePath destructs, a different NodePath may be
261  * created which shares the same hash value.
262  */
263 INLINE size_t NodePath::
264 add_hash(size_t hash) const {
265  return pointer_hash::add_hash(hash, _head);
266 }
267 
268 /**
269  * Returns true if the node represented by this NodePath is parented within
270  * the same graph as that of the other NodePath. This is essentially the same
271  * thing as asking whether get_top() of both NodePaths is the same (e.g., both
272  * "render").
273  */
274 INLINE bool NodePath::
275 is_same_graph(const NodePath &other, Thread *current_thread) const {
276  // Actually, it's possible for the top nodes to be the same, but the
277  // NodePaths still to be considered in different graphs. But even in this
278  // case, get_top() will be different for each one. (They'll be different
279  // singleton NodePaths that happen to reference the same node).
280 
281  // This will happen if one of the top nodes is considered a different
282  // instance--for instance, render.instance_to(NodePath()) returns a
283  // different instance of render that appears to have the same top node. But
284  // this is a very rare thing to do.
285  int a_count, b_count;
286  return (find_common_ancestor(*this, other, a_count, b_count, current_thread) != nullptr);
287 }
288 
289 /**
290  * Returns true if the node represented by this NodePath is a parent or other
291  * ancestor of the other NodePath, or false if it is not.
292  */
293 INLINE bool NodePath::
294 is_ancestor_of(const NodePath &other, Thread *current_thread) const {
295  int a_count, b_count;
296  if (find_common_ancestor(*this, other, a_count, b_count, current_thread) == nullptr) {
297  // Not related.
298  return false;
299  }
300 
301  // They are related; now b is descended from a only if a is the common
302  // ancestor (which is to say, a_count == 0).
303  return (a_count == 0);
304 }
305 
306 /**
307  * Returns the lowest NodePath that both of these two NodePaths have in
308  * common: the first ancestor that both of them share. If the two NodePaths
309  * are unrelated, returns NodePath::not_found().
310  */
311 INLINE NodePath NodePath::
312 get_common_ancestor(const NodePath &other, Thread *current_thread) const {
313  int a_count, b_count;
314  NodePathComponent *common = find_common_ancestor(*this, other, a_count, b_count, current_thread);
315  if (common == nullptr) {
316  return NodePath::not_found();
317  }
318 
319  NodePath result;
320  result._head = common;
321  return result;
322 }
323 
324 /**
325  * Returns the number of children of the referenced node.
326  */
327 INLINE int NodePath::
328 get_num_children(Thread *current_thread) const {
329  nassertr_always(!is_empty(), 0);
330  return _head->get_node()->get_num_children(current_thread);
331 }
332 
333 /**
334  * Returns a NodePath representing the nth child of the referenced node.
335  */
336 INLINE NodePath NodePath::
337 get_child(int n, Thread *current_thread) const {
338  nassertr_always(n >= 0 && n < get_num_children(current_thread), NodePath());
339  NodePath child;
340  int pipeline_stage = current_thread->get_pipeline_stage();
341  child._head = PandaNode::get_component(_head, _head->get_node()->get_child(n, current_thread),
342  pipeline_stage, current_thread);
343  return child;
344 }
345 
346 /**
347  * Returns the number of nodes at and below this level.
348  */
349 INLINE int NodePath::
351  if (is_empty()) {
352  return 0;
353  }
354  return _head->get_node()->count_num_descendants();
355 }
356 
357 /**
358  * Returns true if the referenced node has a parent; i.e. the NodePath chain
359  * contains at least two nodes.
360  */
361 INLINE bool NodePath::
362 has_parent(Thread *current_thread) const {
363  return !is_empty() && !is_singleton(current_thread);
364 }
365 
366 /**
367  * Returns the NodePath to the parent of the referenced node: that is, this
368  * NodePath, shortened by one node. The parent of a singleton NodePath is
369  * defined to be the empty NodePath.
370  */
371 INLINE NodePath NodePath::
372 get_parent(Thread *current_thread) const {
373  if (!has_parent(current_thread)) {
374  return NodePath();
375  }
376 
377  int pipeline_stage = current_thread->get_pipeline_stage();
378 
379  NodePath parent;
380  parent._head = _head->get_next(pipeline_stage, current_thread);
381  return parent;
382 }
383 
384 /**
385  * Creates an ordinary PandaNode and attaches it below the current NodePath,
386  * returning a new NodePath that references it.
387  */
388 INLINE NodePath NodePath::
389 attach_new_node(const std::string &name, int sort, Thread *current_thread) const {
390  nassertr(verify_complete(current_thread), NodePath::fail());
391 
392  return attach_new_node(new PandaNode(name), sort, current_thread);
393 }
394 
395 /**
396  * Lists the hierarchy at and below the referenced node.
397  */
398 INLINE void NodePath::
399 ls() const {
400  ls(nout);
401 }
402 
403 /**
404  * Lists the hierarchy at and below the referenced node.
405  */
406 INLINE void NodePath::
407 ls(std::ostream &out, int indent_level) const {
408  if (is_empty()) {
409  out << "(empty)\n";
410  } else {
411  node()->ls(out, indent_level);
412  }
413 }
414 
415 /**
416  * Lists the hierarchy at and above the referenced node.
417  */
418 INLINE void NodePath::
419 reverse_ls() const {
420  reverse_ls(nout);
421 }
422 
423 /**
424  * Changes the complete state object on this node.
425  */
426 INLINE void NodePath::
427 set_state(const RenderState *state, Thread *current_thread) {
428  nassertv_always(!is_empty());
429  node()->set_state(state, current_thread);
430 }
431 
432 /**
433  * Returns the net state on this node from the root.
434  */
435 INLINE CPT(RenderState) NodePath::
436 get_net_state(Thread *current_thread) const {
437  nassertr(_error_type == ET_ok, RenderState::make_empty());
438  return r_get_net_state(_head, current_thread);
439 }
440 
441 /**
442  * Adds the indicated render attribute to the scene graph on this node. This
443  * attribute will now apply to this node and everything below. If there was
444  * already an attribute of the same type, it is replaced.
445  */
446 INLINE void NodePath::
447 set_attrib(const RenderAttrib *attrib, int priority) {
448  nassertv_always(!is_empty());
449  node()->set_attrib(attrib, priority);
450 }
451 
452 /**
453  * Returns the render attribute of the indicated type, if it is defined on the
454  * node, or NULL if it is not. This checks only what is set on this
455  * particular node level, and has nothing to do with what render attributes
456  * may be inherited from parent nodes.
457  */
458 INLINE const RenderAttrib *NodePath::
459 get_attrib(TypeHandle type) const {
460  nassertr_always(!is_empty(), nullptr);
461  return node()->get_attrib(type);
462 }
463 
464 /**
465  * Returns true if there is a render attribute of the indicated type defined
466  * on this node, or false if there is not.
467  */
468 INLINE bool NodePath::
469 has_attrib(TypeHandle type) const {
470  nassertr_always(!is_empty(), false);
471  return node()->has_attrib(type);
472 }
473 
474 /**
475  * Removes the render attribute of the given type from this node. This node,
476  * and the subgraph below, will now inherit the indicated render attribute
477  * from the nodes above this one.
478  */
479 INLINE void NodePath::
481  nassertv_always(!is_empty());
482  node()->clear_attrib(type);
483 }
484 
485 /**
486  * Adds the indicated render effect to the scene graph on this node. If there
487  * was already an effect of the same type, it is replaced.
488  */
489 INLINE void NodePath::
490 set_effect(const RenderEffect *effect) {
491  nassertv_always(!is_empty());
492  node()->set_effect(effect);
493 }
494 
495 /**
496  * Returns the render effect of the indicated type, if it is defined on the
497  * node, or NULL if it is not.
498  */
499 INLINE const RenderEffect *NodePath::
500 get_effect(TypeHandle type) const {
501  nassertr_always(!is_empty(), nullptr);
502  return node()->get_effect(type);
503 }
504 
505 /**
506  * Returns true if there is a render effect of the indicated type defined on
507  * this node, or false if there is not.
508  */
509 INLINE bool NodePath::
510 has_effect(TypeHandle type) const {
511  nassertr_always(!is_empty(), false);
512  return node()->has_effect(type);
513 }
514 
515 /**
516  * Removes the render effect of the given type from this node.
517  */
518 INLINE void NodePath::
520  nassertv_always(!is_empty());
521  node()->clear_effect(type);
522 }
523 
524 /**
525  * Sets the complete RenderEffects that will be applied this node. This
526  * completely replaces whatever has been set on this node via repeated calls
527  * to set_attrib().
528  */
529 INLINE void NodePath::
530 set_effects(const RenderEffects *effects) {
531  nassertv_always(!is_empty());
532  node()->set_effects(effects);
533 }
534 
535 /**
536  * Returns the complete RenderEffects that will be applied to this node.
537  */
538 INLINE const RenderEffects *NodePath::
539 get_effects() const {
540  nassertr_always(!is_empty(), RenderEffects::make_empty());
541  return node()->get_effects();
542 }
543 
544 /**
545  * Resets this node to have no render effects.
546  */
547 INLINE void NodePath::
549  nassertv_always(!is_empty());
550  node()->clear_effects();
551 }
552 
553 /**
554  * Sets the transform object on this node to identity.
555  */
556 INLINE void NodePath::
557 clear_transform(Thread *current_thread) {
558  set_transform(TransformState::make_identity(), current_thread);
559 }
560 
561 /**
562  * Changes the complete transform object on this node.
563  */
564 INLINE void NodePath::
565 set_transform(const TransformState *transform, Thread *current_thread) {
566  nassertv_always(!is_empty());
567  node()->set_transform(transform, current_thread);
568 }
569 
570 /**
571  * Sets the transform object on this node to identity, relative to the other
572  * node. This effectively places this node at the same position as the other
573  * node.
574  */
575 INLINE void NodePath::
576 clear_transform(const NodePath &other, Thread *current_thread) {
577  set_transform(other, TransformState::make_identity(), current_thread);
578 }
579 
580 /**
581  * Returns the net transform on this node from the root.
582  */
583 INLINE CPT(TransformState) NodePath::
584 get_net_transform(Thread *current_thread) const {
585  nassertr(_error_type == ET_ok, TransformState::make_identity());
586  return r_get_net_transform(_head, current_thread);
587 }
588 
589 /**
590  * Sets the transform that represents this node's "previous" position, one
591  * frame ago, for the purposes of detecting motion for accurate collision
592  * calculations.
593  */
594 INLINE void NodePath::
595 set_prev_transform(const TransformState *transform, Thread *current_thread) {
596  nassertv_always(!is_empty());
597  node()->set_prev_transform(transform, current_thread);
598 }
599 
600 /**
601  * Returns the net "previous" transform on this node from the root. See
602  * set_prev_transform().
603  */
604 INLINE CPT(TransformState) NodePath::
605 get_net_prev_transform(Thread *current_thread) const {
606  nassertr(_error_type == ET_ok, TransformState::make_identity());
607  return r_get_net_prev_transform(_head, current_thread);
608 }
609 
610 /**
611  * Sets the translation component of the transform, leaving rotation and scale
612  * untouched. This also resets the node's "previous" position, so that the
613  * collision system will see the node as having suddenly appeared in the new
614  * position, without passing any points in between.
615  */
616 INLINE void NodePath::
617 set_pos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
618  set_pos(LPoint3(x, y, z));
619 }
620 
621 /**
622  * Sets the translation component, without changing the "previous" position,
623  * so that the collision system will see the node as moving fluidly from its
624  * previous position to its new position.
625  */
626 INLINE void NodePath::
627 set_fluid_pos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
628  set_fluid_pos(LPoint3(x, y, z));
629 }
630 
631 INLINE PN_stdfloat NodePath::
632 get_x() const {
633  return get_pos()[0];
634 }
635 
636 INLINE PN_stdfloat NodePath::
637 get_y() const {
638  return get_pos()[1];
639 }
640 
641 INLINE PN_stdfloat NodePath::
642 get_z() const {
643  return get_pos()[2];
644 }
645 
646 /**
647  * Sets the rotation component of the transform, leaving translation and scale
648  * untouched.
649  */
650 INLINE void NodePath::
651 set_hpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) {
652  set_hpr(LVecBase3(h, p, r));
653 }
654 
655 INLINE PN_stdfloat NodePath::
656 get_h() const {
657  return get_hpr()[0];
658 }
659 
660 INLINE PN_stdfloat NodePath::
661 get_p() const {
662  return get_hpr()[1];
663 }
664 
665 INLINE PN_stdfloat NodePath::
666 get_r() const {
667  return get_hpr()[2];
668 }
669 
670 /**
671  * Sets the scale component of the transform, leaving translation and rotation
672  * untouched.
673  */
674 INLINE void NodePath::
675 set_scale(PN_stdfloat scale) {
676  set_scale(LVecBase3(scale, scale, scale));
677 }
678 
679 INLINE void NodePath::
680 set_scale(PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz) {
681  set_scale(LVecBase3(sx, sy, sz));
682 }
683 
684 INLINE PN_stdfloat NodePath::
685 get_sx() const {
686  return get_scale()[0];
687 }
688 
689 INLINE PN_stdfloat NodePath::
690 get_sy() const {
691  return get_scale()[1];
692 }
693 
694 INLINE PN_stdfloat NodePath::
695 get_sz() const {
696  return get_scale()[2];
697 }
698 
699 /**
700  * Sets the shear component of the transform, leaving translation, rotation,
701  * and scale untouched.
702  */
703 INLINE void NodePath::
704 set_shear(PN_stdfloat shxy, PN_stdfloat shxz, PN_stdfloat shyz) {
705  set_shear(LVecBase3(shxy, shxz, shyz));
706 }
707 
708 INLINE PN_stdfloat NodePath::
709 get_shxy() const {
710  return get_shear()[0];
711 }
712 
713 INLINE PN_stdfloat NodePath::
714 get_shxz() const {
715  return get_shear()[1];
716 }
717 
718 INLINE PN_stdfloat NodePath::
719 get_shyz() const {
720  return get_shear()[2];
721 }
722 
723 /**
724  * Sets the translation and rotation component of the transform, leaving scale
725  * untouched.
726  */
727 INLINE void NodePath::
728 set_pos_hpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) {
729  set_pos_hpr(LVecBase3(x, y, z), LVecBase3(h, p, r));
730 }
731 
732 /**
733  * Sets the rotation and scale components of the transform, leaving
734  * translation untouched.
735  */
736 INLINE void NodePath::
737 set_hpr_scale(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz) {
738  set_hpr_scale(LVecBase3(h, p, r), LVecBase3(sx, sy, sz));
739 }
740 
741 /**
742  * Completely replaces the transform with new translation, rotation, and scale
743  * components.
744  */
745 INLINE void NodePath::
746 set_pos_hpr_scale(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r,
747  PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz) {
748  set_pos_hpr_scale(LVecBase3(x, y, z), LVecBase3(h, p, r),
749  LVecBase3(sx, sy, sz));
750 }
751 
752 /**
753  * Completely removes any transform from the referenced node.
754  */
755 INLINE void NodePath::
757  nassertv_always(!is_empty());
758  node()->clear_transform();
759 }
760 
761 /**
762  * Returns true if a non-identity transform matrix has been applied to the
763  * referenced node, false otherwise.
764  */
765 INLINE bool NodePath::
766 has_mat() const {
767  nassertr_always(!is_empty(), false);
768  return !node()->get_transform()->is_identity();
769 }
770 
771 /**
772  * Returns the transform matrix that has been applied to the referenced node,
773  * or the identity matrix if no matrix has been applied.
774  */
775 INLINE const LMatrix4 &NodePath::
776 get_mat() const {
777  nassertr_always(!is_empty(), LMatrix4::ident_mat());
778 
779  return node()->get_transform()->get_mat();
780 }
781 
782 
783 /**
784  * Sets the transform on this NodePath so that it rotates to face the
785  * indicated point in space. This will overwrite any previously existing
786  * scale on the node, although it will preserve any translation.
787  */
788 INLINE void NodePath::
789 look_at(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
790  look_at(LPoint3(x, y, z));
791 }
792 
793 /**
794  * Behaves like look_at(), but with a strong preference to keeping the up
795  * vector oriented in the indicated "up" direction.
796  */
797 INLINE void NodePath::
798 heads_up(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
799  heads_up(LPoint3(x, y, z));
800 }
801 
802 /**
803  * Sets the translation component of the transform, relative to the other
804  * node.
805  */
806 INLINE void NodePath::
807 set_pos(const NodePath &other, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
808  set_pos(other, LPoint3(x, y, z));
809 }
810 
811 /**
812  * Sets the translation component, without changing the "previous" position,
813  * so that the collision system will see the node as moving fluidly from its
814  * previous position to its new position.
815  */
816 INLINE void NodePath::
817 set_fluid_pos(const NodePath &other, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
818  set_fluid_pos(other, LPoint3(x, y, z));
819 }
820 
821 INLINE PN_stdfloat NodePath::
822 get_x(const NodePath &other) const {
823  return get_pos(other)[0];
824 }
825 
826 INLINE PN_stdfloat NodePath::
827 get_y(const NodePath &other) const {
828  return get_pos(other)[1];
829 }
830 
831 INLINE PN_stdfloat NodePath::
832 get_z(const NodePath &other) const {
833  return get_pos(other)[2];
834 }
835 
836 /**
837  * Sets the rotation component of the transform, relative to the other node.
838  */
839 INLINE void NodePath::
840 set_hpr(const NodePath &other, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) {
841  set_hpr(other, LPoint3(h, p, r));
842 }
843 
844 INLINE PN_stdfloat NodePath::
845 get_h(const NodePath &other) const {
846  return get_hpr(other)[0];
847 }
848 
849 INLINE PN_stdfloat NodePath::
850 get_p(const NodePath &other) const {
851  return get_hpr(other)[1];
852 }
853 
854 INLINE PN_stdfloat NodePath::
855 get_r(const NodePath &other) const {
856  return get_hpr(other)[2];
857 }
858 
859 /**
860  * Sets the scale component of the transform, relative to the other node.
861  */
862 INLINE void NodePath::
863 set_scale(const NodePath &other, PN_stdfloat scale) {
864  set_scale(other, LPoint3(scale, scale, scale));
865 }
866 
867 /**
868  * Sets the scale component of the transform, relative to the other node.
869  */
870 INLINE void NodePath::
871 set_scale(const NodePath &other, PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz) {
872  set_scale(other, LPoint3(sx, sy, sz));
873 }
874 
875 /**
876  * Returns the relative scale of the referenced node as seen from the other
877  * node.
878  */
879 INLINE PN_stdfloat NodePath::
880 get_sx(const NodePath &other) const {
881  return get_scale(other)[0];
882 }
883 
884 INLINE PN_stdfloat NodePath::
885 get_sy(const NodePath &other) const {
886  return get_scale(other)[1];
887 }
888 
889 INLINE PN_stdfloat NodePath::
890 get_sz(const NodePath &other) const {
891  return get_scale(other)[2];
892 }
893 
894 /**
895  * Sets the shear component of the transform, relative to the other node.
896  */
897 INLINE void NodePath::
898 set_shear(const NodePath &other, PN_stdfloat shxy, PN_stdfloat shxz, PN_stdfloat shyz) {
899  set_shear(other, LPoint3(shxy, shxz, shyz));
900 }
901 
902 /**
903  * Returns the relative shear of the referenced node as seen from the other
904  * node.
905  */
906 INLINE PN_stdfloat NodePath::
907 get_shxy(const NodePath &other) const {
908  return get_shear(other)[0];
909 }
910 
911 INLINE PN_stdfloat NodePath::
912 get_shxz(const NodePath &other) const {
913  return get_shear(other)[1];
914 }
915 
916 INLINE PN_stdfloat NodePath::
917 get_shyz(const NodePath &other) const {
918  return get_shear(other)[2];
919 }
920 
921 /**
922  * Sets the translation and rotation component of the transform, relative to
923  * the other node.
924  */
925 INLINE void NodePath::
926 set_pos_hpr(const NodePath &other,
927  PN_stdfloat x, PN_stdfloat y, PN_stdfloat z,
928  PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) {
929  set_pos_hpr(other, LVecBase3(x, y, z), LVecBase3(h, p, r));
930 }
931 
932 /**
933  * Sets the rotation and scale components of the transform, leaving
934  * translation untouched. This, or set_pos_hpr_scale, is the preferred way to
935  * update a transform when both hpr and scale are to be changed.
936  */
937 INLINE void NodePath::
938 set_hpr_scale(const NodePath &other,
939  PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz) {
940  set_hpr_scale(other, LVecBase3(h, p, r), LVecBase3(sx, sy, sz));
941 }
942 
943 /**
944  * Completely replaces the transform with new translation, rotation, and scale
945  * components, relative to the other node.
946  */
947 INLINE void NodePath::
949  PN_stdfloat x, PN_stdfloat y, PN_stdfloat z,
950  PN_stdfloat h, PN_stdfloat p, PN_stdfloat r,
951  PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz) {
952  set_pos_hpr_scale(other, LVecBase3(x, y, z), LVecBase3(h, p, r),
953  LVecBase3(sx, sy, sz));
954 }
955 
956 /**
957  * Sets the hpr on this NodePath so that it rotates to face the indicated
958  * point in space, which is relative to the other NodePath.
959  */
960 INLINE void NodePath::
961 look_at(const NodePath &other, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
962  look_at(other, LPoint3(x, y, z));
963 }
964 
965 /**
966  * Behaves like look_at(), but with a strong preference to keeping the up
967  * vector oriented in the indicated "up" direction.
968  */
969 INLINE void NodePath::
970 heads_up(const NodePath &other, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
971  heads_up(other, LPoint3(x, y, z));
972 }
973 
974 /**
975  * Returns the straight-line distance between this referenced node's
976  * coordinate frame's origin, and that of the other node's origin.
977  */
978 INLINE PN_stdfloat NodePath::
979 get_distance(const NodePath &other) const {
980  LPoint3 pos = get_pos(other);
981  return length(LVector3(pos));
982 }
983 
984 /**
985  * Sets the color scale component of the transform
986  */
987 INLINE void NodePath::
988 set_color_scale(PN_stdfloat sr, PN_stdfloat sg, PN_stdfloat sb, PN_stdfloat sa, int priority) {
989  set_color_scale(LVecBase4(sr, sg, sb, sa), priority);
990 }
991 
992 /**
993  * Sets the color scale component of the transform
994  */
995 INLINE void NodePath::
996 compose_color_scale(PN_stdfloat sr, PN_stdfloat sg, PN_stdfloat sb, PN_stdfloat sa, int priority) {
997  compose_color_scale(LVecBase4(sr, sg, sb, sa), priority);
998 }
999 
1000 /**
1001  * Sets the red scale component of the transform
1002  */
1003 INLINE void NodePath::
1004 set_sr(PN_stdfloat sr) {
1005  LVecBase4 new_scale = get_color_scale();
1006  new_scale[0] = sr;
1007 
1008  set_color_scale(new_scale);
1009 }
1010 
1011 /**
1012  * Sets the alpha scale component of the transform
1013  */
1014 INLINE void NodePath::
1015 set_sg(PN_stdfloat sg) {
1016  LVecBase4 new_scale = get_color_scale();
1017  new_scale[1] = sg;
1018 
1019  set_color_scale(new_scale);
1020 }
1021 
1022 /**
1023  * Sets the blue scale component of the transform
1024  */
1025 INLINE void NodePath::
1026 set_sb(PN_stdfloat sb) {
1027  LVecBase4 new_scale = get_color_scale();
1028  new_scale[2] = sb;
1029 
1030  set_color_scale(new_scale);
1031 }
1032 
1033 /**
1034  * Sets the alpha scale component of the transform
1035  */
1036 INLINE void NodePath::
1037 set_sa(PN_stdfloat sa) {
1038  LVecBase4 new_scale = get_color_scale();
1039  new_scale[3] = sa;
1040 
1041  set_color_scale(new_scale);
1042 }
1043 
1044 /**
1045  * Gets the red scale component of the transform
1046  */
1047 INLINE PN_stdfloat NodePath::
1048 get_sr() const {
1049  return get_color_scale()[0];
1050 }
1051 
1052 /**
1053  * Gets the green scale component of the transform
1054  */
1055 INLINE PN_stdfloat NodePath::
1056 get_sg() const {
1057  return get_color_scale()[1];
1058 }
1059 
1060 /**
1061  * Gets the blue scale component of the transform
1062  */
1063 INLINE PN_stdfloat NodePath::
1064 get_sb() const {
1065  return get_color_scale()[2];
1066 }
1067 
1068 /**
1069  * Gets the alpha scale component of the transform
1070  */
1071 INLINE PN_stdfloat NodePath::
1072 get_sa() const {
1073  return get_color_scale()[3];
1074 }
1075 
1076 /**
1077  *
1078  */
1079 INLINE void NodePath::
1080 set_shader_input(CPT_InternalName id, const PTA_float &v, int priority) {
1081  set_shader_input(ShaderInput(std::move(id), v, priority));
1082 }
1083 
1084 /**
1085  *
1086  */
1087 INLINE void NodePath::
1088 set_shader_input(CPT_InternalName id, const PTA_double &v, int priority) {
1089  set_shader_input(ShaderInput(std::move(id), v, priority));
1090 }
1091 
1092 /**
1093  *
1094  */
1095 INLINE void NodePath::
1096 set_shader_input(CPT_InternalName id, const PTA_int &v, int priority) {
1097  set_shader_input(ShaderInput(std::move(id), v, priority));
1098 }
1099 
1100 /**
1101  *
1102  */
1103 INLINE void NodePath::
1104 set_shader_input(CPT_InternalName id, const PTA_LVecBase4 &v, int priority) {
1105  set_shader_input(ShaderInput(std::move(id), v, priority));
1106 }
1107 
1108 /**
1109  *
1110  */
1111 INLINE void NodePath::
1112 set_shader_input(CPT_InternalName id, const PTA_LVecBase3 &v, int priority) {
1113  set_shader_input(ShaderInput(std::move(id), v, priority));
1114 }
1115 
1116 
1117 /**
1118  *
1119  */
1120 INLINE void NodePath::
1121 set_shader_input(CPT_InternalName id, const PTA_LVecBase2 &v, int priority) {
1122  set_shader_input(ShaderInput(std::move(id), v, priority));
1123 }
1124 
1125 /**
1126  *
1127  */
1128 INLINE void NodePath::
1129 set_shader_input(CPT_InternalName id, const LVecBase4 &v, int priority) {
1130  set_shader_input(ShaderInput(std::move(id), v, priority));
1131 }
1132 
1133 /**
1134  *
1135  */
1136 INLINE void NodePath::
1137 set_shader_input(CPT_InternalName id, const LVecBase3 &v, int priority) {
1138  set_shader_input(ShaderInput(std::move(id), v, priority));
1139 }
1140 
1141 /**
1142  *
1143  */
1144 INLINE void NodePath::
1145 set_shader_input(CPT_InternalName id, const LVecBase2 &v, int priority) {
1146  set_shader_input(ShaderInput(std::move(id), v, priority));
1147 }
1148 
1149 /**
1150  *
1151  */
1152 INLINE void NodePath::
1153 set_shader_input(CPT_InternalName id, const PTA_LVecBase4i &v, int priority) {
1154  set_shader_input(ShaderInput(std::move(id), v, priority));
1155 }
1156 
1157 /**
1158  *
1159  */
1160 INLINE void NodePath::
1161 set_shader_input(CPT_InternalName id, const PTA_LVecBase3i &v, int priority) {
1162  set_shader_input(ShaderInput(std::move(id), v, priority));
1163 }
1164 
1165 
1166 /**
1167  *
1168  */
1169 INLINE void NodePath::
1170 set_shader_input(CPT_InternalName id, const PTA_LVecBase2i &v, int priority) {
1171  set_shader_input(ShaderInput(std::move(id), v, priority));
1172 }
1173 
1174 /**
1175  *
1176  */
1177 INLINE void NodePath::
1178 set_shader_input(CPT_InternalName id, const LVecBase4i &v, int priority) {
1179  set_shader_input(ShaderInput(std::move(id), v, priority));
1180 }
1181 
1182 /**
1183  *
1184  */
1185 INLINE void NodePath::
1186 set_shader_input(CPT_InternalName id, const LVecBase3i &v, int priority) {
1187  set_shader_input(ShaderInput(std::move(id), v, priority));
1188 }
1189 
1190 /**
1191  *
1192  */
1193 INLINE void NodePath::
1194 set_shader_input(CPT_InternalName id, const LVecBase2i &v, int priority) {
1195  set_shader_input(ShaderInput(std::move(id), v, priority));
1196 }
1197 
1198 /**
1199  *
1200  */
1201 INLINE void NodePath::
1202 set_shader_input(CPT_InternalName id, const PTA_LMatrix4 &v, int priority) {
1203  set_shader_input(ShaderInput(std::move(id), v, priority));
1204 }
1205 
1206 /**
1207  *
1208  */
1209 INLINE void NodePath::
1210 set_shader_input(CPT_InternalName id, const PTA_LMatrix3 &v, int priority) {
1211  set_shader_input(ShaderInput(std::move(id), v, priority));
1212 }
1213 
1214 /**
1215  *
1216  */
1217 INLINE void NodePath::
1218 set_shader_input(CPT_InternalName id, const LMatrix4 &v, int priority) {
1219  set_shader_input(ShaderInput(std::move(id), v, priority));
1220 }
1221 
1222 /**
1223  *
1224  */
1225 INLINE void NodePath::
1226 set_shader_input(CPT_InternalName id, const LMatrix3 &v, int priority) {
1227  set_shader_input(ShaderInput(std::move(id), v, priority));
1228 }
1229 
1230 /**
1231  *
1232  */
1233 INLINE void NodePath::
1234 set_shader_input(CPT_InternalName id, Texture *tex, int priority) {
1235  set_shader_input(ShaderInput(std::move(id), tex, priority));
1236 }
1237 
1238 /**
1239  *
1240  */
1241 INLINE void NodePath::
1242 set_shader_input(CPT_InternalName id, Texture *tex, const SamplerState &sampler, int priority) {
1243  set_shader_input(ShaderInput(std::move(id), tex, sampler, priority));
1244 }
1245 
1246 /**
1247  *
1248  */
1249 INLINE void NodePath::
1250 set_shader_input(CPT_InternalName id, Texture *tex, bool read, bool write, int z, int n, int priority) {
1251  set_shader_input(ShaderInput(std::move(id), tex, read, write, z, n, priority));
1252 }
1253 
1254 /**
1255  *
1256  */
1257 INLINE void NodePath::
1258 set_shader_input(CPT_InternalName id, ShaderBuffer *buf, int priority) {
1259  set_shader_input(ShaderInput(std::move(id), buf, priority));
1260 }
1261 
1262 /**
1263  *
1264  */
1265 INLINE void NodePath::
1266 set_shader_input(CPT_InternalName id, const NodePath &np, int priority) {
1267  set_shader_input(ShaderInput(std::move(id), np, priority));
1268 }
1269 
1270 /**
1271  *
1272  */
1273 INLINE void NodePath::
1274 set_shader_input(CPT_InternalName id, int n1, int n2, int n3, int n4, int priority) {
1275  set_shader_input(ShaderInput(std::move(id), LVecBase4i(n1, n2, n3, n4), priority));
1276 }
1277 
1278 /**
1279  *
1280  */
1281 INLINE void NodePath::
1282 set_shader_input(CPT_InternalName id, PN_stdfloat n1, PN_stdfloat n2, PN_stdfloat n3, PN_stdfloat n4, int priority) {
1283  set_shader_input(ShaderInput(std::move(id), LVecBase4(n1, n2, n3, n4), priority));
1284 }
1285 
1286 /**
1287  * Sets a texture matrix on the current node to apply the indicated offset to
1288  * UV's for the given stage.
1289  *
1290  * This call is appropriate for ordinary 2-d texture coordinates.
1291  */
1292 INLINE void NodePath::
1293 set_tex_offset(TextureStage *stage, PN_stdfloat u, PN_stdfloat v) {
1294  set_tex_offset(stage, LVecBase2(u, v));
1295 }
1296 
1297 /**
1298  * Sets a texture matrix on the current node to apply the indicated offset to
1299  * UV's for the given stage.
1300  *
1301  * This call is appropriate for ordinary 2-d texture coordinates.
1302  */
1303 INLINE void NodePath::
1304 set_tex_offset(TextureStage *stage, const LVecBase2 &uv) {
1305  nassertv_always(!is_empty());
1306  set_tex_transform(stage,
1307  get_tex_transform(stage)->set_pos2d(uv));
1308 }
1309 
1310 /**
1311  * Sets a texture matrix on the current node to apply the indicated rotation,
1312  * clockwise in degrees, to UV's for the given stage.
1313  *
1314  * This call is appropriate for ordinary 2-d texture coordinates.
1315  */
1316 INLINE void NodePath::
1317 set_tex_rotate(TextureStage *stage, PN_stdfloat r) {
1318  nassertv_always(!is_empty());
1319  set_tex_transform(stage,
1320  get_tex_transform(stage)->set_rotate2d(r));
1321 }
1322 
1323 /**
1324  * Sets a texture matrix on the current node to apply the indicated scale to
1325  * UVW's for the given stage.
1326  *
1327  * This call is appropriate for 2-d or 3-d texture coordinates.
1328  */
1329 INLINE void NodePath::
1330 set_tex_scale(TextureStage *stage, PN_stdfloat scale) {
1331  nassertv_always(!is_empty());
1332  set_tex_transform(stage,
1333  get_tex_transform(stage)->set_scale(scale));
1334 }
1335 
1336 /**
1337  * Sets a texture matrix on the current node to apply the indicated scale to
1338  * UV's for the given stage.
1339  *
1340  * This call is appropriate for ordinary 2-d texture coordinates.
1341  */
1342 INLINE void NodePath::
1343 set_tex_scale(TextureStage *stage, PN_stdfloat su, PN_stdfloat sv) {
1344  set_tex_scale(stage, LVecBase2(su, sv));
1345 }
1346 
1347 /**
1348  * Sets a texture matrix on the current node to apply the indicated scale to
1349  * UV's for the given stage.
1350  *
1351  * This call is appropriate for ordinary 2-d texture coordinates.
1352  */
1353 INLINE void NodePath::
1354 set_tex_scale(TextureStage *stage, const LVecBase2 &scale) {
1355  nassertv_always(!is_empty());
1356  set_tex_transform(stage,
1357  get_tex_transform(stage)->set_scale2d(scale));
1358 }
1359 
1360 /**
1361  * Returns the offset set for the UV's for the given stage on the current
1362  * node.
1363  *
1364  * This call is appropriate for ordinary 2-d texture coordinates.
1365  */
1366 INLINE LVecBase2 NodePath::
1368  nassertr_always(!is_empty(), LVecBase2::zero());
1369  return get_tex_transform(stage)->get_pos2d();
1370 }
1371 
1372 /**
1373  * Returns the rotation set for the UV's for the given stage on the current
1374  * node.
1375  *
1376  * This call is appropriate for ordinary 2-d texture coordinates.
1377  */
1378 INLINE PN_stdfloat NodePath::
1380  nassertr_always(!is_empty(), 0.0f);
1381  return get_tex_transform(stage)->get_rotate2d();
1382 }
1383 
1384 /**
1385  * Returns the scale set for the UV's for the given stage on the current node.
1386  *
1387  * This call is appropriate for ordinary 2-d texture coordinates.
1388  */
1389 INLINE LVecBase2 NodePath::
1391  nassertr_always(!is_empty(), LVecBase2(1.0f, 1.0f));
1392  return get_tex_transform(stage)->get_scale2d();
1393 }
1394 
1395 /**
1396  * Sets a texture matrix on the current node to apply the indicated offset to
1397  * UVW's for the given stage.
1398  *
1399  * This call is appropriate for 3-d texture coordinates.
1400  */
1401 INLINE void NodePath::
1402 set_tex_pos(TextureStage *stage, PN_stdfloat u, PN_stdfloat v, PN_stdfloat w) {
1403  set_tex_pos(stage, LVecBase3(u, v, w));
1404 }
1405 
1406 /**
1407  * Sets a texture matrix on the current node to apply the indicated offset to
1408  * UVW's for the given stage.
1409  *
1410  * This call is appropriate for 3-d texture coordinates.
1411  */
1412 INLINE void NodePath::
1413 set_tex_pos(TextureStage *stage, const LVecBase3 &uvw) {
1414  nassertv_always(!is_empty());
1415  set_tex_transform(stage,
1416  get_tex_transform(stage)->set_pos(uvw));
1417 }
1418 
1419 /**
1420  * Sets a texture matrix on the current node to apply the indicated rotation,
1421  * as a 3-D HPR, to UVW's for the given stage.
1422  *
1423  * This call is appropriate for 3-d texture coordinates.
1424  */
1425 INLINE void NodePath::
1426 set_tex_hpr(TextureStage *stage, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) {
1427  set_tex_hpr(stage, LVecBase3(h, p, r));
1428 }
1429 
1430 /**
1431  * Sets a texture matrix on the current node to apply the indicated rotation,
1432  * as a 3-D HPR, to UVW's for the given stage.
1433  *
1434  * This call is appropriate for 3-d texture coordinates.
1435  */
1436 INLINE void NodePath::
1437 set_tex_hpr(TextureStage *stage, const LVecBase3 &hpr) {
1438  nassertv_always(!is_empty());
1439  set_tex_transform(stage,
1440  get_tex_transform(stage)->set_hpr(hpr));
1441 }
1442 
1443 /**
1444  * Sets a texture matrix on the current node to apply the indicated scale to
1445  * UVW's for the given stage.
1446  *
1447  * This call is appropriate for 3-d texture coordinates.
1448  */
1449 INLINE void NodePath::
1450 set_tex_scale(TextureStage *stage, PN_stdfloat su, PN_stdfloat sv, PN_stdfloat sw) {
1451  set_tex_scale(stage, LVecBase3(su, sv, sw));
1452 }
1453 
1454 /**
1455  * Sets a texture matrix on the current node to apply the indicated scale to
1456  * UVW's for the given stage.
1457  *
1458  * This call is appropriate for 3-d texture coordinates.
1459  */
1460 INLINE void NodePath::
1461 set_tex_scale(TextureStage *stage, const LVecBase3 &scale) {
1462  nassertv_always(!is_empty());
1463  set_tex_transform(stage,
1464  get_tex_transform(stage)->set_scale(scale));
1465 }
1466 
1467 /**
1468  * Returns the offset set for the UVW's for the given stage on the current
1469  * node.
1470  *
1471  * This call is appropriate for 3-d texture coordinates.
1472  */
1473 INLINE LVecBase3 NodePath::
1474 get_tex_pos(TextureStage *stage) const {
1475  nassertr_always(!is_empty(), LVecBase3::zero());
1476  return get_tex_transform(stage)->get_pos();
1477 }
1478 
1479 /**
1480  * Returns the 3-D HPR set for the UVW's for the given stage on the current
1481  * node.
1482  *
1483  * This call is appropriate for 3-d texture coordinates.
1484  */
1485 INLINE LVecBase3 NodePath::
1486 get_tex_hpr(TextureStage *stage) const {
1487  nassertr_always(!is_empty(), LVecBase3::zero());
1488  return get_tex_transform(stage)->get_hpr();
1489 }
1490 
1491 /**
1492  * Returns the scale set for the UVW's for the given stage on the current
1493  * node.
1494  *
1495  * This call is appropriate for 3-d texture coordinates.
1496  */
1497 INLINE LVecBase3 NodePath::
1499  nassertr_always(!is_empty(), LVecBase3(1.0f, 1.0f, 1.0f));
1500  return get_tex_transform(stage)->get_scale();
1501 }
1502 
1503 /**
1504  * Sets a texture matrix on the current node to apply the indicated offset to
1505  * UV's for the given stage.
1506  *
1507  * This call is appropriate for ordinary 2-d texture coordinates.
1508  */
1509 INLINE void NodePath::
1510 set_tex_offset(const NodePath &other, TextureStage *stage, PN_stdfloat u, PN_stdfloat v) {
1511  set_tex_offset(other, stage, LVecBase2(u, v));
1512 }
1513 
1514 /**
1515  * Sets a texture matrix on the current node to apply the indicated offset to
1516  * UV's for the given stage.
1517  *
1518  * This call is appropriate for ordinary 2-d texture coordinates.
1519  */
1520 INLINE void NodePath::
1521 set_tex_offset(const NodePath &other, TextureStage *stage, const LVecBase2 &uv) {
1522  nassertv_always(!is_empty());
1523  set_tex_transform(other, stage,
1524  get_tex_transform(other, stage)->set_pos2d(uv));
1525 }
1526 
1527 /**
1528  * Sets a texture matrix on the current node to apply the indicated rotation,
1529  * clockwise in degrees, to UV's for the given stage.
1530  *
1531  * This call is appropriate for ordinary 2-d texture coordinates.
1532  */
1533 INLINE void NodePath::
1534 set_tex_rotate(const NodePath &other, TextureStage *stage, PN_stdfloat r) {
1535  nassertv_always(!is_empty());
1536  set_tex_transform(other, stage,
1537  get_tex_transform(other, stage)->set_rotate2d(r));
1538 }
1539 
1540 /**
1541  * Sets a texture matrix on the current node to apply the indicated scale to
1542  * UV's for the given stage.
1543  *
1544  * This call is appropriate for 2-d or 3-d texture coordinates.
1545  */
1546 INLINE void NodePath::
1547 set_tex_scale(const NodePath &other, TextureStage *stage, PN_stdfloat scale) {
1548  nassertv_always(!is_empty());
1549  set_tex_transform(other, stage,
1550  get_tex_transform(stage)->set_scale(scale));
1551 }
1552 
1553 /**
1554  * Sets a texture matrix on the current node to apply the indicated scale to
1555  * UV's for the given stage.
1556  *
1557  * This call is appropriate for ordinary 2-d texture coordinates.
1558  */
1559 INLINE void NodePath::
1560 set_tex_scale(const NodePath &other, TextureStage *stage, PN_stdfloat su, PN_stdfloat sv) {
1561  set_tex_scale(other, stage, LVecBase2(su, sv));
1562 }
1563 
1564 /**
1565  * Sets a texture matrix on the current node to apply the indicated scale to
1566  * UV's for the given stage.
1567  *
1568  * This call is appropriate for ordinary 2-d texture coordinates.
1569  */
1570 INLINE void NodePath::
1571 set_tex_scale(const NodePath &other, TextureStage *stage, const LVecBase2 &scale) {
1572  nassertv_always(!is_empty());
1573  set_tex_transform(other, stage,
1574  get_tex_transform(stage)->set_scale2d(scale));
1575 }
1576 
1577 /**
1578  * Returns the offset set for the UV's for the given stage on the current
1579  * node.
1580  *
1581  * This call is appropriate for ordinary 2-d texture coordinates.
1582  */
1583 INLINE LVecBase2 NodePath::
1584 get_tex_offset(const NodePath &other, TextureStage *stage) const {
1585  nassertr_always(!is_empty(), LVecBase2::zero());
1586  return get_tex_transform(other, stage)->get_pos2d();
1587 }
1588 
1589 /**
1590  * Returns the rotation set for the UV's for the given stage on the current
1591  * node.
1592  *
1593  * This call is appropriate for ordinary 2-d texture coordinates.
1594  */
1595 INLINE PN_stdfloat NodePath::
1596 get_tex_rotate(const NodePath &other, TextureStage *stage) const {
1597  nassertr_always(!is_empty(), 0.0f);
1598  return get_tex_transform(other, stage)->get_rotate2d();
1599 }
1600 
1601 /**
1602  * Returns the scale set for the UV's for the given stage on the current node.
1603  *
1604  * This call is appropriate for ordinary 2-d texture coordinates.
1605  */
1606 INLINE LVecBase2 NodePath::
1607 get_tex_scale(const NodePath &other, TextureStage *stage) const {
1608  nassertr_always(!is_empty(), LVecBase2(1.0f, 1.0f));
1609  return get_tex_transform(other, stage)->get_scale2d();
1610 }
1611 
1612 /**
1613  * Sets a texture matrix on the current node to apply the indicated offset to
1614  * UVW's for the given stage.
1615  *
1616  * This call is appropriate for 3-d texture coordinates.
1617  */
1618 INLINE void NodePath::
1619 set_tex_pos(const NodePath &other, TextureStage *stage, PN_stdfloat u, PN_stdfloat v, PN_stdfloat w) {
1620  set_tex_pos(other, stage, LVecBase3(u, v, w));
1621 }
1622 
1623 /**
1624  * Sets a texture matrix on the current node to apply the indicated offset to
1625  * UVW's for the given stage.
1626  *
1627  * This call is appropriate for 3-d texture coordinates.
1628  */
1629 INLINE void NodePath::
1630 set_tex_pos(const NodePath &other, TextureStage *stage, const LVecBase3 &uvw) {
1631  nassertv_always(!is_empty());
1632  set_tex_transform(other, stage,
1633  get_tex_transform(stage)->set_pos(uvw));
1634 }
1635 
1636 /**
1637  * Sets a texture matrix on the current node to apply the indicated rotation,
1638  * as a 3-D HPR, to UVW's for the given stage.
1639  *
1640  * This call is appropriate for 3-d texture coordinates.
1641  */
1642 INLINE void NodePath::
1643 set_tex_hpr(const NodePath &other, TextureStage *stage, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r) {
1644  set_tex_hpr(other, stage, LVecBase3(h, p, r));
1645 }
1646 
1647 /**
1648  * Sets a texture matrix on the current node to apply the indicated rotation,
1649  * as a 3-D HPR, to UVW's for the given stage.
1650  *
1651  * This call is appropriate for 3-d texture coordinates.
1652  */
1653 INLINE void NodePath::
1654 set_tex_hpr(const NodePath &other, TextureStage *stage, const LVecBase3 &hpr) {
1655  nassertv_always(!is_empty());
1656  set_tex_transform(other, stage,
1657  get_tex_transform(stage)->set_hpr(hpr));
1658 }
1659 
1660 /**
1661  * Sets a texture matrix on the current node to apply the indicated scale to
1662  * UVW's for the given stage.
1663  *
1664  * This call is appropriate for 3-d texture coordinates.
1665  */
1666 INLINE void NodePath::
1667 set_tex_scale(const NodePath &other, TextureStage *stage, PN_stdfloat su, PN_stdfloat sv, PN_stdfloat sw) {
1668  set_tex_scale(other, stage, LVecBase3(su, sv, sw));
1669 }
1670 
1671 /**
1672  * Sets a texture matrix on the current node to apply the indicated scale to
1673  * UVW's for the given stage.
1674  *
1675  * This call is appropriate for 3-d texture coordinates.
1676  */
1677 INLINE void NodePath::
1678 set_tex_scale(const NodePath &other, TextureStage *stage, const LVecBase3 &scale) {
1679  nassertv_always(!is_empty());
1680  set_tex_transform(other, stage,
1681  get_tex_transform(stage)->set_scale(scale));
1682 }
1683 
1684 /**
1685  * Returns the offset set for the UVW's for the given stage on the current
1686  * node.
1687  *
1688  * This call is appropriate for 3-d texture coordinates.
1689  */
1690 INLINE LVecBase3 NodePath::
1691 get_tex_pos(const NodePath &other, TextureStage *stage) const {
1692  nassertr_always(!is_empty(), LVecBase3::zero());
1693  return get_tex_transform(stage)->get_pos();
1694 }
1695 
1696 /**
1697  * Returns the 3-D HPR set for the UVW's for the given stage on the current
1698  * node.
1699  *
1700  * This call is appropriate for 3-d texture coordinates.
1701  */
1702 INLINE LVecBase3 NodePath::
1703 get_tex_hpr(const NodePath &other, TextureStage *stage) const {
1704  nassertr_always(!is_empty(), LVecBase3::zero());
1705  return get_tex_transform(stage)->get_hpr();
1706 }
1707 
1708 /**
1709  * Returns the scale set for the UVW's for the given stage on the current
1710  * node.
1711  *
1712  * This call is appropriate for 3-d texture coordinates.
1713  */
1714 INLINE LVecBase3 NodePath::
1715 get_tex_scale_3d(const NodePath &other, TextureStage *stage) const {
1716  nassertr_always(!is_empty(), LVecBase3(1.0f, 1.0f, 1.0f));
1717  return get_tex_transform(stage)->get_scale();
1718 }
1719 
1720 /**
1721  * Undoes the effect of project_texture().
1722  */
1723 INLINE void NodePath::
1725  clear_texture(stage);
1726  clear_tex_gen(stage);
1727  clear_tex_projector(stage);
1728 }
1729 
1730 /**
1731  * Returns true if there are at least some vertices at this node and below
1732  * that use the named texture coordinate set, false otherwise. Pass the empty
1733  * string for the default texture coordinate set.
1734  */
1735 INLINE bool NodePath::
1736 has_texcoord(const std::string &texcoord_name) const {
1737  return has_vertex_column(InternalName::get_texcoord_name(texcoord_name));
1738 }
1739 
1740 /**
1741  * Puts a billboard transition on the node such that it will rotate in two
1742  * dimensions around the up axis.
1743  */
1744 INLINE void NodePath::
1745 set_billboard_axis(PN_stdfloat offset) {
1746  set_billboard_axis(NodePath(), offset);
1747 }
1748 
1749 /**
1750  * Puts a billboard transition on the node such that it will rotate in three
1751  * dimensions about the origin, keeping its up vector oriented to the top of
1752  * the camera.
1753  */
1754 INLINE void NodePath::
1755 set_billboard_point_eye(PN_stdfloat offset, bool fixed_depth) {
1756  set_billboard_point_eye(NodePath(), offset, fixed_depth);
1757 }
1758 
1759 /**
1760  * Puts a billboard transition on the node such that it will rotate in three
1761  * dimensions about the origin, keeping its up vector oriented to the sky.
1762  */
1763 INLINE void NodePath::
1764 set_billboard_point_world(PN_stdfloat offset) {
1766 }
1767 
1768 /**
1769  * Adds the indicated adjustment amount (which may be negative) to the
1770  * priority for all transitions on the referenced node, and for all nodes in
1771  * the subgraph below. This can be used to force these nodes not to be
1772  * overridden by a high-level state change above. If the priority would drop
1773  * below zero, it is set to zero.
1774  */
1775 INLINE void NodePath::
1776 adjust_all_priorities(int adjustment) {
1777  nassertv_always(!is_empty());
1778  r_adjust_all_priorities(node(), adjustment);
1779 }
1780 
1781 /**
1782  * Undoes the effect of a previous hide() on this node: makes the referenced
1783  * node (and the entire subgraph below this node) visible to all cameras.
1784  *
1785  * This will not reveal the node if a parent node has been hidden.
1786  */
1787 INLINE void NodePath::
1788 show() {
1789  nassertv_always(!is_empty());
1790  node()->adjust_draw_mask(DrawMask::all_off(), DrawMask::all_off(), PandaNode::get_overall_bit());
1791 }
1792 
1793 /**
1794  * Makes the referenced node visible just to the cameras whose camera_mask
1795  * shares the indicated bits.
1796  *
1797  * This undoes the effect of a previous hide() call. It will not reveal the
1798  * node if a parent node has been hidden. However, see show_through().
1799  */
1800 INLINE void NodePath::
1801 show(DrawMask camera_mask) {
1802  nassertv_always(!is_empty());
1803  camera_mask &= ~PandaNode::get_overall_bit();
1805 }
1806 
1807 /**
1808  * Makes the referenced node visible just to the cameras whose camera_mask
1809  * shares the indicated bits.
1810  *
1811  * Unlike show(), this will reveal the node even if a parent node has been
1812  * hidden, thus "showing through" a parent's hide().
1813  */
1814 INLINE void NodePath::
1816  nassertv_always(!is_empty());
1817  node()->adjust_draw_mask(PandaNode::get_overall_bit(), DrawMask::all_off(), DrawMask::all_off());
1818 }
1819 
1820 /**
1821  * Makes the referenced node visible just to the cameras whose camera_mask
1822  * shares the indicated bits.
1823  *
1824  * Unlike show(), this will reveal the node even if a parent node has been
1825  * hidden via the one-parameter hide() method, thus "showing through" a
1826  * parent's hide(). (However, it will not show through a parent's hide() call
1827  * if the no-parameter form of hide() was used.)
1828  */
1829 INLINE void NodePath::
1830 show_through(DrawMask camera_mask) {
1831  nassertv_always(!is_empty());
1832  camera_mask &= ~PandaNode::get_overall_bit();
1834 }
1835 
1836 /**
1837  * Makes the referenced node (and the entire subgraph below this node)
1838  * invisible to all cameras. It remains part of the scene graph, its bounding
1839  * volume still contributes to its parent's bounding volume, and it will still
1840  * be involved in collision tests.
1841  */
1842 INLINE void NodePath::
1843 hide() {
1844  nassertv_always(!is_empty());
1845  node()->adjust_draw_mask(DrawMask::all_off(), PandaNode::get_overall_bit(), DrawMask::all_off());
1846 }
1847 
1848 /**
1849  * Makes the referenced node invisible just to the cameras whose camera_mask
1850  * shares the indicated bits.
1851  *
1852  * This will also hide any nodes below this node in the scene graph, including
1853  * those nodes for which show() has been called, but it will not hide
1854  * descendent nodes for which show_through() has been called.
1855  */
1856 INLINE void NodePath::
1857 hide(DrawMask camera_mask) {
1858  nassertv_always(!is_empty());
1859  camera_mask &= ~PandaNode::get_overall_bit();
1861 }
1862 
1863 /**
1864  * Returns true if the referenced node is hidden from the indicated camera(s)
1865  * either directly, or because some ancestor is hidden.
1866  */
1867 INLINE bool NodePath::
1868 is_hidden(DrawMask camera_mask) const {
1869  return !get_hidden_ancestor(camera_mask).is_empty();
1870 }
1871 
1872 /**
1873  * Returns true if the referenced node is stashed either directly, or because
1874  * some ancestor is stashed.
1875  */
1876 INLINE bool NodePath::
1877 is_stashed() const {
1878  return !get_stashed_ancestor().is_empty();
1879 }
1880 
1881 /**
1882  * Returns the union of all of the into_collide_masks for nodes at this level
1883  * and below. This is the same thing as node()->get_net_collide_mask().
1884  *
1885  * If you want to return what the into_collide_mask of this node itself is,
1886  * without regard to its children, use node()->get_into_collide_mask().
1887  */
1888 INLINE CollideMask NodePath::
1890  nassertr_always(!is_empty(), CollideMask::all_off());
1891  return node()->get_net_collide_mask();
1892 }
1893 
1894 /**
1895  * Recursively applies the indicated CollideMask to the into_collide_masks for
1896  * all nodes at this level and below. If node_type is not TypeHandle::none(),
1897  * then only nodes matching (or inheriting from) the indicated PandaNode
1898  * subclass are modified.
1899  *
1900  * The default is to change all bits, but if bits_to_change is not all bits
1901  * on, then only the bits that are set in bits_to_change are modified,
1902  * allowing this call to change only a subset of the bits in the subgraph.
1903  */
1904 INLINE void NodePath::
1905 set_collide_mask(CollideMask new_mask, CollideMask bits_to_change,
1906  TypeHandle node_type) {
1907  nassertv_always(!is_empty());
1908  if (node_type == TypeHandle::none()) {
1909  node_type = PandaNode::get_class_type();
1910  }
1911 
1912  r_set_collide_mask(node(), ~bits_to_change, new_mask & bits_to_change,
1913  node_type);
1914 }
1915 
1916 /**
1917  * Returns true if the two paths are equivalent; that is, if they contain the
1918  * same list of nodes in the same order.
1919  */
1920 INLINE bool NodePath::
1921 operator == (const NodePath &other) const {
1922  return _head == other._head;
1923 }
1924 
1925 /**
1926  * Returns true if the two paths are not equivalent.
1927  */
1928 INLINE bool NodePath::
1929 operator != (const NodePath &other) const {
1930  return _head != other._head;
1931 }
1932 
1933 /**
1934  * Returns true if this NodePath sorts before the other one, false otherwise.
1935  * The sorting order of two nonequivalent NodePaths is consistent but
1936  * undefined, and is useful only for storing NodePaths in a sorted container
1937  * like an STL set.
1938  */
1939 INLINE bool NodePath::
1940 operator < (const NodePath &other) const {
1941  return _head < other._head;
1942 }
1943 
1944 /**
1945  * Returns a number less than zero if this NodePath sorts before the other
1946  * one, greater than zero if it sorts after, or zero if they are equivalent.
1947  *
1948  * Two NodePaths are considered equivalent if they consist of exactly the same
1949  * list of nodes in the same order. Otherwise, they are different; different
1950  * NodePaths will be ranked in a consistent but undefined ordering; the
1951  * ordering is useful only for placing the NodePaths in a sorted container
1952  * like an STL set.
1953  */
1954 INLINE int NodePath::
1955 compare_to(const NodePath &other) const {
1956  // Nowadays, the NodePathComponents at the head are pointerwise equivalent
1957  // if and only if the NodePaths are equivalent. So we only have to compare
1958  // pointers.
1959  if (_head != other._head) {
1960  return _head < other._head ? -1 : 1;
1961  }
1962  return 0;
1963 }
1964 
1965 /**
1966  * Recursively walks through the scene graph at this level and below, looking
1967  * for ModelNodes, and calls model_node->set_preserve_transform(PT_drop_node)
1968  * on each one. This allows a subsequent call to flatten_strong() to
1969  * eliminate all of the ModelNodes.
1970  *
1971  * Returns the number of ModelNodes found.
1972  */
1973 INLINE int NodePath::
1975  nassertr_always(!is_empty(), 0);
1976  return r_clear_model_nodes(node());
1977 }
1978 
1979 /**
1980  * Associates a user-defined value with a user-defined key which is stored on
1981  * the node. This value has no meaning to Panda; but it is stored
1982  * indefinitely on the node until it is requested again.
1983  *
1984  * Each unique key stores a different string value. There is no effective
1985  * limit on the number of different keys that may be stored or on the length
1986  * of any one key's value.
1987  */
1988 INLINE void NodePath::
1989 set_tag(const std::string &key, const std::string &value) {
1990  nassertv_always(!is_empty());
1991  node()->set_tag(key, value);
1992 }
1993 
1994 /**
1995  * Retrieves the user-defined value that was previously set on this node for
1996  * the particular key, if any. If no value has been previously set, returns
1997  * the empty string. See also get_net_tag().
1998  */
1999 INLINE std::string NodePath::
2000 get_tag(const std::string &key) const {
2001  // An empty NodePath quietly returns no tags. This makes get_net_tag()
2002  // easier to implement.
2003  if (is_empty()) {
2004  return std::string();
2005  }
2006  return node()->get_tag(key);
2007 }
2008 
2009 /**
2010  * Fills the given vector up with the list of tags on this PandaNode.
2011  *
2012  * It is the user's responsibility to ensure that the keys vector is empty
2013  * before making this call; otherwise, the new files will be appended to it.
2014  */
2015 INLINE void NodePath::
2016 get_tag_keys(vector_string &keys) const {
2017  nassertv_always(!is_empty());
2018  node()->get_tag_keys(keys);
2019 }
2020 
2021 /**
2022  * Returns true if a value has been defined on this node for the particular
2023  * key (even if that value is the empty string), or false if no value has been
2024  * set. See also has_net_tag().
2025  */
2026 INLINE bool NodePath::
2027 has_tag(const std::string &key) const {
2028  // An empty NodePath quietly has no tags. This makes has_net_tag() easier
2029  // to implement.
2030  if (is_empty()) {
2031  return false;
2032  }
2033  return node()->has_tag(key);
2034 }
2035 
2036 /**
2037  * Removes the value defined for this key on this particular node. After a
2038  * call to clear_tag(), has_tag() will return false for the indicated key.
2039  */
2040 INLINE void NodePath::
2041 clear_tag(const std::string &key) {
2042  nassertv_always(!is_empty());
2043  node()->clear_tag(key);
2044 }
2045 
2046 /**
2047  * Returns the tag value that has been defined on this node, or the nearest
2048  * ancestor node, for the indicated key. If no value has been defined for the
2049  * indicated key on any ancestor node, returns the empty string. See also
2050  * get_tag().
2051  */
2052 INLINE std::string NodePath::
2053 get_net_tag(const std::string &key) const {
2054  return find_net_tag(key).get_tag(key);
2055 }
2056 
2057 /**
2058  * Returns true if the indicated tag value has been defined on this node or on
2059  * any ancestor node, or false otherwise. See also has_tag().
2060  */
2061 INLINE bool NodePath::
2062 has_net_tag(const std::string &key) const {
2063  return !find_net_tag(key).is_empty();
2064 }
2065 
2066 /**
2067  * Lists the tags to the nout stream, one per line. See
2068  * PandaNode::list_tags() for a variant that allows you to specify the output
2069  * stream.
2070  */
2071 INLINE void NodePath::
2072 list_tags() const {
2073  nassertv_always(!is_empty());
2074  node()->list_tags(nout);
2075  nout << "\n";
2076 }
2077 
2078 /**
2079  * Changes the name of the referenced node.
2080  */
2081 INLINE void NodePath::
2082 set_name(const std::string &name) {
2083  nassertv_always(!is_empty());
2084  node()->set_name(name);
2085 }
2086 
2087 /**
2088  * Returns the name of the referenced node.
2089  */
2090 INLINE std::string NodePath::
2091 get_name() const {
2092  nassertr_always(!is_empty(), std::string());
2093  return node()->get_name();
2094 }
2095 
2096 /**
2097  * Converts the NodePath object into a single stream of data using a
2098  * BamWriter, and returns that data as a string string. Returns empty string
2099  * on failure. This is similar to write_bam_stream().
2100  *
2101  * This method is used by __reduce__ to handle streaming of NodePaths to a
2102  * pickle file.
2103  */
2104 INLINE vector_uchar NodePath::
2106  vector_uchar data;
2107  if (!encode_to_bam_stream(data)) {
2108  data.clear();
2109  }
2110  return data;
2111 }
2112 
2113 
2114 INLINE std::ostream &operator << (std::ostream &out, const NodePath &node_path) {
2115  node_path.output(out);
2116  return out;
2117 }
int get_num_children(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of children of the referenced node.
Definition: nodePath.I:328
clear_tag
Removes the value defined for this key on this particular node.
Definition: pandaNode.h:207
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
void adjust_all_priorities(int adjustment)
Adds the indicated adjustment amount (which may be negative) to the priority for all transitions on t...
Definition: nodePath.I:1776
static size_t add_hash(size_t start, const void *key)
Adds the indicated key into a running hash.
Definition: stl_compares.I:110
bool has_vertex_column(const InternalName *name) const
Returns true if there are at least some vertices at this node and below that contain a reference to t...
Definition: nodePath.cxx:3789
NodePath find_net_tag(const std::string &key) const
Returns the lowest ancestor of this node that contains a tag definition with the indicated key,...
Definition: nodePath.cxx:5585
This is a const pointer to an InternalName, and should be used in lieu of a CPT(InternalName) in func...
Definition: internalName.h:193
Indicates a coordinate-system transform on vertices.
set_name
Changes the name of the referenced node.
Definition: nodePath.h:946
void set_hpr_scale(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz)
Sets the rotation and scale components of the transform, leaving translation untouched.
Definition: nodePath.I:737
void show_through()
Makes the referenced node visible just to the cameras whose camera_mask shares the indicated bits.
Definition: nodePath.I:1815
static void set_max_search_depth(int max_search_depth)
Certain operations, such as find() or find_all_matches(), require a traversal of the scene graph to s...
Definition: nodePath.I:171
vector_uchar encode_to_bam_stream() const
Converts the NodePath object into a single stream of data using a BamWriter, and returns that data as...
Definition: nodePath.I:2105
get_net_tag
Returns the tag value that has been defined on this node, or the nearest ancestor node,...
Definition: nodePath.h:923
This is a generic buffer object that lives in graphics memory.
Definition: shaderBuffer.h:33
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:51
void set_pos_hpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r)
Sets the translation and rotation component of the transform, leaving scale untouched.
Definition: nodePath.I:728
bool operator !=(const NodePath &other) const
Returns true if the two paths are not equivalent.
Definition: nodePath.I:1929
NodePath()
This constructs an empty NodePath with no nodes.
Definition: nodePath.I:18
void set_collide_mask(CollideMask new_mask, CollideMask bits_to_change=CollideMask::all_on(), TypeHandle node_type=TypeHandle::none())
Recursively applies the indicated CollideMask to the into_collide_masks for all nodes at this level a...
Definition: nodePath.I:1905
set_state
Sets the complete RenderState that will be applied to all nodes at this level and below.
Definition: pandaNode.h:173
bool is_empty() const
Returns true if the NodePath contains no nodes.
Definition: nodePath.I:188
PN_stdfloat get_sb() const
Gets the blue scale component of the transform.
Definition: nodePath.I:1064
void list_tags(std::ostream &out, const std::string &separator="\n") const
Writes a list of all the tag keys assigned to the node to the indicated stream.
Definition: pandaNode.cxx:1283
const LVecBase4 & get_color_scale() const
Returns the complete color scale vector that has been applied to this node via a previous call to set...
Definition: nodePath.cxx:2174
NodePath get_stashed_ancestor(Thread *current_thread=Thread::get_current_thread()) const
Returns the NodePath at or above the referenced node that is stashed, or an empty NodePath if no ance...
Definition: nodePath.cxx:5167
void get_tag_keys(vector_string &keys) const
Fills the given vector up with the list of tags on this PandaNode.
Definition: pandaNode.cxx:1304
int compare_to(const NodePath &other) const
Returns a number less than zero if this NodePath sorts before the other one, greater than zero if it ...
Definition: nodePath.I:1955
void set_scale(PN_stdfloat scale)
Sets the scale component of the transform, leaving translation and rotation untouched.
Definition: nodePath.I:675
bool is_ancestor_of(const NodePath &other, Thread *current_thread=Thread::get_current_thread()) const
Returns true if the node represented by this NodePath is a parent or other ancestor of the other Node...
Definition: nodePath.I:294
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:71
NodePath get_hidden_ancestor(DrawMask camera_mask=PandaNode::get_overall_bit(), Thread *current_thread=Thread::get_current_thread()) const
Returns the NodePath at or above the referenced node that is hidden to the indicated camera(s),...
Definition: nodePath.cxx:5093
void clear_tex_gen()
Removes the texture coordinate generation mode from all texture stages on this node.
Definition: nodePath.cxx:3585
PN_stdfloat get_distance(const NodePath &other) const
Returns the straight-line distance between this referenced node's coordinate frame's origin,...
Definition: nodePath.I:979
PN_stdfloat get_tex_rotate(TextureStage *stage) const
Returns the rotation set for the UV's for the given stage on the current node.
Definition: nodePath.I:1379
has_net_tag
Returns true if the indicated tag value has been defined on this node or on any ancestor node,...
Definition: nodePath.h:923
const RenderEffects * get_effects() const
Returns the complete RenderEffects that will be applied to this node.
Definition: nodePath.I:539
NodePath get_common_ancestor(const NodePath &other, Thread *current_thread=Thread::get_current_thread()) const
Returns the lowest NodePath that both of these two NodePaths have in common: the first ancestor that ...
Definition: nodePath.I:312
PandaNode * get_top_node(Thread *current_thread=Thread::get_current_thread()) const
Returns the top node of the path, or NULL if the path is empty.
Definition: nodePath.I:215
void set_tag(const std::string &key, const std::string &value)
Associates a user-defined value with a user-defined key which is stored on the node.
Definition: nodePath.I:1989
void compose_color_scale(const LVecBase4 &scale, int priority=0)
multiplies the color scale component of the transform, with previous color scale leaving translation ...
Definition: nodePath.cxx:2050
get_parent
Returns the NodePath to the parent of the referenced node: that is, this NodePath,...
Definition: nodePath.h:244
void adjust_draw_mask(DrawMask show_mask, DrawMask hide_mask, DrawMask clear_mask)
Adjusts the hide/show bits of this particular node.
Definition: pandaNode.cxx:1591
int clear_model_nodes()
Recursively walks through the scene graph at this level and below, looking for ModelNodes,...
Definition: nodePath.I:1974
static BitMask< uint32_t, nbits > all_off()
Returns a BitMask whose bits are all off.
Definition: bitMask.I:43
This is a small container class that can hold any one of the value types that can be passed as input ...
Definition: shaderInput.h:40
This is the base class for a number of special render effects that may be set on scene graph nodes to...
Definition: renderEffect.h:48
PN_stdfloat get_sg() const
Gets the green scale component of the transform.
Definition: nodePath.I:1056
get_pipeline_stage
Returns the Pipeline stage number associated with this thread.
Definition: thread.h:105
void show()
Undoes the effect of a previous hide() on this node: makes the referenced node (and the entire subgra...
Definition: nodePath.I:1788
void get_tag_keys(vector_string &keys) const
Fills the given vector up with the list of tags on this PandaNode.
Definition: nodePath.I:2016
void clear_transform(Thread *current_thread=Thread::get_current_thread())
Sets the transform object on this node to identity.
Definition: nodePath.I:557
void set_tex_scale(TextureStage *stage, PN_stdfloat scale)
Sets a texture matrix on the current node to apply the indicated scale to UVW's for the given stage.
Definition: nodePath.I:1330
bool has_mat() const
Returns true if a non-identity transform matrix has been applied to the referenced node,...
Definition: nodePath.I:766
void reverse_ls() const
Lists the hierarchy at and above the referenced node.
Definition: nodePath.I:419
void clear_effects()
Resets this node to have no render effects.
Definition: nodePath.I:548
void set_transform(const TransformState *transform, Thread *current_thread=Thread::get_current_thread())
Changes the complete transform object on this node.
Definition: nodePath.I:565
set_tag
Associates a user-defined value with a user-defined key which is stored on the node.
Definition: pandaNode.h:207
PandaNode * node() const
Returns the node traversed to so far.
void set_effects(const RenderEffects *effects)
Sets the complete RenderEffects that will be applied this node.
Definition: nodePath.I:530
set_transform
Sets the transform that will be applied to this node and below.
Definition: pandaNode.h:183
bool is_stashed() const
Returns true if the referenced node is stashed either directly, or because some ancestor is stashed.
Definition: nodePath.I:1877
static NodePath any_path(PandaNode *node, Thread *current_thread=Thread::get_current_thread())
Returns a new NodePath that represents any arbitrary path from the root to the indicated node.
Definition: nodePath.I:62
const RenderAttrib * get_attrib(TypeHandle type) const
Returns the render attribute of the indicated type, if it is defined on the node, or NULL if it is no...
Definition: nodePath.I:459
int count_num_descendants() const
Returns the number of nodes at and below this level.
Definition: nodePath.I:350
bool operator==(const NodePath &other) const
Returns true if the two paths are equivalent; that is, if they contain the same list of nodes in the ...
Definition: nodePath.I:1921
int get_key() const
Returns an integer that is guaranteed to be the same for all NodePaths that represent the same node i...
Definition: nodePath.I:245
PN_stdfloat get_sr() const
Gets the red scale component of the transform.
Definition: nodePath.I:1048
CollideMask get_collide_mask() const
Returns the union of all of the into_collide_masks for nodes at this level and below.
Definition: nodePath.I:1889
void output(std::ostream &out) const
Writes a sensible description of the NodePath to the indicated output stream.
Definition: nodePath.cxx:660
void set_sr(PN_stdfloat sr)
Sets the red scale component of the transform.
Definition: nodePath.I:1004
LVecBase3 get_tex_scale_3d(TextureStage *stage) const
Returns the scale set for the UVW's for the given stage on the current node.
Definition: nodePath.I:1498
bool operator<(const NodePath &other) const
Returns true if this NodePath sorts before the other one, false otherwise.
Definition: nodePath.I:1940
bool verify_complete(Thread *current_thread=Thread::get_current_thread()) const
Returns true if all of the nodes described in the NodePath are connected, or false otherwise.
Definition: nodePath.cxx:5239
void heads_up(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Behaves like look_at(), but with a strong preference to keeping the up vector oriented in the indicat...
Definition: nodePath.I:798
void list_tags() const
Lists the tags to the nout stream, one per line.
Definition: nodePath.I:2072
static NodePath fail()
Creates a NodePath with the ET_fail error type set.
Definition: nodePath.I:149
LVecBase2 get_tex_offset(TextureStage *stage) const
Returns the offset set for the UV's for the given stage on the current node.
Definition: nodePath.I:1367
static int get_max_search_depth()
Returns the current setting of the search depth limit.
Definition: nodePath.I:180
set_effects
Sets the complete RenderEffects that will be applied this node.
Definition: pandaNode.h:178
bool has_effect(TypeHandle type) const
Returns true if there is a render effect of the indicated type defined on this node,...
Definition: nodePath.I:510
NodePath attach_new_node(PandaNode *node, int sort=0, Thread *current_thread=Thread::get_current_thread()) const
Attaches a new node, with or without existing parents, to the scene graph below the referenced node o...
Definition: nodePath.cxx:563
LVecBase3 get_tex_pos(TextureStage *stage) const
Returns the offset set for the UVW's for the given stage on the current node.
Definition: nodePath.I:1474
void clear_project_texture(TextureStage *stage)
Undoes the effect of project_texture().
Definition: nodePath.I:1724
void set_tex_offset(TextureStage *stage, PN_stdfloat u, PN_stdfloat v)
Sets a texture matrix on the current node to apply the indicated offset to UV's for the given stage.
Definition: nodePath.I:1293
bool is_singleton(Thread *current_thread=Thread::get_current_thread()) const
Returns true if the NodePath contains exactly one node.
Definition: nodePath.I:196
void set_billboard_point_eye(PN_stdfloat offset=0.0, bool fixed_depth=false)
Puts a billboard transition on the node such that it will rotate in three dimensions about the origin...
Definition: nodePath.I:1755
PN_stdfloat get_sa() const
Gets the alpha scale component of the transform.
Definition: nodePath.I:1072
LVecBase3 get_tex_hpr(TextureStage *stage) const
Returns the 3-D HPR set for the UVW's for the given stage on the current node.
Definition: nodePath.I:1486
bool has_texcoord(const std::string &texcoord_name) const
Returns true if there are at least some vertices at this node and below that use the named texture co...
Definition: nodePath.I:1736
std::string get_tag(const std::string &key) const
Retrieves the user-defined value that was previously set on this node for the particular key,...
Definition: nodePath.I:2000
void set_effect(const RenderEffect *effect)
Adds the indicated render effect to the scene graph on this node.
Definition: pandaNode.cxx:1005
LVecBase3 get_hpr() const
Retrieves the rotation component of the transform.
Definition: nodePath.cxx:1058
void set_fluid_pos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Sets the translation component, without changing the "previous" position, so that the collision syste...
Definition: nodePath.I:627
void set_effect(const RenderEffect *effect)
Adds the indicated render effect to the scene graph on this node.
Definition: nodePath.I:490
CollideMask get_net_collide_mask(Thread *current_thread=Thread::get_current_thread()) const
Returns the union of all into_collide_mask() values set at CollisionNodes at this level and below.
Definition: pandaNode.cxx:1721
void clear_texture()
Completely removes any texture adjustment that may have been set via set_texture() or set_texture_off...
Definition: nodePath.cxx:3002
void set_tex_transform(TextureStage *stage, const TransformState *transform)
Sets the texture matrix on the current node to the indicated transform for the given stage.
Definition: nodePath.cxx:3387
void clear()
Sets this NodePath to the empty NodePath.
Definition: nodePath.I:119
LPoint3 get_pos() const
Retrieves the translation component of the transform.
Definition: nodePath.cxx:992
void set_attrib(const RenderAttrib *attrib, int override=0)
Adds the indicated render attribute to the scene graph on this node.
Definition: pandaNode.cxx:944
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:47
static NodePath removed()
Creates a NodePath with the ET_removed error type set.
Definition: nodePath.I:139
Represents a set of settings that indicate how a texture is sampled.
Definition: samplerState.h:36
bool is_same_graph(const NodePath &other, Thread *current_thread=Thread::get_current_thread()) const
Returns true if the node represented by this NodePath is parented within the same graph as that of th...
Definition: nodePath.I:275
CPT(RenderState) NodePath
Returns the net state on this node from the root.
Definition: nodePath.I:435
void set_billboard_axis(PN_stdfloat offset=0.0)
Puts a billboard transition on the node such that it will rotate in two dimensions around the up axis...
Definition: nodePath.I:1745
void set_shear(PN_stdfloat shxy, PN_stdfloat shxz, PN_stdfloat shyz)
Sets the shear component of the transform, leaving translation, rotation, and scale untouched.
Definition: nodePath.I:704
static NodePath not_found()
Creates a NodePath with the ET_not_found error type set.
Definition: nodePath.I:129
void set_hpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r)
Sets the rotation component of the transform, leaving translation and scale untouched.
Definition: nodePath.I:651
bool has_attrib(TypeHandle type) const
Returns true if there is a render attribute of the indicated type defined on this node,...
Definition: nodePath.I:469
bool is_hidden(DrawMask camera_mask=PandaNode::get_overall_bit()) const
Returns true if the referenced node is hidden from the indicated camera(s) either directly,...
Definition: nodePath.I:1868
PandaNode * node() const
Returns the referenced node of the path.
Definition: nodePath.I:227
void clear_attrib(TypeHandle type)
Removes the render attribute of the given type from this node.
Definition: nodePath.I:480
void set_sa(PN_stdfloat sa)
Sets the alpha scale component of the transform.
Definition: nodePath.I:1037
A thread; that is, a lightweight process.
Definition: thread.h:46
void set_sb(PN_stdfloat sb)
Sets the blue scale component of the transform.
Definition: nodePath.I:1026
void clear_effect(TypeHandle type)
Removes the render effect of the given type from this node.
Definition: nodePath.I:519
LVecBase3 get_scale() const
Retrieves the scale component of the transform.
Definition: nodePath.cxx:1128
LVecBase2 get_tex_scale(TextureStage *stage) const
Returns the scale set for the UV's for the given stage on the current node.
Definition: nodePath.I:1390
NodePath get_top(Thread *current_thread=Thread::get_current_thread()) const
Returns a singleton NodePath that represents the top of the path, or empty NodePath if this path is e...
Definition: nodePath.cxx:209
void set_tex_pos(TextureStage *stage, PN_stdfloat u, PN_stdfloat v, PN_stdfloat w)
Sets a texture matrix on the current node to apply the indicated offset to UVW's for the given stage.
Definition: nodePath.I:1402
void clear_mat()
Completely removes any transform from the referenced node.
Definition: nodePath.I:756
const LMatrix4 & get_mat() const
Returns the transform matrix that has been applied to the referenced node, or the identity matrix if ...
Definition: nodePath.I:776
void set_pos_hpr_scale(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz)
Completely replaces the transform with new translation, rotation, and scale components.
Definition: nodePath.I:746
size_t add_hash(size_t hash) const
Adds the NodePath into the running hash.
Definition: nodePath.I:264
void clear_effect(TypeHandle type)
Removes the render effect of the given type from this node.
Definition: pandaNode.cxx:1022
void set_sg(PN_stdfloat sg)
Sets the alpha scale component of the transform.
Definition: nodePath.I:1015
void set_prev_transform(const TransformState *transform, Thread *current_thread=Thread::get_current_thread())
Sets the transform that represents this node's "previous" position, one frame ago,...
Definition: pandaNode.cxx:1124
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
has_parent
Returns true if the referenced node has a parent; i.e.
Definition: nodePath.h:244
const RenderEffect * get_effect(TypeHandle type) const
Returns the render effect of the indicated type, if it is defined on the node, or NULL if it is not.
Definition: nodePath.I:500
void hide()
Makes the referenced node (and the entire subgraph below this node) invisible to all cameras.
Definition: nodePath.I:1843
void ls() const
Lists the hierarchy at and below the referenced node.
Definition: nodePath.I:399
void set_tex_hpr(TextureStage *stage, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r)
Sets a texture matrix on the current node to apply the indicated rotation, as a 3-D HPR,...
Definition: nodePath.I:1426
Defines the properties of a named stage of the multitexture pipeline.
Definition: textureStage.h:35
LVecBase3 get_shear() const
Retrieves the shear component of the transform.
Definition: nodePath.cxx:1176
void clear_tag(const std::string &key)
Removes the value defined for this key on this particular node.
Definition: nodePath.I:2041
void set_tex_rotate(TextureStage *stage, PN_stdfloat r)
Sets a texture matrix on the current node to apply the indicated rotation, clockwise in degrees,...
Definition: nodePath.I:1317
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:161
void set_state(const RenderState *state, Thread *current_thread=Thread::get_current_thread())
Changes the complete state object on this node.
Definition: nodePath.I:427
This represents a unique collection of RenderEffect objects that correspond to a particular renderabl...
Definition: renderEffects.h:41
NodePath get_child(int n, Thread *current_thread=Thread::get_current_thread()) const
Returns a NodePath representing the nth child of the referenced node.
Definition: nodePath.I:337
bool has_tag(const std::string &key) const
Returns true if a value has been defined on this node for the particular key (even if that value is t...
Definition: nodePath.I:2027
void clear_tex_projector()
Removes the TexProjectorEffect for all stages from this node.
Definition: nodePath.cxx:3706
void set_color_scale(const LVecBase4 &scale, int priority=0)
Sets the color scale component of the transform, leaving translation and rotation untouched.
Definition: nodePath.cxx:2080
void set_billboard_point_world(PN_stdfloat offset=0.0)
Puts a billboard transition on the node such that it will rotate in three dimensions about the origin...
Definition: nodePath.I:1764
This is one component of a NodePath.
void look_at(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Sets the transform on this NodePath so that it rotates to face the indicated point in space.
Definition: nodePath.I:789