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