Example #1
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            ImGuiRenderer.BeginFrame(e.Time);

            foreach (var component in _guiComponents)
            {
                component.Render();
            }

            NextGuiRender?.Invoke();
            NextGuiRender = null;

            ImGuiRenderer.EndFrame();

            _fbo.Bind();
            GL.Viewport(0, 0, _fbo.Width, _fbo.Height);
            _proj = Matrix4.CreatePerspectiveFieldOfView(MathHelper.DegreesToRadians(60f),
                                                         (float)_fbo.Width / _fbo.Height, 0.1f, 100f);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            _treeController.RenderSelectedNode(_cam.View, _proj);

            _fbo.Unbind();

            SwapBuffers();
        }
Example #2
0
        /// <summary>
        /// Draw the layout.
        /// </summary>
        /// <param name="renderer">Renderer.</param>
        public override void DrawLayout(ImGuiRenderer renderer)
        {
            ImGui.Checkbox("Allow NSFW Content", ref Helper.Settings.NSFW);
            ImGui.Checkbox("Enable Wallpapers", ref Helper.Settings.EnableWallpapers);
            ImGui.Checkbox("Force Wallpapers To Be SFW", ref Helper.Settings.ForceWallpaperSFW);
            ImGui.Separator();
            ImGui.Text("Milliseconds Per Wallpaper");
            ImGui.InputInt("##1", ref Helper.Settings.WallpaperTime, 100, 1000);
            if (Helper.Settings.WallpaperTime < 2000)
            {
                Helper.Settings.WallpaperTime = 2000;
            }
            ImGui.Text("Wallpaper Tags");
            ImGui.InputText("##2", ref Helper.Settings.WallpaperTags, 10000);
            ImGui.Separator();
            int ind = Helper.Settings.ThemeIndex;

            if (ImGui.Combo("Theme", ref ind, Style.ThemeList, Style.ThemeList.Length))
            {
                Helper.Settings.ThemeIndex = ind;
            }
            if (ImGui.Button("Style Editor"))
            {
                new StyleEditorWindow();
            }
            if (ImGui.Button("Reload Last Settings"))
            {
                Helper.Settings.LoadSettings();
            }
            ImGui.SameLine();
            if (ImGui.Button("Save Settings"))
            {
                Helper.Settings.SaveSettings();
            }
        }
Example #3
0
        protected override void LoadContentInternal(
            GraphicsDevice graphicsDevice,
            ContentManager contentManager,
            ImGuiRenderer imGuiRenderer)
        {
            Clear(imGuiRenderer);
            var itemCount = _tileDataProvider.ItemTable?.Length;

            for (var itemIndex = 0; itemIndex < itemCount; ++itemIndex)
            {
                var itemTexture = _itemProvider.GetStatic(graphicsDevice, itemIndex);
                if (itemTexture == null)
                {
                    continue;
                }

                var itemData = _tileDataProvider.ItemTable[itemIndex];
                if (!string.IsNullOrEmpty(itemData.Name))
                {
                    _itemNameMap.Add(itemIndex, itemData.Name);
                }

                var textureHandle = imGuiRenderer.BindTexture(itemTexture);
                _itemTexturesMap.Add(itemTexture, textureHandle);
                _itemIdMap.Add(textureHandle, itemIndex);
            }
        }
Example #4
0
        public MainScreen()
        {
            var windowCreateInfo = new WindowCreateInfo
            {
                X                  = 100,
                Y                  = 100,
                WindowWidth        = 800,
                WindowHeight       = 600,
                WindowInitialState = WindowState.Maximized,
                WindowTitle        = "OpenShadows - Workbench"
            };

            var graphicsDeviceOptions = new GraphicsDeviceOptions(true, null, false, ResourceBindingModel.Improved, true, true, true);

            VeldridStartup.CreateWindowAndGraphicsDevice(windowCreateInfo, graphicsDeviceOptions, GraphicsBackend.Direct3D11, out Window, out Gd);

            Cl = Gd.ResourceFactory.CreateCommandList();

            ImGuiRenderer = new ImGuiRenderer(Gd, Gd.MainSwapchain.Framebuffer.OutputDescription, 800, 600, ColorSpaceHandling.Linear);
            ImGuiHelper.DeactivateIniFile();
            ImGui.StyleColorsLight();

            Window.Resized += () =>
            {
                Gd.MainSwapchain.Resize((uint)Window.Width, (uint)Window.Height);
                ImGuiRenderer.WindowResized(Window.Width, Window.Height);
            };

            Screens.Add(new AlfBrowserScreen());
            Screens.Add(new LevelBrowserScreen());
        }
