Axiom.Core.BillboardChain.UpdateBoundingBox C# (CSharp) Method

UpdateBoundingBox() protected method

protected UpdateBoundingBox ( ) : void
return void
		protected virtual void UpdateBoundingBox()
		{
			if ( this.boundsDirty )
			{
				this.aabb.IsNull = true;
				Vector3 widthVector;

				foreach ( ChainSegment segment in this.chainSegmentList )
				{
					if ( segment.head != SEGMENT_EMPTY )
					{
						for ( int i = segment.head; ; ++i )
						{
							// Wrap forwards
							if ( i == this.maxElementsPerChain )
							{
								i = 0;
							}

							Element element = this.chainElementList[ segment.start + i ];

							widthVector.x = widthVector.y = widthVector.z = element.Width;
							this.aabb.Merge( element.Position - widthVector );
							this.aabb.Merge( element.Position + widthVector );

							if ( i == segment.tail )
							{
								break;
							}
						}
					}
				}

				if ( this.aabb.IsNull )
				{
					this.radius = 0.0f;
				}
				else
				{
					this.radius = (float)Utility.Sqrt( Utility.Max( this.aabb.Minimum.LengthSquared, this.aabb.Maximum.LengthSquared ) );
				}
				this.boundsDirty = false;
			}
		}