4 public class BasePrimitivesRenderer<T1, T2, T3> where T1 :
BaseFlatBatch, new()
24 for (LinkedListNode<T1> linkedListNode =
m_flatBatches.First; linkedListNode !=
null; linkedListNode = linkedListNode.Next) {
25 T1 value = linkedListNode.Value;
26 if (layer == value.Layer
27 && depthStencilState == value.DepthStencilState
28 && rasterizerState == value.RasterizerState
29 && blendState == value.BlendState) {
30 if (linkedListNode.Previous !=
null) {
51 ArgumentNullException.ThrowIfNull(texture);
52 for (LinkedListNode<T2> linkedListNode =
m_texturedBatches.First; linkedListNode !=
null; linkedListNode = linkedListNode.Next) {
53 T2 value = linkedListNode.Value;
54 if (texture == value.Texture
55 && useAlphaTest == value.UseAlphaTest
56 && layer == value.Layer
57 && depthStencilState == value.DepthStencilState
58 && rasterizerState == value.RasterizerState
59 && blendState == value.BlendState
60 && samplerState == value.SamplerState) {
61 if (linkedListNode.Previous !=
null) {
71 UseAlphaTest = useAlphaTest,
89 ArgumentNullException.ThrowIfNull(font);
90 for (LinkedListNode<T3> linkedListNode =
m_fontBatches.First; linkedListNode !=
null; linkedListNode = linkedListNode.Next) {
91 T3 value = linkedListNode.Value;
92 if (font == value.Font
93 && layer == value.Layer
94 && depthStencilState == value.DepthStencilState
95 && rasterizerState == value.RasterizerState
96 && blendState == value.BlendState
97 && samplerState == value.SamplerState) {
98 if (linkedListNode.Previous !=
null) {
119 public void Flush(
Matrix matrix,
bool clearAfterFlush =
true,
int maxLayer =
int.MaxValue) {
123 public void Flush(
Matrix matrix,
Vector4 color,
bool clearAfterFlush =
true,
int maxLayer =
int.MaxValue) {
128 return b1.Layer < b2.Layer ? -1 :
129 b1.Layer > b2.Layer ? 1 : 0;
134 if (allBatch.
Layer > maxLayer) {
138 allBatch.
Flush(matrix, color, clearAfterFlush);
void Flush(Matrix matrix, Vector4 color, bool clearAfterFlush=true)
T1 FindFlatBatch(int layer, DepthStencilState depthStencilState, RasterizerState rasterizerState, BlendState blendState)
void Flush(Matrix matrix, bool clearAfterFlush=true, int maxLayer=int.MaxValue)
T3 FindFontBatch(BitmapFont font, int layer, DepthStencilState depthStencilState, RasterizerState rasterizerState, BlendState blendState, SamplerState samplerState)
List< BaseBatch > m_allBatches
IEnumerable< T3 > FontBatches
LinkedList< T2 > m_texturedBatches
IEnumerable< T1 > FlatBatches
LinkedList< T3 > m_fontBatches
IEnumerable< T2 > TexturedBatches
void Flush(Matrix matrix, Vector4 color, bool clearAfterFlush=true, int maxLayer=int.MaxValue)
LinkedList< T1 > m_flatBatches
T2 FindTexturedBatch(Texture2D texture, bool useAlphaTest, int layer, DepthStencilState depthStencilState, RasterizerState rasterizerState, BlendState blendState, SamplerState samplerState)
static readonly Vector4 One