Example #5
0
        public ModelViewer(ITagContainer diContainer)
        {
            this.diContainer     = diContainer;
            device               = diContainer.GetTag <GraphicsDevice>();
            resourcePool         = diContainer.GetTag <IResourcePool>();
            textureLoader        = diContainer.GetTag <IAssetLoader <Texture> >();
            Window               = diContainer.GetTag <WindowContainer>().NewWindow("Model Viewer");
            Window.InitialBounds = new Rect(float.NaN, float.NaN, 1100.0f, 600.0f);
            Window.AddTag(this);
            editor = new TwoColumnEditorTag(Window, diContainer);
            var onceAction = new OnceAction();

            Window.AddTag(onceAction);
            Window.OnContent += onceAction.Invoke;
            var menuBar = new MenuBarWindowTag(Window);

            menuBar.AddButton("Open", HandleMenuOpen);
            fbArea            = Window.GetTag <FramebufferArea>();
            fbArea.OnResize  += HandleResize;
            fbArea.OnRender  += HandleRender;
            modelMaterialEdit = new ModelMaterialEdit(Window, diContainer);
            diContainer.GetTag <OpenDocumentSet>().AddEditor(this);

            openFileModal                    = new OpenFileModal(diContainer);
            openFileModal.Filter             = "*.dff";
            openFileModal.IsFilterChangeable = false;
            openFileModal.OnOpenedResource  += Load;
            imGuiRenderer                    = Window.Container.ImGuiRenderer;

            locationBuffer = new LocationBuffer(device);
            AddDisposable(locationBuffer);

            var localDiContainer = diContainer.ExtendedWith(locationBuffer);

            camera = new Camera(localDiContainer);
            AddDisposable(camera);

            controls = new OrbitControlsTag(Window, camera.Location, localDiContainer);
            AddDisposable(controls);

            gridRenderer = new DebugGridRenderer(diContainer);
            gridRenderer.Material.LinkTransformsTo(camera);
            gridRenderer.Material.World.Ref = Matrix4x4.Identity;
            AddDisposable(gridRenderer);

            triangleRenderer = new DebugTriangleLineRenderer(diContainer);
            triangleRenderer.Material.LinkTransformsTo(camera);
            triangleRenderer.Material.World.Ref = Matrix4x4.Identity;
            AddDisposable(triangleRenderer);

            planeRenderer = new DebugPlaneRenderer(diContainer);
            planeRenderer.Material.LinkTransformsTo(camera);
            planeRenderer.Material.World.Ref = Matrix4x4.Identity;
            AddDisposable(planeRenderer);

            editor.AddInfoSection("Statistics", HandleStatisticsContent);
            editor.AddInfoSection("Materials", HandleMaterialsContent);
            editor.AddInfoSection("Skeleton", HandleSkeletonContent);
            editor.AddInfoSection("Collision", HandleCollisionContent);
        }
Example #6
0
        public DeveloperModeView(Game game)
        {
            _game = game;

            var window = game.Window;

            _imGuiRenderer = AddDisposable(new ImGuiRenderer(
                                               window.GraphicsDevice,
                                               window.GraphicsDevice.MainSwapchain.Framebuffer.OutputDescription,
                                               window.ClientBounds.Width,
                                               window.ClientBounds.Height));

            void OnWindowSizeChanged(object sender, EventArgs e)
            {
                _imGuiRenderer.WindowResized(window.ClientBounds.Width, window.ClientBounds.Height);
            }

            window.ClientSizeChanged += OnWindowSizeChanged;

            AddDisposeAction(() => window.ClientSizeChanged -= OnWindowSizeChanged);

            _commandList = AddDisposable(window.GraphicsDevice.ResourceFactory.CreateCommandList());

            _mainView = AddDisposable(new MainView(new DiagnosticViewContext(game, _imGuiRenderer)));
        }
