79 using std::ostringstream;
84 int NodePath::_max_search_depth = 7000;
87 PStatCollector NodePath::_get_transform_pcollector(
"*:NodePath:get_transform");
88 PStatCollector NodePath::_verify_complete_pcollector(
"*:NodePath:verify_complete");
99 nassertv(child_node !=
nullptr);
104 _head = PandaNode::get_top_component(child_node,
true,
105 pipeline_stage, current_thread);
108 _head = PandaNode::get_component(parent._head, child_node, pipeline_stage,
111 nassertv(_head !=
nullptr);
113 if (_head !=
nullptr) {
124 operator bool ()
const {
137 return _head->get_length(pipeline_stage, current_thread);
162 nassertr(comp !=
nullptr,
nullptr);
163 comp = comp->
get_next(pipeline_stage, current_thread);
169 nassertr(comp !=
nullptr,
nullptr);
191 comp = comp->
get_next(pipeline_stage, current_thread);
217 while (!comp->
is_top_node(pipeline_stage, current_thread)) {
218 comp = comp->
get_next(pipeline_stage, current_thread);
234 nassertr_always(!
is_empty(), result);
242 for (
int i = 0; i < num_children; i++) {
244 child._head = PandaNode::get_component(_head, cr.
get_child(i),
245 pipeline_stage, current_thread);
260 nassertr_always(!
is_empty(), result);
267 for (
int i = 0; i < num_stashed; i++) {
269 stashed._head = PandaNode::get_component(_head, bottom_node->
get_stashed(i),
270 pipeline_stage, current_thread);
291 PandaNode *parent = _head->get_next(pipeline_stage, current_thread)->get_node();
293 nassertr(parent !=
nullptr && child !=
nullptr, 0);
295 if (child_index != -1) {
300 if (child_index != -1) {
314 find(
const string &path)
const {
318 find_matches(col, path, 1);
340 find_matches(col, approx_path, 1);
358 find_matches(col, path, -1);
371 nassertr(
node !=
nullptr, col);
375 find_matches(col, approx_path, -1);
395 nassertv(other._error_type == ET_ok);
401 bool reparented = PandaNode::reparent(other._head, _head, sort,
false,
402 pipeline_stage, current_thread);
403 nassertv(reparented);
416 nassertv(other._error_type == ET_ok);
422 bool reparented = PandaNode::reparent(other._head, _head, sort,
true,
423 pipeline_stage, current_thread);
424 nassertv(reparented);
437 nassertv(other._error_type == ET_ok);
481 new_instance._head = PandaNode::attach(
nullptr,
node(), sort, pipeline_stage,
485 bool reparented = PandaNode::reparent(other._head, new_instance._head,
486 sort,
false, pipeline_stage,
501 nassertr(reparented, new_instance);
519 Thread *current_thread)
const {
539 nassertr(other._error_type == ET_ok,
fail());
542 PT(
PandaNode) copy_node = source_node->copy_subgraph(current_thread);
543 nassertr(copy_node !=
nullptr,
fail());
545 copy_node->reset_prev_transform(current_thread);
570 new_path._head = PandaNode::attach(_head,
node, sort, pipeline_stage,
592 nassertv(_error_type != ET_not_found);
600 PandaNode::detach(_head, pipeline_stage, current_thread);
603 if (
is_empty() || _head->has_key()) {
632 nassertv(_error_type != ET_not_found);
636 PandaNode::detach(_head, pipeline_stage, current_thread);
649 indent_level =
get_parent().reverse_ls(out, indent_level);
651 node()->write(out, indent_level);
652 return indent_level + 2;
661 switch (_error_type) {
663 out <<
"**not found**";
666 out <<
"**removed**";
675 if (_head ==
nullptr) {
689 nassertr_always(!
is_empty(), RenderState::make_empty());
690 return node()->get_state(current_thread);
699 nassertr(_error_type == ET_ok && other._error_type == ET_ok, RenderState::make_empty());
702 return get_net_state(current_thread);
705 return other.get_net_state(current_thread)->invert_compose(RenderState::make_empty());
708 #if defined(_DEBUG) || (defined(HAVE_THREADS) && defined(SIMPLE_THREADS)) 710 nassertr(other.
verify_complete(current_thread), RenderState::make_empty());
713 int a_count, b_count;
714 if (find_common_ancestor(*
this, other, a_count, b_count, current_thread) ==
nullptr) {
715 if (allow_unrelated_wrt) {
717 << *
this <<
" is not related to " << other <<
"\n";
720 << *
this <<
" is not related to " << other <<
"\n";
721 nassert_raise(
"unrelated nodes");
722 return RenderState::make_empty();
726 CPT(
RenderState) a_state = r_get_partial_state(_head, a_count, current_thread);
727 CPT(
RenderState) b_state = r_get_partial_state(other._head, b_count, current_thread);
728 return b_state->invert_compose(a_state);
739 nassertv(_error_type == ET_ok && other._error_type == ET_ok);
750 CPT(
RenderState) new_state = rel_state->compose(state);
761 nassertr_always(!
is_empty(), TransformState::make_identity());
762 return node()->get_transform(current_thread);
771 nassertr(_error_type == ET_ok && other._error_type == ET_ok, TransformState::make_identity());
775 return get_net_transform(current_thread);
778 return other.get_net_transform(current_thread)->invert_compose(TransformState::make_identity());
781 #if defined(_DEBUG) || (defined(HAVE_THREADS) && defined(SIMPLE_THREADS)) 782 nassertr(
verify_complete(current_thread), TransformState::make_identity());
783 nassertr(other.
verify_complete(current_thread), TransformState::make_identity());
786 int a_count, b_count;
787 if (find_common_ancestor(*
this, other, a_count, b_count, current_thread) ==
nullptr) {
788 if (allow_unrelated_wrt) {
789 if (pgraph_cat.is_debug()) {
791 << *
this <<
" is not related to " << other <<
"\n";
795 << *
this <<
" is not related to " << other <<
"\n";
796 nassert_raise(
"unrelated nodes");
797 return TransformState::make_identity();
803 a_transform = r_get_partial_transform(_head, a_count, current_thread);
804 if (a_transform !=
nullptr) {
805 b_transform = r_get_partial_transform(other._head, b_count, current_thread);
807 if (b_transform ==
nullptr) {
811 a_transform = r_get_net_transform(_head, current_thread);
812 b_transform = r_get_net_transform(other._head, current_thread);
815 return b_transform->invert_compose(a_transform);
826 nassertv(_error_type == ET_ok && other._error_type == ET_ok);
849 nassertr_always(!
is_empty(), TransformState::make_identity());
850 return node()->get_prev_transform(current_thread);
860 nassertr(_error_type == ET_ok && other._error_type == ET_ok, TransformState::make_identity());
863 return get_net_prev_transform(current_thread);
866 return other.get_net_prev_transform(current_thread)->invert_compose(TransformState::make_identity());
869 #if defined(_DEBUG) || (defined(HAVE_THREADS) && defined(SIMPLE_THREADS)) 870 nassertr(
verify_complete(current_thread), TransformState::make_identity());
871 nassertr(other.
verify_complete(current_thread), TransformState::make_identity());
874 int a_count, b_count;
875 if (find_common_ancestor(*
this, other, a_count, b_count, current_thread) ==
nullptr) {
876 if (allow_unrelated_wrt) {
878 << *
this <<
" is not related to " << other <<
"\n";
881 << *
this <<
" is not related to " << other <<
"\n";
882 nassert_raise(
"unrelated nodes");
883 return TransformState::make_identity();
887 CPT(
TransformState) a_prev_transform = r_get_partial_prev_transform(_head, a_count, current_thread);
888 CPT(
TransformState) b_prev_transform = r_get_partial_prev_transform(other._head, b_count, current_thread);
889 return b_prev_transform->invert_compose(a_prev_transform);
900 nassertv(_error_type == ET_ok && other._error_type == ET_ok);
912 set_prev_transform(new_trans, current_thread);
923 set_pos(
const LVecBase3 &pos) {
930 set_x(PN_stdfloat x) {
938 set_y(PN_stdfloat y) {
946 set_z(PN_stdfloat z) {
965 set_fluid_x(PN_stdfloat x) {
973 set_fluid_y(PN_stdfloat y) {
981 set_fluid_z(PN_stdfloat z) {
993 nassertr_always(!
is_empty(), LPoint3(0.0f, 0.0f, 0.0f));
1008 nassertr_always(!
is_empty(), LPoint3(0.0f, 0.0f, 0.0f));
1020 nassertv(transform->
has_hpr());
1025 set_h(PN_stdfloat h) {
1028 nassertv(transform->
has_hpr());
1029 LVecBase3 hpr = transform->
get_hpr();
1035 set_p(PN_stdfloat p) {
1038 nassertv(transform->
has_hpr());
1039 LVecBase3 hpr = transform->
get_hpr();
1045 set_r(PN_stdfloat r) {
1048 nassertv(transform->
has_hpr());
1049 LVecBase3 hpr = transform->
get_hpr();
1059 nassertr_always(!
is_empty(), LVecBase3(0.0f, 0.0f, 0.0f));
1061 nassertr(transform->
has_hpr(), LVecBase3(0.0f, 0.0f, 0.0f));
1081 nassertr_always(!
is_empty(), LQuaternion::ident_quat());
1098 set_sx(PN_stdfloat sx) {
1101 LVecBase3 scale = transform->
get_scale();
1107 set_sy(PN_stdfloat sy) {
1110 LVecBase3 scale = transform->
get_scale();
1116 set_sz(PN_stdfloat sz) {
1119 LVecBase3 scale = transform->
get_scale();
1129 nassertr_always(!
is_empty(), LVecBase3(0.0f, 0.0f, 0.0f));
1146 set_shxy(PN_stdfloat shxy) {
1149 LVecBase3 shear = transform->
get_shear();
1155 set_shxz(PN_stdfloat shxz) {
1158 LVecBase3 shear = transform->
get_shear();
1164 set_shyz(PN_stdfloat shyz) {
1167 LVecBase3 shear = transform->
get_shear();
1177 nassertr_always(!
is_empty(), LVecBase3(0.0f, 0.0f, 0.0f));
1190 transform = TransformState::make_pos_hpr_scale_shear
1204 transform = TransformState::make_pos_quat_scale_shear
1218 transform = TransformState::make_pos_hpr_scale_shear
1231 transform = TransformState::make_pos_quat_scale_shear
1242 const LVecBase3 &scale) {
1255 const LVecBase3 &scale) {
1258 (pos, quat, scale));
1268 const LVecBase3 &scale,
const LVecBase3 &shear) {
1271 (pos, hpr, scale, shear));
1281 const LVecBase3 &scale,
const LVecBase3 &shear) {
1284 (pos, quat, scale, shear));
1303 look_at(
const LPoint3 &point,
const LVector3 &up) {
1338 if (orig_transform->has_components()) {
1343 const LVecBase3 &orig_hpr = orig_transform->get_hpr();
1344 const LVecBase3 &orig_scale = orig_transform->get_scale();
1345 const LVecBase3 &orig_shear = orig_transform->get_shear();
1358 set_x(
const NodePath &other, PN_stdfloat x) {
1362 set_pos(other, pos);
1366 set_y(
const NodePath &other, PN_stdfloat y) {
1370 set_pos(other, pos);
1374 set_z(
const NodePath &other, PN_stdfloat z) {
1378 set_pos(other, pos);
1391 if (orig_transform->has_components()) {
1396 const LVecBase3 &orig_hpr = orig_transform->get_hpr();
1397 const LVecBase3 &orig_scale = orig_transform->get_scale();
1398 const LVecBase3 &orig_shear = orig_transform->get_shear();
1413 set_fluid_x(
const NodePath &other, PN_stdfloat x) {
1421 set_fluid_y(
const NodePath &other, PN_stdfloat y) {
1429 set_fluid_z(
const NodePath &other, PN_stdfloat z) {
1442 nassertr_always(!
is_empty(), LPoint3(0.0f, 0.0f, 0.0f));
1457 nassertr_always(!
is_empty(), LPoint3(0.0f, 0.0f, 0.0f));
1468 nassertv(rel_transform->has_hpr());
1471 if (transform->has_components()) {
1476 const LVecBase3 &orig_pos = transform->get_pos();
1477 const LVecBase3 &orig_scale = transform->get_scale();
1478 const LVecBase3 &orig_shear = transform->get_shear();
1482 if (transform->has_components()) {
1484 (orig_pos, transform->get_hpr(), orig_scale, orig_shear));
1494 set_h(
const NodePath &other, PN_stdfloat h) {
1496 LVecBase3 hpr =
get_hpr(other);
1502 set_p(
const NodePath &other, PN_stdfloat p) {
1504 LVecBase3 hpr =
get_hpr(other);
1510 set_r(
const NodePath &other, PN_stdfloat r) {
1512 LVecBase3 hpr =
get_hpr(other);
1523 nassertr_always(!
is_empty(), LVecBase3(0.0f, 0.0f, 0.0f));
1525 nassertr(transform->
has_hpr(), LVecBase3(0.0f, 0.0f, 0.0f));
1543 const LVecBase3 &orig_pos = transform->
get_pos();
1544 const LVecBase3 &orig_scale = transform->
get_scale();
1545 const LVecBase3 &orig_shear = transform->
get_shear();
1549 if (transform->has_components()) {
1551 (orig_pos, transform->get_quat(), orig_scale, orig_shear));
1566 nassertr_always(!
is_empty(), LQuaternion::ident_quat());
1585 const LVecBase3 &orig_pos = transform->
get_pos();
1586 const LVecBase3 &orig_hpr = transform->
get_hpr();
1587 const LVecBase3 &orig_shear = transform->
get_shear();
1591 if (transform->has_components()) {
1593 (orig_pos, orig_hpr, transform->get_scale(), orig_shear));
1603 set_sx(
const NodePath &other, PN_stdfloat sx) {
1611 set_sy(
const NodePath &other, PN_stdfloat sy) {
1619 set_sz(
const NodePath &other, PN_stdfloat sz) {
1631 nassertr_always(!
is_empty(), LVecBase3(0.0f, 0.0f, 0.0f));
1650 const LVecBase3 &orig_pos = transform->
get_pos();
1651 const LVecBase3 &orig_hpr = transform->
get_hpr();
1652 const LVecBase3 &orig_scale = transform->
get_scale();
1656 if (transform->has_components()) {
1658 (orig_pos, orig_hpr, orig_scale, transform->get_shear()));
1668 set_shxy(
const NodePath &other, PN_stdfloat shxy) {
1676 set_shxz(
const NodePath &other, PN_stdfloat shxz) {
1684 set_shyz(
const NodePath &other, PN_stdfloat shyz) {
1696 nassertr_always(!
is_empty(), LVecBase3(0.0f, 0.0f, 0.0f));
1707 const LVecBase3 &hpr) {
1717 const LVecBase3 &orig_scale = transform->
get_scale();
1718 const LVecBase3 &orig_shear = transform->
get_shear();
1720 set_transform(other, TransformState::make_pos_hpr_scale_shear
1721 (pos, hpr, rel_transform->get_scale(), rel_transform->get_shear()));
1725 orig_scale, orig_shear);
1730 set_transform(other, TransformState::make_pos_hpr_scale_shear
1731 (pos, hpr, rel_transform->get_scale(), rel_transform->get_shear()));
1742 const LQuaternion &quat) {
1752 const LVecBase3 &orig_scale = transform->
get_scale();
1753 const LVecBase3 &orig_shear = transform->
get_shear();
1755 set_transform(other, TransformState::make_pos_quat_scale_shear
1756 (pos, quat, rel_transform->get_scale(), rel_transform->get_shear()));
1760 orig_scale, orig_shear);
1765 set_transform(other, TransformState::make_pos_quat_scale_shear
1766 (pos, quat, rel_transform->get_scale(), rel_transform->get_shear()));
1783 transform = TransformState::make_pos_hpr_scale_shear
1795 const LVecBase3 &scale) {
1801 transform = TransformState::make_pos_quat_scale_shear
1812 const LVecBase3 &pos,
const LVecBase3 &hpr,
1813 const LVecBase3 &scale) {
1826 const LVecBase3 &pos,
const LQuaternion &quat,
1827 const LVecBase3 &scale) {
1830 (pos, quat, scale));
1840 const LVecBase3 &pos,
const LVecBase3 &hpr,
1841 const LVecBase3 &scale,
const LVecBase3 &shear) {
1843 set_transform(other, TransformState::make_pos_hpr_scale_shear
1844 (pos, hpr, scale, shear));
1854 const LVecBase3 &pos,
const LQuaternion &quat,
1855 const LVecBase3 &scale,
const LVecBase3 &shear) {
1857 set_transform(other, TransformState::make_pos_quat_scale_shear
1858 (pos, quat, scale, shear));
1894 LPoint3 rel_point = LPoint3(point) * transform->
get_mat();
1905 LVector3 rel_vector = LVector3(vec) * transform->
get_mat();
1918 LPoint3 rel_point = point * transform->
get_mat();
1936 LPoint3 rel_point = point * transform->
get_mat();
1952 set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a,
1954 set_color(LColor(r, g, b, a), priority);
1988 node()->clear_attrib(ColorAttrib::get_class_slot());
1997 nassertr_always(!
is_empty(),
false);
1998 return node()->has_attrib(ColorAttrib::get_class_slot());
2007 nassertr_always(!
is_empty(),
false);
2009 node()->get_attrib(ColorAttrib::get_class_slot());
2010 if (attrib !=
nullptr) {
2017 pgraph_cat.warning()
2018 <<
"get_color() called on " << *
this <<
" which has no color set.\n";
2020 return LColor(1.0f, 1.0f, 1.0f, 1.0f);
2030 nassertr_always(!
is_empty(),
false);
2031 return node()->has_attrib(ColorScaleAttrib::get_class_slot());
2042 node()->clear_attrib(ColorScaleAttrib::get_class_slot());
2054 node()->get_attrib(ColorScaleAttrib::get_class_slot());
2055 if (attrib !=
nullptr) {
2056 priority = max(priority,
2057 node()->
get_state()->get_override(ColorScaleAttrib::get_class_slot()));
2062 LVecBase4 prev_color_scale = csa->
get_scale();
2063 LVecBase4 new_color_scale(prev_color_scale[0]*scale[0],
2064 prev_color_scale[1]*scale[1],
2065 prev_color_scale[2]*scale[2],
2066 prev_color_scale[3]*scale[3]);
2084 node()->get_attrib(ColorScaleAttrib::get_class_slot());
2085 if (attrib !=
nullptr) {
2086 priority = max(priority,
2087 node()->
get_state()->get_override(ColorScaleAttrib::get_class_slot()));
2126 node()->get_attrib(ColorScaleAttrib::get_class_slot());
2127 if (attrib !=
nullptr) {
2128 priority = max(priority,
2129 node()->
get_state()->get_override(ColorScaleAttrib::get_class_slot()));
2134 node()->
set_attrib(csa->set_scale(LVecBase4(sc[0], sc[1], sc[2], scale)), priority);
2138 node()->
set_attrib(ColorScaleAttrib::make(LVecBase4(1.0f, 1.0f, 1.0f, scale)), priority);
2152 node()->get_attrib(ColorScaleAttrib::get_class_slot());
2153 if (attrib !=
nullptr) {
2154 priority = max(priority,
2155 node()->
get_state()->get_override(ColorScaleAttrib::get_class_slot()));
2160 node()->
set_attrib(csa->set_scale(LVecBase4(scale, scale, scale, sc[3])), priority);
2164 node()->
set_attrib(ColorScaleAttrib::make(LVecBase4(scale, scale, scale, 1.0f)), priority);
2175 static const LVecBase4 ident_scale(1.0f, 1.0f, 1.0f, 1.0f);
2176 nassertr_always(!
is_empty(), ident_scale);
2178 node()->get_attrib(ColorScaleAttrib::get_class_slot());
2179 if (attrib !=
nullptr) {
2198 if (light_obj !=
nullptr) {
2201 node()->get_attrib(LightAttrib::get_class_slot());
2202 if (attrib !=
nullptr) {
2203 priority = max(priority,
2204 node()->
get_state()->get_override(LightAttrib::get_class_slot()));
2217 }
else if (light.
node()->
is_of_type(PolylightNode::get_class_type())) {
2219 if (priority != 0) {
2222 pgraph_cat.warning()
2223 <<
"Ignoring priority on set_light(" << light <<
")\n";
2227 node()->get_effect(PolylightEffect::get_class_type());
2228 if (effect !=
nullptr) {
2242 nassert_raise(
"Not a Light object.");
2276 if (light_obj !=
nullptr) {
2278 node()->get_attrib(LightAttrib::get_class_slot());
2279 if (attrib !=
nullptr) {
2280 priority = max(priority,
2281 node()->
get_state()->get_override(LightAttrib::get_class_slot()));
2298 nassert_raise(
"Not a Light object.");
2308 node()->clear_attrib(LightAttrib::get_class_slot());
2322 if (light_obj !=
nullptr) {
2324 node()->get_attrib(LightAttrib::get_class_slot());
2325 if (attrib !=
nullptr) {
2327 la = DCAST(
LightAttrib, la->remove_on_light(light));
2328 la = DCAST(
LightAttrib, la->remove_off_light(light));
2330 if (la->is_identity()) {
2331 node()->clear_attrib(LightAttrib::get_class_slot());
2334 int priority =
node()->get_state()->get_override(LightAttrib::get_class_slot());
2340 }
else if (light.
node()->
is_of_type(PolylightNode::get_class_type())) {
2342 node()->get_effect(PolylightEffect::get_class_type());
2343 if (effect !=
nullptr) {
2351 nassert_raise(
"Not a Light object.");
2361 nassertr_always(!
is_empty(),
false);
2365 if (light_obj !=
nullptr) {
2367 node()->get_attrib(LightAttrib::get_class_slot());
2368 if (attrib !=
nullptr) {
2374 }
else if (light.
node()->
is_of_type(PolylightNode::get_class_type())) {
2376 node()->get_effect(PolylightEffect::get_class_type());
2377 if (effect !=
nullptr) {
2379 return ple->has_light(light);
2384 nassert_raise(
"Not a Light object.");
2395 nassertr_always(!
is_empty(),
false);
2398 node()->get_attrib(LightAttrib::get_class_slot());
2399 if (attrib !=
nullptr) {
2417 nassertr_always(!
is_empty(),
false);
2420 if (light_obj !=
nullptr) {
2422 node()->get_attrib(LightAttrib::get_class_slot());
2423 if (attrib !=
nullptr) {
2429 nassert_raise(
"Not a Light object.");
2445 node()->get_attrib(ClipPlaneAttrib::get_class_slot());
2446 if (attrib !=
nullptr) {
2447 priority = max(priority,
2448 node()->
get_state()->get_override(ClipPlaneAttrib::get_class_slot()));
2461 nassert_raise(
"Not a PlaneNode object.");
2493 node()->get_attrib(ClipPlaneAttrib::get_class_slot());
2494 if (attrib !=
nullptr) {
2495 priority = max(priority,
2496 node()->
get_state()->get_override(ClipPlaneAttrib::get_class_slot()));
2512 nassert_raise(
"Not a PlaneNode object.");
2522 node()->clear_attrib(ClipPlaneAttrib::get_class_slot());
2534 node()->get_attrib(ClipPlaneAttrib::get_class_slot());
2535 if (attrib !=
nullptr) {
2540 if (la->is_identity()) {
2541 node()->clear_attrib(ClipPlaneAttrib::get_class_slot());
2544 int priority =
node()->get_state()->get_override(ClipPlaneAttrib::get_class_slot());
2550 nassert_raise(
"Not a PlaneNode object.");
2560 nassertr_always(!
is_empty(),
false);
2564 node()->get_attrib(ClipPlaneAttrib::get_class_slot());
2565 if (attrib !=
nullptr) {
2571 nassert_raise(
"Not a PlaneNode object.");
2582 nassertr_always(!
is_empty(),
false);
2585 node()->get_attrib(ClipPlaneAttrib::get_class_slot());
2586 if (attrib !=
nullptr) {
2601 nassertr_always(!
is_empty(),
false);
2604 node()->get_attrib(ClipPlaneAttrib::get_class_slot());
2605 if (attrib !=
nullptr) {
2610 nassert_raise(
"Not a PlaneNode object.");
2626 node()->get_effect(OccluderEffect::get_class_type());
2627 if (effect !=
nullptr) {
2640 nassert_raise(
"Not an OccluderNode object.");
2662 node()->get_effect(OccluderEffect::get_class_type());
2663 if (effect !=
nullptr) {
2667 if (la->is_identity()) {
2676 nassert_raise(
"Not an OccluderNode object.");
2686 nassertr_always(!
is_empty(),
false);
2690 node()->get_effect(OccluderEffect::get_class_type());
2691 if (effect !=
nullptr) {
2697 nassert_raise(
"Not an OccluderNode object.");
2709 set_scissor(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
2710 set_effect(ScissorEffect::make_screen(LVecBase4(left, right, bottom, top)));
2733 const LPoint3 &c,
const LPoint3 &d) {
2734 set_effect(ScissorEffect::make_node(a, b, c, d));
2745 set_effect(ScissorEffect::make_node(a, b, other));
2757 const LPoint3 &a,
const LPoint3 &b,
2758 const LPoint3 &c,
const LPoint3 &d) {
2759 set_effect(ScissorEffect::make_node(a, b, c, d, other));
2780 return has_effect(ScissorEffect::get_class_type());
2801 set_bin(
const string &bin_name,
int draw_order,
int priority) {
2803 node()->
set_attrib(CullBinAttrib::make(bin_name, draw_order), priority);
2813 node()->clear_attrib(CullBinAttrib::get_class_slot());
2822 nassertr_always(!
is_empty(),
false);
2823 return node()->has_attrib(CullBinAttrib::get_class_slot());
2833 nassertr_always(!
is_empty(),
string());
2835 node()->get_attrib(CullBinAttrib::get_class_slot());
2836 if (attrib !=
nullptr) {
2851 nassertr_always(!
is_empty(),
false);
2853 node()->get_attrib(CullBinAttrib::get_class_slot());
2854 if (attrib !=
nullptr) {
2889 node()->get_attrib(TextureAttrib::get_class_slot());
2890 if (attrib !=
nullptr) {
2892 int sg_priority =
node()->get_state()->get_override(TextureAttrib::get_class_slot());
2895 node()->
set_attrib(tsa->add_on_stage(stage, tex, priority), sg_priority);
2939 node()->get_attrib(TextureAttrib::get_class_slot());
2940 if (attrib !=
nullptr) {
2942 int sg_priority =
node()->get_state()->get_override(TextureAttrib::get_class_slot());
2945 node()->
set_attrib(tsa->add_on_stage(stage, tex, sampler, priority), sg_priority);
2950 node()->
set_attrib(tsa->add_on_stage(stage, tex, sampler, priority));
2977 node()->get_attrib(TextureAttrib::get_class_slot());
2978 if (attrib !=
nullptr) {
2980 int sg_priority =
node()->get_state()->get_override(TextureAttrib::get_class_slot());
2985 node()->
set_attrib(tsa->add_off_stage(stage, priority), sg_priority);
3004 node()->clear_attrib(TextureAttrib::get_class_slot());
3015 node()->get_attrib(TextureAttrib::get_class_slot());
3016 if (attrib !=
nullptr) {
3021 if (tsa->is_identity()) {
3022 node()->clear_attrib(TextureAttrib::get_class_slot());
3025 int priority =
node()->get_state()->get_override(TextureAttrib::get_class_slot());
3050 nassertr_always(!
is_empty(),
false);
3053 node()->get_attrib(TextureAttrib::get_class_slot());
3054 if (attrib !=
nullptr) {
3070 nassertr_always(!
is_empty(),
false);
3072 node()->get_attrib(TextureAttrib::get_class_slot());
3073 if (attrib !=
nullptr) {
3089 nassertr_always(!
is_empty(),
false);
3092 node()->get_attrib(TextureAttrib::get_class_slot());
3093 if (attrib !=
nullptr) {
3111 nassertr_always(!
is_empty(),
nullptr);
3113 node()->get_attrib(TextureAttrib::get_class_slot());
3114 if (attrib !=
nullptr) {
3128 nassertr_always(!
is_empty(),
nullptr);
3130 node()->get_attrib(TextureAttrib::get_class_slot());
3131 if (attrib !=
nullptr) {
3164 node()->get_attrib(TextureAttrib::get_class_slot());
3175 set_shader(
const Shader *sha,
int priority) {
3179 node()->get_attrib(ShaderAttrib::get_class_slot());
3180 if (attrib !=
nullptr) {
3181 priority = max(priority,
3182 node()->
get_state()->get_override(ShaderAttrib::get_class_slot()));
3196 set_shader_off(
int priority) {
3197 set_shader(
nullptr, priority);
3204 set_shader_auto(
int priority) {
3208 node()->get_attrib(ShaderAttrib::get_class_slot());
3209 if (attrib !=
nullptr) {
3210 priority = max(priority,
3211 node()->
get_state()->get_override(ShaderAttrib::get_class_slot()));
3229 node()->get_attrib(ShaderAttrib::get_class_slot());
3230 if (attrib !=
nullptr) {
3231 priority = max(priority,
3232 node()->
get_state()->get_override(ShaderAttrib::get_class_slot()));
3234 node()->
set_attrib(sa->set_shader_auto(shader_switch, priority));
3238 node()->
set_attrib(sa->set_shader_auto(shader_switch, priority));
3249 node()->get_attrib(ShaderAttrib::get_class_slot());
3250 if (attrib !=
nullptr) {
3260 get_shader()
const {
3261 nassertr_always(!
is_empty(),
nullptr);
3263 node()->get_attrib(ShaderAttrib::get_class_slot());
3264 if (attrib !=
nullptr) {
3266 return sa->get_shader();
3280 pnode->get_attrib(ShaderAttrib::get_class_slot());
3281 if (attrib !=
nullptr) {
3283 pnode->
set_attrib(sa->set_shader_input(inp));
3287 pnode->
set_attrib(sa->set_shader_input(inp));
3300 pnode->get_attrib(ShaderAttrib::get_class_slot());
3301 if (attrib !=
nullptr) {
3303 pnode->
set_attrib(sa->set_shader_input(move(inp)));
3307 pnode->
set_attrib(sa->set_shader_input(move(inp)));
3319 node()->get_attrib(ShaderAttrib::get_class_slot());
3320 if (attrib !=
nullptr) {
3322 return sa->get_shader_input(
id);
3336 node()->get_attrib(ShaderAttrib::get_class_slot());
3338 if (attrib !=
nullptr) {
3354 node()->get_attrib(ShaderAttrib::get_class_slot());
3355 if (attrib !=
nullptr) {
3371 node()->get_attrib(ShaderAttrib::get_class_slot());
3372 if (attrib !=
nullptr) {
3391 node()->get_attrib(TexMatrixAttrib::get_class_slot());
3392 if (attrib !=
nullptr) {
3410 node()->clear_attrib(TexMatrixAttrib::get_class_slot());
3421 node()->get_attrib(TexMatrixAttrib::get_class_slot());
3422 if (attrib !=
nullptr) {
3426 if (tma->is_empty()) {
3427 node()->clear_attrib(TexMatrixAttrib::get_class_slot());
3441 nassertr_always(!
is_empty(),
false);
3444 node()->get_attrib(TexMatrixAttrib::get_class_slot());
3445 if (attrib !=
nullptr) {
3447 return tma->has_stage(stage);
3460 nassertr_always(!
is_empty(),
nullptr);
3463 node()->get_attrib(TexMatrixAttrib::get_class_slot());
3464 if (attrib !=
nullptr) {
3466 return tma->get_transform(stage);
3469 return TransformState::make_identity();
3478 nassertv(_error_type == ET_ok && other._error_type == ET_ok);
3483 state->get_attrib(TexMatrixAttrib::get_class_slot());
3484 if (attrib !=
nullptr) {
3488 state = state->add_attrib(tma->add_stage(stage, transform));
3492 state = state->add_attrib(TexMatrixAttrib::make(stage, transform));
3502 CPT(
RenderState) new_state = rel_state->compose(state);
3506 node()->
set_attrib(new_state->get_attrib(TexMatrixAttrib::get_class_slot()));
3515 nassertr(_error_type == ET_ok && other._error_type == ET_ok, TransformState::make_identity());
3519 state->get_attrib(TexMatrixAttrib::get_class_slot());
3520 if (attrib !=
nullptr) {
3522 return tma->get_transform(stage);
3525 return TransformState::make_identity();
3533 set_tex_gen(
TextureStage *stage, RenderAttrib::TexGenMode mode,
int priority) {
3537 node()->get_attrib(TexGenAttrib::get_class_slot());
3541 if (attrib !=
nullptr) {
3542 priority = max(priority,
3543 node()->
get_state()->get_override(TextureAttrib::get_class_slot()));
3560 const LTexCoord3 &constant_value,
int priority) {
3564 node()->get_attrib(TexGenAttrib::get_class_slot());
3568 if (attrib !=
nullptr) {
3569 priority = max(priority,
3570 node()->
get_state()->get_override(TextureAttrib::get_class_slot()));
3577 node()->
set_attrib(tga->add_stage(stage, mode, constant_value), priority);
3587 node()->clear_attrib(TexGenAttrib::get_class_slot());
3599 node()->get_attrib(TexGenAttrib::get_class_slot());
3600 if (attrib !=
nullptr) {
3604 if (tga->is_empty()) {
3605 node()->clear_attrib(TexGenAttrib::get_class_slot());
3619 nassertr_always(!
is_empty(),
false);
3622 node()->get_attrib(TexGenAttrib::get_class_slot());
3623 if (attrib !=
nullptr) {
3625 return tga->has_stage(stage);
3637 nassertr_always(!
is_empty(), TexGenAttrib::M_off);
3640 node()->get_attrib(TexGenAttrib::get_class_slot());
3641 if (attrib !=
nullptr) {
3643 return tga->get_mode(stage);
3646 return TexGenAttrib::M_off;
3666 node()->get_effect(TexProjectorEffect::get_class_type());
3670 if (effect !=
nullptr) {
3688 node()->get_effect(TexProjectorEffect::get_class_type());
3689 if (effect !=
nullptr) {
3693 if (tpe->is_empty()) {
3717 nassertr_always(!
is_empty(),
false);
3720 node()->get_effect(TexProjectorEffect::get_class_type());
3721 if (effect !=
nullptr) {
3723 return tpe->has_stage(stage);
3739 node()->get_effect(TexProjectorEffect::get_class_type());
3740 if (effect !=
nullptr) {
3742 return tpe->get_from(stage);
3758 node()->get_effect(TexProjectorEffect::get_class_type());
3759 if (effect !=
nullptr) {
3761 return tpe->get_to(stage);
3776 set_tex_gen(stage, TexGenAttrib::M_world_position);
3790 nassertr_always(!
is_empty(),
false);
3791 return r_has_vertex_column(
node(), name);
3801 InternalNames vertex_columns;
3802 r_find_all_vertex_columns(
node(), vertex_columns);
3805 InternalNames::iterator ti;
3806 for (ti = vertex_columns.begin(); ti != vertex_columns.end(); ++ti) {
3820 InternalNames vertex_columns;
3821 r_find_all_vertex_columns(
node(), vertex_columns);
3826 InternalNames::iterator ti;
3827 for (ti = vertex_columns.begin(); ti != vertex_columns.end(); ++ti) {
3843 InternalNames vertex_columns;
3844 r_find_all_vertex_columns(
node(), vertex_columns);
3846 CPT(
InternalName) texcoord_name = InternalName::get_texcoord();
3849 InternalNames::iterator ti;
3850 for (ti = vertex_columns.begin(); ti != vertex_columns.end(); ++ti) {
3851 if ((*ti)->get_top() == texcoord_name) {
3866 InternalNames vertex_columns;
3867 r_find_all_vertex_columns(
node(), vertex_columns);
3873 InternalNames::iterator ti;
3874 for (ti = vertex_columns.begin(); ti != vertex_columns.end(); ++ti) {
3876 if (name->
get_top() == texcoord_name) {
3883 if (glob.
matches(net_basename)) {
3898 nassertr_always(!
is_empty(),
nullptr);
3900 return r_find_texture(
node(), get_net_state(), glob);
3910 nassertr_always(!
is_empty(),
nullptr);
3911 return r_find_texture(
node(), stage);
3921 r_find_all_textures(
node(), get_net_state(), textures);
3924 Textures::iterator ti;
3925 for (ti = textures.begin(); ti != textures.end(); ++ti) {
3939 r_find_all_textures(
node(), get_net_state(), textures);
3944 Textures::iterator ti;
3945 for (ti = textures.begin(); ti != textures.end(); ++ti) {
3947 if (glob.
matches(texture->get_name())) {
3962 r_find_all_textures(
node(), stage, textures);
3965 Textures::iterator ti;
3966 for (ti = textures.begin(); ti != textures.end(); ++ti) {
3980 nassertr_always(!
is_empty(),
nullptr);
3982 return r_find_texture_stage(
node(), get_net_state(), glob);
3992 TextureStages texture_stages;
3993 r_find_all_texture_stages(
node(), get_net_state(), texture_stages);
3996 TextureStages::iterator ti;
3997 for (ti = texture_stages.begin(); ti != texture_stages.end(); ++ti) {
4013 r_unify_texture_stages(
node(), stage);
4024 TextureStages texture_stages;
4025 r_find_all_texture_stages(
node(), get_net_state(), texture_stages);
4030 TextureStages::iterator ti;
4031 for (ti = texture_stages.begin(); ti != texture_stages.end(); ++ti) {
4047 nassertr_always(!
is_empty(),
nullptr);
4049 return r_find_material(
node(), get_net_state(), glob);
4058 Materials materials;
4059 r_find_all_materials(
node(), get_net_state(), materials);
4062 Materials::iterator ti;
4063 for (ti = materials.begin(); ti != materials.end(); ++ti) {
4076 Materials materials;
4077 r_find_all_materials(
node(), get_net_state(), materials);
4082 Materials::iterator ti;
4083 for (ti = materials.begin(); ti != materials.end(); ++ti) {
4085 if (glob.
matches(material->get_name())) {
4102 nassertv(mat !=
nullptr);
4125 node()->clear_attrib(MaterialAttrib::get_class_slot());
4134 nassertr_always(!
is_empty(),
false);
4136 node()->get_attrib(MaterialAttrib::get_class_slot());
4137 if (attrib !=
nullptr) {
4154 get_material()
const {
4155 nassertr_always(!
is_empty(),
nullptr);
4157 node()->get_attrib(MaterialAttrib::get_class_slot());
4158 if (attrib !=
nullptr) {
4173 nassertv(mat !=
nullptr);
4174 nassertv(new_mat !=
nullptr);
4176 CPT(
RenderAttrib) new_attrib = MaterialAttrib::make(new_mat);
4210 node()->clear_attrib(FogAttrib::get_class_slot());
4221 nassertr_always(!
is_empty(),
false);
4223 node()->get_attrib(FogAttrib::get_class_slot());
4224 if (attrib !=
nullptr) {
4240 nassertr_always(!
is_empty(),
false);
4242 node()->get_attrib(FogAttrib::get_class_slot());
4243 if (attrib !=
nullptr) {
4259 nassertr_always(!
is_empty(),
nullptr);
4261 node()->get_attrib(FogAttrib::get_class_slot());
4262 if (attrib !=
nullptr) {
4278 node()->get_state()->get_attrib_def(rma);
4290 node()->get_state()->get_attrib_def(rma);
4303 node()->get_state()->get_attrib_def(rma);
4321 node()->get_state()->get_attrib_def(rma);
4337 node()->get_state()->get_attrib_def(rma);
4349 node()->
set_attrib(RenderModeAttrib::make(mode, thickness), priority);
4359 node()->clear_attrib(RenderModeAttrib::get_class_slot());
4369 nassertr_always(!
is_empty(),
false);
4370 return node()->has_attrib(RenderModeAttrib::get_class_slot());
4379 nassertr_always(!
is_empty(), RenderModeAttrib::M_unchanged);
4381 node()->get_attrib(RenderModeAttrib::get_class_slot());
4382 if (attrib !=
nullptr) {
4387 return RenderModeAttrib::M_unchanged;
4396 nassertr_always(!
is_empty(), 0.0f);
4398 node()->get_attrib(RenderModeAttrib::get_class_slot());
4399 if (attrib !=
nullptr) {
4413 nassertr_always(!
is_empty(), 0.0f);
4415 node()->get_attrib(RenderModeAttrib::get_class_slot());
4416 if (attrib !=
nullptr) {
4433 CullFaceAttrib::Mode mode =
4435 CullFaceAttrib::M_cull_none :
4436 CullFaceAttrib::M_cull_clockwise;
4451 node()->clear_attrib(CullFaceAttrib::get_class_slot());
4461 nassertr_always(!
is_empty(),
false);
4462 return node()->has_attrib(CullFaceAttrib::get_class_slot());
4474 nassertr_always(!
is_empty(),
false);
4476 node()->get_attrib(CullFaceAttrib::get_class_slot());
4477 if (attrib !=
nullptr) {
4494 DepthTestAttrib::PandaCompareFunc mode =
4496 DepthTestAttrib::M_less :
4497 DepthTestAttrib::M_none;
4509 node()->clear_attrib(DepthTestAttrib::get_class_slot());
4519 nassertr_always(!
is_empty(),
false);
4520 return node()->has_attrib(DepthTestAttrib::get_class_slot());
4531 nassertr_always(!
is_empty(),
false);
4533 node()->get_attrib(DepthTestAttrib::get_class_slot());
4534 if (attrib !=
nullptr) {
4536 return (dta->
get_mode() != DepthTestAttrib::M_none);
4551 DepthWriteAttrib::Mode mode =
4553 DepthWriteAttrib::M_on :
4554 DepthWriteAttrib::M_off;
4566 node()->clear_attrib(DepthWriteAttrib::get_class_slot());
4576 nassertr_always(!
is_empty(),
false);
4577 return node()->has_attrib(DepthWriteAttrib::get_class_slot());
4588 nassertr_always(!
is_empty(),
false);
4590 node()->get_attrib(DepthWriteAttrib::get_class_slot());
4591 if (attrib !=
nullptr) {
4593 return (dta->
get_mode() != DepthWriteAttrib::M_off);
4622 node()->clear_attrib(DepthOffsetAttrib::get_class_slot());
4632 nassertr_always(!
is_empty(),
false);
4633 return node()->has_attrib(DepthOffsetAttrib::get_class_slot());
4644 node()->get_attrib(DepthOffsetAttrib::get_class_slot());
4645 if (attrib !=
nullptr) {
4663 const LMatrix4 &rel_mat = transform->
get_mat();
4665 LVector3 up = LVector3::up();
4666 LVector3 rel_pos = -rel_mat.get_row3(3);
4674 if (offset != 0.0f) {
4675 LVector3 translate = rel_mat.get_row3(3);
4676 translate.normalize();
4677 translate *= offset;
4693 const LMatrix4 &rel_mat = transform->
get_mat();
4695 LVector3 up = LVector3::up() * rel_mat;
4696 LVector3 rel_pos = LVector3::forward() * rel_mat;
4704 if (offset != 0.0f) {
4705 LVector3 translate = rel_mat.get_row3(3);
4706 translate.normalize();
4707 translate *= offset;
4722 const LMatrix4 &rel_mat = transform->
get_mat();
4724 LVector3 up = LVector3::up();
4725 LVector3 rel_pos = -rel_mat.get_row3(3);
4733 if (offset != 0.0f) {
4734 LVector3 translate = rel_mat.get_row3(3);
4735 translate.normalize();
4736 translate *= offset;
4750 (LVector3::up(),
false,
true,
4751 offset, camera, LPoint3(0.0f, 0.0f, 0.0f));
4764 (LVector3::up(),
true,
false,
4765 offset, camera, LPoint3(0.0f, 0.0f, 0.0f), fixed_depth);
4778 (LVector3::up(),
false,
false,
4779 offset, camera, LPoint3(0.0f, 0.0f, 0.0f));
4797 nassertr_always(!
is_empty(),
false);
4798 return node()->has_effect(BillboardEffect::get_class_type());
4826 nassertr_always(!
is_empty(),
false);
4827 return node()->has_effect(CompassEffect::get_class_type());
4851 node()->clear_attrib(TransparencyAttrib::get_class_slot());
4862 nassertr_always(!
is_empty(),
false);
4863 return node()->has_attrib(TransparencyAttrib::get_class_slot());
4876 nassertr_always(!
is_empty(), TransparencyAttrib::M_none);
4878 node()->get_attrib(TransparencyAttrib::get_class_slot());
4879 if (attrib !=
nullptr) {
4884 return TransparencyAttrib::M_none;
4907 node()->clear_attrib(LogicOpAttrib::get_class_slot());
4918 nassertr_always(!
is_empty(),
false);
4919 return node()->has_attrib(LogicOpAttrib::get_class_slot());
4932 nassertr_always(!
is_empty(), LogicOpAttrib::O_none);
4934 node()->get_attrib(LogicOpAttrib::get_class_slot());
4935 if (attrib !=
nullptr) {
4940 return LogicOpAttrib::O_none;
4961 node()->clear_attrib(AntialiasAttrib::get_class_slot());
4971 nassertr_always(!
is_empty(),
false);
4972 return node()->has_attrib(AntialiasAttrib::get_class_slot());
4981 nassertr_always(!
is_empty(), AntialiasAttrib::M_none);
4983 node()->get_attrib(AntialiasAttrib::get_class_slot());
4984 if (attrib !=
nullptr) {
4989 return AntialiasAttrib::M_none;
4999 nassertr_always(!
is_empty(),
false);
5000 return node()->has_attrib(AudioVolumeAttrib::get_class_slot());
5011 node()->clear_attrib(AudioVolumeAttrib::get_class_slot());
5022 node()->get_attrib(AudioVolumeAttrib::get_class_slot());
5023 if (attrib !=
nullptr) {
5024 priority = max(priority,
5025 node()->
get_state()->get_override(AudioVolumeAttrib::get_class_slot()));
5060 node()->get_attrib(AudioVolumeAttrib::get_class_slot());
5061 if (attrib !=
nullptr) {
5076 const RenderAttrib *attrib = net_state->get_attrib(AudioVolumeAttrib::get_class_slot());
5077 if (attrib !=
nullptr) {
5079 if (ava !=
nullptr) {
5099 comp = comp->
get_next(pipeline_stage, current_thread)) {
5104 result._head = comp;
5128 bool reparented = PandaNode::reparent(_head->get_next(pipeline_stage, current_thread),
5129 _head, sort,
true, pipeline_stage,
5131 nassertv(reparented);
5145 bool reparented = PandaNode::reparent(_head->get_next(pipeline_stage, current_thread),
5146 _head, sort,
false, pipeline_stage,
5148 nassertv(reparented);
5157 stashed_descendents.
unstash();
5169 if (comp !=
nullptr) {
5173 while (next !=
nullptr) {
5179 result._head = comp;
5184 next = next->
get_next(pipeline_stage, current_thread);
5197 return (other == *
this);
5205 return (other != *
this);
5216 return other.compare_to(*
this) > 0;
5231 return -other.compare_to(*
this);
5245 if (Thread::is_true_threads()) {
5252 #endif // HAVE_THREADS 5254 PStatTimer timer(_verify_complete_pcollector);
5257 nassertr(comp !=
nullptr,
false);
5262 nassertr(
node !=
nullptr,
false);
5263 int length = comp->
get_length(pipeline_stage, current_thread);
5265 comp = comp->
get_next(pipeline_stage, current_thread);
5267 while (comp !=
nullptr) {
5269 nassertr(next_node !=
nullptr,
false);
5272 pgraph_cat.warning()
5273 << *
this <<
" is incomplete; " << *
node <<
" is not a child of " 5274 << *next_node <<
"\n";
5278 if (comp->
get_length(pipeline_stage, current_thread) != length) {
5279 pgraph_cat.warning()
5280 << *
this <<
" is incomplete; length at " << *next_node
5281 <<
" indicates " << comp->
get_length(pipeline_stage, current_thread)
5282 <<
" while length at " << *
node <<
" indicates " << length <<
"\n";
5287 comp = comp->
get_next(pipeline_stage, current_thread);
5307 CPT(
RenderState) state = RenderState::make_empty();
5330 node()->prepare_scene(gsg, get_net_state());
5372 get_bounds(
Thread *current_thread)
const {
5389 force_recompute_bounds() {
5391 r_force_recompute_bounds(
node());
5400 get_bounds()->write(out);
5421 min_point.set(0.0f, 0.0f, 0.0f);
5422 max_point.set(0.0f, 0.0f, 0.0f);
5423 nassertr_always(!
is_empty(),
false);
5430 bool found_any =
false;
5431 node()->calc_tight_bounds(min_point, max_point, found_any,
5432 move(transform), current_thread);
5521 if (flatten_geoms) {
5549 if (flatten_geoms) {
5551 gr.
collect_vertex_data(
node(), ~(SceneGraphReducer::CVD_format | SceneGraphReducer::CVD_name | SceneGraphReducer::CVD_animation_type));
5576 gr.
apply_attribs(
node(), SceneGraphReducer::TT_apply_texture_color | SceneGraphReducer::TT_tex_matrix | SceneGraphReducer::TT_other);
5602 nassertr_always(!
is_empty(),
false);
5606 bool okflag =
false;
5626 nassertr_always(!
is_empty(),
false);
5630 bool okflag =
false;
5669 ostringstream stream;
5673 bool used_local_writer =
false;
5674 if (writer ==
nullptr) {
5680 writer = &local_writer;
5681 used_local_writer =
true;
5687 if (used_local_writer && num_nodes > 1) {
5710 for (
int i = 0; i < num_nodes; ++i) {
5712 nassertr(
node !=
nullptr,
false);
5735 if (reader ==
nullptr) {
5739 if (!buffer.
read_header(head, _bam_header.size())) {
5743 if (head != _bam_header) {
5747 reader = &local_reader;
5759 ErrorType error_type = (ErrorType)dgi.
get_uint8();
5761 if (num_nodes == 0) {
5763 result._error_type = error_type;
5767 for (
int i = 0; i < num_nodes; ++i) {
5770 if (
object ==
nullptr ||
5771 !object->
is_of_type(PandaNode::get_class_type())) {
5801 int &a_count,
int &b_count,
Thread *current_thread) {
5811 while (ac->get_length(pipeline_stage, current_thread) > bc->
get_length(pipeline_stage, current_thread)) {
5812 nassertr(ac !=
nullptr,
nullptr);
5813 ac = ac->get_next(pipeline_stage, current_thread);
5816 while (bc->
get_length(pipeline_stage, current_thread) > ac->get_length(pipeline_stage, current_thread)) {
5817 nassertr(bc !=
nullptr,
nullptr);
5818 bc = bc->
get_next(pipeline_stage, current_thread);
5825 nassertr(ac !=
nullptr,
nullptr);
5826 nassertr(bc !=
nullptr,
nullptr);
5827 ac = ac->get_next(pipeline_stage, current_thread);
5829 bc = bc->
get_next(pipeline_stage, current_thread);
5842 if (comp ==
nullptr) {
5843 return RenderState::make_empty();
5847 return r_get_net_state(comp->
get_next(pipeline_stage, current_thread), current_thread)->compose(state);
5858 Thread *current_thread)
const {
5859 if (n == 0 || comp ==
nullptr) {
5860 return RenderState::make_empty();
5864 return r_get_partial_state(comp->
get_next(pipeline_stage, current_thread), n - 1, current_thread)->compose(state);
5874 if (comp ==
nullptr) {
5875 return TransformState::make_identity();
5879 CPT(
TransformState) net_transform = r_get_net_transform(comp->
get_next(pipeline_stage, current_thread), current_thread);
5882 if (!node_cdata->_effects->has_adjust_transform()) {
5883 if (node_cdata->_transform->is_identity()) {
5884 return net_transform;
5886 return net_transform->compose(node_cdata->_transform);
5890 node_cdata->_effects->adjust_transform(net_transform, transform,
node);
5891 return net_transform->compose(transform);
5906 Thread *current_thread)
const {
5907 if (n == 0 || comp ==
nullptr) {
5908 return TransformState::make_identity();
5912 if (node_cdata->_effects->has_adjust_transform()) {
5916 CPT(
TransformState) partial = r_get_partial_transform(comp->
get_next(pipeline_stage, current_thread), n - 1, current_thread);
5917 if (partial ==
nullptr) {
5920 if (node_cdata->_transform->is_identity()) {
5923 return partial->compose(node_cdata->_transform);
5934 if (comp ==
nullptr) {
5935 return TransformState::make_identity();
5939 return r_get_net_prev_transform(comp->
get_next(pipeline_stage, current_thread), current_thread)->compose(transform);
5950 if (n == 0 || comp ==
nullptr) {
5951 return TransformState::make_identity();
5955 return r_get_partial_prev_transform(comp->
get_next(pipeline_stage, current_thread), n - 1, current_thread)->compose(transform);
5966 int max_matches)
const {
5968 pgraph_cat.warning()
5969 <<
"Attempt to extend an empty NodePath by '" << path
5975 find_matches(result, approx_path, max_matches);
5986 int max_matches)
const {
5988 pgraph_cat.warning()
5989 <<
"Attempt to extend an empty NodePath by: " << approx_path <<
".\n";
5996 nassertv(level->_node_path.
is_valid());
5998 find_matches(result, level, max_matches);
6007 int max_matches)
const {
6009 int num_levels_remaining = _max_search_depth;
6013 while (num_levels_remaining > 0 && level !=
nullptr) {
6014 if (pgraph_cat.is_spam()) {
6016 <<
"find_matches pass: " << result <<
", " 6017 << max_matches <<
", " << num_levels_remaining <<
"\n";
6021 num_levels_remaining--;
6028 while (entry !=
nullptr) {
6029 if (entry->
consider_node(result, next_level, max_matches, 0)) {
6033 while (entry !=
nullptr) {
6038 while (next_level !=
nullptr) {
6043 while (deleted_entries !=
nullptr) {
6045 delete deleted_entries;
6046 deleted_entries = next;
6056 entry->_next = deleted_entries;
6057 deleted_entries = entry;
6064 while (entry !=
nullptr) {
6066 entry->_next = deleted_entries;
6067 deleted_entries = entry;
6076 while (deleted_entries !=
nullptr) {
6078 delete deleted_entries;
6079 deleted_entries = next;
6093 DCAST_INTO_R(mnode,
node, count);
6100 for (
int i = 0; i < num_children; i++) {
6101 count += r_clear_model_nodes(cr.
get_child(i));
6112 r_adjust_all_priorities(
PandaNode *node,
int adjustment) {
6116 DCAST_INTO_V(gnode,
node);
6119 for (
int i = 0; i < num_geoms; i++) {
6126 for (
int i = 0; i < num_children; i++) {
6127 r_adjust_all_priorities(cr.
get_child(i), adjustment);
6135 r_force_recompute_bounds(
PandaNode *node) {
6138 DCAST_INTO_V(gnode,
node);
6141 for (
int i = 0; i < num_geoms; i++) {
6142 const Geom *geom = gnode->get_geom(i);
6143 geom->mark_bounds_stale();
6147 node->mark_bounds_stale();
6152 for (
int i = 0; i < num_children; i++) {
6153 r_force_recompute_bounds(cr.
get_child(i));
6167 into_collide_mask = (into_collide_mask & and_mask) | or_mask;
6173 for (
int i = 0; i < num_children; i++) {
6174 r_set_collide_mask(cr.
get_child(i), and_mask, or_mask, node_type);
6185 DCAST_INTO_R(gnode,
node,
false);
6188 for (
int i = 0; i < num_geoms; i++) {
6189 const Geom *geom = gnode->get_geom(i);
6191 if (vdata->has_column(name)) {
6200 for (
int i = 0; i < num_children; i++) {
6202 if (r_has_vertex_column(child, name)) {
6214 r_find_all_vertex_columns(
PandaNode *node,
6215 NodePath::InternalNames &vertex_columns)
const {
6218 DCAST_INTO_V(gnode,
node);
6221 for (
int i = 0; i < num_geoms; ++i) {
6222 const Geom *geom = gnode->get_geom(i);
6225 for (
int j = 0; j < num_arrays; ++j) {
6228 for (
int k = 0; k < num_columns; ++k) {
6230 vertex_columns.insert(column->
get_name());
6239 for (
int i = 0; i < num_children; i++) {
6241 r_find_all_vertex_columns(child, vertex_columns);
6253 DCAST_INTO_R(gnode,
node,
nullptr);
6256 for (
int i = 0; i < num_geoms; i++) {
6262 geom_state->get_attrib(TextureAttrib::get_class_slot());
6263 if (attrib !=
nullptr) {
6267 if (texture !=
nullptr) {
6268 if (glob.
matches(texture->get_name())) {
6280 for (
int i = 0; i < num_children; i++) {
6282 CPT(
RenderState) next_state = state->compose(child->get_state());
6284 Texture *result = r_find_texture(child, next_state, glob);
6285 if (result !=
nullptr) {
6298 NodePath::Textures &textures)
const {
6301 DCAST_INTO_V(gnode,
node);
6304 for (
int i = 0; i < num_geoms; i++) {
6310 geom_state->get_attrib(TextureAttrib::get_class_slot());
6311 if (attrib !=
nullptr) {
6315 if (texture !=
nullptr) {
6316 textures.insert(texture);
6326 for (
int i = 0; i < num_children; i++) {
6328 CPT(
RenderState) next_state = state->compose(child->get_state());
6329 r_find_all_textures(child, next_state, textures);
6340 node->get_attrib(TextureAttrib::get_class_slot());
6341 if (attrib !=
nullptr) {
6350 DCAST_INTO_R(gnode,
node,
nullptr);
6353 for (
int i = 0; i < num_geoms; i++) {
6358 geom_state->get_attrib(TextureAttrib::get_class_slot());
6359 if (attrib !=
nullptr) {
6371 for (
int i = 0; i < num_children; i++) {
6374 Texture *result = r_find_texture(child, stage);
6375 if (result !=
nullptr) {
6388 NodePath::Textures &textures)
const {
6391 node->get_attrib(TextureAttrib::get_class_slot());
6392 if (attrib !=
nullptr) {
6401 DCAST_INTO_V(gnode,
node);
6404 for (
int i = 0; i < num_geoms; i++) {
6409 geom_state->get_attrib(TextureAttrib::get_class_slot());
6410 if (attrib !=
nullptr) {
6422 for (
int i = 0; i < num_children; i++) {
6424 r_find_all_textures(child, stage, textures);
6436 DCAST_INTO_R(gnode,
node,
nullptr);
6439 for (
int i = 0; i < num_geoms; i++) {
6445 geom_state->get_attrib(TextureAttrib::get_class_slot());
6446 if (attrib !=
nullptr) {
6450 if (texture_stage !=
nullptr) {
6452 return texture_stage;
6463 for (
int i = 0; i < num_children; i++) {
6465 CPT(
RenderState) next_state = state->compose(child->get_state());
6467 TextureStage *result = r_find_texture_stage(child, next_state, glob);
6468 if (result !=
nullptr) {
6481 NodePath::TextureStages &texture_stages)
const {
6484 DCAST_INTO_V(gnode,
node);
6487 for (
int i = 0; i < num_geoms; i++) {
6493 geom_state->get_attrib(TextureAttrib::get_class_slot());
6494 if (attrib !=
nullptr) {
6498 if (texture_stage !=
nullptr) {
6499 texture_stages.insert(texture_stage);
6509 for (
int i = 0; i < num_children; i++) {
6511 CPT(
RenderState) next_state = state->compose(child->get_state());
6512 r_find_all_texture_stages(child, next_state, texture_stages);
6523 node->get_attrib(TextureAttrib::get_class_slot());
6524 if (attrib !=
nullptr) {
6526 CPT(
RenderAttrib) new_attrib = ta->unify_texture_stages(stage);
6527 if (new_attrib != ta) {
6534 DCAST_INTO_V(gnode,
node);
6537 for (
int i = 0; i < num_geoms; i++) {
6542 state->get_attrib(TextureAttrib::get_class_slot());
6543 if (attrib !=
nullptr) {
6545 CPT(
RenderAttrib) new_attrib = ta->unify_texture_stages(stage);
6546 if (new_attrib != ta) {
6547 CPT(
RenderState) new_state = state->add_attrib(new_attrib);
6557 for (
int i = 0; i < num_children; i++) {
6559 r_unify_texture_stages(child, stage);
6571 DCAST_INTO_R(gnode,
node,
nullptr);
6574 for (
int i = 0; i < num_geoms; i++) {
6580 geom_state->get_attrib(MaterialAttrib::get_class_slot());
6581 if (attrib !=
nullptr) {
6585 if (material !=
nullptr) {
6586 if (glob.
matches(material->get_name())) {
6598 for (
int i = 0; i < num_children; i++) {
6600 CPT(
RenderState) next_state = state->compose(child->get_state());
6602 Material *result = r_find_material(child, next_state, glob);
6603 if (result !=
nullptr) {
6616 NodePath::Materials &materials)
const {
6619 DCAST_INTO_V(gnode,
node);
6622 for (
int i = 0; i < num_geoms; i++) {
6628 geom_state->get_attrib(MaterialAttrib::get_class_slot());
6629 if (attrib !=
nullptr) {
6633 if (material !=
nullptr) {
6634 materials.insert(material);
6644 for (
int i = 0; i < num_children; i++) {
6646 CPT(
RenderState) next_state = state->compose(child->get_state());
6647 r_find_all_materials(child, next_state, materials);
6661 if (node_state->get_attrib(ma)) {
6671 DCAST_INTO_V(gnode,
node);
6674 for (
int i = 0; i < num_geoms; i++) {
6679 if (geom_state->get_attrib(ma)) {
6691 for (
size_t i = 0; i < num_children; ++i) {
6693 r_replace_material(child, mat, new_attrib);
6711 if (root ==
nullptr || root ==
node()) {
6717 Thread *current_thread = Thread::get_current_thread();
6723 while (comp !=
nullptr) {
6725 path.push_back(
node);
6731 comp = comp->
get_next(pipeline_stage, current_thread);
6734 if (comp ==
nullptr) {
6742 for (
int i = path.size() - 1; i >= 0; --i) {
6756 if (
node.is_null()) {
6762 Thread *current_thread = Thread::get_current_thread();
6769 nassertd(!comp.is_null()) {
6770 while (p_list[pi++]) {}
6775 while (p_list[pi] !=
nullptr) {
6783 PandaNode::Paths::const_iterator it;
6784 for (it =
node->_paths.begin(); it !=
node->_paths.end(); ++it) {
6785 if ((*it)->get_next(pipeline_stage, current_thread) == comp) {
6792 if (it ==
node->_paths.end()) {
6798 node->_paths.insert(comp);
bool write_header(const std::string &header)
Writes a sequence of bytes to the beginning of the datagram file.
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.
get_mode
Returns the specified antialias mode.
std::string get_bin_name() const
Returns the name of the bin that this particular node was assigned to via set_bin(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void clear_audio_volume()
Completely removes any audio volume from the referenced node.
get_instance_count
Returns the number of geometry instances.
get_geom_state
Returns the RenderState associated with the nth geom of the 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(),...
void add_match_pointer(PandaNode *pointer, int flags)
Adds a component that must match a particular node exactly, by pointer.
void clear_two_sided()
Completely removes any two-sided adjustment that may have been set on this node via set_two_sided().
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 ...
void set_audio_volume(PN_stdfloat volume, int priority=0)
Sets the audio volume component of the transform.
NodePathCollection find_all_matches(const std::string &path) const
Returns the complete set of all NodePaths that begin with this NodePath and can be extended by path.
virtual Light * as_light()
Cross-casts the node to a Light pointer, if it is one of the four kinds of Light nodes,...
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.
NodePath find(const std::string &path) const
Searches for a node below the referenced node that matches the indicated string.
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...
NodePath find_net_tag(const std::string &key) const
Returns the lowest ancestor of this node that contains a tag definition with the indicated key,...
bool get_render_mode_perspective() const
Returns the flag that has been set on this node via set_render_mode_perspective(),...
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...
get_stashed_children
Returns the set of all child nodes of the referenced node that have been stashed.
set_root_node
Sets the root node of the part of the scene graph we are currently writing out.
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...
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(...
get_mode
Returns the transparency mode.
get_name
Returns the name of this texture stage.
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.
vector_uchar encode_to_bam_stream() const
Converts the NodePath object into a single stream of data using a BamWriter, and returns that data as...
Enables or disables writing to the depth buffer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool has_occluder(const NodePath &occluder) const
Returns true if the indicated occluder has been specifically applied to this particular node.
int flatten_light()
Analyzes the geometry below this node and reports the number of vertices, triangles,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_render_mode_filled(int priority=0)
Sets up the geometry at this level and below (unless overridden) to render in filled (i....
NodePath instance_under_node(const NodePath &other, const std::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,...
bool has_fog_off() const
Returns true if a fog has been specifically disabled on this particular node via set_fog_off(),...
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...
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
int get_instance_count() const
Returns the geometry instance count, or 0 if disabled.
const InternalName * get_top() const
Returns the oldest ancestor in the InternalName's chain, not counting the root.
void clear_logic_op()
Completely removes any logical operation that may have been set on this node via set_logic_op().
bool operator !=(const NodePath &other) const
Returns true if the two paths are not equivalent.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool has_depth_offset() const
Returns true if a depth-offset adjustment has been explicitly set on this particular node via set_dep...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
set_state
Sets the complete RenderState that will be applied to all nodes at this level and below.
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...
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.
void write_level(std::ostream &out, int indent_level) const
Writes the entire level (a linked list of entries beginning at this entry).
Indicates which, if any, material should be applied to geometry.
PandaNode * get_child(size_t n) const
Returns the nth child of the node.
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.
std::string get_net_basename(int n) const
Returns the basename of this name prefixed by the indicated number of ancestors.
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.
get_num_on_stages
Returns the number of stages that are turned on by the attribute.
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...
get_on_stage
Returns the nth stage turned on by the attribute, sorted in render order.
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.
is_overall_hidden
Returns true if the node has been hidden to all cameras by clearing its overall bit.
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).
int compare_to(const NodePath &other) const
Returns a number less than zero if this NodePath sorts before the other one, greater than zero if it ...
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.
void clear_billboard()
Removes any billboard effect from the node.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_num_nodes
Returns the number of nodes in the path.
get_fog
If the FogAttrib is not an 'off' FogAttrib, returns the fog that is associated.
void set_bin(const std::string &bin_name, int draw_order, int priority=0)
Assigns the geometry at this level and below to the named rendering bin.
void set_instance_count(int instance_count)
Sets the geometry instance count, or 0 if geometry instancing should be disabled.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_scale(PN_stdfloat scale)
Sets the scale component of the transform, leaving translation and rotation untouched.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_bin_name
Returns the name of the bin this attribute specifies.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
get_on_sampler
Returns the sampler associated with the indicated stage, or the one associated with its texture if no...
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),...
get_color
If the type is T_flat or T_off, this returns the color that will be applied to geometry.
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.
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.
bool calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, const NodePath &other=NodePath(), 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 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,...
void set_quat_scale(const LQuaternion &quat, const LVecBase3 &scale)
Sets the rotation and scale components of the transform, leaving translation untouched.
void compose_color_scale(const LVecBase4 &scale, int priority=0)
multiplies the color scale component of the transform, with previous color scale leaving translation ...
get_parent
Returns the NodePath to the parent of the referenced node: that is, this NodePath,...
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.
void set_pos_quat(const LVecBase3 &pos, const LQuaternion &quat)
Sets the translation and rotation component of the transform, leaving scale untouched.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 set_logic_op(LogicOpAttrib::Operation op, int priority=0)
Specifically sets or disables a logical operation on this particular node.
void add_texture(Texture *texture)
Adds a new Texture to the collection.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_node
Returns the nth node of the path, where 0 is the referenced (bottom) node and get_num_nodes() - 1 is ...
bool has_material() const
Returns true if a material has been applied to this particular node via set_material(),...
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...
int32_t get_int32()
Extracts a signed 32-bit integer.
PN_stdfloat get_render_mode_thickness() const
Returns the render mode thickness that has been specifically set on this node via set_render_mode(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a class designed to support low-overhead traversals of the complete scene graph,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_pipeline_stage
Returns the Pipeline stage number associated with this thread.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_mode
Returns the depth write mode.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
RenderModeAttrib::Mode get_render_mode() const
Returns the render mode that has been specifically set on this node via set_render_mode(),...
void set_material(Material *tex, int priority=0)
Sets the geometry at this level and below to render using the indicated material.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
get_name
Returns the complete name represented by the InternalName and all of its parents.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool matches(const std::string &candidate) const
Returns true if the candidate string matches the pattern, false otherwise.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
void reverse_ls() const
Lists the hierarchy at and above the referenced node.
bool add_string(const std::string &str_path)
Adds a sequence of components separated by slashes, followed optionally by a semicolon and a sequence...
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...
bool write_bam_stream(std::ostream &out) const
Writes the contents of this node and below out to the indicated stream.
static NodePath decode_from_bam_stream(vector_uchar data, BamReader *reader=nullptr)
Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the N...
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.
bool is_stashed() const
Returns true if the referenced node is stashed either directly, or because some ancestor is stashed.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool has_light_off() const
Returns true if all Lights have been specifically disabled on this particular node.
This is our own Panda specialization on the default STL vector.
get_draw_control_mask
Returns the set of bits in draw_show_mask that are considered meaningful.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 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,...
void set_fog(Fog *fog, int priority=0)
Sets the geometry at this level and below to render using the indicated fog.
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() ...
PT(Material) NodePath
Returns the material that has been set on this particular node, or NULL if no material has been set.
Applies a Fog to the geometry at and below this node.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
get_scale
Returns the scale to be applied to colors.
bool operator==(const NodePath &other) const
Returns true if the two paths are equivalent; that is, if they contain the same list of nodes in the ...
bool has_texture() const
Returns true if a texture has been applied to this particular node via set_texture(),...
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.
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.
get_draw_show_mask
Returns the hide/show bits of this particular node.
void set_occluder(const NodePath &occluder)
Adds the indicated occluder to the list of occluders that apply to geometry at this node and below.
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...
void output(std::ostream &out) const
Writes a sensible description of the NodePath to the indicated output stream.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_fog_off(int priority=0)
Sets the geometry at this level and below to render using no fog.
bool operator<(const NodePath &other) const
Returns true if this NodePath sorts before the other one, false otherwise.
bool is_top_node(int pipeline_stage, Thread *current_thread) const
Returns true if this component represents the top node in the path.
get_offset
Returns the depth offset represented by this attrib.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
bool has_logic_op() const
Returns true if a logical operation has been explicitly set on this particular node via set_logic_op(...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
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.
has_on_stage
Returns true if the indicated stage is turned on by the attrib, false otherwise.
bool has_effect(TypeHandle type) const
Returns true if there is a render effect of the indicated type defined on this node,...
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...
void unify(PandaNode *root, bool preserve_order)
Calls unify() on every GeomNode at this level and below.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_quat(const LQuaternion &quat)
Sets the rotation component of the transform, leaving translation and scale untouched.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This functions similarly to a LightAttrib or ClipPlaneAttrib.
size_t get_num_children() const
Returns the number of children of the node.
get_path
Returns the nth NodePath in the collection.
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.
set_source
Changes the source of future datagrams for this BamReader.
unsigned short get_antialias() const
Returns the antialias setting that has been specifically set on this node via set_antialias(),...
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...
Texture * find_texture(const std::string &name) const
Returns the first texture found applied to geometry at this node or below that matches the indicated ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool is_singleton(Thread *current_thread=Thread::get_current_thread()) const
Returns true if the NodePath contains exactly one node.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A container for geometry primitives.
LogicOpAttrib::Operation get_logic_op() const
Returns the logical operation that has been specifically set on this node via set_logic_op(),...
void set_billboard_point_eye(PN_stdfloat offset=0.0, bool fixed_depth=false)
Puts a billboard transition on the node such that it will rotate in three dimensions about the origin...
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,...
get_writer
Returns the BamWriter in charge of performing the write operations.
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.
get_children
Returns the set of all child nodes of the referenced node.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
get_children
Returns an object that can be used to walk through the list of children of the node.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
void premunge_scene(GraphicsStateGuardianBase *gsg=nullptr)
Walks through the scene graph beginning at the bottom node, and internally adjusts any GeomVertexForm...
virtual bool put_datagram(const Datagram &data) override
Writes the given datagram to the file.
LVecBase3 get_hpr() const
Retrieves the rotation component of the transform.
This class is a wrapper around a NodePath that, unlike the actual NodePath class, doesn't hold a refe...
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...
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.
get_mode
Returns the depth write mode.
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).
set_into_collide_mask
Sets the "into" CollideMask.
bool has_clip_plane_off() const
Returns true if all clipping planes have been specifically disabled on this particular node.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int flatten(PandaNode *root, int combine_siblings_bits)
Simplifies the graph by removing unnecessary nodes and nodes.
get_sort
Returns the sort value of the referenced node within its parent; that is, the sort number passed on t...
bool get_depth_write() const
Returns true if depth-write rendering has been specifically set on this node via set_depth_write(),...
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.
get_actual_mode
Returns the actual culling mode, without considering the effects of the reverse flag.
Defines the way an object appears in the presence of lighting.
Similar to MutexHolder, but for a light reentrant mutex.
LQuaternion get_quat() const
Retrieves the rotation component of the transform.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Encodes a string name in a hash table, mapping it to a pointer.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
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,...
bool has_scissor() const
Returns true if a scissor region was defined at this node by a previous call to set_scissor().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class can be used to write a series of datagrams into a memory buffer.
CPT(RenderState) NodePath
Returns the state changes that must be made to transition to the render state of this node from the r...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_stashed
Returns the nth stashed child of this node.
void project_texture(TextureStage *stage, Texture *tex, const NodePath &projector)
A convenience function to enable projective texturing at this node level and below,...
Material * find_material(const std::string &name) const
Returns the first material found applied to geometry at this node or below that matches the indicated...
Applies a transform matrix to UV's before they are rendered.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
get_material
If the MaterialAttrib is not an 'off' MaterialAttrib, returns the material that is associated.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
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(...
is_valid
Returns true if the WorkingNodePath object appears to be a valid NodePath reference,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static const SamplerState & get_default()
Returns a reference to the global default immutable SamplerState object.
void add_int32(int32_t value)
Adds a signed 32-bit integer to the datagram.
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.
get_operation
Returns the logic operation specified by this attribute.
This effect automatically applies a computed texture matrix to the specified texture stage,...
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...
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.
get_num_geoms
Returns the number of geoms in the node.
get_mode
Returns the render mode.
get_root_node
Returns the root node of the part of the scene graph we are currently writing out.
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.
void remove_node(Thread *current_thread=Thread::get_current_thread())
Disconnects the referenced node from the scene graph.
bool read_header(std::string &header, size_t num_bytes)
Reads a sequence of bytes from the beginning of the datagram file.
int get_length(int pipeline_stage, Thread *current_thread) const
Returns the length of the path to this node.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_wireframe_color
Returns the color that is used in M_filled_wireframe mode to distinguish the wireframe from the rest ...
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.
bool read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
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...
int find_ancestor(const std::string &basename) const
Returns the index of the ancestor with the indicated basename, or -1 if no ancestor has that basename...
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.
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...
bool is_off() const
Returns true if the MaterialAttrib is an 'off' MaterialAttrib, indicating that it should disable the ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_thickness
Returns the line width or point thickness.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_perspective
Returns the perspective flag.
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.
void add_uint8(uint8_t value)
Adds an unsigned 8-bit integer to the datagram.
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.
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 ...
int complete_pointers(TypedWritable **plist, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
If enabled, specifies that a custom logical operation be performed instead of any color blending.
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.
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(),...
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.
virtual bool get_datagram(Datagram &data) override
Reads the next datagram from the file.
bool open_write(const Filename &bam_filename, bool report_errors=true)
Attempts to open the indicated file for writing.
set_target
Changes the destination of future datagrams written by the BamWriter.
TypeHandle is the identifier used to differentiate C++ class types.
void set_preserve_transform(PreserveTransform preserve_transform)
Sets the preserve_transform flag.
has_parent
Returns true if the referenced node has a parent; i.e.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TextureStage * find_texture_stage(const std::string &name) const
Returns the first TextureStage found applied to geometry at this node or below that matches the indic...
bool is_off() const
Returns true if the FogAttrib is an 'off' FogAttrib, indicating that it should disable fog.
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.
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 ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Computes texture coordinates for geometry automatically based on vertex position and/or normal.
get_draw_order
Returns the draw order this attribute specifies.
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.
void write_bounds(std::ostream &out) const
Writes a description of the bounding volume containing the bottom node and all of its descendants to ...
get_color_type
Returns the type of color specified by this ColorAttrib.
int flatten_medium()
A more thorough flattening than flatten_light(), this first applies all the transforms,...
bool get_two_sided() const
Returns true if two-sided rendering has been specifically set on this node via set_two_sided(),...
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.
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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_tag(const std::string &key) const
Returns true if a value has been defined on this node for the particular key (even if that value is t...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_color_scale(const LVecBase4 &scale, int priority=0)
Sets the color scale component of the transform, leaving translation and rotation untouched.
get_into_collide_mask
Returns the "into" collide mask for this node.
get_ancestor
Returns the nth ancestor of the path, where 0 is the NodePath itself and get_num_nodes() - 1 is get_t...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
get_volume
Returns the volume to be applied to sounds.
bool has_render_mode() const
Returns true if a render mode has been explicitly set on this particular node via set_render_mode() (...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class can be used to test for string matches against standard Unix- shell filename globbing conv...
void clear_compass()
Removes any compass effect from the node.
get_num_stashed
Returns the number of stashed nodes this node has.
void write_datagram(BamWriter *manager, Datagram &dg) const
Writes the contents of this object to the datagram for shipping out to a Bam file.
int make_compatible_state(PandaNode *root)
Searches for GeomNodes that contain multiple Geoms that differ only in their ColorAttribs.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
get_on_texture
Returns the texture associated with the indicated stage, or NULL if no texture is associated.
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.
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
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(),...
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.
void swap_data(vector_uchar &other)
Swaps the data in the internal buffer with that of the other buffer.
This is a set of zero or more NodePaths.
void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is called by make_from_bam to read in all of the relevant data from the BamFil...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.