19 #include "nodePathCollection.h" 20 #include "findApproxPath.h" 21 #include "findApproxLevelEntry.h" 22 #include "internalNameCollection.h" 23 #include "config_pgraph.h" 24 #include "colorAttrib.h" 25 #include "colorScaleAttrib.h" 26 #include "cullBinAttrib.h" 27 #include "textureAttrib.h" 28 #include "texMatrixAttrib.h" 29 #include "texGenAttrib.h" 30 #include "materialAttrib.h" 31 #include "materialCollection.h" 32 #include "lightAttrib.h" 33 #include "clipPlaneAttrib.h" 34 #include "occluderEffect.h" 35 #include "polylightEffect.h" 36 #include "fogAttrib.h" 37 #include "renderModeAttrib.h" 38 #include "cullFaceAttrib.h" 39 #include "alphaTestAttrib.h" 40 #include "depthTestAttrib.h" 41 #include "depthWriteAttrib.h" 42 #include "depthOffsetAttrib.h" 43 #include "shaderAttrib.h" 44 #include "billboardEffect.h" 45 #include "compassEffect.h" 46 #include "showBoundsEffect.h" 47 #include "transparencyAttrib.h" 48 #include "antialiasAttrib.h" 49 #include "audioVolumeAttrib.h" 50 #include "texProjectorEffect.h" 51 #include "scissorEffect.h" 52 #include "texturePool.h" 53 #include "planeNode.h" 54 #include "occluderNode.h" 56 #include "materialPool.h" 59 #include "boundingSphere.h" 61 #include "sceneGraphReducer.h" 62 #include "textureCollection.h" 63 #include "textureStageCollection.h" 64 #include "globPattern.h" 66 #include "shaderInput.h" 67 #include "config_gobj.h" 69 #include "preparedGraphicsObjects.h" 71 #include "pStatCollector.h" 72 #include "pStatTimer.h" 73 #include "modelNode.h" 76 #include "bamWriter.h" 80 int NodePath::_max_search_depth = 7000;
83 PStatCollector NodePath::_get_transform_pcollector(
"*:NodePath:get_transform");
84 PStatCollector NodePath::_verify_complete_pcollector(
"*:NodePath:verify_complete");
89 extern EXPCL_PANDA_PUTIL Dtool_PyTypedObject Dtool_BamWriter;
90 extern EXPCL_PANDA_PUTIL Dtool_PyTypedObject Dtool_BamReader;
95 enum EmptyNodePathType {
102 ostream &operator << (ostream &out, EmptyNodePathType enp) {
105 return out <<
"future";
107 return out <<
"transition";
109 return out <<
"deprecated";
111 return out <<
"notify";
113 return out <<
"**invalid EmptyNodePathType value (" << (int)enp <<
")**";
116 istream &operator >> (istream &in, EmptyNodePathType &enp) {
119 if (word ==
"future") {
121 }
else if (word ==
"transition") {
122 enp = ENP_transition;
123 }
else if (word ==
"deprecated") {
124 enp = ENP_deprecated;
125 }
else if (word ==
"notify") {
129 <<
"Invalid EmptyNodePathType value (\"" << word <<
"\")\n";
130 enp = ENP_transition;
136 (
"empty-node-path", ENP_future,
137 PRC_DESC(
"This is a temporary transition variable to control the behavior " 138 "of a NodePath when it is used as a boolean false. Set this to " 139 "'deprecated' to preserve the original behavior: every NodePath " 140 "evaluates true, even an empty NodePath. Set it to 'future' to " 141 "support the new behavior: non-empty NodePaths evaluate true, " 142 "and empty NodePaths evaluate false. Set it to 'transition' to " 143 "raise an exception if an empty NodePath is used as a boolean."));
160 nassertv(child_node != (
PandaNode *)NULL);
165 _head = PandaNode::get_top_component(child_node,
true,
166 pipeline_stage, current_thread);
169 _head = PandaNode::get_component(parent._head, child_node, pipeline_stage,
187 operator bool ()
const {
188 switch (empty_node_path) {
197 const char *msg =
"NodePath being used as a Boolean (talk to Zac)";
199 PyErr_Warn(PyExc_FutureWarning, (
char *)msg);
211 const char *message =
"Using an empty NodePath as a boolean value. Because the meaning of this operation is changing, you should avoid doing this to avoid ambiguity, or set the config variable empty-node-path to 'future' or 'deprecated' to specify the desired behavior.";
215 PyErr_Warn(PyExc_FutureWarning, (
char *)message);
221 nassertr(
false,
true);
236 return _head->get_length(pipeline_stage, current_thread);
266 comp = comp->
get_next(pipeline_stage, current_thread);
297 comp = comp->
get_next(pipeline_stage, current_thread);
325 while (!comp->
is_top_node(pipeline_stage, current_thread)) {
326 comp = comp->
get_next(pipeline_stage, current_thread);
345 nassertr_always(!
is_empty(), result);
353 for (
int i = 0; i < num_children; i++) {
355 child._head = PandaNode::get_component(_head, cr.
get_child(i),
356 pipeline_stage, current_thread);
374 nassertr_always(!
is_empty(), result);
381 for (
int i = 0; i < num_stashed; i++) {
383 stashed._head = PandaNode::get_component(_head, bottom_node->
get_stashed(i),
384 pipeline_stage, current_thread);
408 PandaNode *parent = _head->get_next(pipeline_stage, current_thread)->get_node();
412 if (child_index != -1) {
417 if (child_index != -1) {
434 find(
const string &path)
const {
438 find_matches(col, path, 1);
462 find_matches(col, approx_path, 1);
484 find_matches(col, path, -1);
500 nassertr(node != (
PandaNode *)NULL, col);
504 find_matches(col, approx_path, -1);
527 nassertv(other._error_type == ET_ok);
533 bool reparented = PandaNode::reparent(other._head, _head, sort,
false,
534 pipeline_stage, current_thread);
535 nassertv(reparented);
551 nassertv(other._error_type == ET_ok);
557 bool reparented = PandaNode::reparent(other._head, _head, sort,
true,
558 pipeline_stage, current_thread);
559 nassertv(reparented);
576 nassertv(other._error_type == ET_ok);
629 new_instance._head = PandaNode::attach(NULL,
node(), sort, pipeline_stage,
633 bool reparented = PandaNode::reparent(other._head, new_instance._head,
634 sort,
false, pipeline_stage,
649 nassertr(reparented, new_instance);
671 Thread *current_thread)
const {
695 nassertr(other._error_type == ET_ok,
fail());
698 PT(
PandaNode) copy_node = source_node->copy_subgraph(current_thread);
701 copy_node->reset_prev_transform(current_thread);
730 new_path._head = PandaNode::attach(_head, node, sort, pipeline_stage,
758 nassertv(_error_type != ET_not_found);
767 PandaNode::detach(_head, pipeline_stage, current_thread);
770 if (
is_empty() || _head->has_key()) {
805 nassertv(_error_type != ET_not_found);
809 PandaNode::detach(_head, pipeline_stage, current_thread);
821 switch (_error_type) {
823 out <<
"**not found**";
826 out <<
"**removed**";
851 nassertr_always(!
is_empty(), RenderState::make_empty());
852 return node()->get_state(current_thread);
864 nassertr(_error_type == ET_ok && other._error_type == ET_ok, RenderState::make_empty());
867 return get_net_state(current_thread);
870 return other.get_net_state(current_thread)->invert_compose(RenderState::make_empty());
874 nassertr(other.
verify_complete(current_thread), RenderState::make_empty());
876 int a_count, b_count;
877 if (find_common_ancestor(*
this, other, a_count, b_count, current_thread) == (
NodePathComponent *)NULL) {
878 if (allow_unrelated_wrt) {
880 << *
this <<
" is not related to " << other <<
"\n";
883 << *
this <<
" is not related to " << other <<
"\n";
884 nassertr(
false, RenderState::make_empty());
888 CPT(
RenderState) a_state = r_get_partial_state(_head, a_count, current_thread);
889 CPT(
RenderState) b_state = r_get_partial_state(other._head, b_count, current_thread);
890 return b_state->invert_compose(a_state);
904 nassertv(_error_type == ET_ok && other._error_type == ET_ok);
915 CPT(
RenderState) new_state = rel_state->compose(state);
928 nassertr_always(!
is_empty(), TransformState::make_identity());
929 return node()->get_transform(current_thread);
941 nassertr(_error_type == ET_ok && other._error_type == ET_ok, TransformState::make_identity());
945 return get_net_transform(current_thread);
948 return other.get_net_transform(current_thread)->invert_compose(TransformState::make_identity());
951 nassertr(
verify_complete(current_thread), TransformState::make_identity());
952 nassertr(other.
verify_complete(current_thread), TransformState::make_identity());
954 int a_count, b_count;
955 if (find_common_ancestor(*
this, other, a_count, b_count, current_thread) == (
NodePathComponent *)NULL) {
956 if (allow_unrelated_wrt) {
957 if (pgraph_cat.is_debug()) {
959 << *
this <<
" is not related to " << other <<
"\n";
963 << *
this <<
" is not related to " << other <<
"\n";
964 nassertr(
false, TransformState::make_identity());
968 CPT(TransformState) a_transform, b_transform;
970 a_transform = r_get_partial_transform(_head, a_count, current_thread);
971 if (a_transform != (TransformState *)NULL) {
972 b_transform = r_get_partial_transform(other._head, b_count, current_thread);
974 if (b_transform == (TransformState *)NULL) {
978 a_transform = r_get_net_transform(_head, current_thread);
979 b_transform = r_get_net_transform(other._head, current_thread);
982 return b_transform->invert_compose(a_transform);
996 nassertv(_error_type == ET_ok && other._error_type == ET_ok);
1000 CPT(TransformState) rel_trans;
1007 CPT(TransformState) new_trans = rel_trans->compose(transform);
1022 nassertr_always(!
is_empty(), TransformState::make_identity());
1023 return node()->get_prev_transform(current_thread);
1036 nassertr(_error_type == ET_ok && other._error_type == ET_ok, TransformState::make_identity());
1039 return get_net_prev_transform(current_thread);
1042 return other.get_net_prev_transform(current_thread)->invert_compose(TransformState::make_identity());
1045 nassertr(
verify_complete(current_thread), TransformState::make_identity());
1046 nassertr(other.
verify_complete(current_thread), TransformState::make_identity());
1048 int a_count, b_count;
1049 if (find_common_ancestor(*
this, other, a_count, b_count, current_thread) == (
NodePathComponent *)NULL) {
1050 if (allow_unrelated_wrt) {
1052 << *
this <<
" is not related to " << other <<
"\n";
1055 << *
this <<
" is not related to " << other <<
"\n";
1056 nassertr(
false, TransformState::make_identity());
1060 CPT(TransformState) a_prev_transform = r_get_partial_prev_transform(_head, a_count, current_thread);
1061 CPT(TransformState) b_prev_transform = r_get_partial_prev_transform(other._head, b_count, current_thread);
1062 return b_prev_transform->invert_compose(a_prev_transform);
1074 set_prev_transform(
const NodePath &other,
const TransformState *transform,
1075 Thread *current_thread) {
1076 nassertv(_error_type == ET_ok && other._error_type == ET_ok);
1080 CPT(TransformState) rel_trans;
1087 CPT(TransformState) new_trans = rel_trans->compose(transform);
1088 set_prev_transform(new_trans, current_thread);
1110 set_x(PN_stdfloat x) {
1118 set_y(PN_stdfloat y) {
1126 set_z(PN_stdfloat z) {
1149 set_fluid_x(PN_stdfloat x) {
1157 set_fluid_y(PN_stdfloat y) {
1165 set_fluid_z(PN_stdfloat z) {
1213 nassertv(transform->has_hpr());
1218 set_h(PN_stdfloat h) {
1221 nassertv(transform->has_hpr());
1228 set_p(PN_stdfloat p) {
1231 nassertv(transform->has_hpr());
1238 set_r(PN_stdfloat r) {
1241 nassertv(transform->has_hpr());
1256 nassertr(transform->has_hpr(),
LVecBase3(0.0f, 0.0f, 0.0f));
1257 return transform->get_hpr();
1282 return transform->get_quat();
1299 set_sx(PN_stdfloat sx) {
1302 LVecBase3 scale = transform->get_scale();
1308 set_sy(PN_stdfloat sy) {
1311 LVecBase3 scale = transform->get_scale();
1317 set_sz(PN_stdfloat sz) {
1320 LVecBase3 scale = transform->get_scale();
1334 return transform->get_scale();
1351 set_shxy(PN_stdfloat shxy) {
1354 LVecBase3 shear = transform->get_shear();
1360 set_shxz(PN_stdfloat shxz) {
1363 LVecBase3 shear = transform->get_shear();
1369 set_shyz(PN_stdfloat shyz) {
1372 LVecBase3 shear = transform->get_shear();
1386 return transform->get_shear();
1399 transform = TransformState::make_pos_hpr_scale_shear
1400 (pos, hpr, transform->get_scale(), transform->get_shear());
1415 transform = TransformState::make_pos_quat_scale_shear
1416 (pos, quat, transform->get_scale(), transform->get_shear());
1431 transform = TransformState::make_pos_hpr_scale_shear
1432 (transform->get_pos(), hpr, scale, transform->get_shear());
1446 transform = TransformState::make_pos_quat_scale_shear
1447 (transform->get_pos(), quat, scale, transform->get_shear());
1477 (pos, quat, scale));
1492 (pos, hpr, scale, shear));
1507 (pos, quat, scale, shear));
1570 if (orig_transform->has_components()) {
1575 const LVecBase3 &orig_hpr = orig_transform->get_hpr();
1576 const LVecBase3 &orig_scale = orig_transform->get_scale();
1577 const LVecBase3 &orig_shear = orig_transform->get_shear();
1591 set_x(
const NodePath &other, PN_stdfloat x) {
1595 set_pos(other, pos);
1599 set_y(
const NodePath &other, PN_stdfloat y) {
1603 set_pos(other, pos);
1607 set_z(
const NodePath &other, PN_stdfloat z) {
1611 set_pos(other, pos);
1626 if (orig_transform->has_components()) {
1631 const LVecBase3 &orig_hpr = orig_transform->get_hpr();
1632 const LVecBase3 &orig_scale = orig_transform->get_scale();
1633 const LVecBase3 &orig_shear = orig_transform->get_shear();
1649 set_fluid_x(
const NodePath &other, PN_stdfloat x) {
1657 set_fluid_y(
const NodePath &other, PN_stdfloat y) {
1665 set_fluid_z(
const NodePath &other, PN_stdfloat z) {
1715 nassertv(rel_transform->has_hpr());
1718 if (transform->has_components()) {
1723 const LVecBase3 &orig_pos = transform->get_pos();
1724 const LVecBase3 &orig_scale = transform->get_scale();
1725 const LVecBase3 &orig_shear = transform->get_shear();
1729 if (transform->has_components()) {
1731 (orig_pos, transform->get_hpr(), orig_scale, orig_shear));
1742 set_h(
const NodePath &other, PN_stdfloat h) {
1750 set_p(
const NodePath &other, PN_stdfloat p) {
1758 set_r(
const NodePath &other, PN_stdfloat r) {
1775 nassertr(transform->has_hpr(),
LVecBase3(0.0f, 0.0f, 0.0f));
1776 return transform->get_hpr();
1791 if (transform->has_components()) {
1796 const LVecBase3 &orig_pos = transform->get_pos();
1797 const LVecBase3 &orig_scale = transform->get_scale();
1798 const LVecBase3 &orig_shear = transform->get_shear();
1802 if (transform->has_components()) {
1804 (orig_pos, transform->get_quat(), orig_scale, orig_shear));
1824 return transform->get_quat();
1839 if (transform->has_components()) {
1844 const LVecBase3 &orig_pos = transform->get_pos();
1845 const LVecBase3 &orig_hpr = transform->get_hpr();
1846 const LVecBase3 &orig_shear = transform->get_shear();
1850 if (transform->has_components()) {
1852 (orig_pos, orig_hpr, transform->get_scale(), orig_shear));
1863 set_sx(
const NodePath &other, PN_stdfloat sx) {
1871 set_sy(
const NodePath &other, PN_stdfloat sy) {
1879 set_sz(
const NodePath &other, PN_stdfloat sz) {
1896 return transform->get_scale();
1911 if (transform->has_components()) {
1916 const LVecBase3 &orig_pos = transform->get_pos();
1917 const LVecBase3 &orig_hpr = transform->get_hpr();
1918 const LVecBase3 &orig_scale = transform->get_scale();
1922 if (transform->has_components()) {
1924 (orig_pos, orig_hpr, orig_scale, transform->get_shear()));
1935 set_shxy(
const NodePath &other, PN_stdfloat shxy) {
1943 set_shxz(
const NodePath &other, PN_stdfloat shxz) {
1951 set_shyz(
const NodePath &other, PN_stdfloat shyz) {
1968 return transform->get_shear();
1984 if (transform->has_components()) {
1989 const LVecBase3 &orig_scale = transform->get_scale();
1990 const LVecBase3 &orig_shear = transform->get_shear();
1992 set_transform(other, TransformState::make_pos_hpr_scale_shear
1993 (pos, hpr, rel_transform->get_scale(), rel_transform->get_shear()));
1995 if (transform->has_components()) {
1997 orig_scale, orig_shear);
2003 set_transform(other, TransformState::make_pos_hpr_scale_shear
2004 (pos, hpr, rel_transform->get_scale(), rel_transform->get_shear()));
2022 if (transform->has_components()) {
2027 const LVecBase3 &orig_scale = transform->get_scale();
2028 const LVecBase3 &orig_shear = transform->get_shear();
2030 set_transform(other, TransformState::make_pos_quat_scale_shear
2031 (pos, quat, rel_transform->get_scale(), rel_transform->get_shear()));
2033 if (transform->has_components()) {
2035 orig_scale, orig_shear);
2041 set_transform(other, TransformState::make_pos_quat_scale_shear
2042 (pos, quat, rel_transform->get_scale(), rel_transform->get_shear()));
2063 transform = TransformState::make_pos_hpr_scale_shear
2064 (transform->get_pos(), hpr, scale, transform->get_shear());
2085 transform = TransformState::make_pos_quat_scale_shear
2086 (transform->get_pos(), quat, scale, transform->get_shear());
2120 (pos, quat, scale));
2136 set_transform(other, TransformState::make_pos_hpr_scale_shear
2137 (pos, hpr, scale, shear));
2153 set_transform(other, TransformState::make_pos_quat_scale_shear
2154 (pos, quat, scale, shear));
2173 return transform->get_mat();
2230 LPoint3 rel_point = point * transform->get_mat();
2251 LPoint3 rel_point = point * transform->get_mat();
2270 set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a,
2316 node()->clear_attrib(ColorAttrib::get_class_slot());
2327 nassertr_always(!
is_empty(),
false);
2328 return node()->has_attrib(ColorAttrib::get_class_slot());
2339 nassertr_always(!
is_empty(),
false);
2341 node()->get_attrib(ColorAttrib::get_class_slot());
2349 pgraph_cat.warning()
2350 <<
"get_color() called on " << *
this <<
" which has no color set.\n";
2352 return LColor(1.0f, 1.0f, 1.0f, 1.0f);
2365 nassertr_always(!
is_empty(),
false);
2366 return node()->has_attrib(ColorScaleAttrib::get_class_slot());
2381 node()->clear_attrib(ColorScaleAttrib::get_class_slot());
2396 node()->get_attrib(ColorScaleAttrib::get_class_slot());
2398 priority = max(priority,
2399 node()->
get_state()->get_override(ColorScaleAttrib::get_class_slot()));
2405 LVecBase4 new_color_scale(prev_color_scale[0]*scale[0],
2406 prev_color_scale[1]*scale[1],
2407 prev_color_scale[2]*scale[2],
2408 prev_color_scale[3]*scale[3]);
2428 node()->get_attrib(ColorScaleAttrib::get_class_slot());
2430 priority = max(priority,
2431 node()->
get_state()->get_override(ColorScaleAttrib::get_class_slot()));
2479 node()->get_attrib(ColorScaleAttrib::get_class_slot());
2481 priority = max(priority,
2482 node()->
get_state()->get_override(ColorScaleAttrib::get_class_slot()));
2509 node()->get_attrib(ColorScaleAttrib::get_class_slot());
2511 priority = max(priority,
2512 node()->
get_state()->get_override(ColorScaleAttrib::get_class_slot()));
2537 static const LVecBase4 ident_scale(1.0f, 1.0f, 1.0f, 1.0f);
2538 nassertr_always(!
is_empty(), ident_scale);
2540 node()->get_attrib(ColorScaleAttrib::get_class_slot());
2564 if (light_obj != (
Light *)NULL) {
2567 node()->get_attrib(LightAttrib::get_class_slot());
2569 priority = max(priority,
2570 node()->
get_state()->get_override(LightAttrib::get_class_slot()));
2584 }
else if (light.
node()->
is_of_type(PolylightNode::get_class_type())) {
2586 if (priority != 0) {
2589 pgraph_cat.warning()
2590 <<
"Ignoring priority on set_light(" << light <<
")\n";
2594 node()->get_effect(PolylightEffect::get_class_type());
2610 nassert_raise(
"Not a Light object.");
2653 if (light_obj != (
Light *)NULL) {
2655 node()->get_attrib(LightAttrib::get_class_slot());
2657 priority = max(priority,
2658 node()->
get_state()->get_override(LightAttrib::get_class_slot()));
2675 nassert_raise(
"Not a Light object.");
2688 node()->clear_attrib(LightAttrib::get_class_slot());
2704 if (light_obj != (
Light *)NULL) {
2706 node()->get_attrib(LightAttrib::get_class_slot());
2709 la = DCAST(
LightAttrib, la->remove_on_light(light));
2710 la = DCAST(
LightAttrib, la->remove_off_light(light));
2712 if (la->is_identity()) {
2713 node()->clear_attrib(LightAttrib::get_class_slot());
2716 int priority =
node()->get_state()->get_override(LightAttrib::get_class_slot());
2722 }
else if (light.
node()->
is_of_type(PolylightNode::get_class_type())) {
2724 node()->get_effect(PolylightEffect::get_class_type());
2733 nassert_raise(
"Not a Light object.");
2746 nassertr_always(!
is_empty(),
false);
2750 if (light_obj != (
Light *)NULL) {
2752 node()->get_attrib(LightAttrib::get_class_slot());
2759 }
else if (light.
node()->
is_of_type(PolylightNode::get_class_type())) {
2761 node()->get_effect(PolylightEffect::get_class_type());
2764 return ple->has_light(light);
2769 nassert_raise(
"Not a Light object.");
2783 nassertr_always(!
is_empty(),
false);
2786 node()->get_attrib(LightAttrib::get_class_slot());
2808 nassertr_always(!
is_empty(),
false);
2811 if (light_obj != (
Light *)NULL) {
2813 node()->get_attrib(LightAttrib::get_class_slot());
2820 nassert_raise(
"Not a Light object.");
2839 node()->get_attrib(ClipPlaneAttrib::get_class_slot());
2841 priority = max(priority,
2842 node()->
get_state()->get_override(ClipPlaneAttrib::get_class_slot()));
2856 nassert_raise(
"Not a PlaneNode object.");
2896 node()->get_attrib(ClipPlaneAttrib::get_class_slot());
2898 priority = max(priority,
2899 node()->
get_state()->get_override(ClipPlaneAttrib::get_class_slot()));
2915 nassert_raise(
"Not a PlaneNode object.");
2928 node()->clear_attrib(ClipPlaneAttrib::get_class_slot());
2943 node()->get_attrib(ClipPlaneAttrib::get_class_slot());
2949 if (la->is_identity()) {
2950 node()->clear_attrib(ClipPlaneAttrib::get_class_slot());
2953 int priority =
node()->get_state()->get_override(ClipPlaneAttrib::get_class_slot());
2959 nassert_raise(
"Not a PlaneNode object.");
2972 nassertr_always(!
is_empty(),
false);
2976 node()->get_attrib(ClipPlaneAttrib::get_class_slot());
2983 nassert_raise(
"Not a PlaneNode object.");
2997 nassertr_always(!
is_empty(),
false);
3000 node()->get_attrib(ClipPlaneAttrib::get_class_slot());
3019 nassertr_always(!
is_empty(),
false);
3022 node()->get_attrib(ClipPlaneAttrib::get_class_slot());
3028 nassert_raise(
"Not a PlaneNode object.");
3047 node()->get_effect(OccluderEffect::get_class_type());
3062 nassert_raise(
"Not an OccluderNode object.");
3089 node()->get_effect(OccluderEffect::get_class_type());
3094 if (la->is_identity()) {
3103 nassert_raise(
"Not an OccluderNode object.");
3116 nassertr_always(!
is_empty(),
false);
3120 node()->get_effect(OccluderEffect::get_class_type());
3127 nassert_raise(
"Not an OccluderNode object.");
3143 set_scissor(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
3176 set_effect(ScissorEffect::make_node(a, b, c, d));
3191 set_effect(ScissorEffect::make_node(a, b, other));
3209 set_effect(ScissorEffect::make_node(a, b, c, d, other));
3235 return has_effect(ScissorEffect::get_class_type());
3263 set_bin(
const string &bin_name,
int draw_order,
int priority) {
3265 node()->
set_attrib(CullBinAttrib::make(bin_name, draw_order), priority);
3277 node()->clear_attrib(CullBinAttrib::get_class_slot());
3289 nassertr_always(!
is_empty(),
false);
3290 return node()->has_attrib(CullBinAttrib::get_class_slot());
3302 nassertr_always(!
is_empty(),
string());
3304 node()->get_attrib(CullBinAttrib::get_class_slot());
3323 nassertr_always(!
is_empty(),
false);
3325 node()->get_attrib(CullBinAttrib::get_class_slot());
3368 node()->get_attrib(TextureAttrib::get_class_slot());
3371 int sg_priority =
node()->get_state()->get_override(TextureAttrib::get_class_slot());
3375 node()->
set_attrib(tsa->add_on_stage(stage, tex, priority), sg_priority);
3430 node()->get_attrib(TextureAttrib::get_class_slot());
3433 int sg_priority =
node()->get_state()->get_override(TextureAttrib::get_class_slot());
3437 node()->
set_attrib(tsa->add_on_stage(stage, tex, sampler, priority), sg_priority);
3442 node()->
set_attrib(tsa->add_on_stage(stage, tex, sampler, priority));
3477 node()->get_attrib(TextureAttrib::get_class_slot());
3480 int sg_priority =
node()->get_state()->get_override(TextureAttrib::get_class_slot());
3485 node()->
set_attrib(tsa->add_off_stage(stage, priority), sg_priority);
3507 node()->clear_attrib(TextureAttrib::get_class_slot());
3521 node()->get_attrib(TextureAttrib::get_class_slot());
3527 if (tsa->is_identity()) {
3528 node()->clear_attrib(TextureAttrib::get_class_slot());
3531 int priority =
node()->get_state()->get_override(TextureAttrib::get_class_slot());
3564 nassertr_always(!
is_empty(),
false);
3567 node()->get_attrib(TextureAttrib::get_class_slot());
3588 nassertr_always(!
is_empty(),
false);
3590 node()->get_attrib(TextureAttrib::get_class_slot());
3611 nassertr_always(!
is_empty(),
false);
3614 node()->get_attrib(TextureAttrib::get_class_slot());
3637 nassertr_always(!
is_empty(), NULL);
3639 node()->get_attrib(TextureAttrib::get_class_slot());
3657 nassertr_always(!
is_empty(), NULL);
3659 node()->get_attrib(TextureAttrib::get_class_slot());
3699 node()->get_attrib(TextureAttrib::get_class_slot());
3712 set_shader(
const Shader *sha,
int priority) {
3716 node()->get_attrib(ShaderAttrib::get_class_slot());
3718 priority = max(priority,
3719 node()->
get_state()->get_override(ShaderAttrib::get_class_slot()));
3735 set_shader_off(
int priority) {
3736 set_shader(NULL, priority);
3745 set_shader_auto(
int priority) {
3749 node()->get_attrib(ShaderAttrib::get_class_slot());
3751 priority = max(priority,
3752 node()->
get_state()->get_override(ShaderAttrib::get_class_slot()));
3772 node()->get_attrib(ShaderAttrib::get_class_slot());
3774 priority = max(priority,
3775 node()->
get_state()->get_override(ShaderAttrib::get_class_slot()));
3777 node()->
set_attrib(sa->set_shader_auto(shader_switch, priority));
3781 node()->
set_attrib(sa->set_shader_auto(shader_switch, priority));
3794 node()->get_attrib(ShaderAttrib::get_class_slot());
3807 get_shader()
const {
3808 nassertr_always(!
is_empty(), NULL);
3810 node()->get_attrib(ShaderAttrib::get_class_slot());
3813 return sa->get_shader();
3828 node()->get_attrib(ShaderAttrib::get_class_slot());
3846 nassertr_always(!
is_empty(), NULL);
3849 node()->get_attrib(ShaderAttrib::get_class_slot());
3852 return sa->get_shader_input(
id);
3868 node()->get_attrib(ShaderAttrib::get_class_slot());
3888 node()->get_attrib(ShaderAttrib::get_class_slot());
3908 node()->get_attrib(ShaderAttrib::get_class_slot());
3930 node()->get_attrib(TexMatrixAttrib::get_class_slot());
3952 node()->clear_attrib(TexMatrixAttrib::get_class_slot());
3966 node()->get_attrib(TexMatrixAttrib::get_class_slot());
3971 if (tma->is_empty()) {
3972 node()->clear_attrib(TexMatrixAttrib::get_class_slot());
3988 nassertr_always(!
is_empty(),
false);
3991 node()->get_attrib(TexMatrixAttrib::get_class_slot());
3994 return tma->has_stage(stage);
4007 CPT(TransformState) NodePath::
4009 nassertr_always(!
is_empty(), NULL);
4012 node()->get_attrib(TexMatrixAttrib::get_class_slot());
4015 return tma->get_transform(stage);
4018 return TransformState::make_identity();
4029 nassertv(_error_type == ET_ok && other._error_type == ET_ok);
4034 state->get_attrib(TexMatrixAttrib::get_class_slot());
4040 state = state->add_attrib(tma->add_stage(stage, transform));
4044 state = state->add_attrib(TexMatrixAttrib::make(stage, transform));
4054 CPT(
RenderState) new_state = rel_state->compose(state);
4058 node()->
set_attrib(new_state->get_attrib(TexMatrixAttrib::get_class_slot()));
4067 CPT(TransformState) NodePath::
4069 nassertr(_error_type == ET_ok && other._error_type == ET_ok, TransformState::make_identity());
4073 state->get_attrib(TexMatrixAttrib::get_class_slot());
4076 return tma->get_transform(stage);
4079 return TransformState::make_identity();
4089 set_tex_gen(
TextureStage *stage, RenderAttrib::TexGenMode mode,
int priority) {
4093 node()->get_attrib(TexGenAttrib::get_class_slot());
4098 priority = max(priority,
4099 node()->
get_state()->get_override(TextureAttrib::get_class_slot()));
4119 const LTexCoord3 &constant_value,
int priority) {
4123 node()->get_attrib(TexGenAttrib::get_class_slot());
4128 priority = max(priority,
4129 node()->
get_state()->get_override(TextureAttrib::get_class_slot()));
4136 node()->
set_attrib(tga->add_stage(stage, mode, constant_value), priority);
4148 node()->clear_attrib(TexGenAttrib::get_class_slot());
4162 node()->get_attrib(TexGenAttrib::get_class_slot());
4167 if (tga->is_empty()) {
4168 node()->clear_attrib(TexGenAttrib::get_class_slot());
4185 nassertr_always(!
is_empty(),
false);
4188 node()->get_attrib(TexGenAttrib::get_class_slot());
4191 return tga->has_stage(stage);
4206 nassertr_always(!
is_empty(), TexGenAttrib::M_off);
4209 node()->get_attrib(TexGenAttrib::get_class_slot());
4212 return tga->get_mode(stage);
4215 return TexGenAttrib::M_off;
4239 node()->get_effect(TexProjectorEffect::get_class_type());
4264 node()->get_effect(TexProjectorEffect::get_class_type());
4269 if (tpe->is_empty()) {
4298 nassertr_always(!
is_empty(),
false);
4301 node()->get_effect(TexProjectorEffect::get_class_type());
4304 return tpe->has_stage(stage);
4324 node()->get_effect(TexProjectorEffect::get_class_type());
4327 return tpe->get_from(stage);
4347 node()->get_effect(TexProjectorEffect::get_class_type());
4350 return tpe->get_to(stage);
4368 set_tex_gen(stage, TexGenAttrib::M_world_position);
4385 nassertr_always(!
is_empty(),
false);
4386 return r_has_vertex_column(
node(), name);
4398 InternalNames vertex_columns;
4399 r_find_all_vertex_columns(
node(), vertex_columns);
4402 InternalNames::iterator ti;
4403 for (ti = vertex_columns.begin(); ti != vertex_columns.end(); ++ti) {
4420 InternalNames vertex_columns;
4421 r_find_all_vertex_columns(
node(), vertex_columns);
4426 InternalNames::iterator ti;
4427 for (ti = vertex_columns.begin(); ti != vertex_columns.end(); ++ti) {
4428 const InternalName *name = (*ti);
4429 if (glob.
matches(name->get_name())) {
4445 InternalNames vertex_columns;
4446 r_find_all_vertex_columns(
node(), vertex_columns);
4448 CPT(InternalName) texcoord_name = InternalName::get_texcoord();
4451 InternalNames::iterator ti;
4452 for (ti = vertex_columns.begin(); ti != vertex_columns.end(); ++ti) {
4453 if ((*ti)->get_top() == texcoord_name) {
4471 InternalNames vertex_columns;
4472 r_find_all_vertex_columns(
node(), vertex_columns);
4478 InternalNames::iterator ti;
4479 for (ti = vertex_columns.begin(); ti != vertex_columns.end(); ++ti) {
4480 const InternalName *name = (*ti);
4481 if (name->get_top() == texcoord_name) {
4484 int index = name->find_ancestor(
"texcoord");
4486 string net_basename = name->get_net_basename(index - 1);
4488 if (glob.
matches(net_basename)) {
4506 nassertr_always(!
is_empty(), NULL);
4508 return r_find_texture(
node(), get_net_state(), glob);
4521 nassertr_always(!
is_empty(), NULL);
4522 return r_find_texture(
node(), stage);
4535 r_find_all_textures(
node(), get_net_state(), textures);
4538 Textures::iterator ti;
4539 for (ti = textures.begin(); ti != textures.end(); ++ti) {
4556 r_find_all_textures(
node(), get_net_state(), textures);
4561 Textures::iterator ti;
4562 for (ti = textures.begin(); ti != textures.end(); ++ti) {
4564 if (glob.
matches(texture->get_name())) {
4582 r_find_all_textures(
node(), stage, textures);
4585 Textures::iterator ti;
4586 for (ti = textures.begin(); ti != textures.end(); ++ti) {
4604 nassertr_always(!
is_empty(), NULL);
4606 return r_find_texture_stage(
node(), get_net_state(), glob);
4618 TextureStages texture_stages;
4619 r_find_all_texture_stages(
node(), get_net_state(), texture_stages);
4622 TextureStages::iterator ti;
4623 for (ti = texture_stages.begin(); ti != texture_stages.end(); ++ti) {
4642 r_unify_texture_stages(
node(), stage);
4655 TextureStages texture_stages;
4656 r_find_all_texture_stages(
node(), get_net_state(), texture_stages);
4661 TextureStages::iterator ti;
4662 for (ti = texture_stages.begin(); ti != texture_stages.end(); ++ti) {
4681 nassertr_always(!
is_empty(), NULL);
4683 return r_find_material(
node(), get_net_state(), glob);
4695 Materials materials;
4696 r_find_all_materials(
node(), get_net_state(), materials);
4699 Materials::iterator ti;
4700 for (ti = materials.begin(); ti != materials.end(); ++ti) {
4716 Materials materials;
4717 r_find_all_materials(
node(), get_net_state(), materials);
4722 Materials::iterator ti;
4723 for (ti = materials.begin(); ti != materials.end(); ++ti) {
4725 if (glob.
matches(material->get_name())) {
4745 nassertv(mat != NULL);
4775 node()->clear_attrib(MaterialAttrib::get_class_slot());
4786 nassertr_always(!
is_empty(),
false);
4788 node()->get_attrib(MaterialAttrib::get_class_slot());
4810 get_material()
const {
4811 nassertr_always(!
is_empty(), NULL);
4813 node()->get_attrib(MaterialAttrib::get_class_slot());
4829 set_fog(
Fog *fog,
int priority) {
4862 node()->clear_attrib(FogAttrib::get_class_slot());
4877 nassertr_always(!
is_empty(),
false);
4879 node()->get_attrib(FogAttrib::get_class_slot());
4900 nassertr_always(!
is_empty(),
false);
4902 node()->get_attrib(FogAttrib::get_class_slot());
4923 nassertr_always(!
is_empty(), NULL);
4925 node()->get_attrib(FogAttrib::get_class_slot());
4944 node()->get_state()->get_attrib_def(rma);
4959 node()->get_state()->get_attrib_def(rma);
4975 node()->get_state()->get_attrib_def(rma);
4998 node()->get_state()->get_attrib_def(rma);
5019 node()->get_state()->get_attrib_def(rma);
5034 node()->
set_attrib(RenderModeAttrib::make(mode, thickness), priority);
5048 node()->clear_attrib(RenderModeAttrib::get_class_slot());
5061 nassertr_always(!
is_empty(),
false);
5062 return node()->has_attrib(RenderModeAttrib::get_class_slot());
5074 nassertr_always(!
is_empty(), RenderModeAttrib::M_unchanged);
5076 node()->get_attrib(RenderModeAttrib::get_class_slot());
5082 return RenderModeAttrib::M_unchanged;
5094 nassertr_always(!
is_empty(), 0.0f);
5096 node()->get_attrib(RenderModeAttrib::get_class_slot());
5114 nassertr_always(!
is_empty(), 0.0f);
5116 node()->get_attrib(RenderModeAttrib::get_class_slot());
5138 CullFaceAttrib::Mode mode =
5140 CullFaceAttrib::M_cull_none :
5141 CullFaceAttrib::M_cull_clockwise;
5160 node()->clear_attrib(CullFaceAttrib::get_class_slot());
5174 nassertr_always(!
is_empty(),
false);
5175 return node()->has_attrib(CullFaceAttrib::get_class_slot());
5191 nassertr_always(!
is_empty(),
false);
5193 node()->get_attrib(CullFaceAttrib::get_class_slot());
5215 DepthTestAttrib::PandaCompareFunc mode =
5217 DepthTestAttrib::M_less :
5218 DepthTestAttrib::M_none;
5232 node()->clear_attrib(DepthTestAttrib::get_class_slot());
5246 nassertr_always(!
is_empty(),
false);
5247 return node()->has_attrib(DepthTestAttrib::get_class_slot());
5261 nassertr_always(!
is_empty(),
false);
5263 node()->get_attrib(DepthTestAttrib::get_class_slot());
5266 return (dta->
get_mode() != DepthTestAttrib::M_none);
5285 DepthWriteAttrib::Mode mode =
5287 DepthWriteAttrib::M_on :
5288 DepthWriteAttrib::M_off;
5302 node()->clear_attrib(DepthWriteAttrib::get_class_slot());
5316 nassertr_always(!
is_empty(),
false);
5317 return node()->has_attrib(DepthWriteAttrib::get_class_slot());
5331 nassertr_always(!
is_empty(),
false);
5333 node()->get_attrib(DepthWriteAttrib::get_class_slot());
5336 return (dta->
get_mode() != DepthWriteAttrib::M_off);
5373 node()->clear_attrib(DepthOffsetAttrib::get_class_slot());
5387 nassertr_always(!
is_empty(),
false);
5388 return node()->has_attrib(DepthOffsetAttrib::get_class_slot());
5401 node()->get_attrib(DepthOffsetAttrib::get_class_slot());
5422 const LMatrix4 &rel_mat = transform->get_mat();
5433 if (offset != 0.0f) {
5436 translate *= offset;
5455 const LMatrix4 &rel_mat = transform->get_mat();
5466 if (offset != 0.0f) {
5469 translate *= offset;
5486 const LMatrix4 &rel_mat = transform->get_mat();
5497 if (offset != 0.0f) {
5500 translate *= offset;
5518 offset, camera,
LPoint3(0.0f, 0.0f, 0.0f));
5536 offset, camera,
LPoint3(0.0f, 0.0f, 0.0f));
5553 offset, camera,
LPoint3(0.0f, 0.0f, 0.0f));
5576 nassertr_always(!
is_empty(),
false);
5577 return node()->has_effect(BillboardEffect::get_class_type());
5613 nassertr_always(!
is_empty(),
false);
5614 return node()->has_effect(CompassEffect::get_class_type());
5645 node()->clear_attrib(TransparencyAttrib::get_class_slot());
5660 nassertr_always(!
is_empty(),
false);
5661 return node()->has_attrib(TransparencyAttrib::get_class_slot());
5677 nassertr_always(!
is_empty(), TransparencyAttrib::M_none);
5679 node()->get_attrib(TransparencyAttrib::get_class_slot());
5685 return TransparencyAttrib::M_none;
5710 node()->clear_attrib(AntialiasAttrib::get_class_slot());
5724 nassertr_always(!
is_empty(),
false);
5725 return node()->has_attrib(AntialiasAttrib::get_class_slot());
5737 nassertr_always(!
is_empty(), AntialiasAttrib::M_none);
5739 node()->get_attrib(AntialiasAttrib::get_class_slot());
5745 return AntialiasAttrib::M_none;
5758 nassertr_always(!
is_empty(),
false);
5759 return node()->has_attrib(AudioVolumeAttrib::get_class_slot());
5774 node()->clear_attrib(AudioVolumeAttrib::get_class_slot());
5787 node()->get_attrib(AudioVolumeAttrib::get_class_slot());
5789 priority = max(priority,
5790 node()->
get_state()->get_override(AudioVolumeAttrib::get_class_slot()));
5834 node()->get_attrib(AudioVolumeAttrib::get_class_slot());
5852 const RenderAttrib *attrib = net_state->get_attrib(AudioVolumeAttrib::get_class_slot());
5878 comp = comp->
get_next(pipeline_stage, current_thread)) {
5883 result._head = comp;
5912 bool reparented = PandaNode::reparent(_head->get_next(pipeline_stage, current_thread),
5913 _head, sort,
true, pipeline_stage,
5915 nassertv(reparented);
5932 bool reparented = PandaNode::reparent(_head->get_next(pipeline_stage, current_thread),
5933 _head, sort,
false, pipeline_stage,
5935 nassertv(reparented);
5946 stashed_descendents.
unstash();
5971 result._head = comp;
5976 next = next->
get_next(pipeline_stage, current_thread);
6003 #endif // HAVE_THREADS 6005 PStatTimer timer(_verify_complete_pcollector);
6013 nassertr(node != (
const PandaNode *)NULL,
false);
6014 int length = comp->
get_length(pipeline_stage, current_thread);
6016 comp = comp->
get_next(pipeline_stage, current_thread);
6020 nassertr(next_node != (
const PandaNode *)NULL,
false);
6023 pgraph_cat.warning()
6024 << *
this <<
" is incomplete; " << *node <<
" is not a child of " 6025 << *next_node <<
"\n";
6029 if (comp->
get_length(pipeline_stage, current_thread) != length) {
6030 pgraph_cat.warning()
6031 << *
this <<
" is incomplete; length at " << *next_node
6032 <<
" indicates " << comp->
get_length(pipeline_stage, current_thread)
6033 <<
" while length at " << *node <<
" indicates " << length <<
"\n";
6038 comp = comp->
get_next(pipeline_stage, current_thread);
6063 CPT(
RenderState) state = RenderState::make_empty();
6091 node()->prepare_scene(gsg, get_net_state());
6146 get_bounds(
Thread *current_thread)
const {
6168 force_recompute_bounds() {
6170 r_force_recompute_bounds(
node());
6182 get_bounds()->write(out);
6199 Thread *current_thread)
const {
6200 min_point.set(0.0f, 0.0f, 0.0f);
6201 max_point.set(0.0f, 0.0f, 0.0f);
6202 nassertr_always(!
is_empty(),
false);
6204 bool found_any =
false;
6205 node()->calc_tight_bounds(min_point, max_point, found_any,
6206 TransformState::make_identity(),
6220 // Function: NodePath::analyze
6221 // Access: Published
6222 // Description: Analyzes the geometry below this node and reports the
6223 // number of vertices, triangles, etc. This is the same
6224 // information reported by the bam-info program.
6228 nassertv_always(!is_empty());
6229 SceneGraphAnalyzer sga;
6230 sga.add_node(node());
6232 if (sga.get_num_lod_nodes() == 0) {
6236 nout << "At highest LOD:\n";
6237 SceneGraphAnalyzer sga2;
6238 sga2.set_lod_mode(SceneGraphAnalyzer::LM_highest);
6239 sga2.add_node(node());
6242 nout << "\nAt lowest LOD:\n";
6244 sga2.set_lod_mode(SceneGraphAnalyzer::LM_lowest);
6245 sga2.add_node(node());
6248 nout << "\nAll nodes:\n";
6310 if (flatten_geoms) {
6343 if (flatten_geoms) {
6345 gr.
collect_vertex_data(
node(), ~(SceneGraphReducer::CVD_format | SceneGraphReducer::CVD_name | SceneGraphReducer::CVD_animation_type));
6376 gr.
apply_attribs(
node(), SceneGraphReducer::TT_apply_texture_color | SceneGraphReducer::TT_tex_matrix | SceneGraphReducer::TT_other);
6409 nassertr_always(!
is_empty(),
false);
6413 bool okflag =
false;
6432 nassertr_always(!
is_empty(),
false);
6436 bool okflag =
false;
6481 if (!dout.
open(stream)) {
6486 bool used_local_writer =
false;
6487 if (writer == NULL) {
6493 writer = &local_writer;
6494 used_local_writer =
true;
6500 if (used_local_writer && num_nodes > 1) {
6517 for (
int i = 0; i < num_nodes; ++i) {
6519 nassertr(node != NULL,
false);
6527 data = stream.str();
6546 if (!din.
open(stream)) {
6551 if (reader == NULL) {
6559 if (head != _bam_header) {
6563 reader = &local_reader;
6575 ErrorType error_type = (ErrorType)dgi.
get_uint8();
6577 if (num_nodes == 0) {
6579 result._error_type = error_type;
6583 for (
int i = 0; i < num_nodes; ++i) {
6587 !object->
is_of_type(PandaNode::get_class_type())) {
6621 int &a_count,
int &b_count,
Thread *current_thread) {
6631 while (ac->get_length(pipeline_stage, current_thread) > bc->
get_length(pipeline_stage, current_thread)) {
6633 ac = ac->get_next(pipeline_stage, current_thread);
6636 while (bc->
get_length(pipeline_stage, current_thread) > ac->get_length(pipeline_stage, current_thread)) {
6638 bc = bc->
get_next(pipeline_stage, current_thread);
6647 ac = ac->get_next(pipeline_stage, current_thread);
6649 bc = bc->
get_next(pipeline_stage, current_thread);
6665 return RenderState::make_empty();
6669 return r_get_net_state(comp->
get_next(pipeline_stage, current_thread), current_thread)->compose(state);
6683 Thread *current_thread)
const {
6685 return RenderState::make_empty();
6689 return r_get_partial_state(comp->
get_next(pipeline_stage, current_thread), n - 1, current_thread)->compose(state);
6699 CPT(TransformState) NodePath::
6702 return TransformState::make_identity();
6705 CPT(TransformState) net_transform = r_get_net_transform(comp->
get_next(pipeline_stage, current_thread), current_thread);
6707 CPT(TransformState) transform = node->get_transform(current_thread);
6709 CPT(
RenderEffects) effects = node->get_effects(current_thread);
6710 if (effects->has_adjust_transform()) {
6711 effects->adjust_transform(net_transform, transform, node);
6714 return net_transform->compose(transform);
6730 CPT(TransformState) NodePath::
6732 Thread *current_thread)
const {
6734 return TransformState::make_identity();
6736 if (comp->
get_node()->get_effects(current_thread)->has_adjust_transform()) {
6739 CPT(TransformState) transform = comp->
get_node()->get_transform(current_thread);
6741 CPT(TransformState) partial = r_get_partial_transform(comp->
get_next(pipeline_stage, current_thread), n - 1, current_thread);
6742 if (partial == (
const TransformState *)NULL) {
6745 return partial->compose(transform);
6756 CPT(TransformState) NodePath::
6759 return TransformState::make_identity();
6761 CPT(TransformState) transform = comp->
get_node()->get_prev_transform(current_thread);
6763 return r_get_net_prev_transform(comp->
get_next(pipeline_stage, current_thread), current_thread)->compose(transform);
6776 CPT(TransformState) NodePath::
6779 return TransformState::make_identity();
6781 CPT(TransformState) transform = comp->
get_node()->get_prev_transform(current_thread);
6783 return r_get_partial_prev_transform(comp->
get_next(pipeline_stage, current_thread), n - 1, current_thread)->compose(transform);
6798 int max_matches)
const {
6800 pgraph_cat.warning()
6801 <<
"Attempt to extend an empty NodePath by '" << path
6807 find_matches(result, approx_path, max_matches);
6822 int max_matches)
const {
6824 pgraph_cat.warning()
6825 <<
"Attempt to extend an empty NodePath by: " << approx_path <<
".\n";
6832 nassertv(level->_node_path.
is_valid());
6834 find_matches(result, level, max_matches);
6846 int max_matches)
const {
6848 int num_levels_remaining = _max_search_depth;
6852 while (num_levels_remaining > 0 && level != NULL) {
6853 if (pgraph_cat.is_spam()) {
6855 <<
"find_matches pass: " << result <<
", " 6856 << max_matches <<
", " << num_levels_remaining <<
"\n";
6860 num_levels_remaining--;
6868 if (entry->
consider_node(result, next_level, max_matches, 0)) {
6884 delete deleted_entries;
6885 deleted_entries = next;
6895 entry->_next = deleted_entries;
6896 deleted_entries = entry;
6905 entry->_next = deleted_entries;
6906 deleted_entries = entry;
6917 delete deleted_entries;
6918 deleted_entries = next;
6933 if (node->
is_of_type(ModelNode::get_class_type())) {
6935 DCAST_INTO_R(mnode, node, count);
6942 for (
int i = 0; i < num_children; i++) {
6943 count += r_clear_model_nodes(cr.
get_child(i));
6957 r_adjust_all_priorities(
PandaNode *node,
int adjustment) {
6958 node->
set_state(node->get_state()->adjust_all_priorities(adjustment));
6961 DCAST_INTO_V(gnode, node);
6964 for (
int i = 0; i < num_geoms; i++) {
6971 for (
int i = 0; i < num_children; i++) {
6972 r_adjust_all_priorities(cr.
get_child(i), adjustment);
6982 r_force_recompute_bounds(
PandaNode *node) {
6985 DCAST_INTO_V(gnode, node);
6988 for (
int i = 0; i < num_geoms; i++) {
6989 const Geom *geom = gnode->get_geom(i);
6990 geom->mark_bounds_stale();
6994 node->mark_bounds_stale();
6999 for (
int i = 0; i < num_children; i++) {
7000 r_force_recompute_bounds(cr.
get_child(i));
7016 into_collide_mask = (into_collide_mask & and_mask) | or_mask;
7022 for (
int i = 0; i < num_children; i++) {
7023 r_set_collide_mask(cr.
get_child(i), and_mask, or_mask, node_type);
7033 r_has_vertex_column(
PandaNode *node,
const InternalName *name)
const {
7036 DCAST_INTO_R(gnode, node,
false);
7039 for (
int i = 0; i < num_geoms; i++) {
7040 const Geom *geom = gnode->get_geom(i);
7042 if (vdata->has_column(name)) {
7051 for (
int i = 0; i < num_children; i++) {
7053 if (r_has_vertex_column(child, name)) {
7067 r_find_all_vertex_columns(
PandaNode *node,
7068 NodePath::InternalNames &vertex_columns)
const {
7071 DCAST_INTO_V(gnode, node);
7074 for (
int i = 0; i < num_geoms; ++i) {
7075 const Geom *geom = gnode->get_geom(i);
7076 const GeomVertexFormat *format = geom->get_vertex_data()->get_format();
7077 int num_arrays = format->get_num_arrays();
7078 for (
int j = 0; j < num_arrays; ++j) {
7079 const GeomVertexArrayFormat *array = format->get_array(j);
7080 int num_columns = array->get_num_columns();
7081 for (
int k = 0; k < num_columns; ++k) {
7083 vertex_columns.insert(column->
get_name());
7092 for (
int i = 0; i < num_children; i++) {
7094 r_find_all_vertex_columns(child, vertex_columns);
7108 DCAST_INTO_R(gnode, node, NULL);
7111 for (
int i = 0; i < num_geoms; i++) {
7117 geom_state->get_attrib(TextureAttrib::get_class_slot());
7122 if (texture != (
Texture *)NULL) {
7123 if (glob.
matches(texture->get_name())) {
7135 for (
int i = 0; i < num_children; i++) {
7137 CPT(
RenderState) next_state = state->compose(child->get_state());
7139 Texture *result = r_find_texture(child, next_state, glob);
7140 if (result != (
Texture *)NULL) {
7155 NodePath::Textures &textures)
const {
7158 DCAST_INTO_V(gnode, node);
7161 for (
int i = 0; i < num_geoms; i++) {
7167 geom_state->get_attrib(TextureAttrib::get_class_slot());
7172 if (texture != (
Texture *)NULL) {
7173 textures.insert(texture);
7183 for (
int i = 0; i < num_children; i++) {
7185 CPT(
RenderState) next_state = state->compose(child->get_state());
7186 r_find_all_textures(child, next_state, textures);
7199 node->get_attrib(TextureAttrib::get_class_slot());
7209 DCAST_INTO_R(gnode, node, NULL);
7212 for (
int i = 0; i < num_geoms; i++) {
7217 geom_state->get_attrib(TextureAttrib::get_class_slot());
7230 for (
int i = 0; i < num_children; i++) {
7233 Texture *result = r_find_texture(child, stage);
7234 if (result != (
Texture *)NULL) {
7249 NodePath::Textures &textures)
const {
7252 node->get_attrib(TextureAttrib::get_class_slot());
7262 DCAST_INTO_V(gnode, node);
7265 for (
int i = 0; i < num_geoms; i++) {
7270 geom_state->get_attrib(TextureAttrib::get_class_slot());
7283 for (
int i = 0; i < num_children; i++) {
7285 r_find_all_textures(child, stage, textures);
7299 DCAST_INTO_R(gnode, node, NULL);
7302 for (
int i = 0; i < num_geoms; i++) {
7308 geom_state->get_attrib(TextureAttrib::get_class_slot());
7315 return texture_stage;
7326 for (
int i = 0; i < num_children; i++) {
7328 CPT(
RenderState) next_state = state->compose(child->get_state());
7330 TextureStage *result = r_find_texture_stage(child, next_state, glob);
7346 NodePath::TextureStages &texture_stages)
const {
7349 DCAST_INTO_V(gnode, node);
7352 for (
int i = 0; i < num_geoms; i++) {
7358 geom_state->get_attrib(TextureAttrib::get_class_slot());
7364 texture_stages.insert(texture_stage);
7374 for (
int i = 0; i < num_children; i++) {
7376 CPT(
RenderState) next_state = state->compose(child->get_state());
7377 r_find_all_texture_stages(child, next_state, texture_stages);
7390 node->get_attrib(TextureAttrib::get_class_slot());
7393 CPT(
RenderAttrib) new_attrib = ta->unify_texture_stages(stage);
7394 if (new_attrib != ta) {
7401 DCAST_INTO_V(gnode, node);
7404 for (
int i = 0; i < num_geoms; i++) {
7409 state->get_attrib(TextureAttrib::get_class_slot());
7412 CPT(
RenderAttrib) new_attrib = ta->unify_texture_stages(stage);
7413 if (new_attrib != ta) {
7414 CPT(
RenderState) new_state = state->add_attrib(new_attrib);
7424 for (
int i = 0; i < num_children; i++) {
7426 r_unify_texture_stages(child, stage);
7440 DCAST_INTO_R(gnode, node, NULL);
7443 for (
int i = 0; i < num_geoms; i++) {
7449 geom_state->get_attrib(MaterialAttrib::get_class_slot());
7454 if (material != (
Material *)NULL) {
7455 if (glob.
matches(material->get_name())) {
7467 for (
int i = 0; i < num_children; i++) {
7469 CPT(
RenderState) next_state = state->compose(child->get_state());
7471 Material *result = r_find_material(child, next_state, glob);
7487 NodePath::Materials &materials)
const {
7490 DCAST_INTO_V(gnode, node);
7493 for (
int i = 0; i < num_geoms; i++) {
7499 geom_state->get_attrib(MaterialAttrib::get_class_slot());
7504 if (material != (
Material *)NULL) {
7505 materials.insert(material);
7515 for (
int i = 0; i < num_children; i++) {
7517 CPT(
RenderState) next_state = state->compose(child->get_state());
7518 r_find_all_materials(child, next_state, materials);
void unstash(int sort=0, Thread *current_thread=Thread::get_current_thread())
Undoes the effect of a previous stash() on this node: makes the referenced node (and the entire subgr...
The principle public interface to reading and writing Bam disk files.
static const LQuaternionf & ident_quat()
Returns an identity quaternion.
const RenderState * get_geom_state(int n) const
Returns the RenderState associated with the nth geom of the node.
string get_bin_name() const
Returns the name of the bin that this particular node was assigned to via set_bin(), or the empty string if no bin was assigned.
void clear_audio_volume()
Completely removes any audio volume from the referenced node.
CollideMask get_into_collide_mask() const
Returns the "into" collide mask for this node.
Texture * get_texture() const
Returns the base-level texture that has been set on this particular node, or NULL if no texture has b...
void clear_depth_write()
Completely removes any depth-write adjustment that may have been set on this node via set_depth_write...
TransparencyAttrib::Mode get_transparency() const
Returns the transparent rendering that has been specifically set on this node via set_transparency()...
Fog * get_fog() const
If the FogAttrib is not an 'off' FogAttrib, returns the fog that is associated.
int get_num_children() const
Returns the number of children of the node.
void add_match_pointer(PandaNode *pointer, int flags)
Adds a component that must match a particular node exactly, by pointer.
bool calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, Thread *current_thread=Thread::get_current_thread()) const
Calculates the minimum and maximum vertices of all Geoms at this NodePath's bottom node and below...
void clear_two_sided()
Completely removes any two-sided adjustment that may have been set on this node via set_two_sided()...
bool matches(const string &candidate) const
Returns true if the candidate string matches the pattern, false otherwise.
RenderAttrib::TexGenMode get_tex_gen(TextureStage *stage) const
Returns the texture coordinate generation mode for the given stage, or M_off if there is no explicit ...
int get_offset() const
Returns the depth offset represented by this attrib.
void set_audio_volume(PN_stdfloat volume, int priority=0)
Sets the audio volume component of the transform.
virtual Light * as_light()
Cross-casts the node to a Light pointer, if it is one of the four kinds of Light nodes, or returns NULL if it is not.
bool write_object(const TypedWritable *object)
Writes the indicated object to the Bam file.
void set_depth_test(bool depth_test, int priority=0)
Specifically sets or disables the testing of the depth buffer on this particular node.
A basic node of the scene graph or data graph.
void do_billboard_axis(const NodePath &camera, PN_stdfloat offset)
Performs a billboard-type rotate to the indicated camera node, one time only, and leaves the object r...
void add_texture_stage(TextureStage *node_texture_stage)
Adds a new TextureStage to the collection.
The abstract interface to all kinds of lights.
unsigned short get_mode() const
Returns the specified antialias mode.
bool has_vertex_column(const InternalName *name) const
Returns true if there are at least some vertices at this node and below that contain a reference to t...
void clear_material()
Completely removes any material adjustment that may have been set via set_material() from this partic...
void add_uint8(PN_uint8 value)
Adds an unsigned 8-bit integer to the datagram.
This is the base class for all three-component vectors and points.
bool get_render_mode_perspective() const
Returns the flag that has been set on this node via set_render_mode_perspective(), or false if no flag has been set.
void set_color_scale_off(int priority=0)
Disables any color scale attribute inherited from above.
This is a const pointer to an InternalName, and should be used in lieu of a CPT(InternalName) in func...
int collect_vertex_data(PandaNode *root, int collect_bits=~0)
Collects all different GeomVertexData blocks that have compatible formats at this node and below into...
Mode get_mode() const
Returns the render mode.
void write_bounds(ostream &out) const
Writes a description of the bounding volume containing the bottom node and all of its descendants to ...
void add_path(const NodePath &node_path)
Adds a new NodePath to the collection.
void set_hpr_scale(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz)
Sets the rotation and scale components of the transform, leaving translation untouched.
void clear_clip_plane()
Completely removes any clip planes that may have been set via set_clip_plane() or set_clip_plane_off(...
void do_billboard_point_eye(const NodePath &camera, PN_stdfloat offset)
Performs a billboard-type rotate to the indicated camera node, one time only, and leaves the object r...
bool has_off_plane(const NodePath &plane) const
Returns true if the indicated plane is disabled by the attrib, false otherwise.
Enables or disables writing to the depth buffer.
Material * get_material() const
If the MaterialAttrib is not an 'off' MaterialAttrib, returns the material that is associated...
void set_source(DatagramGenerator *source)
Changes the source of future datagrams for this BamReader.
int get_num_stashed(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of stashed nodes this node has.
bool has_occluder(const NodePath &occluder) const
Returns true if the indicated occluder has been specifically applied to this particular node...
This is the base class for a number of render attributes (other than transform) that may be set on sc...
void set_render_mode_filled(int priority=0)
Sets up the geometry at this level and below (unless overridden) to render in filled (i...
const LColor & get_color() const
If the type is T_flat or T_off, this returns the color that will be applied to geometry.
bool has_fog_off() const
Returns true if a fog has been specifically disabled on this particular node via set_fog_off(), false otherwise.
void set_pos_hpr(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r)
Sets the translation and rotation component of the transform, leaving scale untouched.
LVector3 get_relative_vector(const NodePath &other, const LVecBase3 &vec) const
Given that the indicated vector is in the coordinate system of the other node, returns the same vecto...
int get_instance_count() const
Returns the geometry instance count, or 0 if disabled.
Material * find_material(const string &name) const
Returns the first material found applied to geometry at this node or below that matches the indicated...
NodePath()
This constructs an empty NodePath with no nodes.
void set_depth_write(bool depth_write, int priority=0)
Specifically sets or disables the writing to the depth buffer on this particular node.
int get_instance_count() const
Returns the number of geometry instances.
bool has_depth_offset() const
Returns true if a depth-offset adjustment has been explicitly set on this particular node via set_dep...
bool has_color() const
Returns true if a color has been applied to the given node, false otherwise.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
int get_pipeline_stage() const
Returns the Pipeline stage number associated with this thread.
void clear_bin()
Completely removes any bin adjustment that may have been set via set_bin() from this particular node...
bool resolve()
This may be called at any time during processing of the Bam file to resolve all the known pointers so...
int get_depth_offset() const
Returns the depth offset value if it has been specified using set_depth_offset, or 0 if not...
bool is_empty() const
Returns true if the NodePath contains no nodes.
Indicates which, if any, material should be applied to geometry.
DrawMask get_draw_control_mask() const
Returns the set of bits in draw_show_mask that are considered meaningful.
const LVecBase4 & get_scale() const
Returns the scale to be applied to colors.
This class is local to this package only; it doesn't get exported.
Enables or disables writing to the depth buffer.
void set_alpha_scale(PN_stdfloat scale, int priority=0)
Sets the alpha scale component of the transform without (much) affecting the color scale...
Texture * find_texture(const string &name) const
Returns the first texture found applied to geometry at this node or below that matches the indicated ...
LColor get_color() const
Returns the color that has been assigned to the node, or black if no color has been assigned...
Specifies whether or how to enable antialiasing, if supported by the backend renderer.
const LVecBase4 & get_color_scale() const
Returns the complete color scale vector that has been applied to this node via a previous call to set...
void set_clip_plane(const NodePath &clip_plane, int priority=0)
Adds the indicated clipping plane to the list of planes that apply to geometry at this node and below...
NodePath get_stashed_ancestor(Thread *current_thread=Thread::get_current_thread()) const
Returns the NodePath at or above the referenced node that is stashed, or an empty NodePath if no ance...
bool has_audio_volume() const
Returns true if an audio volume has been applied to the referenced node, false otherwise.
void unstash()
Unstashes all NodePaths in the collection.
bool is_empty() const
Returns true if there are no NodePaths in the collection, false otherwise.
TypedWritable * read_object()
Reads a single object from the Bam file.
This controls the enabling of transparency.
bool has_all_off() const
Returns true if this attrib disables all planes (although it may also enable some).
MaterialCollection find_all_materials() const
Returns a list of a materials applied to geometry at this node and below.
This defines a bounding sphere, consisting of a center and a radius.
void set_audio_volume_off(int priority=0)
Disables any audio volume attribute inherited from above.
static bool is_true_threads()
Returns true if a real threading library is available that supports actual OS-implemented threads...
void clear_billboard()
Removes any billboard effect from the node.
bool has_tag(const string &key) const
Returns true if a value has been defined on this node for the particular key (even if that value is t...
Mode get_mode() const
Returns the transparency mode.
void set_instance_count(int instance_count)
Sets the geometry instance count, or 0 if geometry instancing should be disabled. ...
void set_scale(PN_stdfloat scale)
Sets the scale component of the transform, leaving translation and rotation untouched.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Base class for objects that can be written to and read from Bam files.
NodePath get_hidden_ancestor(DrawMask camera_mask=PandaNode::get_overall_bit(), Thread *current_thread=Thread::get_current_thread()) const
Returns the NodePath at or above the referenced node that is hidden to the indicated camera(s)...
bool write_header(const string &header)
Writes a sequence of bytes to the beginning of the datagram file.
This class is local to this package only; it doesn't get exported.
An interface for simplifying ("flattening") scene graphs by eliminating unneeded nodes and collapsing...
void clear_tex_gen()
Removes the texture coordinate generation mode from all texture stages on this node.
bool has_on_occluder(const NodePath &occluder) const
Returns true if the indicated occluder is enabled by the effect, false otherwise. ...
NodePath instance_under_node(const NodePath &other, const string &name, int sort=0, Thread *current_thread=Thread::get_current_thread()) const
Behaves like instance_to(), but implicitly creates a new node to instance the geometry under...
void apply_texture_colors()
Removes textures from Geoms at this node and below by applying the texture colors to the vertices...
NodePathCollection find_all_paths_to(PandaNode *node) const
Returns the set of all NodePaths that extend from this NodePath down to the indicated node...
void hide_bounds()
Stops the rendering of the bounding volume begun with show_bounds().
void set_render_mode(RenderModeAttrib::Mode mode, PN_stdfloat thickness, int priority=0)
Sets up the geometry at this level and below (unless overridden) to render in the specified mode and ...
void show_bounds()
Causes the bounding volume of the bottom node and all of its descendants (that is, the bounding volume associated with the the bottom arc) to be rendered, if possible.
void set_target(DatagramSink *target)
Changes the destination of future datagrams written by the BamWriter.
void set_quat_scale(const LQuaternion &quat, const LVecBase3 &scale)
Sets the rotation and scale components of the transform, leaving translation untouched.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
void compose_color_scale(const LVecBase4 &scale, int priority=0)
multiplies the color scale component of the transform, with previous color scale leaving translation ...
bool has_fog() const
Returns true if a fog has been applied to this particular node via set_fog(), false otherwise...
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
This functions similarly to a LightAttrib.
int get_draw_order() const
Returns the draw order this attribute specifies.
void set_pos_quat(const LVecBase3 &pos, const LQuaternion &quat)
Sets the translation and rotation component of the transform, leaving scale untouched.
void add_material(Material *node_material)
Adds a new Material to the collection.
bool has_billboard() const
Returns true if there is any billboard effect on the node.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
NodePath get_ancestor(int index, Thread *current_thread=Thread::get_current_thread()) const
Returns the nth ancestor of the path, where 0 is the NodePath itself and get_num_nodes() - 1 is get_t...
This is the base class for a number of special render effects that may be set on scene graph nodes to...
NodePath instance_to(const NodePath &other, int sort=0, Thread *current_thread=Thread::get_current_thread()) const
Adds the referenced node of the NodePath as a child of the referenced node of the indicated other Nod...
void clear_depth_test()
Completely removes any depth-test adjustment that may have been set on this node via set_depth_test()...
void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a=1.0, int priority=0)
Applies a scene-graph color to the referenced node.
void add_texture(Texture *texture)
Adds a new Texture to the collection.
int get_num_geoms() const
Returns the number of geoms in the node.
void write_level(ostream &out, int indent_level) const
Writes the entire level (a linked list of entries beginning at this entry).
PN_int32 get_int32()
Extracts a signed 32-bit integer.
bool has_material() const
Returns true if a material has been applied to this particular node via set_material(), false otherwise.
PN_uint8 get_uint8()
Extracts an unsigned 8-bit integer.
PandaNode * get_node() const
Returns the node referenced by this component.
void unify_texture_stages(TextureStage *stage)
Searches through all TextureStages at this node and below.
void clear_transparency()
Completely removes any transparency adjustment that may have been set on this node via set_transparen...
bool get_perspective() const
Returns the perspective flag.
PN_stdfloat get_render_mode_thickness() const
Returns the render mode thickness that has been specifically set on this node via set_render_mode()...
This is a class designed to support low-overhead traversals of the complete scene graph...
Type get_color_type() const
Returns the type of color specified by this ColorAttrib.
bool is_overall_hidden() const
Returns true if the node has been hidden to all cameras by clearing its overall bit.
void set_compass(const NodePath &reference=NodePath())
Puts a compass effect on the node, so that it will retain a fixed rotation relative to the reference ...
bool has_tex_projector(TextureStage *stage) const
Returns true if this node has a TexProjectorEffect for the indicated stage, false otherwise...
RenderModeAttrib::Mode get_render_mode() const
Returns the render mode that has been specifically set on this node via set_render_mode(), or M_unchanged if nothing has been set.
void set_material(Material *tex, int priority=0)
Sets the geometry at this level and below to render using the indicated material. ...
bool has_antialias() const
Returns true if an antialias setting has been explicitly mode on this particular node via set_antiali...
void clear_scissor()
Removes the scissor region that was defined at this node level by a previous call to set_scissor()...
void close()
Closes the input or output stream.
Mode get_mode() const
Returns the depth write mode.
This defines how a single column is interleaved within a vertex array stored within a Geom...
void set_pos_quat_scale_shear(const LVecBase3 &pos, const LQuaternion &quat, const LVecBase3 &scale, const LVecBase3 &shear)
Completely replaces the transform with new translation, rotation, scale, and shear components...
TextureCollection find_all_textures() const
Returns a list of a textures applied to geometry at this node and below.
NodePath find_net_tag(const string &key) const
Returns the lowest ancestor of this node that contains a tag definition with the indicated key...
bool open(const FileReference *file)
Opens the indicated filename for writing.
void set_transform(const TransformState *transform, Thread *current_thread=Thread::get_current_thread())
Changes the complete transform object on this node.
A PolylightEffect can be used on a node to define a LightGroup for that node.
void set_texture(Texture *tex, int priority=0)
Adds the indicated texture to the list of textures that will be rendered on the default texture stage...
static LVector3f forward(CoordinateSystem cs=CS_default)
Returns the forward vector for the given coordinate system.
NodePathCollection get_children(Thread *current_thread=Thread::get_current_thread()) const
Returns the set of all child nodes of the referenced node.
LVector3 get_pos_delta() const
Returns the delta vector from this node's position in the previous frame (according to set_prev_trans...
Indicates the set of TextureStages and their associated Textures that should be applied to (or remove...
Indicates which faces should be culled based on their vertex ordering.
PandaNode * get_stashed(int n, Thread *current_thread=Thread::get_current_thread()) const
Returns the nth stashed child of this node.
bool is_stashed() const
Returns true if the referenced node is stashed either directly, or because some ancestor is stashed...
bool has_light_off() const
Returns true if all Lights have been specifically disabled on this particular node.
const SamplerState & get_on_sampler(TextureStage *stage) const
Returns the sampler associated with the indicated stage, or the one associated with its texture if no...
void prepare_scene(GraphicsStateGuardianBase *gsg)
Walks through the scene graph beginning at the bottom node, and does whatever initialization is requi...
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
void output(ostream &out) const
Writes a sensible description of the NodePath to the indicated output stream.
void set_render_mode_thickness(PN_stdfloat thickness, int priority=0)
Sets up the point geometry at this level and below to render as thick points (that is...
bool has_light(const NodePath &light) const
Returns true if the indicated Light or PolylightNode has been specifically enabled on this particular...
void clear_light()
Completely removes any lighting operations that may have been set via set_light() or set_light_off() ...
Applies a Fog to the geometry at and below this node.
void reset_prev_transform(Thread *current_thread=Thread::get_current_thread())
Resets the transform that represents this node's "previous" position to the same as the current trans...
bool has_texture() const
Returns true if a texture has been applied to this particular node via set_texture(), false otherwise.
void clear_depth_offset()
Completely removes any depth-offset adjustment that may have been set on this node via set_depth_offs...
int get_key() const
Returns an integer that is guaranteed to be the same for all NodePaths that represent the same node i...
A lightweight class that represents a single element that may be timed and/or counted via stats...
bool has_tex_transform(TextureStage *stage) const
Returns true if there is an explicit texture matrix on the current node for the given stage...
DrawMask get_draw_show_mask() const
Returns the hide/show bits of this particular node.
void premunge_scene(GraphicsStateGuardianBase *gsg=NULL)
Walks through the scene graph beginning at the bottom node, and internally adjusts any GeomVertexForm...
Texture * get_on_texture(TextureStage *stage) const
Returns the texture associated with the indicated stage, or NULL if no texture is associated...
bool consider_node(NodePathCollection &result, FindApproxLevelEntry *&next_level, int max_matches, int increment) const
Considers the node represented by the entry for matching the find path.
InternalNameCollection find_all_vertex_columns() const
Returns a list of all vertex array columns stored on some geometry found at this node level and below...
void set_light_off(int priority=0)
Sets the geometry at this level and below to render using no lights at all.
void set_occluder(const NodePath &occluder)
Adds the indicated occluder to the list of occluders that apply to geometry at this node and below...
NodePath find(const string &path) const
Searches for a node below the referenced node that matches the indicated string.
void reparent_to(const NodePath &other, int sort=0, Thread *current_thread=Thread::get_current_thread())
Removes the referenced node of the NodePath from its current parent and attaches it to the referenced...
virtual bool put_datagram(const Datagram &data)
Writes the given datagram to the file.
void set_fog_off(int priority=0)
Sets the geometry at this level and below to render using no fog.
NodePathCollection get_stashed_children(Thread *current_thread=Thread::get_current_thread()) const
Returns the set of all child nodes of the referenced node that have been stashed. ...
PN_stdfloat get_thickness() const
Returns the line width or point thickness.
bool is_top_node(int pipeline_stage, Thread *current_thread) const
Returns true if this component represents the top node in the path.
bool verify_complete(Thread *current_thread=Thread::get_current_thread()) const
Returns true if all of the nodes described in the NodePath are connected, or false otherwise...
This node is placed at key points within the scene graph to indicate the roots of "models": subtrees ...
void heads_up(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Behaves like look_at(), but with a strong preference to keeping the up vector oriented in the indicat...
void add_match_many(int flags)
Adds a component that will match a chain of zero or more consecutive nodes.
int get_bin_draw_order() const
Returns the drawing order associated with the bin that this particular node was assigned to via set_b...
static NodePath fail()
Creates a NodePath with the ET_fail error type set.
Fog * get_fog() const
Returns the fog that has been set on this particular node, or NULL if no fog has been set...
void set_scissor(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Sets up a scissor region on the nodes rendered at this level and below.
void unstash_all(Thread *current_thread=Thread::get_current_thread())
Unstashes this node and all stashed child nodes.
void set_bin(const string &bin_name, int draw_order, int priority=0)
Assigns the geometry at this level and below to the named rendering bin.
The name of a file, such as a texture file or an Egg file.
void set_pos_quat_scale(const LVecBase3 &pos, const LQuaternion &quat, const LVecBase3 &scale)
Replaces the translation, rotation, and scale components, implicitly setting shear to 0...
bool has_effect(TypeHandle type) const
Returns true if there is a render effect of the indicated type defined on this node, or false if there is not.
NodePath attach_new_node(PandaNode *node, int sort=0, Thread *current_thread=Thread::get_current_thread()) const
Attaches a new node, with or without existing parents, to the scene graph below the referenced node o...
This is a 4-by-4 transform matrix.
void unify(PandaNode *root, bool preserve_order)
Calls unify() on every GeomNode at this level and below.
void set_quat(const LQuaternion &quat)
Sets the rotation component of the transform, leaving translation and scale untouched.
static NodePath decode_from_bam_stream(const string &data, BamReader *reader=NULL)
Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the N...
This functions similarly to a LightAttrib or ClipPlaneAttrib.
Specifies how atmospheric fog effects are applied to geometry.
bool has_color_scale() const
Returns true if a color scale has been applied to the referenced node, false otherwise.
unsigned short get_antialias() const
Returns the antialias setting that has been specifically set on this node via set_antialias(), or M_none if no setting has been made.
bool has_on_light(const NodePath &light) const
Returns true if the indicated light is turned on by the attrib, false otherwise.
void show_tight_bounds()
Similar to show_bounds(), this draws a bounding box representing the "tight" bounds of this node and ...
void clear_render_mode()
Completely removes any render mode adjustment that may have been set on this node via set_render_mode...
NodePathComponent * get_next(int pipeline_stage, Thread *current_thread) const
Returns the next component in the path.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
void set_antialias(unsigned short mode, int priority=0)
Specifies the antialiasing type that should be applied at this node and below.
int find_parent(PandaNode *node, Thread *current_thread=Thread::get_current_thread()) const
Returns the index of the indicated parent node, if it is a parent, or -1 if it is not...
int find_child(PandaNode *node, Thread *current_thread=Thread::get_current_thread()) const
Returns the index of the indicated child node, if it is a child, or -1 if it is not.
bool is_singleton(Thread *current_thread=Thread::get_current_thread()) const
Returns true if the NodePath contains exactly one node.
bool has_on_stage(TextureStage *stage) const
Returns true if the indicated stage is turned on by the attrib, false otherwise.
A container for geometry primitives.
void set_state(const RenderState *state, Thread *current_thread=Thread::get_current_thread())
Sets the complete RenderState that will be applied to all nodes at this level and below...
bool has_on_plane(const NodePath &plane) const
Returns true if the indicated plane is enabled by the attrib, false otherwise.
void set_all_color_scale(PN_stdfloat scale, int priority=0)
Scales all the color components of the object by the same amount, darkening the object, without (much) affecting alpha.
bool write_bam_file(const Filename &filename) const
Writes the contents of this node and below out to a bam file with the indicated filename.
PN_stdfloat get_volume() const
Returns the volume to be applied to sounds.
void premunge(PandaNode *root, const RenderState *initial_state)
Walks the scene graph rooted at this node and below, and uses the indicated GSG to premunge every Geo...
Texture * get_texture() const
If the TextureAttrib is not an 'off' TextureAttrib, returns the base-level texture that is associated...
This class specializes ConfigVariable as an enumerated type.
Manages a list of Texture objects, as returned by TexturePool::find_all_textures().
bool write_object(const TypedWritable *obj)
Writes a single object to the Bam file, so that the BamReader::read_object() can later correctly rest...
void clear_color_scale()
Completely removes any color scale from the referenced node.
void set_effect(const RenderEffect *effect)
Adds the indicated render effect to the scene graph on this node.
void set_into_collide_mask(CollideMask mask)
Sets the "into" CollideMask.
TextureStage * get_on_stage(int n) const
Returns the nth stage turned on by the attribute, sorted in render order.
NodePath copy_to(const NodePath &other, int sort=0, Thread *current_thread=Thread::get_current_thread()) const
Functions like instance_to(), except a deep copy is made of the referenced node and all of its descen...
LVecBase3 get_hpr() const
Retrieves the rotation component of the transform.
NodePath get_path(int index) const
Returns the nth NodePath in the collection.
const SamplerState & get_texture_sampler() const
Returns the sampler state that has been given for the base-level texture that has been set on this pa...
bool write_bam_stream(ostream &out) const
Writes the contents of this node and below out to the indicated stream.
void clear_color()
Completely removes any color adjustment from the node.
void set_fluid_pos(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Sets the translation component, without changing the "previous" position, so that the collision syste...
void set_effect(const RenderEffect *effect)
Adds the indicated render effect to the scene graph on this node.
int get_child_sort(int n, Thread *current_thread=Thread::get_current_thread()) const
Returns the sort index of the nth child node of this node (that is, the number that was passed to add...
bool has_all_off() const
Returns true if this attrib turns off all stages (although it may also turn some on).
int flatten_light()
Lightly flattens out the hierarchy below this node by applying transforms, colors, and texture matrices from the nodes onto the vertices, but does not remove any nodes.
bool has_clip_plane_off() const
Returns true if all clipping planes have been specifically disabled on this particular node...
int flatten(PandaNode *root, int combine_siblings_bits)
Simplifies the graph by removing unnecessary nodes and nodes.
bool get_depth_write() const
Returns true if depth-write rendering has been specifically set on this node via set_depth_write(), or false if depth-write rendering has been specifically disabled.
void clear_texture()
Completely removes any texture adjustment that may have been set via set_texture() or set_texture_off...
void set_tex_transform(TextureStage *stage, const TransformState *transform)
Sets the texture matrix on the current node to the indicated transform for the given stage...
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
void set_billboard_point_eye(PN_stdfloat offset=0.0)
Puts a billboard transition on the node such that it will rotate in three dimensions about the origin...
Defines the way an object appears in the presence of lighting.
LQuaternion get_quat() const
Retrieves the rotation component of the transform.
TextureStage * find_texture_stage(const string &name) const
Returns the first TextureStage found applied to geometry at this node or below that matches the indic...
LPoint3 get_pos() const
Retrieves the translation component of the transform.
void set_attrib(const RenderAttrib *attrib, int override=0)
Adds the indicated render attribute to the scene graph on this node.
Applies a scale to colors in the scene graph and on vertices.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
void set_light(const NodePath &light, int priority=0)
Adds the indicated Light or PolylightNode to the list of lights that illuminate geometry at this node...
void set_color_off(int priority=0)
Sets the geometry at this level and below to render using the geometry color.
Assigns geometry to a particular bin by name.
static NodePath removed()
Creates a NodePath with the ET_removed error type set.
Represents a set of settings that indicate how a texture is sampled.
const string & get_name() const
Returns the name of this texture stage.
void set_render_mode_filled_wireframe(const LColor &wireframe_color, int priority=0)
Sets up the geometry at this level and below (unless overridden) to render in filled, but overlay the wireframe on top with a fixed color.
bool has_scissor() const
Returns true if a scissor region was defined at this node by a previous call to set_scissor().
This is the base class for all three-component vectors and points.
void project_texture(TextureStage *stage, Texture *tex, const NodePath &projector)
A convenience function to enable projective texturing at this node level and below, using the indicated NodePath (which should contain a LensNode) as the projector.
Applies a transform matrix to UV's before they are rendered.
This class can be used to write a binary file that consists of an arbitrary header followed by a numb...
void clear_antialias()
Completely removes any antialias setting that may have been set on this node via set_antialias().
void add_name(const InternalName *name)
Adds a new InternalName to the collection.
void set_billboard_axis(PN_stdfloat offset=0.0)
Puts a billboard transition on the node such that it will rotate in two dimensions around the up axis...
void set_texture_off(int priority=0)
Sets the geometry at this level and below to render using no texture, on any stage.
void set_shear(PN_stdfloat shxy, PN_stdfloat shxz, PN_stdfloat shyz)
Sets the shear component of the transform, leaving translation, rotation, and scale untouched...
static NodePath not_found()
Creates a NodePath with the ET_not_found error type set.
void apply_attribs(PandaNode *node, int attrib_types=~(TT_clip_plane|TT_cull_face|TT_apply_texture_color))
Walks the scene graph, accumulating attribs of the indicated types, applying them to the vertices...
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
int flatten_strong()
The strongest possible flattening.
void set_hpr(PN_stdfloat h, PN_stdfloat p, PN_stdfloat r)
Sets the rotation component of the transform, leaving translation and scale untouched.
bool has_texture_off() const
Returns true if texturing has been specifically disabled on this particular node via set_texture_off(...
static const SamplerState & get_default()
Returns a reference to the global default immutable SamplerState object.
bool is_valid() const
Returns true if the WorkingNodePath object appears to be a valid NodePath reference, false otherwise.
bool has_off_stage(TextureStage *stage) const
Returns true if the indicated stage is turned off by the attrib, false otherwise. ...
void set_render_mode_wireframe(int priority=0)
Sets up the geometry at this level and below (unless overridden) to render in wireframe mode...
PandaNode * node() const
Returns the referenced node of the path.
This effect automatically applies a computed texture matrix to the specified texture stage...
Children get_children(Thread *current_thread=Thread::get_current_thread()) const
Returns an object that can be used to walk through the list of children of the node.
bool has_tex_gen(TextureStage *stage) const
Returns true if there is a mode for automatic texture coordinate generation on the current node for t...
PandaCompareFunc get_mode() const
Returns the depth write mode.
void set_pos_hpr_scale_shear(const LVecBase3 &pos, const LVecBase3 &hpr, const LVecBase3 &scale, const LVecBase3 &shear)
Completely replaces the transform with new translation, rotation, scale, and shear components...
This is the base quaternion class.
void stash_to(const NodePath &other, int sort=0, Thread *current_thread=Thread::get_current_thread())
Similar to reparent_to(), but the node is added to its new parent's stashed list, so that the result ...
A thread; that is, a lightweight process.
bool has_parent(Thread *current_thread=Thread::get_current_thread()) const
Returns true if the referenced node has a parent; i.e.
void remove_node(Thread *current_thread=Thread::get_current_thread())
Disconnects the referenced node from the scene graph.
int get_length(int pipeline_stage, Thread *current_thread) const
Returns the length of the path to this node.
bool has_all_off() const
Returns true if this attrib turns off all lights (although it may also turn some on).
void set_material_off(int priority=0)
Sets the geometry at this level and below to render using no material.
int get_num_nodes(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of nodes in the path.
This is a special kind of attribute that instructs the graphics driver to apply an offset or bias to ...
int get_stashed_sort(int n, Thread *current_thread=Thread::get_current_thread()) const
Returns the sort index of the nth stashed node of this node (that is, the number that was passed to a...
void wrt_reparent_to(const NodePath &other, int sort=0, Thread *current_thread=Thread::get_current_thread())
This functions identically to reparent_to(), except the transform on this node is also adjusted so th...
Mode get_actual_mode() const
Returns the actual culling mode, without considering the effects of the reverse flag.
void clear_effect(TypeHandle type)
Removes the render effect of the given type from this node.
LVecBase3 get_scale() const
Retrieves the scale component of the transform.
const LColor & get_wireframe_color() const
Returns the color that is used in M_filled_wireframe mode to distinguish the wireframe from the rest ...
void set_depth_offset(int bias, int priority=0)
This instructs the graphics driver to apply an offset or bias to the generated depth values for rende...
NodePath get_parent(Thread *current_thread=Thread::get_current_thread()) const
Returns the NodePath to the parent of the referenced node: that is, this NodePath, shortened by one node.
const string & get_bin_name() const
Returns the name of the bin this attribute specifies.
bool is_off() const
Returns true if the MaterialAttrib is an 'off' MaterialAttrib, indicating that it should disable the ...
NodePath get_top(Thread *current_thread=Thread::get_current_thread()) const
Returns a singleton NodePath that represents the top of the path, or empty NodePath if this path is e...
void set_mat(const LMatrix4 &mat)
Directly sets an arbitrary 4x4 transform matrix.
TextureStageCollection find_all_texture_stages() const
Returns a list of a TextureStages applied to geometry at this node and below.
bool add_string(const string &str_path)
Adds a sequence of components separated by slashes, followed optionally by a semicolon and a sequence...
Specifies how polygons are to be drawn.
void clear_occluder()
Completely removes any occluders that may have been set via set_occluder() from this particular node...
int get_num_on_stages() const
Returns the number of stages that are turned on by the attribute.
Indicates what color should be applied to renderable geometry.
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
string encode_to_bam_stream() const
Converts the NodePath object into a single stream of data using a BamWriter, and returns that data as...
void set_render_mode_perspective(bool perspective, int priority=0)
Sets up the point geometry at this level and below to render as perspective sprites (that is...
NodePath find_path_to(PandaNode *node) const
Searches for the indicated node below this node and returns the shortest NodePath that connects them...
PN_stdfloat get_audio_volume() const
Returns the complete audio volume that has been applied to this node via a previous call to set_audio...
const LMatrix4 & get_mat() const
Returns the transform matrix that has been applied to the referenced node, or the identity matrix if ...
bool has_depth_test() const
Returns true if a depth-test adjustment has been explicitly set on this particular node via set_depth...
bool has_off_light(const NodePath &light) const
Returns true if the indicated light is turned off by the attrib, false otherwise. ...
void stash(int sort=0, Thread *current_thread=Thread::get_current_thread())
Removes the referenced node (and the entire subgraph below this node) from the scene graph in any nor...
void set_pos_hpr_scale(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat h, PN_stdfloat p, PN_stdfloat r, PN_stdfloat sx, PN_stdfloat sy, PN_stdfloat sz)
Completely replaces the transform with new translation, rotation, and scale components.
void add_int32(PN_int32 value)
Adds a signed 32-bit integer to the datagram.
bool has_two_sided() const
Returns true if a two-sided adjustment has been explicitly set on this particular node via set_two_si...
void set_transparency(TransparencyAttrib::Mode mode, int priority=0)
Specifically sets or disables transparent rendering mode on this particular node. ...
A class to retrieve the individual data elements previously stored in a Datagram. ...
const InternalName * get_name() const
Returns the name of this particular data field, e.g.
bool get_depth_test() const
Returns true if depth-test rendering has been specifically set on this node via set_depth_test(), or false if depth-test rendering has been specifically disabled.
LPoint3 get_relative_point(const NodePath &other, const LVecBase3 &point) const
Given that the indicated point is in the coordinate system of the other node, returns the same point ...
void clear_effect(TypeHandle type)
Removes the render effect of the given type from this node.
void set_geom_state(int n, const RenderState *state)
Changes the RenderState associated with the nth geom of the node.
PandaNode * get_child(int n) const
Returns the nth child of the node.
bool open_write(const Filename &bam_filename, bool report_errors=true)
Attempts to open the indicated file for writing.
TypeHandle is the identifier used to differentiate C++ class types.
void set_preserve_transform(PreserveTransform preserve_transform)
Sets the preserve_transform flag.
const TransformState * get_transform(Thread *current_thread=Thread::get_current_thread()) const
Returns the complete transform object set on this node.
void set_tex_projector(TextureStage *stage, const NodePath &from, const NodePath &to, int lens_index=0)
Establishes a TexProjectorEffect on this node, which can be used to establish projective texturing (b...
void clear_tex_transform()
Removes all texture matrices from the current node.
bool is_off() const
Returns true if the FogAttrib is an 'off' FogAttrib, indicating that it should disable fog...
static TextureStage * get_default()
Returns the default TextureStage that will be used for all texturing that does not name a particular ...
int find_stashed(PandaNode *node, Thread *current_thread=Thread::get_current_thread()) const
Returns the index of the indicated stashed node, if it is a stashed child, or -1 if it is not...
virtual bool is_geom_node() const
A simple downcast check.
NodePath get_tex_projector_from(TextureStage *stage) const
Returns the "from" node associated with the TexProjectorEffect on the indicated stage.
NodePathCollection find_all_matches(const string &path) const
Returns the complete set of all NodePaths that begin with this NodePath and can be extended by path...
bool normalize()
Normalizes the vector in place.
Defines the properties of a named stage of the multitexture pipeline.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Computes texture coordinates for geometry automatically based on vertex position and/or normal...
void clear_fog()
Completely removes any fog adjustment that may have been set via set_fog() or set_fog_off() from this...
LVecBase3 get_shear() const
Retrieves the shear component of the transform.
int flatten_medium()
A more thorough flattening than flatten_light(), this first applies all the transforms, colors, and texture matrices from the nodes onto the vertices, and then removes unneeded grouping nodes–nodes that have exactly one child, for instance, but have no special properties in themselves.
bool get_two_sided() const
Returns true if two-sided rendering has been specifically set on this node via set_two_sided(), or false if one-sided rendering has been specifically set, or if nothing has been specifically set.
void set_two_sided(bool two_sided, int priority=0)
Specifically sets or disables two-sided rendering mode on this particular node.
void detach_node(Thread *current_thread=Thread::get_current_thread())
Disconnects the referenced node from its parent, but does not immediately delete it.
PandaNode * get_node(int index, Thread *current_thread=Thread::get_current_thread()) const
Returns the nth node of the path, where 0 is the referenced (bottom) node and get_num_nodes() - 1 is ...
LVecBase3f get_row3(int row) const
Retrieves the row column of the matrix as a 3-component vector, ignoring the last column...
NodePath get_tex_projector_to(TextureStage *stage) const
Returns the "to" node associated with the TexProjectorEffect on the indicated stage.
bool has_compass() const
Returns true if there is any compass effect on the node.
bool has_depth_write() const
Returns true if a depth-write adjustment has been explicitly set on this particular node via set_dept...
Applies a scale to audio volume for positional sounds in the scene graph.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
void set_state(const RenderState *state, Thread *current_thread=Thread::get_current_thread())
Changes the complete state object on this node.
void do_billboard_point_world(const NodePath &camera, PN_stdfloat offset)
Performs a billboard-type rotate to the indicated camera node, one time only, and leaves the object r...
static LVector3f up(CoordinateSystem cs=CS_default)
Returns the up vector for the given coordinate system.
This represents a unique collection of RenderEffect objects that correspond to a particular renderabl...
InternalNameCollection find_all_texcoords() const
Returns a list of all texture coordinate sets used by any geometry at this node level and below...
bool has_transparency() const
Returns true if a transparent-rendering adjustment has been explicitly set on this particular node vi...
void clear_tex_projector()
Removes the TexProjectorEffect for all stages from this node.
A node that holds Geom objects, renderable pieces of geometry.
void set_color_scale(const LVecBase4 &scale, int priority=0)
Sets the color scale component of the transform, leaving translation and rotation untouched...
void set_clip_plane_off(int priority=0)
Sets the geometry at this level and below to render using no clip_planes at all.
bool has_clip_plane(const NodePath &clip_plane) const
Returns true if the indicated clipping plane has been specifically applied to this particular node...
bool has_render_mode() const
Returns true if a render mode has been explicitly set on this particular node via set_render_mode() (...
This class can be used to test for string matches against standard Unix-shell filename globbing conve...
void clear_compass()
Removes any compass effect from the node.
int make_compatible_state(PandaNode *root)
Searches for GeomNodes that contain multiple Geoms that differ only in their ColorAttribs.
Indicates which set of lights should be considered "on" to illuminate geometry at this level and belo...
void set_billboard_point_world(PN_stdfloat offset=0.0)
Puts a billboard transition on the node such that it will rotate in three dimensions about the origin...
const TransformState * get_prev_transform(Thread *current_thread=Thread::get_current_thread()) const
Returns the transform that has been set as this node's "previous" position.
const RenderState * get_state(Thread *current_thread=Thread::get_current_thread()) const
Returns the complete state object set on this node.
bool has_bin() const
Returns true if the node has been assigned to the a particular rendering bin via set_bin(), false otherwise.
PN_stdfloat get_net_audio_volume() const
Returns the complete audio volume for this node taking highers nodes in the graph into account...
This is one component of a NodePath.
int get_sort(Thread *current_thread=Thread::get_current_thread()) const
Returns the sort value of the referenced node within its parent; that is, the sort number passed on t...
This is a set of zero or more NodePaths.
void look_at(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Sets the transform on this NodePath so that it rotates to face the indicated point in space...