Example #7
0
        static void Main(string[] args)
        {
            AdbManager.Instance.Init();

            bool isWindows = System.Runtime.InteropServices.RuntimeInformation
                             .IsOSPlatform(OSPlatform.Windows);

            VeldridStartup.CreateWindowAndGraphicsDevice(
                new WindowCreateInfo(50, 50, 600, 400, WindowState.Normal, "LogMeow"),
                new GraphicsDeviceOptions(true, null, true),
                isWindows ? GraphicsBackend.Direct3D11 : GraphicsBackend.Metal,
                out window,
                out graphicDevice);

            window.Resized += () =>
            {
                graphicDevice.MainSwapchain.Resize((uint)window.Width, (uint)window.Height);
                guiRender.WindowResized(window.Width, window.Height);
            };
            commandList = graphicDevice.ResourceFactory.CreateCommandList();
            guiRender   = new ImGuiRenderer(graphicDevice, graphicDevice.MainSwapchain.Framebuffer.OutputDescription, window.Width, window.Height);

            window.Closed += () =>
            {
                Environment.Exit(0);
            };


            assembly = typeof(Program).Assembly;
            string[] names = assembly.GetManifestResourceNames();
            Console.WriteLine(String.Join(Environment.NewLine, names));
            LoadFont();

            // Main application loop
            while (window.Exists)
            {
                InputSnapshot snapshot = window.PumpEvents();
                if (!window.Exists)
                {
                    break;
                }
                guiRender.Update(1f / 60f, snapshot); // Feed the input events to our ImGui controller, which passes them through to ImGui.

                SubmitUI();
                Singleton <LogMeowWorkspaceView> .Instance.draw();

                commandList.Begin();
                commandList.SetFramebuffer(graphicDevice.MainSwapchain.Framebuffer);
                commandList.ClearColorTarget(0, new RgbaFloat(backgroundColor.X, backgroundColor.Y, backgroundColor.Z, 1f));
                guiRender.Render(graphicDevice, commandList);
                commandList.End();
                graphicDevice.SubmitCommands(commandList);
                graphicDevice.SwapBuffers(graphicDevice.MainSwapchain);
            }

            graphicDevice.WaitForIdle();
            guiRender.Dispose();
            commandList.Dispose();
            graphicDevice.Dispose();
        }
Example #8
0
        public DevModeOverlay(
            GraphicsDevice graphicsDevice,
            Framebuffer framebuffer,
            LogEventRecorder logEventRecorder)
        {
            Framebuffer mainFramebuffer = framebuffer;

            _imguiRenderer = new ImGuiRenderer(
                graphicsDevice,
                mainFramebuffer.OutputDescription,
                (int)mainFramebuffer.Width,
                (int)mainFramebuffer.Height
                );

            ImGui.EndFrame();

            ImGuiIOPtr io = ImGui.GetIO();

            io.Fonts.Clear();
            io.Fonts.AddFontFromFileTTF(
                "Fonts/NotoSansCJKjp-Regular.ttf",
                16, null, io.Fonts.GetGlyphRangesJapanese()
                );
            _imguiRenderer.RecreateFontDeviceTexture(graphicsDevice);
            ImGui.NewFrame();

            _gd          = graphicsDevice;
            _cl          = _gd.ResourceFactory.CreateCommandList();
            _framebuffer = mainFramebuffer;

            _logView = new LogView(logEventRecorder);
        }
