Changeset 891 for GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshSaver.cpp
- Timestamp:
- 05/04/06 12:56:05 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshSaver.cpp
r826 r891 194 194 unsigned long indexCount; 195 195 String materialName; 196 Index *index; 197 Index *indexBegin; 198 Index *indexEnd; 196 199 197 200 // Debug. … … 219 222 indexCount = geoSubMesh->mIndexCount; 220 223 224 // If the submesh is in triangle strips. 225 if (geoSubMesh->mType == GEO_TRIANGLE_STRIPS) 226 { 227 indexCount += 2 * geoSubMesh->mStripCount - 2; 228 } 229 221 230 writeInts(indexCount, 1); 222 231 … … 229 238 << endl; 230 239 231 // Write the index array. 232 for (int i = 0; i < geoSubMesh->mIndexCount; i++) 233 { 234 writeInts(geoSubMesh->mIndex[i], 1); 240 // If the submesh is in triangle strips. 241 if (geoSubMesh->mType == GEO_TRIANGLE_STRIPS) 242 { 243 // Debug. 244 cout << "Write triangle strips" 245 << endl; 246 247 // For each one of the strips. 248 for (int strip = 0; strip < geoSubMesh->mStripCount; strip++) 249 { 250 // First index of the strip. 251 indexBegin = geoSubMesh->mStrip[strip]; 252 253 // If is the final strip 254 if (strip == (geoSubMesh->mStripCount - 1)) 255 { 256 // The end of the index array. 257 indexEnd = &geoSubMesh->mIndex[geoSubMesh->mIndexCount]; 258 } 259 else 260 { 261 // The beginning of the next strip. 262 indexEnd = geoSubMesh->mStrip[strip + 1]; 263 } 264 265 int i; 266 i = 0; 267 268 if (strip != 0) 269 { 270 writeInts(indexBegin[i], 1); 271 } 272 273 // For each index of the strip. 274 for (index = indexBegin; index < indexEnd; index++) 275 { 276 writeInts(indexBegin[i], 1); 277 278 // Increments i. 279 i++; 280 } 281 282 if (strip != (geoSubMesh->mStripCount - 1)) 283 { 284 writeInts(indexBegin[i - 1], 1); 285 } 286 287 } 288 } 289 // If the submesh is in triangle list. 290 else 291 { 292 // Write the index array. 293 for (int i = 0; i < geoSubMesh->mIndexCount; i++) 294 { 295 writeInts(geoSubMesh->mIndex[i], 1); 296 } 235 297 } 236 298
Note: See TracChangeset
for help on using the changeset viewer.