Axiom.Core.BillboardSet.UpdateBounds C# (CSharp) Method

UpdateBounds() public method

Update the bounds of the BillboardSet.
public UpdateBounds ( ) : void
return void
		public virtual void UpdateBounds()
		{
			if ( this.activeBillboards.Count == 0 )
			{
				// no billboards, so the bounding box is null
				this.aab.IsNull = true;
				this.boundingRadius = 0.0f;
			}
			else
			{
				float maxSqLen = -1.0f;
				Vector3 min = new Vector3( float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity );
				Vector3 max = new Vector3( float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity );

				foreach ( Billboard billboard in this.activeBillboards )
				{
					Vector3 pos = billboard.Position;
					min.Floor( pos );
					max.Ceil( pos );

					maxSqLen = Utility.Max( maxSqLen, pos.LengthSquared );
				}

				// adjust for billboard size
				float adjust = Utility.Max( this.defaultParticleWidth, this.defaultParticleHeight );
				Vector3 vecAdjust = new Vector3( adjust, adjust, adjust );
				min -= vecAdjust;
				max += vecAdjust;

				// update our local aabb
				this.aab.SetExtents( min, max );

				this.boundingRadius = Utility.Sqrt( maxSqLen );
			}
			// if we have a parent node, ask it to update us
			if ( this.parentNode != null )
			{
				this.parentNode.NeedUpdate();
			}
		}