Example #9
0
        static void CreateResources()
        {
            factory     = device.ResourceFactory;
            commandList = factory.CreateCommandList();
            Vertex[] quadVertices = Logic.ScreenQuads;
            ushort[] quadIndices  = { 0, 1, 2, 3 };

            imGuiRenderer = new ImGuiRenderer(device,
                                              device.SwapchainFramebuffer.OutputDescription, window.Width, window.Height);


            renderTexture = MakeTexture(Round(window.Width, Logic.GroupSize), Round(window.Height, Logic.GroupSize));//var resultTBuffer = factory.CreateTextureView(new TextureViewDescription(renderTexture));
            var drawUBuffer = MakeBuffer(new Info[] { Logic.State }, BufferUsage.UniformBuffer);

            var renderDesc = new VertFragUnit.Description()
            {
                Vertex   = LoadShader(ShaderStages.Vertex),
                Fragment = LoadShader("DisplayFrag", ShaderStages.Fragment),

                VertexBuffer = MakeBuffer(quadVertices, BufferUsage.VertexBuffer),
                IndexBuffer  = MakeBuffer(quadIndices, BufferUsage.IndexBuffer),
                Topology     = PrimitiveTopology.TriangleStrip,
                Output       = device.SwapchainFramebuffer.OutputDescription
            };

            renderDesc.AddResource("texture", ResourceKind.TextureReadOnly, renderTexture);
            renderDesc.AddResource("info", ResourceKind.UniformBuffer, drawUBuffer);
            renderer = new VertFragUnit(factory, renderDesc);

            var infoUBuffer = MakeBuffer(new Info[] { Logic.State }, BufferUsage.UniformBuffer);

            var compDesc = new ComputeUnit.Description(LoadShader("Compute", ShaderStages.Compute))
            {
                xGroupSize = Logic.GroupSize,
                yGroupSize = Logic.GroupSize
            };

            compDesc.AddResource("sampler", ResourceKind.Sampler, device.LinearSampler);
            //compDesc.AddResource("values", ResourceKind.StructuredBufferReadOnly, model.ValueBuffer());
            compDesc.AddResource("values", ResourceKind.TextureReadOnly, model.ValueTexture());
            compDesc.AddResource("data", ResourceKind.StructuredBufferReadOnly, model.StructBuffer());
            compDesc.AddResource("info", ResourceKind.UniformBuffer, infoUBuffer);
            compDesc.AddResource("result", ResourceKind.TextureReadWrite, renderTexture);
            compute = new ComputeUnit(factory, compDesc);


            ushort[] debugIndices = { 0, 1, 2, 3, 4, 5 };
            var      uiDesc       = new VertFragUnit.Description()
            {
                Vertex       = LoadShader(ShaderStages.Vertex),
                Fragment     = LoadShader("Plain", ShaderStages.Fragment),
                VertexBuffer = MakeBuffer(Logic.DebugUtils, BufferUsage.VertexBuffer),
                IndexBuffer  = MakeBuffer(debugIndices, BufferUsage.IndexBuffer),
                Topology     = PrimitiveTopology.LineList,
                Output       = device.SwapchainFramebuffer.OutputDescription
            };

            uiRenderer = new VertFragUnit(factory, uiDesc);
        }
Example #10
0
        public MainForm(GameWindow gameWindow, ImGuiRenderer imGuiRenderer)
        {
            _gameWindow    = gameWindow;
            _imGuiRenderer = imGuiRenderer;

            _installations = GameInstallation.FindAll(GameDefinition.All).ToList();
            ChangeInstallation(_installations.FirstOrDefault());
        }
Example #11
0
 protected override void OnMouseMove(MouseMoveEventArgs e)
 {
     if (!Focused || !Visible)
     {
         return;
     }
     ImGuiRenderer.UpdateMousePos(e.X, e.Y);
 }
Example #12
0
 public AssetViewContext(Game game, ImGuiGamePanel gamePanel, ImGuiRenderer imGuiRenderer, FileSystemEntry entry)
 {
     Game           = game;
     GamePanel      = gamePanel;
     GraphicsDevice = game.GraphicsDevice;
     ImGuiRenderer  = imGuiRenderer;
     Entry          = entry;
 }
