forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcharacterJoint.h
More file actions
141 lines (112 loc) · 4.06 KB
/
characterJoint.h
File metadata and controls
141 lines (112 loc) · 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file characterJoint.h
* @author drose
* @date 1999-02-23
*/
#ifndef CHARACTERJOINT_H
#define CHARACTERJOINT_H
#include "pandabase.h"
#include "transformState.h"
#include "movingPartMatrix.h"
#include "pandaNode.h"
#include "nodePathCollection.h"
#include "ordered_vector.h"
class JointVertexTransform;
class Character;
/**
* This represents one joint of the character's animation, containing an
* animating transform matrix.
*/
class EXPCL_PANDA_CHAR CharacterJoint : public MovingPartMatrix {
protected:
CharacterJoint();
CharacterJoint(const CharacterJoint ©);
PUBLISHED:
explicit CharacterJoint(Character *character, PartBundle *root,
PartGroup *parent, const std::string &name,
const LMatrix4 &default_value);
virtual ~CharacterJoint();
public:
virtual bool is_character_joint() const;
virtual PartGroup *make_copy() const;
virtual bool update_internals(PartBundle *root, PartGroup *parent,
bool self_changed, bool parent_changed,
Thread *current_thread);
virtual void do_xform(const LMatrix4 &mat, const LMatrix4 &inv_mat);
PUBLISHED:
bool add_net_transform(PandaNode *node);
bool remove_net_transform(PandaNode *node);
bool has_net_transform(PandaNode *node) const;
void clear_net_transforms();
NodePathCollection get_net_transforms();
bool add_local_transform(PandaNode *node);
bool remove_local_transform(PandaNode *node);
bool has_local_transform(PandaNode *node) const;
void clear_local_transforms();
NodePathCollection get_local_transforms();
void get_transform(LMatrix4 &transform) const;
INLINE const LMatrix4 &get_transform() const;
CPT(TransformState) get_transform_state() const;
void get_net_transform(LMatrix4 &transform) const;
Character *get_character() const;
private:
void set_character(Character *character);
private:
// Not a reference-counted pointer.
Character *_character;
typedef ov_set< PT(PandaNode) > NodeList;
NodeList _net_transform_nodes;
NodeList _local_transform_nodes;
typedef ov_set<JointVertexTransform *> VertexTransforms;
VertexTransforms _vertex_transforms;
public:
static void register_with_read_factory();
virtual void write_datagram(BamWriter* manager, Datagram &me);
virtual int complete_pointers(TypedWritable **p_list,
BamReader *manager);
static TypedWritable *make_CharacterJoint(const FactoryParams ¶ms);
protected:
void fillin(DatagramIterator& scan, BamReader* manager);
private:
int _num_net_nodes, _num_local_nodes;
public:
// The _geom_node member just holds a temporary pointer to a node for the
// CharacterMaker's convenenience while creating the character. It does not
// store any meaningful value after creation is complete.
PT(PandaNode) _geom_node;
// These are filled in as the joint animates.
LMatrix4 _net_transform;
LMatrix4 _initial_net_transform_inverse;
// This is the product of the above; the matrix that gets applied to a
// vertex (whose coordinates are in the coordinate space of the character
// in its neutral pose) to transform it from its neutral position to its
// animated position.
LMatrix4 _skinning_matrix;
public:
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
MovingPartMatrix::init_type();
register_type(_type_handle, "CharacterJoint",
MovingPartMatrix::get_class_type());
}
private:
static TypeHandle _type_handle;
friend class Character;
friend class CharacterJointBundle;
friend class JointVertexTransform;
};
#include "characterJoint.I"
#endif