00001 #include "OMKPostureDataType.h" 00002 #include "OMKIncomingSynchronisationMessage.h" 00003 #include "OMKOutgoingSynchronisationMessage.h" 00004 #include "OgreVector3.h" 00005 #include "OgreQuaternion.h" 00006 00007 using namespace OMK ; 00008 using namespace OMK::Type ; 00009 EventIdentifier OMK::EventId::INITIALISATION_SEQUENCE( "initialisationSequence" ) ; 00010 00011 //============================================================================= 00012 std::ostream& operator << ( std::ostream& out, const HBT::PostureData& p ) 00013 { 00014 out << p.rootPos.x << " " << p.rootPos.y << " " << p.rootPos.z << " " 00015 << p.rootQuat.w << " " << p.rootQuat.x << " " << p.rootQuat.y << " " << p.rootQuat.z << " " 00016 << p.generalScale.x << " " << p.generalScale.y << " " << p.generalScale.z << " " 00017 << p.postureQuat.size() << " " ; 00018 for( unsigned int i = 0 ; i < p.postureQuat.size() ; i++ ) 00019 { 00020 out << p.postureQuat[ i ].w << " " << p.postureQuat[ i ].x << " " << p.postureQuat[ i ].y << " " << p.postureQuat[ i ].z << " " 00021 << p.quatModified[ i ] << " " ; 00022 } 00023 return out ; 00024 } 00025 00026 std::istream& operator >> ( std::istream& in, HBT::PostureData& p ) 00027 { 00028 unsigned int size ; 00029 in >> p.rootPos.x >> p.rootPos.y >> p.rootPos.z 00030 >> p.rootQuat.w >> p.rootQuat.x >> p.rootQuat.y >> p.rootQuat.z 00031 >> p.generalScale.x >> p.generalScale.y >> p.generalScale.z 00032 >> size ; 00033 for( ; 0 < size ; size-- ) 00034 { 00035 Ogre::Quaternion postureQuat ; 00036 bool quatModified ; 00037 in >> postureQuat.w >> postureQuat.x >> postureQuat.y >> postureQuat.z 00038 >> quatModified ; 00039 p.postureQuat.push_back( postureQuat ) ; 00040 p.quatModified.push_back( quatModified ) ; 00041 } 00042 return in ; 00043 } 00044 00045 OutgoingSynchronisationMessage& operator << 00046 ( OutgoingSynchronisationMessage& out, const HBT::PostureData& p ) 00047 { 00048 out << p.rootPos.x << p.rootPos.y << p.rootPos.z 00049 << p.rootQuat.w << p.rootQuat.x << p.rootQuat.y << p.rootQuat.z 00050 << p.generalScale.x << p.generalScale.y << p.generalScale.z 00051 << p.postureQuat.size() ; 00052 for( unsigned int i = 0 ; i < p.postureQuat.size() ; i++ ) 00053 { 00054 out << p.postureQuat[ i ].w << p.postureQuat[ i ].x << p.postureQuat[ i ].y << p.postureQuat[ i ].z 00055 << p.quatModified[ i ] ; 00056 } 00057 return out ; 00058 } 00059 00060 IncomingSynchronisationMessage& operator >> 00061 ( IncomingSynchronisationMessage& in, HBT::PostureData& p ) 00062 { 00063 unsigned int size ; 00064 in >> p.rootPos.x >> p.rootPos.y >> p.rootPos.z 00065 >> p.rootQuat.w >> p.rootQuat.x >> p.rootQuat.y >> p.rootQuat.z 00066 >> p.generalScale.x >> p.generalScale.y >> p.generalScale.z 00067 >> size ; 00068 for( ; 0 < size ; size-- ) 00069 { 00070 Ogre::Quaternion postureQuat ; 00071 bool quatModified ; 00072 in >> postureQuat.w >> postureQuat.x >> postureQuat.y >> postureQuat.z 00073 >> quatModified ; 00074 p.postureQuat.push_back( postureQuat ) ; 00075 p.quatModified.push_back( quatModified ) ; 00076 } 00077 return in ; 00078 } 00079 00080 bool HBT::operator == ( const HBT::PostureData& a, const HBT::PostureData& b ) 00081 { 00082 return false ; 00083 } 00084 00085 //============================================================================= 00086 std::ostream& operator << ( std::ostream& out, const HBT::InitialisationSequence& p ) 00087 { 00088 out << p.meshFile << " " 00089 << p.humanName << " " 00090 << p.useShadows << " " 00091 << p.generalScale.x << " " << p.generalScale.y << " " << p.generalScale.z << " " 00092 << p.rootQuat.w << " " << p.rootQuat.x << " " << p.rootQuat.y << " " << p.rootQuat.z << " " 00093 << p.rootPos.x << " " << p.rootPos.y << " " << p.rootPos.z << " " 00094 << p.boneNumber.size() << " " ; 00095 OMASSERT( p.boneNumber.size() == p.postureQuat.size() ) ; 00096 for( unsigned int i = 0 ; i < p.boneNumber.size() ; i++ ) 00097 { 00098 out << p.boneNumber[ i ] << " " 00099 << p.postureQuat[ i ].w << " " << p.postureQuat[ i ].x << " " << p.postureQuat[ i ].y << " " << p.postureQuat[ i ].z << " " ; 00100 } 00101 return out ; 00102 } 00103 00104 std::istream& operator >> ( std::istream& in, HBT::InitialisationSequence& p ) 00105 { 00106 unsigned int size ; 00107 in >> p.meshFile 00108 >> p.humanName 00109 >> p.useShadows 00110 >> p.generalScale.x >> p.generalScale.y >> p.generalScale.z 00111 >> p.rootQuat.w >> p.rootQuat.x >> p.rootQuat.y >> p.rootQuat.z 00112 >> p.rootPos.x >> p.rootPos.y >> p.rootPos.z 00113 >> size ; 00114 00115 for( ; 0 < size ; size-- ) 00116 { 00117 unsigned short boneNumber ; 00118 Ogre::Quaternion postureQuat ; 00119 in >> boneNumber 00120 >> postureQuat.w >> postureQuat.x >> postureQuat.y >> postureQuat.z ; 00121 p.boneNumber.push_back( boneNumber ) ; 00122 p.postureQuat.push_back( postureQuat ) ; 00123 } 00124 return in ; 00125 } 00126 00127 OutgoingSynchronisationMessage& operator << 00128 ( OutgoingSynchronisationMessage& out, const HBT::InitialisationSequence& p ) 00129 { 00130 out << p.meshFile 00131 << p.humanName 00132 << p.useShadows 00133 << p.generalScale.x << p.generalScale.y << p.generalScale.z 00134 << p.rootQuat.w << p.rootQuat.x << p.rootQuat.y << p.rootQuat.z 00135 << p.rootPos.x << p.rootPos.y << p.rootPos.z 00136 << p.boneNumber.size() ; 00137 OMASSERT( p.boneNumber.size() == p.postureQuat.size() ) ; 00138 for( unsigned int i = 0 ; i < p.boneNumber.size() ; i++ ) 00139 { 00140 out << p.boneNumber[ i ] 00141 << p.postureQuat[ i ].w << p.postureQuat[ i ].x << p.postureQuat[ i ].y << p.postureQuat[ i ].z ; 00142 } 00143 return out ; 00144 } 00145 00146 IncomingSynchronisationMessage& operator >> 00147 ( IncomingSynchronisationMessage& in, HBT::InitialisationSequence& p ) 00148 { 00149 unsigned int size ; 00150 in >> p.meshFile 00151 >> p.humanName 00152 >> p.useShadows 00153 >> p.generalScale.x >> p.generalScale.y >> p.generalScale.z 00154 >> p.rootQuat.w >> p.rootQuat.x >> p.rootQuat.y >> p.rootQuat.z 00155 >> p.rootPos.x >> p.rootPos.y >> p.rootPos.z 00156 >> size ; 00157 00158 for( ; 0 < size ; size-- ) 00159 { 00160 unsigned short boneNumber ; 00161 Ogre::Quaternion postureQuat ; 00162 in >> boneNumber 00163 >> postureQuat.w >> postureQuat.x >> postureQuat.y >> postureQuat.z ; 00164 p.boneNumber.push_back( boneNumber ) ; 00165 p.postureQuat.push_back( postureQuat ) ; 00166 } 00167 return in ; 00168 } 00169 00170 bool HBT::operator == ( const HBT::InitialisationSequence& a, const HBT::InitialisationSequence& b ) 00171 { 00172 return false ; 00173 }
Documentation generated on Mon Jun 9 11:45:57 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |