#region CPL License
/*
Nuclex Framework
Copyright (C) 2002-2009 Nuclex Development Labs
This library is free software; you can redistribute it and/or
modify it under the terms of the IBM Common Public License as
published by the IBM Corporation; either version 1.0 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
IBM Common Public License for more details.
You should have received a copy of the IBM Common Public
License along with this library
*/
#endregion
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework.Graphics;
namespace Nuclex.Graphics.Batching {
/// Controls the queuing of primitives for the primitive batcher
internal abstract class Queuer : IDisposable
where VertexType : struct, IVertexType {
/// Initializes a new primitive queuer
///
/// Batch drawer that will be used to render completed vertex batches
///
public Queuer(IBatchDrawer batchDrawer) {
this.BatchDrawer = batchDrawer;
}
/// Immediately releases all resources owned by the queuer
public virtual void Dispose() { }
/// Informs the queuer that a new drawing cycle is about to start
public virtual void Begin() { }
/// Informs the queuer that the current drawing cycle has ended
public virtual void End() { }
/// Queues a series of indexed primitives
/// Primitive vertices
///
/// Index in the vertex array of the first vertex. This vertex will become
/// the new index 0 for the index buffer.
///
/// Number of vertices to draw
/// Indices of the vertices to draw
/// Index of the vertex index to begin drawing with
/// Number of vertex indices to draw
/// Type of primitives to draw
/// Desired graphics device settings for the primitives
public abstract void Queue(
VertexType[] vertices, int startVertex, int vertexCount,
short[] indices, int startIndex, int indexCount,
PrimitiveType type, DrawContext context
);
/// Queues a series of primitives
/// Primitive vertices
/// Index of vertex to begin drawing with
/// Number of vertices to draw
/// Type of primitives to draw
/// Desired graphics device settings for the primitives
public abstract void Queue(
VertexType[] vertices, int startVertex, int vertexCount,
PrimitiveType type, DrawContext context
);
/// Vertex batch drawer used to send vertex batches to the GPU
protected IBatchDrawer BatchDrawer;
}
} // namespace Nuclex.Graphics.Batching