| 633 | } |
| 634 | |
| 635 | void TerrainBlock::updateGrid( const Point2I &minPt, const Point2I &maxPt, bool updateClient ) |
| 636 | { |
| 637 | // On the client we just signal everyone that the height |
| 638 | // map has changed... the server does the actual changes. |
| 639 | if ( isClientObject() ) |
| 640 | { |
| 641 | PROFILE_SCOPE( TerrainBlock_updateGrid_Client ); |
| 642 | |
| 643 | // This depends on the client getting this call 'after' the server. |
| 644 | // Which is currently the case. |
| 645 | _updateBounds(); |
| 646 | mZoningDirty = true; |
| 647 | |
| 648 | smUpdateSignal.trigger( HeightmapUpdate, this, minPt, maxPt ); |
| 649 | |
| 650 | // Tell the terrain cell that the height changed. |
| 651 | const RectI gridRect( minPt, maxPt - minPt ); |
| 652 | mCell->updateGrid( gridRect ); |
| 653 | |
| 654 | // Rebuild the physics representation. |
| 655 | if ( mPhysicsRep ) |
| 656 | { |
| 657 | // Delay the update by a few milliseconds so |
| 658 | // that we're not rebuilding during an active |
| 659 | // editing operation. |
| 660 | mPhysicsRep->queueCallback( 500, Delegate<void()>( this, &TerrainBlock::_updatePhysics ) ); |
| 661 | } |
| 662 | |
| 663 | return; |
| 664 | } |
| 665 | |
| 666 | // Now on the server we rebuild the |
| 667 | // affected area of the grid map. |
| 668 | mFile->updateGrid( minPt, maxPt ); |
| 669 | |
| 670 | // Fix up the bounds. |
| 671 | _updateBounds(); |
| 672 | |
| 673 | // Rebuild the physics representation. |
| 674 | if ( mPhysicsRep ) |
| 675 | { |
| 676 | // Delay the update by a few milliseconds so |
| 677 | // that we're not rebuilding during an active |
| 678 | // editing operation. |
| 679 | mPhysicsRep->queueCallback( 500, Delegate<void()>( this, &TerrainBlock::_updatePhysics ) ); |
| 680 | } |
| 681 | |
| 682 | // Signal again here for any server side observers. |
| 683 | smUpdateSignal.trigger( HeightmapUpdate, this, minPt, maxPt ); |
| 684 | |
| 685 | // If this is a server object and the client update |
| 686 | // was requested then try to use the local connection |
| 687 | // pointer to do it. |
| 688 | if ( updateClient && getClientObject() ) |
| 689 | ((TerrainBlock*)getClientObject())->updateGrid( minPt, maxPt, false ); |
| 690 | } |
| 691 | |
| 692 | bool TerrainBlock::getHeight( const Point2F &pos, F32 *height ) const |
no test coverage detected