Panda3D
 All Classes Functions Variables Enumerations
animChannel.I
1 // Filename: animChannel.I
2 // Created by: drose (22Feb99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 template<class SwitchType>
17 
18 // We don't need to explicitly call AnimChannel::init_type(), because
19 // it is an abstract class and therefore must have derived objects.
20 // Its derived objects will call init_type() for us.
21 
22 
23 ////////////////////////////////////////////////////////////////////
24 // Function: AnimChannel::Protected constructor
25 // Access: Protected
26 // Description: Don't use this constructor. It exists only so that
27 // AnimChannelFixed may define itself outside of the
28 // hierarchy. Normally, an AnimChannel must be created
29 // as part of a hierarchy.
30 ////////////////////////////////////////////////////////////////////
31 template<class SwitchType>
33 AnimChannel(const string &name)
34  : AnimChannelBase(name) {
35 }
36 
37 ////////////////////////////////////////////////////////////////////
38 // Function: AnimChannel::Copy Constructor
39 // Access: Protected
40 // Description: Creates a new AnimChannel, just like this one,
41 // without copying any children. The new copy is added
42 // to the indicated parent. Intended to be called by
43 // make_copy() only.
44 ////////////////////////////////////////////////////////////////////
45 template<class SwitchType>
47 AnimChannel(AnimGroup *parent, const AnimChannel &copy) :
48  AnimChannelBase(parent, copy)
49 {
50 }
51 
52 ////////////////////////////////////////////////////////////////////
53 // Function: AnimChannel::Constructor
54 // Access: Public
55 // Description: This is the normal constructor, which automatically
56 // places the AnimChannel in the previously-created
57 // hierarchy.
58 ////////////////////////////////////////////////////////////////////
59 template<class SwitchType>
61 AnimChannel(AnimGroup *parent, const string &name)
62  : AnimChannelBase(parent, name) {
63 }
64 
65 ////////////////////////////////////////////////////////////////////
66 // Function: AnimChannel::Destructor
67 // Access: Public
68 // Description:
69 ////////////////////////////////////////////////////////////////////
70 template<class SwitchType>
72 ~AnimChannel() {
73 }
74 
75 #if defined(WIN32_VC) || defined(WIN64_VC)
76 ////////////////////////////////////////////////////////////////////
77 // Function: AnimChannel::get_value
78 // Access: Public, Virtual
79 // Description: Gets the value of the channel at the indicated frame.
80 // This is a pure virtual function and normally would
81 // not need a function body, except that VC++ seems to
82 // be unhappy about instantiating the template without
83 // it.
84 //
85 // However, GCC seems to get confused when it *is*
86 // defined. So this whole thing is protected within an
87 // ifdef.
88 ////////////////////////////////////////////////////////////////////
89 template<class SwitchType>
91 get_value(int, TYPENAME AnimChannel<SwitchType>::ValueType &) {
92 }
93 #endif
94 
95 ////////////////////////////////////////////////////////////////////
96 // Function: AnimChannel::get_value_no_scale_share
97 // Access: Public, Virtual
98 // Description: Returns the value associated with the current frame,
99 // with no scale or share components. This only makes
100 // sense for a matrix-type channel, although for fiddly
101 // technical reasons the function exists for all
102 // channels.
103 ////////////////////////////////////////////////////////////////////
104 template<class SwitchType>
106 get_value_no_scale_shear(int frame, ValueType &value) {
107  get_value(frame, value);
108 }
109 
110 ////////////////////////////////////////////////////////////////////
111 // Function: AnimChannel::get_scale
112 // Access: Public, Virtual
113 // Description: Returns the x, y, and z scale components associated
114 // with the current frame. As above, this only makes
115 // sense for a matrix-type channel.
116 ////////////////////////////////////////////////////////////////////
117 template<class SwitchType>
119 get_scale(int, LVecBase3 &scale) {
120  nassertv(false);
121 }
122 
123 ////////////////////////////////////////////////////////////////////
124 // Function: AnimChannel::get_hpr
125 // Access: Public, Virtual
126 // Description: Returns the h, p, and r components associated
127 // with the current frame. As above, this only makes
128 // sense for a matrix-type channel.
129 ////////////////////////////////////////////////////////////////////
130 template<class SwitchType>
132 get_hpr(int, LVecBase3 &hpr) {
133  nassertv(false);
134 }
135 
136 ////////////////////////////////////////////////////////////////////
137 // Function: AnimChannel::get_quat
138 // Access: Public, Virtual
139 // Description: Returns the rotation component associated with the
140 // current frame, expressed as a quaternion. As above,
141 // this only makes sense for a matrix-type channel.
142 ////////////////////////////////////////////////////////////////////
143 template<class SwitchType>
145 get_quat(int, LQuaternion &quat) {
146  nassertv(false);
147 }
148 
149 ////////////////////////////////////////////////////////////////////
150 // Function: AnimChannel::get_pos
151 // Access: Public, Virtual
152 // Description: Returns the x, y, and z translation components
153 // associated with the current frame. As above, this
154 // only makes sense for a matrix-type channel.
155 ////////////////////////////////////////////////////////////////////
156 template<class SwitchType>
158 get_pos(int, LVecBase3 &pos) {
159  nassertv(false);
160 }
161 
162 ////////////////////////////////////////////////////////////////////
163 // Function: AnimChannel::get_shear
164 // Access: Public, Virtual
165 // Description: Returns the a, b, and c shear components associated
166 // with the current frame. As above, this only makes
167 // sense for a matrix-type channel.
168 ////////////////////////////////////////////////////////////////////
169 template<class SwitchType>
171 get_shear(int, LVecBase3 &shear) {
172  nassertv(false);
173 }
174 
175 
176 ////////////////////////////////////////////////////////////////////
177 // Function: AnimChannel::get_value_type
178 // Access: Public, Virtual
179 // Description: Returns the TypeHandle associated with the ValueType
180 // we return. This is provided to allow a bit of
181 // run-time checking that joints and channels are
182 // matching properly in type.
183 ////////////////////////////////////////////////////////////////////
184 template<class SwitchType>
186 get_value_type() const {
187  return get_type_handle(ValueType);
188 }
189 
190 
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
virtual void get_pos(int frame, LVecBase3 &pos)
Returns the x, y, and z translation components associated with the current frame. ...
Definition: animChannel.I:158
virtual void get_quat(int frame, LQuaternion &quat)
Returns the rotation component associated with the current frame, expressed as a quaternion.
Definition: animChannel.I:145
virtual void get_scale(int frame, LVecBase3 &scale)
Returns the x, y, and z scale components associated with the current frame.
Definition: animChannel.I:119
virtual TypeHandle get_value_type() const
Returns the TypeHandle associated with the ValueType we return.
Definition: animChannel.I:186
virtual void get_hpr(int frame, LVecBase3 &hpr)
Returns the h, p, and r components associated with the current frame.
Definition: animChannel.I:132
This template class is the parent class for all kinds of AnimChannels that return different values...
Definition: animChannel.h:30
Parent class for all animation channels.
This is the base class for AnimChannel and AnimBundle.
Definition: animGroup.h:36
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:106
This is the base quaternion class.
Definition: lquaternion.h:96
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
virtual void get_shear(int frame, LVecBase3 &shear)
Returns the a, b, and c shear components associated with the current frame.
Definition: animChannel.I:171