Axiom.SceneManagers.Bsp.BspLevel.InitQuake3Patches C# (CSharp) Method

InitQuake3Patches() public method

public InitQuake3Patches ( Quake3Level q3lvl, Axiom.Graphics.VertexDeclaration decl ) : void
q3lvl Quake3Level
decl Axiom.Graphics.VertexDeclaration
return void
		public void InitQuake3Patches( Quake3Level q3lvl, VertexDeclaration decl )
		{
			int face;

			patchVertexCount = 0;
			patchIndexCount = 0;

			// We're just building the patch here to get a hold on the size of the mesh
			// although we'll reuse this information later
			face = q3lvl.NumFaces;

			while ( face-- > 0 )
			{
				InternalBspFace src = q3lvl.Faces[ face ];

				if ( src.type == BspFaceType.Patch )
				{
					// Seems to be some crap in the Q3 level where vertex count = 0 or num control points = 0?
					if ( ( src.vertCount == 0 ) || ( src.meshCtrl[ 0 ] == 0 ) )
						continue;

					PatchSurface ps = new PatchSurface();

					// Set up control points & format.
					// Reuse the vertex declaration.
					// Copy control points into a buffer so we can convert their format.
					BspVertex[] controlPoints = new BspVertex[ src.vertCount ];
					TextureLightMap texLightMap;

					for ( int v = 0; v < src.vertCount; v++ )
						QuakeVertexToBspVertex( q3lvl.Vertices[ src.vertStart + v ], out controlPoints[ v ], out texLightMap );

					// Define the surface, but don't build it yet (no vertex / index buffer)
					ps.DefineSurface(
						controlPoints,
						decl,
						src.meshCtrl[ 0 ],
						src.meshCtrl[ 1 ]
						);

					// Get stats
					patchVertexCount += ps.RequiredVertexCount;
					patchIndexCount += ps.RequiredIndexCount;

					// Save the surface for later
					patches.Add( face, ps );
				}
			}
		}
		public void BuildQuake3Patches( int vertOffset, int indexOffset )