private void UpdateTextureBuffer() { int sourceIndex = (int)updateTile.X * 8; for (int ly = 0; ly < DrawSize.Height; ly++) { int baseDestinationIndex = ly * textureBufferLength; if (ly + (int)updateTile.Y < Height) { int layerBufferIndex = ly + (int)updateTile.Y; Array.Copy(layerBuffer[0][layerBufferIndex], sourceIndex, mainTextureBuffer.Cache, baseDestinationIndex, textureBufferLength); Array.Copy(layerBuffer[1][layerBufferIndex], sourceIndex, mainTextureBuffer.Cache, baseDestinationIndex + textureBufferL1baseOffset, textureBufferLength); Array.Copy(layerBuffer[2][layerBufferIndex], sourceIndex, foregroundTextureBuffer.Cache, baseDestinationIndex, textureBufferLength); } else { Array.Clear(mainTextureBuffer.Cache, baseDestinationIndex, textureBufferLength); Array.Clear(mainTextureBuffer.Cache, baseDestinationIndex + textureBufferL1baseOffset, textureBufferLength); Array.Clear(foregroundTextureBuffer.Cache, baseDestinationIndex, textureBufferLength); } } mainTextureBuffer.Apply(); foregroundTextureBuffer.Apply(); }
private static void ApplyBufferUpdates() { vertexBuffer.Apply(); textureBuffer.Apply(); colorBuffer.Apply(); }