Changeset 5014 in orxonox.OLD for orxonox/trunk/src/lib/graphics
- Timestamp:
- Aug 14, 2005, 4:29:29 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/objModel.cc
r4836 r5014 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 64 64 { 65 65 PRINTF(4)("preparing to read in file: %s\n", fileName); 66 // splitting the 66 // splitting the 67 67 char* split = NULL; 68 68 … … 103 103 // line termiated with \0 not \n 104 104 if (buffer[strlen(buffer)-1] == '\n') 105 105 buffer[strlen(buffer)-1] = '\0'; 106 106 107 107 // case vertice 108 108 if (!strncmp(buffer, "v ", 2)) 109 110 111 109 { 110 this->addVertex(buffer+2); 111 } 112 112 113 113 // case face 114 114 else if (!strncmp(buffer, "f ", 2)) 115 116 117 118 115 { 116 this->addFace (buffer+2); 117 } 118 119 119 else if (!strncmp(buffer, "mtllib ", 7)) 120 121 122 120 { 121 this->readMtlLib (buffer+7); 122 } 123 123 124 124 else if (!strncmp(buffer, "usemtl ", 7)) 125 126 127 125 { 126 this->setMaterial (buffer+7); 127 } 128 128 129 129 // case VertexNormal 130 130 else if (!strncmp(buffer, "vn ", 3)) 131 132 133 134 131 { 132 this->addVertexNormal(buffer+3); 133 } 134 135 135 // case VertexTextureCoordinate 136 136 else if (!strncmp(buffer, "vt ", 3)) 137 138 139 137 { 138 this->addVertexTexture(buffer+3); 139 } 140 140 // case group 141 141 else if (!strncmp(buffer, "g ", 2)) 142 143 144 142 { 143 this->addGroup (buffer+2); 144 } 145 145 else if (!strncmp(buffer, "s ", 2)) //! @todo smoothing groups have to be implemented 146 147 148 146 { 147 PRINTF(2)("smoothing groups not supportet yet. line: %s\n", buffer); 148 } 149 149 } 150 150 fclose (stream); … … 152 152 } 153 153 154 /** 154 /** 155 155 * Function to read in a mtl File. 156 156 * @param mtlFile The .mtl file to read … … 183 183 // line termiated with \0 not \n 184 184 if (buffer[strlen(buffer)-1] == '\n') 185 185 buffer[strlen(buffer)-1] = '\0'; 186 186 187 187 // create new Material 188 188 if (!strncmp(buffer, "newmtl ", 7)) 189 190 191 189 { 190 tmpMat = this->addMaterial(buffer+7);//tmpMat->addMaterial(buffer+7); 191 } 192 192 // setting a illumMode 193 193 else if (!strncmp(buffer, "illum ", 6)) 194 195 196 197 198 194 { 195 if (likely(tmpMat != NULL)) 196 tmpMat->setIllum(buffer+6); 197 198 } 199 199 // setting Diffuse Color 200 200 else if (!strncmp(buffer, "Kd ", 3)) 201 202 203 204 201 { 202 if (likely(tmpMat != NULL)) 203 tmpMat->setDiffuse(buffer+3); 204 } 205 205 // setting Ambient Color 206 206 else if (!strncmp(buffer, "Ka ", 3)) 207 208 209 210 207 { 208 if (likely(tmpMat != NULL)) 209 tmpMat->setAmbient(buffer+3); 210 } 211 211 // setting Specular Color 212 212 else if (!strncmp(buffer, "Ks ", 3)) 213 214 215 216 213 { 214 if (likely(tmpMat != NULL)) 215 tmpMat->setSpecular(buffer+3); 216 } 217 217 // setting The Specular Shininess 218 218 else if (!strncmp(buffer, "Ns ", 3)) 219 220 221 222 219 { 220 if (likely(tmpMat != NULL)) 221 tmpMat->setShininess(buffer+3); 222 } 223 223 // setting up transparency 224 224 else if (!strncmp(buffer, "d ", 2)) 225 226 227 228 225 { 226 if (likely(tmpMat != NULL)) 227 tmpMat->setTransparency(buffer+2); 228 } 229 229 else if (!strncmp(buffer, "Tf ", 3)) 230 231 232 233 234 230 { 231 if (likely(tmpMat != NULL)) 232 tmpMat->setTransparency(buffer+3); 233 } 234 235 235 else if (!strncmp(buffer, "map_Kd ", 7)) 236 237 238 239 236 { 237 if (likely(tmpMat != NULL)) 238 tmpMat->setDiffuseMap(buffer+7); 239 } 240 240 else if (!strncmp(buffer, "map_Ka ", 7)) 241 242 243 244 241 { 242 if (likely(tmpMat != NULL)) 243 tmpMat->setAmbientMap(buffer+7); 244 } 245 245 else if (!strncmp(buffer, "map_Ks ", 7)) 246 247 248 249 246 { 247 if (likely(tmpMat != NULL)) 248 tmpMat->setSpecularMap(buffer+7); 249 } 250 250 else if (!strncmp(buffer, "bump ", 5)) 251 252 253 254 255 251 { 252 if (likely(tmpMat != NULL)) 253 tmpMat->setBump(buffer+7); 254 } 255 256 256 257 257 }
Note: See TracChangeset
for help on using the changeset viewer.