Panda3D
 All Classes Functions Variables Enumerations
characterMaker.h
00001 // Filename: characterMaker.h
00002 // Created by:  drose (06Mar02)
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 CHARACTERMAKER_H
00016 #define CHARACTERMAKER_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "vertexTransform.h"
00021 #include "vertexSlider.h"
00022 #include "character.h"
00023 #include "vector_PartGroupStar.h"
00024 #include "typedef.h"
00025 #include "pmap.h"
00026 
00027 
00028 class EggNode;
00029 class EggGroup;
00030 class EggGroupNode;
00031 class EggPrimitive;
00032 class EggBin;
00033 class PartGroup;
00034 class CharacterJointBundle;
00035 class Character;
00036 class GeomNode;
00037 class CharacterSlider;
00038 class MovingPartBase;
00039 class EggLoader;
00040 class PandaNode;
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, bool structured = false);
00051 
00052   Character *make_node();
00053 
00054   string get_name() const;
00055   PartGroup *egg_to_part(EggNode *egg_node) const;
00056   VertexTransform *egg_to_transform(EggNode *egg_node);
00057   int egg_to_index(EggNode *egg_node) const;
00058   PandaNode *part_to_node(PartGroup *part, const string &name) const;
00059 
00060   int create_slider(const string &name);
00061   VertexSlider *egg_to_slider(const string &name);
00062 
00063 private:
00064   CharacterJointBundle *make_bundle();
00065   void build_joint_hierarchy(EggNode *egg_node, PartGroup *part, int index);
00066   void parent_joint_nodes(PartGroup *part);
00067 
00068   void make_geometry(EggNode *egg_node);
00069 
00070   EggGroupNode *determine_primitive_home(EggPrimitive *egg_primitive);
00071   EggGroupNode *determine_bin_home(EggBin *egg_bin);
00072   VertexTransform *get_identity_transform();
00073 
00074   typedef pmap<EggNode *, int> NodeMap;
00075   NodeMap _node_map;
00076 
00077   typedef vector_PartGroupStar Parts;
00078   Parts _parts;
00079 
00080   typedef pmap<int, PT(VertexTransform) > VertexTransforms;
00081   VertexTransforms _vertex_transforms;
00082   PT(VertexTransform) _identity_transform;
00083 
00084   typedef pmap<string, PT(VertexSlider) > VertexSliders;
00085   VertexSliders _vertex_sliders;
00086 
00087   EggLoader &_loader;
00088   EggGroup *_egg_root;
00089   PT(Character) _character_node;
00090   CharacterJointBundle *_bundle;
00091   PartGroup *_morph_root;
00092   PartGroup *_skeleton_root;
00093   
00094   bool _structured;
00095 
00096 };
00097 
00098 #endif
 All Classes Functions Variables Enumerations