Even more documentation.
This commit is contained in:
@@ -6,9 +6,15 @@ using System.Collections.Generic;
|
||||
|
||||
namespace RecrownedAthenaeum.Render
|
||||
{
|
||||
/// <summary>
|
||||
/// A batch used to draw primitive shapes by batching together vertices.
|
||||
/// </summary>
|
||||
public class PrimitiveBatch : IDisposable
|
||||
{
|
||||
List<VertexPositionColor> vertices;
|
||||
/// <summary>
|
||||
/// The maximum vertices expected. The further off this expectancy is from the true value, the less efficient.
|
||||
/// </summary>
|
||||
public int MaxVertices { get { return vertices.Capacity; } set { vertices.Capacity = value; } }
|
||||
int bufferPosition;
|
||||
BasicEffect basicEffect;
|
||||
@@ -80,7 +86,8 @@ namespace RecrownedAthenaeum.Render
|
||||
if (primitiveType != PrimitiveType.LineStrip && primitiveType != PrimitiveType.TriangleStrip)
|
||||
{
|
||||
Flush();
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("Buffer size isn't large enough.");
|
||||
}
|
||||
@@ -103,23 +110,35 @@ namespace RecrownedAthenaeum.Render
|
||||
bufferPosition = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes this.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public void Dispose(bool disposing)
|
||||
/// <summary>
|
||||
/// Overridable dispose.
|
||||
/// </summary>
|
||||
/// <param name="disposing">True for when user called for this to be disposed. False otherwise.</param>
|
||||
public virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposed) throw new ObjectDisposedException(this.GetType().Name);
|
||||
disposed = true;
|
||||
if (disposing && !disposed)
|
||||
{
|
||||
basicEffect.Dispose();
|
||||
disposed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (disposed) throw new ObjectDisposedException(this.GetType().Name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destructor.
|
||||
/// </summary>
|
||||
~PrimitiveBatch()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user