public void Append(VertexDrawInfo vertexDrawInfo) { int v = vertices.Length; int i = indices.Length; Array.Resize(ref vertices, vertices.Length + vertexDrawInfo.vertices.Length); Array.Resize(ref indices, indices.Length + vertexDrawInfo.indices.Length); Array.Copy(vertexDrawInfo.vertices, 0, vertices, v, vertexDrawInfo.vertices.Length); Array.Copy(vertexDrawInfo.indices, 0, indices, i, vertexDrawInfo.indices.Length); for (int j = i; j < indices.Length; j++) { indices[j] += i; } }
/// <summary> /// 开始顶点绘制 /// </summary> /// <param name="vertexInfo">顶点绘制信息</param> public void Draw(VertexDrawInfo vertexInfo) { if (DrawImmediately) { PrimitiveType cache = primitiveType; if (vertexInfo.primitiveType != null) { primitiveType = vertexInfo.primitiveType.Value; } Draw(vertexInfo.vertices, vertexInfo.indices, vertexInfo.texture); primitiveType = cache; return; } Draw(vertexInfo.vertices, vertexInfo.indices); }
/// <summary> /// 开始顶点绘制 /// </summary> /// <param name="vertex">顶点</param> /// <param name="index">索引</param> /// <param name="texture2D">材质</param> public void Draw(Vertex[] vertex, int[] index, Texture2D texture2D = null) { if (!_begin) { throw new Exception("Called Draw Before Begin"); } if (texture2D == null) { texture2D = Ste.Pixel; } if (DrawImmediately) { DoDraw(vertex, index, texture2D); return; } if (infos.Length < drawCount) { Array.Resize(ref infos, drawCount + 512); } infos[drawCount] = new VertexDrawInfo(vertex, index, texture2D); drawCount++; }
public void Draw(VertexDrawInfo info) { }
public static void DrawUserIndexedPrimitives(this GraphicsDevice graphicsDevice, PrimitiveType primitiveType, VertexDrawInfo vertexInfo) { graphicsDevice.DrawUserIndexedPrimitives(primitiveType, vertexInfo.vertices, 0, vertexInfo.vertices.Length, vertexInfo.indices, 0, VertexBatch.LengthGusser(vertexInfo.vertices.Length, primitiveType)); }