Example #13
0
 public static void Init()
 {
     try {
         Renderer = new ImGuiRenderer(Engine.Instance);
         ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 4f);
     } catch (Exception e) {
     }
 }
Example #14
0
        public CD3DRenderer()
        {
            Configuration.EnableObjectTracking             = false;
            Configuration.EnableTrackingReleaseOnFinalizer = false;
            ComObject.LogMemoryLeakWarning = (warning) => System.Diagnostics.Trace.WriteLine(warning);

            m_uiRenderer = new ImGuiRenderer();
        }
Example #15
0
 protected override void OnKeyPress(KeyPressEventArgs e)
 {
     if (!Focused || !Visible)
     {
         return;
     }
     ImGuiRenderer.AddKeyChar(e.KeyChar);
 }
Example #16
0
        public MainForm(GameWindow gameWindow, ImGuiRenderer imGuiRenderer)
        {
            _gameWindow     = gameWindow;
            _isVSyncEnabled = _gameWindow.GraphicsDevice.SyncToVerticalBlank;
            _imGuiRenderer  = imGuiRenderer;

            _installations = GameInstallation.FindAll(GameDefinition.All).ToList();
            ChangeInstallation(_installations.FirstOrDefault());
        }
        public static void Main()
        {
            Sdl2Window window = WindowingSystem.CreateNewWindow("Veldrid test", width: 500, height: 500);

            GraphicsDeviceOptions gdOptions = new GraphicsDeviceOptions(false,
                                                                        null,
                                                                        false,
                                                                        ResourceBindingModel.Improved,
                                                                        true,
                                                                        true,
                                                                        true);

            var graphicsDevice = VeldridStartup.CreateGraphicsDevice(window, gdOptions);

            ImGuiRenderer imguiRenderer = new ImGuiRenderer(
                graphicsDevice, graphicsDevice.MainSwapchain.Framebuffer.OutputDescription,
                (int)graphicsDevice.MainSwapchain.Framebuffer.Width, (int)graphicsDevice.MainSwapchain.Framebuffer.Height);

            var cl = graphicsDevice.ResourceFactory.CreateCommandList();

            window.Resized += () => imguiRenderer.WindowResized(window.Width, window.Height);
            window.Resized += () => graphicsDevice.ResizeMainWindow((uint)window.Width, (uint)window.Height);

            ImGui.StyleColorsClassic();

            int       optimalFrameTimeMS = 16;
            bool      showMore           = false;
            Stopwatch stopwatch          = new Stopwatch();

            stopwatch.Start();
            while (window.Exists)
            {
                Thread.Sleep(optimalFrameTimeMS);

                var input = window.PumpEvents();
                if (!window.Exists)
                {
                    break;
                }
                imguiRenderer.Update((float)stopwatch.Elapsed.TotalSeconds, input);                 // Compute actual value for deltaSeconds.

                // Draw stuff
                ImGui.Begin("Hierarchy");
                {
                } ImGui.End();

                cl.Begin();
                cl.SetFramebuffer(graphicsDevice.MainSwapchain.Framebuffer);
                cl.ClearColorTarget(0, RgbaFloat.Black);
                imguiRenderer.Render(graphicsDevice, cl);
                cl.End();
                graphicsDevice.SubmitCommands(cl);
                graphicsDevice.SwapBuffers(graphicsDevice.MainSwapchain);

                stopwatch.Restart();
            }
        }
Example #18
0
        public Window()
        {
            VeldridStartup.CreateWindowAndGraphicsDevice(WindowCreateInfo, out _window, out _graphicsDevice);
            ImGuiRenderer = new ImGuiRenderer(_graphicsDevice, _graphicsDevice.SwapchainFramebuffer.OutputDescription, _window.Width, _window.Height);
            _commandList  = _graphicsDevice.ResourceFactory.CreateCommandList();
            _framebuffer  = _graphicsDevice.SwapchainFramebuffer;

            _window.Resized += () => _resized = true;
        }
