public void UseAncestorVertexData( TerrainQuadTreeNode owner, int treeDepthEnd, int resolution ) { this.mNodeWithVertexData = owner; this.mVertexDataRecord = null; if ( !IsLeaf && treeDepthEnd > ( this.mDepth + 1 ) ) // treeDepthEnd is exclusive, and this is children { for ( int i = 0; i < 4; i++ ) { this.mChildren[ i ].UseAncestorVertexData( owner, treeDepthEnd, resolution ); } } }
protected override void dispose( bool disposeManagedResources ) { if ( !IsDisposed ) { if ( disposeManagedResources ) { if ( this.mMovable != null ) { if ( !this.mMovable.IsDisposed ) { this.mMovable.Dispose(); } this.mMovable = null; } if ( this.mRend != null ) { this.mRend = null; } if ( this.mLocalNode != null ) { this.mTerrain.RootSceneNode.RemoveAndDestroyChild( this.mLocalNode.Name ); this.mLocalNode = null; } for ( int i = 0; i < this.mChildren.Length; i++ ) { if ( this.mChildren[ i ] != null ) { this.mChildren[ i ].Dispose(); } } DestroyCpuVertexData(); DestroyGpuVertexData(); DestroyGpuIndexData(); if ( this.mLodLevels != null ) { this.mLodLevels.Clear(); this.mLodLevels = null; } this.mVertexDataRecord = null; } } base.dispose( disposeManagedResources ); }
public void AssignVertexData( ushort treeDepthStart, ushort treeDepthEnd, ushort resolution, ushort sz ) { Debug.Assert( treeDepthStart >= this.mDepth, "Should not be calling this" ); if ( this.mDepth == treeDepthStart ) { //we own this vertex data this.mNodeWithVertexData = this; this.mVertexDataRecord = new VertexDataRecord( resolution, sz, (ushort)( treeDepthEnd - treeDepthStart ) ); CreateCpuVertexData(); //pass on to children if ( !IsLeaf && treeDepthEnd > ( this.mDepth + 1 ) ) // treeDepthEnd is exclusive, and this is children { for ( int i = 0; i < 4; ++i ) { this.mChildren[ i ].UseAncestorVertexData( this, treeDepthEnd, resolution ); } } } else { Debug.Assert( !IsLeaf, "No more levels below this!" ); for ( int i = 0; i < 4; ++i ) { this.mChildren[ i ].AssignVertexData( treeDepthStart, treeDepthEnd, resolution, sz ); } } }