39 _blend_mode = BM_unspecified;
40 _blend_operand_a = BO_unspecified;
41 _blend_operand_b = BO_unspecified;
42 _blend_color = LColor::zero();
62 EggTransform::operator = (copy);
64 _flags2 = copy._flags2;
65 _collide_mask = copy._collide_mask;
66 _from_collide_mask = copy._from_collide_mask;
67 _into_collide_mask = copy._into_collide_mask;
68 _billboard_center = copy._billboard_center;
69 _object_types = copy._object_types;
70 _collision_name = copy._collision_name;
73 _blend_mode = copy._blend_mode;
74 _blend_operand_a = copy._blend_operand_a;
75 _blend_operand_b = copy._blend_operand_b;
76 _blend_color = copy._blend_color;
77 _tag_data = copy._tag_data;
78 _u_speed = copy._u_speed;
79 _v_speed = copy._v_speed;
80 _w_speed = copy._w_speed;
81 _r_speed = copy._r_speed;
82 _default_pose = copy._default_pose;
89 VertexRef::iterator vri;
90 for (vri = _vref.begin(); vri != _vref.end(); ++vri) {
93 bool inserted = vert->_gref.insert(
this).second;
96 nassertr(inserted, *
this);
102 EggGroupNode::operator = (copy);
103 EggRenderMode::operator = (copy);
121 set_group_type(GroupType type) {
122 if (type != get_group_type()) {
124 if (type != GT_instance) {
126 nassertv(_group_refs.empty());
131 nassertv((type & ~F_group_type)==0);
132 _flags = (_flags & ~F_group_type) | type;
146 vector_string::const_iterator oi;
147 for (oi = _object_types.begin(); oi != _object_types.end(); ++oi) {
148 if (cmp_nocase_uh((*oi), object_type) == 0) {
162 vector_string::iterator oi;
163 for (oi = _object_types.begin(); oi != _object_types.end(); ++oi) {
164 if (cmp_nocase_uh((*oi), object_type) == 0) {
165 _object_types.erase(oi);
177 write(ostream &out,
int indent_level)
const {
178 test_under_integrity();
180 switch (get_group_type()) {
195 nassert_raise(
"invalid EggGroup type");
200 indent(out, indent_level + 2)
201 <<
"// Bin " << DCAST(
EggBin,
this)->get_bin_number() <<
"\n";
205 get_lod().write(out, indent_level + 2);
217 if (get_group_type() == GT_joint && _default_pose.
has_transform()) {
218 _default_pose.
write(out, indent_level + 2,
"<DefaultPose>");
221 if (get_scroll_u() != 0) {
222 indent(out, indent_level + 2)
223 <<
"<Scalar> scroll_u { " << get_scroll_u() <<
" }\n";
227 if (get_scroll_v() != 0) {
228 indent(out, indent_level + 2)
229 <<
"<Scalar> scroll_v { " << get_scroll_v() <<
" }\n";
233 if (get_scroll_w() != 0) {
234 indent(out, indent_level + 2)
235 <<
"<Scalar> scroll_w { " << get_scroll_w() <<
" }\n";
239 if (get_scroll_r() != 0) {
240 indent(out, indent_level + 2)
241 <<
"<Scalar> scroll_r { " << get_scroll_r() <<
" }\n";
250 if (get_portal_flag()) {
251 indent(out, indent_level + 2) <<
"<Scalar> portal { 1 }\n";
254 if (get_occluder_flag()) {
255 indent(out, indent_level + 2) <<
"<Scalar> occluder { 1 }\n";
258 if (get_polylight_flag()) {
259 indent(out, indent_level + 2) <<
"<Scalar> polylight { 1 }\n";
262 if (has_indexed_flag()) {
263 indent(out, indent_level + 2)
264 <<
"<Scalar> indexed { " << get_indexed_flag() <<
" }\n";
267 if (get_blend_mode() != BM_unspecified) {
268 indent(out, indent_level + 2)
269 <<
"<Scalar> blend { " << get_blend_mode() <<
" }\n";
272 if (get_blend_operand_a() != BO_unspecified) {
273 indent(out, indent_level + 2)
274 <<
"<Scalar> blendop-a { " << get_blend_operand_a() <<
" }\n";
277 if (get_blend_operand_b() != BO_unspecified) {
278 indent(out, indent_level + 2)
279 <<
"<Scalar> blendop-b { " << get_blend_operand_b() <<
" }\n";
284 indent(out, indent_level + 2)
285 <<
"<Scalar> blendr { " << c[0] <<
" }\n";
286 indent(out, indent_level + 2)
287 <<
"<Scalar> blendg { " << c[1] <<
" }\n";
288 indent(out, indent_level + 2)
289 <<
"<Scalar> blendb { " << c[2] <<
" }\n";
290 indent(out, indent_level + 2)
291 <<
"<Scalar> blenda { " << c[3] <<
" }\n";
294 GroupRefs::const_iterator gri;
295 for (gri = _group_refs.begin(); gri != _group_refs.end(); ++gri) {
297 indent(out, indent_level + 2)
298 <<
"<Ref> { " << group_ref->get_name() <<
" }\n";
305 write_vertex_ref(out, indent_level + 2);
307 indent(out, indent_level) <<
"}\n";
316 if (get_billboard_type() != BT_none) {
318 <<
"<Billboard> { " << get_billboard_type() <<
" }\n";
321 if (has_billboard_center()) {
323 <<
"<BillboardCenter> { " << get_billboard_center() <<
" }\n";
333 if (get_cs_type() != CST_none) {
334 indent(out, indent_level) <<
"<Collide> ";
335 if (has_collision_name()) {
338 out <<
"{ " << get_cs_type();
339 if (get_collide_flags() != CF_none) {
340 out <<
" " << get_collide_flags();
345 if (has_collide_mask()) {
347 <<
"<Scalar> collide-mask { 0x";
348 get_collide_mask().output_hex(out, 0);
352 if (has_from_collide_mask()) {
354 <<
"<Scalar> from-collide-mask { 0x";
355 get_from_collide_mask().output_hex(out, 0);
359 if (has_into_collide_mask()) {
361 <<
"<Scalar> into-collide-mask { 0x";
362 get_into_collide_mask().output_hex(out, 0);
372 if (get_dcs_type() != DC_unspecified) {
374 <<
"<DCS> { " << get_dcs_type() <<
" }\n";
377 if (get_dart_type() != DT_none) {
379 <<
"<Dart> { " << get_dart_type() <<
" }\n";
382 if (get_model_flag()) {
383 indent(out, indent_level) <<
"<Model> { 1 }\n";
386 if (get_texlist_flag()) {
387 indent(out, indent_level) <<
"<TexList> { 1 }\n";
390 if (get_direct_flag()) {
391 indent(out, indent_level) <<
"<Scalar> direct { 1 }\n";
400 if (get_switch_flag()) {
401 indent(out, indent_level) <<
"<Switch> { 1 }\n";
402 if (get_switch_fps() != 0.0) {
404 <<
"<Scalar> fps { " << get_switch_fps() <<
" }\n";
414 vector_string::const_iterator oi;
415 for (oi = _object_types.begin(); oi != _object_types.end(); ++oi) {
417 <<
"<ObjectType> { ";
427 if (get_decal_flag()) {
428 indent(out, indent_level) <<
"<Scalar> decal { 1 }\n";
437 TagData::const_iterator ti;
438 for (ti = _tag_data.begin(); ti != _tag_data.end(); ++ti) {
439 const string &key = (*ti).first;
440 const string &value = (*ti).second;
442 indent(out, indent_level) <<
"<Tag> ";
445 indent(out, indent_level) <<
"}\n";
457 if (get_nofog_flag()) {
458 indent(out, indent_level) <<
"<Scalar> no-fog { 1 }\n";
469 return (get_group_type() == GT_joint);
580 if (has_indexed_flag()) {
581 return get_indexed_flag();
596 if (get_decal_flag()) {
609 VertexRef::iterator vri = _vref.find(vert);
611 if (vri != _vref.end()) {
613 (*vri).second += membership;
616 if ((*vri).second == 0.0) {
622 if (membership != 0.0) {
623 _vref[vert] = membership;
625 bool inserted = vert->_gref.insert(
this).second;
641 VertexRef::iterator vri = _vref.find(vert);
643 if (vri != _vref.end()) {
645 int count = vert->_gref.erase(
this);
648 nassertv(count == 1);
659 VertexRef::iterator vri;
660 for (vri = _vref.begin(); vri != _vref.end(); ++vri) {
662 int count = vert->_gref.erase(
this);
665 nassertv(count == 1);
678 VertexRef::const_iterator vri = _vref.find((
EggVertex *)vert);
680 if (vri != _vref.end()) {
681 return (*vri).second;
693 if (membership == 0.0) {
698 VertexRef::iterator vri = _vref.find(vert);
700 if (vri != _vref.end()) {
702 (*vri).second = membership;
706 _vref[vert] = membership;
708 bool inserted = vert->_gref.insert(
this).second;
722 nassertv(other !=
this);
723 VertexRef::const_iterator vri;
726 double membership = (*vri).second;
740 test_vref_integrity()
const {
743 VertexRef::const_iterator vri;
761 nassertv(get_group_type() == GT_instance);
762 _group_refs.push_back(group);
770 get_num_group_refs()
const {
771 return _group_refs.size();
779 nassertr(n >= 0 && n < (
int)_group_refs.size(),
nullptr);
780 return _group_refs[n];
788 nassertv(n >= 0 && n < (
int)_group_refs.size());
789 _group_refs.erase(_group_refs.begin() + n);
809 if (cmp_nocase_uh(strval,
"group") == 0) {
811 }
else if (cmp_nocase_uh(strval,
"instance") == 0) {
813 }
else if (cmp_nocase_uh(strval,
"joint") == 0) {
826 if (cmp_nocase_uh(strval,
"sync") == 0) {
828 }
else if (cmp_nocase_uh(strval,
"nosync") == 0) {
830 }
else if (cmp_nocase_uh(strval,
"default") == 0) {
832 }
else if (cmp_nocase_uh(strval,
"structured") == 0) {
833 return DT_structured;
845 if (cmp_nocase_uh(strval,
"none") == 0) {
847 }
else if (cmp_nocase_uh(strval,
"local") == 0) {
849 }
else if (cmp_nocase_uh(strval,
"net") == 0) {
851 }
else if (cmp_nocase_uh(strval,
"no_touch") == 0) {
853 }
else if (cmp_nocase_uh(strval,
"default") == 0) {
856 return DC_unspecified;
867 if (cmp_nocase_uh(strval,
"axis") == 0) {
869 }
else if (cmp_nocase_uh(strval,
"point_eye") == 0) {
870 return BT_point_camera_relative;
871 }
else if (cmp_nocase_uh(strval,
"point_world") == 0) {
872 return BT_point_world_relative;
873 }
else if (cmp_nocase_uh(strval,
"point") == 0) {
874 return BT_point_world_relative;
887 if (cmp_nocase_uh(strval,
"plane") == 0) {
889 }
else if (cmp_nocase_uh(strval,
"polygon") == 0) {
891 }
else if (cmp_nocase_uh(strval,
"polyset") == 0) {
893 }
else if (cmp_nocase_uh(strval,
"sphere") == 0) {
895 }
else if (cmp_nocase_uh(strval,
"box") == 0) {
897 }
else if (cmp_nocase_uh(strval,
"inv-sphere") == 0 ||
898 cmp_nocase_uh(strval,
"invsphere") == 0) {
899 return CST_inv_sphere;
900 }
else if (cmp_nocase_uh(strval,
"tube") == 0 ||
901 cmp_nocase_uh(strval,
"capsule") == 0) {
903 }
else if (cmp_nocase_uh(strval,
"floor-mesh") == 0 ||
904 cmp_nocase_uh(strval,
"floormesh") == 0) {
905 return CST_floor_mesh;
919 if (cmp_nocase_uh(strval,
"intangible") == 0) {
920 return CF_intangible;
921 }
else if (cmp_nocase_uh(strval,
"event") == 0) {
923 }
else if (cmp_nocase_uh(strval,
"descend") == 0) {
925 }
else if (cmp_nocase_uh(strval,
"keep") == 0) {
927 }
else if (cmp_nocase_uh(strval,
"solid") == 0) {
929 }
else if (cmp_nocase_uh(strval,
"center") == 0) {
931 }
else if (cmp_nocase_uh(strval,
"turnstile") == 0) {
933 }
else if (cmp_nocase_uh(strval,
"level") == 0) {
947 if (cmp_nocase_uh(strval,
"none") == 0) {
949 }
else if (cmp_nocase_uh(strval,
"add") == 0) {
951 }
else if (cmp_nocase_uh(strval,
"subtract") == 0) {
953 }
else if (cmp_nocase_uh(strval,
"inv_subtract") == 0) {
954 return BM_inv_subtract;
955 }
else if (cmp_nocase_uh(strval,
"min") == 0) {
957 }
else if (cmp_nocase_uh(strval,
"max") == 0) {
960 return BM_unspecified;
971 if (cmp_nocase_uh(strval,
"zero") == 0) {
973 }
else if (cmp_nocase_uh(strval,
"one") == 0) {
975 }
else if (cmp_nocase_uh(strval,
"incoming_color") == 0) {
976 return BO_incoming_color;
977 }
else if (cmp_nocase_uh(strval,
"one_minus_incoming_color") == 0) {
978 return BO_one_minus_incoming_color;
979 }
else if (cmp_nocase_uh(strval,
"fbuffer_color") == 0) {
980 return BO_fbuffer_color;
981 }
else if (cmp_nocase_uh(strval,
"one_minus_fbuffer_color") == 0) {
982 return BO_one_minus_fbuffer_color;
983 }
else if (cmp_nocase_uh(strval,
"incoming_alpha") == 0) {
984 return BO_incoming_alpha;
985 }
else if (cmp_nocase_uh(strval,
"one_minus_incoming_alpha") == 0) {
986 return BO_one_minus_incoming_alpha;
987 }
else if (cmp_nocase_uh(strval,
"fbuffer_alpha") == 0) {
988 return BO_fbuffer_alpha;
989 }
else if (cmp_nocase_uh(strval,
"one_minus_fbuffer_alpha") == 0) {
990 return BO_one_minus_fbuffer_alpha;
991 }
else if (cmp_nocase_uh(strval,
"constant_color") == 0) {
992 return BO_constant_color;
993 }
else if (cmp_nocase_uh(strval,
"one_minus_constant_color") == 0) {
994 return BO_one_minus_constant_color;
995 }
else if (cmp_nocase_uh(strval,
"constant_alpha") == 0) {
996 return BO_constant_alpha;
997 }
else if (cmp_nocase_uh(strval,
"one_minus_constant_alpha") == 0) {
998 return BO_one_minus_constant_alpha;
999 }
else if (cmp_nocase_uh(strval,
"incoming_color_saturate") == 0) {
1000 return BO_incoming_color_saturate;
1001 }
else if (cmp_nocase_uh(strval,
"color_scale") == 0) {
1002 return BO_color_scale;
1003 }
else if (cmp_nocase_uh(strval,
"one_minus_color_scale") == 0) {
1004 return BO_one_minus_color_scale;
1005 }
else if (cmp_nocase_uh(strval,
"alpha_scale") == 0) {
1006 return BO_alpha_scale;
1007 }
else if (cmp_nocase_uh(strval,
"one_minus_alpha_scale") == 0) {
1008 return BO_one_minus_alpha_scale;
1010 return BO_unspecified;
1030 write_vertex_ref(ostream &out,
int indent_level)
const {
1041 bool all_membership_one =
true;
1043 VertexRef::const_iterator vri;
1044 for (vri = _vref.begin(); vri != _vref.end(); ++vri) {
1046 double membership = (*vri).second;
1048 if (membership != 1.0) {
1049 all_membership_one =
false;
1057 Pools::const_iterator pi;
1058 for (pi = _entries.begin(); pi != _entries.end(); ++pi) {
1060 const Memberships &memberships = (*pi).second;
1061 Memberships::const_iterator mi;
1062 for (mi = memberships.begin(); mi != memberships.end(); ++mi) {
1063 double membership = (*mi).first;
1064 const Indices &indices = (*mi).second;
1066 indent(out, indent_level)
1067 <<
"<VertexRef> {\n";
1073 if (!all_membership_one) {
1074 indent(out, indent_level + 2)
1075 <<
"<Scalar> membership { " << membership <<
" }\n";
1077 if (pool ==
nullptr) {
1078 indent(out, indent_level + 2)
1079 <<
"// Invalid NULL vertex pool.\n";
1081 indent(out, indent_level + 2)
1082 <<
"<Ref> { " << pool->get_name() <<
" }\n";
1084 indent(out, indent_level)
1097 egg_start_parse_body() {
1098 egg_start_group_body();
1116 _under_flags |= UF_under_transform;
1127 new MatrixFrame(mat);
1129 _node_frame_inv =
nullptr;
1140 _under_flags |= UF_under_instance;
1141 if (_under_flags & UF_under_transform) {
1144 _under_flags |= UF_local_coord;
1150 _vertex_frame = _node_frame;
1151 _vertex_frame_inv = _node_frame_inv;
1152 _vertex_to_node =
nullptr;
1153 _node_to_vertex =
nullptr;
1167 r_transform(
const LMatrix4d &mat,
const LMatrix4d &inv,
1168 CoordinateSystem to_cs) {
1177 LMatrix4d mat1 = mat;
1178 LMatrix4d inv1 = inv;
1182 mat1.set_row(3, LVector3d(0.0, 0.0, 0.0));
1183 inv1.set_row(3, LVector3d(0.0, 0.0, 0.0));
1193 EggGroupNode::r_transform(mat1, inv1, to_cs);
1195 EggGroupNode::r_transform(mat, inv, to_cs);
1200 _lod->transform(mat);
1202 if (has_billboard_center()) {
1203 _billboard_center = _billboard_center * mat;
1211 r_flatten_transforms() {
1212 EggGroupNode::r_flatten_transforms();
1217 _lod->transform(mat);
1220 if (get_billboard_type() != BT_none && !has_billboard_center()) {
1225 }
else if (has_billboard_center()) {
1226 _billboard_center = _billboard_center * mat;
1230 if (get_group_type() == GT_instance) {
1231 set_group_type(GT_group);
1234 if (get_group_type() != GT_joint) {
1235 internal_clear_transform();
1245 transform_changed() {
1258 ostream &operator << (ostream &out, EggGroup::GroupType t) {
1260 case EggGroup::GT_invalid:
1261 return out <<
"invalid group";
1262 case EggGroup::GT_group:
1263 return out <<
"group";
1264 case EggGroup::GT_instance:
1265 return out <<
"instance";
1266 case EggGroup::GT_joint:
1267 return out <<
"joint";
1270 nassertr(
false, out);
1271 return out <<
"(**invalid**)";
1277 ostream &operator << (ostream &out, EggGroup::DartType t) {
1279 case EggGroup::DT_none:
1280 return out <<
"none";
1281 case EggGroup::DT_sync:
1282 return out <<
"sync";
1283 case EggGroup::DT_nosync:
1284 return out <<
"nosync";
1285 case EggGroup::DT_structured:
1286 return out <<
"structured";
1287 case EggGroup::DT_default:
1291 nassertr(
false, out);
1292 return out <<
"(**invalid**)";
1298 ostream &operator << (ostream &out, EggGroup::DCSType t) {
1300 case EggGroup::DC_unspecified:
1301 return out <<
"unspecified";
1302 case EggGroup::DC_none:
1303 return out <<
"none";
1304 case EggGroup::DC_local:
1305 return out <<
"local";
1306 case EggGroup::DC_net:
1307 return out <<
"net";
1308 case EggGroup::DC_no_touch:
1309 return out <<
"no_touch";
1310 case EggGroup::DC_default:
1314 nassertr(
false, out);
1315 return out <<
"(**invalid**)";
1321 ostream &operator << (ostream &out, EggGroup::BillboardType t) {
1323 case EggGroup::BT_none:
1324 return out <<
"none";
1325 case EggGroup::BT_axis:
1326 return out <<
"axis";
1327 case EggGroup::BT_point_camera_relative:
1328 return out <<
"point_eye";
1329 case EggGroup::BT_point_world_relative:
1330 return out <<
"point_world";
1333 nassertr(
false, out);
1334 return out <<
"(**invalid**)";
1340 ostream &operator << (ostream &out, EggGroup::CollisionSolidType t) {
1342 case EggGroup::CST_none:
1343 return out <<
"None";
1344 case EggGroup::CST_plane:
1345 return out <<
"Plane";
1346 case EggGroup::CST_polygon:
1347 return out <<
"Polygon";
1348 case EggGroup::CST_polyset:
1349 return out <<
"Polyset";
1350 case EggGroup::CST_sphere:
1351 return out <<
"Sphere";
1352 case EggGroup::CST_inv_sphere:
1353 return out <<
"InvSphere";
1354 case EggGroup::CST_tube:
1355 return out <<
"Tube";
1356 case EggGroup::CST_floor_mesh:
1357 return out <<
"FloorMesh";
1358 case EggGroup::CST_box:
1359 return out <<
"Box";
1362 nassertr(
false, out);
1363 return out <<
"(**invalid**)";
1369 ostream &operator << (ostream &out, EggGroup::CollideFlags t) {
1370 if (t == EggGroup::CF_none) {
1371 return out <<
"none";
1374 const char *space =
"";
1376 if (bits & EggGroup::CF_intangible) {
1377 out << space <<
"intangible";
1380 if (bits & EggGroup::CF_event) {
1381 out << space <<
"event";
1384 if (bits & EggGroup::CF_descend) {
1385 out << space <<
"descend";
1388 if (bits & EggGroup::CF_keep) {
1389 out << space <<
"keep";
1392 if (bits & EggGroup::CF_solid) {
1393 out << space <<
"solid";
1396 if (bits & EggGroup::CF_center) {
1397 out << space <<
"center";
1400 if (bits & EggGroup::CF_turnstile) {
1401 out << space <<
"turnstile";
1404 if (bits & EggGroup::CF_level) {
1405 out << space <<
"level";
1415 operator << (ostream &out, EggGroup::BlendMode t) {
1417 case EggGroup::BM_unspecified:
1418 return out <<
"unspecified";
1420 case EggGroup::BM_none:
1421 return out <<
"none";
1423 case EggGroup::BM_add:
1424 return out <<
"add";
1426 case EggGroup::BM_subtract:
1427 return out <<
"subtract";
1429 case EggGroup::BM_inv_subtract:
1430 return out <<
"inv_subtract";
1432 case EggGroup::BM_min:
1433 return out <<
"min";
1435 case EggGroup::BM_max:
1436 return out <<
"max";
1439 return out <<
"**invalid EggGroup::BlendMode(" << (int)t <<
")**";
1446 operator << (ostream &out, EggGroup::BlendOperand t) {
1448 case EggGroup::BO_unspecified:
1449 return out <<
"unspecified";
1451 case EggGroup::BO_zero:
1452 return out <<
"zero";
1454 case EggGroup::BO_one:
1455 return out <<
"one";
1457 case EggGroup::BO_incoming_color:
1458 return out <<
"incomfing_color";
1460 case EggGroup::BO_one_minus_incoming_color:
1461 return out <<
"one_minus_incoming_color";
1463 case EggGroup::BO_fbuffer_color:
1464 return out <<
"fbuffer_color";
1466 case EggGroup::BO_one_minus_fbuffer_color:
1467 return out <<
"one_minus_fbuffer_color";
1469 case EggGroup::BO_incoming_alpha:
1470 return out <<
"incoming_alpha";
1472 case EggGroup::BO_one_minus_incoming_alpha:
1473 return out <<
"one_minus_incoming_alpha";
1475 case EggGroup::BO_fbuffer_alpha:
1476 return out <<
"fbuffer_alpha";
1478 case EggGroup::BO_one_minus_fbuffer_alpha:
1479 return out <<
"one_minus_fbuffer_alpha";
1481 case EggGroup::BO_constant_color:
1482 return out <<
"constant_color";
1484 case EggGroup::BO_one_minus_constant_color:
1485 return out <<
"one_minus_constant_color";
1487 case EggGroup::BO_constant_alpha:
1488 return out <<
"constant_alpha";
1490 case EggGroup::BO_one_minus_constant_alpha:
1491 return out <<
"one_minus_constant_alpha";
1493 case EggGroup::BO_incoming_color_saturate:
1494 return out <<
"incoming_color_saturate";
1496 case EggGroup::BO_color_scale:
1497 return out <<
"color_scale";
1499 case EggGroup::BO_one_minus_color_scale:
1500 return out <<
"one_minus_color_scale";
1502 case EggGroup::BO_alpha_scale:
1503 return out <<
"alpha_scale";
1505 case EggGroup::BO_one_minus_alpha_scale:
1506 return out <<
"one_minus_alpha_scale";
1509 return out <<
"**invalid EggGroup::BlendOperand(" << (int)t <<
")**";
virtual void write(std::ostream &out, int indent_level) const
Writes the group and all of its children to the indicated output stream in Egg format.
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 DartType string_dart_type(const std::string &strval)
Returns the DartType value associated with the given string representation, or DT_none if the string ...
void write_render_mode(std::ostream &out, int indent_level) const
Writes the flags inherited from EggRenderMode and similar flags that control obscure render effects.
virtual bool is_joint() const
Returns true if this particular node represents a <Joint> entry or not.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL map.
void write_header(std::ostream &out, int indent_level, const char *egg_keyword) const
Writes the first line of the egg object, e.g.
virtual EggRenderMode * determine_depth_write_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
virtual EggRenderMode * determine_bin()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
bool has_bin() const
Returns true if a bin name has been set for this particular object.
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...
bool remove_object_type(const std::string &object_type)
Removes the first instance of the indicated object type from the group if it is present.
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.
A base class for nodes in the hierarchy that are not leaf nodes.
ostream & enquote_string(ostream &out, const string &str, int indent_level, bool always_quote)
Writes the string to the indicated output stream.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 BillboardType string_billboard_type(const std::string &strval)
Returns the BillboardType value associated with the given string representation, or BT_none if the st...
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.
void write_collide_flags(std::ostream &out, int indent_level) const
Writes just the <Collide> entry and related fields to the indicated ostream.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool test_ref_count_integrity() const
Does some easy checks to make sure that the reference count isn't completely bogus.
void write_billboard_flags(std::ostream &out, int indent_level) const
Writes just the <Billboard> entry and related fields to the indicated ostream.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual EggRenderMode * determine_visibility_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
virtual EggTransform * as_transform()
Returns this object cross-cast to an EggTransform pointer, if it inherits from EggTransform,...
DepthWriteMode get_depth_write_mode() const
Returns the depth_write mode that was set, or DWM_unspecified if nothing was set.
void write_model_flags(std::ostream &out, int indent_level) const
Writes the <Model> flag and related flags to the indicated ostream.
static CollisionSolidType string_cs_type(const std::string &strval)
Returns the CollisionSolidType value associated with the given string representation,...
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.
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...
This class stores miscellaneous rendering properties that is associated with geometry,...
virtual void write(std::ostream &out, int indent_level) const
Writes the group and all of its children to the indicated output stream in Egg format.
static CollideFlags string_collide_flags(const std::string &strval)
Returns the CollideFlags value associated with the given string representation, or CF_none if the str...
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.
static BlendMode string_blend_mode(const std::string &strval)
Returns the BlendMode value associated with the given string representation, or BM_none if the string...
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.
void write_switch_flags(std::ostream &out, int indent_level) const
Writes the <Switch> flag and related flags to the indicated ostream.
virtual EggRenderMode * determine_visibility_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
bool has_object_type(const std::string &object_type) const
Returns true if the indicated object type has been added to the group, or false otherwise.
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
void write_tags(std::ostream &out, int indent_level) const
Writes just the <Tag> entries, if any, to the indicated ostream.
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.
void write_long_list(std::ostream &out, int indent_level, InputIterator ifirst, InputIterator ilast, std::string first_prefix="", std::string later_prefix="", int max_col=72)
Writes a list of things to the indicated output stream, with a space separating each item.
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...
virtual EggRenderMode * determine_alpha_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
void write(std::ostream &out, int indent_level) const
Writes the attributes to the indicated output stream in Egg format.
static GroupType string_group_type(const std::string &strval)
Returns the GroupType value associated with the given string representation, or GT_invalid if the str...
bool has_draw_order() const
Returns true if the draw-order flag has been set for this particular object.
set_billboard_center
Sets the point around which the billboard will rotate, if this node contains a billboard specificatio...
virtual EggRenderMode * determine_bin()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
get_blend_color
Returns the blend color if one has been specified, or (0, 0, 0, 0) if one has not.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool has_depth_offset() const
Returns true if the depth-offset flag has been set for this particular object.
get_group_ref
Returns the nth <Ref> entry within this group.
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
void remove_group_ref(int n)
Removes the nth <Ref> entry within this group.
has_blend_color
Returns true if the blend color has been specified, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
void write_object_types(std::ostream &out, int indent_level) const
Writes just the <ObjectTypes> entries, if any, to the indicated ostream.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
void write_decal_flags(std::ostream &out, int indent_level) const
Writes the flags related to decaling, if any.
static DCSType string_dcs_type(const std::string &strval)
Returns the DCSType value associated with the given string representation, or DC_unspecified if the s...
static BlendOperand string_blend_operand(const std::string &strval)
Returns the BlendOperand value associated with the given string representation, or BO_none if the str...
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
DepthTestMode get_depth_test_mode() const
Returns the depth_test mode that was set, or DTM_unspecified if nothing was set.
const LMatrix4d & get_vertex_frame_inv() const
Returns the inverse of the matrix returned by get_vertex_frame().
A type of group node that holds related subnodes.