コード例 #1
0
ファイル: ImGuiNode.cs プロジェクト: iqingyu/helix-toolkit
        protected override void OnAttached()
        {
            previousTime = TimeSpan.Zero;
            IntPtr context = ImGui.CreateContext();

            ImGui.SetCurrentContext(context);
            ImGui.GetIO().Fonts.AddFontDefault();
            bufferModel = Collect(new ImGui2DBufferModel());
            (RenderCore as ImGuiRenderCore).Buffer = bufferModel;
            var io = ImGui.GetIO();

            unsafe
            {
                io.Fonts.GetTexDataAsRGBA32(out IntPtr textureData, out var width, out var height);
                var textureView = Collect(new ShaderResourceViewProxy(EffectsManager.Device));
                textureView.CreateView(textureData, width, height,
                                       Format.R8G8B8A8_UNorm);
                io.Fonts.SetTexID(fontAtlasID);
                io.Fonts.ClearTexData();
                (RenderCore as ImGuiRenderCore).TextureView = textureView;
            }
            ImGui.NewFrame();
            newFrame = true;
            base.OnAttached();
        }
コード例 #2
0
ファイル: ImGuiNode.cs プロジェクト: xzcxlyh/helix-toolkit
        protected override void OnAttached()
        {
            bufferModel = Collect(new ImGui2DBufferModel());
            (RenderCore as ImGuiRenderCore).Buffer = bufferModel;
            var io = ImGui.GetIO();

            var textureData = io.FontAtlas.GetTexDataAsRGBA32();
            var textureView = Collect(new ShaderResourceViewProxy(EffectsManager.Device));

            unsafe
            {
                textureView.CreateView((IntPtr)textureData.Pixels, textureData.Width, textureData.Height,
                                       Format.R8G8B8A8_UNorm);
            }
            io.FontAtlas.SetTexID(1);
            io.FontAtlas.ClearTexData();
            (RenderCore as ImGuiRenderCore).TextureView = textureView;
            ImGui.NewFrame();
            base.OnAttached();
        }
コード例 #3
0
ファイル: ImGuiNode.cs プロジェクト: iqingyu/helix-toolkit
 protected override void OnDetach()
 {
     bufferModel = null;
     (RenderCore as ImGuiRenderCore).TextureView = null;
     base.OnDetach();
 }