| 330 | } |
| 331 | |
| 332 | void TerrainFile::_load( FileStream &stream ) |
| 333 | { |
| 334 | // NOTE: We read using a loop instad of in one large chunk |
| 335 | // because the stream will do endian conversions for us when |
| 336 | // reading one type at a time. |
| 337 | |
| 338 | stream.read( &mSize ); |
| 339 | |
| 340 | // Load the heightmap. |
| 341 | mHeightMap.setSize( mSize * mSize ); |
| 342 | for ( U32 i=0; i < mHeightMap.size(); i++ ) |
| 343 | stream.read( &mHeightMap[i] ); |
| 344 | |
| 345 | // Load the layer index map. |
| 346 | mLayerMap.setSize( mSize * mSize ); |
| 347 | for ( U32 i=0; i < mLayerMap.size(); i++ ) |
| 348 | stream.read( &mLayerMap[i] ); |
| 349 | |
| 350 | // Get the material name count. |
| 351 | U32 materialCount; |
| 352 | stream.read( &materialCount ); |
| 353 | Vector<String> materials; |
| 354 | materials.setSize( materialCount ); |
| 355 | |
| 356 | // Load the material names. |
| 357 | for ( U32 i=0; i < materialCount; i++ ) |
| 358 | stream.read( &materials[i] ); |
| 359 | |
| 360 | // Resolve the TerrainMaterial objects from the names. |
| 361 | _resolveMaterials( materials ); |
| 362 | } |
| 363 | |
| 364 | void TerrainFile::_loadLegacy( FileStream &stream ) |
| 365 | { |