Example #19
0
        protected override void Initialize()
        {
            // ....
            IsMouseVisible = true;                    // So you can see the mouse pointer over the controls
            _imGuiRenderer = new ImGuiRenderer(this); // Initialize the ImGui renderer
            _imGuiRenderer.RebuildFontAtlas();        // Required so fonts are available for rendering

            base.Initialize();
        }
Example #20
0
 public MainForm(GraphicsDevice gd, ImGuiRenderer ren)
 {
     _files           = new List <BigArchiveEntry>();
     _imguiRenderer   = ren;
     _currentFileName = null;
     _scrollY         = 0.0f;
     _graphicsDevice  = gd;
     Reset();
 }
Example #21
0
        protected override void Initialize()
        {
            _logger.Information("Initializing...");
            _imGuiRenderer = new ImGuiRenderer(this).Initialize().RebuildFontAtlas();
            ImGui.GetIO().ConfigFlags = ImGuiConfigFlags.DockingEnable;

            _logger.Information("Initializing...Done");
            base.Initialize();
        }
Example #22
0
 private void CreateImGui()
 {
     imGuiRenderer = new ImGuiRenderer(graphicsDevice,
                                       swapchain.Framebuffer.OutputDescription,
                                       window.Width,
                                       window.Height,
                                       ColorSpaceHandling.Linear);
     uiController = new ImGuiController(this);
     uiController.Initialize();
 }
Example #23
0
 public ImageInspectorWindow(ImGuiRenderer guiRenderer, ILogger logger, GraphicsDevice device, OpaqueEffect effect, PostProcessTriangle triangle, WindowService windowService)
 {
     this.GuiRenderer   = guiRenderer;
     this.Logger        = logger;
     this.Device        = device;
     this.Effect        = effect;
     this.Triangle      = triangle;
     this.WindowService = windowService;
     this.Textures      = new List <Texture2D>();
 }
Example #24
0
        public ImageView(Stream stream, GraphicsDevice gd, ImGuiRenderer renderer)
        {
            _graphicsDevice = gd;
            _imguiRenderer  = renderer;

            var imageSharpTex = new ImageSharpTexture(stream);

            _texture      = imageSharpTex.CreateDeviceTexture(_graphicsDevice, _graphicsDevice.ResourceFactory);
            _textureViews = new Dictionary <TextureViewDescription, TextureView>();
        }
Example #25
0
        protected override void LoadContentInternal(
            GraphicsDevice graphicsDevice,
            ContentManager contentManager,
            ImGuiRenderer imGuiRenderer)
        {
            _splashScreenTexture   = contentManager.Load <Texture2D>("Content/splashscreen");
            _splashScreenTextureId = imGuiRenderer.BindTexture(_splashScreenTexture);

            base.LoadContentInternal(graphicsDevice, contentManager, imGuiRenderer);
        }
Example #26
0
 private void Clear(ImGuiRenderer imGuiRenderer)
 {
     _landIdMap.Clear();
     _landNameMap.Clear();
     foreach (var(texture, texturePtr) in _landTexturesMap)
     {
         texture.Dispose();
         imGuiRenderer.UnbindTexture(texturePtr);
     }
 }
Example #27
0
        public ImGuiRenderObject()
        {
            var width  = Engine.WindowWidth;
            var height = Engine.WindowHeight;

            var graphicsDevice = Renderer.GraphicsDevice;

            _imGuiRenderer = new ImGuiRenderer(graphicsDevice, graphicsDevice.SwapchainFramebuffer.OutputDescription,
                                               width, height, ColorSpaceHandling.Linear);
        }
