Changeset 8541 in orxonox.OLD for branches/bsp_model
- Timestamp:
- Jun 16, 2006, 5:05:37 PM (19 years ago)
- Location:
- branches/bsp_model/src/lib/graphics/importer/md3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/md3/md3_animation.h
r8526 r8541 11 11 #include <string> 12 12 13 namespace md3 14 { 13 15 14 16 typedef enum MD3AnimationType { … … 43 45 void init(); 44 46 45 std::string toString() 46 { 47 return std::string("Name: " + this->name); 48 } 47 std::string toString() { return std::string("Name: " + this->name); } 49 48 50 49 … … 62 61 }; 63 62 64 63 } 65 64 #endif /* _MD3_ANIMATION_H */ -
branches/bsp_model/src/lib/graphics/importer/md3/md3_animation_cfg.cc
r8537 r8541 17 17 #include "md3_animation_cfg.h" 18 18 19 #include "md3_animation.h" 20 19 21 #include "tokenizer.h" 22 #include "helper_functions.h" 20 23 21 24 #include "debug.h" … … 23 26 #include <stdio.h> 24 27 #include <stdlib.h> 28 25 29 26 30 using namespace std; … … 67 71 int firstTorsoFrame = -1; //!< first of the TORSO animation frames 68 72 bool inHeader = true; //!< are we still in the header of the .cfg file? 69 char buffer[1024]; //!< buffer to write stuff into70 73 71 74 … … 130 133 Tokenizer::tokenize(line, tokens, " \t\n\r\f/"); 131 134 132 // newAnimCfg.footsteps=st.nextToken().trim();133 135 this->footsteps = tokens.back(); 136 // std::transform(this->footsteps.begin(), this->footsteps.end(), this->footsteps.begin(), std::tolower); 134 137 135 138 while( !tokens.empty()) … … 139 142 } 140 143 141 142 /* if (!(newAnimCfg.footsteps.toLowerCase().equals("default") || 143 newAnimCfg.footsteps.toLowerCase().equals("normal") || 144 newAnimCfg.footsteps.toLowerCase().equals("boot") || 145 newAnimCfg.footsteps.toLowerCase().equals("flesh") || 146 newAnimCfg.footsteps.toLowerCase().equals("mech") || 147 newAnimCfg.footsteps.toLowerCase().equals("energy") 148 ))*/ 149 //don't throw an exception, non-fatal error 150 // newAnimCfg.footsteps="illegal footsteps value (" + newAnimCfg.footsteps + ")"; 144 //check if value is ok 145 if (!(nocaseCmp(this->footsteps, "default") || 146 nocaseCmp(this->footsteps, "normal") || 147 nocaseCmp(this->footsteps, "boot") || 148 nocaseCmp(this->footsteps, "flesh") || 149 nocaseCmp(this->footsteps, "mech") || 150 nocaseCmp(this->footsteps, "energy")) ) { 151 this->footsteps="illegal footsteps value (" + this->footsteps + ")"; 152 } 153 PRINTF(0)("got footsteps: %s\n", this->footsteps.c_str()); 154 } 155 else { 156 // assume it's an animation line 157 inHeader = false; 158 159 MD3Animation* animation = new MD3Animation(line); 160 161 animation->name = MD3Animation::animationList[i].animationName; 162 animation->type = MD3Animation::animationList[i].animationType; 163 164 // workaround for strange numbering in animation.cfg: skip TORSO frames 165 // for LEGS animation lines... 166 if (animation->type == LEGS) { 167 //when first LEGS animation is found, calc # of TORSO frames 168 if( torsoOffset == -1) 169 torsoOffset = animation->first - firstTorsoFrame; 170 171 animation->first -= torsoOffset; 172 animation->offset = torsoOffset; 173 } 174 else if (animation->type == TORSO) 175 if( firstTorsoFrame == -1) 176 firstTorsoFrame = animation->first; 177 178 179 //newAnimCfg.putAnimation(animation); 151 180 } 152 181 } 182 183 153 184 } 154 /* 155 else { 156 //assume it's an animation line 157 IN_HEADER=false; //no longer in header 158 159 MD3Animation animation=MD3ModelFactory.getFactory().makeMD3Animation(line); 160 161 animation.name=animationNames[i]; 162 animation.type=animationTypes[i++]; 163 164 //workaround for strange numbering in animation.cfg: skip TORSO frames 165 //for LEGS animation lines... 166 if (animation.type==AnimationType.LEGS) { 167 //when first LEGS animation is found, calc # of TORSO frames 168 if (TORSO_OFFSET==-1) 169 TORSO_OFFSET=animation.first-firstTORSOFrame; 170 171 animation.first-=TORSO_OFFSET; 172 animation.offset=TORSO_OFFSET; 173 } 174 else if (animation.type==AnimationType.TORSO) 175 if (firstTORSOFrame==-1) 176 firstTORSOFrame=animation.first; 177 178 newAnimCfg.putAnimation(animation); 179 } 180 } 181 182 line=bin.readLine(); 183 } 184 catch (Exception e) { 185 throw new IOException(e.getMessage()); 186 }*/ 187 188 } 189 190 191 192 /** 193 * <p>Look up the animation data for the animation with the specified name. 185 186 } 187 188 189 190 /** 191 * Look up the animation data for the animation with the specified name. 194 192 * 195 193 * @param name Name of the animation. 196 194 * @return The animation data associated with the name or null if no data was found. 197 195 */ 198 MD3Animation* getAnimation(std::string name)196 MD3Animation* MD3AnimationCfg::getAnimation(std::string name) 199 197 { 200 198 // return (MD3Animation)animations.get(name); 201 199 } 200 201 202 /** 203 * Add the specified animation to the list of known animations. 204 */ 205 void MD3AnimationCfg::putAnimation(MD3Animation* anim) 206 { 207 // animations.put(anim.name, anim); 208 } 209 202 210 203 211 } -
branches/bsp_model/src/lib/graphics/importer/md3/md3_animation_cfg.h
r8533 r8541 37 37 void loadConfig(std::string filename); 38 38 39 MD3Animation* getAnimation(std::string name); 40 void putAnimation(MD3Animation* animation); 41 39 42 std::string toString() { return std::string("Name: " + this->filename); } 40 43
Note: See TracChangeset
for help on using the changeset viewer.