Panda3D
jointVertexTransform.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 jointVertexTransform.h
10  * @author drose
11  * @date 2005-03-24
12  */
13 
14 #ifndef JOINTVERTEXTRANSFORM_H
15 #define JOINTVERTEXTRANSFORM_H
16 
17 #include "pandabase.h"
18 #include "characterJoint.h"
19 #include "vertexTransform.h"
20 #include "pointerTo.h"
21 #include "lightMutex.h"
22 
23 /**
24  * This is a specialization on VertexTransform that returns the transform
25  * necessary to move vertices as if they were assigned to the indicated joint.
26  * The geometry itself should be parented to the scene graph at the level of
27  * the character's root joint; that is, it should not be parented under a node
28  * directly animated by any joints.
29  *
30  * Multiple combinations of these with different weights are used to implement
31  * soft-skinned vertices for an animated character.
32  */
33 class EXPCL_PANDA_CHAR JointVertexTransform : public VertexTransform {
34 private:
36 
37 PUBLISHED:
39  virtual ~JointVertexTransform();
40 
41  INLINE const CharacterJoint *get_joint() const;
42 
43  virtual void get_matrix(LMatrix4 &matrix) const;
44  virtual void mult_matrix(LMatrix4 &result, const LMatrix4 &previous) const;
45  virtual void accumulate_matrix(LMatrix4 &accum, PN_stdfloat weight) const;
46 
47  virtual void output(std::ostream &out) const;
48 
49 private:
50  PT(CharacterJoint) _joint;
51 
52 public:
53  static void register_with_read_factory();
54  virtual void write_datagram(BamWriter *manager, Datagram &dg);
55  virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
56 
57 protected:
58  static TypedWritable *make_from_bam(const FactoryParams &params);
59  void fillin(DatagramIterator &scan, BamReader *manager);
60 
61 public:
62  static TypeHandle get_class_type() {
63  return _type_handle;
64  }
65  static void init_type() {
66  VertexTransform::init_type();
67  register_type(_type_handle, "JointVertexTransform",
68  VertexTransform::get_class_type());
69  }
70  virtual TypeHandle get_type() const {
71  return get_class_type();
72  }
73  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
74 
75 private:
76  static TypeHandle _type_handle;
77 
78  friend class CharacterJoint;
79 };
80 
81 #include "jointVertexTransform.I"
82 
83 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
This is our own Panda specialization on the default STL list.
Definition: plist.h:35
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
This is an abstract base class that holds a pointer to some transform, computed in some arbitrary way...
virtual void mult_matrix(LMatrix4 &result, const LMatrix4 &previous) const
Premultiplies this transform's matrix with the indicated previous matrix, so that the result is the n...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a specialization on VertexTransform that returns the transform necessary to move vertices as ...
This represents one joint of the character's animation, containing an animating transform matrix.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void accumulate_matrix(LMatrix4 &accum, PN_stdfloat weight) const
Adds the value of this transform's matrix, modified by the indicated weight, into the indicated accum...
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:81
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38