private void Clear(ImGuiRenderer imGuiRenderer) { _landIdMap.Clear(); _landNameMap.Clear(); foreach (var(texture, texturePtr) in _landTexturesMap) { texture.Dispose(); imGuiRenderer.UnbindTexture(texturePtr); } }
public void SetMask(IReadOnlyList <bool> mask, int rowCount, int columnCount) { if (_maskTexture != null) { _imGuiRenderer.UnbindTexture(_maskTexturePointer); } _maskTexture = GenerateTextureForMask(mask, rowCount, columnCount); _maskTexturePointer = _imGuiRenderer.BindTexture(_maskTexture); }
public override void Draw(GameTime gameTime) { _graphicsDevice.SetRenderTarget(null); _graphicsDevice.Clear(ClearOptions.DepthBuffer, Color.White, 1, 0); _imGuiTexture[0] = _imGuiRenderer.BindTexture(ShaderManager.Instance.Color); _imGuiTexture[1] = _imGuiRenderer.BindTexture(ShaderManager.Instance.Depth); _imGuiTexture[2] = _imGuiRenderer.BindTexture(ShaderManager.Instance.LightInfo); _imGuiTexture[3] = _imGuiRenderer.BindTexture(ShaderManager.Instance.Normal); _imGuiTexture[4] = _imGuiRenderer.BindTexture(ShaderManager.Instance.Lights); _imGuiTexture[5] = _imGuiRenderer.BindTexture(ShaderManager.Instance.ShadowMap); _imGuiTexture[6] = _imGuiRenderer.BindTexture(ShaderManager.Instance.SSAO); var viewports = _viewportRenderSystem.GetViewports(); _viewPortTextures = new IntPtr[viewports.Length]; for (var i = 0; i < viewports.Length; i++) { _viewPortTextures[i] = _imGuiRenderer.BindTexture(viewports[i].GetViewport()); } // Call BeforeLayout first to set things up _imGuiRenderer.BeforeLayout(gameTime); // Draw our UI ImGuiLayout(); // Call AfterLayout now to finish up and draw all the things _imGuiRenderer.AfterLayout(); _imGuiRenderer.UnbindTexture(_imGuiTexture[0]); _imGuiRenderer.UnbindTexture(_imGuiTexture[1]); _imGuiRenderer.UnbindTexture(_imGuiTexture[2]); _imGuiRenderer.UnbindTexture(_imGuiTexture[3]); _imGuiRenderer.UnbindTexture(_imGuiTexture[4]); _imGuiRenderer.UnbindTexture(_imGuiTexture[5]); _imGuiRenderer.UnbindTexture(_imGuiTexture[6]); for (var i = 0; i < viewports.Length; i++) { _imGuiRenderer.UnbindTexture(_viewPortTextures[i]); } }
/// <summary> /// Unloads the texture from ImGui. /// </summary> /// <param name="texture">The texture <see cref="IntPtr"/>.</param> public void UnloadTexture(IntPtr texture) { imGuiRenderer.UnbindTexture(texture); }