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())) {
184 PT(EggGroup) child = DCAST(EggGroup, child_node);
185 next_group->remove_child(child.p());
191 PN_stdfloat in = node->get_in(i);
192 PN_stdfloat out = node->get_out(i);
193 LPoint3 center = node->get_center();
195 next_group->set_lod(dist);
196 egg_group->add_child(next_group.p());
211 EggGroup *egg_group =
new EggGroup(node->get_name());
213 apply_node_properties(egg_group, node);
216 egg_group->set_switch_flag(
true);
217 egg_group->set_switch_fps(node->get_frame_rate());
219 int num_children = node->get_num_children();
221 for (
int i = 0; i < num_children; i++) {
225 PT(EggGroup) next_group = new EggGroup;
226 convert_node(
WorkingNodePath(node_path, child), next_group, has_decal);
228 egg_group->add_child(next_group.p());
244 EggGroup *egg_group =
new EggGroup(node->get_name());
246 apply_node_properties(egg_group, node);
249 egg_group->set_switch_flag(
true);
251 int num_children = node->get_num_children();
253 for (
int i = 0; i < num_children; i++) {
257 PT(EggGroup) next_group = new EggGroup;
258 convert_node(
WorkingNodePath(node_path, child), next_group, has_decal);
260 egg_group->add_child(next_group.p());
271 int num_children = animGroup->get_num_children();
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);
343 convert_character_bundle(
PartGroup *bundleNode,
EggGroupNode *egg_parent, CharacterJointMap *jointMap) {
347 if (bundleNode->
is_of_type(CharacterJoint::get_class_type())) {
352 LMatrix4d transformd(LCAST(
double, transformf));
353 EggGroup *joint =
new EggGroup(bundleNode->get_name());
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);
389 EggGroup *egg_group =
new EggGroup(node->get_name());
390 egg_group->set_dart_type(EggGroup::DT_default);
392 apply_node_properties(egg_group, node);
394 CharacterJointMap jointMap;
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);
429 EggGroup *egg_group =
new EggGroup(node->get_name());
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();
439 LMatrix4 inv = LCAST(PN_stdfloat, egg_parent->get_vertex_frame_inv());
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++) {
453 egg_group->set_cs_type(EggGroup::CST_polyset);
459 int num_points = poly->get_num_points();
460 for (
int j = 0; j < num_points; j++) {
462 egg_vert.
set_pos(LCAST(
double, poly->get_point(j) * net_mat));
463 egg_vert.set_normal(LCAST(
double, poly->get_normal() * net_mat));
469 }
else if (child->is_of_type(CollisionSphere::get_class_type())) {
471 LPoint3 center = sphere->get_center();
472 LVector3 offset(sphere->get_radius(), 0, 0);
474 EggGroup *egg_sphere;
475 if (num_solids == 1) {
476 egg_sphere = egg_group;
478 egg_sphere =
new EggGroup;
479 egg_sphere->set_collide_flags(EggGroup::CF_descend);
482 egg_sphere->set_cs_type(EggGroup::CST_sphere);
485 ev1.
set_pos(LCAST(
double, (center + offset) * net_mat));
486 ev2.
set_pos(LCAST(
double, (center - offset) * net_mat));
489 egg_sphere->add_child(egg_poly);
494 }
else if (child->is_of_type(CollisionPlane::get_class_type())) {
496 LPoint3 origin = plane.get_point();
497 LVector3 normal = plane.get_normal();
502 if (abs(normal[2]) > abs(normal[1])) {
503 vec1 = normal.cross(
LVector3(0, 1, 0));
505 vec1 = normal.cross(
LVector3(0, 0, 1));
512 if (num_solids == 1) {
513 egg_plane = egg_group;
515 egg_plane =
new EggGroup;
516 egg_plane->set_collide_flags(EggGroup::CF_descend);
519 egg_plane->set_cs_type(EggGroup::CST_plane);
522 ev0.
set_pos(LCAST(
double, origin * net_mat));
523 ev1.
set_pos(LCAST(
double, (origin + vec1) * net_mat));
524 ev2.
set_pos(LCAST(
double, (origin + vec2) * net_mat));
533 }
else if (child->is_of_type(CollisionBox::get_class_type())) {
534 nout <<
"Encountered unhandled collsion type: CollisionBox" <<
"\n";
535 }
else if (child->is_of_type(CollisionInvSphere::get_class_type())) {
536 nout <<
"Encountered unhandled collsion type: CollisionInvSphere" <<
"\n";
537 }
else if (child->is_of_type(CollisionTube::get_class_type())) {
538 nout <<
"Encountered unhandled collsion type: CollisionTube" <<
"\n";
540 nout <<
"Encountered unknown CollisionSolid" <<
"\n";
546 recurse_nodes(node_path, egg_group, has_decal);
557 EggGroupNode *egg_parent,
bool has_decal, CharacterJointMap *jointMap) {
558 PT(EggGroup) egg_group = new EggGroup(node->get_name());
559 bool fancy_attributes = apply_node_properties(egg_group, node);
561 if (node->get_effects()->has_decal()) {
566 egg_group->set_decal_flag(
true);
569 if (fancy_attributes || has_decal || !node->get_name().empty()) {
574 egg_parent = egg_group;
579 CPT(TransformState) net_transform = np.get_net_transform();
580 LMatrix4 net_mat = net_transform->get_mat();
581 LMatrix4 inv = LCAST(PN_stdfloat, egg_parent->get_vertex_frame_inv());
582 net_mat = net_mat * inv;
585 int num_geoms = node->get_num_geoms();
586 for (
int i = 0; i < num_geoms; ++i) {
587 CPT(
RenderState) geom_state = net_state->compose(node->get_geom_state(i));
589 const
Geom *geom = node->get_geom(i);
590 int num_primitives = geom->get_num_primitives();
591 for (
int j = 0; j < num_primitives; ++j) {
596 convert_primitive(vdata, simple, geom_state,
597 net_mat, egg_parent, jointMap);
601 recurse_nodes(node_path, egg_parent, has_decal);
614 CharacterJointMap *jointMap) {
618 LVecBase4 color_scale(1.0f, 1.0f, 1.0f, 1.0f);
625 bool has_color_override =
false;
626 bool has_color_off =
false;
631 has_color_override =
true;
633 color_override.set(color_override[0] * color_scale[0],
634 color_override[1] * color_scale[1],
635 color_override[2] * color_scale[2],
636 color_override[3] * color_scale[3]);
639 has_color_off =
true;
662 case TextureStage::M_modulate:
663 if (has_color_off ==
true) {
664 egg_tex->set_env_type(EggTexture::ET_replace);
666 egg_tex->set_env_type(EggTexture::ET_modulate);
669 case TextureStage::M_decal:
670 egg_tex->set_env_type(EggTexture::ET_decal);
672 case TextureStage::M_blend:
673 egg_tex->set_env_type(EggTexture::ET_blend);
675 case TextureStage::M_replace:
676 egg_tex->set_env_type(EggTexture::ET_replace);
678 case TextureStage::M_add:
679 egg_tex->set_env_type(EggTexture::ET_add);
681 case TextureStage::M_blend_color_scale:
682 egg_tex->set_env_type(EggTexture::ET_blend_color_scale);
692 const RenderAttrib *cf_attrib = net_state->get_attrib(CullFaceAttrib::get_class_type());
701 bool has_depthwrite =
false;
702 DepthWriteAttrib::Mode depthwrite = DepthWriteAttrib::M_on;
703 const RenderAttrib *dw_attrib = net_state->get_attrib(DepthWriteAttrib::get_class_type());
707 has_depthwrite =
true;
711 bool has_transparency =
false;
712 TransparencyAttrib::Mode transparency = TransparencyAttrib::M_none;
713 const RenderAttrib *tr_attrib = net_state->get_attrib(TransparencyAttrib::get_class_type());
717 has_transparency =
true;
719 if (has_transparency && (egg_tex != (
EggTexture *)NULL)) {
720 EggRenderMode::AlphaMode tex_trans = EggRenderMode::AM_unspecified;
721 switch (transparency) {
722 case TransparencyAttrib::M_none:
723 tex_trans = EggRenderMode::AM_off;
725 case TransparencyAttrib::M_alpha:
726 if (has_depthwrite && (depthwrite == DepthWriteAttrib::M_off)) {
727 tex_trans = EggRenderMode::AM_blend_no_occlude;
728 has_depthwrite =
false;
730 tex_trans = EggRenderMode::AM_blend;
733 case TransparencyAttrib::M_multisample:
734 tex_trans = EggRenderMode::AM_ms;
736 case TransparencyAttrib::M_multisample_mask:
737 tex_trans = EggRenderMode::AM_ms_mask;
739 case TransparencyAttrib::M_binary:
740 tex_trans = EggRenderMode::AM_binary;
742 case TransparencyAttrib::M_dual:
743 tex_trans = EggRenderMode::AM_dual;
746 case TransparencyAttrib::M_notused:
749 if (tex_trans != EggRenderMode::AM_unspecified) {
759 int num_primitives = primitive->get_num_primitives();
760 int num_vertices = primitive->get_num_vertices_per_primitive();
764 if (primitive->is_of_type(
GeomTriangles::get_class_type())) {
765 make_func = make_egg_polygon;
766 }
else if (primitive->is_of_type(GeomPatches::get_class_type())) {
767 make_func = make_egg_patch;
768 }
else if (primitive->is_of_type(GeomPoints::get_class_type())) {
769 make_func = make_egg_point;
770 }
else if (primitive->is_of_type(GeomLines::get_class_type())) {
771 make_func = make_egg_line;
777 for (
int i = 0; i < num_primitives; ++i) {
780 egg_parent->add_child(egg_prim);
783 egg_prim->set_material(egg_mat);
786 egg_prim->set_texture(egg_tex);
790 egg_prim->set_bface_flag(
true);
793 for (
int j = 0; j < num_vertices; j++) {
797 reader.set_row(primitive->get_vertex(i * num_vertices + j));
799 reader.set_column(InternalName::get_vertex());
800 LVertex vertex = reader.get_data3();
801 egg_vert.
set_pos(LCAST(
double, vertex * net_mat));
803 if (vertex_data->has_column(InternalName::get_normal())) {
804 reader.set_column(InternalName::get_normal());
805 LNormal normal = reader.get_data3();
806 egg_vert.set_normal(LCAST(
double, normal * net_mat));
808 if (has_color_override) {
809 egg_vert.set_color(color_override);
811 }
else if (!has_color_off) {
812 LColor color(1.0f, 1.0f, 1.0f, 1.0f);
813 if (vertex_data->has_column(InternalName::get_color())) {
814 reader.set_column(InternalName::get_color());
815 color = reader.get_data4();
817 egg_vert.set_color(
LColor(color[0] * color_scale[0],
818 color[1] * color_scale[1],
819 color[2] * color_scale[2],
820 color[3] * color_scale[3]));
823 if (vertex_data->has_column(InternalName::get_texcoord())) {
824 reader.set_column(InternalName::get_texcoord());
826 egg_vert.
set_uv(LCAST(
double, uv));
829 EggVertex *new_egg_vert = _vpool->create_unique_vertex(egg_vert);
831 if ((vertex_data->has_column(InternalName::get_transform_blend())) &&
832 (jointMap!=NULL) && (transformBlendTable!=NULL)) {
833 reader.set_column(InternalName::get_transform_blend());
834 int idx = reader.get_data1i();
837 for (
int k = 0; k < num_weights; ++k) {
841 if (vertex_transform->
is_of_type(JointVertexTransform::get_class_type())) {
844 CharacterJointMap::iterator mi = jointMap->find(joint_vertex_transform->
get_joint());
845 if (mi == jointMap->end()) {
849 joint_vertices.push_back(pair<EggVertex*,PN_stdfloat>(new_egg_vert, weight));
855 egg_prim->add_vertex(new_egg_vert);
871 for (
int i = 0; i < num_children; i++) {
873 convert_node(
WorkingNodePath(node_path, child), egg_parent, has_decal);
885 apply_node_properties(EggGroup *egg_group,
PandaNode *node,
bool allow_backstage) {
886 bool any_applied =
false;
892 egg_group->add_object_type(
"backstage");
896 if (apply_tags(egg_group, node)) {
901 if (node->
is_of_type(ModelNode::get_class_type())) {
904 case ModelNode::PT_none:
905 case ModelNode::PT_drop_node:
908 case ModelNode::PT_net:
909 egg_group->set_dcs_type(EggGroup::DC_net);
912 case ModelNode::PT_local:
913 egg_group->set_dcs_type(EggGroup::DC_local);
916 case ModelNode::PT_no_touch:
917 egg_group->set_dcs_type(EggGroup::DC_no_touch);
927 egg_group->set_billboard_type(EggGroup::BT_axis);
931 egg_group->set_billboard_type(EggGroup::BT_point_camera_relative);
935 egg_group->set_billboard_type(EggGroup::BT_point_world_relative);
940 const TransformState *transform = node->get_transform();
941 if (!transform->is_identity()) {
942 if (transform->has_components()) {
945 const LVecBase3 &scale = transform->get_scale();
947 const LVecBase3 &pos = transform->get_pos();
958 }
else if (transform->has_mat()) {
960 const LMatrix4 &mat = transform->get_mat();
976 apply_tags(EggGroup *egg_group,
PandaNode *node) {
978 char delimiter =
'\n';
979 string delimiter_str(1, delimiter);
982 string data = strm.str();
987 bool any_applied =
false;
990 size_t q = data.find(delimiter);
991 while (q != string::npos) {
992 string tag = data.substr(p, q);
993 if (apply_tag(egg_group, node, tag)) {
997 q = data.find(delimiter, p);
1000 string tag = data.substr(p);
1001 if (apply_tag(egg_group, node, tag)) {
1014 apply_tag(EggGroup *egg_group,
PandaNode *node,
const string &tag) {
1019 string value = node->
get_tag(tag);
1020 egg_group->
set_tag(tag, value);
1066 get_egg_texture(
Texture *tex) {
1073 temp.set_alpha_filename(alpha);
1077 case SamplerState::FT_nearest:
1078 temp.set_minfilter(EggTexture::FT_nearest);
1080 case SamplerState::FT_linear:
1081 temp.set_minfilter(EggTexture::FT_linear);
1083 case SamplerState::FT_nearest_mipmap_nearest:
1084 temp.set_minfilter(EggTexture::FT_nearest_mipmap_nearest);
1086 case SamplerState::FT_linear_mipmap_nearest:
1087 temp.set_minfilter(EggTexture::FT_linear_mipmap_nearest);
1089 case SamplerState::FT_nearest_mipmap_linear:
1090 temp.set_minfilter(EggTexture::FT_nearest_mipmap_linear);
1092 case SamplerState::FT_linear_mipmap_linear:
1093 temp.set_minfilter(EggTexture::FT_linear_mipmap_linear);
1101 case SamplerState::FT_nearest:
1102 temp.set_magfilter(EggTexture::FT_nearest);
1104 case SamplerState::FT_linear:
1105 temp.set_magfilter(EggTexture::FT_linear);
1113 case SamplerState::WM_clamp:
1114 temp.set_wrap_u(EggTexture::WM_clamp);
1116 case SamplerState::WM_repeat:
1117 temp.set_wrap_u(EggTexture::WM_repeat);
1127 case SamplerState::WM_clamp:
1128 temp.set_wrap_v(EggTexture::WM_clamp);
1130 case SamplerState::WM_repeat:
1131 temp.set_wrap_v(EggTexture::WM_repeat);
1141 case Texture::F_red:
1142 temp.set_format(EggTexture::F_red);
1144 case Texture::F_green:
1145 temp.set_format(EggTexture::F_green);
1147 case Texture::F_blue:
1148 temp.set_format(EggTexture::F_blue);
1150 case Texture::F_alpha:
1151 temp.set_format(EggTexture::F_alpha);
1153 case Texture::F_rgb:
1154 temp.set_format(EggTexture::F_rgb);
1156 case Texture::F_rgb5:
1157 temp.set_format(EggTexture::F_rgb5);
1159 case Texture::F_rgb8:
1160 temp.set_format(EggTexture::F_rgb8);
1162 case Texture::F_rgb12:
1163 temp.set_format(EggTexture::F_rgb12);
1165 case Texture::F_rgb332:
1166 temp.set_format(EggTexture::F_rgb332);
1168 case Texture::F_rgba:
1169 temp.set_format(EggTexture::F_rgba);
1171 case Texture::F_rgbm:
1172 temp.set_format(EggTexture::F_rgbm);
1174 case Texture::F_rgba4:
1175 temp.set_format(EggTexture::F_rgba4);
1177 case Texture::F_rgba5:
1178 temp.set_format(EggTexture::F_rgba5);
1180 case Texture::F_rgba8:
1181 temp.set_format(EggTexture::F_rgba8);
1183 case Texture::F_rgba12:
1184 temp.set_format(EggTexture::F_rgba12);
1186 case Texture::F_luminance:
1187 temp.set_format(EggTexture::F_luminance);
1189 case Texture::F_luminance_alpha:
1190 temp.set_format(EggTexture::F_luminance_alpha);
1192 case Texture::F_luminance_alphamask:
1193 temp.set_format(EggTexture::F_luminance_alphamask);
1212 make_egg_polygon() {
A base class for any of a number of kinds of geometry primitives: polygons, point lights...
Format get_format() const
Returns the format of the texture, which represents both the semantic meaning of the texels and...
PreserveTransform get_preserve_transform() const
Returns the current setting of the preserve_transform flag.
A basic node of the scene graph or data graph.
This is the base class for all three-component vectors and points.
Mode get_mode() const
Return the mode of this stage.
const LColor & get_ambient() const
Returns the ambient color setting, if it has been set.
void list_tags(ostream &out, const string &separator="\n") const
Writes a list of all the tag keys assigned to the node to the indicated stream.
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...
bool is_identity() const
Returns true if this quaternion represents the identity transformation: no rotation.
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...
bool has_ambient() const
Returns true if the ambient color has been explicitly set for this material, false otherwise...
bool has_specular() const
Returns true if the specular color has been explicitly set for this material, false otherwise...
An animated character, with skeleton-morph animation and either soft-skinned or hard-skinned vertices...
Indicates which, if any, material should be applied to geometry.
void set_pos(double pos)
Sets the vertex position.
Enables or disables writing to the depth buffer.
SamplerState::WrapMode get_wrap_v() const
Returns the wrap mode of the texture in the V direction.
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.
bool has_table(char table_id) const
Returns true if the indicated subtable has been assigned.
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).
void get_transform(LMatrix4 &transform) const
Copies the joint's current transform into the indicated matrix.
This controls the enabling of transparency.
Defines a texture map that may be applied to geometry.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
Material * get_material() const
If the MaterialAttrib is not an 'off' MaterialAttrib, returns the material that is associated...
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 ...
Type get_color_type() const
Returns the type of color specified by this ColorAttrib.
This is the base class for a number of special render effects that may be set on scene graph nodes to...
A spherical collision volume or object.
PN_stdfloat get_shininess() const
Returns the shininess exponent of the material.
This is the primary interface into all the egg data, and the root of the egg file structure...
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...
bool has_alpha_filename() const
Returns true if the alpha_filename has been set and is available.
TextureStage * get_on_stage(int n) const
Returns the nth stage turned on by the attribute, sorted in render order.
Converts the scene graph beginning at the indicated node into an EggData structure, for writing to an egg file.
bool has_emission() const
Returns true if the emission color has been explicitly set for this material, false otherwise...
A single point, or a collection of points as defined by a single <PointLight> entry.
const LColor & get_emission() const
Returns the emission color setting, if it has been set.
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.
PandaNode * node() const
Returns the node traversed to so far.
Mode get_mode() const
Returns the depth write mode.
bool has_tags() const
Returns true if the node has any tags (or any Python tags) at all, false if it has none...
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
int get_num_switches() const
Returns the number of switch ranges added to the LODNode.
Mode get_effective_mode() const
Returns the effective culling mode.
bool has_tag(const string &key, Thread *current_thread=Thread::get_current_thread()) const
Returns true if a value has been defined on this node for the particular key (even if that value is t...
const RenderEffect * get_effect(int n) const
Returns the nth effect in the state.
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 ...
string get_tag(const string &key, Thread *current_thread=Thread::get_current_thread()) const
Retrieves the user-defined value that was previously set on this node for the particular key...
The name of a file, such as a texture file or an Egg file.
NodePath get_node_path() const
Constructs and returns an actual NodePath that represents the same path we have just traversed...
const LColor & get_color() const
If the type is T_flat or T_off, this returns the color that will be applied to geometry.
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...
int get_num_children(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of child nodes this node has.
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...
const LVecBase4 & get_scale() const
Returns the scale to be applied to colors.
A container for geometry primitives.
void set_alpha_mode(AlphaMode mode)
Specifies precisely how the transparency for this geometry should be achieved, or if it should be use...
const LColor & get_specular() const
Returns the specular color setting, if it has been set.
bool get_eye_relative() const
Returns true if this billboard interprets the up vector relative to the camera, or false if it is rel...
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 get_axial_rotate() const
Returns true if this billboard rotates only around the axis of the up vector, or false if it rotates ...
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...
SamplerState::FilterType get_magfilter() const
Returns the filter mode of the texture for magnification.
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.
string get_basename_wo_extension() const
Returns the basename part of the filename, without the file extension.
bool has_diffuse() const
Returns true if the diffuse color has been explicitly set for this material, false otherwise...
Mode get_mode() const
Returns the transparency mode.
PandaNode * get_child(int n, Thread *current_thread=Thread::get_current_thread()) const
Returns the nth child node of this node.
EggNode * add_child(EggNode *node)
Adds the indicated child to the group and returns it.
PartGroup * get_child(int n) const
Returns the nth child of the group.
double get_base_frame_rate() const
Returns the ideal number of frames per second of the animation, when it is running at normal speed...
This is the base quaternion class.
This is the root of a MovingPart hierarchy.
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
bool almost_equal(const LVecBase3f &other, float threshold) const
Returns true if two vectors are memberwise equal within a specified tolerance.
bool has_filename() const
Returns true if the filename has been set and is available.
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.
Defines a series of disconnected triangles.
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 ...
Indicates what color should be applied to renderable geometry.
int get_num_children() const
Returns the number of child nodes of the group.
SamplerState::WrapMode get_wrap_u() const
Returns the wrap mode of the texture in the U direction.
This is a two-component point in space.
bool get_local() const
Returns the local viewer flag.
SamplerState::FilterType get_minfilter() const
Returns the filter mode of the texture for minification.
virtual bool is_geom_node() const
A simple downcast check.
This is a node that contains a pointer to an AnimBundle.
AnimGroup * get_child(int n) const
Returns the nth child of the group.
Defines the properties of a named stage of the multitexture pipeline.
const LColor & get_diffuse() const
Returns the diffuse color setting, if it has been set.
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...
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...
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.
const Filename & get_alpha_filename() const
Returns the alpha_filename that has been set.
A node that renders only one of its children, according to the user's indication. ...
Texture * get_texture() const
If the TextureAttrib is not an 'off' TextureAttrib, returns the base-level texture that is associated...
Similar to PointerToArray, except that its contents may not be modified.
const Filename & get_filename() const
Returns the filename that has been set.
bool is_overall_hidden() const
Returns true if the node has been hidden to all cameras by clearing its overall bit.
This is the base class for PartRoot and MovingPart.