本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawIndexedPrimitives方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsDevice.DrawIndexedPrimitives方法的具体用法?C# GraphicsDevice.DrawIndexedPrimitives怎么用?C# GraphicsDevice.DrawIndexedPrimitives使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.GraphicsDevice
的用法示例。
在下文中一共展示了GraphicsDevice.DrawIndexedPrimitives方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderMesh
public void RenderMesh(GraphicsDevice graphicsDevice)
{
graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0,
meshPart.NumVertices,
meshPart.StartIndex,
meshPart.PrimitiveCount);
}
示例2: Render
public void Render(GraphicsDevice device, Camera cam)
{
if (!Transform.renderer.enabled)
{
return;
}
device.SetVertexBuffer(VertexBuffer);
device.Indices = IndexBuffer;
Effect e = Material.shader.effect;
Material.shader.ApplyPreRenderSettings(Material, UseVertexColor);
Material.SetBlendState(device);
IEffectMatrices ems = e as IEffectMatrices;
if (ems != null)
{
ems.World = Transform.world;
ems.View = cam.view;
ems.Projection = cam.projectionMatrix;
}
foreach (EffectPass pass in e.CurrentTechnique.Passes)
{
pass.Apply();
device.DrawIndexedPrimitives(
PrimitiveType.TriangleList,
0,
0,
VertexBuffer.VertexCount,
0,
IndexBuffer.IndexCount / 3
);
}
RenderStats.AddDrawCall(batches, VertexBuffer.VertexCount, IndexBuffer.IndexCount / 3);
}
示例3: Draw
/// <summary>
/// Render the terrain
/// </summary>
/// <param name="device"></param>
/// <param name="world"></param>
public override void Draw(GraphicsDevice device, WorldState world)
{
world._3D.ApplyCamera(Effect, this);
//device.SamplerStates[0].AddressU = TextureAddressMode.Wrap;
//device.SamplerStates[0].AddressV = TextureAddressMode.Wrap;
device.SetVertexBuffer(VertexBuffer);
device.Indices = IndexBuffer;
//device.RasterizerState.CullMode = CullMode.None;
foreach (var pass in Effect.CurrentTechnique.Passes)
{
pass.Apply();
device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, GeomLength, 0, NumPrimitives);
}
device.SetVertexBuffer(GrassVertexBuffer);
//device.Indices = GrassIndexBuffer;
foreach (var pass in Effect.CurrentTechnique.Passes)
{
pass.Apply();
device.DrawPrimitives(PrimitiveType.LineList, 0, GrassPrimitives);
//device.DrawIndexedPrimitives(PrimitiveType.LineList, 0, 0, GrassPrimitives*2, 0, GrassPrimitives);
};
}
示例4:
void IMesh.Render(GraphicsDevice Device)
{
Device.SetVertexBuffer(verticies);
Device.Indices = indicies;
Device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, verticies.VertexCount,
0, System.Math.Min(primitiveCount, 65535));
}
示例5: Render
/// <summary>
/// Draws the primitive to the screen.
/// </summary>
/// <param Name="device">GPU to draw with.</param>
public virtual void Render(GraphicsDevice device)
{
lock (VertexLock)
{
#if MONOGAME_BUILD
device.SamplerStates[0].Filter = TextureFilter.Point;
device.SamplerStates[1].Filter = TextureFilter.Point;
device.SamplerStates[2].Filter = TextureFilter.Point;
device.SamplerStates[3].Filter = TextureFilter.Point;
device.SamplerStates[4].Filter = TextureFilter.Point;
#endif
if (VertexBuffer == null)
{
return;
}
if (Vertices == null || VertexBuffer == null || Vertices.Length < 3 || VertexBuffer.IsDisposed || VertexBuffer.VertexCount < 3)
{
return;
}
device.SetVertexBuffer(VertexBuffer);
if (IndexBuffer != null)
{
device.Indices = IndexBuffer;
device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, VertexBuffer.VertexCount, 0, IndexBuffer.IndexCount / 3);
}
else
{
device.DrawPrimitives(PrimitiveType.TriangleList, 0, Vertices.Length/3);
}
}
}
示例6: draw
public void draw(GraphicsDevice graphics)
{
foreach (EffectPass pass in _shader.CurrentTechnique.Passes)
{
pass.Apply();
CGraphics.GPU.SetVertexBuffer(_vertexBuffer);
graphics.DrawIndexedPrimitives(PrimitiveType.LineList, 0, 0, vertices.Length, 0, 1);
}
}
示例7: Draw
public void Draw(GraphicsDevice graphics, Matrix world, Matrix view, Matrix projection)
{
graphics.SetVertexBuffer(vertices);
graphics.Indices = indices;
skyEffect.Parameters["WVP"].SetValue(world * view * projection);
skyEffect.CurrentTechnique.Passes[0].Apply();
graphics.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, number_of_vertices, 0, number_of_indices / 3);
}
示例8: Draw
internal void Draw(Texture2D[] textures, GraphicsDevice device, BasicEffect effect, EffectPass pass)
{
effect.World = displayObject.WorldTransform;
effect.Texture = textures[displayObject.TextureIndex];
device.SetVertexBuffer(vertexBuffer);
device.Indices = indexBuffer;
pass.Apply();
device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, vertices.Length, 0, indices.Length / 3);
}
示例9: Draw
//Draw and Set Buffers
public void Draw(GraphicsDevice GraphicsDevice)
{
//Set Vertex Buffer
GraphicsDevice.SetVertexBuffer(vb);
//Set Index Buffer
GraphicsDevice.Indices = ib;
//Draw Quad
GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);
}
示例10: draw
/// <summary>
/// Draws the Sphere
/// </summary>
/// <param name="device">Graphics device</param>
/// <param name="camera">What camera to draw on</param>
public void draw(GraphicsDevice device, Camera.CameraMatrices camera)
{
for (int i = 0; i < numB; i++)
{
device.VertexDeclaration = vDecl;
device.Vertices[0].SetSource(vBuffer, 0, vertexPos.SizeInBytes);
device.Indices = iBuffer[i];
device.DrawIndexedPrimitives(PrimitiveType.TriangleStrip, 0, 0, numV, 0, numI - 2);
}
}
示例11: DrawGeometry
public void DrawGeometry(GraphicsDevice gd)
{
if (GPUMode){
gd.VertexDeclaration = new VertexDeclaration(gd, MeshVertex.VertexElements);
gd.Indices = GPUIndexBuffer;
gd.Vertices[0].SetSource(GPUBlendVertexBuffer, 0, MeshVertex.SizeInBytes);
gd.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, BlendVertexBuffer.Length, 0, NumPrimitives);
}else{
gd.VertexDeclaration = new VertexDeclaration(gd, MeshVertex.VertexElements);
gd.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, BlendVertexBuffer, 0, BlendVertexBuffer.Length, IndexBuffer, 0, NumPrimitives);
}
}
示例12: Draw
//-----------------------------------------------------------------------
public void Draw(GraphicsDevice device)
{
if (indices.Length == 0)
return;
if (isDirty)
Warm(device);
device.SetVertexBuffer(vertexbuffer);
device.Indices = indexbuffer;
device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, vertices.Length, 0, indices.Length / 3);
}
示例13: Draw
/// <summary>
/// This renders the grid as constructed.
/// </summary>
public void Draw()
{
IGraphicsDeviceService igs = (IGraphicsDeviceService)game.Services.GetService(typeof(IGraphicsDeviceService));
graphicsDevice = igs.GraphicsDevice;
int numVertices = (dimension + 1) * (dimension + 1);
int numTriangles = 2 * dimension * dimension;
graphicsDevice.VertexDeclaration = vertexDecl;
graphicsDevice.Vertices[0].SetSource(vertexBuffer, 0, VertexPositionNormalTexture.SizeInBytes);
graphicsDevice.Indices = indexBuffer;
graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, numVertices, 0, numTriangles);
}
示例14: drawPass
//描画パスごとに呼び出す
public void drawPass(GraphicsDevice inDevice)
{
inDevice.SetVertexBuffer(m_VertexBuffer);
inDevice.Indices=m_IndexBuffer;
inDevice.DrawIndexedPrimitives(
PrimitiveType.TriangleList,
0,
0,
m_Vertices.Length,
0,
m_Indices.Length / 3
);
}
示例15: DrawSkybox
public void DrawSkybox(Matrix viewMatrix, Matrix projectionMatrix,
Matrix camWorld, GraphicsDevice device)
{
device.SetVertexBuffer(vertices);
device.Indices = indices;
skyEffect.Parameters["WVP"].SetValue(camWorld * projectionMatrix * viewMatrix
*Matrix.CreateScale(100));
skyEffect.CurrentTechnique.Passes[0].Apply();
device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0,
number_of_vertices, 0, number_of_indices / 3);
}