Example #28
0
        private VxContext(GraphicsDevice gd, Sdl2Window window)
        {
            Device  = gd;
            Window  = window;
            Factory = new DisposeCollectorResourceFactory(gd.ResourceFactory);
            _cl     = Factory.CreateCommandList();

            Window.Resized += () =>
            {
                Device.MainSwapchain.Resize((uint)Window.Width, (uint)Window.Height);
                _imguiRenderer.WindowResized(Window.Width, Window.Height);
            };

            ShaderSetDescription meshShaderSet = new ShaderSetDescription(
                new[]
            {
                new VertexLayoutDescription(
                    new VertexElementDescription("Position", VertexElementSemantic.TextureCoordinate, VertexElementFormat.Float3),
                    new VertexElementDescription("Normal", VertexElementSemantic.TextureCoordinate, VertexElementFormat.Float3))
            },
                ShaderHelpers.LoadSet(Device, Factory, "Model"));

            ResourceLayout viewProjLayout = Factory.CreateResourceLayout(new ResourceLayoutDescription(
                                                                             new ResourceLayoutElementDescription("ViewProjection", ResourceKind.UniformBuffer, ShaderStages.Vertex),
                                                                             new ResourceLayoutElementDescription("SceneInfo", ResourceKind.UniformBuffer, ShaderStages.Fragment)));
            ResourceLayout worldLayout = Factory.CreateResourceLayout(new ResourceLayoutDescription(
                                                                          new ResourceLayoutElementDescription("World", ResourceKind.UniformBuffer, ShaderStages.Vertex)));
            ResourceLayout modelParamsLayout = Factory.CreateResourceLayout(new ResourceLayoutDescription(
                                                                                new ResourceLayoutElementDescription("ModelParams", ResourceKind.UniformBuffer, ShaderStages.Fragment)));

            GraphicsPipelineDescription meshPipelineDescription = new GraphicsPipelineDescription(
                BlendStateDescription.SingleOverrideBlend,
                DepthStencilStateDescription.DepthOnlyGreaterEqual,
                RasterizerStateDescription.Default,
                PrimitiveTopology.TriangleList,
                meshShaderSet,
                new[] { viewProjLayout, worldLayout, modelParamsLayout },
                Device.MainSwapchain.Framebuffer.OutputDescription);

            _modelPipeline = Factory.CreateGraphicsPipeline(meshPipelineDescription);

            _viewProjectionBuffer = Factory.CreateBufferFor <Matrix4x4>(BufferUsage.Dynamic | BufferUsage.UniformBuffer);
            _sceneInfoBuffer      = Factory.CreateBufferFor <SceneInfo>(BufferUsage.Dynamic | BufferUsage.UniformBuffer);
            _viewProjectionSet    = Factory.CreateResourceSet(new ResourceSetDescription(viewProjLayout, _viewProjectionBuffer, _sceneInfoBuffer));

            _worldBuffer = Factory.CreateBuffer(new BufferDescription(128, BufferUsage.Dynamic | BufferUsage.UniformBuffer));
            _worldSet    = Factory.CreateResourceSet(new ResourceSetDescription(worldLayout, _worldBuffer));

            _modelParamsBuffer = Factory.CreateBufferFor <Vector4>(BufferUsage.Dynamic | BufferUsage.UniformBuffer);
            _modelParamsSet    = Factory.CreateResourceSet(new ResourceSetDescription(modelParamsLayout, _modelParamsBuffer));

            _imguiRenderer = new ImGuiRenderer(Device, Device.MainSwapchain.Framebuffer.OutputDescription, Window.Width, Window.Height);

            _sw = Stopwatch.StartNew();
        }
Example #29
0
 public override void CreateDeviceObjects(GraphicsDevice gd, CommandList cl, SceneContext sc)
 {
     if (_imguiRenderer == null)
     {
         _imguiRenderer = new ImGuiRenderer(gd, cl, gd.SwapchainFramebuffer.OutputDescription, _width, _height);
     }
     else
     {
         _imguiRenderer.CreateDeviceResources(gd, cl, gd.SwapchainFramebuffer.OutputDescription);
     }
 }
Example #30
0
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     _imGuiRenderer = new ImGuiRenderer(this);
     _imGuiRenderer.RebuildFontAtlas();
     SetupDarkStyle();
     Camera        = new PerspectiveCamera(new Vector3(-10, 5, -15), Vector3.Zero);
     _renderer     = new Renderer.Renderer(Camera);
     CurrentFolder = AppContext.BaseDirectory;
     base.Initialize();
 }