Changeset 8546 in orxonox.OLD for branches/bsp_model/src/lib/graphics
- Timestamp:
- Jun 16, 2006, 6:03:42 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/md3/md3_animation_cfg.cc
r8545 r8546 73 73 74 74 75 //this->dataStream.open(filename.c_str());76 75 FILE* pFile; 77 76 char* cLine; … … 88 87 89 88 // parse file 90 // this->dataStream.getline(buffer, 1024, '\n');91 // std::string line(buffer);92 89 while( (read = getline(&cLine, &len, pFile)) != -1) { /*( !this->dataStream.eof()) {*/ 93 90 std::string line(cLine); 94 91 95 PRINTF(0)("size = %i, line = |%s|\n", read, line.c_str());92 // PRINTF(0)("size = %i, line = |%s|\n", read, line.c_str()); 96 93 97 94 //ignore empty lines and comments 98 if( line != "" && line.find("//") != 0) { 99 // find the sex section 95 if( line.length() > 2 && line.find("//") != 0) { 96 97 // find the gender section 100 98 if( inHeader && line.find("sex") == 0) { 101 99 //parse line: sex [m | f | ...] … … 115 113 PRINTF(0)("sex of the md3 model: %c\n", this->sex); 116 114 } 117 else if (inHeader && line.find("headoffset") == 0) {115 else if( inHeader && line.find("headoffset") == 0) { 118 116 // parse line: headoffset X Y Z 119 117 std::vector<std::string> tokens; … … 128 126 PRINTF(0)("got head offset: %f, %f, %f\n", x, y, z); 129 127 } 130 else if (inHeader && line.find("footsteps") == 0) {128 else if( inHeader && line.find("footsteps") == 0) { 131 129 //parse line: footsteps [normal | mech | ...] 132 130 std::vector<std::string> tokens; … … 153 151 this->loadAnimation(animation, line); 154 152 155 animation->name = MD3Animation::animationList[i].animationName; 156 animation->type = MD3Animation::animationList[i].animationType; 153 if( i < 25) 154 { 155 animation->name = MD3Animation::animationList[i].animationName; 156 animation->type = MD3Animation::animationList[i++].animationType; 157 } 157 158 158 159 // workaround for strange numbering in animation.cfg: skip TORSO frames … … 187 188 Tokenizer::tokenize(line, tokens, " \t\n\r\f/"); 188 189 189 190 while( !tokens.empty()) 190 /* while( !tokens.empty()) 191 191 { 192 PRINTF( 0)("tokens: %s\n", tokens.back().c_str());192 PRINTF(5)("token: %s\n", tokens.back().c_str()); 193 193 tokens.pop_back(); 194 } 195 } 196 // //parse line: 197 // //first frame, num frames, looping frames, frames per second 198 // try { 199 // StringTokenizer st=new StringTokenizer(line, " \t\n\r\f/"); 200 // 201 // newAnimation.first=new Integer(st.nextToken()).intValue(); 202 // newAnimation.num=new Integer(st.nextToken()).intValue(); 203 // newAnimation.looping=new Integer(st.nextToken()).intValue(); 204 // newAnimation.fps=new Integer(st.nextToken()).intValue(); 205 // } catch (Exception e) { 206 // throw new IOException("corrupt animation line"); 207 // } 194 }*/ 195 anim->fps = atoi(tokens.back().c_str()); tokens.pop_back(); 196 anim->numLoopFrames = atoi(tokens.back().c_str()); tokens.pop_back(); 197 anim->numFrames = atoi(tokens.back().c_str()); tokens.pop_back(); 198 anim->first = atoi(tokens.back().c_str()); tokens.pop_back(); 199 200 PRINTF(0)("Animation: first frame: %i, num frames: %i, num loops: %i, fps: %i\n", anim->first, anim->numFrames, anim->numLoopFrames, anim->fps); 201 } 208 202 209 203
Note: See TracChangeset
for help on using the changeset viewer.