00001 00007 #include "SO3SkeletonBap.h" 00008 #include "../SCOLBasic/SO3Loader3d.h" 00009 #include "../SO3Animation/SO3Anim.h" 00010 #include "SO3Bone.h" 00011 #include "SO3EntityFap.h" 00012 00013 namespace SO3 00014 { 00015 00016 SSkeletonFap::SSkeletonFap(SScene* parent, std::string skeletonName, SEntity* parentEntity) : SSkeleton(parent, skeletonName, parentEntity) 00017 { 00018 hisDictionnaryInit = false; 00019 nbBAPFrames = 0; 00020 is_H_Anim = false; 00021 animBAP = NULL; 00022 } 00023 00024 SSkeletonFap::SSkeletonFap() : SSkeleton(0, "", 0) 00025 { 00026 // Forbiden (private) 00027 } 00028 00029 SSkeletonFap::~SSkeletonFap() 00030 { 00031 } 00032 00033 void SSkeletonFap::FeedBAPAnimation() 00034 { 00035 /*if(bapBuffer.Size()>2) 00036 { 00037 struct Load3d l1; 00038 struct Load3d l2; 00039 int p = 0; 00040 00041 string str1,str2; 00042 str1 = bapBuffer[bapBuffer.Size()-1]; 00043 str2 = bapBuffer[bapBuffer.Size()-2]; 00044 00045 l1.f = NULL; 00046 l1.buf = (char*)str1.c_str(); 00047 SO3Dnextline(&l1); 00048 00049 l2.f = NULL; 00050 l2.buf = (char*)str2.c_str(); 00051 SO3Dnextline(&l2); 00052 SO3Dnextline(&l2); 00053 00054 bapBuffer.DeleteIndex(bapBuffer.Size()-2); 00055 bapBuffer.DeleteIndex(bapBuffer.Size()-1); 00056 00057 if(is_H_Anim) 00058 { 00059 int nbBones = 3*(boneList.Size()); 00060 float eulerAngle[297]; 00061 SArray<Ogre::Vector3> vecEulerAngle; 00062 int temp[297]; 00063 00064 int count = 0; 00065 for(int i=0;i<l1.argn;i++) 00066 { 00067 if(!strcmp(l1.argv[i],"1")) 00068 { 00069 temp[count] = i+1; 00070 count++; 00071 } 00072 } 00073 00074 for(int i=0;i<297;i++) eulerAngle[i] = 0.0; 00075 //nbBAPFrames = atoi(l2.argv[0]); 00076 for(int j=0;j<count;j++) 00077 { 00078 for(int i=0;i<297;i++) 00079 { 00080 if(abs(BapID[i]) == temp[j] && BapID[i] != 0) 00081 eulerAngle[i] = atoi(l2.argv[j+1])*(BapID[i]/abs(BapID[i])); 00082 else if(eulerAngle[i] == 0.0) 00083 eulerAngle[i] = 0.0; 00084 } 00085 } 00086 Ogre::Vector3 vec; 00087 for(int i=0;i<99;i++) 00088 { 00089 vec.x = eulerAngle[i + 2*i]; 00090 vec.y = eulerAngle[i + (2*i+1)]; 00091 vec.z = eulerAngle[i + (2*i+2)]; 00092 00093 Ogre::Matrix3 rot; 00094 rot.IDENTITY; 00095 00096 vec.x = ((vec.x/100000)*180.0)/SO3_PI; 00097 vec.y = ((vec.y/100000)*180.0)/SO3_PI; 00098 vec.z = ((vec.z/100000)*180.0)/SO3_PI; 00099 00100 rot.FromEulerAnglesYXZ((Ogre::Radian)vec.x,(Ogre::Radian)vec.y,(Ogre::Radian)vec.z); 00101 rot.FromEulerAnglesYXZ((Ogre::Radian)(vec.x*SO3_PI/180.0),(Ogre::Radian)((vec.y)*SO3_PI/180.0),(Ogre::Radian)(vec.z*SO3_PI/180.0)); 00102 00103 // On créer un quaternion 00104 Ogre::Quaternion quat; 00105 quat.FromRotationMatrix(rot); 00106 quat = quat * boneList[i]->quatBAP; 00107 animBAP->getOgreAnimationPointer()->getNodeTrack(i)->createNodeKeyFrame(animBAP->getOgreAnimationPointer()->getNodeTrack(i)->getNumKeyFrames()+1)->setRotation(quat); 00108 } 00109 } 00110 else 00111 { 00112 int nbBones = 3*(boneList.Size()); 00113 float eulerAngle[126]; 00114 SArray<Ogre::Vector3> vecEulerAngle; 00115 int temp[126]; 00116 int frame = 0; 00117 00118 int count = 0; 00119 for(int i=0;i<l1.argn;i++) 00120 { 00121 if(!strcmp(l1.argv[i],"1")) 00122 { 00123 temp[count] = i+1; 00124 count++; 00125 } 00126 } 00127 00128 for(int i=0;i<126;i++) eulerAngle[i] = 0.0; 00129 frame = atoi(l2.argv[0]); 00130 for(int j=0;j<count;j++) 00131 { 00132 for(int i=0;i<126;i++) 00133 { 00134 if(abs(BapID[i]) == temp[j] && BapID[i] != 0) 00135 eulerAngle[i] = atoi(l2.argv[j+1])*(BapID[i]/abs(BapID[i])); 00136 else if(eulerAngle[i] == 0.0) 00137 eulerAngle[i] = 0.0; 00138 } 00139 } 00140 Ogre::Vector3 vec; 00141 for(int i=0;i<42;i++) 00142 { 00143 vec.x = eulerAngle[i + 2*i]; 00144 vec.y = eulerAngle[i + (2*i+1)]; 00145 vec.z = eulerAngle[i + (2*i+2)]; 00146 00147 Ogre::Matrix3 rot; 00148 rot.IDENTITY; 00149 00150 vec.x = ((vec.x/100000)*180.0)/SO3_PI; 00151 vec.y = ((vec.y/100000)*180.0)/SO3_PI; 00152 vec.z = ((vec.z/100000)*180.0)/SO3_PI; 00153 00154 rot.FromEulerAnglesYXZ((Ogre::Radian)vec.x,(Ogre::Radian)vec.y,(Ogre::Radian)vec.z); 00155 rot.FromEulerAnglesYXZ((Ogre::Radian)(vec.x*SO3_PI/180.0),(Ogre::Radian)((vec.y)*SO3_PI/180.0),(Ogre::Radian)(vec.z*SO3_PI/180.0)); 00156 00157 // On créer un quaternion 00158 Ogre::Quaternion quat; 00159 quat.FromRotationMatrix(rot); 00160 quat = quat * boneList[i]->quatBAP; 00161 animBAP->getOgreAnimationPointer()->getNodeTrack(i)->createNodeKeyFrame(animBAP->getOgreAnimationPointer()->getNodeTrack(i)->getNumKeyFrames()+1)->setRotation(quat); 00162 } 00163 } 00164 nbBAPFrames++; 00165 }*/ 00166 } 00167 00168 bool SSkeletonFap::FeedBAPBuffer(std::string buffer) 00169 { 00170 /*if(!strcmp(buffer.c_str(),"End of Datas\n")) 00171 { 00172 bapBuffer.Clear(); 00173 bapBuffer.Empty(); 00174 return false; 00175 } 00176 00177 if(bapBuffer.Size() == 0) 00178 bapBuffer.Add(" "); 00179 00180 for(int i= 0;i<buffer.length();i++) 00181 { 00182 if((buffer.substr(i,1)).find("\n") == -1) 00183 bapBuffer[0] += buffer.substr(i,1); 00184 else 00185 bapBuffer.Insert(" ",0) ; 00186 } 00187 00188 while(bapBuffer.Size()>2) 00189 FeedBAPAnimation(); 00190 00191 Ogre::AnimationState* curAnimState = ((SEntity*)animBAP->getAssociatedNodePointer())->getOgreEntityPointer()->getAnimationState(animBAP->getOgreAnimationPointer()->getName()); 00192 animBAP->getOgreAnimationPointer()->setLength(animBAP->getOgreAnimationPointer()->getLength()+nbBAPFrames); 00193 curAnimState->setLength(curAnimState->getLength()+nbBAPFrames); 00194 curAnimState->setEnabled(true); 00195 animBAP->isEnable = true; 00196 00197 if(bapBuffer.Size() == 0) 00198 bapBuffer.Add(" "); 00199 */ 00200 return true; 00201 } 00202 00203 bool SSkeletonFap::InitializeDictionnary(int isHanim) 00204 { 00205 // TODO... 00206 /* if(hisDictionnaryInit) 00207 { 00208 return false; 00209 } 00210 00211 if(linkedEntity->GetSkeleton()!=0) 00212 { 00213 if(isHanim==0) 00214 { 00215 is_H_Anim = false ; 00216 // Bip01 00217 boneList[0]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00218 boneList[0]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00219 boneList[0]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00220 00221 // Bip01 Pelvis 00222 boneList[1]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00223 boneList[1]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00224 boneList[1]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00225 00226 // Bip01 Spine 00227 boneList[2]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00228 boneList[2]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00229 boneList[2]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00230 00231 // Bip01 Spine1 00232 boneList[3]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00233 boneList[3]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00234 boneList[3]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00235 00236 // Bip01 Spine2 00237 boneList[4]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00238 boneList[4]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00239 boneList[4]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00240 00241 // Bip01 Neck 00242 boneList[5]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00243 boneList[5]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00244 boneList[5]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00245 00246 // Bip01 Head 00247 boneList[6]->eulerBAPRef[0] = -62 ; //inactif à LOA1 00248 boneList[6]->eulerBAPRef[1] = 61 ; //inactif à LOA1 00249 boneList[6]->eulerBAPRef[2] = -60 ; //inactif à LOA1 00250 00251 // Bip01 L Clavicle 00252 boneList[7]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00253 boneList[7]->eulerBAPRef[1] = -26 ; //inactif à LOA1 00254 boneList[7]->eulerBAPRef[2] = 24 ; //inactif à LOA1 00255 00256 // Bip01 L UpperArm 00257 boneList[8]->eulerBAPRef[0] = -32 ; //inactif à LOA1 00258 boneList[8]->eulerBAPRef[1] = 36 ; //inactif à LOA1 00259 boneList[8]->eulerBAPRef[2] = 34 ; //inactif à LOA1 00260 00261 // Bip01 L Forearm 00262 boneList[9]->eulerBAPRef[0] = -38 ; //inactif à LOA1 00263 boneList[9]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00264 boneList[9]->eulerBAPRef[2] = 40 ; //inactif à LOA1 00265 00266 // Bip01 L Hand 00267 boneList[10]->eulerBAPRef[0] = 42 ; //inactif à LOA1 00268 boneList[10]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00269 boneList[10]->eulerBAPRef[2] = -44 ; //inactif à LOA1 00270 00271 // Bip01 L Finger0 00272 boneList[11]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00273 boneList[11]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00274 boneList[11]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00275 00276 // Bip01 L Finger01 00277 boneList[12]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00278 boneList[12]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00279 boneList[12]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00280 00281 // Bip01 L Finger1 00282 boneList[13]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00283 boneList[13]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00284 boneList[13]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00285 00286 // Bip01 L Finger11 00287 boneList[14]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00288 boneList[14]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00289 boneList[14]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00290 00291 // Bip01 L Finger2 00292 boneList[15]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00293 boneList[15]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00294 boneList[15]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00295 00296 // Bip01 L Finger21 00297 boneList[16]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00298 boneList[16]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00299 boneList[16]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00300 00301 // Bip01 L Finger3 00302 boneList[17]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00303 boneList[17]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00304 boneList[17]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00305 00306 // Bip01 L Finger31 00307 boneList[18]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00308 boneList[18]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00309 boneList[18]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00310 00311 // Bip01 L Finger4 00312 boneList[19]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00313 boneList[19]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00314 boneList[19]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00315 00316 // Bip01 L Finger41 00317 boneList[20]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00318 boneList[20]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00319 boneList[20]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00320 00321 // Bip01 R Clavicle 00322 boneList[21]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00323 boneList[21]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00324 boneList[21]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00325 00326 // Bip01 R UpperArm 00327 boneList[22]->eulerBAPRef[0] = -33 ; //inactif à LOA1 00328 boneList[22]->eulerBAPRef[1] = 37 ; //inactif à LOA1 00329 boneList[22]->eulerBAPRef[2] = 35 ; //inactif à LOA1 00330 00331 // Bip01 R Forearm 00332 boneList[23]->eulerBAPRef[0] = -39 ; //inactif à LOA1 00333 boneList[23]->eulerBAPRef[1] = 41 ; //inactif à LOA1 00334 boneList[23]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00335 00336 // Bip01 R Hand 00337 boneList[24]->eulerBAPRef[0] = -43 ; //inactif à LOA1 00338 boneList[24]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00339 boneList[24]->eulerBAPRef[2] = 45 ; //inactif à LOA1 00340 00341 // Bip01 R Finger0 00342 boneList[25]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00343 boneList[25]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00344 boneList[25]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00345 00346 // Bip01 R Finger01 00347 boneList[26]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00348 boneList[26]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00349 boneList[26]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00350 00351 // Bip01 R Finger1 00352 boneList[27]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00353 boneList[27]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00354 boneList[27]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00355 00356 // Bip01 R Finger11 00357 boneList[28]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00358 boneList[28]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00359 boneList[28]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00360 00361 // Bip01 R Finger2 00362 boneList[29]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00363 boneList[29]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00364 boneList[29]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00365 00366 // Bip01 R Finger21 00367 boneList[30]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00368 boneList[30]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00369 boneList[30]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00370 00371 // Bip01 R Finger3 00372 boneList[31]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00373 boneList[31]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00374 boneList[31]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00375 00376 // Bip01 R Finger31 00377 boneList[32]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00378 boneList[32]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00379 boneList[32]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00380 00381 // Bip01 R Finger4 00382 boneList[33]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00383 boneList[33]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00384 boneList[33]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00385 00386 // Bip01 R Finger41 00387 boneList[34]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00388 boneList[34]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00389 boneList[34]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00390 00391 // Bip01 L Thigh 00392 boneList[35]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00393 boneList[35]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00394 boneList[35]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00395 00396 // Bip01 L Calf 00397 boneList[36]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00398 boneList[36]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00399 boneList[36]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00400 00401 // Bip01 L Foot 00402 boneList[37]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00403 boneList[37]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00404 boneList[37]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00405 00406 // Bip01 L Toe0 00407 boneList[38]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00408 boneList[38]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00409 boneList[38]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00410 00411 // Bip01 R Thigh 00412 boneList[39]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00413 boneList[39]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00414 boneList[39]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00415 00416 // Bip01 R Calf 00417 boneList[40]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00418 boneList[40]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00419 boneList[40]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00420 00421 // Bip01 R Foot 00422 boneList[41]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00423 boneList[41]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00424 boneList[41]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00425 00426 // Bip01 R Toe0 00427 boneList[42]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00428 boneList[42]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00429 boneList[42]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00430 00431 } 00432 else if(isHanim==1) 00433 { 00434 is_H_Anim = true ; 00435 // Bip01 00436 boneList[0]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00437 boneList[0]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00438 boneList[0]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00439 00440 // Bip01_Head 00441 boneList[26]->eulerBAPRef[0] = -62 ; 00442 boneList[26]->eulerBAPRef[1] = 61 ; 00443 boneList[26]->eulerBAPRef[2] = -60 ; 00444 00445 // Bip01_L_Calf 00446 boneList[88]->eulerBAPRef[0] = 12 ; 00447 boneList[88]->eulerBAPRef[1] = -10 ; 00448 boneList[88]->eulerBAPRef[2] = 0 ; 00449 00450 // Bip01_L_Clavicle 00451 boneList[29]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00452 boneList[29]->eulerBAPRef[1] = -26; //-26; //inactif à LOA1 00453 boneList[29]->eulerBAPRef[2] = 24 ; //24 ; //inactif à LOA1 00454 00455 // Bip01_L_Finger0 00456 boneList[34]->eulerBAPRef[0] = 0 ;//175 00457 boneList[34]->eulerBAPRef[1] = 0 ;//173 00458 boneList[34]->eulerBAPRef[2] = 0 ;//171 00459 00460 // Bip01_L_Finger1 00461 boneList[38]->eulerBAPRef[0] = 0 ;//-151 00462 boneList[38]->eulerBAPRef[1] = 0 ;//-153 00463 boneList[38]->eulerBAPRef[2] = 0 ;//-149 00464 00465 // Bip01_L_Foot 00466 boneList[6]->eulerBAPRef[0] = 0 ;//16 00467 boneList[6]->eulerBAPRef[1] = 0 ;//-14 00468 boneList[6]->eulerBAPRef[2] = 0 ; 00469 00470 // Bip01_L_Forearm 00471 boneList[32]->eulerBAPRef[0] = 0 ;//-38 ; 00472 boneList[32]->eulerBAPRef[1] = -38 ;//0 ; 00473 boneList[32]->eulerBAPRef[2] = 40 ;//40 ; 00474 00475 // Bip01_L_Hand 00476 boneList[33]->eulerBAPRef[0] = 0 ;//42; 00477 boneList[33]->eulerBAPRef[1] = -44;//0; 00478 boneList[33]->eulerBAPRef[2] = -42;//-44; 00479 00480 // Bip01_L_Thigh 00481 boneList[9]->eulerBAPRef[0] = 0 ;//-8 00482 boneList[9]->eulerBAPRef[1] = 0 ;//4 00483 boneList[9]->eulerBAPRef[2] = 0 ;//6 00484 00485 // Bip01_L_Toe0 00486 boneList[10]->eulerBAPRef[0] = 0 ; 00487 boneList[10]->eulerBAPRef[1] = 0 ; 00488 boneList[10]->eulerBAPRef[2] = 0; 00489 00490 // Bip01_L_UpperArm 00491 00492 boneList[31]->eulerBAPRef[0] = 36 ;//??//-32; 00493 boneList[31]->eulerBAPRef[1] = -32 ;//36 ; 00494 boneList[31]->eulerBAPRef[2] = 34 ;//34 ; 00495 00496 // Bip01_Neck 00497 boneList[26]->eulerBAPRef[0] = 0; //inactif à LOA1 00498 boneList[26]->eulerBAPRef[1] = 0; //inactif à LOA1 00499 boneList[26]->eulerBAPRef[2] = 0; //inactif à LOA1 00500 00501 // Bip01_Pelvis 00502 boneList[13]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00503 boneList[13]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00504 boneList[13]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00505 00506 // Bip01_R_Calf 00507 boneList[14]->eulerBAPRef[0] = 0 ;//13 00508 boneList[14]->eulerBAPRef[1] = 0 ;//-11 00509 boneList[14]->eulerBAPRef[2] = 0 ;//0 00510 00511 // Bip01_R_Clavicle 00512 boneList[59]->eulerBAPRef[0] = 0 ; //inactif à LOA1 00513 boneList[59]->eulerBAPRef[1] = 0 ; //inactif à LOA1 00514 boneList[59]->eulerBAPRef[2] = 0 ; //inactif à LOA1 00515 00516 // Bip01_R_Finger0 00517 boneList[16]->eulerBAPRef[0] = 0 ;//176 00518 boneList[16]->eulerBAPRef[1] = 0 ;//174 00519 boneList[16]->eulerBAPRef[2] = 0 ;//172 00520 00521 // Bip01_R_Finger1 00522 boneList[17]->eulerBAPRef[0] = 0 ;//-152 00523 boneList[17]->eulerBAPRef[1] = 0 ;//-154 00524 boneList[17]->eulerBAPRef[2] = 0 ;//-150 00525 00526 // Bip01_R_Foot 00527 boneList[18]->eulerBAPRef[0] = 0 ;//17 00528 boneList[18]->eulerBAPRef[1] = 0 ;//-15 00529 boneList[18]->eulerBAPRef[2] = 0 ; 00530 00531 // Bip01_R_Forearm 00532 boneList[61]->eulerBAPRef[0] = -41 ;//-39 ; 00533 boneList[61]->eulerBAPRef[1] = -39 ;//41 ; 00534 boneList[61]->eulerBAPRef[2] = 0 ;//0 ; 00535 00536 // Bip01_R_Hand 00537 boneList[62]->eulerBAPRef[0] = 0 ;//-43 ; 00538 boneList[62]->eulerBAPRef[1] = -45 ;//0 ; 00539 boneList[62]->eulerBAPRef[2] = -43 ;//45 ; 00540 00541 // Bip01_R_Thigh 00542 boneList[21]->eulerBAPRef[0] = 0 ;//-7 00543 boneList[21]->eulerBAPRef[1] = 0 ;//-5 00544 boneList[21]->eulerBAPRef[2] = 0 ;//-9 00545 00546 // Bip01_R_Toe0 00547 boneList[22]->eulerBAPRef[0] = 0 ; 00548 boneList[22]->eulerBAPRef[1] = 0; 00549 boneList[22]->eulerBAPRef[2] = 0 ; 00550 00551 // Bip01_R_UpperArm 00552 boneList[60]->eulerBAPRef[0] = -37 ;//-33 ; 00553 boneList[60]->eulerBAPRef[1] = -33 ;//37 ; 00554 boneList[60]->eulerBAPRef[2] = 35 ;//35 ; 00555 00556 // Bip01_Spine 00557 boneList[24]->eulerBAPRef[0] = 0 ; 00558 boneList[24]->eulerBAPRef[1] = 0 ; 00559 boneList[24]->eulerBAPRef[2] = 0 ; 00560 00561 // Bip01_Spine1 00562 boneList[25]->eulerBAPRef[0] = 0 ;//67 00563 boneList[25]->eulerBAPRef[1] = 0 ;//68 00564 boneList[25]->eulerBAPRef[2] = 0;//-66 00565 } 00566 00567 int count = 0.0 ; 00568 int nb = 0 ; 00569 BapID.Clear() ; 00570 BapID.Empty() ; 00571 for(int k = 0;k<boneList.Size();k++) 00572 { 00573 for(int i=0;i<3;i++) 00574 { 00575 BapID.Add(boneList[k]->eulerBAPRef[i]) ; 00576 } 00577 } 00578 00579 // Init Pose + AnimTtrack 00580 if(!animBAP) 00581 { 00582 std::string animBAPName = "BAP_Animation_"; 00583 animBAPName+=linkedEntity->getOgreEntityPointer()->getName(); 00584 animBAP = new SAnim(animBAPName, SAnim::SO3_SKELETAL_ANIM); 00585 animBAP->setOgreAnimationPointer(getOgreSkeletonInstance()->createAnimation(animBAPName.c_str(),1)) ; 00586 animBAP->setAssociatedNodePointer(linkedEntity); 00587 00588 //scene->listOfAnim.Add(skel->animBAP) ; 00589 currentScene->listOfAnim.insert(SAnimMap::value_type(animBAP->getOgreAnimationPointer()->getName(), animBAP)); 00590 createAnim(m,animBAP, entity) ; 00591 entity->getOgreEntityPointer()->getMesh()->setSkeletonName(getOgreSkeletonInstance()->getName()) ; 00592 entity->getOgreEntityPointer()->refreshAvailableAnimationState() ; 00593 } 00594 00595 for(int i=0;i<boneList.Size();i++) 00596 { 00597 if(!animBAP->getOgreAnimationPointer()->hasNodeTrack(i)) 00598 { 00599 animBAP->getOgreAnimationPointer()->createNodeTrack(i,boneList[i]->getOgreBonePointer()) ; 00600 if(animBAP->getOgreAnimationPointer()->getNodeTrack(i)->getNumKeyFrames() == 0) 00601 { 00602 Ogre::TransformKeyFrame * key = getOgreSkeletonInstance()->getAnimation(0)->getNodeTrack(i)->createNodeKeyFrame(1.0) ; 00603 Ogre::Quaternion quat ; 00604 quat.IDENTITY ; 00605 key->setRotation(quat) ; 00606 } 00607 } 00608 else 00609 { 00610 animBAP->getOgreAnimationPointer()->getNodeTrack(i)->removeKeyFrame(0) ; 00611 Ogre::TransformKeyFrame * key = animBAP->getOgreAnimationPointer()->getNodeTrack(i)->createNodeKeyFrame(1.0) ; 00612 Ogre::Quaternion quat ; 00613 quat.IDENTITY ; 00614 key->setRotation(quat) ; 00615 } 00616 animBAP->getOgreAnimationPointer()->_keyFrameListChanged() ; 00617 boneList[i]->quatBAP = animBAP->getOgreAnimationPointer()->getNodeTrack(i)->getNodeKeyFrame(animBAP->getOgreAnimationPointer()->getNodeTrack(i)->getNumKeyFrames()-1)->getRotation() ; 00618 } 00619 } 00620 hisDictionnaryInit = true; 00621 return true;*/ 00622 return false; 00623 } 00624 00625 }
1.6.3