00001 // Filename: animChannel.I 00002 // Created by: drose (22Feb99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 template<class SwitchType> 00020 TypeHandle AnimChannel<SwitchType>::_type_handle; 00021 00022 // We don't need to explicitly call AnimChannel::init_type(), because 00023 // it is an abstract class and therefore must have derived objects. 00024 // Its derived objects will call init_type() for us. 00025 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: AnimChannel::Protected constructor 00029 // Access: Protected 00030 // Description: Don't use this constructor. It exists only so that 00031 // AnimChannelFixed may define itself outside of the 00032 // hierarchy. Normally, an AnimChannel must be created 00033 // as part of a hierarchy. 00034 //////////////////////////////////////////////////////////////////// 00035 template<class SwitchType> 00036 INLINE AnimChannel<SwitchType>:: 00037 AnimChannel(const string &name) 00038 : AnimChannelBase(name) { 00039 } 00040 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: AnimChannel::Constructor 00044 // Access: Public 00045 // Description: This is the normal constructor, which automatically 00046 // places the AnimChannel in the previously-created 00047 // hierarchy. 00048 //////////////////////////////////////////////////////////////////// 00049 template<class SwitchType> 00050 INLINE AnimChannel<SwitchType>:: 00051 AnimChannel(AnimGroup *parent, const string &name) 00052 : AnimChannelBase(parent, name) { 00053 } 00054 00055 #ifdef WIN32_VC 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: AnimChannel::get_value 00058 // Access: Public, Virtual 00059 // Description: Gets the value of the channel at the indicated frame. 00060 // This is a pure virtual function and normally would 00061 // not need a function body, except that VC++ seems to 00062 // be unhappy about instantiating the template without 00063 // it. 00064 // 00065 // However, GCC seems to get confused when it *is* 00066 // defined. So this whole thing is protected within an 00067 // ifdef. 00068 //////////////////////////////////////////////////////////////////// 00069 template<class SwitchType> 00070 void AnimChannel<SwitchType>:: 00071 get_value(int, TYPENAME AnimChannel<SwitchType>::ValueType &) { 00072 } 00073 #endif 00074 00075 //////////////////////////////////////////////////////////////////// 00076 // Function: AnimChannel::get_value_no_scale 00077 // Access: Public, Virtual 00078 // Description: Returns the value associated with the current frame, 00079 // with no scale components. This only makes sense for 00080 // a matrix-type channel, although for fiddly technical 00081 // reasons the function exists for all channels. 00082 //////////////////////////////////////////////////////////////////// 00083 template<class SwitchType> 00084 void AnimChannel<SwitchType>:: 00085 get_value_no_scale(int frame, ValueType &value) { 00086 get_value(frame, value); 00087 } 00088 00089 //////////////////////////////////////////////////////////////////// 00090 // Function: AnimChannel::get_scale 00091 // Access: Public, Virtual 00092 // Description: Returns the x, y, and z scale components associated 00093 // with the current frame. As above, this only makes 00094 // sense for a matrix-type channel. 00095 //////////////////////////////////////////////////////////////////// 00096 template<class SwitchType> 00097 void AnimChannel<SwitchType>:: 00098 get_scale(int, float scale[3]) { 00099 scale[0] = 1.0f; 00100 scale[1] = 1.0f; 00101 scale[2] = 1.0f; 00102 } 00103 00104 00105 //////////////////////////////////////////////////////////////////// 00106 // Function: AnimChannel::get_value_type 00107 // Access: Public, Virtual 00108 // Description: Returns the TypeHandle associated with the ValueType 00109 // we return. This is provided to allow a bit of 00110 // run-time checking that joints and channels are 00111 // matching properly in type. 00112 //////////////////////////////////////////////////////////////////// 00113 template<class SwitchType> 00114 TypeHandle AnimChannel<SwitchType>:: 00115 get_value_type() const { 00116 return get_type_handle(ValueType); 00117 } 00118 00119