示例#1
0
文件: Geometry.cs 项目: bryanedds/Xi
 /// <summary>
 /// Create a Geometry object.
 /// </summary>
 /// <param name="device">The graphics device to create the geometry on.</param>
 /// <param name="primitiveType">The type of primitive used to draw the geometry.</param>
 /// <param name="vertices">The vertices of the geometry.</param>
 public Geometry(GraphicsDevice device, PrimitiveType primitiveType, IVertices vertices)
 {
     XiHelper.ArgumentNullCheck(device, vertices);
     this.device = device;
     this.primitiveType = primitiveType;
     vertexSize = vertices.VertexSize;
     vertexCount = vertices.Length;
     vertexBuffer = new VertexBuffer(device, vertices.Length * vertices.VertexSize, BufferUsage.None);
     vertices.SetDataOfVertexBuffer(vertexBuffer);
     primitiveCount = primitiveType.GetPrimitiveCount(vertices.Length);
     vertexDeclaration = new ManagedVertexDeclaration(device, vertices.VertexElements);
 }
示例#2
0
文件: Geometry.cs 项目: bryanedds/Xi
 /// <summary>
 /// Create a Geometry object.
 /// </summary>
 /// <param name="device">The graphics device that the geometry will be created on.</param>
 /// <param name="vertexElements">The vertex elements that define the vertices that make up the geometry.</param>
 /// <param name="primitiveType">The type of primitive used to draw the geometry.</param>
 /// <param name="vertexBuffer">The vertex buffer that holds the geometry's vertices.</param>
 /// <param name="vertexSize">The size of each vertex in bytes.</param>
 /// <param name="vertexCount">The number of vertices in the vertex buffer.</param>
 /// <param name="indexBuffer">The index buffer that holds the geomety's indices.</param>
 /// <param name="indexCount">The number of indices in the index buffer.</param>
 public Geometry(
     GraphicsDevice device,
     VertexElement[] vertexElements,
     PrimitiveType primitiveType,
     VertexBuffer vertexBuffer,
     int vertexSize,
     int vertexCount,
     IndexBuffer indexBuffer,
     int indexCount)
     : this(device, vertexElements, primitiveType, vertexBuffer, vertexSize, vertexCount)
 {
     XiHelper.ArgumentNullCheck(device, vertexElements, vertexBuffer, indexBuffer);
     this.indexBuffer = indexBuffer;
     this.indexCount = indexCount;
     primitiveCount = primitiveType.GetPrimitiveCount(indexCount);
 }
示例#3
0
文件: Geometry.cs 项目: bryanedds/Xi
 /// <summary>
 /// Create a Geometry object.
 /// </summary>
 /// <param name="device">The graphics device that the geometry will be created on.</param>
 /// <param name="vertexElements">The vertex elements that define the vertices that make up the geometry.</param>
 /// <param name="primitiveType">The type of primitive used to draw the geometry.</param>
 /// <param name="vertexBuffer">The vertex buffer that holds the geometry's vertices.</param>
 /// <param name="vertexSize">The size of each vertex in bytes.</param>
 /// <param name="vertexCount">The number of vertices in the vertex buffer.</param>
 public Geometry(
     GraphicsDevice device,
     VertexElement[] vertexElements,
     PrimitiveType primitiveType,
     VertexBuffer vertexBuffer,
     int vertexSize,
     int vertexCount)
 {
     XiHelper.ArgumentNullCheck(device, vertexElements, vertexBuffer);
     this.device = device;
     this.vertexBuffer = vertexBuffer;
     this.vertexSize = vertexSize;
     this.vertexCount = vertexCount;
     this.primitiveType = primitiveType;
     primitiveCount = primitiveType.GetPrimitiveCount(vertexCount);
     vertexDeclaration = new ManagedVertexDeclaration(device, vertexElements);
 }
示例#4
0
文件: Geometry.cs 项目: bryanedds/Xi
 /// <summary>
 /// Create a Geometry object.
 /// </summary>
 /// <param name="device">The graphics device to create the geometry on.</param>
 /// <param name="primitiveType">The type of primitive used to draw the geometry.</param>
 /// <param name="vertices">The vertices of the geometry.</param>
 /// <param name="indices">The indices of the geometry.</param>
 public Geometry(GraphicsDevice device, PrimitiveType primitiveType, IVertices vertices, int[] indices)
     : this(device, primitiveType, vertices)
 {
     XiHelper.ArgumentNullCheck(device, vertices, indices);
     indexCount = indices.Length;
     indexBuffer = new IndexBuffer(device, typeof(int), indices.Length, BufferUsage.None);
     indexBuffer.SetData<int>(indices);
     primitiveCount = primitiveType.GetPrimitiveCount(indices.Length);
 }