17 #include "pandaNode.h" 18 #include "workingNodePath.h" 20 #include "billboardEffect.h" 21 #include "renderEffects.h" 22 #include "transformState.h" 23 #include "colorScaleAttrib.h" 24 #include "colorAttrib.h" 25 #include "materialAttrib.h" 26 #include "textureAttrib.h" 27 #include "cullFaceAttrib.h" 28 #include "transparencyAttrib.h" 29 #include "depthWriteAttrib.h" 31 #include "switchNode.h" 32 #include "sequenceNode.h" 33 #include "collisionNode.h" 34 #include "collisionPolygon.h" 35 #include "collisionPlane.h" 36 #include "collisionSphere.h" 37 #include "collisionBox.h" 38 #include "collisionInvSphere.h" 39 #include "collisionTube.h" 40 #include "textureStage.h" 43 #include "geomTriangles.h" 44 #include "geomPatches.h" 45 #include "geomPoints.h" 46 #include "geomLines.h" 47 #include "geomVertexReader.h" 48 #include "transformTable.h" 49 #include "modelNode.h" 50 #include "animBundleNode.h" 51 #include "animChannelMatrixXfmTable.h" 52 #include "characterJoint.h" 53 #include "character.h" 54 #include "string_utils.h" 56 #include "bamCacheRecord.h" 57 #include "eggSAnimData.h" 58 #include "eggXfmAnimData.h" 59 #include "eggXfmSAnim.h" 61 #include "eggVertexPool.h" 62 #include "eggVertex.h" 63 #include "eggPrimitive.h" 64 #include "eggPolygon.h" 68 #include "eggTexture.h" 69 #include "eggMaterial.h" 70 #include "eggRenderMode.h" 98 _data->add_child(_vpool);
104 if (_vpool->empty()) {
105 _data->remove_child(_vpool);
122 convert_geom_node(DCAST(
GeomNode, node), node_path, egg_parent, has_decal);
124 }
else if (node->
is_of_type(LODNode::get_class_type())) {
125 convert_lod_node(DCAST(
LODNode, node), node_path, egg_parent, has_decal);
127 }
else if (node->
is_of_type(SequenceNode::get_class_type())) {
128 convert_sequence_node(DCAST(
SequenceNode, node), node_path, egg_parent, has_decal);
130 }
else if (node->
is_of_type(SwitchNode::get_class_type())) {
131 convert_switch_node(DCAST(
SwitchNode, node), node_path, egg_parent, has_decal);
133 }
else if (node->
is_of_type(CollisionNode::get_class_type())) {
134 convert_collision_node(DCAST(
CollisionNode, node), node_path, egg_parent, has_decal);
136 }
else if (node->
is_of_type(AnimBundleNode::get_class_type())) {
137 convert_anim_node(DCAST(
AnimBundleNode, node), node_path, egg_parent, has_decal);
139 }
else if (node->
is_of_type(Character::get_class_type())) {
140 convert_character_node(DCAST(
Character, node), node_path, egg_parent, has_decal);
146 apply_node_properties(egg_group, node);
148 recurse_nodes(node_path, egg_group, has_decal);
165 apply_node_properties(egg_group, node);
170 num_children = min(num_children, num_switches);
172 for (
int i = 0; i < num_children; i++) {
177 convert_node(
WorkingNodePath(node_path, child), next_group, has_decal);
179 if (next_group->size() == 1) {
182 EggNode *child_node = *next_group->begin();
183 if (child_node->
is_of_type(EggGroup::get_class_type())) {
185 next_group->remove_child(child.p());
191 PN_stdfloat in = node->
get_in(i);
192 PN_stdfloat out = node->
get_out(i);
195 next_group->set_lod(dist);
213 apply_node_properties(egg_group, node);
216 egg_group->set_switch_flag(
true);
221 for (
int i = 0; i < num_children; i++) {
226 convert_node(
WorkingNodePath(node_path, child), next_group, has_decal);
246 apply_node_properties(egg_group, node);
249 egg_group->set_switch_flag(
true);
253 for (
int i = 0; i < num_children; i++) {
258 convert_node(
WorkingNodePath(node_path, child), next_group, has_decal);
274 if (animGroup->
is_of_type(AnimBundle::get_class_type())) {
276 eggTable ->set_table_type(EggTable::TT_bundle);
278 }
else if (animGroup->
is_of_type(AnimGroup::get_class_type())) {
280 eggTable ->set_table_type(EggTable::TT_table);
284 if (animGroup->
is_of_type(AnimChannelMatrixXfmTable::get_class_type())) {
287 egg_anim->set_fps(fps);
288 for (
int i = 0; i < num_matrix_components; i++) {
289 string componentName(1, matrix_component_letters[i]);
290 char table_id = matrix_component_letters[i];
294 for (
unsigned int j = 0; j < table.size(); j++) {
301 for (
int i = 0; i < num_children; i++) {
303 EggGroupNode *eggChildNode = convert_animGroup_node(animChild, fps);
304 if (eggChildNode!=NULL) {
305 nassertr(eggNode!=NULL, NULL);
326 _data->add_child(eggTable);
347 if (bundleNode->
is_of_type(CharacterJoint::get_class_type())) {
352 LMatrix4d transformd(LCAST(
double, transformf));
355 joint->set_group_type(EggGroup::GT_joint);
358 if (jointMap!=NULL) {
359 CharacterJointMap::iterator mi = jointMap->find(character_joint);
360 if (mi != jointMap->end()) {
363 for (vi = joint_vertices.begin(); vi != joint_vertices.end(); ++vi) {
370 for (
int i = 0; i < num_children ; i++) {
372 convert_character_bundle(partGroup, joint_group, jointMap);
390 egg_group->set_dart_type(EggGroup::DT_default);
392 apply_node_properties(egg_group, node);
400 int num_bundles = node->get_num_bundles();
402 for (
int i = 0; i < num_children; i++) {
410 for (
int i = 0; i < num_bundles ; i++) {
412 convert_character_bundle(bundle, egg_group, &jointMap);
431 apply_node_properties(egg_group, node,
false);
434 egg_group->set_collide_flags(EggGroup::CF_descend);
437 CPT(TransformState) net_transform = np.get_net_transform();
438 LMatrix4 net_mat = net_transform->get_mat();
440 net_mat = net_mat * inv;
442 int num_solids = node->get_num_solids();
444 if (num_solids > 0) {
450 for (
int i = 0; i < num_solids; i++) {
452 int flags = EggGroup::CF_descend;
454 if (!child->is_tangible()) {
455 flags |= EggGroup::CF_intangible;
458 if (child->has_effective_normal() &&
460 flags |= EggGroup::CF_level;
463 if (child->is_of_type(CollisionPolygon::get_class_type())) {
464 egg_group->set_cs_type(EggGroup::CST_polyset);
465 egg_group->set_collide_flags(flags);
471 int num_points = poly->get_num_points();
472 for (
int j = 0; j < num_points; j++) {
474 egg_vert.
set_pos(LCAST(
double, poly->get_point(j) * net_mat));
475 egg_vert.set_normal(LCAST(
double, poly->get_normal() * net_mat));
481 }
else if (child->is_of_type(CollisionSphere::get_class_type())) {
483 LPoint3 center = sphere->get_center();
484 PN_stdfloat radius = sphere->get_radius();
487 if (num_solids == 1) {
488 egg_sphere = egg_group;
494 if (child->is_of_type(CollisionInvSphere::get_class_type())) {
495 egg_sphere->set_cs_type(EggGroup::CST_inv_sphere);
497 egg_sphere->set_cs_type(EggGroup::CST_sphere);
499 egg_sphere->set_collide_flags(flags);
502 ev1.
set_pos(LCAST(
double, (center +
LVector3(radius, 0, 0)) * net_mat));
503 ev2.
set_pos(LCAST(
double, (center +
LVector3(0, radius, 0)) * net_mat));
504 ev3.
set_pos(LCAST(
double, (center +
LVector3(-radius, 0, 0)) * net_mat));
505 ev4.
set_pos(LCAST(
double, (center +
LVector3(0, -radius, 0)) * net_mat));
515 }
else if (child->is_of_type(CollisionPlane::get_class_type())) {
517 LPoint3 origin = plane.get_point();
518 LVector3 normal = plane.get_normal();
523 if (abs(normal[2]) > abs(normal[1])) {
524 vec1 = normal.cross(
LVector3(0, 1, 0));
526 vec1 = normal.cross(
LVector3(0, 0, 1));
533 if (num_solids == 1) {
534 egg_plane = egg_group;
539 egg_plane->set_cs_type(EggGroup::CST_plane);
540 egg_plane->set_collide_flags(flags);
543 ev0.
set_pos(LCAST(
double, origin * net_mat));
544 ev1.
set_pos(LCAST(
double, (origin + vec1) * net_mat));
545 ev2.
set_pos(LCAST(
double, (origin + vec2) * net_mat));
554 }
else if (child->is_of_type(CollisionBox::get_class_type())) {
556 LPoint3 min_point = box->get_min();
557 LPoint3 max_point = box->get_max();
560 if (num_solids == 1) {
566 egg_box->set_cs_type(EggGroup::CST_box);
567 egg_box->set_collide_flags(flags);
571 ev0.
set_pos(LCAST(
double, min_point * net_mat));
572 ev1.
set_pos(LCAST(
double, max_point * net_mat));
580 }
else if (child->is_of_type(CollisionTube::get_class_type())) {
582 LPoint3 point_a = tube->get_point_a();
583 LPoint3 point_b = tube->get_point_b();
584 LPoint3 centroid = (point_a + point_b) * 0.5f;
589 if (abs(axis[2]) > abs(axis[1])) {
590 sideways = axis.cross(
LVector3(0, 1, 0));
592 sideways = axis.cross(
LVector3(0, 0, 1));
595 sideways *= tube->get_radius();
599 if (num_solids == 1) {
600 egg_tube = egg_group;
605 egg_tube->set_cs_type(EggGroup::CST_tube);
606 egg_tube->set_collide_flags(flags);
611 ev0.
set_pos(LCAST(
double, (point_a - extend) * net_mat));
612 ev1.
set_pos(LCAST(
double, (centroid + sideways) * net_mat));
613 ev2.
set_pos(LCAST(
double, (point_b + extend) * net_mat));
614 ev3.
set_pos(LCAST(
double, (centroid - sideways) * net_mat));
625 nout <<
"Encountered unknown collision solid type " << child->get_type() <<
"\n";
631 recurse_nodes(node_path, egg_group, has_decal);
644 bool fancy_attributes = apply_node_properties(egg_group, node);
646 if (node->get_effects()->has_decal()) {
651 egg_group->set_decal_flag(
true);
654 if (fancy_attributes || has_decal || !node->get_name().empty()) {
659 egg_parent = egg_group;
664 CPT(TransformState) net_transform = np.get_net_transform();
665 LMatrix4 net_mat = net_transform->get_mat();
667 net_mat = net_mat * inv;
671 for (
int i = 0; i < num_geoms; ++i) {
674 const Geom *geom = node->get_geom(i);
675 int num_primitives = geom->get_num_primitives();
676 for (
int j = 0; j < num_primitives; ++j) {
681 convert_primitive(vdata, simple, geom_state,
682 net_mat, egg_parent, jointMap);
686 recurse_nodes(node_path, egg_parent, has_decal);
703 LVecBase4 color_scale(1.0f, 1.0f, 1.0f, 1.0f);
710 bool has_color_override =
false;
711 bool has_color_off =
false;
716 has_color_override =
true;
718 color_override.set(color_override[0] * color_scale[0],
719 color_override[1] * color_scale[1],
720 color_override[2] * color_scale[2],
721 color_override[3] * color_scale[3]);
724 has_color_off =
true;
747 case TextureStage::M_modulate:
748 if (has_color_off ==
true) {
749 egg_tex->set_env_type(EggTexture::ET_replace);
751 egg_tex->set_env_type(EggTexture::ET_modulate);
754 case TextureStage::M_decal:
755 egg_tex->set_env_type(EggTexture::ET_decal);
757 case TextureStage::M_blend:
758 egg_tex->set_env_type(EggTexture::ET_blend);
760 case TextureStage::M_replace:
761 egg_tex->set_env_type(EggTexture::ET_replace);
763 case TextureStage::M_add:
764 egg_tex->set_env_type(EggTexture::ET_add);
766 case TextureStage::M_blend_color_scale:
767 egg_tex->set_env_type(EggTexture::ET_blend_color_scale);
777 const RenderAttrib *cf_attrib = net_state->get_attrib(CullFaceAttrib::get_class_type());
786 bool has_depthwrite =
false;
787 DepthWriteAttrib::Mode depthwrite = DepthWriteAttrib::M_on;
788 const RenderAttrib *dw_attrib = net_state->get_attrib(DepthWriteAttrib::get_class_type());
792 has_depthwrite =
true;
796 bool has_transparency =
false;
797 TransparencyAttrib::Mode transparency = TransparencyAttrib::M_none;
798 const RenderAttrib *tr_attrib = net_state->get_attrib(TransparencyAttrib::get_class_type());
802 has_transparency =
true;
804 if (has_transparency && (egg_tex != (
EggTexture *)NULL)) {
805 EggRenderMode::AlphaMode tex_trans = EggRenderMode::AM_unspecified;
806 switch (transparency) {
807 case TransparencyAttrib::M_none:
808 tex_trans = EggRenderMode::AM_off;
810 case TransparencyAttrib::M_alpha:
811 if (has_depthwrite && (depthwrite == DepthWriteAttrib::M_off)) {
812 tex_trans = EggRenderMode::AM_blend_no_occlude;
813 has_depthwrite =
false;
815 tex_trans = EggRenderMode::AM_blend;
818 case TransparencyAttrib::M_multisample:
819 tex_trans = EggRenderMode::AM_ms;
821 case TransparencyAttrib::M_multisample_mask:
822 tex_trans = EggRenderMode::AM_ms_mask;
824 case TransparencyAttrib::M_binary:
825 tex_trans = EggRenderMode::AM_binary;
827 case TransparencyAttrib::M_dual:
828 tex_trans = EggRenderMode::AM_dual;
831 case TransparencyAttrib::M_notused:
834 if (tex_trans != EggRenderMode::AM_unspecified) {
835 egg_tex->set_alpha_mode(tex_trans);
849 if (primitive->
is_of_type(GeomTriangles::get_class_type())) {
850 make_func = make_egg_polygon;
851 }
else if (primitive->
is_of_type(GeomPatches::get_class_type())) {
852 make_func = make_egg_patch;
853 }
else if (primitive->
is_of_type(GeomPoints::get_class_type())) {
854 make_func = make_egg_point;
855 }
else if (primitive->
is_of_type(GeomLines::get_class_type())) {
856 make_func = make_egg_line;
862 for (
int i = 0; i < num_primitives; ++i) {
868 egg_prim->set_material(egg_mat);
871 egg_prim->set_texture(egg_tex);
875 egg_prim->set_bface_flag(
true);
878 for (
int j = 0; j < num_vertices; j++) {
884 reader.
set_column(InternalName::get_vertex());
886 egg_vert.
set_pos(LCAST(
double, vertex * net_mat));
888 if (vertex_data->
has_column(InternalName::get_normal())) {
889 reader.
set_column(InternalName::get_normal());
891 egg_vert.set_normal(LCAST(
double, normal * net_mat));
893 if (has_color_override) {
894 egg_vert.set_color(color_override);
896 }
else if (!has_color_off) {
897 LColor color(1.0f, 1.0f, 1.0f, 1.0f);
898 if (vertex_data->
has_column(InternalName::get_color())) {
902 egg_vert.set_color(
LColor(color[0] * color_scale[0],
903 color[1] * color_scale[1],
904 color[2] * color_scale[2],
905 color[3] * color_scale[3]));
908 if (vertex_data->
has_column(InternalName::get_texcoord())) {
909 reader.
set_column(InternalName::get_texcoord());
911 egg_vert.
set_uv(LCAST(
double, uv));
914 EggVertex *new_egg_vert = _vpool->create_unique_vertex(egg_vert);
916 if ((vertex_data->
has_column(InternalName::get_transform_blend())) &&
917 (jointMap!=NULL) && (transformBlendTable!=NULL)) {
918 reader.
set_column(InternalName::get_transform_blend());
922 for (
int k = 0; k < num_weights; ++k) {
926 if (vertex_transform->
is_of_type(JointVertexTransform::get_class_type())) {
929 CharacterJointMap::iterator mi = jointMap->find(joint_vertex_transform->
get_joint());
930 if (mi == jointMap->end()) {
934 joint_vertices.push_back(pair<EggVertex*,PN_stdfloat>(new_egg_vert, weight));
940 egg_prim->add_vertex(new_egg_vert);
956 for (
int i = 0; i < num_children; i++) {
958 convert_node(
WorkingNodePath(node_path, child), egg_parent, has_decal);
970 apply_node_properties(
EggGroup *egg_group,
PandaNode *node,
bool allow_backstage) {
971 bool any_applied =
false;
977 egg_group->add_object_type(
"backstage");
980 if (node->has_tags()) {
981 if (apply_tags(egg_group, node)) {
986 if (node->
is_of_type(ModelNode::get_class_type())) {
989 case ModelNode::PT_none:
990 case ModelNode::PT_drop_node:
993 case ModelNode::PT_net:
994 egg_group->set_dcs_type(EggGroup::DC_net);
997 case ModelNode::PT_local:
998 egg_group->set_dcs_type(EggGroup::DC_local);
1001 case ModelNode::PT_no_touch:
1002 egg_group->set_dcs_type(EggGroup::DC_no_touch);
1012 egg_group->set_billboard_type(EggGroup::BT_axis);
1016 egg_group->set_billboard_type(EggGroup::BT_point_camera_relative);
1020 egg_group->set_billboard_type(EggGroup::BT_point_world_relative);
1025 const TransformState *transform = node->get_transform();
1026 if (!transform->is_identity()) {
1027 if (transform->has_components()) {
1030 const LVecBase3 &scale = transform->get_scale();
1032 const LVecBase3 &pos = transform->get_pos();
1043 }
else if (transform->has_mat()) {
1045 const LMatrix4 &mat = transform->get_mat();
1063 char delimiter =
'\n';
1064 string delimiter_str(1, delimiter);
1067 string data = strm.str();
1072 bool any_applied =
false;
1075 size_t q = data.find(delimiter);
1076 while (q != string::npos) {
1077 string tag = data.substr(p, q);
1078 if (apply_tag(egg_group, node, tag)) {
1082 q = data.find(delimiter, p);
1085 string tag = data.substr(p);
1086 if (apply_tag(egg_group, node, tag)) {
1100 if (!node->has_tag(tag)) {
1104 string value = node->get_tag(tag);
1105 egg_group->
set_tag(tag, value);
1151 get_egg_texture(
Texture *tex) {
1158 temp.set_alpha_filename(alpha);
1162 case SamplerState::FT_nearest:
1163 temp.set_minfilter(EggTexture::FT_nearest);
1165 case SamplerState::FT_linear:
1166 temp.set_minfilter(EggTexture::FT_linear);
1168 case SamplerState::FT_nearest_mipmap_nearest:
1169 temp.set_minfilter(EggTexture::FT_nearest_mipmap_nearest);
1171 case SamplerState::FT_linear_mipmap_nearest:
1172 temp.set_minfilter(EggTexture::FT_linear_mipmap_nearest);
1174 case SamplerState::FT_nearest_mipmap_linear:
1175 temp.set_minfilter(EggTexture::FT_nearest_mipmap_linear);
1177 case SamplerState::FT_linear_mipmap_linear:
1178 temp.set_minfilter(EggTexture::FT_linear_mipmap_linear);
1186 case SamplerState::FT_nearest:
1187 temp.set_magfilter(EggTexture::FT_nearest);
1189 case SamplerState::FT_linear:
1190 temp.set_magfilter(EggTexture::FT_linear);
1198 case SamplerState::WM_clamp:
1199 temp.set_wrap_u(EggTexture::WM_clamp);
1201 case SamplerState::WM_repeat:
1202 temp.set_wrap_u(EggTexture::WM_repeat);
1212 case SamplerState::WM_clamp:
1213 temp.set_wrap_v(EggTexture::WM_clamp);
1215 case SamplerState::WM_repeat:
1216 temp.set_wrap_v(EggTexture::WM_repeat);
1226 case Texture::F_red:
1227 temp.set_format(EggTexture::F_red);
1229 case Texture::F_green:
1230 temp.set_format(EggTexture::F_green);
1232 case Texture::F_blue:
1233 temp.set_format(EggTexture::F_blue);
1235 case Texture::F_alpha:
1236 temp.set_format(EggTexture::F_alpha);
1238 case Texture::F_rgb:
1239 temp.set_format(EggTexture::F_rgb);
1241 case Texture::F_rgb5:
1242 temp.set_format(EggTexture::F_rgb5);
1244 case Texture::F_rgb8:
1245 temp.set_format(EggTexture::F_rgb8);
1247 case Texture::F_rgb12:
1248 temp.set_format(EggTexture::F_rgb12);
1250 case Texture::F_rgb332:
1251 temp.set_format(EggTexture::F_rgb332);
1253 case Texture::F_rgba:
1254 temp.set_format(EggTexture::F_rgba);
1256 case Texture::F_rgbm:
1257 temp.set_format(EggTexture::F_rgbm);
1259 case Texture::F_rgba4:
1260 temp.set_format(EggTexture::F_rgba4);
1262 case Texture::F_rgba5:
1263 temp.set_format(EggTexture::F_rgba5);
1265 case Texture::F_rgba8:
1266 temp.set_format(EggTexture::F_rgba8);
1268 case Texture::F_rgba12:
1269 temp.set_format(EggTexture::F_rgba12);
1271 case Texture::F_luminance:
1272 temp.set_format(EggTexture::F_luminance);
1274 case Texture::F_luminance_alpha:
1275 temp.set_format(EggTexture::F_luminance_alpha);
1277 case Texture::F_luminance_alphamask:
1278 temp.set_format(EggTexture::F_luminance_alphamask);
1297 make_egg_polygon() {
A base class for any of a number of kinds of geometry primitives: polygons, point lights...
double get_frame_rate() const
Returns the native frame rate of the animation.
const RenderState * get_geom_state(int n) const
Returns the RenderState associated with the nth geom of the node.
Format get_format() const
Returns the format of the texture, which represents both the semantic meaning of the texels and...
A basic node of the scene graph or data graph.
PandaNode * node() const
Returns the node traversed to so far.
This is the base class for all three-component vectors and points.
This is our own Panda specialization on the default STL map.
bool get_local() const
Returns the local viewer flag.
const Filename & get_alpha_filename() const
Returns the alpha_filename that has been set.
Material * get_material() const
If the MaterialAttrib is not an 'off' MaterialAttrib, returns the material that is associated...
EggTexture * create_unique_texture(const EggTexture ©, int eq)
Creates a new texture if there is not already one equivalent (according to eq, see EggTexture::is_equ...
This is a 4-by-4 transform matrix.
A line segment, or a series of connected line segments, defined by a <Line> entry.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
const LColor & get_color() const
If the type is T_flat or T_off, this returns the color that will be applied to geometry.
bool get_axial_rotate() const
Returns true if this billboard rotates only around the axis of the up vector, or false if it rotates ...
bool set_column(int column)
Sets up the reader to use the nth data type of the GeomVertexFormat, numbering from 0...
An animated character, with skeleton-morph animation and either soft-skinned or hard-skinned vertices...
int get_num_children() const
Returns the number of child nodes of the group.
Indicates which, if any, material should be applied to geometry.
SamplerState::WrapMode get_wrap_v() const
Returns the wrap mode of the texture in the V direction.
int get_num_children(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of child nodes this node has.
const LVecBase4 & get_scale() const
Returns the scale to be applied to colors.
void set_pos(double pos)
Sets the vertex position.
bool has_ambient() const
Returns true if the ambient color has been explicitly set for this material, false otherwise...
Enables or disables writing to the depth buffer.
void add_component_data(const string &component_name, double value)
Adds a new row to the named component (one of matrix_component_letters) of the table.
This is the root of an AnimChannel hierarchy.
A base class for nodes in the hierarchy that are not leaf nodes.
The abstract base class for all things that can collide with other things in the world, and all the things they can collide with (except geometry).
PN_stdfloat get_shininess() const
Returns the shininess exponent of the material.
This controls the enabling of transparency.
Defines a texture map that may be applied to geometry.
const LVecBase2 & get_data2()
Returns the data associated with the read row, expressed as a 2-component value, and advances the rea...
Mode get_mode() const
Returns the transparency mode.
A cuboid collision volume or object.
double get_base_frame_rate() const
Returns the ideal number of frames per second of the animation, when it is running at normal speed...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
PandaNode * get_child(int n, Thread *current_thread=Thread::get_current_thread()) const
Returns the nth child node of this node.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
SamplerState::FilterType get_magfilter() const
Returns the filter mode of the texture for magnification.
bool has_alpha_filename() const
Returns true if the alpha_filename has been set and is available.
int get_num_children() const
Returns the number of child nodes of the group.
bool has_table(char table_id) const
Returns true if the indicated subtable has been assigned.
PN_stdfloat get_out(int index) const
Returns the "out" distance of the indicated switch range.
const LVecBase4 & get_data4()
Returns the data associated with the read row, expressed as a 4-component value, and advances the rea...
A node that automatically cycles through rendering each one of its children according to its frame ra...
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
This is the base class for a number of special render effects that may be set on scene graph nodes to...
PreserveTransform get_preserve_transform() const
Returns the current setting of the preserve_transform flag.
Mode get_mode() const
Return the mode of this stage.
A spherical collision volume or object.
int get_num_geoms() const
Returns the number of geoms in the node.
This is the primary interface into all the egg data, and the root of the egg file structure...
const LPoint3 & get_center() const
Returns the center of the LOD.
Indicates that geometry at this node should automatically rotate to face the camera, or any other arbitrary node.
static const LVecBase3f & zero()
Returns a zero-length vector.
This is a class designed to support low-overhead traversals of the complete scene graph...
Type get_color_type() const
Returns the type of color specified by this ColorAttrib.
bool is_overall_hidden() const
Returns true if the node has been hidden to all cameras by clearing its overall bit.
A single point, or a collection of points as defined by a single <PointLight> entry.
bool almost_equal(const LVecBase3f &other, float threshold) const
Returns true if two vectors are memberwise equal within a specified tolerance.
Mode get_mode() const
Returns the depth write mode.
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.
This is our own Panda specialization on the default STL vector.
const LColor & get_diffuse() const
Returns the diffuse color setting, if it has been set.
SamplerState::WrapMode get_wrap_u() const
Returns the wrap mode of the texture in the U direction.
const LColor & get_ambient() const
Returns the ambient color setting, if it has been set.
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
PartGroup * get_child(int n) const
Returns the nth child of the group.
bool has_filename() const
Returns true if the filename has been set and is available.
This is the base class for AnimChannel and AnimBundle.
This node is placed at key points within the scene graph to indicate the roots of "models": subtrees ...
NodePath get_node_path() const
Constructs and returns an actual NodePath that represents the same path we have just traversed...
AnimGroup * get_child(int n) const
Returns the nth child of the group.
The name of a file, such as a texture file or an Egg file.
This is a 4-by-4 transform matrix.
A single "patch", a special primitive to be rendered only with a tessellation shader.
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal...
This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S$Anim> entries that...
void set_vertex_membership(EggVertex *vert, double membership)
Explicitly sets the net membership of the indicated vertex in this group to the given value...
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
PN_stdfloat get_in(int index) const
Returns the "in" distance of the indicated switch range.
int get_num_switches() const
Returns the number of switch ranges added to the LODNode.
A container for geometry primitives.
const LVecBase3 & get_data3()
Returns the data associated with the read row, expressed as a 3-component value, and advances the rea...
Texture * get_texture() const
If the TextureAttrib is not an 'off' TextureAttrib, returns the base-level texture that is associated...
bool has_specular() const
Returns true if the specular color has been explicitly set for this material, false otherwise...
TextureStage * get_on_stage(int n) const
Returns the nth stage turned on by the attribute, sorted in render order.
void set_row(int row)
Sets the start row to the indicated value.
LVector3f normalized() const
Normalizes the vector and returns the normalized vector as a copy.
string get_basename_wo_extension() const
Returns the basename part of the filename, without the file extension.
int get_data1i()
Returns the data associated with the read row, expressed as a 1-component value, and advances the rea...
Defines the way an object appears in the presence of lighting.
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_tag(const string &key, const string &value)
Associates a user-defined value with a user-defined key which is stored on the node.
This is the base class for all three-component vectors and points.
bool is_identity() const
Returns true if this quaternion represents the identity transformation: no rotation.
EggNode * add_child(EggNode *node)
Adds the indicated child to the group and returns it.
int get_num_primitives() const
Returns the number of individual primitives stored within this object.
bool get_eye_relative() const
Returns true if this billboard interprets the up vector relative to the camera, or false if it is rel...
int get_vertex(int i) const
Returns the ith vertex index in the table.
bool has_column(const InternalName *name) const
Returns true if the data has the named column, false otherwise.
This is the base quaternion class.
This is the root of a MovingPart hierarchy.
const RenderEffect * get_effect(int n) const
Returns the nth effect in the state.
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
A base class for things that may be directly added into the egg hierarchy.
This represents one joint of the character's animation, containing an animating transform matrix...
A node in the scene graph that can hold any number of CollisionSolids.
EggMaterial * create_unique_material(const EggMaterial ©, int eq)
Creates a new material if there is not already one equivalent (according to eq, see EggMaterial::is_e...
An animation channel that issues a matrix each frame, read from a table such as might have been read ...
void get_transform(LMatrix4 &transform) const
Copies the joint's current transform into the indicated matrix.
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.
virtual int get_num_vertices_per_primitive() const
If the primitive type is a simple type in which all primitives have the same number of vertices...
Mode get_effective_mode() const
Returns the effective culling mode.
This is a two-component point in space.
const LColor & get_emission() const
Returns the emission color setting, if it has been set.
bool has_diffuse() const
Returns true if the diffuse color has been explicitly set for this material, false otherwise...
bool has_emission() const
Returns true if the emission color has been explicitly set for this material, false otherwise...
This is a node that contains a pointer to an AnimBundle.
This implements a solid roughly in cylindrical shape.
virtual bool is_geom_node() const
A simple downcast check.
CPTA_stdfloat get_table(char table_id) const
Returns a pointer to the indicated subtable's data, if it exists, or NULL if it does not...
bool normalize()
Normalizes the vector in place.
Defines the properties of a named stage of the multitexture pipeline.
void set_uv(const LTexCoordd &texCoord)
Replaces the unnamed UV coordinate pair on the vertex with the indicated value.
EggVertex * create_unique_vertex(const EggVertex ©)
Creates a new vertex in the pool that is a copy of the indicated one and returns it.
void add_node(PandaNode *node)
Adds the scene graph rooted at the indicated node to the accumulated egg data within this object...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
static LVector3f up(CoordinateSystem cs=CS_default)
Returns the up vector for the given coordinate system.
A collection of vertices.
EggVertex * add_vertex(EggVertex *vertex)
Adds the indicated vertex to the end of the primitive's list of vertices, and returns it...
This represents a unique collection of RenderEffect objects that correspond to a particular renderabl...
const LColor & get_specular() const
Returns the specular color setting, if it has been set.
A SwitchCondition that switches the levels-of-detail based on distance from the camera's eyepoint...
A node that holds Geom objects, renderable pieces of geometry.
SamplerState::FilterType get_minfilter() const
Returns the filter mode of the texture for minification.
A node that renders only one of its children, according to the user's indication. ...
Similar to PointerToArray, except that its contents may not be modified.
const LMatrix4d & get_vertex_frame_inv() const
Returns the inverse of the matrix returned by get_vertex_frame().
const Filename & get_filename() const
Returns the filename that has been set.
void list_tags(ostream &out, const string &separator="\) const
Writes a list of all the tag keys assigned to the node to the indicated stream.
This is the base class for PartRoot and MovingPart.