Panda3D

animChannel.I
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 animChannel.I
10 * @author drose
11 * @date 1999-02-22
12 */
13
14 template<class SwitchType>
15 TypeHandle AnimChannel<SwitchType>::_type_handle;
16
17 // We don't need to explicitly call AnimChannel::init_type(), because it is an
18 // abstract class and therefore must have derived objects. Its derived
19 // objects will call init_type() for us.
20
21
22 /**
23 * Don't use this constructor. It exists only so that AnimChannelFixed may
24 * define itself outside of the hierarchy. Normally, an AnimChannel must be
25 * created as part of a hierarchy.
26 */
27 template<class SwitchType>
28 INLINE AnimChannel<SwitchType>::
29 AnimChannel(const std::string &name)
30 : AnimChannelBase(name) {
31 }
32
33 /**
34 * Creates a new AnimChannel, just like this one, without copying any
35 * children. The new copy is added to the indicated parent. Intended to be
36 * called by make_copy() only.
37 */
38 template<class SwitchType>
39 INLINE AnimChannel<SwitchType>::
40 AnimChannel(AnimGroup *parent, const AnimChannel &copy) :
41 AnimChannelBase(parent, copy)
42 {
43 }
44
45 /**
46 * This is the normal constructor, which automatically places the AnimChannel
47 * in the previously-created hierarchy.
48 */
49 template<class SwitchType>
50 INLINE AnimChannel<SwitchType>::
51 AnimChannel(AnimGroup *parent, const std::string &name)
52 : AnimChannelBase(parent, name) {
53 }
54
55 /**
56 *
57 */
58 template<class SwitchType>
59 INLINE AnimChannel<SwitchType>::
60 ~AnimChannel() {
61 }
62
63 /**
64 * Returns the value associated with the current frame, with no scale or share
65 * components. This only makes sense for a matrix-type channel, although for
66 * fiddly technical reasons the function exists for all channels.
67 */
68 template<class SwitchType>
69 void AnimChannel<SwitchType>::
70 get_value_no_scale_shear(int frame, ValueType &value) {
71 get_value(frame, value);
72 }
73
74 /**
75 * Returns the x, y, and z scale components associated with the current frame.
76 * As above, this only makes sense for a matrix-type channel.
77 */
78 template<class SwitchType>
79 void AnimChannel<SwitchType>::
80 get_scale(int, LVecBase3 &scale) {
81 nassertv(false);
82 }
83
84 /**
85 * Returns the h, p, and r components associated with the current frame. As
86 * above, this only makes sense for a matrix-type channel.
87 */
88 template<class SwitchType>
89 void AnimChannel<SwitchType>::
90 get_hpr(int, LVecBase3 &hpr) {
91 nassertv(false);
92 }
93
94 /**
95 * Returns the rotation component associated with the current frame, expressed
96 * as a quaternion. As above, this only makes sense for a matrix-type
97 * channel.
98 */
99 template<class SwitchType>
100 void AnimChannel<SwitchType>::
101 get_quat(int, LQuaternion &quat) {
102 nassertv(false);
103 }
104
105 /**
106 * Returns the x, y, and z translation components associated with the current
107 * frame. As above, this only makes sense for a matrix-type channel.
108 */
109 template<class SwitchType>
110 void AnimChannel<SwitchType>::
111 get_pos(int, LVecBase3 &pos) {
112 nassertv(false);
113 }
114
115 /**
116 * Returns the a, b, and c shear components associated with the current frame.
117 * As above, this only makes sense for a matrix-type channel.
118 */
119 template<class SwitchType>
120 void AnimChannel<SwitchType>::
121 get_shear(int, LVecBase3 &shear) {
122 nassertv(false);
123 }
124
125
126 /**
127 * Returns the TypeHandle associated with the ValueType we return. This is
128 * provided to allow a bit of run-time checking that joints and channels are
129 * matching properly in type.
130 */
131 template<class SwitchType>
132 TypeHandle AnimChannel<SwitchType>::
133 get_value_type() const {
134 return get_type_handle(ValueType);
135 }
AnimChannelBase
Parent class for all animation channels.
Definition: animChannelBase.h:30
AnimChannel
This template class is the parent class for all kinds of AnimChannels that return different values.
Definition: animChannel.h:28
AnimChannel::get_scale
virtual void get_scale(int frame, LVecBase3 &scale)
Returns the x, y, and z scale components associated with the current frame.
Definition: animChannel.I:80
AnimChannel::get_hpr
virtual void get_hpr(int frame, LVecBase3 &hpr)
Returns the h, p, and r components associated with the current frame.
Definition: animChannel.I:90
AnimChannel::get_quat
virtual void get_quat(int frame, LQuaternion &quat)
Returns the rotation component associated with the current frame, expressed as a quaternion.
Definition: animChannel.I:101
AnimChannel::get_value_type
virtual TypeHandle get_value_type() const
Returns the TypeHandle associated with the ValueType we return.
Definition: animChannel.I:133
AnimChannel::get_pos
virtual void get_pos(int frame, LVecBase3 &pos)
Returns the x, y, and z translation components associated with the current frame.
Definition: animChannel.I:111
AnimChannel::get_value_no_scale_shear
virtual void get_value_no_scale_shear(int frame, ValueType &value)
Returns the value associated with the current frame, with no scale or share components.
Definition: animChannel.I:70
AnimChannel::get_shear
virtual void get_shear(int frame, LVecBase3 &shear)
Returns the a, b, and c shear components associated with the current frame.
Definition: animChannel.I:121
AnimGroup
This is the base class for AnimChannel and AnimBundle.
Definition: animGroup.h:33
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81