Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/eggcharbase/eggCharacterData.h

Go to the documentation of this file.
00001 // Filename: eggCharacterData.h
00002 // Created by:  drose (23Feb01)
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 EGGCHARACTERDATA_H
00020 #define EGGCHARACTERDATA_H
00021 
00022 #include "pandatoolbase.h"
00023 
00024 #include "eggJointData.h"
00025 
00026 #include "eggNode.h"
00027 #include "pointerTo.h"
00028 #include "namable.h"
00029 
00030 #include "pmap.h"
00031 
00032 class EggCharacterCollection;
00033 class EggSliderData;
00034 
00035 ////////////////////////////////////////////////////////////////////
00036 //       Class : EggCharacterData
00037 // Description : Represents a single character, as read and collected
00038 //               from several models and animation files.  This
00039 //               contains a hierarchy of EggJointData nodes
00040 //               representing the skeleton, as well as a list of
00041 //               EggSliderData nodes representing the morph channels
00042 //               for the character.
00043 //
00044 //               This is very similar to the Character class from
00045 //               Panda, in that it's capable of associating
00046 //               skeleton-morph animation channels with models and
00047 //               calculating the vertex position for each frame.  To
00048 //               some degree, it duplicates the functionality of
00049 //               Character.  However, it differs in one fundamental
00050 //               principle: it is designed to be a non-real-time
00051 //               operation, working directly on the Egg structures as
00052 //               they are, instead of first boiling the Egg data into
00053 //               native Panda Geom tables for real-time animation.
00054 //               Because of this, it is (a) double-precision instead
00055 //               of single precision, (b) capable of generating
00056 //               modified Egg files, and (c) about a hundred times
00057 //               slower than the Panda Character class.
00058 //
00059 //               The data in this structure is normally filled in by
00060 //               the EggCharacterCollection class.
00061 ////////////////////////////////////////////////////////////////////
00062 class EggCharacterData : public Namable {
00063 public:
00064   EggCharacterData(EggCharacterCollection *collection);
00065   virtual ~EggCharacterData();
00066 
00067   void add_model(int model_index, EggNode *model_root);
00068   INLINE int get_num_models() const;
00069   INLINE int get_model_index(int n) const;
00070   INLINE EggNode *get_model_root(int n) const;
00071 
00072   INLINE EggJointData *get_root_joint() const;
00073   INLINE EggJointData *find_joint(const string &name) const;
00074 
00075   EggSliderData *make_slider(const string &name);
00076 
00077   virtual void write(ostream &out, int indent_level = 0) const;
00078 
00079 protected:
00080   class Model {
00081   public:
00082     int _model_index;
00083     PT(EggNode) _model_root;
00084   };
00085   typedef pvector<Model> Models;
00086   Models _models;
00087 
00088   EggCharacterCollection *_collection;
00089   EggJointData *_root_joint;
00090 
00091   typedef pmap<string, EggSliderData *> Sliders;
00092   Sliders _sliders;
00093 };
00094 
00095 #include "eggCharacterData.I"
00096 
00097 #endif
00098 
00099 

Generated on Fri May 2 03:18:42 2003 for Panda-Tool by doxygen1.3