Exemple #1
0
 /// <summary>
 /// Draw call
 /// </summary>
 /// <param name="context"></param>
 /// <param name="instanceModel"></param>
 protected virtual void OnDraw(DeviceContextProxy context, IElementsBufferModel instanceModel)
 {
     if (GeometryBuffer.IndexBuffer != null)
     {
         if (instanceModel == null || !instanceModel.HasElements)
         {
             context.DrawIndexed(GeometryBuffer.IndexBuffer.ElementCount, GeometryBuffer.IndexBuffer.Offset, 0);
         }
         else
         {
             context.DrawIndexedInstanced(GeometryBuffer.IndexBuffer.ElementCount, instanceModel.Buffer.ElementCount, GeometryBuffer.IndexBuffer.Offset, 0, instanceModel.Buffer.Offset);
         }
     }
     else if (GeometryBuffer.VertexBuffer.Length > 0)
     {
         if (instanceModel == null || !instanceModel.HasElements)
         {
             context.Draw(GeometryBuffer.VertexBuffer[0].ElementCount, 0);
         }
         else
         {
             context.DrawInstanced(GeometryBuffer.VertexBuffer[0].ElementCount, instanceModel.Buffer.ElementCount,
                                   0, instanceModel.Buffer.Offset);
         }
     }
 }
Exemple #2
0
 public static void DrawIndexed(DeviceContextProxy context, IElementsBufferProxy indexBuffer, IElementsBufferModel instanceModel)
 {
     if (!instanceModel.HasElements)
     {
         context.DrawIndexed(indexBuffer.ElementCount, 0, 0);
     }
     else
     {
         context.DrawIndexedInstanced(indexBuffer.ElementCount, instanceModel.Buffer.ElementCount, 0, 0, 0);
     }
 }
Exemple #3
0
 public static void DrawIndexed(DeviceContextProxy context, int indexCount, int instanceCount)
 {
     if (instanceCount <= 0)
     {
         context.DrawIndexed(indexCount, 0, 0);
     }
     else
     {
         context.DrawIndexedInstanced(indexCount, instanceCount, 0, 0, 0);
     }
 }