16 #include "eggMiscFuncs.h" 17 #include "eggVertexPool.h" 19 #include "lexerDefs.h" 22 #include "string_utils.h" 39 _blend_mode = BM_unspecified;
40 _blend_operand_a = BO_unspecified;
41 _blend_operand_b = BO_unspecified;
66 EggTransform::operator = (copy);
68 _flags2 = copy._flags2;
69 _collide_mask = copy._collide_mask;
70 _from_collide_mask = copy._from_collide_mask;
71 _into_collide_mask = copy._into_collide_mask;
72 _billboard_center = copy._billboard_center;
73 _object_types = copy._object_types;
74 _collision_name = copy._collision_name;
77 _blend_mode = copy._blend_mode;
78 _blend_operand_a = copy._blend_operand_a;
79 _blend_operand_b = copy._blend_operand_b;
80 _blend_color = copy._blend_color;
81 _tag_data = copy._tag_data;
82 _u_speed = copy._u_speed;
83 _v_speed = copy._v_speed;
84 _w_speed = copy._w_speed;
85 _r_speed = copy._r_speed;
86 _default_pose = copy._default_pose;
93 VertexRef::iterator vri;
94 for (vri = _vref.begin(); vri != _vref.end(); ++vri) {
97 bool inserted = vert->_gref.insert(
this).second;
101 nassertr(inserted, *
this);
107 EggGroupNode::operator = (copy);
108 EggRenderMode::operator = (copy);
130 set_group_type(GroupType type) {
131 if (type != get_group_type()) {
133 if (type != GT_instance) {
136 nassertv(_group_refs.empty());
141 nassertv((type & ~F_group_type)==0);
142 _flags = (_flags & ~F_group_type) | type;
158 vector_string::const_iterator oi;
159 for (oi = _object_types.begin(); oi != _object_types.end(); ++oi) {
160 if (cmp_nocase_uh((*oi), object_type) == 0) {
177 vector_string::iterator oi;
178 for (oi = _object_types.begin(); oi != _object_types.end(); ++oi) {
179 if (cmp_nocase_uh((*oi), object_type) == 0) {
180 _object_types.erase(oi);
194 write(ostream &out,
int indent_level)
const {
195 test_under_integrity();
197 switch (get_group_type()) {
216 indent(out, indent_level + 2)
217 <<
"// Bin " << DCAST(
EggBin,
this)->get_bin_number() <<
"\n";
221 get_lod().write(out, indent_level + 2);
233 if (get_group_type() == GT_joint && _default_pose.
has_transform()) {
234 _default_pose.
write(out, indent_level + 2,
"<DefaultPose>");
237 if (get_scroll_u() != 0) {
238 indent(out, indent_level + 2)
239 <<
"<Scalar> scroll_u { " << get_scroll_u() <<
" }\n";
243 if (get_scroll_v() != 0) {
244 indent(out, indent_level + 2)
245 <<
"<Scalar> scroll_v { " << get_scroll_v() <<
" }\n";
249 if (get_scroll_w() != 0) {
250 indent(out, indent_level + 2)
251 <<
"<Scalar> scroll_w { " << get_scroll_w() <<
" }\n";
255 if (get_scroll_r() != 0) {
256 indent(out, indent_level + 2)
257 <<
"<Scalar> scroll_r { " << get_scroll_r() <<
" }\n";
266 if (get_portal_flag()) {
267 indent(out, indent_level + 2) <<
"<Scalar> portal { 1 }\n";
270 if (get_occluder_flag()) {
271 indent(out, indent_level + 2) <<
"<Scalar> occluder { 1 }\n";
274 if (get_polylight_flag()) {
275 indent(out, indent_level + 2) <<
"<Scalar> polylight { 1 }\n";
278 if (has_indexed_flag()) {
279 indent(out, indent_level + 2)
280 <<
"<Scalar> indexed { " << get_indexed_flag() <<
" }\n";
283 if (get_blend_mode() != BM_unspecified) {
284 indent(out, indent_level + 2)
285 <<
"<Scalar> blend { " << get_blend_mode() <<
" }\n";
288 if (get_blend_operand_a() != BO_unspecified) {
289 indent(out, indent_level + 2)
290 <<
"<Scalar> blendop-a { " << get_blend_operand_a() <<
" }\n";
293 if (get_blend_operand_b() != BO_unspecified) {
294 indent(out, indent_level + 2)
295 <<
"<Scalar> blendop-b { " << get_blend_operand_b() <<
" }\n";
300 indent(out, indent_level + 2)
301 <<
"<Scalar> blendr { " << c[0] <<
" }\n";
302 indent(out, indent_level + 2)
303 <<
"<Scalar> blendg { " << c[1] <<
" }\n";
304 indent(out, indent_level + 2)
305 <<
"<Scalar> blendb { " << c[2] <<
" }\n";
306 indent(out, indent_level + 2)
307 <<
"<Scalar> blenda { " << c[3] <<
" }\n";
310 GroupRefs::const_iterator gri;
311 for (gri = _group_refs.begin(); gri != _group_refs.end(); ++gri) {
313 indent(out, indent_level + 2)
314 <<
"<Ref> { " << group_ref->get_name() <<
" }\n";
321 write_vertex_ref(out, indent_level + 2);
323 indent(out, indent_level) <<
"}\n";
334 if (get_billboard_type() != BT_none) {
335 indent(out, indent_level)
336 <<
"<Billboard> { " << get_billboard_type() <<
" }\n";
339 if (has_billboard_center()) {
340 indent(out, indent_level)
341 <<
"<BillboardCenter> { " << get_billboard_center() <<
" }\n";
353 if (get_cs_type() != CST_none) {
354 indent(out, indent_level) <<
"<Collide> ";
355 if (has_collision_name()) {
356 enquote_string(out, get_collision_name()) <<
" ";
358 out <<
"{ " << get_cs_type();
359 if (get_collide_flags() != CF_none) {
360 out <<
" " << get_collide_flags();
365 if (has_collide_mask()) {
366 indent(out, indent_level)
367 <<
"<Scalar> collide-mask { 0x";
372 if (has_from_collide_mask()) {
373 indent(out, indent_level)
374 <<
"<Scalar> from-collide-mask { 0x";
379 if (has_into_collide_mask()) {
380 indent(out, indent_level)
381 <<
"<Scalar> into-collide-mask { 0x";
395 if (get_dcs_type() != DC_unspecified) {
396 indent(out, indent_level)
397 <<
"<DCS> { " << get_dcs_type() <<
" }\n";
400 if (get_dart_type() != DT_none) {
401 indent(out, indent_level)
402 <<
"<Dart> { " << get_dart_type() <<
" }\n";
405 if (get_model_flag()) {
406 indent(out, indent_level) <<
"<Model> { 1 }\n";
409 if (get_texlist_flag()) {
410 indent(out, indent_level) <<
"<TexList> { 1 }\n";
413 if (get_direct_flag()) {
414 indent(out, indent_level) <<
"<Scalar> direct { 1 }\n";
426 if (get_switch_flag()) {
427 indent(out, indent_level) <<
"<Switch> { 1 }\n";
428 if (get_switch_fps() != 0.0) {
429 indent(out, indent_level)
430 <<
"<Scalar> fps { " << get_switch_fps() <<
" }\n";
443 vector_string::const_iterator oi;
444 for (oi = _object_types.begin(); oi != _object_types.end(); ++oi) {
445 indent(out, indent_level)
446 <<
"<ObjectType> { ";
447 enquote_string(out, (*oi)) <<
" }\n";
458 if (get_decal_flag()) {
459 indent(out, indent_level) <<
"<Scalar> decal { 1 }\n";
471 TagData::const_iterator ti;
472 for (ti = _tag_data.begin(); ti != _tag_data.end(); ++ti) {
473 const string &key = (*ti).first;
474 const string &value = (*ti).second;
476 indent(out, indent_level) <<
"<Tag> ";
477 enquote_string(out, key) <<
" {\n";
478 enquote_string(out, value, indent_level + 2) <<
"\n";
479 indent(out, indent_level) <<
"}\n";
493 if (get_nofog_flag()) {
494 indent(out, indent_level) <<
"<Scalar> no-fog { 1 }\n";
509 return (get_group_type() == GT_joint);
644 if (has_indexed_flag()) {
645 return get_indexed_flag();
663 if (get_decal_flag()) {
679 VertexRef::iterator vri = _vref.find(vert);
681 if (vri != _vref.end()) {
684 (*vri).second += membership;
687 if ((*vri).second == 0.0) {
693 if (membership != 0.0) {
694 _vref[vert] = membership;
696 bool inserted = vert->_gref.insert(
this).second;
715 VertexRef::iterator vri = _vref.find(vert);
717 if (vri != _vref.end()) {
719 int count = vert->_gref.erase(
this);
722 nassertv(count == 1);
735 VertexRef::iterator vri;
736 for (vri = _vref.begin(); vri != _vref.end(); ++vri) {
738 int count = vert->_gref.erase(
this);
741 nassertv(count == 1);
757 VertexRef::const_iterator vri = _vref.find((
EggVertex *)vert);
759 if (vri != _vref.end()) {
760 return (*vri).second;
774 if (membership == 0.0) {
779 VertexRef::iterator vri = _vref.find(vert);
781 if (vri != _vref.end()) {
784 (*vri).second = membership;
788 _vref[vert] = membership;
790 bool inserted = vert->_gref.insert(
this).second;
808 nassertv(other !=
this);
809 VertexRef::const_iterator vri;
812 double membership = (*vri).second;
828 test_vref_integrity()
const {
831 VertexRef::const_iterator vri;
852 nassertv(get_group_type() == GT_instance);
853 _group_refs.push_back(group);
864 return _group_refs.size();
875 nassertr(n >= 0 && n < (
int)_group_refs.size(), NULL);
876 return _group_refs[n];
887 nassertv(n >= 0 && n < (
int)_group_refs.size());
888 _group_refs.erase(_group_refs.begin() + n);
913 if (cmp_nocase_uh(strval,
"group") == 0) {
915 }
else if (cmp_nocase_uh(strval,
"instance") == 0) {
917 }
else if (cmp_nocase_uh(strval,
"joint") == 0) {
933 if (cmp_nocase_uh(strval,
"sync") == 0) {
935 }
else if (cmp_nocase_uh(strval,
"nosync") == 0) {
937 }
else if (cmp_nocase_uh(strval,
"default") == 0) {
939 }
else if (cmp_nocase_uh(strval,
"structured") == 0) {
940 return DT_structured;
955 if (cmp_nocase_uh(strval,
"none") == 0) {
957 }
else if (cmp_nocase_uh(strval,
"local") == 0) {
959 }
else if (cmp_nocase_uh(strval,
"net") == 0) {
961 }
else if (cmp_nocase_uh(strval,
"no_touch") == 0) {
963 }
else if (cmp_nocase_uh(strval,
"default") == 0) {
966 return DC_unspecified;
979 if (cmp_nocase_uh(strval,
"axis") == 0) {
981 }
else if (cmp_nocase_uh(strval,
"point_eye") == 0) {
982 return BT_point_camera_relative;
983 }
else if (cmp_nocase_uh(strval,
"point_world") == 0) {
984 return BT_point_world_relative;
985 }
else if (cmp_nocase_uh(strval,
"point") == 0) {
986 return BT_point_world_relative;
1001 if (cmp_nocase_uh(strval,
"plane") == 0) {
1003 }
else if (cmp_nocase_uh(strval,
"polygon") == 0) {
1005 }
else if (cmp_nocase_uh(strval,
"polyset") == 0) {
1007 }
else if (cmp_nocase_uh(strval,
"sphere") == 0) {
1009 }
else if (cmp_nocase_uh(strval,
"box") == 0) {
1011 }
else if (cmp_nocase_uh(strval,
"inv-sphere") == 0 ||
1012 cmp_nocase_uh(strval,
"invsphere") == 0) {
1013 return CST_inv_sphere;
1014 }
else if (cmp_nocase_uh(strval,
"tube") == 0) {
1016 }
else if (cmp_nocase_uh(strval,
"floor-mesh") == 0 ||
1017 cmp_nocase_uh(strval,
"floormesh") == 0) {
1018 return CST_floor_mesh;
1035 if (cmp_nocase_uh(strval,
"intangible") == 0) {
1036 return CF_intangible;
1037 }
else if (cmp_nocase_uh(strval,
"event") == 0) {
1039 }
else if (cmp_nocase_uh(strval,
"descend") == 0) {
1041 }
else if (cmp_nocase_uh(strval,
"keep") == 0) {
1043 }
else if (cmp_nocase_uh(strval,
"solid") == 0) {
1045 }
else if (cmp_nocase_uh(strval,
"center") == 0) {
1047 }
else if (cmp_nocase_uh(strval,
"turnstile") == 0) {
1048 return CF_turnstile;
1049 }
else if (cmp_nocase_uh(strval,
"level") == 0) {
1065 if (cmp_nocase_uh(strval,
"none") == 0) {
1067 }
else if (cmp_nocase_uh(strval,
"add") == 0) {
1069 }
else if (cmp_nocase_uh(strval,
"subtract") == 0) {
1071 }
else if (cmp_nocase_uh(strval,
"inv_subtract") == 0) {
1072 return BM_inv_subtract;
1073 }
else if (cmp_nocase_uh(strval,
"min") == 0) {
1075 }
else if (cmp_nocase_uh(strval,
"max") == 0) {
1078 return BM_unspecified;
1091 if (cmp_nocase_uh(strval,
"zero") == 0) {
1093 }
else if (cmp_nocase_uh(strval,
"one") == 0) {
1095 }
else if (cmp_nocase_uh(strval,
"incoming_color") == 0) {
1096 return BO_incoming_color;
1097 }
else if (cmp_nocase_uh(strval,
"one_minus_incoming_color") == 0) {
1098 return BO_one_minus_incoming_color;
1099 }
else if (cmp_nocase_uh(strval,
"fbuffer_color") == 0) {
1100 return BO_fbuffer_color;
1101 }
else if (cmp_nocase_uh(strval,
"one_minus_fbuffer_color") == 0) {
1102 return BO_one_minus_fbuffer_color;
1103 }
else if (cmp_nocase_uh(strval,
"incoming_alpha") == 0) {
1104 return BO_incoming_alpha;
1105 }
else if (cmp_nocase_uh(strval,
"one_minus_incoming_alpha") == 0) {
1106 return BO_one_minus_incoming_alpha;
1107 }
else if (cmp_nocase_uh(strval,
"fbuffer_alpha") == 0) {
1108 return BO_fbuffer_alpha;
1109 }
else if (cmp_nocase_uh(strval,
"one_minus_fbuffer_alpha") == 0) {
1110 return BO_one_minus_fbuffer_alpha;
1111 }
else if (cmp_nocase_uh(strval,
"constant_color") == 0) {
1112 return BO_constant_color;
1113 }
else if (cmp_nocase_uh(strval,
"one_minus_constant_color") == 0) {
1114 return BO_one_minus_constant_color;
1115 }
else if (cmp_nocase_uh(strval,
"constant_alpha") == 0) {
1116 return BO_constant_alpha;
1117 }
else if (cmp_nocase_uh(strval,
"one_minus_constant_alpha") == 0) {
1118 return BO_one_minus_constant_alpha;
1119 }
else if (cmp_nocase_uh(strval,
"incoming_color_saturate") == 0) {
1120 return BO_incoming_color_saturate;
1121 }
else if (cmp_nocase_uh(strval,
"color_scale") == 0) {
1122 return BO_color_scale;
1123 }
else if (cmp_nocase_uh(strval,
"one_minus_color_scale") == 0) {
1124 return BO_one_minus_color_scale;
1125 }
else if (cmp_nocase_uh(strval,
"alpha_scale") == 0) {
1126 return BO_alpha_scale;
1127 }
else if (cmp_nocase_uh(strval,
"one_minus_alpha_scale") == 0) {
1128 return BO_one_minus_alpha_scale;
1130 return BO_unspecified;
1155 write_vertex_ref(ostream &out,
int indent_level)
const {
1166 bool all_membership_one =
true;
1168 VertexRef::const_iterator vri;
1169 for (vri = _vref.begin(); vri != _vref.end(); ++vri) {
1171 double membership = (*vri).second;
1173 if (membership != 1.0) {
1174 all_membership_one =
false;
1182 Pools::const_iterator pi;
1183 for (pi = _entries.begin(); pi != _entries.end(); ++pi) {
1185 const Memberships &memberships = (*pi).second;
1186 Memberships::const_iterator mi;
1187 for (mi = memberships.begin(); mi != memberships.end(); ++mi) {
1188 double membership = (*mi).first;
1189 const Indices &indices = (*mi).second;
1191 indent(out, indent_level)
1192 <<
"<VertexRef> {\n";
1193 write_long_list(out, indent_level+2, indices.begin(), indices.end(),
1198 if (!all_membership_one) {
1199 indent(out, indent_level + 2)
1200 <<
"<Scalar> membership { " << membership <<
" }\n";
1203 indent(out, indent_level + 2)
1204 <<
"// Invalid NULL vertex pool.\n";
1206 indent(out, indent_level + 2)
1207 <<
"<Ref> { " << pool->get_name() <<
" }\n";
1209 indent(out, indent_level)
1225 egg_start_parse_body() {
1226 egg_start_group_body();
1248 _under_flags |= UF_under_transform;
1261 _node_frame_inv = NULL;
1272 _under_flags |= UF_under_instance;
1273 if (_under_flags & UF_under_transform) {
1277 _under_flags |= UF_local_coord;
1283 _vertex_frame = _node_frame;
1284 _vertex_frame_inv = _node_frame_inv;
1285 _vertex_to_node = NULL;
1286 _node_to_vertex = NULL;
1305 CoordinateSystem to_cs) {
1332 EggGroupNode::r_transform(mat1, inv1, to_cs);
1334 EggGroupNode::r_transform(mat, inv, to_cs);
1339 _lod->transform(mat);
1341 if (has_billboard_center()) {
1342 _billboard_center = _billboard_center * mat;
1352 r_flatten_transforms() {
1353 EggGroupNode::r_flatten_transforms();
1358 _lod->transform(mat);
1361 if (get_billboard_type() != BT_none && !has_billboard_center()) {
1366 }
else if (has_billboard_center()) {
1367 _billboard_center = _billboard_center * mat;
1371 if (get_group_type() == GT_instance) {
1372 set_group_type(GT_group);
1375 if (get_group_type() != GT_joint) {
1376 internal_clear_transform();
1388 transform_changed() {
1402 ostream &operator << (ostream &out, EggGroup::GroupType t) {
1404 case EggGroup::GT_invalid:
1405 return out <<
"invalid group";
1406 case EggGroup::GT_group:
1407 return out <<
"group";
1408 case EggGroup::GT_instance:
1409 return out <<
"instance";
1410 case EggGroup::GT_joint:
1411 return out <<
"joint";
1414 nassertr(
false, out);
1415 return out <<
"(**invalid**)";
1422 ostream &operator << (ostream &out, EggGroup::DartType t) {
1424 case EggGroup::DT_none:
1425 return out <<
"none";
1426 case EggGroup::DT_sync:
1427 return out <<
"sync";
1428 case EggGroup::DT_nosync:
1429 return out <<
"nosync";
1430 case EggGroup::DT_structured:
1431 return out <<
"structured";
1432 case EggGroup::DT_default:
1436 nassertr(
false, out);
1437 return out <<
"(**invalid**)";
1444 ostream &operator << (ostream &out, EggGroup::DCSType t) {
1446 case EggGroup::DC_unspecified:
1447 return out <<
"unspecified";
1448 case EggGroup::DC_none:
1449 return out <<
"none";
1450 case EggGroup::DC_local:
1451 return out <<
"local";
1452 case EggGroup::DC_net:
1453 return out <<
"net";
1454 case EggGroup::DC_no_touch:
1455 return out <<
"no_touch";
1456 case EggGroup::DC_default:
1460 nassertr(
false, out);
1461 return out <<
"(**invalid**)";
1468 ostream &operator << (ostream &out, EggGroup::BillboardType t) {
1470 case EggGroup::BT_none:
1471 return out <<
"none";
1472 case EggGroup::BT_axis:
1473 return out <<
"axis";
1474 case EggGroup::BT_point_camera_relative:
1475 return out <<
"point_eye";
1476 case EggGroup::BT_point_world_relative:
1477 return out <<
"point_world";
1480 nassertr(
false, out);
1481 return out <<
"(**invalid**)";
1488 ostream &operator << (ostream &out, EggGroup::CollisionSolidType t) {
1490 case EggGroup::CST_none:
1491 return out <<
"None";
1492 case EggGroup::CST_plane:
1493 return out <<
"Plane";
1494 case EggGroup::CST_polygon:
1495 return out <<
"Polygon";
1496 case EggGroup::CST_polyset:
1497 return out <<
"Polyset";
1498 case EggGroup::CST_sphere:
1499 return out <<
"Sphere";
1500 case EggGroup::CST_inv_sphere:
1501 return out <<
"InvSphere";
1502 case EggGroup::CST_tube:
1503 return out <<
"Tube";
1504 case EggGroup::CST_floor_mesh:
1505 return out <<
"FloorMesh";
1506 case EggGroup::CST_box:
1507 return out <<
"Box";
1510 nassertr(
false, out);
1511 return out <<
"(**invalid**)";
1518 ostream &operator << (ostream &out, EggGroup::CollideFlags t) {
1519 if (t == EggGroup::CF_none) {
1520 return out <<
"none";
1523 const char *space =
"";
1525 if (bits & EggGroup::CF_intangible) {
1526 out << space <<
"intangible";
1529 if (bits & EggGroup::CF_event) {
1530 out << space <<
"event";
1533 if (bits & EggGroup::CF_descend) {
1534 out << space <<
"descend";
1537 if (bits & EggGroup::CF_keep) {
1538 out << space <<
"keep";
1541 if (bits & EggGroup::CF_solid) {
1542 out << space <<
"solid";
1545 if (bits & EggGroup::CF_center) {
1546 out << space <<
"center";
1549 if (bits & EggGroup::CF_turnstile) {
1550 out << space <<
"turnstile";
1553 if (bits & EggGroup::CF_level) {
1554 out << space <<
"level";
1565 operator << (ostream &out, EggGroup::BlendMode t) {
1567 case EggGroup::BM_unspecified:
1568 return out <<
"unspecified";
1570 case EggGroup::BM_none:
1571 return out <<
"none";
1573 case EggGroup::BM_add:
1574 return out <<
"add";
1576 case EggGroup::BM_subtract:
1577 return out <<
"subtract";
1579 case EggGroup::BM_inv_subtract:
1580 return out <<
"inv_subtract";
1582 case EggGroup::BM_min:
1583 return out <<
"min";
1585 case EggGroup::BM_max:
1586 return out <<
"max";
1589 return out <<
"**invalid EggGroup::BlendMode(" << (int)t <<
")**";
1597 operator << (ostream &out, EggGroup::BlendOperand t) {
1599 case EggGroup::BO_unspecified:
1600 return out <<
"unspecified";
1602 case EggGroup::BO_zero:
1603 return out <<
"zero";
1605 case EggGroup::BO_one:
1606 return out <<
"one";
1608 case EggGroup::BO_incoming_color:
1609 return out <<
"incomfing_color";
1611 case EggGroup::BO_one_minus_incoming_color:
1612 return out <<
"one_minus_incoming_color";
1614 case EggGroup::BO_fbuffer_color:
1615 return out <<
"fbuffer_color";
1617 case EggGroup::BO_one_minus_fbuffer_color:
1618 return out <<
"one_minus_fbuffer_color";
1620 case EggGroup::BO_incoming_alpha:
1621 return out <<
"incoming_alpha";
1623 case EggGroup::BO_one_minus_incoming_alpha:
1624 return out <<
"one_minus_incoming_alpha";
1626 case EggGroup::BO_fbuffer_alpha:
1627 return out <<
"fbuffer_alpha";
1629 case EggGroup::BO_one_minus_fbuffer_alpha:
1630 return out <<
"one_minus_fbuffer_alpha";
1632 case EggGroup::BO_constant_color:
1633 return out <<
"constant_color";
1635 case EggGroup::BO_one_minus_constant_color:
1636 return out <<
"one_minus_constant_color";
1638 case EggGroup::BO_constant_alpha:
1639 return out <<
"constant_alpha";
1641 case EggGroup::BO_one_minus_constant_alpha:
1642 return out <<
"one_minus_constant_alpha";
1644 case EggGroup::BO_incoming_color_saturate:
1645 return out <<
"incoming_color_saturate";
1647 case EggGroup::BO_color_scale:
1648 return out <<
"color_scale";
1650 case EggGroup::BO_one_minus_color_scale:
1651 return out <<
"one_minus_color_scale";
1653 case EggGroup::BO_alpha_scale:
1654 return out <<
"alpha_scale";
1656 case EggGroup::BO_one_minus_alpha_scale:
1657 return out <<
"one_minus_alpha_scale";
1660 return out <<
"**invalid EggGroup::BlendOperand(" << (int)t <<
")**";
static CollideFlags string_collide_flags(const string &strval)
Returns the CollideFlags value associated with the given string representation, or CF_none if the str...
virtual bool determine_indexed()
Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "indexed" sc...
AlphaMode get_alpha_mode() const
Returns the alpha mode that was set, or AM_unspecified if nothing was set.
VisibilityMode get_visibility_mode() const
Returns the visibility mode that was set, or VM_unspecified if nothing was set.
static CollisionSolidType string_cs_type(const string &strval)
Returns the CollisionSolidType value associated with the given string representation, or CST_none if the string does not match any known CollisionSolidType value.
virtual void write(ostream &out, int indent_level) const
Writes the group and all of its children to the indicated output stream in Egg format.
virtual bool is_joint() const
Returns true if this particular node represents a <Joint> entry or not.
This is our own Panda specialization on the default STL map.
virtual EggRenderMode * determine_depth_write_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
This is a 4-by-4 transform matrix.
virtual EggRenderMode * determine_bin()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
static DartType string_dart_type(const string &strval)
Returns the DartType value associated with the given string representation, or DT_none if the string ...
bool has_bin() const
Returns true if a bin name has been set for this particular object.
void write_collide_flags(ostream &out, int indent_level) const
Writes just the <Collide> entry and related fields to the indicated ostream.
const LMatrix4d & get_node_frame_inv() const
Returns the inverse of the matrix returned by get_node_frame().
virtual EggRenderMode * determine_alpha_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
VertexRef::const_iterator vref_begin() const
Returns an iterator that can, in conjunction with vref_end(), be used to traverse the entire set of r...
void add_group_ref(EggGroup *group)
Adds a new <Ref> entry to the group.
EggVertexPool * get_pool() const
Returns the vertex pool this vertex belongs in.
const LMatrix4d & get_vertex_frame() const
Returns the coordinate frame of the vertices referenced by primitives at or under this node...
bool has_object_type(const string &object_type) const
Returns true if the indicated object type has been added to the group, or false otherwise.
A base class for nodes in the hierarchy that are not leaf nodes.
void write_tags(ostream &out, int indent_level) const
Writes just the <Tag> entries, if any, to the indicated ostream.
virtual EggRenderMode * determine_depth_test_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
virtual EggRenderMode * determine_draw_order()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
static BlendOperand string_blend_operand(const string &strval)
Returns the BlendOperand value associated with the given string representation, or BO_none if the str...
virtual EggRenderMode * determine_depth_test_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
void steal_vrefs(EggGroup *other)
Moves all of the vertex references from the indicated other group into this one.
static BlendMode string_blend_mode(const string &strval)
Returns the BlendMode value associated with the given string representation, or BM_none if the string...
void write_switch_flags(ostream &out, int indent_level) const
Writes the <Switch> flag and related flags to the indicated ostream.
bool test_ref_count_integrity() const
Does some easy checks to make sure that the reference count isn't completely bogus.
void output_hex(ostream &out, int spaces_every=4) const
Writes the BitMask out as a hexadecimal number, with spaces every four digits.
virtual EggRenderMode * determine_visibility_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
void set_row(int row, const LVecBase4d &v)
Replaces the indicated row of the matrix.
virtual EggTransform * as_transform()
Returns this object cross-cast to an EggTransform pointer, if it inherits from EggTransform, or NULL if it does not.
void write_decal_flags(ostream &out, int indent_level) const
Writes the flags related to decaling, if any.
DepthWriteMode get_depth_write_mode() const
Returns the depth_write mode that was set, or DWM_unspecified if nothing was set. ...
bool remove_object_type(const string &object_type)
Removes the first instance of the indicated object type from the group if it is present.
void unref_all_vertices()
Removes all vertices from the reference list.
void unref_vertex(EggVertex *vert)
Removes the vertex from the set of those referenced by the group.
bool has_gref(const EggGroup *group) const
Returns true if the indicated group references this vertex, false otherwise.
EggGroup * get_group_ref(int n) const
Returns the nth <Ref> entry within this group.
virtual bool determine_decal()
Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "decal" flag...
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
void set_billboard_center(const LPoint3d &billboard_center)
Sets the point around which the billboard will rotate, if this node contains a billboard specificatio...
This class stores miscellaneous rendering properties that is associated with geometry, and which may be set on the geometry primitive level, on the group above it, or indirectly via a texture.
int get_index() const
Returns the index number of the vertex within its pool.
bool is_local_coord() const
Returns true if this node's vertices are not in the global coordinate space.
virtual EggRenderMode * determine_draw_order()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
virtual bool determine_decal()
Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "decal" flag...
const LMatrix4d & get_node_frame() const
Returns the coordinate frame of the node itself.
virtual EggRenderMode * determine_visibility_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal...
void write_render_mode(ostream &out, int indent_level) const
Writes the flags inherited from EggRenderMode and similar flags that control obscure render effects...
bool is_instance_type() const
Returns true if this group is an instance type node; i.e.
void set_vertex_membership(EggVertex *vert, double membership)
Explicitly sets the net membership of the indicated vertex in this group to the given value...
bool invert_from(const LMatrix4d &other)
Computes the inverse of the other matrix, and stores the result in this matrix.
double get_vertex_membership(const EggVertex *vert) const
Returns the amount of membership of the indicated vertex in this group.
virtual EggRenderMode * determine_depth_write_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
void write_header(ostream &out, int indent_level, const char *egg_keyword) const
Writes the first line of the egg object, e.g.
static GroupType string_group_type(const string &strval)
Returns the GroupType value associated with the given string representation, or GT_invalid if the str...
void write_model_flags(ostream &out, int indent_level) const
Writes the <Model> flag and related flags to the indicated ostream.
virtual EggRenderMode * determine_alpha_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
const LColor & get_blend_color() const
Returns the blend color if one has been specified, or (0, 0, 0, 0) if one has not.
bool has_draw_order() const
Returns true if the draw-order flag has been set for this particular object.
static DCSType string_dcs_type(const string &strval)
Returns the DCSType value associated with the given string representation, or DC_unspecified if the s...
virtual EggRenderMode * determine_bin()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
void write(ostream &out, int indent_level) const
Writes the attributes to the indicated output stream in Egg format.
void write_billboard_flags(ostream &out, int indent_level) const
Writes just the <Billboard> entry and related fields to the indicated ostream.
This is the base class for all three-component vectors and points.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
bool has_blend_color() const
Returns true if the blend color has been specified, false otherwise.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
virtual bool determine_indexed()
Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "indexed" sc...
void clear_group_refs()
Removes all of the <Ref> entries within this group.
void ref_vertex(EggVertex *vert, double membership=1.0)
Adds the vertex to the set of those referenced by the group, at the indicated membership level...
bool has_depth_offset() const
Returns true if the depth-offset flag has been set for this particular object.
static BillboardType string_billboard_type(const string &strval)
Returns the BillboardType value associated with the given string representation, or BT_none if the st...
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
void write_object_types(ostream &out, int indent_level) const
Writes just the <ObjectTypes> entries, if any, to the indicated ostream.
void remove_group_ref(int n)
Removes the nth <Ref> entry within this group.
Another kind of proxy, similar to RefCountProxy.
TypeHandle is the identifier used to differentiate C++ class types.
virtual EggRenderMode * determine_depth_offset()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
virtual EggRenderMode * determine_depth_offset()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
A collection of vertices.
VertexRef::const_iterator vref_end() const
Returns an iterator that can, in conjunction with vref_begin(), be used to traverse the entire set of...
virtual void write(ostream &out, int indent_level) const
Writes the group and all of its children to the indicated output stream in Egg format.
DepthTestMode get_depth_test_mode() const
Returns the depth_test mode that was set, or DTM_unspecified if nothing was set.
int get_num_group_refs() const
Returns the number of <Ref> entries within this group.
const LMatrix4d & get_vertex_frame_inv() const
Returns the inverse of the matrix returned by get_vertex_frame().
static const LVecBase4f & zero()
Returns a zero-length vector.
A type of group node that holds related subnodes.