Panda3D
|
00001 // Filename: nodePath.h 00002 // Created by: drose (25Feb02) 00003 // Updated by: fperazzi, PandaSE (06Apr10) (added more overloads 00004 // for set_shader_input) 00005 // Updated by: weifengh, PandaSE(30Apr10) 00006 // 00007 //////////////////////////////////////////////////////////////////// 00008 // 00009 // PANDA 3D SOFTWARE 00010 // Copyright (c) Carnegie Mellon University. All rights reserved. 00011 // 00012 // All use of this software is subject to the terms of the revised BSD 00013 // license. You should have received a copy of this license along 00014 // with this source code in a file named "LICENSE." 00015 // 00016 //////////////////////////////////////////////////////////////////// 00017 00018 #ifndef NODEPATH_H 00019 #define NODEPATH_H 00020 00021 #include "pandabase.h" 00022 00023 #include "pandaNode.h" 00024 #include "renderState.h" 00025 #include "transformState.h" 00026 #include "renderModeAttrib.h" 00027 #include "transparencyAttrib.h" 00028 #include "nodePathComponent.h" 00029 #include "pointerTo.h" 00030 #include "referenceCount.h" 00031 #include "pnotify.h" 00032 #include "typedObject.h" 00033 #include "pta_float.h" 00034 #include "pta_double.h" 00035 #include "pta_LMatrix4.h" 00036 #include "pta_LMatrix3.h" 00037 #include "pta_LVecBase4.h" 00038 #include "pta_LVecBase3.h" 00039 #include "pta_LVecBase2.h" 00040 #include "stl_compares.h" 00041 00042 class NodePathCollection; 00043 class FindApproxPath; 00044 class FindApproxLevelEntry; 00045 class Light; 00046 class PolylightNode; 00047 class InternalNameCollection; 00048 class Texture; 00049 class TextureStage; 00050 class TextureCollection; 00051 class TextureStageCollection; 00052 class Material; 00053 class MaterialCollection; 00054 class Fog; 00055 class GlobPattern; 00056 class PreparedGraphicsObjects; 00057 class Shader; 00058 class ShaderInput; 00059 00060 // 00061 // A NodePath is the fundamental unit of high-level interaction with 00062 // the scene graph. It encapsulates the complete path down to a node 00063 // from some other node, usually the root of the scene graph. This is 00064 // used to resolve ambiguities associated with instancing. 00065 // 00066 // NodePath also contains a number of handy high-level methods for 00067 // common scene-graph manipulations, such as reparenting, and common 00068 // state changes, such as repositioning. 00069 // 00070 // There are also a number of NodePath methods for finding nodes deep 00071 // within the tree by name or by type. These take a path string, 00072 // which at its simplest consists of a series of node names separated 00073 // by slashes, like a directory pathname. 00074 // 00075 // Each component of the path string may optionally consist of one of 00076 // the following special names, instead of a node name: 00077 // 00078 // * -- matches exactly one node, with any name. 00079 // ** -- matches any sequence of zero or more nodes. 00080 // +typename -- matches any node that is or derives from the given type. 00081 // -typename -- matches any node that is the given type exactly. 00082 // =tag -- matches any node that has the indicated tag. 00083 // =tag=value -- matches any node whose tag matches the indicated value. 00084 // 00085 // Furthermore, a node name may itself contain standard filename 00086 // globbing characters, like *, ?, and [a-z], that will be accepted as 00087 // a partial match. (In fact, the '*' special name may be seen as 00088 // just a special case of this.) The globbing characters may not be 00089 // used with the typename matches or with tag matches, but they may 00090 // be used to match a tag's value in the =tag=value syntax. 00091 // 00092 // The special characters "@@", appearing at the beginning of a node 00093 // name, indicate a stashed node. Normally, stashed nodes are not 00094 // returned by a find (but see the special flags, below), but a 00095 // stashed node may be found if it is explicitly named with its 00096 // leading @@ characters. By extension, "@@*" may be used to identify 00097 // any stashed node. 00098 // 00099 // Examples: 00100 // 00101 // "room//graph" will look for a node named "graph", which is a child 00102 // of an unnamed node, which is a child of a node named "room", which 00103 // is a child of the starting path. 00104 // 00105 // "**/red*" will look for any node anywhere in the tree (below the 00106 // starting path) with a name that begins with "red". 00107 // 00108 // "**/+PartBundleNode/**/head" will look for a node named "head", 00109 // somewhere below a PartBundleNode anywhere in the tree. 00110 // 00111 // 00112 // The search is always potentially ambiguous, even if the special 00113 // wildcard operators are not used, because there may be multiple 00114 // nodes in the tree with the same name. In general, in the case of 00115 // an ambiguity, the shortest path is preferred; when a method (such 00116 // as extend_by) must choose only only one of several possible paths, 00117 // it will choose the shortest available; on the other hand, when a 00118 // method (such as find_all_matches) is to return all of the matching 00119 // paths, it will sort them so that the shortest paths appear first in 00120 // the output. 00121 // 00122 // 00123 // Special flags. The entire string may optionally be followed by the 00124 // ";" character, followed by one or more of the following special 00125 // control flags, with no intervening spaces or punctuation: 00126 // 00127 // -h Do not return hidden nodes. 00128 // +h Do return hidden nodes. 00129 // -s Do not return stashed nodes unless explicitly referenced with @@. 00130 // +s Return stashed nodes even without any explicit @@ characters. 00131 // -i Node name comparisons are not case insensitive: case must match 00132 // exactly. 00133 // +i Node name comparisons are case insensitive: case is not important. 00134 // This affects matches against the node name only; node type 00135 // and tag strings are always case sensitive. 00136 // 00137 // The default flags are +h-s-i. 00138 // 00139 00140 00141 //////////////////////////////////////////////////////////////////// 00142 // Class : NodePath 00143 // Description : NodePath is the fundamental system for disambiguating 00144 // instances, and also provides a higher-level interface 00145 // for manipulating the scene graph. 00146 // 00147 // A NodePath is a list of connected nodes from the root 00148 // of the graph to any sub-node. Each NodePath 00149 // therefore uniquely describes one instance of a node. 00150 // 00151 // NodePaths themselves are lightweight objects that may 00152 // easily be copied and passed by value. Their data is 00153 // stored as a series of NodePathComponents that are 00154 // stored on the nodes. Holding a NodePath will keep a 00155 // reference count to all the nodes in the path. 00156 // However, if any node in the path is removed or 00157 // reparented (perhaps through a different NodePath), 00158 // the NodePath will automatically be updated to reflect 00159 // the changes. 00160 //////////////////////////////////////////////////////////////////// 00161 class EXPCL_PANDA_PGRAPH NodePath { 00162 PUBLISHED: 00163 // This enumeration is returned by get_error_type() for an empty 00164 // NodePath to report the reason it's empty. 00165 enum ErrorType { 00166 ET_ok = 0, // i.e. not empty, or never assigned to anything. 00167 ET_not_found, // returned from a failed find() or similar function. 00168 ET_removed, // remove_node() was previously called on this NodePath. 00169 ET_fail, // general failure return from some function. 00170 }; 00171 00172 INLINE NodePath(); 00173 INLINE NodePath(const string &top_node_name, Thread *current_thread = Thread::get_current_thread()); 00174 INLINE NodePath(PandaNode *node, Thread *current_thread = Thread::get_current_thread()); 00175 INLINE static NodePath any_path(PandaNode *node, Thread *current_thread = Thread::get_current_thread()); 00176 NodePath(const NodePath &parent, PandaNode *child_node, 00177 Thread *current_thread = Thread::get_current_thread()); 00178 00179 INLINE NodePath(const NodePath ©); 00180 INLINE void operator = (const NodePath ©); 00181 00182 #ifdef HAVE_PYTHON 00183 NodePath __copy__() const; 00184 PyObject *__deepcopy__(PyObject *self, PyObject *memo) const; 00185 PyObject *__reduce__(PyObject *self) const; 00186 PyObject *__reduce_persist__(PyObject *self, PyObject *pickler) const; 00187 #endif 00188 00189 INLINE static NodePath not_found(); 00190 INLINE static NodePath removed(); 00191 INLINE static NodePath fail(); 00192 00193 INLINE static void set_max_search_depth(int max_search_depth); 00194 INLINE static int get_max_search_depth(); 00195 00196 // Methods to query a NodePath's contents. 00197 INLINE bool is_empty() const; 00198 operator bool () const; 00199 00200 INLINE bool is_singleton(Thread *current_thread = Thread::get_current_thread()) const; 00201 int get_num_nodes(Thread *current_thread = Thread::get_current_thread()) const; 00202 PandaNode *get_node(int index, Thread *current_thread = Thread::get_current_thread()) const; 00203 MAKE_SEQ(get_nodes, get_num_nodes, get_node); 00204 NodePath get_ancestor(int index, Thread *current_thread = Thread::get_current_thread()) const; 00205 MAKE_SEQ(get_ancestors, get_num_nodes, get_ancestor); 00206 00207 INLINE ErrorType get_error_type() const; 00208 00209 INLINE PandaNode *get_top_node(Thread *current_thread = Thread::get_current_thread()) const; 00210 NodePath get_top(Thread *current_thread = Thread::get_current_thread()) const; 00211 00212 INLINE PandaNode *node() const; 00213 00214 INLINE int get_key() const; 00215 INLINE size_t add_hash(size_t hash) const; 00216 00217 INLINE bool is_same_graph(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const; 00218 INLINE bool is_ancestor_of(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const; 00219 INLINE NodePath get_common_ancestor(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const; 00220 00221 // Methods that return collections of NodePaths derived from or 00222 // related to this one. 00223 00224 NodePathCollection get_children(Thread *current_thread = Thread::get_current_thread()) const; 00225 INLINE int get_num_children(Thread *current_thread = Thread::get_current_thread()) const; 00226 INLINE NodePath get_child(int n, Thread *current_thread = Thread::get_current_thread()) const; 00227 NodePathCollection get_stashed_children(Thread *current_thread = Thread::get_current_thread()) const; 00228 00229 INLINE int count_num_descendants() const; 00230 00231 INLINE bool has_parent(Thread *current_thread = Thread::get_current_thread()) const; 00232 INLINE NodePath get_parent(Thread *current_thread = Thread::get_current_thread()) const; 00233 int get_sort(Thread *current_thread = Thread::get_current_thread()) const; 00234 00235 NodePath find(const string &path) const; 00236 NodePath find_path_to(PandaNode *node) const; 00237 NodePathCollection find_all_matches(const string &path) const; 00238 NodePathCollection find_all_paths_to(PandaNode *node) const; 00239 00240 // Methods that actually move nodes around in the scene graph. The 00241 // optional "sort" parameter can be used to force a particular 00242 // ordering between sibling nodes, useful when dealing with LOD's 00243 // and similar switch nodes. If the sort value is the same, nodes 00244 // will be arranged in the order they were added. 00245 void reparent_to(const NodePath &other, int sort = 0, 00246 Thread *current_thread = Thread::get_current_thread()); 00247 void stash_to(const NodePath &other, int sort = 0, 00248 Thread *current_thread = Thread::get_current_thread()); 00249 void wrt_reparent_to(const NodePath &other, int sort = 0, 00250 Thread *current_thread = Thread::get_current_thread()); 00251 NodePath instance_to(const NodePath &other, int sort = 0, 00252 Thread *current_thread = Thread::get_current_thread()) const; 00253 NodePath instance_under_node(const NodePath &other, const string &name, 00254 int sort = 0, 00255 Thread *current_thread = Thread::get_current_thread()) const; 00256 NodePath copy_to(const NodePath &other, int sort = 0, 00257 Thread *current_thread = Thread::get_current_thread()) const; 00258 NodePath attach_new_node(PandaNode *node, int sort = 0, 00259 Thread *current_thread = Thread::get_current_thread()) const; 00260 INLINE NodePath attach_new_node(const string &name, int sort = 0, 00261 Thread *current_thread = Thread::get_current_thread()) const; 00262 void remove_node(Thread *current_thread = Thread::get_current_thread()); 00263 void detach_node(Thread *current_thread = Thread::get_current_thread()); 00264 00265 // Handy ways to look at what's there, and other miscellaneous 00266 // operations. 00267 00268 void output(ostream &out) const; 00269 00270 INLINE void ls() const; 00271 INLINE void ls(ostream &out, int indent_level = 0) const; 00272 INLINE void reverse_ls() const; 00273 INLINE int reverse_ls(ostream &out, int indent_level = 0) const; 00274 00275 00276 // Aggregate transform and state information. 00277 const RenderState *get_state(Thread *current_thread = Thread::get_current_thread()) const; 00278 INLINE void set_state(const RenderState *state, Thread *current_thread = Thread::get_current_thread()); 00279 CPT(RenderState) get_state(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const; 00280 void set_state(const NodePath &other, const RenderState *state, Thread *current_thread = Thread::get_current_thread()); 00281 INLINE CPT(RenderState) get_net_state(Thread *current_thread = Thread::get_current_thread()) const; 00282 00283 INLINE void set_attrib(const RenderAttrib *attrib, int priority = 0); 00284 INLINE const RenderAttrib *get_attrib(TypeHandle type) const; 00285 INLINE bool has_attrib(TypeHandle type) const; 00286 INLINE void clear_attrib(TypeHandle type); 00287 00288 INLINE void set_effect(const RenderEffect *effect); 00289 INLINE const RenderEffect *get_effect(TypeHandle type) const; 00290 INLINE bool has_effect(TypeHandle type) const; 00291 INLINE void clear_effect(TypeHandle type); 00292 00293 INLINE void set_effects(const RenderEffects *effects); 00294 INLINE const RenderEffects *get_effects() const; 00295 INLINE void clear_effects(); 00296 00297 const TransformState *get_transform(Thread *current_thread = Thread::get_current_thread()) const; 00298 INLINE void clear_transform(Thread *current_thread = Thread::get_current_thread()); 00299 INLINE void set_transform(const TransformState *transform, Thread *current_thread = Thread::get_current_thread()); 00300 CPT(TransformState) get_transform(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const; 00301 INLINE void clear_transform(const NodePath &other, Thread *current_thread = Thread::get_current_thread()); 00302 void set_transform(const NodePath &other, const TransformState *transform, Thread *current_thread = Thread::get_current_thread()); 00303 INLINE CPT(TransformState) get_net_transform(Thread *current_thread = Thread::get_current_thread()) const; 00304 00305 const TransformState *get_prev_transform(Thread *current_thread = Thread::get_current_thread()) const; 00306 INLINE void set_prev_transform(const TransformState *transform, Thread *current_thread = Thread::get_current_thread()); 00307 CPT(TransformState) get_prev_transform(const NodePath &other, Thread *current_thread = Thread::get_current_thread()) const; 00308 void set_prev_transform(const NodePath &other, const TransformState *transform, Thread *current_thread = Thread::get_current_thread()); 00309 INLINE CPT(TransformState) get_net_prev_transform(Thread *current_thread = Thread::get_current_thread()) const; 00310 00311 00312 // Methods that get and set the matrix transform: pos, hpr, scale, 00313 // in the local coordinate system. 00314 00315 INLINE void set_pos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z); 00316 void set_pos(const LVecBase3 &pos); 00317 void set_x(PN_stdfloat x); 00318 void set_y(PN_stdfloat y); 00319 void set_z(PN_stdfloat z); 00320 INLINE void set_fluid_pos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z); 00321 void set_fluid_pos(const LVecBase3 &pos); 00322 void set_fluid_x(PN_stdfloat x); 00323 void set_fluid_y(PN_stdfloat y); 00324 void set_fluid_z(PN_stdfloat z); 00325 LPoint3 get_pos() const; 00326 INLINE PN_stdfloat get_x() const; 00327 INLINE PN_stdfloat get_y() const; 00328 INLINE PN_stdfloat get_z() const; 00329 00330 LVector3 get_pos_delta() const; 00331 00332 INLINE void set_hpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r); 00333 void set_hpr(const LVecBase3 &hpr); 00334 void set_h(PN_stdfloat h); 00335 void set_p(PN_stdfloat p); 00336 void set_r(PN_stdfloat r); 00337 LVecBase3 get_hpr() const; 00338 INLINE PN_stdfloat get_h() const; 00339 INLINE PN_stdfloat get_p() const; 00340 INLINE PN_stdfloat get_r() const; 00341 00342 void set_quat(const LQuaternion &quat); 00343 LQuaternion get_quat() const; 00344 00345 INLINE void set_scale(PN_stdfloat scale); 00346 INLINE void set_scale(PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz); 00347 void set_scale(const LVecBase3 &scale); 00348 void set_sx(PN_stdfloat sx); 00349 void set_sy(PN_stdfloat sy); 00350 void set_sz(PN_stdfloat sz); 00351 LVecBase3 get_scale() const; 00352 INLINE PN_stdfloat get_sx() const; 00353 INLINE PN_stdfloat get_sy() const; 00354 INLINE PN_stdfloat get_sz() const; 00355 00356 INLINE void set_shear(PN_stdfloat shxy, PN_stdfloat shxz, PN_stdfloat shyz); 00357 void set_shear(const LVecBase3 &shear); 00358 void set_shxy(PN_stdfloat shxy); 00359 void set_shxz(PN_stdfloat shxz); 00360 void set_shyz(PN_stdfloat shyz); 00361 LVecBase3 get_shear() const; 00362 INLINE PN_stdfloat get_shxy() const; 00363 INLINE PN_stdfloat get_shxz() const; 00364 INLINE PN_stdfloat get_shyz() const; 00365 00366 INLINE void set_pos_hpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, 00367 PN_stdfloat h, PN_stdfloat p, PN_stdfloat r); 00368 void set_pos_hpr(const LVecBase3 &pos, 00369 const LVecBase3 &hpr); 00370 void set_pos_quat(const LVecBase3 &pos, 00371 const LQuaternion &quat); 00372 00373 INLINE void set_hpr_scale(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, 00374 PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz); 00375 void set_hpr_scale(const LVecBase3 &hpr, 00376 const LVecBase3 &scale); 00377 void set_quat_scale(const LQuaternion &quat, 00378 const LVecBase3 &scale); 00379 INLINE void set_pos_hpr_scale(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, 00380 PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, 00381 PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz); 00382 void set_pos_hpr_scale(const LVecBase3 &pos, 00383 const LVecBase3 &hpr, 00384 const LVecBase3 &scale); 00385 void set_pos_quat_scale(const LVecBase3 &pos, 00386 const LQuaternion &quat, 00387 const LVecBase3 &scale); 00388 void set_pos_hpr_scale_shear(const LVecBase3 &pos, 00389 const LVecBase3 &hpr, 00390 const LVecBase3 &scale, 00391 const LVecBase3 &shear); 00392 void set_pos_quat_scale_shear(const LVecBase3 &pos, 00393 const LQuaternion &quat, 00394 const LVecBase3 &scale, 00395 const LVecBase3 &shear); 00396 00397 void set_mat(const LMatrix4 &mat); 00398 INLINE void clear_mat(); 00399 INLINE bool has_mat() const; 00400 INLINE const LMatrix4 &get_mat() const; 00401 00402 INLINE void look_at(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z); 00403 void look_at(const LPoint3 &point, const LVector3 &up = LVector3::up()); 00404 INLINE void heads_up(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z); 00405 void heads_up(const LPoint3 &point, const LVector3 &up = LVector3::up()); 00406 00407 // Methods that get and set the matrix transforms relative to some 00408 // other node in the scene graph. These perform an implicit wrt(). 00409 00410 INLINE void set_pos(const NodePath &other, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z); 00411 void set_pos(const NodePath &other, const LVecBase3 &pos); 00412 void set_x(const NodePath &other, PN_stdfloat x); 00413 void set_y(const NodePath &other, PN_stdfloat y); 00414 void set_z(const NodePath &other, PN_stdfloat z); 00415 INLINE void set_fluid_pos(const NodePath &other, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z); 00416 void set_fluid_pos(const NodePath &other, const LVecBase3 &pos); 00417 void set_fluid_x(const NodePath &other, PN_stdfloat x); 00418 void set_fluid_y(const NodePath &other, PN_stdfloat y); 00419 void set_fluid_z(const NodePath &other, PN_stdfloat z); 00420 LPoint3 get_pos(const NodePath &other) const; 00421 INLINE PN_stdfloat get_x(const NodePath &other) const; 00422 INLINE PN_stdfloat get_y(const NodePath &other) const; 00423 INLINE PN_stdfloat get_z(const NodePath &other) const; 00424 00425 LVector3 get_pos_delta(const NodePath &other) const; 00426 00427 INLINE void set_hpr(const NodePath &other, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r); 00428 void set_hpr(const NodePath &other, const LVecBase3 &hpr); 00429 void set_h(const NodePath &other, PN_stdfloat h); 00430 void set_p(const NodePath &other, PN_stdfloat p); 00431 void set_r(const NodePath &other, PN_stdfloat r); 00432 LVecBase3 get_hpr(const NodePath &other) const; 00433 INLINE PN_stdfloat get_h(const NodePath &other) const; 00434 INLINE PN_stdfloat get_p(const NodePath &other) const; 00435 INLINE PN_stdfloat get_r(const NodePath &other) const; 00436 00437 void set_quat(const NodePath &other, const LQuaternion &quat); 00438 LQuaternion get_quat(const NodePath &other) const; 00439 00440 INLINE void set_scale(const NodePath &other, PN_stdfloat scale); 00441 INLINE void set_scale(const NodePath &other, PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz); 00442 void set_scale(const NodePath &other, const LVecBase3 &scale); 00443 void set_sx(const NodePath &other, PN_stdfloat sx); 00444 void set_sy(const NodePath &other, PN_stdfloat sy); 00445 void set_sz(const NodePath &other, PN_stdfloat sz); 00446 LVecBase3 get_scale(const NodePath &other) const; 00447 INLINE PN_stdfloat get_sx(const NodePath &other) const; 00448 INLINE PN_stdfloat get_sy(const NodePath &other) const; 00449 INLINE PN_stdfloat get_sz(const NodePath &other) const; 00450 00451 INLINE void set_shear(const NodePath &other, PN_stdfloat shxy, PN_stdfloat shxz, PN_stdfloat shyz); 00452 void set_shear(const NodePath &other, const LVecBase3 &shear); 00453 void set_shxy(const NodePath &other, PN_stdfloat shxy); 00454 void set_shxz(const NodePath &other, PN_stdfloat shxz); 00455 void set_shyz(const NodePath &other, PN_stdfloat shyz); 00456 LVecBase3 get_shear(const NodePath &other) const; 00457 INLINE PN_stdfloat get_shxy(const NodePath &other) const; 00458 INLINE PN_stdfloat get_shxz(const NodePath &other) const; 00459 INLINE PN_stdfloat get_shyz(const NodePath &other) const; 00460 00461 INLINE void set_pos_hpr(const NodePath &other, 00462 PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, 00463 PN_stdfloat h, PN_stdfloat p, PN_stdfloat r); 00464 void set_pos_hpr(const NodePath &other, 00465 const LVecBase3 &pos, 00466 const LVecBase3 &hpr); 00467 void set_pos_quat(const NodePath &other, 00468 const LVecBase3 &pos, 00469 const LQuaternion &quat); 00470 INLINE void set_hpr_scale(const NodePath &other, 00471 PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, 00472 PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz); 00473 void set_hpr_scale(const NodePath &other, 00474 const LVecBase3 &hpr, 00475 const LVecBase3 &scale); 00476 void set_quat_scale(const NodePath &other, 00477 const LQuaternion &quat, 00478 const LVecBase3 &scale); 00479 INLINE void set_pos_hpr_scale(const NodePath &other, 00480 PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, 00481 PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, 00482 PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz); 00483 void set_pos_hpr_scale(const NodePath &other, 00484 const LVecBase3 &pos, 00485 const LVecBase3 &hpr, 00486 const LVecBase3 &scale); 00487 void set_pos_quat_scale(const NodePath &other, 00488 const LVecBase3 &pos, 00489 const LQuaternion &quat, 00490 const LVecBase3 &scale); 00491 void set_pos_hpr_scale_shear(const NodePath &other, 00492 const LVecBase3 &pos, 00493 const LVecBase3 &hpr, 00494 const LVecBase3 &scale, 00495 const LVecBase3 &shear); 00496 void set_pos_quat_scale_shear(const NodePath &other, 00497 const LVecBase3 &pos, 00498 const LQuaternion &quat, 00499 const LVecBase3 &scale, 00500 const LVecBase3 &shear); 00501 00502 LMatrix4 get_mat(const NodePath &other) const; 00503 void set_mat(const NodePath &other, const LMatrix4 &mat); 00504 00505 LPoint3 get_relative_point(const NodePath &other, const LVecBase3 &point) const; 00506 LVector3 get_relative_vector(const NodePath &other, const LVecBase3 &vec) const; 00507 00508 INLINE void look_at(const NodePath &other, 00509 PN_stdfloat x, PN_stdfloat y, PN_stdfloat z); 00510 void look_at(const NodePath &other, 00511 const LPoint3 &point = LPoint3(0.0, 0.0, 0.0), 00512 const LVector3 &up = LVector3::up()); 00513 INLINE void heads_up(const NodePath &other, 00514 PN_stdfloat x, PN_stdfloat y, PN_stdfloat z); 00515 void heads_up(const NodePath &other, 00516 const LPoint3 &point = LPoint3(0.0, 0.0, 0.0), 00517 const LVector3 &up = LVector3::up()); 00518 00519 INLINE PN_stdfloat get_distance(const NodePath &other) const; 00520 00521 00522 // Methods that affect appearance of geometry: color, texture, etc. 00523 // These affect the state at the bottom level only. 00524 00525 void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a = 1.0, 00526 int priority = 0); 00527 void set_color(const LColor &color, int priority = 0); 00528 void set_color_off(int priority = 0); 00529 void clear_color(); 00530 bool has_color() const; 00531 LColor get_color() const; 00532 00533 bool has_color_scale() const; 00534 void clear_color_scale(); 00535 void set_color_scale(const LVecBase4 &scale, 00536 int priority = 0); 00537 INLINE void set_color_scale(PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz, PN_stdfloat sa, 00538 int priority = 0); 00539 void compose_color_scale(const LVecBase4 &scale, 00540 int priority = 0); 00541 INLINE void compose_color_scale(PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz, PN_stdfloat sa, 00542 int priority = 0); 00543 void set_color_scale_off(int priority = 0); 00544 00545 void set_alpha_scale(PN_stdfloat scale, int priority = 0); 00546 void set_all_color_scale(PN_stdfloat scale, int priority = 0); 00547 INLINE void set_sr(PN_stdfloat sr); 00548 INLINE void set_sg(PN_stdfloat sg); 00549 INLINE void set_sb(PN_stdfloat sb); 00550 INLINE void set_sa(PN_stdfloat sa); 00551 00552 const LVecBase4 &get_color_scale() const; 00553 INLINE PN_stdfloat get_sr() const; 00554 INLINE PN_stdfloat get_sg() const; 00555 INLINE PN_stdfloat get_sb() const; 00556 INLINE PN_stdfloat get_sa() const; 00557 00558 void set_light(const NodePath &light, int priority = 0); 00559 void set_light_off(int priority = 0); 00560 void set_light_off(const NodePath &light, int priority = 0); 00561 void clear_light(); 00562 void clear_light(const NodePath &light); 00563 bool has_light(const NodePath &light) const; 00564 bool has_light_off() const; 00565 bool has_light_off(const NodePath &light) const; 00566 00567 void set_clip_plane(const NodePath &clip_plane, int priority = 0); 00568 void set_clip_plane_off(int priority = 0); 00569 void set_clip_plane_off(const NodePath &clip_plane, int priority = 0); 00570 void clear_clip_plane(); 00571 void clear_clip_plane(const NodePath &clip_plane); 00572 bool has_clip_plane(const NodePath &clip_plane) const; 00573 bool has_clip_plane_off() const; 00574 bool has_clip_plane_off(const NodePath &clip_plane) const; 00575 00576 void set_scissor(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top); 00577 void set_scissor(const LPoint3 &a, const LPoint3 &b); 00578 void set_scissor(const LPoint3 &a, const LPoint3 &b, 00579 const LPoint3 &c, const LPoint3 &d); 00580 void set_scissor(const NodePath &other, 00581 const LPoint3 &a, const LPoint3 &b); 00582 void set_scissor(const NodePath &other, 00583 const LPoint3 &a, const LPoint3 &b, 00584 const LPoint3 &c, const LPoint3 &d); 00585 void clear_scissor(); 00586 bool has_scissor() const; 00587 00588 void set_occluder(const NodePath &occluder); 00589 void clear_occluder(); 00590 void clear_occluder(const NodePath &occluder); 00591 bool has_occluder(const NodePath &occluder) const; 00592 00593 void set_bin(const string &bin_name, int draw_order, int priority = 0); 00594 void clear_bin(); 00595 bool has_bin() const; 00596 string get_bin_name() const; 00597 int get_bin_draw_order() const; 00598 00599 void set_texture(Texture *tex, int priority = 0); 00600 void set_texture(TextureStage *stage, Texture *tex, int priority = 0); 00601 void set_texture_off(int priority = 0); 00602 void set_texture_off(TextureStage *stage, int priority = 0); 00603 void clear_texture(); 00604 void clear_texture(TextureStage *stage); 00605 bool has_texture() const; 00606 bool has_texture(TextureStage *stage) const; 00607 bool has_texture_off() const; 00608 bool has_texture_off(TextureStage *stage) const; 00609 Texture *get_texture() const; 00610 Texture *get_texture(TextureStage *stage) const; 00611 00612 void set_shader(const Shader *sha, int priority = 0); 00613 void set_shader_off(int priority = 0); 00614 void set_shader_auto(int priority = 0); 00615 void set_shader_auto(BitMask32 shader_switch, int priority=0); 00616 void clear_shader(); 00617 00618 void set_shader_input(const ShaderInput *inp); 00619 void set_shader_input(const InternalName *id, Texture *tex, int priority=0); 00620 void set_shader_input(const InternalName *id, const NodePath &np, int priority=0); 00621 void set_shader_input(const InternalName *id, const PTA_float &v, int priority=0); 00622 void set_shader_input(const InternalName *id, const PTA_double &v, int priority=0); 00623 void set_shader_input(const InternalName *id, const PTA_LVecBase4 &v, int priority=0); 00624 void set_shader_input(const InternalName *id, const PTA_LVecBase3 &v, int priority=0); 00625 void set_shader_input(const InternalName *id, const PTA_LVecBase2 &v, int priority=0); 00626 void set_shader_input(const InternalName *id, const PTA_LMatrix4 &v, int priority=0); 00627 void set_shader_input(const InternalName *id, const PTA_LMatrix3 &v, int priority=0); 00628 void set_shader_input(const InternalName *id, const LVecBase4 &v, int priority=0); 00629 void set_shader_input(const InternalName *id, const LVecBase3 &v, int priority=0); 00630 void set_shader_input(const InternalName *id, const LVecBase2 &v, int priority=0); 00631 void set_shader_input(const InternalName *id, const LMatrix4 &v, int priority=0); 00632 void set_shader_input(const InternalName *id, const LMatrix3 &v, int priority=0); 00633 void set_shader_input(const InternalName *id, double n1=0, double n2=0, double n3=0, 00634 double n4=1, int priority=0); 00635 00636 void set_shader_input(const string &id, Texture *tex, int priority=0); 00637 void set_shader_input(const string &id, const NodePath &np, int priority=0); 00638 void set_shader_input(const string &id, const PTA_float &v, int priority=0); 00639 void set_shader_input(const string &id, const PTA_double &v, int priority=0); 00640 void set_shader_input(const string &id, const PTA_LVecBase4 &v, int priority=0); 00641 void set_shader_input(const string &id, const PTA_LVecBase3 &v, int priority=0); 00642 void set_shader_input(const string &id, const PTA_LVecBase2 &v, int priority=0); 00643 void set_shader_input(const string &id, const PTA_LMatrix4 &v, int priority=0); 00644 void set_shader_input(const string &id, const PTA_LMatrix3 &v, int priority=0); 00645 void set_shader_input(const string &id, const LVecBase4 &v, int priority=0); 00646 void set_shader_input(const string &id, const LVecBase3 &v, int priority=0); 00647 void set_shader_input(const string &id, const LVecBase2 &v, int priority=0); 00648 void set_shader_input(const string &id, const LMatrix4 &v, int priority=0); 00649 void set_shader_input(const string &id, const LMatrix3 &v, int priority=0); 00650 void set_shader_input(const string &id, double n1=0, double n2=0, double n3=0, 00651 double n4=1, int priority=0); 00652 00653 void clear_shader_input(const InternalName *id); 00654 void clear_shader_input(const string &id); 00655 void set_instance_count(int instance_count); 00656 00657 const Shader *get_shader() const; 00658 const ShaderInput *get_shader_input(const InternalName *id) const; 00659 const ShaderInput *get_shader_input(const string &id) const; 00660 const int get_instance_count() const; 00661 00662 void set_tex_transform(TextureStage *stage, const TransformState *transform); 00663 void clear_tex_transform(); 00664 void clear_tex_transform(TextureStage *stage); 00665 bool has_tex_transform(TextureStage *stage) const; 00666 CPT(TransformState) get_tex_transform(TextureStage *stage) const; 00667 00668 INLINE void set_tex_offset(TextureStage *stage, PN_stdfloat u, PN_stdfloat v); 00669 INLINE void set_tex_offset(TextureStage *stage, const LVecBase2 &uv); 00670 INLINE void set_tex_rotate(TextureStage *stage, PN_stdfloat r); 00671 INLINE void set_tex_scale(TextureStage *stage, PN_stdfloat scale); 00672 INLINE void set_tex_scale(TextureStage *stage, PN_stdfloat su, PN_stdfloat sv); 00673 INLINE void set_tex_scale(TextureStage *stage, const LVecBase2 &scale); 00674 INLINE LVecBase2 get_tex_offset(TextureStage *stage) const; 00675 INLINE PN_stdfloat get_tex_rotate(TextureStage *stage) const; 00676 INLINE LVecBase2 get_tex_scale(TextureStage *stage) const; 00677 00678 INLINE void set_tex_pos(TextureStage *stage, PN_stdfloat u, PN_stdfloat v, PN_stdfloat w); 00679 INLINE void set_tex_pos(TextureStage *stage, const LVecBase3 &uvw); 00680 INLINE void set_tex_hpr(TextureStage *stage, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r); 00681 INLINE void set_tex_hpr(TextureStage *stage, const LVecBase3 &hpr); 00682 INLINE void set_tex_scale(TextureStage *stage, PN_stdfloat su, PN_stdfloat sv, PN_stdfloat sw); 00683 INLINE void set_tex_scale(TextureStage *stage, const LVecBase3 &scale); 00684 INLINE LVecBase3 get_tex_pos(TextureStage *stage) const; 00685 INLINE LVecBase3 get_tex_hpr(TextureStage *stage) const; 00686 INLINE LVecBase3 get_tex_scale_3d(TextureStage *stage) const; 00687 00688 void set_tex_transform(const NodePath &other, TextureStage *stage, const TransformState *transform); 00689 CPT(TransformState) get_tex_transform(const NodePath &other, TextureStage *stage) const; 00690 00691 INLINE void set_tex_offset(const NodePath &other, TextureStage *stage, PN_stdfloat u, PN_stdfloat v); 00692 INLINE void set_tex_offset(const NodePath &other, TextureStage *stage, const LVecBase2 &uv); 00693 INLINE void set_tex_rotate(const NodePath &other, TextureStage *stage, PN_stdfloat r); 00694 INLINE void set_tex_scale(const NodePath &other, TextureStage *stage, PN_stdfloat scale); 00695 INLINE void set_tex_scale(const NodePath &other, TextureStage *stage, PN_stdfloat su, PN_stdfloat sv); 00696 INLINE void set_tex_scale(const NodePath &other, TextureStage *stage, const LVecBase2 &scale); 00697 INLINE LVecBase2 get_tex_offset(const NodePath &other, TextureStage *stage) const; 00698 INLINE PN_stdfloat get_tex_rotate(const NodePath &other, TextureStage *stage) const; 00699 INLINE LVecBase2 get_tex_scale(const NodePath &other, TextureStage *stage) const; 00700 00701 INLINE void set_tex_pos(const NodePath &other, TextureStage *stage, PN_stdfloat u, PN_stdfloat v, PN_stdfloat w); 00702 INLINE void set_tex_pos(const NodePath &other, TextureStage *stage, const LVecBase3 &uvw); 00703 INLINE void set_tex_hpr(const NodePath &other, TextureStage *stage, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r); 00704 INLINE void set_tex_hpr(const NodePath &other, TextureStage *stage, const LVecBase3 &hpr); 00705 INLINE void set_tex_scale(const NodePath &other, TextureStage *stage, PN_stdfloat su, PN_stdfloat sv, PN_stdfloat sw); 00706 INLINE void set_tex_scale(const NodePath &other, TextureStage *stage, const LVecBase3 &scale); 00707 INLINE LVecBase3 get_tex_pos(const NodePath &other, TextureStage *stage) const; 00708 INLINE LVecBase3 get_tex_hpr(const NodePath &other, TextureStage *stage) const; 00709 INLINE LVecBase3 get_tex_scale_3d(const NodePath &other, TextureStage *stage) const; 00710 00711 void set_tex_gen(TextureStage *stage, RenderAttrib::TexGenMode mode, int priority = 0); 00712 void set_tex_gen(TextureStage *stage, RenderAttrib::TexGenMode mode, 00713 const string &source_name, const NodePath &light, 00714 int priority = 0); 00715 void set_tex_gen(TextureStage *stage, RenderAttrib::TexGenMode mode, 00716 const LTexCoord3 &constant_value, 00717 int priority = 0); 00718 void clear_tex_gen(); 00719 void clear_tex_gen(TextureStage *stage); 00720 bool has_tex_gen(TextureStage *stage) const; 00721 RenderAttrib::TexGenMode get_tex_gen(TextureStage *stage) const; 00722 NodePath get_tex_gen_light(TextureStage *stage) const; 00723 00724 void set_tex_projector(TextureStage *stage, const NodePath &from, const NodePath &to); 00725 void clear_tex_projector(TextureStage *stage); 00726 void clear_tex_projector(); 00727 bool has_tex_projector(TextureStage *stage) const; 00728 NodePath get_tex_projector_from(TextureStage *stage) const; 00729 NodePath get_tex_projector_to(TextureStage *stage) const; 00730 00731 void project_texture(TextureStage *stage, Texture *tex, const NodePath &projector); 00732 INLINE void clear_project_texture(TextureStage *stage); 00733 00734 void set_normal_map(Texture *normal_map, const string &texcoord_name = string(), 00735 bool preserve_color = false); 00736 void clear_normal_map(); 00737 00738 INLINE bool has_texcoord(const string &texcoord_name) const; 00739 bool has_vertex_column(const InternalName *name) const; 00740 InternalNameCollection find_all_vertex_columns() const; 00741 InternalNameCollection find_all_vertex_columns(const string &name) const; 00742 InternalNameCollection find_all_texcoords() const; 00743 InternalNameCollection find_all_texcoords(const string &name) const; 00744 00745 Texture *find_texture(const string &name) const; 00746 Texture *find_texture(TextureStage *stage) const; 00747 TextureCollection find_all_textures() const; 00748 TextureCollection find_all_textures(const string &name) const; 00749 TextureCollection find_all_textures(TextureStage *stage) const; 00750 00751 TextureStage *find_texture_stage(const string &name) const; 00752 TextureStageCollection find_all_texture_stages() const; 00753 TextureStageCollection find_all_texture_stages(const string &name) const; 00754 00755 void unify_texture_stages(TextureStage *stage); 00756 00757 Material *find_material(const string &name) const; 00758 MaterialCollection find_all_materials() const; 00759 MaterialCollection find_all_materials(const string &name) const; 00760 00761 void set_material(Material *tex, int priority = 0); 00762 void set_material_off(int priority = 0); 00763 void clear_material(); 00764 bool has_material() const; 00765 PT(Material) get_material() const; 00766 00767 void set_fog(Fog *fog, int priority = 0); 00768 void set_fog_off(int priority = 0); 00769 void clear_fog(); 00770 bool has_fog() const; 00771 bool has_fog_off() const; 00772 Fog *get_fog() const; 00773 00774 void set_render_mode_wireframe(int priority = 0); 00775 void set_render_mode_filled(int priority = 0); 00776 void set_render_mode_thickness(PN_stdfloat thickness, int priority = 0); 00777 void set_render_mode_perspective(bool perspective, int priority = 0); 00778 void set_render_mode(RenderModeAttrib::Mode mode, PN_stdfloat thickness, int priority = 0); 00779 void clear_render_mode(); 00780 bool has_render_mode() const; 00781 RenderModeAttrib::Mode get_render_mode() const; 00782 PN_stdfloat get_render_mode_thickness() const; 00783 bool get_render_mode_perspective() const; 00784 00785 void set_two_sided(bool two_sided, int priority = 0); 00786 void clear_two_sided(); 00787 bool has_two_sided() const; 00788 bool get_two_sided() const; 00789 00790 void set_depth_test(bool depth_test, int priority = 0); 00791 void clear_depth_test(); 00792 bool has_depth_test() const; 00793 bool get_depth_test() const; 00794 00795 void set_depth_write(bool depth_write, int priority = 0); 00796 void clear_depth_write(); 00797 bool has_depth_write() const; 00798 bool get_depth_write() const; 00799 00800 void set_depth_offset(int bias, int priority = 0); 00801 void clear_depth_offset(); 00802 bool has_depth_offset() const; 00803 int get_depth_offset() const; 00804 00805 void do_billboard_axis(const NodePath &camera, PN_stdfloat offset); 00806 void do_billboard_point_eye(const NodePath &camera, PN_stdfloat offset); 00807 void do_billboard_point_world(const NodePath &camera, PN_stdfloat offset); 00808 INLINE void set_billboard_axis(PN_stdfloat offset = 0.0); 00809 INLINE void set_billboard_point_eye(PN_stdfloat offset = 0.0); 00810 INLINE void set_billboard_point_world(PN_stdfloat offset = 0.0); 00811 void set_billboard_axis(const NodePath &camera, PN_stdfloat offset); 00812 void set_billboard_point_eye(const NodePath &camera, PN_stdfloat offset); 00813 void set_billboard_point_world(const NodePath &camera, PN_stdfloat offset); 00814 void clear_billboard(); 00815 bool has_billboard() const; 00816 00817 void set_compass(const NodePath &reference = NodePath()); 00818 void clear_compass(); 00819 bool has_compass() const; 00820 00821 void set_transparency(TransparencyAttrib::Mode mode, int priority = 0); 00822 void clear_transparency(); 00823 bool has_transparency() const; 00824 TransparencyAttrib::Mode get_transparency() const; 00825 00826 void set_antialias(unsigned short mode, int priority = 0); 00827 void clear_antialias(); 00828 bool has_antialias() const; 00829 unsigned short get_antialias() const; 00830 00831 bool has_audio_volume() const; 00832 void clear_audio_volume(); 00833 void set_audio_volume(PN_stdfloat volume, 00834 int priority = 0); 00835 void set_audio_volume_off(int priority = 0); 00836 PN_stdfloat get_audio_volume() const; 00837 PN_stdfloat get_net_audio_volume() const; 00838 00839 INLINE void adjust_all_priorities(int adjustment); 00840 00841 // Variants on show and hide 00842 INLINE void show(); 00843 INLINE void show(DrawMask camera_mask); 00844 INLINE void show_through(); 00845 INLINE void show_through(DrawMask camera_mask); 00846 INLINE void hide(); 00847 INLINE void hide(DrawMask camera_mask); 00848 INLINE bool is_hidden(DrawMask camera_mask = PandaNode::get_overall_bit()) const; 00849 NodePath get_hidden_ancestor(DrawMask camera_mask = PandaNode::get_overall_bit(), 00850 Thread *current_thread = Thread::get_current_thread()) const; 00851 00852 void stash(int sort = 0, Thread *current_thread = Thread::get_current_thread()); 00853 void unstash(int sort = 0, Thread *current_thread = Thread::get_current_thread()); 00854 void unstash_all(Thread *current_thread = Thread::get_current_thread()); 00855 INLINE bool is_stashed() const; 00856 NodePath get_stashed_ancestor(Thread *current_thread = Thread::get_current_thread()) const; 00857 00858 INLINE CollideMask get_collide_mask() const; 00859 INLINE void set_collide_mask(CollideMask new_mask, CollideMask bits_to_change = CollideMask::all_on(), 00860 TypeHandle node_type = TypeHandle::none()); 00861 00862 // Comparison methods 00863 INLINE bool operator == (const NodePath &other) const; 00864 INLINE bool operator != (const NodePath &other) const; 00865 INLINE bool operator < (const NodePath &other) const; 00866 INLINE int compare_to(const NodePath &other) const; 00867 00868 // Miscellaneous 00869 bool verify_complete(Thread *current_thread = Thread::get_current_thread()) const; 00870 00871 void premunge_scene(GraphicsStateGuardianBase *gsg = NULL); 00872 void prepare_scene(GraphicsStateGuardianBase *gsg); 00873 00874 void show_bounds(); 00875 void show_tight_bounds(); 00876 void hide_bounds(); 00877 PT(BoundingVolume) get_bounds(Thread *current_thread = Thread::get_current_thread()) const; 00878 void force_recompute_bounds(); 00879 void write_bounds(ostream &out) const; 00880 bool calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, 00881 Thread *current_thread = Thread::get_current_thread()) const; 00882 00883 // void analyze() const; 00884 00885 int flatten_light(); 00886 int flatten_medium(); 00887 int flatten_strong(); 00888 void apply_texture_colors(); 00889 INLINE int clear_model_nodes(); 00890 00891 INLINE void set_tag(const string &key, const string &value); 00892 INLINE string get_tag(const string &key) const; 00893 INLINE bool has_tag(const string &key) const; 00894 INLINE void clear_tag(const string &key); 00895 INLINE string get_net_tag(const string &key) const; 00896 INLINE bool has_net_tag(const string &key) const; 00897 NodePath find_net_tag(const string &key) const; 00898 00899 #ifdef HAVE_PYTHON 00900 INLINE void set_python_tag(const string &key, PyObject *value); 00901 INLINE PyObject *get_python_tag(const string &key) const; 00902 INLINE bool has_python_tag(const string &key) const; 00903 INLINE void clear_python_tag(const string &key); 00904 INLINE PyObject *get_net_python_tag(const string &key) const; 00905 INLINE bool has_net_python_tag(const string &key) const; 00906 NodePath find_net_python_tag(const string &key) const; 00907 #endif // HAVE_PYTHON 00908 00909 INLINE void list_tags() const; 00910 00911 INLINE void set_name(const string &name); 00912 INLINE string get_name() const; 00913 00914 BLOCKING bool write_bam_file(const Filename &filename) const; 00915 BLOCKING bool write_bam_stream(ostream &out) const; 00916 00917 INLINE string encode_to_bam_stream() const; 00918 bool encode_to_bam_stream(string &data, BamWriter *writer = NULL) const; 00919 static NodePath decode_from_bam_stream(const string &data, BamReader *reader = NULL); 00920 00921 private: 00922 static NodePathComponent * 00923 find_common_ancestor(const NodePath &a, const NodePath &b, 00924 int &a_count, int &b_count, 00925 Thread *current_thread); 00926 00927 CPT(RenderState) r_get_net_state(NodePathComponent *comp, 00928 Thread *current_thread) const; 00929 CPT(RenderState) r_get_partial_state(NodePathComponent *comp, int n, 00930 Thread *current_thread) const; 00931 CPT(TransformState) r_get_net_transform(NodePathComponent *comp, 00932 Thread *current_thread) const; 00933 CPT(TransformState) r_get_partial_transform(NodePathComponent *comp, int n, 00934 Thread *current_thread) const; 00935 CPT(TransformState) r_get_net_prev_transform(NodePathComponent *comp, 00936 Thread *current_thread) const; 00937 CPT(TransformState) r_get_partial_prev_transform(NodePathComponent *comp, 00938 int n, Thread *current_thread) const; 00939 00940 void find_matches(NodePathCollection &result, 00941 const string &approx_path_str, 00942 int max_matches) const; 00943 void find_matches(NodePathCollection &result, 00944 FindApproxPath &approx_path, 00945 int max_matches) const; 00946 void find_matches(NodePathCollection &result, 00947 FindApproxLevelEntry *level, 00948 int max_matches) const; 00949 00950 int r_clear_model_nodes(PandaNode *node); 00951 void r_adjust_all_priorities(PandaNode *node, int adjustment); 00952 00953 void r_force_recompute_bounds(PandaNode *node); 00954 00955 void r_set_collide_mask(PandaNode *node, 00956 CollideMask and_mask, CollideMask or_mask, 00957 TypeHandle node_type); 00958 00959 typedef phash_set<InternalName *, pointer_hash> InternalNames; 00960 bool r_has_vertex_column(PandaNode *node, const InternalName *name) const; 00961 void r_find_all_vertex_columns(PandaNode *node, 00962 InternalNames &vertex_columns) const; 00963 00964 typedef phash_set<Texture *, pointer_hash> Textures; 00965 Texture *r_find_texture(PandaNode *node, const RenderState *state, 00966 const GlobPattern &glob) const; 00967 void r_find_all_textures(PandaNode *node, const RenderState *state, 00968 Textures &textures) const; 00969 Texture *r_find_texture(PandaNode *node, TextureStage *stage) const; 00970 void r_find_all_textures(PandaNode *node, TextureStage *stage, 00971 Textures &textures) const; 00972 00973 typedef phash_set<TextureStage *, pointer_hash> TextureStages; 00974 TextureStage *r_find_texture_stage(PandaNode *node, const RenderState *state, 00975 const GlobPattern &glob) const; 00976 void r_find_all_texture_stages(PandaNode *node, const RenderState *state, 00977 TextureStages &texture_stages) const; 00978 00979 void r_unify_texture_stages(PandaNode *node, TextureStage *stage); 00980 00981 typedef phash_set<Material *, pointer_hash> Materials; 00982 Material *r_find_material(PandaNode *node, const RenderState *state, 00983 const GlobPattern &glob) const; 00984 void r_find_all_materials(PandaNode *node, const RenderState *state, 00985 Materials &materials) const; 00986 00987 PT(NodePathComponent) _head; 00988 int _backup_key; 00989 ErrorType _error_type; 00990 static int _max_search_depth; 00991 00992 static PStatCollector _get_transform_pcollector; 00993 static PStatCollector _verify_complete_pcollector; 00994 00995 public: 00996 static TypeHandle get_class_type() { 00997 return _type_handle; 00998 } 00999 static void init_type() { 01000 register_type(_type_handle, "NodePath"); 01001 } 01002 01003 private: 01004 static TypeHandle _type_handle; 01005 01006 friend class NodePathCollection; 01007 friend class WorkingNodePath; 01008 friend class WeakNodePath; 01009 }; 01010 01011 INLINE ostream &operator << (ostream &out, const NodePath &node_path); 01012 01013 #ifdef HAVE_PYTHON 01014 BEGIN_PUBLISH 01015 NodePath py_decode_NodePath_from_bam_stream(const string &data); 01016 NodePath py_decode_NodePath_from_bam_stream_persist(PyObject *unpickler, const string &data); 01017 END_PUBLISH 01018 #endif 01019 01020 #include "nodePath.I" 01021 01022 #endif