Axiom.Core.PatchMesh.Define C# (CSharp) Method

Define() public method

public Define ( Array controlPointArray, Axiom.Graphics.VertexDeclaration declaration, int width, int height, int uMaxSubdivisionLevel, int vMaxSubdivisionLevel, VisibleSide visibleSide, BufferUsage vbUsage, BufferUsage ibUsage, bool vbUseShadow, bool ibUseShadow ) : void
controlPointArray System.Array
declaration Axiom.Graphics.VertexDeclaration
width int
height int
uMaxSubdivisionLevel int
vMaxSubdivisionLevel int
visibleSide VisibleSide
vbUsage BufferUsage
ibUsage BufferUsage
vbUseShadow bool
ibUseShadow bool
return void
		public void Define( Array controlPointArray, VertexDeclaration declaration,
			int width, int height, int uMaxSubdivisionLevel, int vMaxSubdivisionLevel, VisibleSide visibleSide,
							BufferUsage vbUsage, BufferUsage ibUsage, bool vbUseShadow, bool ibUseShadow )
		{

			VertexBufferUsage = vbUsage;
			UseVertexShadowBuffer = vbUseShadow;
			IndexBufferUsage = ibUsage;
			UseIndexShadowBuffer = ibUseShadow;

			// Init patch builder
			// define the surface
			// NB clone the declaration to make it independent
			vertexDeclaration = (VertexDeclaration)declaration.Clone();
			patchSurface.DefineSurface( controlPointArray, vertexDeclaration, width, height,
				PatchSurfaceType.Bezier, uMaxSubdivisionLevel, vMaxSubdivisionLevel, visibleSide );
		}

Usage Example

Beispiel #1
0
		/// <summary>
		///     Creates a Bezier patch based on an array of control vertices.
		/// </summary>
		public PatchMesh CreateBezierPatch( string name, string group, Array controlPointBuffer, VertexDeclaration declaration,
			int width, int height, int uMaxSubdivisionLevel, int vMaxSubdivisionLevel, VisibleSide visibleSide,
			BufferUsage vbUsage, BufferUsage ibUsage, bool vbUseShadow, bool ibUseShadow )
		{
			if ( width < 3 || height < 3 )
			{
				throw new Exception( "Bezier patch requires at least 3x3 control points." );
			}
			PatchMesh mesh = (PatchMesh)this[ name ];

			if ( mesh != null )
			{
				throw new AxiomException( "A mesh with the name {0} already exists!", name );
			}

			mesh = new PatchMesh( this, name, nextHandle, group );

			mesh.Define( controlPointBuffer, declaration, width, height, uMaxSubdivisionLevel, vMaxSubdivisionLevel, visibleSide, vbUsage, ibUsage, vbUseShadow, ibUseShadow );

			mesh.Load();

			_add( mesh );

			return mesh;
		}