Panda3D

Loading...
Searching...
No Matches
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 {
29PUBLISHED:
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::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::optimize_to_standard_order
void optimize_to_standard_order()
Optimizes the table by collapsing redundant sub-tables, and simultaneously ensures that the order str...
Definition eggXfmSAnim.cxx:101
EggXfmSAnim::optimize
void optimize()
Optimizes the table by collapsing redundant sub-tables.
Definition eggXfmSAnim.cxx:63
EggXfmSAnim::get_coordinate_system
CoordinateSystem get_coordinate_system() const
Returns the coordinate system this table believes it is defined within.
Definition eggXfmSAnim.I:140
EggXfmSAnim::clear_data
void clear_data()
Removes all data from the table.
Definition eggXfmSAnim.I:149
EggXfmSAnim::get_num_rows
int get_num_rows() const
Returns the effective number of rows in the table.
Definition eggXfmSAnim.cxx:263
EggXfmSAnim::compose_with_order
static void compose_with_order(LMatrix4d &mat, const LVecBase3d &scale, const LVecBase3d &shear, const LVecBase3d &hpr, const LVecBase3d &trans, const std::string &order, CoordinateSystem cs)
Composes a matrix out of the nine individual components, respecting the order string.
Definition eggXfmSAnim.cxx:203
EggXfmSAnim::add_data
bool add_data(const LMatrix4d &mat)
Adds a new matrix to the table, by adding a new row to each of the subtables.
Definition eggXfmSAnim.cxx:476
EggXfmSAnim::get_value
void get_value(int row, LMatrix4d &mat) const
Returns the value of the aggregate row of the table as a matrix.
Definition eggXfmSAnim.cxx:293
EggXfmSAnim::set_value
bool set_value(int row, const LMatrix4d &mat)
Replaces the indicated row of the table with the given matrix.
Definition eggXfmSAnim.cxx:392
EggXfmSAnim::add_component_data
void add_component_data(const std::string &component_name, double value)
Adds a new row to the named component (one of matrix_component_letters) of the table.
Definition eggXfmSAnim.cxx:556
EggXfmSAnim::normalize
void normalize()
The inverse operation of optimize(), this ensures that all the sub-tables have the same length by dup...
Definition eggXfmSAnim.cxx:115
EggXfmSAnim::get_fps
double get_fps() const
This is only valid if has_fps() returns true.
Definition eggXfmSAnim.I:82
EggXfmSAnim::get_standard_order
static const std::string & get_standard_order()
Returns the standard order of matrix component composition.
Definition eggXfmSAnim.I:129
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