Panda3D
 All Classes Functions Variables Enumerations
eggJointPointer.h
1 // Filename: eggJointPointer.h
2 // Created by: drose (26Feb01)
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 EGGJOINTPOINTER_H
16 #define EGGJOINTPOINTER_H
17 
18 #include "pandatoolbase.h"
19 #include "eggBackPointer.h"
20 #include "eggGroup.h"
21 #include "luse.h"
22 
23 class EggCharacterDb;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : EggJointPointer
27 // Description : This is a base class for EggJointNodePointer and
28 // EggMatrixTablePointer. It stores a back pointer to
29 // either a <Joint> entry or an xform <Table> data, and
30 // thus presents an interface that returns 1-n matrices,
31 // one for each frame. (<Joint> entries, for model
32 // files, appear the same as one-frame animations.)
33 ////////////////////////////////////////////////////////////////////
35 public:
36  virtual int get_num_frames() const=0;
37  virtual LMatrix4d get_frame(int n) const=0;
38  virtual void set_frame(int n, const LMatrix4d &mat)=0;
39  virtual bool add_frame(const LMatrix4d &mat);
40 
41  virtual void do_finish_reparent(EggJointPointer *new_parent)=0;
42  virtual void move_vertices_to(EggJointPointer *new_joint);
43 
44  virtual bool do_rebuild(EggCharacterDb &db);
45 
46  virtual void optimize();
47  virtual void expose(EggGroup::DCSType dcs_type);
48  virtual void zero_channels(const string &components);
49  virtual void quantize_channels(const string &components, double quantum);
50  virtual void apply_default_pose(EggJointPointer *source_joint, int frame);
51 
52  virtual EggJointPointer *make_new_joint(const string &name)=0;
53 
54 public:
55  static TypeHandle get_class_type() {
56  return _type_handle;
57  }
58  static void init_type() {
59  EggBackPointer::init_type();
60  register_type(_type_handle, "EggJointPointer",
61  EggBackPointer::get_class_type());
62  }
63  virtual TypeHandle get_type() const {
64  return get_class_type();
65  }
66  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
67 
68 private:
69  static TypeHandle _type_handle;
70 };
71 
72 #include "eggJointPointer.I"
73 
74 #endif
75 
76 
virtual void quantize_channels(const string &components, double quantum)
Rounds the named components of the transform to the nearest multiple of quantum.
virtual void optimize()
Resets the table before writing to disk so that redundant rows (e.g.
virtual bool add_frame(const LMatrix4d &mat)
Appends a new frame onto the end of the data, if possible; returns true if not possible, or false otherwise (e.g.
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:4716
virtual void zero_channels(const string &components)
Zeroes out the named components of the transform in the animation frames.
virtual void move_vertices_to(EggJointPointer *new_joint)
Moves the vertices assigned to this joint into the other joint (which should be of the same type)...
This class is used during joint optimization or restructuring to store the table of interim joint com...
virtual void apply_default_pose(EggJointPointer *source_joint, int frame)
Applies the pose from the indicated frame of the indicated source joint as the initial pose for this ...
This is a base class for EggJointNodePointer and EggMatrixTablePointer.
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 void expose(EggGroup::DCSType dcs_type)
Flags the joint with the indicated DCS flag so that it will be loaded as a separate node in the playe...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This stores a pointer from an EggJointData or EggSliderData object back to the referencing data in an...