- Timestamp:
- May 6, 2005, 1:52:04 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc
r4080 r4082 18 18 19 19 #include <fstream> 20 #include <string> 20 21 21 22 #include "list.h" … … 165 166 */ 166 167 void MD2Loader::parseAnimations(t3DModel *pModel) 167 {} 168 { 169 tAnimationInfo* animationInfo = new tAnimationInfo; 170 string strLastName = ""; 171 172 /* the animation parse process looks a little bit weired: this is because there are no 173 fix bounds for the animation lengths, so the frames are destingushed using their names 174 which is normaly composed of <animationname><number> 175 */ 176 177 for(int i = 0; i < pModel->numOfObjects; i++) 178 { 179 string strName = this->pFrames[i].strName; 180 int frameNum = 0; 181 182 for(unsigned int j = 0; j < strName.length(); j++) 183 { 184 if( isdigit(strName[j]) && j >= strName.length() - 2) 185 { 186 frameNum = atoi(&strName[j]); 187 strName.erase(j, strName.length() - j); 188 break; 189 } 190 } 191 192 /* animations are sorted through their names: this is how its been done: */ 193 if(strName != strLastName || i == pModel->numOfObjects - 1) 194 { 195 if(strLastName != "") 196 { 197 strcpy(animationInfo->strName, strLastName.c_str()); 198 animationInfo->endFrame = i; 199 pModel->animationList->add(animationInfo); 200 memset(&animationInfo, 0, sizeof(tAnimationInfo)); 201 pModel->numOfAnimations++; 202 } 203 animationInfo->startFrame = frameNum - 1 + i; 204 } 205 strLastName = strName; 206 } 207 } 168 208 169 209 /**
Note: See TracChangeset
for help on using the changeset viewer.