public void Update(float dt) { if (!DisableTextureAnimation && !m_subsystemTime.FixedTimeStep.HasValue) { float dt2 = (float)MathUtils.Min(m_subsystemTime.GameTime - m_lastAnimateGameTime, 1.0); m_lastAnimateGameTime = m_subsystemTime.GameTime; Texture2D blocksTexture = m_subsystemBlocksTexture.BlocksTexture; if (m_animatedBlocksTexture == null || m_animatedBlocksTexture.Width != blocksTexture.Width || m_animatedBlocksTexture.Height != blocksTexture.Height || m_animatedBlocksTexture.MipLevelsCount > 1 != SettingsManager.TerrainMipmapsEnabled) { Utilities.Dispose(ref m_animatedBlocksTexture); m_animatedBlocksTexture = new RenderTarget2D(blocksTexture.Width, blocksTexture.Height, (!SettingsManager.TerrainMipmapsEnabled) ? 1 : 4, ColorFormat.Rgba8888, DepthFormat.None); } Rectangle scissorRectangle = Display.ScissorRectangle; RenderTarget2D renderTarget = Display.RenderTarget; Display.RenderTarget = m_animatedBlocksTexture; try { Display.Clear(new Vector4(Color.Transparent)); m_primitivesRenderer.TexturedBatch(blocksTexture, useAlphaTest: false, -1, DepthStencilState.None, RasterizerState.CullNone, BlendState.Opaque, SamplerState.PointClamp).QueueQuad(new Vector2(0f, 0f), new Vector2(m_animatedBlocksTexture.Width, m_animatedBlocksTexture.Height), 0f, Vector2.Zero, Vector2.One, Color.White); AnimateWaterBlocksTexture(); AnimateMagmaBlocksTexture(); m_primitivesRenderer.Flush(); Display.ScissorRectangle = AnimateFireBlocksTexture(dt2); m_primitivesRenderer.Flush(); } finally { Display.RenderTarget = renderTarget; Display.ScissorRectangle = scissorRectangle; } if (SettingsManager.TerrainMipmapsEnabled && Time.FrameIndex % 2 == 0) { m_animatedBlocksTexture.GenerateMipMaps(); } } }