| 1373 | } |
| 1374 | |
| 1375 | void TerrainBlock::unpackUpdate(NetConnection* con, BitStream *stream) |
| 1376 | { |
| 1377 | Parent::unpackUpdate( con, stream ); |
| 1378 | |
| 1379 | if ( stream->readFlag() ) // TransformMask |
| 1380 | { |
| 1381 | MatrixF mat; |
| 1382 | mathRead( *stream, &mat ); |
| 1383 | setTransform( mat ); |
| 1384 | } |
| 1385 | |
| 1386 | |
| 1387 | if ( stream->readFlag() ) // SizeMask |
| 1388 | stream->read( &mSquareSize ); |
| 1389 | |
| 1390 | mCastShadows = stream->readFlag(); |
| 1391 | |
| 1392 | bool baseTexSizeChanged = false; |
| 1393 | if ( stream->readFlag() ) // MaterialMask |
| 1394 | { |
| 1395 | U32 baseTexSize; |
| 1396 | stream->read( &baseTexSize ); |
| 1397 | if ( mBaseTexSize != baseTexSize ) |
| 1398 | { |
| 1399 | mBaseTexSize = baseTexSize; |
| 1400 | baseTexSizeChanged = true; |
| 1401 | } |
| 1402 | |
| 1403 | U32 lightMapSize; |
| 1404 | stream->read( &lightMapSize ); |
| 1405 | if ( mLightMapSize != lightMapSize ) |
| 1406 | { |
| 1407 | mLightMapSize = lightMapSize; |
| 1408 | if ( isProperlyAdded() ) |
| 1409 | { |
| 1410 | SAFE_DELETE( mLightMap ); |
| 1411 | clearLightMap(); |
| 1412 | } |
| 1413 | } |
| 1414 | } |
| 1415 | |
| 1416 | if (stream->readFlag()) // FileMask |
| 1417 | { |
| 1418 | stream->read(&mCRC); |
| 1419 | |
| 1420 | char buffer[256]; |
| 1421 | stream->readString(buffer); |
| 1422 | setTerrainAsset(StringTable->insert(buffer)); |
| 1423 | } |
| 1424 | if (baseTexSizeChanged && isProperlyAdded()) |
| 1425 | _updateBaseTexture(NONE); |
| 1426 | |
| 1427 | if ( stream->readFlag() && isProperlyAdded() ) // HeightMapChangeMask |
| 1428 | { |
| 1429 | _updateBounds(); |
| 1430 | _rebuildQuadtree(); |
| 1431 | _updatePhysics(); |
| 1432 | mDetailsDirty = true; |