Panda3D
 All Classes Functions Variables Enumerations
eggCharacterDb.h
00001 // Filename: eggCharacterDb.h
00002 // Created by:  drose (05Oct06)
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 EGGCHARACTERDB_H
00016 #define EGGCHARACTERDB_H
00017 
00018 #include "pandatoolbase.h"
00019 #include "pmap.h"
00020 
00021 /*
00022 #ifdef HAVE_BDB
00023 
00024 // Apparently, we have to define this to make db_cxx files include the
00025 // modern header files.
00026 #define HAVE_CXX_STDHEADERS 1
00027 #include <db_cxx.h>
00028 
00029 #endif  // HAVE_BDB
00030 */
00031 
00032 class EggJointPointer;
00033 
00034 ////////////////////////////////////////////////////////////////////
00035 //       Class : EggCharacterDb
00036 // Description : This class is used during joint optimization or
00037 //               restructuring to store the table of interim joint
00038 //               computations.
00039 //
00040 //               That is to say, this class provides an temporary data
00041 //               store for three tables of matrices per each
00042 //               EggJointPointer per frame.
00043 ////////////////////////////////////////////////////////////////////
00044 class EggCharacterDb {
00045 public:
00046   EggCharacterDb();
00047   ~EggCharacterDb();
00048 
00049   enum TableType {
00050     TT_rebuild_frame,
00051     TT_net_frame,
00052     TT_net_frame_inv,
00053   };
00054 
00055   bool get_matrix(const EggJointPointer *joint, TableType type,
00056                   int frame, LMatrix4d &mat) const;
00057   void set_matrix(const EggJointPointer *joint, TableType type,
00058                   int frame, const LMatrix4d &mat);
00059 
00060 private:
00061   class Key {
00062   public:
00063     INLINE Key(const EggJointPointer *joint,
00064                TableType table_type,
00065                int frame);
00066     INLINE bool operator < (const Key &other) const;
00067 
00068   private:
00069     const EggJointPointer *_joint;
00070     TableType _table_type;
00071     int _frame;
00072   };
00073 
00074   /*
00075 #ifdef HAVE_BDB
00076   Db *_db;
00077   Filename _db_filename;
00078 #endif  // HAVE_BDB
00079   */
00080 
00081   typedef pmap<Key, LMatrix4d> Table;
00082   Table _table;
00083 };
00084 
00085 #include "eggCharacterDb.I"
00086 
00087 #endif
00088 
00089 
 All Classes Functions Variables Enumerations