forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmovingPart.I
More file actions
117 lines (102 loc) · 2.96 KB
/
movingPart.I
File metadata and controls
117 lines (102 loc) · 2.96 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
/**
* 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 movingPart.I
* @author drose
* @date 1999-02-22
*/
#include "animChannelFixed.h"
#include "datagram.h"
#include "datagramIterator.h"
#include "bamReader.h"
#include "bamWriter.h"
template<class SwitchType>
TypeHandle MovingPart<SwitchType>::_type_handle;
// We don't need to explicitly call MovingPart::init_type(), because it is an
// abstract class and therefore must have derived objects. Its derived
// objects will call init_type() for us.
/**
* Normally, you'd use make_copy() or copy_subgraph() to make a copy of this.
*/
template<class SwitchType>
INLINE MovingPart<SwitchType>::
MovingPart(const MovingPart<SwitchType> ©) :
MovingPartBase(copy),
_value(copy._value),
_default_value(copy._default_value)
{
}
/**
*
*/
template<class SwitchType>
INLINE MovingPart<SwitchType>::
MovingPart(PartGroup *parent, const std::string &name,
const ValueType &default_value) :
MovingPartBase(parent, name),
_value(default_value),
_default_value(default_value)
{
}
/**
*
*/
template<class SwitchType>
INLINE MovingPart<SwitchType>::
MovingPart() {
}
/**
* Returns the TypeHandle associated with the ValueType we are concerned with.
* This is provided to allow a bit of run-time checking that joints and
* channels are matching properly in type.
*/
template<class SwitchType>
TypeHandle MovingPart<SwitchType>::
get_value_type() const {
return get_type_handle(ValueType);
}
/**
* Creates and returns a new AnimChannel that is not part of any hierarchy,
* but that returns the default value associated with this part.
*/
template<class SwitchType>
AnimChannelBase *MovingPart<SwitchType>::
make_default_channel() const {
return new AnimChannelFixed<SwitchType>(get_name(), _default_value);
}
/**
* Outputs a very brief description of the channel's current value.
*/
template<class SwitchType>
void MovingPart<SwitchType>::
output_value(std::ostream &out) const {
SwitchType::output_value(out, _value);
}
/**
* Function to write the important information in the particular object to a
* Datagram
*/
template<class SwitchType>
void MovingPart<SwitchType>::
write_datagram(BamWriter *manager, Datagram &me) {
MovingPartBase::write_datagram(manager, me);
SwitchType::write_datagram(me, _value);
SwitchType::write_datagram(me, _default_value);
}
/**
* Function that reads out of the datagram (or asks manager to read) all of
* the data that is needed to re-create this object and stores it in the
* appropiate place
*/
template<class SwitchType>
void MovingPart<SwitchType>::
fillin(DatagramIterator &scan, BamReader *manager) {
MovingPartBase::fillin(scan, manager);
SwitchType::read_datagram(scan, _value);
SwitchType::read_datagram(scan, _default_value);
}