Nez.DeferredLighting.PolygonMesh.PolygonMesh C# (CSharp) Method

PolygonMesh() public method

public PolygonMesh ( Vector2 points ) : System
points Vector2
return System
		public PolygonMesh( Vector2[] points )
		{
			var verts = generateVerts( points );

			// each point needs 3 verts
			var indices = new short[points.Length * 3];
			for( short i = 0; i < points.Length; i++ )
			{
				indices[i * 3] = 0;
				indices[(i * 3) + 1] = (short)( i + 1 );
				indices[(i * 3) + 2] = (short)( i + 2 );
			}
			indices[( points.Length * 3 ) - 1] = 1;

			_vertexBuffer = new VertexBuffer( Core.graphicsDevice, VertexPosition.VertexDeclaration, verts.Length, BufferUsage.WriteOnly );
			_vertexBuffer.SetData( verts );
			_indexBuffer = new IndexBuffer( Core.graphicsDevice, IndexElementSize.SixteenBits, indices.Length, BufferUsage.WriteOnly );
			_indexBuffer.SetData( indices );
			_primitiveCount = points.Length;
		}