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 */
30 class EggMatrixTablePointer : public EggJointPointer {
31 public:
32 EggMatrixTablePointer(EggObject *object);
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
EggCharacterDb
This class is used during joint optimization or restructuring to store the table of interim joint com...
Definition: eggCharacterDb.h:41
EggJointPointer
This is a base class for EggJointNodePointer and EggMatrixTablePointer.
Definition: eggJointPointer.h:31
EggMatrixTablePointer
This stores a pointer back to an EggXfmSAnim table (i.e.
Definition: eggMatrixTablePointer.h:30
EggMatrixTablePointer::get_num_frames
virtual int get_num_frames() const
Returns the number of frames of animation for this particular joint.
Definition: eggMatrixTablePointer.cxx:76
EggMatrixTablePointer::do_rebuild
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...
Definition: eggMatrixTablePointer.cxx:184
EggMatrixTablePointer::add_frame
virtual bool add_frame(const LMatrix4d &mat)
Appends a new frame onto the end of the data, if possible; returns true if not possible,...
Definition: eggMatrixTablePointer.cxx:142
EggMatrixTablePointer::zero_channels
virtual void zero_channels(const std::string &components)
Zeroes out the named components of the transform in the animation frames.
Definition: eggMatrixTablePointer.cxx:229
EggMatrixTablePointer::get_frame_rate
virtual double get_frame_rate() const
Returns the stated frame rate of this particular joint, or 0.0 if it doesn't state.
Definition: eggMatrixTablePointer.cxx:64
EggMatrixTablePointer::do_finish_reparent
virtual void do_finish_reparent(EggJointPointer *new_parent)
Performs the actual reparenting operation by removing the node from its old parent and associating it...
Definition: eggMatrixTablePointer.cxx:155
EggMatrixTablePointer::extend_to
virtual void extend_to(int num_frames)
Extends the table to the indicated number of frames.
Definition: eggMatrixTablePointer.cxx:88
EggMatrixTablePointer::get_frame
virtual LMatrix4d get_frame(int n) const
Returns the transform matrix corresponding to this joint position in the nth frame.
Definition: eggMatrixTablePointer.cxx:110
EggMatrixTablePointer::set_frame
virtual void set_frame(int n, const LMatrix4d &mat)
Sets the transform matrix corresponding to this joint position in the nth frame.
Definition: eggMatrixTablePointer.cxx:132
EggMatrixTablePointer::optimize
virtual void optimize()
Resets the table before writing to disk so that redundant rows (e.g.
Definition: eggMatrixTablePointer.cxx:219
EggMatrixTablePointer::set_name
virtual void set_name(const std::string &name)
Applies the indicated name change to the egg file.
Definition: eggMatrixTablePointer.cxx:293
EggMatrixTablePointer::make_new_joint
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.
Definition: eggMatrixTablePointer.cxx:275
EggMatrixTablePointer::quantize_channels
virtual void quantize_channels(const std::string &components, double quantum)
Rounds the named components of the transform to the nearest multiple of quantum.
Definition: eggMatrixTablePointer.cxx:251
EggObject
The highest-level base class in the egg directory.
Definition: eggObject.h:29
EggTable
This corresponds to a.
Definition: eggTable.h:27
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
eggJointPointer.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggTable.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggXfmSAnim.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.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