Panda3D

eggXfmSAnim.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 eggXfmSAnim.h
10 * @author drose
11 * @date 1999-02-19
12 */
13
14 #ifndef EGGXFMSANIM_H
15 #define EGGXFMSANIM_H
16
17 #include "pandabase.h"
18 #include "eggGroupNode.h"
19
20 class EggXfmAnimData;
21
22 /**
23 * This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to
24 * nine <S$Anim> entries that specify the nine components of a transformation.
25 * It's implemented as a group that can contain any number of EggSAnimData
26 * children.
27 */
28 class EXPCL_PANDA_EGG EggXfmSAnim : public EggGroupNode {
29 PUBLISHED:
30 INLINE explicit EggXfmSAnim(const std::string &name = "",
31 CoordinateSystem cs = CS_default);
32 EggXfmSAnim(const EggXfmAnimData &convert_from);
33
34 INLINE EggXfmSAnim(const EggXfmSAnim &copy);
35 INLINE EggXfmSAnim &operator = (const EggXfmSAnim &copy);
36
37 INLINE void set_fps(double fps);
38 INLINE void clear_fps();
39 INLINE bool has_fps() const;
40 INLINE double get_fps() const;
41
42 INLINE void set_order(const std::string &order);
43 INLINE void clear_order();
44 INLINE bool has_order() const;
45 INLINE const std::string &get_order() const;
46 INLINE static const std::string &get_standard_order();
47
48 INLINE CoordinateSystem get_coordinate_system() const;
49
50 void optimize();
51 void optimize_to_standard_order();
52 void normalize();
53
54 int get_num_rows() const;
55 void get_value(int row, LMatrix4d &mat) const;
56 bool set_value(int row, const LMatrix4d &mat);
57
58 INLINE void clear_data();
59 bool add_data(const LMatrix4d &mat);
60 void add_component_data(const std::string &component_name, double value);
61 void add_component_data(int component, double value);
62
63 virtual bool is_anim_matrix() const;
64 virtual void write(std::ostream &out, int indent_level) const;
65
66 static void compose_with_order(LMatrix4d &mat,
67 const LVecBase3d &scale,
68 const LVecBase3d &shear,
69 const LVecBase3d &hpr,
70 const LVecBase3d &trans,
71 const std::string &order,
72 CoordinateSystem cs);
73
74 protected:
75 virtual void r_transform(const LMatrix4d &mat, const LMatrix4d &inv,
76 CoordinateSystem to_cs);
77 virtual void r_mark_coordsys(CoordinateSystem cs);
78
79 private:
80 void normalize_by_rebuilding();
81 void normalize_by_expanding();
82
83
84 private:
85 double _fps;
86 bool _has_fps;
87 std::string _order;
88 CoordinateSystem _coordsys;
89
90 static const std::string _standard_order;
91
92 public:
93
94 static TypeHandle get_class_type() {
95 return _type_handle;
96 }
97 static void init_type() {
98 EggGroupNode::init_type();
99 register_type(_type_handle, "EggXfmSAnim",
100 EggGroupNode::get_class_type());
101 }
102 virtual TypeHandle get_type() const {
103 return get_class_type();
104 }
105 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
106
107 private:
108 static TypeHandle _type_handle;
109 };
110
111 #include "eggXfmSAnim.I"
112
113 #endif
EggGroupNode
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:46
EggGroupNode::write
virtual void write(std::ostream &out, int indent_level) const
Writes the group and all of its children to the indicated output stream in Egg format.
Definition: eggGroupNode.cxx:84
EggNode::is_anim_matrix
virtual bool is_anim_matrix() const
Returns true if this node represents a table of animation transformation data, false otherwise.
Definition: eggNode.cxx:74
EggXfmAnimData
Corresponding to an <Xfm$Anim> entry, this stores a two-dimensional table with up to nine columns,...
Definition: eggXfmAnimData.h:29
EggXfmSAnim
This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S$Anim> entries that...
Definition: eggXfmSAnim.h:28
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
eggGroupNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggXfmSAnim.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22