Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Allocate()

void Terraria.Graphics.TileBatch.Allocate ( )
inlineprivate

Definition at line 59 of file TileBatch.cs.

60 {
62 {
65 _vertexBuffer.ContentLost += delegate
66 {
68 };
69 }
70 if (_indexBuffer != null && !_indexBuffer.IsDisposed)
71 {
72 return;
73 }
74 if (_fallbackIndexData == null)
75 {
76 _fallbackIndexData = new short[12288];
77 for (int i = 0; i < 2048; i++)
78 {
79 _fallbackIndexData[i * 6] = (short)(i * 4);
80 _fallbackIndexData[i * 6 + 1] = (short)(i * 4 + 1);
81 _fallbackIndexData[i * 6 + 2] = (short)(i * 4 + 2);
82 _fallbackIndexData[i * 6 + 3] = (short)(i * 4);
83 _fallbackIndexData[i * 6 + 4] = (short)(i * 4 + 2);
84 _fallbackIndexData[i * 6 + 5] = (short)(i * 4 + 3);
85 }
86 }
87 _indexBuffer = new DynamicIndexBuffer(_graphicsDevice, typeof(short), 12288, BufferUsage.WriteOnly);
89 _indexBuffer.ContentLost += delegate
90 {
92 };
93 }
DynamicVertexBuffer _vertexBuffer
Definition TileBatch.cs:42
DynamicIndexBuffer _indexBuffer
Definition TileBatch.cs:44
GraphicsDevice _graphicsDevice
Definition TileBatch.cs:28

References Terraria.Graphics.TileBatch._fallbackIndexData, Terraria.Graphics.TileBatch._graphicsDevice, Terraria.Graphics.TileBatch._indexBuffer, Terraria.Graphics.TileBatch._vertexBuffer, Terraria.Graphics.TileBatch._vertexBufferPosition, and Microsoft.Xna.Framework.Graphics.GraphicsResource.IsDisposed.

Referenced by Terraria.Graphics.TileBatch.TileBatch(), and Terraria.Graphics.TileBatch.FlushRenderState().