00001 // Filename: animChannel.I 00002 // Created by: drose (22Feb99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 template<class SwitchType> 00016 TypeHandle AnimChannel<SwitchType>::_type_handle; 00017 00018 // We don't need to explicitly call AnimChannel::init_type(), because 00019 // it is an abstract class and therefore must have derived objects. 00020 // Its derived objects will call init_type() for us. 00021 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Function: AnimChannel::Protected constructor 00025 // Access: Protected 00026 // Description: Don't use this constructor. It exists only so that 00027 // AnimChannelFixed may define itself outside of the 00028 // hierarchy. Normally, an AnimChannel must be created 00029 // as part of a hierarchy. 00030 //////////////////////////////////////////////////////////////////// 00031 template<class SwitchType> 00032 INLINE AnimChannel<SwitchType>:: 00033 AnimChannel(const string &name) 00034 : AnimChannelBase(name) { 00035 } 00036 00037 //////////////////////////////////////////////////////////////////// 00038 // Function: AnimChannel::Copy Constructor 00039 // Access: Protected 00040 // Description: Creates a new AnimChannel, just like this one, 00041 // without copying any children. The new copy is added 00042 // to the indicated parent. Intended to be called by 00043 // make_copy() only. 00044 //////////////////////////////////////////////////////////////////// 00045 template<class SwitchType> 00046 INLINE AnimChannel<SwitchType>:: 00047 AnimChannel(AnimGroup *parent, const AnimChannel ©) : 00048 AnimChannelBase(parent, copy) 00049 { 00050 } 00051 00052 //////////////////////////////////////////////////////////////////// 00053 // Function: AnimChannel::Constructor 00054 // Access: Public 00055 // Description: This is the normal constructor, which automatically 00056 // places the AnimChannel in the previously-created 00057 // hierarchy. 00058 //////////////////////////////////////////////////////////////////// 00059 template<class SwitchType> 00060 INLINE AnimChannel<SwitchType>:: 00061 AnimChannel(AnimGroup *parent, const string &name) 00062 : AnimChannelBase(parent, name) { 00063 } 00064 00065 //////////////////////////////////////////////////////////////////// 00066 // Function: AnimChannel::Destructor 00067 // Access: Public 00068 // Description: 00069 //////////////////////////////////////////////////////////////////// 00070 template<class SwitchType> 00071 INLINE AnimChannel<SwitchType>:: 00072 ~AnimChannel() { 00073 } 00074 00075 #if defined(WIN32_VC) || defined(WIN64_VC) 00076 //////////////////////////////////////////////////////////////////// 00077 // Function: AnimChannel::get_value 00078 // Access: Public, Virtual 00079 // Description: Gets the value of the channel at the indicated frame. 00080 // This is a pure virtual function and normally would 00081 // not need a function body, except that VC++ seems to 00082 // be unhappy about instantiating the template without 00083 // it. 00084 // 00085 // However, GCC seems to get confused when it *is* 00086 // defined. So this whole thing is protected within an 00087 // ifdef. 00088 //////////////////////////////////////////////////////////////////// 00089 template<class SwitchType> 00090 void AnimChannel<SwitchType>:: 00091 get_value(int, TYPENAME AnimChannel<SwitchType>::ValueType &) { 00092 } 00093 #endif 00094 00095 //////////////////////////////////////////////////////////////////// 00096 // Function: AnimChannel::get_value_no_scale_share 00097 // Access: Public, Virtual 00098 // Description: Returns the value associated with the current frame, 00099 // with no scale or share components. This only makes 00100 // sense for a matrix-type channel, although for fiddly 00101 // technical reasons the function exists for all 00102 // channels. 00103 //////////////////////////////////////////////////////////////////// 00104 template<class SwitchType> 00105 void AnimChannel<SwitchType>:: 00106 get_value_no_scale_shear(int frame, ValueType &value) { 00107 get_value(frame, value); 00108 } 00109 00110 //////////////////////////////////////////////////////////////////// 00111 // Function: AnimChannel::get_scale 00112 // Access: Public, Virtual 00113 // Description: Returns the x, y, and z scale components associated 00114 // with the current frame. As above, this only makes 00115 // sense for a matrix-type channel. 00116 //////////////////////////////////////////////////////////////////// 00117 template<class SwitchType> 00118 void AnimChannel<SwitchType>:: 00119 get_scale(int, LVecBase3 &scale) { 00120 nassertv(false); 00121 } 00122 00123 //////////////////////////////////////////////////////////////////// 00124 // Function: AnimChannel::get_hpr 00125 // Access: Public, Virtual 00126 // Description: Returns the h, p, and r components associated 00127 // with the current frame. As above, this only makes 00128 // sense for a matrix-type channel. 00129 //////////////////////////////////////////////////////////////////// 00130 template<class SwitchType> 00131 void AnimChannel<SwitchType>:: 00132 get_hpr(int, LVecBase3 &hpr) { 00133 nassertv(false); 00134 } 00135 00136 //////////////////////////////////////////////////////////////////// 00137 // Function: AnimChannel::get_quat 00138 // Access: Public, Virtual 00139 // Description: Returns the rotation component associated with the 00140 // current frame, expressed as a quaternion. As above, 00141 // this only makes sense for a matrix-type channel. 00142 //////////////////////////////////////////////////////////////////// 00143 template<class SwitchType> 00144 void AnimChannel<SwitchType>:: 00145 get_quat(int, LQuaternion &quat) { 00146 nassertv(false); 00147 } 00148 00149 //////////////////////////////////////////////////////////////////// 00150 // Function: AnimChannel::get_pos 00151 // Access: Public, Virtual 00152 // Description: Returns the x, y, and z translation components 00153 // associated with the current frame. As above, this 00154 // only makes sense for a matrix-type channel. 00155 //////////////////////////////////////////////////////////////////// 00156 template<class SwitchType> 00157 void AnimChannel<SwitchType>:: 00158 get_pos(int, LVecBase3 &pos) { 00159 nassertv(false); 00160 } 00161 00162 //////////////////////////////////////////////////////////////////// 00163 // Function: AnimChannel::get_shear 00164 // Access: Public, Virtual 00165 // Description: Returns the a, b, and c shear components associated 00166 // with the current frame. As above, this only makes 00167 // sense for a matrix-type channel. 00168 //////////////////////////////////////////////////////////////////// 00169 template<class SwitchType> 00170 void AnimChannel<SwitchType>:: 00171 get_shear(int, LVecBase3 &shear) { 00172 nassertv(false); 00173 } 00174 00175 00176 //////////////////////////////////////////////////////////////////// 00177 // Function: AnimChannel::get_value_type 00178 // Access: Public, Virtual 00179 // Description: Returns the TypeHandle associated with the ValueType 00180 // we return. This is provided to allow a bit of 00181 // run-time checking that joints and channels are 00182 // matching properly in type. 00183 //////////////////////////////////////////////////////////////////// 00184 template<class SwitchType> 00185 TypeHandle AnimChannel<SwitchType>:: 00186 get_value_type() const { 00187 return get_type_handle(ValueType); 00188 } 00189 00190