Panda3D
Loading...
Searching...
No Matches
xFileAnimationSet.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 xFileAnimationSet.h
10 * @author drose
11 * @date 2004-10-02
12 */
13
14#ifndef XFILEANIMATIONSET_H
15#define XFILEANIMATIONSET_H
16
17#include "pandatoolbase.h"
18#include "pmap.h"
19#include "epvector.h"
20#include "luse.h"
21#include "namable.h"
22
24class EggGroup;
25class EggTable;
26class EggXfmSAnim;
27
28/**
29 * This represents a tree of EggTables, corresponding to Animation entries in
30 * the X file. There is one EggTable for each joint in the character's joint
31 * set, and the whole tree is structured as a mirror of the joint set.
32 */
33class XFileAnimationSet : public Namable {
34public:
37
39 EggXfmSAnim *get_table(const std::string &joint_name) const;
40
41 enum FrameDataFlags {
42 FDF_scale = 0x01,
43 FDF_rot = 0x02,
44 FDF_trans = 0x04,
45 FDF_mat = 0x08,
46 };
47
48 class FrameEntry {
49 public:
50 INLINE FrameEntry();
51 INLINE const LMatrix4d &get_mat(int flags) const;
52
53 LVecBase3d _scale;
54 LQuaterniond _rot;
55 LVector3d _trans;
56 LMatrix4d _mat;
57 };
58
59 typedef epvector<FrameEntry> FrameEntries;
60
61 class FrameData {
62 public:
63 INLINE FrameData();
64 FrameEntries _entries;
65 int _flags;
66 };
67
68 FrameData &create_frame_data(const std::string &joint_name);
69
70public:
71 double _frame_rate;
72
73private:
74 void mirror_table(XFileToEggConverter *converter,
75 EggGroup *model_node, EggTable *anim_node);
76
78 JointData _joint_data;
79
80 class TablePair {
81 public:
82 EggGroup *_joint;
83 EggXfmSAnim *_table;
84 };
85
86 typedef pmap<std::string, TablePair> Tables;
87 Tables _tables;
88};
89
90#include "xFileAnimationSet.I"
91
92#endif
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition eggGroup.h:34
This corresponds to a.
Definition eggTable.h:27
This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine entries that specify...
Definition eggXfmSAnim.h:28
A base class for all things which can have a name.
Definition namable.h:26
const LMatrix4d & get_mat(int flags) const
Returns the frame's data as a matrix, composing the matrix first if necessary, as indicated by the Fr...
This represents a tree of EggTables, corresponding to Animation entries in the X file.
bool create_hierarchy(XFileToEggConverter *converter)
Sets up the hierarchy of EggTables corresponding to this AnimationSet.
EggXfmSAnim * get_table(const std::string &joint_name) const
Returns the table associated with the indicated joint name.
FrameData & create_frame_data(const std::string &joint_name)
Returns a reference to a new FrameData table corresponding to the indicated joint.
This is our own Panda specialization on the default STL map.
Definition pmap.h:49
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.