Axiom.Core.PatchSurface.GetAutoULevel C# (CSharp) Method

GetAutoULevel() protected method

protected GetAutoULevel ( bool forMax ) : int
forMax bool
return int
		protected int GetAutoULevel( bool forMax )
		{
			// determine levels
			// Derived from work by Bart Sekura in Rogl
			Vector3 a = Vector3.Zero;
			Vector3 b = Vector3.Zero;
			Vector3 c = Vector3.Zero;

			bool found = false;

			// Find u level
			for ( int v = 0; v < controlHeight; v++ )
			{
				for ( int u = 0; u < controlWidth - 1; u += 2 )
				{
					a = controlPoints[ v * controlWidth + u + 0 ];
					b = controlPoints[ v * controlWidth + u + 1 ];
					c = controlPoints[ v * controlWidth + u + 2 ];

					if ( a != c )
					{
						found = true;
						break;
					}
				}
				if ( found )
				{
					break;
				}
			}

			if ( !found )
			{
				throw new AxiomException( "Can't find suitable control points for determining U subdivision level" );
			}

			return FindLevel( ref a, ref b, ref c );
		}

Same methods

PatchSurface::GetAutoULevel ( ) : int