Panda3D

Loading...
Searching...
No Matches
eggCharacterDb.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file eggCharacterDb.h
10 * @author drose
11 * @date 2006-10-05
12 */
13
14#ifndef EGGCHARACTERDB_H
15#define EGGCHARACTERDB_H
16
17#include "pandatoolbase.h"
18#include "pmap.h"
19
20/*
21#ifdef HAVE_BDB
22
23// Apparently, we have to define this to make db_cxx files include the modern
24// header files.
25#define HAVE_CXX_STDHEADERS 1
26#include <db_cxx.h>
27
28#endif // HAVE_BDB
29*/
30
31 class EggJointPointer;
32 class LMatrix4d;
33
34/**
35 * This class is used during joint optimization or restructuring to store the
36 * table of interim joint computations.
37 *
38 * That is to say, this class provides an temporary data store for three
39 * tables of matrices per each EggJointPointer per frame.
40 */
41 class EggCharacterDb {
42 public:
43 EggCharacterDb();
44 ~EggCharacterDb();
45
46 enum TableType {
47 TT_rebuild_frame,
48 TT_net_frame,
49 TT_net_frame_inv,
50 };
51
52 bool get_matrix(const EggJointPointer *joint, TableType type,
53 int frame, LMatrix4d &mat) const;
54 void set_matrix(const EggJointPointer *joint, TableType type,
55 int frame, const LMatrix4d &mat);
56
57 private:
58 class Key {
59 public:
60 INLINE Key(const EggJointPointer *joint,
61 TableType table_type,
62 int frame);
63 INLINE bool operator < (const Key &other) const;
64
65 private:
66 const EggJointPointer *_joint;
67 TableType _table_type;
68 int _frame;
69 };
70
71 /*
72#ifdef HAVE_BDB
73 Db *_db;
74 Filename _db_filename;
75#endif // HAVE_BDB
76 */
77
78 typedef pmap<Key, LMatrix4d> Table;
79 Table _table;
80};
81
82#include "eggCharacterDb.I"
83
84#endif
EggCharacterDb::EggCharacterDb
EggCharacterDb()
Constructs a database for storing the interim work for the indicated EggCharacterData.
Definition eggCharacterDb.cxx:25
EggCharacterDb::set_matrix
void set_matrix(const EggJointPointer *joint, TableType type, int frame, const LMatrix4d &mat)
Stores the matrix for the indicated joint, type, and frame in the database.
Definition eggCharacterDb.cxx:106
EggCharacterDb::get_matrix
bool get_matrix(const EggJointPointer *joint, TableType type, int frame, LMatrix4d &mat) const
Looks up the data for the indicated joint, type, and frame, and fills it in result (and returns true)...
Definition eggCharacterDb.cxx:68
EggJointPointer
This is a base class for EggJointNodePointer and EggMatrixTablePointer.
Definition eggJointPointer.h:31
eggCharacterDb.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pmap.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.