Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8536 in orxonox.OLD


Ignore:
Timestamp:
Jun 16, 2006, 4:01:25 PM (18 years ago)
Author:
patrick
Message:

bsp: md3 sex gets read correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_animation_cfg.cc

    r8535 r8536  
    8989    while( (read = getline(&cLine, &len, pFile)) != -1) { /*( !this->dataStream.eof()) {*/
    9090      std::string line(cLine);
     91
     92      PRINTF(0)("size = %i, line = |%s|\n", read, line.c_str());
    9193
    9294      //ignore empty lines and comments
     
    98100          Tokenizer::tokenize(line, tokens, " \t\n\r\f/");
    99101
    100           PRINTF(0)("size = %i, line = |%s|\n", read, line.c_str());
    101 
    102           while( !tokens.empty())
    103           {
    104             PRINTF(0)("tokens: %s\n", tokens.back().c_str());
    105             tokens.pop_back();
     102          std::string sexStr = tokens.back();
     103          // probably error in the file format
     104          if( sexStr.length() != 1) {
     105            this->sex = '?';
     106            PRINTF(2)("no section \"sex\" in the config file %s found\n", filename.c_str());
    106107          }
    107 
     108          else {
     109            this->sex = sexStr[0];
     110          }
     111
     112          PRINTF(0)("sex of the md3 model: %c\n", this->sex);
    108113        }
     114        else if (inHeader && line.find("headoffset") == 0) {
     115          // parse line: headoffset X Y Z
     116          std::vector<std::string> tokens;
     117          Tokenizer::tokenize(line, tokens, " \t\n\r\f/");
     118
     119          //           while( !tokens.empty())
     120//           {
     121//             PRINTF(0)("tokens: %s\n", tokens.back().c_str());
     122//             tokens.pop_back();
     123//           }
     124
     125//           newAnimCfg.headOffset=
     126//               new md3.util.Vec3(new Float(st.nextToken()).floatValue(),
     127//                                 new Float(st.nextToken()).floatValue(),
     128//                                 new Float(st.nextToken()).floatValue());
     129         }
    109130      }
    110131    }
    111 /*
    112           st.nextToken(); //throw away first token
    113           String sexStr=st.nextToken();
    114           if (sexStr.length()!=1)
    115             //non-fatal error, don't thow exception
    116             newAnimCfg.sex='?';
    117           else
    118             newAnimCfg.sex=sexStr.charAt(0);
    119         }
    120         else if (IN_HEADER && line.startsWith("headoffset")) {
    121                                         //parse line: headoffset X Y Z
    122           StringTokenizer st=new StringTokenizer(line, " \t\n\r\f/");
    123 
    124           st.nextToken(); //throw away first token
    125 
    126           newAnimCfg.headOffset=
    127               new md3.util.Vec3(new Float(st.nextToken()).floatValue(),
    128                                 new Float(st.nextToken()).floatValue(),
    129                                 new Float(st.nextToken()).floatValue());
    130         }
     132    /*
    131133        else if (IN_HEADER && line.startsWith("footsteps")) {
    132134                                        //parse line: footsteps [normal | mech | ...]
Note: See TracChangeset for help on using the changeset viewer.