forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmovingPartBase.h
More file actions
121 lines (99 loc) · 3.94 KB
/
movingPartBase.h
File metadata and controls
121 lines (99 loc) · 3.94 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
/**
* 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 movingPartBase.h
* @author drose
* @date 1999-02-22
*/
#ifndef MOVINGPARTBASE_H
#define MOVINGPARTBASE_H
#include "pandabase.h"
#include "partGroup.h"
#include "partBundle.h"
#include "animChannelBase.h"
/**
* This is the base class for a single animatable piece that may be bound to
* one channel (or more, if blending is in effect). It corresponds to, for
* instance, a single joint or slider of a character.
*
* MovingPartBase does not have a particular value type. See the derived
* template class, MovingPart, for this.
*/
class EXPCL_PANDA_CHAN MovingPartBase : public PartGroup {
protected:
INLINE MovingPartBase(const MovingPartBase ©);
public:
MovingPartBase(PartGroup *parent, const std::string &name);
PUBLISHED:
INLINE int get_max_bound() const;
INLINE AnimChannelBase *get_bound(int n) const;
public:
virtual TypeHandle get_value_type() const=0;
virtual AnimChannelBase *make_default_channel() const=0;
PUBLISHED:
virtual bool clear_forced_channel();
virtual AnimChannelBase *get_forced_channel() const;
virtual void write(std::ostream &out, int indent_level) const;
virtual void write_with_value(std::ostream &out, int indent_level) const;
virtual void output_value(std::ostream &out) const=0;
public:
virtual bool do_update(PartBundle *root, const CycleData *root_cdata,
PartGroup *parent, bool parent_changed,
bool anim_changed, Thread *current_thread);
virtual void get_blend_value(const PartBundle *root)=0;
virtual bool update_internals(PartBundle *root, PartGroup *parent,
bool self_changed, bool parent_changed,
Thread *current_thread);
protected:
MovingPartBase();
virtual void pick_channel_index(plist<int> &holes, int &next) const;
virtual void bind_hierarchy(AnimGroup *anim, int channel_index,
int &joint_index, bool is_included,
BitArray &bound_joints,
const PartSubset &subset);
virtual void find_bound_joints(int &joint_index, bool is_included,
BitArray &bound_joints,
const PartSubset &subset);
virtual void determine_effective_channels(const CycleData *root_cdata);
// This is the vector of all channels bound to this part.
typedef pvector< PT(AnimChannelBase) > Channels;
Channels _channels;
// This is the single channel that has an effect on this part, as determined
// by determine_effective_channels(). It is only set if there is exactly
// one channel that affects this part (i.e. num_effective_channels is 1).
// If there are multiple channels, or no channels at all, it is NULL.
AnimControl *_effective_control;
PT(AnimChannelBase) _effective_channel;
// This is the particular channel that's been forced to this part, via
// set_forced_channel(). It overrides all of the above if set.
PT(AnimChannelBase) _forced_channel;
public:
virtual void write_datagram(BamWriter *manager, Datagram &dg);
virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
protected:
void fillin(DatagramIterator &scan, BamReader *manager);
public:
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
PUBLISHED:
static TypeHandle get_class_type() {
return _type_handle;
}
public:
static void init_type() {
PartGroup::init_type();
register_type(_type_handle, "MovingPartBase",
PartGroup::get_class_type());
}
private:
static TypeHandle _type_handle;
};
#include "movingPartBase.I"
#endif