Panda3D
animChannelMatrixXfmTable.h
1 // Filename: animChannelMatrixXfmTable.h
2 // Created by: drose (20Feb99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef ANIMCHANNELMATRIXXFMTABLE_H
16 #define ANIMCHANNELMATRIXXFMTABLE_H
17 
18 #include "pandabase.h"
19 
20 #include "animChannel.h"
21 
22 #include "pointerToArray.h"
23 #include "pta_stdfloat.h"
24 #include "compose_matrix.h"
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : AnimChannelMatrixXfmTable
28 // Description : An animation channel that issues a matrix each frame,
29 // read from a table such as might have been read from
30 // an egg file. The table actually consists of nine
31 // sub-tables, each representing one component of the
32 // transform: scale, rotate, translate.
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDA_CHAN AnimChannelMatrixXfmTable : public AnimChannelMatrix {
35 protected:
38 
39 PUBLISHED:
40  AnimChannelMatrixXfmTable(AnimGroup *parent, const string &name);
41  virtual ~AnimChannelMatrixXfmTable();
42 
43 public:
44  virtual bool has_changed(int last_frame, double last_frac,
45  int this_frame, double this_frac);
46  virtual void get_value(int frame, LMatrix4 &mat);
47 
48  virtual void get_value_no_scale_shear(int frame, LMatrix4 &value);
49  virtual void get_scale(int frame, LVecBase3 &scale);
50  virtual void get_hpr(int frame, LVecBase3 &hpr);
51  virtual void get_quat(int frame, LQuaternion &quat);
52  virtual void get_pos(int frame, LVecBase3 &pos);
53  virtual void get_shear(int frame, LVecBase3 &shear);
54 
55 PUBLISHED:
56  static INLINE bool is_valid_id(char table_id);
57 
58  void set_table(char table_id, const CPTA_stdfloat &table);
59  INLINE CPTA_stdfloat get_table(char table_id) const;
60 
61  void clear_all_tables();
62  INLINE bool has_table(char table_id) const;
63  INLINE void clear_table(char table_id);
64 
65 public:
66  virtual void write(ostream &out, int indent_level) const;
67 
68 protected:
69  virtual AnimGroup *make_copy(AnimGroup *parent) const;
70 
71  INLINE static char get_table_id(int table_index);
72  static int get_table_index(char table_id);
73  INLINE static PN_stdfloat get_default_value(int table_index);
74 
75  CPTA_stdfloat _tables[num_matrix_components];
76 
77 public:
78  static void register_with_read_factory();
79  virtual void write_datagram(BamWriter* manager, Datagram &me);
80 
81  static TypedWritable *make_AnimChannelMatrixXfmTable(const FactoryParams &params);
82 
83 protected:
84  void fillin(DatagramIterator& scan, BamReader* manager);
85 
86 public:
87  virtual TypeHandle get_type() const {
88  return get_class_type();
89  }
90  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
91  static TypeHandle get_class_type() {
92  return _type_handle;
93  }
94  static void init_type() {
95  AnimChannelMatrix::init_type();
96  register_type(_type_handle, "AnimChannelMatrixXfmTable",
97  AnimChannelMatrix::get_class_type());
98  }
99 
100 private:
101  static TypeHandle _type_handle;
102 };
103 
104 #include "animChannelMatrixXfmTable.I"
105 
106 #endif
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
virtual void get_pos(int frame, LVecBase3 &pos)
Returns the x, y, and z translation components associated with the current frame. ...
Definition: animChannel.I:158
virtual void get_quat(int frame, LQuaternion &quat)
Returns the rotation component associated with the current frame, expressed as a quaternion.
Definition: animChannel.I:145
virtual void get_scale(int frame, LVecBase3 &scale)
Returns the x, y, and z scale components associated with the current frame.
Definition: animChannel.I:119
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
static void register_with_read_factory()
Factory method to generate a AnimGroup object.
Definition: animGroup.cxx:362
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
virtual void get_hpr(int frame, LVecBase3 &hpr)
Returns the h, p, and r components associated with the current frame.
Definition: animChannel.I:132
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
virtual bool has_changed(int last_frame, double last_frac, int this_frame, double this_frac)
Returns true if the value has changed since the last call to has_changed().
This is the base class for AnimChannel and AnimBundle.
Definition: animGroup.h:36
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:451
virtual void get_value_no_scale_shear(int frame, ValueType &value)
Returns the value associated with the current frame, with no scale or share components.
Definition: animChannel.I:106
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
virtual void write(ostream &out, int indent_level) const
Writes a brief description of the group and all of its descendants.
Definition: animGroup.cxx:225
This is the base quaternion class.
Definition: lquaternion.h:96
An animation channel that issues a matrix each frame, read from a table such as might have been read ...
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43
virtual void get_shear(int frame, LVecBase3 &shear)
Returns the a, b, and c shear components associated with the current frame.
Definition: animChannel.I:171
Similar to PointerToArray, except that its contents may not be modified.