00001 // Filename: computedVerticesMorph.I 00002 // Created by: drose (03Mar99) 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 #include "characterSlider.h" 00020 00021 //////////////////////////////////////////////////////////////////// 00022 // Function: ComputedVerticesMorphValue2::Constructor 00023 // Access: Public 00024 // Description: 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE ComputedVerticesMorphValue2:: 00027 ComputedVerticesMorphValue2(int index, const VecType &mvector) 00028 : _index(index), _vector(mvector) { 00029 } 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: ComputedVerticesMorphValue2::Constructor 00033 // Access: Public 00034 // Description: 00035 //////////////////////////////////////////////////////////////////// 00036 INLINE ComputedVerticesMorphValue2:: 00037 ComputedVerticesMorphValue2(void){ 00038 } 00039 00040 //////////////////////////////////////////////////////////////////// 00041 // Function: ComputedVerticesMorphValue3::Constructor 00042 // Access: Public 00043 // Description: 00044 //////////////////////////////////////////////////////////////////// 00045 INLINE ComputedVerticesMorphValue3:: 00046 ComputedVerticesMorphValue3(int index, const VecType &mvector) 00047 : _index(index), _vector(mvector) { 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: ComputedVerticesMorphValue3::Constructor 00052 // Access: Public 00053 // Description: 00054 //////////////////////////////////////////////////////////////////// 00055 INLINE ComputedVerticesMorphValue3:: 00056 ComputedVerticesMorphValue3(void){ 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: ComputedVerticesMorphValue4::Constructor 00061 // Access: Public 00062 // Description: 00063 //////////////////////////////////////////////////////////////////// 00064 INLINE ComputedVerticesMorphValue4:: 00065 ComputedVerticesMorphValue4(int index, const VecType &mvector) 00066 : _index(index), _vector(mvector) { 00067 } 00068 00069 //////////////////////////////////////////////////////////////////// 00070 // Function: ComputedVerticesMorphValue4::Constructor 00071 // Access: Public 00072 // Description: 00073 //////////////////////////////////////////////////////////////////// 00074 INLINE ComputedVerticesMorphValue4:: 00075 ComputedVerticesMorphValue4(void){ 00076 } 00077 00078 //////////////////////////////////////////////////////////////////// 00079 // Function: ComputedVerticesMorph::Constructor 00080 // Access: Public 00081 // Description: 00082 //////////////////////////////////////////////////////////////////// 00083 template<class ValueType, class MorphValueType> 00084 ComputedVerticesMorph<ValueType, MorphValueType>:: 00085 ComputedVerticesMorph() { 00086 _slider_index = -1; 00087 } 00088 00089 //////////////////////////////////////////////////////////////////// 00090 // Function: ComputedVerticesMorph::Copy Constructor 00091 // Access: Public 00092 // Description: 00093 //////////////////////////////////////////////////////////////////// 00094 template<class ValueType, class MorphValueType> 00095 ComputedVerticesMorph<ValueType, MorphValueType>:: 00096 ComputedVerticesMorph(const ComputedVerticesMorph<ValueType, MorphValueType> ©) : 00097 _slider_index(copy._slider_index), 00098 _morphs(copy._morphs) 00099 { 00100 } 00101 00102 00103 //////////////////////////////////////////////////////////////////// 00104 // Function: ComputedVerticesMorph::output 00105 // Access: Public 00106 // Description: 00107 //////////////////////////////////////////////////////////////////// 00108 template<class ValueType, class MorphValueType> 00109 void ComputedVerticesMorph<ValueType, MorphValueType>:: 00110 output(ostream &out) const { 00111 out << "morph index " << _slider_index << ": " 00112 << _morphs.size() << " points."; 00113 } 00114 00115 00116 //////////////////////////////////////////////////////////////////// 00117 // Function: ComputedVerticesMorph::write_datagram 00118 // Access: Public 00119 // Description: 00120 //////////////////////////////////////////////////////////////////// 00121 template<class ValueType, class MorphValueType> 00122 void ComputedVerticesMorph<ValueType, MorphValueType>:: 00123 write_datagram(Datagram &dest) 00124 { 00125 dest.add_int16(_slider_index); 00126 dest.add_uint16(_morphs.size()); 00127 for(int i = 0; i < (int)_morphs.size(); i++) 00128 { 00129 _morphs[i].write_datagram(dest); 00130 } 00131 } 00132 00133 //////////////////////////////////////////////////////////////////// 00134 // Function: ComputedVerticesMorph::read_datagram 00135 // Access: Protected 00136 // Description: 00137 //////////////////////////////////////////////////////////////////// 00138 template<class ValueType, class MorphValueType> 00139 void ComputedVerticesMorph<ValueType, MorphValueType>:: 00140 read_datagram(DatagramIterator& source) 00141 { 00142 _slider_index = source.get_int16(); 00143 int size = source.get_uint16(); 00144 for(int i = 0; i < size; i++) 00145 { 00146 MorphValue mv; 00147 mv.read_datagram(source); 00148 _morphs.push_back(mv); 00149 } 00150 }