Panda3D
eggMatrixTablePointer.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 eggMatrixTablePointer.h
10  * @author drose
11  * @date 2001-02-26
12  */
13 
14 #ifndef EGGMATRIXTABLEPOINTER_H
15 #define EGGMATRIXTABLEPOINTER_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "eggJointPointer.h"
20 
21 #include "eggTable.h"
22 #include "eggXfmSAnim.h"
23 #include "pointerTo.h"
24 
25 /**
26  * This stores a pointer back to an EggXfmSAnim table (i.e. an <Xfm$Anim_S$>
27  * entry in an egg file), corresponding to the animation data from a single
28  * bundle for this joint.
29  */
31 public:
33 
34  virtual double get_frame_rate() const;
35  virtual int get_num_frames() const;
36  virtual void extend_to(int num_frames);
37  virtual LMatrix4d get_frame(int n) const;
38  virtual void set_frame(int n, const LMatrix4d &mat);
39  virtual bool add_frame(const LMatrix4d &mat);
40 
41  virtual void do_finish_reparent(EggJointPointer *new_parent);
42 
43  virtual bool do_rebuild(EggCharacterDb &db);
44 
45  virtual void optimize();
46  virtual void zero_channels(const std::string &components);
47  virtual void quantize_channels(const std::string &components, double quantum);
48 
49  virtual EggJointPointer *make_new_joint(const std::string &name);
50 
51  virtual void set_name(const std::string &name);
52 
53 private:
54  PT(EggTable) _table;
55  PT(EggXfmSAnim) _xform;
56 
57 public:
58  static TypeHandle get_class_type() {
59  return _type_handle;
60  }
61  static void init_type() {
62  EggJointPointer::init_type();
63  register_type(_type_handle, "EggMatrixTablePointer",
64  EggJointPointer::get_class_type());
65  }
66  virtual TypeHandle get_type() const {
67  return get_class_type();
68  }
69  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
70 
71 private:
72  static TypeHandle _type_handle;
73 };
74 
75 #endif
virtual LMatrix4d get_frame(int n) const
Returns the transform matrix corresponding to this joint position in the nth frame.
virtual void set_frame(int n, const LMatrix4d &mat)
Sets the transform matrix corresponding to this joint position in the nth frame.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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
virtual void extend_to(int num_frames)
Extends the table to the indicated number of frames.
virtual void zero_channels(const std::string &components)
Zeroes out the named components of the transform in the animation frames.
virtual void optimize()
Resets the table before writing to disk so that redundant rows (e.g.
virtual EggJointPointer * make_new_joint(const std::string &name)
Creates a new child of the current joint in the egg data, and returns a pointer to it.
This class is used during joint optimization or restructuring to store the table of interim joint com...
virtual bool do_rebuild(EggCharacterDb &db)
Rebuilds the entire table all at once, based on the frames added by repeated calls to add_rebuild_fra...
virtual bool add_frame(const LMatrix4d &mat)
Appends a new frame onto the end of the data, if possible; returns true if not possible,...
This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S$Anim> entries that...
Definition: eggXfmSAnim.h:28
This is a base class for EggJointNodePointer and EggMatrixTablePointer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This corresponds to a.
Definition: eggTable.h:27
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void set_name(const std::string &name)
Applies the indicated name change to the egg file.
This stores a pointer back to an EggXfmSAnim table (i.e.
virtual void quantize_channels(const std::string &components, double quantum)
Rounds the named components of the transform to the nearest multiple of quantum.
virtual int get_num_frames() const
Returns the number of frames of animation for this particular joint.
virtual void do_finish_reparent(EggJointPointer *new_parent)
Performs the actual reparenting operation by removing the node from its old parent and associating it...
virtual double get_frame_rate() const
Returns the stated frame rate of this particular joint, or 0.0 if it doesn't state.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The highest-level base class in the egg directory.
Definition: eggObject.h:29