Panda3D
nodePath.h
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.h
10  * @author drose
11  * @date 2002-02-25
12  * @author fperazzi, PandaSE
13  * @date 2010-04-06
14  * for set_shader_input)
15  * @author weifengh, PandaSE
16  * @date 2010-04-30
17  */
18 
19 #ifndef NODEPATH_H
20 #define NODEPATH_H
21 
22 #include "pandabase.h"
23 
24 #include "pandaNode.h"
25 #include "renderState.h"
26 #include "transformState.h"
27 #include "renderModeAttrib.h"
28 #include "transparencyAttrib.h"
29 #include "logicOpAttrib.h"
30 #include "nodePathComponent.h"
31 #include "pointerTo.h"
32 #include "referenceCount.h"
33 #include "pnotify.h"
34 #include "typedObject.h"
35 #include "pta_float.h"
36 #include "pta_double.h"
37 #include "pta_LMatrix4.h"
38 #include "pta_LMatrix3.h"
39 #include "pta_LVecBase4.h"
40 #include "pta_LVecBase3.h"
41 #include "pta_LVecBase2.h"
42 #include "stl_compares.h"
43 #include "shaderInput.h"
44 #include "textureCollection.h"
45 #include "textureStageCollection.h"
46 
47 class NodePathCollection;
48 class FindApproxPath;
50 class Light;
51 class PolylightNode;
53 class Texture;
54 class TextureStage;
55 class TextureCollection;
57 class Material;
58 class MaterialCollection;
59 class Fog;
60 class GlobPattern;
62 class SamplerState;
63 class Shader;
64 class ShaderBuffer;
65 class ShaderInput;
66 class WeakNodePath;
67 
68 //
69 // A NodePath is the fundamental unit of high-level interaction with the scene
70 // graph. It encapsulates the complete path down to a node from some other
71 // node, usually the root of the scene graph. This is used to resolve
72 // ambiguities associated with instancing.
73 //
74 // NodePath also contains a number of handy high-level methods for common
75 // scene-graph manipulations, such as reparenting, and common state changes,
76 // such as repositioning.
77 //
78 // There are also a number of NodePath methods for finding nodes deep within
79 // the tree by name or by type. These take a path string, which at its
80 // simplest consists of a series of node names separated by slashes, like a
81 // directory pathname.
82 //
83 // Each component of the path string may optionally consist of one of the
84 // following special names, instead of a node name:
85 //
86 // * -- matches exactly one node, with any name.
87 // ** -- matches any sequence of zero or more nodes.
88 // +typename -- matches any node that is or derives from the given type.
89 // -typename -- matches any node that is the given type exactly.
90 // =tag -- matches any node that has the indicated tag.
91 // =tag=value -- matches any node whose tag matches the indicated value.
92 //
93 // Furthermore, a node name may itself contain standard filename globbing
94 // characters, like *, ?, and [a-z], that will be accepted as a partial match.
95 // (In fact, the '*' special name may be seen as just a special case of this.)
96 // The globbing characters may not be used with the typename matches or with
97 // tag matches, but they may be used to match a tag's value in the =tag=value
98 // syntax.
99 //
100 // The special characters "@@", appearing at the beginning of a node name,
101 // indicate a stashed node. Normally, stashed nodes are not returned by a
102 // find (but see the special flags, below), but a stashed node may be found if
103 // it is explicitly named with its leading @@ characters. By extension, "@@*"
104 // may be used to identify any stashed node.
105 //
106 // Examples:
107 //
108 // "room//graph" will look for a node named "graph", which is a child of an
109 // unnamed node, which is a child of a node named "room", which is a child of
110 // the starting path.
111 //
112 // "**/red*" will look for any node anywhere in the tree (below the starting
113 // path) with a name that begins with "red".
114 //
115 // "**/+PartBundleNode/**/head" will look for a node named "head", somewhere
116 // below a PartBundleNode anywhere in the tree.
117 //
118 //
119 // The search is always potentially ambiguous, even if the special wildcard
120 // operators are not used, because there may be multiple nodes in the tree
121 // with the same name. In general, in the case of an ambiguity, the shortest
122 // path is preferred; when a method (such as extend_by) must choose only only
123 // one of several possible paths, it will choose the shortest available; on
124 // the other hand, when a method (such as find_all_matches) is to return all
125 // of the matching paths, it will sort them so that the shortest paths appear
126 // first in the output.
127 //
128 //
129 // Special flags. The entire string may optionally be followed by the ";"
130 // character, followed by one or more of the following special control flags,
131 // with no intervening spaces or punctuation:
132 //
133 // -h Do not return hidden nodes.
134 // +h Do return hidden nodes.
135 // -s Do not return stashed nodes unless explicitly referenced with @@.
136 // +s Return stashed nodes even without any explicit @@ characters.
137 // -i Node name comparisons are not case insensitive: case must match
138 // exactly.
139 // +i Node name comparisons are case insensitive: case is not important.
140 // This affects matches against the node name only; node type and tag
141 // strings are always case sensitive.
142 //
143 // The default flags are +h-s-i.
144 //
145 
146 /**
147  * NodePath is the fundamental system for disambiguating instances, and also
148  * provides a higher-level interface for manipulating the scene graph.
149  *
150  * A NodePath is a list of connected nodes from the root of the graph to any
151  * sub-node. Each NodePath therefore uniquely describes one instance of a
152  * node.
153  *
154  * NodePaths themselves are lightweight objects that may easily be copied and
155  * passed by value. Their data is stored as a series of NodePathComponents
156  * that are stored on the nodes. Holding a NodePath will keep a reference
157  * count to all the nodes in the path. However, if any node in the path is
158  * removed or reparented (perhaps through a different NodePath), the NodePath
159  * will automatically be updated to reflect the changes.
160  */
161 class EXPCL_PANDA_PGRAPH NodePath {
162 PUBLISHED:
163  // This enumeration is returned by get_error_type() for an empty NodePath to
164  // report the reason it's empty.
165  enum ErrorType {
166  ET_ok = 0, // i.e. not empty, or never assigned to anything.
167  ET_not_found, // returned from a failed find() or similar function.
168  ET_removed, // remove_node() was previously called on this NodePath.
169  ET_fail, // general failure return from some function.
170  };
171 
172  INLINE NodePath();
173  INLINE explicit NodePath(const std::string &top_node_name, Thread *current_thread = Thread::get_current_thread());
174  INLINE explicit NodePath(PandaNode *node, Thread *current_thread = Thread::get_current_thread());
175  INLINE static NodePath any_path(PandaNode *node, Thread *current_thread = Thread::get_current_thread());
176  explicit NodePath(const NodePath &parent, PandaNode *child_node,
177  Thread *current_thread = Thread::get_current_thread());
178 
179  INLINE NodePath(const NodePath &copy);
180  INLINE NodePath(NodePath &&from) noexcept;
181 
182  INLINE void operator = (const NodePath &copy);
183  INLINE void operator = (NodePath &&from) noexcept;
184 
185  INLINE void clear();
186 
187  EXTENSION(NodePath __copy__() const);
188  EXTENSION(PyObject *__deepcopy__(PyObject *self, PyObject *memo) const);
189  EXTENSION(PyObject *__reduce__(PyObject *self) const);
190  EXTENSION(PyObject *__reduce_persist__(PyObject *self, PyObject *pickler) const);
191 
192  INLINE static NodePath not_found();
193  INLINE static NodePath removed();
194  INLINE static NodePath fail();
195 
196  INLINE static void set_max_search_depth(int max_search_depth);
197  INLINE static int get_max_search_depth();
198 
199  // Methods to query a NodePath's contents.
200  INLINE bool is_empty() const;
201  operator bool () const;
202 
203  INLINE bool is_singleton(Thread *current_thread = Thread::get_current_thread()) const;
204  int get_num_nodes(Thread *current_thread = Thread::get_current_thread()) const;
205  PandaNode *get_node(int index, Thread *current_thread = Thread::get_current_thread()) const;
206  MAKE_SEQ(get_nodes, get_num_nodes, get_node);
207  MAKE_SEQ_PROPERTY(nodes, get_num_nodes, get_node);
208  NodePath get_ancestor(int index, Thread *current_thread = Thread::get_current_thread()) const;
209  MAKE_SEQ(get_ancestors, get_num_nodes, get_ancestor);
210  MAKE_SEQ_PROPERTY(ancestors, get_num_nodes, get_ancestor);
211 
212  INLINE ErrorType get_error_type() const;
213  MAKE_PROPERTY(error_type, get_error_type);
214 
215  INLINE PandaNode *get_top_node(Thread *current_thread = Thread::get_current_thread()) const;
216  NodePath get_top(Thread *current_thread = Thread::get_current_thread()) const;
217 
218  INLINE PandaNode *node() const;
219 
220  INLINE int get_key() const;
221  INLINE size_t add_hash(size_t hash) const;
222 
223  INLINE bool is_same_graph(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const;
224  INLINE bool is_ancestor_of(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const;
225  INLINE NodePath get_common_ancestor(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const;
226 
227  // Methods that return collections of NodePaths derived from or related to
228  // this one.
229 
230  NodePathCollection get_children(Thread *current_thread = Thread::get_current_thread()) const;
231  INLINE int get_num_children(Thread *current_thread = Thread::get_current_thread()) const;
232  INLINE NodePath get_child(int n, Thread *current_thread = Thread::get_current_thread()) const;
233  NodePathCollection get_stashed_children(Thread *current_thread = Thread::get_current_thread()) const;
234 
235  MAKE_PROPERTY(children, get_children);
236  MAKE_PROPERTY(stashed_children, get_stashed_children);
237 
238  INLINE int count_num_descendants() const;
239 
240  INLINE bool has_parent(Thread *current_thread = Thread::get_current_thread()) const;
241  INLINE NodePath get_parent(Thread *current_thread = Thread::get_current_thread()) const;
242  int get_sort(Thread *current_thread = Thread::get_current_thread()) const;
243 
244  MAKE_PROPERTY2(parent, has_parent, get_parent);
245  MAKE_PROPERTY(sort, get_sort);
246 
247  NodePath find(const std::string &path) const;
248  NodePath find_path_to(PandaNode *node) const;
249  NodePathCollection find_all_matches(const std::string &path) const;
250  NodePathCollection find_all_paths_to(PandaNode *node) const;
251 
252  // Methods that actually move nodes around in the scene graph. The optional
253  // "sort" parameter can be used to force a particular ordering between
254  // sibling nodes, useful when dealing with LOD's and similar switch nodes.
255  // If the sort value is the same, nodes will be arranged in the order they
256  // were added.
257  void reparent_to(const NodePath &other, int sort = 0,
258  Thread *current_thread = Thread::get_current_thread());
259  void stash_to(const NodePath &other, int sort = 0,
260  Thread *current_thread = Thread::get_current_thread());
261  void wrt_reparent_to(const NodePath &other, int sort = 0,
262  Thread *current_thread = Thread::get_current_thread());
263  NodePath instance_to(const NodePath &other, int sort = 0,
264  Thread *current_thread = Thread::get_current_thread()) const;
265  NodePath instance_under_node(const NodePath &other, const std::string &name,
266  int sort = 0,
267  Thread *current_thread = Thread::get_current_thread()) const;
268  NodePath copy_to(const NodePath &other, int sort = 0,
269  Thread *current_thread = Thread::get_current_thread()) const;
270  NodePath attach_new_node(PandaNode *node, int sort = 0,
271  Thread *current_thread = Thread::get_current_thread()) const;
272  INLINE NodePath attach_new_node(const std::string &name, int sort = 0,
273  Thread *current_thread = Thread::get_current_thread()) const;
274  void remove_node(Thread *current_thread = Thread::get_current_thread());
275  void detach_node(Thread *current_thread = Thread::get_current_thread());
276 
277  // Handy ways to look at what's there, and other miscellaneous operations.
278 
279  void output(std::ostream &out) const;
280 
281  INLINE void ls() const;
282  INLINE void ls(std::ostream &out, int indent_level = 0) const;
283  INLINE void reverse_ls() const;
284  int reverse_ls(std::ostream &out, int indent_level = 0) const;
285 
286  // Aggregate transform and state information.
287  const RenderState *get_state(Thread *current_thread = Thread::get_current_thread()) const;
288  INLINE void set_state(const RenderState *state, Thread *current_thread = Thread::get_current_thread());
289  CPT(RenderState) get_state(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const;
290  void set_state(const NodePath &other, const RenderState *state, Thread *current_thread = Thread::get_current_thread());
291  INLINE CPT(RenderState) get_net_state(Thread *current_thread = Thread::get_current_thread()) const;
292 
293  INLINE void set_attrib(const RenderAttrib *attrib, int priority = 0);
294  INLINE const RenderAttrib *get_attrib(TypeHandle type) const;
295  INLINE bool has_attrib(TypeHandle type) const;
296  INLINE void clear_attrib(TypeHandle type);
297 
298  INLINE void set_effect(const RenderEffect *effect);
299  INLINE const RenderEffect *get_effect(TypeHandle type) const;
300  INLINE bool has_effect(TypeHandle type) const;
301  INLINE void clear_effect(TypeHandle type);
302 
303  INLINE void set_effects(const RenderEffects *effects);
304  INLINE const RenderEffects *get_effects() const;
305  INLINE void clear_effects();
306 
307  const TransformState *get_transform(Thread *current_thread = Thread::get_current_thread()) const;
308  INLINE void clear_transform(Thread *current_thread = Thread::get_current_thread());
309  INLINE void set_transform(const TransformState *transform, Thread *current_thread = Thread::get_current_thread());
310  CPT(TransformState) get_transform(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const;
311  INLINE void clear_transform(const NodePath &other, Thread *current_thread = Thread::get_current_thread());
312  void set_transform(const NodePath &other, const TransformState *transform, Thread *current_thread = Thread::get_current_thread());
313  INLINE CPT(TransformState) get_net_transform(Thread *current_thread = Thread::get_current_thread()) const;
314 
315  const TransformState *get_prev_transform(Thread *current_thread = Thread::get_current_thread()) const;
316  INLINE void set_prev_transform(const TransformState *transform, Thread *current_thread = Thread::get_current_thread());
317  CPT(TransformState) get_prev_transform(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const;
318  void set_prev_transform(const NodePath &other, const TransformState *transform, Thread *current_thread = Thread::get_current_thread());
319  INLINE CPT(TransformState) get_net_prev_transform(Thread *current_thread = Thread::get_current_thread()) const;
320 
321 
322  // Methods that get and set the matrix transform: pos, hpr, scale, in the
323  // local coordinate system.
324 
325  INLINE void set_pos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
326  void set_pos(const LVecBase3 &pos);
327  void set_x(PN_stdfloat x);
328  void set_y(PN_stdfloat y);
329  void set_z(PN_stdfloat z);
330  INLINE void set_fluid_pos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
331  void set_fluid_pos(const LVecBase3 &pos);
332  void set_fluid_x(PN_stdfloat x);
333  void set_fluid_y(PN_stdfloat y);
334  void set_fluid_z(PN_stdfloat z);
335  LPoint3 get_pos() const;
336  INLINE PN_stdfloat get_x() const;
337  INLINE PN_stdfloat get_y() const;
338  INLINE PN_stdfloat get_z() const;
339 
340  LVector3 get_pos_delta() const;
341 
342  INLINE void set_hpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
343  void set_hpr(const LVecBase3 &hpr);
344  void set_h(PN_stdfloat h);
345  void set_p(PN_stdfloat p);
346  void set_r(PN_stdfloat r);
347  LVecBase3 get_hpr() const;
348  INLINE PN_stdfloat get_h() const;
349  INLINE PN_stdfloat get_p() const;
350  INLINE PN_stdfloat get_r() const;
351 
352  void set_quat(const LQuaternion &quat);
353  LQuaternion get_quat() const;
354 
355  INLINE void set_scale(PN_stdfloat scale);
356  INLINE void set_scale(PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz);
357  void set_scale(const LVecBase3 &scale);
358  void set_sx(PN_stdfloat sx);
359  void set_sy(PN_stdfloat sy);
360  void set_sz(PN_stdfloat sz);
361  LVecBase3 get_scale() const;
362  INLINE PN_stdfloat get_sx() const;
363  INLINE PN_stdfloat get_sy() const;
364  INLINE PN_stdfloat get_sz() const;
365 
366  INLINE void set_shear(PN_stdfloat shxy, PN_stdfloat shxz, PN_stdfloat shyz);
367  void set_shear(const LVecBase3 &shear);
368  void set_shxy(PN_stdfloat shxy);
369  void set_shxz(PN_stdfloat shxz);
370  void set_shyz(PN_stdfloat shyz);
371  LVecBase3 get_shear() const;
372  INLINE PN_stdfloat get_shxy() const;
373  INLINE PN_stdfloat get_shxz() const;
374  INLINE PN_stdfloat get_shyz() const;
375 
376  INLINE void set_pos_hpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z,
377  PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
378  void set_pos_hpr(const LVecBase3 &pos,
379  const LVecBase3 &hpr);
380  void set_pos_quat(const LVecBase3 &pos,
381  const LQuaternion &quat);
382 
383  INLINE void set_hpr_scale(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r,
384  PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz);
385  void set_hpr_scale(const LVecBase3 &hpr,
386  const LVecBase3 &scale);
387  void set_quat_scale(const LQuaternion &quat,
388  const LVecBase3 &scale);
389  INLINE void set_pos_hpr_scale(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z,
390  PN_stdfloat h, PN_stdfloat p, PN_stdfloat r,
391  PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz);
392  void set_pos_hpr_scale(const LVecBase3 &pos,
393  const LVecBase3 &hpr,
394  const LVecBase3 &scale);
395  void set_pos_quat_scale(const LVecBase3 &pos,
396  const LQuaternion &quat,
397  const LVecBase3 &scale);
398  void set_pos_hpr_scale_shear(const LVecBase3 &pos,
399  const LVecBase3 &hpr,
400  const LVecBase3 &scale,
401  const LVecBase3 &shear);
402  void set_pos_quat_scale_shear(const LVecBase3 &pos,
403  const LQuaternion &quat,
404  const LVecBase3 &scale,
405  const LVecBase3 &shear);
406 
407  void set_mat(const LMatrix4 &mat);
408  INLINE void clear_mat();
409  INLINE bool has_mat() const;
410  INLINE const LMatrix4 &get_mat() const;
411 
412  INLINE void look_at(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
413  void look_at(const LPoint3 &point, const LVector3 &up = LVector3::up());
414  INLINE void heads_up(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
415  void heads_up(const LPoint3 &point, const LVector3 &up = LVector3::up());
416 
417  // Methods that get and set the matrix transforms relative to some other
418  // node in the scene graph. These perform an implicit wrt().
419 
420  INLINE void set_pos(const NodePath &other, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
421  void set_pos(const NodePath &other, const LVecBase3 &pos);
422  void set_x(const NodePath &other, PN_stdfloat x);
423  void set_y(const NodePath &other, PN_stdfloat y);
424  void set_z(const NodePath &other, PN_stdfloat z);
425  INLINE void set_fluid_pos(const NodePath &other, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
426  void set_fluid_pos(const NodePath &other, const LVecBase3 &pos);
427  void set_fluid_x(const NodePath &other, PN_stdfloat x);
428  void set_fluid_y(const NodePath &other, PN_stdfloat y);
429  void set_fluid_z(const NodePath &other, PN_stdfloat z);
430  LPoint3 get_pos(const NodePath &other) const;
431  INLINE PN_stdfloat get_x(const NodePath &other) const;
432  INLINE PN_stdfloat get_y(const NodePath &other) const;
433  INLINE PN_stdfloat get_z(const NodePath &other) const;
434 
435  LVector3 get_pos_delta(const NodePath &other) const;
436 
437  INLINE void set_hpr(const NodePath &other, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
438  void set_hpr(const NodePath &other, const LVecBase3 &hpr);
439  void set_h(const NodePath &other, PN_stdfloat h);
440  void set_p(const NodePath &other, PN_stdfloat p);
441  void set_r(const NodePath &other, PN_stdfloat r);
442  LVecBase3 get_hpr(const NodePath &other) const;
443  INLINE PN_stdfloat get_h(const NodePath &other) const;
444  INLINE PN_stdfloat get_p(const NodePath &other) const;
445  INLINE PN_stdfloat get_r(const NodePath &other) const;
446 
447  void set_quat(const NodePath &other, const LQuaternion &quat);
448  LQuaternion get_quat(const NodePath &other) const;
449 
450  INLINE void set_scale(const NodePath &other, PN_stdfloat scale);
451  INLINE void set_scale(const NodePath &other, PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz);
452  void set_scale(const NodePath &other, const LVecBase3 &scale);
453  void set_sx(const NodePath &other, PN_stdfloat sx);
454  void set_sy(const NodePath &other, PN_stdfloat sy);
455  void set_sz(const NodePath &other, PN_stdfloat sz);
456  LVecBase3 get_scale(const NodePath &other) const;
457  INLINE PN_stdfloat get_sx(const NodePath &other) const;
458  INLINE PN_stdfloat get_sy(const NodePath &other) const;
459  INLINE PN_stdfloat get_sz(const NodePath &other) const;
460 
461  INLINE void set_shear(const NodePath &other, PN_stdfloat shxy, PN_stdfloat shxz, PN_stdfloat shyz);
462  void set_shear(const NodePath &other, const LVecBase3 &shear);
463  void set_shxy(const NodePath &other, PN_stdfloat shxy);
464  void set_shxz(const NodePath &other, PN_stdfloat shxz);
465  void set_shyz(const NodePath &other, PN_stdfloat shyz);
466  LVecBase3 get_shear(const NodePath &other) const;
467  INLINE PN_stdfloat get_shxy(const NodePath &other) const;
468  INLINE PN_stdfloat get_shxz(const NodePath &other) const;
469  INLINE PN_stdfloat get_shyz(const NodePath &other) const;
470 
471  INLINE void set_pos_hpr(const NodePath &other,
472  PN_stdfloat x, PN_stdfloat y, PN_stdfloat z,
473  PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
474  void set_pos_hpr(const NodePath &other,
475  const LVecBase3 &pos,
476  const LVecBase3 &hpr);
477  void set_pos_quat(const NodePath &other,
478  const LVecBase3 &pos,
479  const LQuaternion &quat);
480  INLINE void set_hpr_scale(const NodePath &other,
481  PN_stdfloat h, PN_stdfloat p, PN_stdfloat r,
482  PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz);
483  void set_hpr_scale(const NodePath &other,
484  const LVecBase3 &hpr,
485  const LVecBase3 &scale);
486  void set_quat_scale(const NodePath &other,
487  const LQuaternion &quat,
488  const LVecBase3 &scale);
489  INLINE void set_pos_hpr_scale(const NodePath &other,
490  PN_stdfloat x, PN_stdfloat y, PN_stdfloat z,
491  PN_stdfloat h, PN_stdfloat p, PN_stdfloat r,
492  PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz);
493  void set_pos_hpr_scale(const NodePath &other,
494  const LVecBase3 &pos,
495  const LVecBase3 &hpr,
496  const LVecBase3 &scale);
497  void set_pos_quat_scale(const NodePath &other,
498  const LVecBase3 &pos,
499  const LQuaternion &quat,
500  const LVecBase3 &scale);
501  void set_pos_hpr_scale_shear(const NodePath &other,
502  const LVecBase3 &pos,
503  const LVecBase3 &hpr,
504  const LVecBase3 &scale,
505  const LVecBase3 &shear);
506  void set_pos_quat_scale_shear(const NodePath &other,
507  const LVecBase3 &pos,
508  const LQuaternion &quat,
509  const LVecBase3 &scale,
510  const LVecBase3 &shear);
511 
512  LMatrix4 get_mat(const NodePath &other) const;
513  void set_mat(const NodePath &other, const LMatrix4 &mat);
514 
515  LPoint3 get_relative_point(const NodePath &other, const LVecBase3 &point) const;
516  LVector3 get_relative_vector(const NodePath &other, const LVecBase3 &vec) const;
517 
518  INLINE void look_at(const NodePath &other,
519  PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
520  void look_at(const NodePath &other,
521  const LPoint3 &point = LPoint3(0.0, 0.0, 0.0),
522  const LVector3 &up = LVector3::up());
523  INLINE void heads_up(const NodePath &other,
524  PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
525  void heads_up(const NodePath &other,
526  const LPoint3 &point = LPoint3(0.0, 0.0, 0.0),
527  const LVector3 &up = LVector3::up());
528 
529  INLINE PN_stdfloat get_distance(const NodePath &other) const;
530 
531 
532  // Methods that affect appearance of geometry: color, texture, etc. These
533  // affect the state at the bottom level only.
534 
535  void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a = 1.0,
536  int priority = 0);
537  void set_color(const LColor &color, int priority = 0);
538  void set_color_off(int priority = 0);
539  void clear_color();
540  bool has_color() const;
541  LColor get_color() const;
542 
543  bool has_color_scale() const;
544  void clear_color_scale();
545  void set_color_scale(const LVecBase4 &scale,
546  int priority = 0);
547  INLINE void set_color_scale(PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz, PN_stdfloat sa,
548  int priority = 0);
549  void compose_color_scale(const LVecBase4 &scale,
550  int priority = 0);
551  INLINE void compose_color_scale(PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz, PN_stdfloat sa,
552  int priority = 0);
553  void set_color_scale_off(int priority = 0);
554 
555  void set_alpha_scale(PN_stdfloat scale, int priority = 0);
556  void set_all_color_scale(PN_stdfloat scale, int priority = 0);
557  INLINE void set_sr(PN_stdfloat sr);
558  INLINE void set_sg(PN_stdfloat sg);
559  INLINE void set_sb(PN_stdfloat sb);
560  INLINE void set_sa(PN_stdfloat sa);
561 
562  const LVecBase4 &get_color_scale() const;
563  INLINE PN_stdfloat get_sr() const;
564  INLINE PN_stdfloat get_sg() const;
565  INLINE PN_stdfloat get_sb() const;
566  INLINE PN_stdfloat get_sa() const;
567 
568  void set_light(const NodePath &light, int priority = 0);
569  void set_light_off(int priority = 0);
570  void set_light_off(const NodePath &light, int priority = 0);
571  void clear_light();
572  void clear_light(const NodePath &light);
573  bool has_light(const NodePath &light) const;
574  bool has_light_off() const;
575  bool has_light_off(const NodePath &light) const;
576 
577  void set_clip_plane(const NodePath &clip_plane, int priority = 0);
578  void set_clip_plane_off(int priority = 0);
579  void set_clip_plane_off(const NodePath &clip_plane, int priority = 0);
580  void clear_clip_plane();
581  void clear_clip_plane(const NodePath &clip_plane);
582  bool has_clip_plane(const NodePath &clip_plane) const;
583  bool has_clip_plane_off() const;
584  bool has_clip_plane_off(const NodePath &clip_plane) const;
585 
586  void set_scissor(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top);
587  void set_scissor(const LPoint3 &a, const LPoint3 &b);
588  void set_scissor(const LPoint3 &a, const LPoint3 &b,
589  const LPoint3 &c, const LPoint3 &d);
590  void set_scissor(const NodePath &other,
591  const LPoint3 &a, const LPoint3 &b);
592  void set_scissor(const NodePath &other,
593  const LPoint3 &a, const LPoint3 &b,
594  const LPoint3 &c, const LPoint3 &d);
595  void clear_scissor();
596  bool has_scissor() const;
597 
598  void set_occluder(const NodePath &occluder);
599  void clear_occluder();
600  void clear_occluder(const NodePath &occluder);
601  bool has_occluder(const NodePath &occluder) const;
602 
603  void set_bin(const std::string &bin_name, int draw_order, int priority = 0);
604  void clear_bin();
605  bool has_bin() const;
606  std::string get_bin_name() const;
607  int get_bin_draw_order() const;
608 
609  void set_texture(Texture *tex, int priority = 0);
610  void set_texture(TextureStage *stage, Texture *tex, int priority = 0);
611  void set_texture(Texture *tex, const SamplerState &sampler, int priority = 0);
612  void set_texture(TextureStage *stage, Texture *tex, const SamplerState &sampler, int priority = 0);
613  void set_texture_off(int priority = 0);
614  void set_texture_off(TextureStage *stage, int priority = 0);
615  void clear_texture();
616  void clear_texture(TextureStage *stage);
617  bool has_texture() const;
618  bool has_texture(TextureStage *stage) const;
619  bool has_texture_off() const;
620  bool has_texture_off(TextureStage *stage) const;
621  Texture *get_texture() const;
622  Texture *get_texture(TextureStage *stage) const;
623  const SamplerState &get_texture_sampler() const;
624  const SamplerState &get_texture_sampler(TextureStage *stage) const;
625 
626  void set_shader(const Shader *sha, int priority = 0);
627  void set_shader_off(int priority = 0);
628  void set_shader_auto(int priority = 0);
629  void set_shader_auto(BitMask32 shader_switch, int priority=0);
630  void clear_shader();
631 
632  void set_shader_input(const ShaderInput &input);
633  void set_shader_input(ShaderInput &&input);
634 
635  INLINE void set_shader_input(CPT_InternalName id, Texture *tex, const SamplerState &sampler, int priority=0);
636  INLINE void set_shader_input(CPT_InternalName id, Texture *tex, bool read, bool write, int z=-1, int n=0, int priority=0);
637 
638 public:
639  INLINE void set_shader_input(CPT_InternalName id, Texture *tex, int priority=0);
640  INLINE void set_shader_input(CPT_InternalName id, ShaderBuffer *buf, int priority=0);
641  INLINE void set_shader_input(CPT_InternalName id, const NodePath &np, int priority=0);
642  INLINE void set_shader_input(CPT_InternalName id, const PTA_float &v, int priority=0);
643  INLINE void set_shader_input(CPT_InternalName id, const PTA_double &v, int priority=0);
644  INLINE void set_shader_input(CPT_InternalName id, const PTA_int &v, int priority=0);
645  INLINE void set_shader_input(CPT_InternalName id, const PTA_LVecBase4 &v, int priority=0);
646  INLINE void set_shader_input(CPT_InternalName id, const PTA_LVecBase3 &v, int priority=0);
647  INLINE void set_shader_input(CPT_InternalName id, const PTA_LVecBase2 &v, int priority=0);
648  INLINE void set_shader_input(CPT_InternalName id, const PTA_LMatrix4 &v, int priority=0);
649  INLINE void set_shader_input(CPT_InternalName id, const PTA_LMatrix3 &v, int priority=0);
650  INLINE void set_shader_input(CPT_InternalName id, const LVecBase4 &v, int priority=0);
651  INLINE void set_shader_input(CPT_InternalName id, const LVecBase3 &v, int priority=0);
652  INLINE void set_shader_input(CPT_InternalName id, const LVecBase2 &v, int priority=0);
653  INLINE void set_shader_input(CPT_InternalName id, const LMatrix4 &v, int priority=0);
654  INLINE void set_shader_input(CPT_InternalName id, const LMatrix3 &v, int priority=0);
655  INLINE void set_shader_input(CPT_InternalName id, const PTA_LVecBase4i &v, int priority=0);
656  INLINE void set_shader_input(CPT_InternalName id, const PTA_LVecBase3i &v, int priority=0);
657  INLINE void set_shader_input(CPT_InternalName id, const PTA_LVecBase2i &v, int priority=0);
658  INLINE void set_shader_input(CPT_InternalName id, const LVecBase4i &v, int priority=0);
659  INLINE void set_shader_input(CPT_InternalName id, const LVecBase3i &v, int priority=0);
660  INLINE void set_shader_input(CPT_InternalName id, const LVecBase2i &v, int priority=0);
661 PUBLISHED:
662  INLINE void set_shader_input(CPT_InternalName id, int n1, int n2, int n3=0,
663  int n4=0, int priority=0);
664  INLINE void set_shader_input(CPT_InternalName id, PN_stdfloat n1, PN_stdfloat n2,
665  PN_stdfloat n3=0, PN_stdfloat n4=0, int priority=0);
666 
667  EXTENSION(void set_shader_input(CPT_InternalName, PyObject *, int priority=0));
668  EXTENSION(void set_shader_inputs(PyObject *args, PyObject *kwargs));
669 
670  void clear_shader_input(CPT_InternalName id);
671  void set_instance_count(int instance_count);
672 
673  const Shader *get_shader() const;
674  ShaderInput get_shader_input(CPT_InternalName id) const;
675  int get_instance_count() const;
676 
677  void set_tex_transform(TextureStage *stage, const TransformState *transform);
678  void clear_tex_transform();
679  void clear_tex_transform(TextureStage *stage);
680  bool has_tex_transform(TextureStage *stage) const;
681  CPT(TransformState) get_tex_transform(TextureStage *stage) const;
682 
683  INLINE void set_tex_offset(TextureStage *stage, PN_stdfloat u, PN_stdfloat v);
684  INLINE void set_tex_offset(TextureStage *stage, const LVecBase2 &uv);
685  INLINE void set_tex_rotate(TextureStage *stage, PN_stdfloat r);
686  INLINE void set_tex_scale(TextureStage *stage, PN_stdfloat scale);
687  INLINE void set_tex_scale(TextureStage *stage, PN_stdfloat su, PN_stdfloat sv);
688  INLINE void set_tex_scale(TextureStage *stage, const LVecBase2 &scale);
689  INLINE LVecBase2 get_tex_offset(TextureStage *stage) const;
690  INLINE PN_stdfloat get_tex_rotate(TextureStage *stage) const;
691  INLINE LVecBase2 get_tex_scale(TextureStage *stage) const;
692 
693  INLINE void set_tex_pos(TextureStage *stage, PN_stdfloat u, PN_stdfloat v, PN_stdfloat w);
694  INLINE void set_tex_pos(TextureStage *stage, const LVecBase3 &uvw);
695  INLINE void set_tex_hpr(TextureStage *stage, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
696  INLINE void set_tex_hpr(TextureStage *stage, const LVecBase3 &hpr);
697  INLINE void set_tex_scale(TextureStage *stage, PN_stdfloat su, PN_stdfloat sv, PN_stdfloat sw);
698  INLINE void set_tex_scale(TextureStage *stage, const LVecBase3 &scale);
699  INLINE LVecBase3 get_tex_pos(TextureStage *stage) const;
700  INLINE LVecBase3 get_tex_hpr(TextureStage *stage) const;
701  INLINE LVecBase3 get_tex_scale_3d(TextureStage *stage) const;
702 
703  void set_tex_transform(const NodePath &other, TextureStage *stage, const TransformState *transform);
704  CPT(TransformState) get_tex_transform(const NodePath &other, TextureStage *stage) const;
705 
706  INLINE void set_tex_offset(const NodePath &other, TextureStage *stage, PN_stdfloat u, PN_stdfloat v);
707  INLINE void set_tex_offset(const NodePath &other, TextureStage *stage, const LVecBase2 &uv);
708  INLINE void set_tex_rotate(const NodePath &other, TextureStage *stage, PN_stdfloat r);
709  INLINE void set_tex_scale(const NodePath &other, TextureStage *stage, PN_stdfloat scale);
710  INLINE void set_tex_scale(const NodePath &other, TextureStage *stage, PN_stdfloat su, PN_stdfloat sv);
711  INLINE void set_tex_scale(const NodePath &other, TextureStage *stage, const LVecBase2 &scale);
712  INLINE LVecBase2 get_tex_offset(const NodePath &other, TextureStage *stage) const;
713  INLINE PN_stdfloat get_tex_rotate(const NodePath &other, TextureStage *stage) const;
714  INLINE LVecBase2 get_tex_scale(const NodePath &other, TextureStage *stage) const;
715 
716  INLINE void set_tex_pos(const NodePath &other, TextureStage *stage, PN_stdfloat u, PN_stdfloat v, PN_stdfloat w);
717  INLINE void set_tex_pos(const NodePath &other, TextureStage *stage, const LVecBase3 &uvw);
718  INLINE void set_tex_hpr(const NodePath &other, TextureStage *stage, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r);
719  INLINE void set_tex_hpr(const NodePath &other, TextureStage *stage, const LVecBase3 &hpr);
720  INLINE void set_tex_scale(const NodePath &other, TextureStage *stage, PN_stdfloat su, PN_stdfloat sv, PN_stdfloat sw);
721  INLINE void set_tex_scale(const NodePath &other, TextureStage *stage, const LVecBase3 &scale);
722  INLINE LVecBase3 get_tex_pos(const NodePath &other, TextureStage *stage) const;
723  INLINE LVecBase3 get_tex_hpr(const NodePath &other, TextureStage *stage) const;
724  INLINE LVecBase3 get_tex_scale_3d(const NodePath &other, TextureStage *stage) const;
725 
726  void set_tex_gen(TextureStage *stage, RenderAttrib::TexGenMode mode, int priority = 0);
727  void set_tex_gen(TextureStage *stage, RenderAttrib::TexGenMode mode,
728  const LTexCoord3 &constant_value,
729  int priority = 0);
730  void clear_tex_gen();
731  void clear_tex_gen(TextureStage *stage);
732  bool has_tex_gen(TextureStage *stage) const;
733  RenderAttrib::TexGenMode get_tex_gen(TextureStage *stage) const;
734 
735  void set_tex_projector(TextureStage *stage, const NodePath &from, const NodePath &to,
736  int lens_index = 0);
737  void clear_tex_projector(TextureStage *stage);
738  void clear_tex_projector();
739  bool has_tex_projector(TextureStage *stage) const;
740  NodePath get_tex_projector_from(TextureStage *stage) const;
741  NodePath get_tex_projector_to(TextureStage *stage) const;
742 
743  void project_texture(TextureStage *stage, Texture *tex, const NodePath &projector);
744  INLINE void clear_project_texture(TextureStage *stage);
745 
746  INLINE bool has_texcoord(const std::string &texcoord_name) const;
747  bool has_vertex_column(const InternalName *name) const;
748  InternalNameCollection find_all_vertex_columns() const;
749  InternalNameCollection find_all_vertex_columns(const std::string &name) const;
750  InternalNameCollection find_all_texcoords() const;
751  InternalNameCollection find_all_texcoords(const std::string &name) const;
752 
753  Texture *find_texture(const std::string &name) const;
754  Texture *find_texture(TextureStage *stage) const;
755  TextureCollection find_all_textures() const;
756  TextureCollection find_all_textures(const std::string &name) const;
757  TextureCollection find_all_textures(TextureStage *stage) const;
758 
759  TextureStage *find_texture_stage(const std::string &name) const;
760  TextureStageCollection find_all_texture_stages() const;
761  TextureStageCollection find_all_texture_stages(const std::string &name) const;
762 
763  void unify_texture_stages(TextureStage *stage);
764 
765  Material *find_material(const std::string &name) const;
766  MaterialCollection find_all_materials() const;
767  MaterialCollection find_all_materials(const std::string &name) const;
768 
769  void set_material(Material *tex, int priority = 0);
770  void set_material_off(int priority = 0);
771  void clear_material();
772  bool has_material() const;
773  PT(Material) get_material() const;
774  void replace_material(Material *mat, Material *new_mat);
775 
776  void set_fog(Fog *fog, int priority = 0);
777  void set_fog_off(int priority = 0);
778  void clear_fog();
779  bool has_fog() const;
780  bool has_fog_off() const;
781  Fog *get_fog() const;
782 
783  void set_render_mode_wireframe(int priority = 0);
784  void set_render_mode_filled(int priority = 0);
785  void set_render_mode_filled_wireframe(const LColor &wireframe_color, int priority = 0);
786  void set_render_mode_thickness(PN_stdfloat thickness, int priority = 0);
787  void set_render_mode_perspective(bool perspective, int priority = 0);
788  void set_render_mode(RenderModeAttrib::Mode mode, PN_stdfloat thickness, int priority = 0);
789  void clear_render_mode();
790  bool has_render_mode() const;
791  RenderModeAttrib::Mode get_render_mode() const;
792  PN_stdfloat get_render_mode_thickness() const;
793  bool get_render_mode_perspective() const;
794 
795  void set_two_sided(bool two_sided, int priority = 0);
796  void clear_two_sided();
797  bool has_two_sided() const;
798  bool get_two_sided() const;
799 
800  void set_depth_test(bool depth_test, int priority = 0);
801  void clear_depth_test();
802  bool has_depth_test() const;
803  bool get_depth_test() const;
804 
805  void set_depth_write(bool depth_write, int priority = 0);
806  void clear_depth_write();
807  bool has_depth_write() const;
808  bool get_depth_write() const;
809 
810  void set_depth_offset(int bias, int priority = 0);
811  void clear_depth_offset();
812  bool has_depth_offset() const;
813  int get_depth_offset() const;
814 
815  void do_billboard_axis(const NodePath &camera, PN_stdfloat offset);
816  void do_billboard_point_eye(const NodePath &camera, PN_stdfloat offset);
817  void do_billboard_point_world(const NodePath &camera, PN_stdfloat offset);
818  INLINE void set_billboard_axis(PN_stdfloat offset = 0.0);
819  INLINE void set_billboard_point_eye(PN_stdfloat offset = 0.0, bool fixed_depth = false);
820  INLINE void set_billboard_point_world(PN_stdfloat offset = 0.0);
821  void set_billboard_axis(const NodePath &camera, PN_stdfloat offset);
822  void set_billboard_point_eye(const NodePath &camera, PN_stdfloat offset, bool fixed_depth = false);
823  void set_billboard_point_world(const NodePath &camera, PN_stdfloat offset);
824  void clear_billboard();
825  bool has_billboard() const;
826 
827  void set_compass(const NodePath &reference = NodePath());
828  void clear_compass();
829  bool has_compass() const;
830 
831  void set_transparency(TransparencyAttrib::Mode mode, int priority = 0);
832  void clear_transparency();
833  bool has_transparency() const;
834  TransparencyAttrib::Mode get_transparency() const;
835 
836  void set_logic_op(LogicOpAttrib::Operation op, int priority = 0);
837  void clear_logic_op();
838  bool has_logic_op() const;
839  LogicOpAttrib::Operation get_logic_op() const;
840 
841  void set_antialias(unsigned short mode, int priority = 0);
842  void clear_antialias();
843  bool has_antialias() const;
844  unsigned short get_antialias() const;
845 
846  bool has_audio_volume() const;
847  void clear_audio_volume();
848  void set_audio_volume(PN_stdfloat volume,
849  int priority = 0);
850  void set_audio_volume_off(int priority = 0);
851  PN_stdfloat get_audio_volume() const;
852  PN_stdfloat get_net_audio_volume() const;
853 
854  INLINE void adjust_all_priorities(int adjustment);
855 
856  // Variants on show and hide
857  INLINE void show();
858  INLINE void show(DrawMask camera_mask);
859  INLINE void show_through();
860  INLINE void show_through(DrawMask camera_mask);
861  INLINE void hide();
862  INLINE void hide(DrawMask camera_mask);
863  INLINE bool is_hidden(DrawMask camera_mask = PandaNode::get_overall_bit()) const;
864  NodePath get_hidden_ancestor(DrawMask camera_mask = PandaNode::get_overall_bit(),
865  Thread *current_thread = Thread::get_current_thread()) const;
866 
867  void stash(int sort = 0, Thread *current_thread = Thread::get_current_thread());
868  void unstash(int sort = 0, Thread *current_thread = Thread::get_current_thread());
869  void unstash_all(Thread *current_thread = Thread::get_current_thread());
870  INLINE bool is_stashed() const;
871  NodePath get_stashed_ancestor(Thread *current_thread = Thread::get_current_thread()) const;
872 
873  INLINE CollideMask get_collide_mask() const;
874  INLINE void set_collide_mask(CollideMask new_mask, CollideMask bits_to_change = CollideMask::all_on(),
875  TypeHandle node_type = TypeHandle::none());
876 
877  // Comparison methods
878  INLINE bool operator == (const NodePath &other) const;
879  INLINE bool operator != (const NodePath &other) const;
880  INLINE bool operator < (const NodePath &other) const;
881  INLINE int compare_to(const NodePath &other) const;
882 
883  bool operator == (const WeakNodePath &other) const;
884  bool operator != (const WeakNodePath &other) const;
885  bool operator < (const WeakNodePath &other) const;
886  int compare_to(const WeakNodePath &other) const;
887 
888  // Miscellaneous
889  bool verify_complete(Thread *current_thread = Thread::get_current_thread()) const;
890 
891  void premunge_scene(GraphicsStateGuardianBase *gsg = nullptr);
892  void prepare_scene(GraphicsStateGuardianBase *gsg);
893 
894  void show_bounds();
895  void show_tight_bounds();
896  void hide_bounds();
897  PT(BoundingVolume) get_bounds(Thread *current_thread = Thread::get_current_thread()) const;
898  void force_recompute_bounds();
899  void write_bounds(std::ostream &out) const;
900  bool calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point,
901  const NodePath &other = NodePath(),
902  Thread *current_thread = Thread::get_current_thread()) const;
903 
904  EXTENSION(PyObject *get_tight_bounds(const NodePath &other = NodePath()) const);
905 
906  // void analyze() const;
907 
908  int flatten_light();
909  int flatten_medium();
910  int flatten_strong();
911  void apply_texture_colors();
912  INLINE int clear_model_nodes();
913 
914  INLINE void set_tag(const std::string &key, const std::string &value);
915  INLINE std::string get_tag(const std::string &key) const;
916  INLINE void get_tag_keys(vector_string &keys) const;
917  INLINE bool has_tag(const std::string &key) const;
918  INLINE void clear_tag(const std::string &key);
919  INLINE std::string get_net_tag(const std::string &key) const;
920  INLINE bool has_net_tag(const std::string &key) const;
921  NodePath find_net_tag(const std::string &key) const;
922 
923  MAKE_MAP_PROPERTY(net_tags, has_net_tag, get_net_tag);
924 
925  EXTENSION(INLINE PyObject *get_tags() const);
926  EXTENSION(INLINE PyObject *get_tag_keys() const);
927  MAKE_PROPERTY(tags, get_tags);
928 
929  EXTENSION(PyObject *get_python_tags());
930  EXTENSION(INLINE void set_python_tag(PyObject *keys, PyObject *value));
931  EXTENSION(INLINE PyObject *get_python_tag(PyObject *keys) const);
932  EXTENSION(INLINE PyObject *get_python_tag_keys() const);
933  EXTENSION(INLINE bool has_python_tag(PyObject *keys) const);
934  EXTENSION(INLINE void clear_python_tag(PyObject *keys));
935  EXTENSION(INLINE PyObject *get_net_python_tag(PyObject *keys) const);
936  EXTENSION(INLINE bool has_net_python_tag(PyObject *keys) const);
937  EXTENSION(NodePath find_net_python_tag(PyObject *keys) const);
938  MAKE_PROPERTY(python_tags, get_python_tags);
939 
940  EXTENSION(int __traverse__(visitproc visit, void *arg));
941 
942  INLINE void list_tags() const;
943 
944  INLINE void set_name(const std::string &name);
945  INLINE std::string get_name() const;
946  MAKE_PROPERTY(name, get_name, set_name);
947 
948  BLOCKING bool write_bam_file(const Filename &filename) const;
949  BLOCKING bool write_bam_stream(std::ostream &out) const;
950 
951  INLINE vector_uchar encode_to_bam_stream() const;
952  bool encode_to_bam_stream(vector_uchar &data, BamWriter *writer = nullptr) const;
953  static NodePath decode_from_bam_stream(vector_uchar data, BamReader *reader = nullptr);
954 
955 private:
956  static NodePathComponent *
957  find_common_ancestor(const NodePath &a, const NodePath &b,
958  int &a_count, int &b_count,
959  Thread *current_thread);
960 
961  CPT(RenderState) r_get_net_state(NodePathComponent *comp,
962  Thread *current_thread) const;
963  CPT(RenderState) r_get_partial_state(NodePathComponent *comp, int n,
964  Thread *current_thread) const;
965  CPT(TransformState) r_get_net_transform(NodePathComponent *comp,
966  Thread *current_thread) const;
967  CPT(TransformState) r_get_partial_transform(NodePathComponent *comp, int n,
968  Thread *current_thread) const;
969  CPT(TransformState) r_get_net_prev_transform(NodePathComponent *comp,
970  Thread *current_thread) const;
971  CPT(TransformState) r_get_partial_prev_transform(NodePathComponent *comp,
972  int n, Thread *current_thread) const;
973 
974  void find_matches(NodePathCollection &result,
975  const std::string &approx_path_str,
976  int max_matches) const;
977  void find_matches(NodePathCollection &result,
978  FindApproxPath &approx_path,
979  int max_matches) const;
980  void find_matches(NodePathCollection &result,
981  FindApproxLevelEntry *level,
982  int max_matches) const;
983 
984  int r_clear_model_nodes(PandaNode *node);
985  void r_adjust_all_priorities(PandaNode *node, int adjustment);
986 
987  void r_force_recompute_bounds(PandaNode *node);
988 
989  void r_set_collide_mask(PandaNode *node,
990  CollideMask and_mask, CollideMask or_mask,
991  TypeHandle node_type);
992 
993  typedef phash_set<const InternalName *, pointer_hash> InternalNames;
994  bool r_has_vertex_column(PandaNode *node, const InternalName *name) const;
995  void r_find_all_vertex_columns(PandaNode *node,
996  InternalNames &vertex_columns) const;
997 
998  typedef phash_set<Texture *, pointer_hash> Textures;
999  Texture *r_find_texture(PandaNode *node, const RenderState *state,
1000  const GlobPattern &glob) const;
1001  void r_find_all_textures(PandaNode *node, const RenderState *state,
1002  Textures &textures) const;
1003  Texture *r_find_texture(PandaNode *node, TextureStage *stage) const;
1004  void r_find_all_textures(PandaNode *node, TextureStage *stage,
1005  Textures &textures) const;
1006 
1007  typedef phash_set<TextureStage *, pointer_hash> TextureStages;
1008  TextureStage *r_find_texture_stage(PandaNode *node, const RenderState *state,
1009  const GlobPattern &glob) const;
1010  void r_find_all_texture_stages(PandaNode *node, const RenderState *state,
1011  TextureStages &texture_stages) const;
1012 
1013  void r_unify_texture_stages(PandaNode *node, TextureStage *stage);
1014 
1015  typedef phash_set<Material *, pointer_hash> Materials;
1016  Material *r_find_material(PandaNode *node, const RenderState *state,
1017  const GlobPattern &glob) const;
1018  void r_find_all_materials(PandaNode *node, const RenderState *state,
1019  Materials &materials) const;
1020  static void r_replace_material(PandaNode *node, Material *mat,
1021  const MaterialAttrib *new_attrib);
1022 
1023  PT(NodePathComponent) _head;
1024  int _backup_key;
1025  ErrorType _error_type;
1026  static int _max_search_depth;
1027 
1028  static PStatCollector _get_transform_pcollector;
1029  static PStatCollector _verify_complete_pcollector;
1030 
1031 public:
1032  void write_datagram(BamWriter *manager, Datagram &dg) const;
1033  int complete_pointers(TypedWritable **plist, BamReader *manager);
1034  void fillin(DatagramIterator &scan, BamReader *manager);
1035 
1036 public:
1037  static TypeHandle get_class_type() {
1038  return _type_handle;
1039  }
1040  static void init_type() {
1041  register_type(_type_handle, "NodePath");
1042  }
1043 
1044 private:
1045  static TypeHandle _type_handle;
1046 
1047  friend class NodePathCollection;
1048  friend class WorkingNodePath;
1049  friend class WeakNodePath;
1050  friend class CullTraverserData;
1051 };
1052 
1053 INLINE std::ostream &operator << (std::ostream &out, const NodePath &node_path);
1054 
1055 #include "nodePath.I"
1056 
1057 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
The abstract interface to all kinds of lights.
Definition: light.h:38
This is a const pointer to an InternalName, and should be used in lieu of a CPT(InternalName) in func...
Definition: internalName.h:193
Indicates a coordinate-system transform on vertices.
This is a generic buffer object that lives in graphics memory.
Definition: shaderBuffer.h:33
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:51
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
Indicates which, if any, material should be applied to geometry.
This class is local to this package only; it doesn't get exported.
static BitMask< WType, nbits > all_on()
Returns a BitMask whose bits are all on.
Definition: bitMask.I:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:71
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class is local to this package only; it doesn't get exported.
Definition: shader.h:49
This collects together the pieces of data that are accumulated for each node while walking the scene ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
This is a small container class that can hold any one of the value types that can be passed as input ...
Definition: shaderInput.h:40
This is the base class for a number of special render effects that may be set on scene graph nodes to...
Definition: renderEffect.h:48
This is our own Panda specialization on the default STL list.
Definition: plist.h:35
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A table of objects that are saved within the graphics context for reference by handle later.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a class designed to support low-overhead traversals of the complete scene graph,...
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A lightweight class that represents a single element that may be timed and/or counted via stats.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
Specifies how atmospheric fog effects are applied to geometry.
Definition: fog.h:41
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A PolylightNode.
Definition: polylightNode.h:29
Manages a list of Texture objects, as returned by TexturePool::find_all_textures().
This class is a wrapper around a NodePath that, unlike the actual NodePath class, doesn't hold a refe...
Definition: weakNodePath.h:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Defines the way an object appears in the presence of lighting.
Definition: material.h:43
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Encodes a string name in a hash table, mapping it to a pointer.
Definition: internalName.h:38
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:47
Represents a set of settings that indicate how a texture is sampled.
Definition: samplerState.h:36
An STL function object class, this is intended to be used on any ordered collection of class objects ...
Definition: stl_compares.h:73
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A thread; that is, a lightweight process.
Definition: thread.h:46
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Defines the properties of a named stage of the multitexture pipeline.
Definition: textureStage.h:35
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:161
This represents a unique collection of RenderEffect objects that correspond to a particular renderabl...
Definition: renderEffects.h:41
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class can be used to test for string matches against standard Unix- shell filename globbing conv...
Definition: globPattern.h:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is one component of a NodePath.
This is a set of zero or more NodePaths.