Axiom.Core.Rectangle.Merge C# (CSharp) Method

Merge() public method

public Merge ( Rectangle rhs ) : Rectangle
rhs Rectangle
return Rectangle
		public Rectangle Merge( Rectangle rhs )
		{
			if ( Width == 0 )
			{
				this = rhs;
			}
			else
			{
				Left = System.Math.Min( Left, rhs.Left );
				Right = System.Math.Max( Right, rhs.Right );
				Top = System.Math.Min( Top, rhs.Top );
				Bottom = System.Math.Max( Bottom, rhs.Bottom );
			}

			return this;
		}

Usage Example

Beispiel #1
0
		public void HandleResponse( WorkQueue.Response res, WorkQueue srcq )
		{
			// Main thread
			var ddres = (DerivedDataResponse)res.Data;
			var ddreq = (DerivedDataRequest)res.Request.Data;

			// only deal with own requests
			if ( ddreq.Terrain != this )
			{
				return;
			}

			if ( ( ( ddreq.TypeMask & DERIVED_DATA_DELTAS ) == ddreq.TypeMask ) &&
				 ( ( ddres.RemainingTypeMask & DERIVED_DATA_DELTAS ) != DERIVED_DATA_DELTAS ) )
			{
				FinalizeHeightDeltas( ddres.DeltaUpdateRect, false );
			}
			if ( ( ( ddreq.TypeMask & DERIVED_DATA_NORMALS ) == ddreq.TypeMask ) &&
				 ( ( ddres.RemainingTypeMask & DERIVED_DATA_NORMALS ) != DERIVED_DATA_NORMALS ) )
			{
				FinalizeNormals( ddres.NormalUpdateRect, ddres.NormalMapBox );
				this.mCompositeMapDirtyRect.Merge( ddreq.DirtyRect );
			}
			if ( ( ( ddreq.TypeMask & DERIVED_DATA_LIGHTMAP ) == ddreq.TypeMask ) &&
				 ( ( ddres.RemainingTypeMask & DERIVED_DATA_LIGHTMAP ) != DERIVED_DATA_LIGHTMAP ) )
			{
				FinalizeLightMap( ddres.LightMapUpdateRect, ddres.LightMapPixelBox );
				this.mCompositeMapDirtyRect.Merge( ddreq.DirtyRect );
				this.mCompositeMapDirtyRectLightmapUpdate = true;
			}

			IsDerivedDataUpdateInProgress = false;

			// Re-trigger another request if there are still things to do, or if
			// we had a new request since this one
			var newRect = new Rectangle( 0, 0, 0, 0 );
			if ( ddres.RemainingTypeMask != 0 )
			{
				newRect.Merge( ddreq.DirtyRect );
			}

			if ( this.mDerivedUpdatePendingMask != 0 )
			{
				newRect.Merge( this.mDirtyDerivedDataRect );
				this.mDirtyDerivedDataRect.IsNull = true;
			}

			var newLightmapExtraRext = new Rectangle( 0, 0, 0, 0 );
			if ( ddres.RemainingTypeMask != 0 )
			{
				newLightmapExtraRext.Merge( ddreq.LightmapExtraDirtyRect );
			}
			if ( this.mDerivedUpdatePendingMask != 0 )
			{
				newLightmapExtraRext.Merge( this.mDirtyLightmapFromNeighboursRect );
				this.mDirtyLightmapFromNeighboursRect.IsNull = true;
			}
			var newMask = (byte)( ddres.RemainingTypeMask | this.mDerivedUpdatePendingMask );
			if ( newMask != 0 )
			{
				// trigger again
				UpdateDerivedDataImpl( newRect, newLightmapExtraRext, false, newMask );
			}
			else
			{
				// we've finished all the background processes
				// update the composite map if enabled
				if ( this.mCompositeMapRequired )
				{
					UpdateCompositeMap();
				}
			}
		}
All Usage Examples Of Axiom.Core.Rectangle::Merge