00001 // Filename: characterMaker.h 00002 // Created by: drose (06Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef CHARACTERMAKER_H 00020 #define CHARACTERMAKER_H 00021 00022 #include "pandabase.h" 00023 00024 #include "computedVerticesMaker.h" 00025 00026 #include "vector_PartGroupStar.h" 00027 #include "typedef.h" 00028 #include "pmap.h" 00029 00030 class EggNode; 00031 class EggGroup; 00032 class EggGroupNode; 00033 class EggPrimitive; 00034 class PartGroup; 00035 class CharacterJointBundle; 00036 class Character; 00037 class CharacterSlider; 00038 class MovingPartBase; 00039 class NamedNode; 00040 class EggLoader; 00041 00042 /////////////////////////////////////////////////////////////////// 00043 // Class : CharacterMaker 00044 // Description : Converts an EggGroup hierarchy, beginning with a 00045 // group with <Dart> set, to a character node with 00046 // joints. 00047 //////////////////////////////////////////////////////////////////// 00048 class EXPCL_PANDAEGG CharacterMaker { 00049 public: 00050 CharacterMaker(EggGroup *root, EggLoader &loader); 00051 00052 Character *make_node(); 00053 00054 PartGroup *egg_to_part(EggNode *egg_node) const; 00055 int egg_to_index(EggNode *egg_node) const; 00056 PandaNode *part_to_node(PartGroup *part) const; 00057 00058 int create_slider(const string &name); 00059 00060 private: 00061 CharacterJointBundle *make_bundle(); 00062 void build_joint_hierarchy(EggNode *egg_node, PartGroup *part); 00063 void parent_joint_nodes(PartGroup *part); 00064 00065 void make_geometry(EggNode *egg_node); 00066 00067 void make_static_primitive(EggPrimitive *egg_primitive, 00068 EggGroupNode *prim_home); 00069 void make_dynamic_primitive(EggPrimitive *egg_primitive, 00070 EggGroupNode *prim_home); 00071 EggGroupNode *determine_primitive_home(EggPrimitive *egg_primitive); 00072 00073 typedef pmap<EggNode *, int> NodeMap; 00074 NodeMap _node_map; 00075 00076 typedef vector_PartGroupStar Parts; 00077 Parts _parts; 00078 00079 EggLoader &_loader; 00080 EggGroup *_egg_root; 00081 Character *_character_node; 00082 CharacterJointBundle *_bundle; 00083 ComputedVerticesMaker _comp_verts_maker; 00084 PartGroup *_morph_root; 00085 PartGroup *_skeleton_root; 00086 }; 00087 00088 #endif