Panda3D

bamToEgg.h

00001 // Filename: bamToEgg.h
00002 // Created by:  drose (25Jun01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef BAMTOEGG_H
00016 #define BAMTOEGG_H
00017 
00018 #include "pandatoolbase.h"
00019 
00020 #include "somethingToEgg.h"
00021 #include "luse.h"
00022 #include "eggTextureCollection.h"
00023 #include "eggMaterialCollection.h"
00024 
00025 class WorkingNodePath;
00026 class EggGroup;
00027 class EggGroupNode;
00028 class EggVertexPool;
00029 class EggTexture;
00030 class LODNode;
00031 class SequenceNode;
00032 class SwitchNode;
00033 class AnimBundleNode;
00034 class AnimGroup;
00035 class Character;
00036 class PartGroup;
00037 class CollisionNode;
00038 class GeomNode;
00039 class GeomTri;
00040 class GeomVertexData;
00041 class GeomTriangles;
00042 class PandaNode;
00043 class RenderState;
00044 class Texture;
00045 class CharacterJoint;
00046 class EggVertex;
00047 
00048 typedef pmap<const CharacterJoint*, pvector<pair<EggVertex*,float> > > CharacterJointMap;
00049 
00050 ////////////////////////////////////////////////////////////////////
00051 //       Class : BamToEgg
00052 // Description : This program reads a bam file, for instance as
00053 //               written out from a real-time interaction session, and
00054 //               generates a corresponding egg file.
00055 ////////////////////////////////////////////////////////////////////
00056 class BamToEgg : public SomethingToEgg {
00057 public:
00058   BamToEgg();
00059 
00060   void run();
00061 
00062 private:
00063   void convert_node(const WorkingNodePath &node_path, EggGroupNode *egg_parent,
00064                     bool has_decal);
00065   void convert_lod_node(LODNode *node, const WorkingNodePath &node_path,
00066                         EggGroupNode *egg_parent, bool has_decal);
00067   void convert_sequence_node(SequenceNode *node, const WorkingNodePath &node_path,
00068                         EggGroupNode *egg_parent, bool has_decal);
00069   void convert_switch_node(SwitchNode *node, const WorkingNodePath &node_path,
00070                         EggGroupNode *egg_parent, bool has_decal);
00071   EggGroupNode *convert_animGroup_node(AnimGroup *animGroup, double fps );
00072   void convert_anim_node(AnimBundleNode *node, const WorkingNodePath &node_path,
00073                         EggGroupNode *egg_parent, bool has_decal);
00074   void convert_character_node(Character *node, const WorkingNodePath &node_path,
00075                         EggGroupNode *egg_parent, bool has_decal);
00076   void convert_character_bundle(PartGroup *bundleNode, EggGroupNode *egg_parent, CharacterJointMap *jointMap);
00077   void convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path,
00078                         EggGroupNode *egg_parent, bool has_decal);
00079   void convert_geom_node(GeomNode *node, const WorkingNodePath &node_path, 
00080                          EggGroupNode *egg_parent, bool has_decal, CharacterJointMap *jointMap=NULL);
00081   void convert_triangles(const GeomVertexData *vertex_data,
00082                          const GeomTriangles *primitive, 
00083                          const RenderState *net_state, 
00084                          const LMatrix4f &net_mat, EggGroupNode *egg_parent,
00085                          CharacterJointMap *jointMap);
00086 
00087   void recurse_nodes(const WorkingNodePath &node_path, EggGroupNode *egg_parent,
00088                      bool has_decal);
00089   bool apply_node_properties(EggGroup *egg_group, PandaNode *node, bool allow_backstage = true);
00090 
00091   EggTexture *get_egg_texture(Texture *tex);
00092 
00093   EggVertexPool *_vpool;
00094   EggTextureCollection _textures;
00095   EggMaterialCollection _materials;
00096 };
00097 
00098 #endif
 All Classes Functions Variables Enumerations