public static void Render(FMAT material)
        {
            bool edited = false;

            var renderState = material.Material.RenderState;

            if (ImGui.CollapsingHeader("Culling", ImGuiTreeNodeFlags.DefaultOpen))
            {
                edited |= ImGuiHelper.ComboFromEnum <FMAT.CullMode>("Cull Mode", material, "CullState");
            }
            if (ImGui.CollapsingHeader("Alpha Control", ImGuiTreeNodeFlags.DefaultOpen))
            {
                edited |= ImGuiHelper.ComboFromEnum <RenderStateFlagsMode>("Render State", renderState, "FlagsMode");
                edited |= ImGuiHelper.InputFromBoolean("Alpha Test Enabled", renderState.AlphaControl, "AlphaTestEnabled");
                edited |= ImGuiHelper.ComboFromEnum <GX2CompareFunction>("Depth Function", renderState.AlphaControl, "AlphaFunc");
                edited |= ImGuiHelper.InputFromFloat("Alpha Reference", renderState, "AlphaRefValue");
            }
            if (ImGui.CollapsingHeader("Blend Control", ImGuiTreeNodeFlags.DefaultOpen))
            {
                edited |= ImGuiHelper.ComboFromEnum <RenderStateFlagsBlendMode>("Blend Mode", renderState, "FlagsBlendMode");

                ImGui.LabelText("Color Calculation", CreateBlendMethod(
                                    renderState.BlendControl.ColorSourceBlend,
                                    renderState.BlendControl.ColorCombine,
                                    renderState.BlendControl.ColorDestinationBlend));

                edited |= ImGuiHelper.ComboFromEnum <GX2BlendFunction>("Color Source", renderState.BlendControl, "ColorSourceBlend");
                edited |= ImGuiHelper.ComboFromEnum <GX2BlendCombine>("Color Combine", renderState.BlendControl, "ColorCombine");
                edited |= ImGuiHelper.ComboFromEnum <GX2BlendFunction>("Color Destination", renderState.BlendControl, "ColorDestinationBlend");

                ImGui.LabelText("Alpha Calculation", CreateBlendMethod(
                                    renderState.BlendControl.AlphaSourceBlend,
                                    renderState.BlendControl.AlphaCombine,
                                    renderState.BlendControl.AlphaDestinationBlend));

                edited |= ImGuiHelper.ComboFromEnum <GX2BlendFunction>("Alpha Source", renderState.BlendControl, "AlphaSourceBlend");
                edited |= ImGuiHelper.ComboFromEnum <GX2BlendCombine>("Alpha Combine", renderState.BlendControl, "AlphaCombine");
                edited |= ImGuiHelper.ComboFromEnum <GX2BlendFunction>("Alpha Destination", renderState.BlendControl, "AlphaDestinationBlend");

                ImGuiHelper.InputFromUint("Blend Target", renderState, "BlendTarget");
            }
            if (ImGui.CollapsingHeader("Color Control", ImGuiTreeNodeFlags.DefaultOpen))
            {
                edited |= ImGuiHelper.InputFromBoolean("ColorBuffer Enabled", renderState.ColorControl, "ColorBufferEnabled");
                edited |= ImGuiHelper.InputFromBoolean("MultiWrite Enabled", renderState.ColorControl, "MultiWriteEnabled");
                edited |= ImGuiHelper.InputFromByte("Blend Enable Mask", renderState.ColorControl, "BlendEnableMask");
                edited |= ImGuiHelper.ComboFromEnum <GX2LogicOp>("Logic Op", renderState.ColorControl, "LogicOp");
            }
            if (ImGui.CollapsingHeader("Depth Control", ImGuiTreeNodeFlags.DefaultOpen))
            {
                edited |= ImGuiHelper.InputFromBoolean("Depth Test Enabled", renderState.DepthControl, "DepthTestEnabled");
                edited |= ImGuiHelper.InputFromBoolean("Depth Write Enabled", renderState.DepthControl, "DepthWriteEnabled");
                edited |= ImGuiHelper.ComboFromEnum <GX2CompareFunction>("Depth Function", renderState.DepthControl, "DepthFunc");
            }

            if (edited)
            {
                ReloadMaterial(material);
            }
        }
Пример #2
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());
        }
Пример #3
0
 void ChangeSystem()
 {
     if (sysIndex != sysIndexLoaded)
     {
         camera.UpdateProjection();
         camera.Free = false;
         camera.Zoom = 5000;
         Resources.ClearTextures();
         if (universeBackgroundTex != null)
         {
             ImGuiHelper.DeregisterTexture(universeBackgroundTex);
         }
         universeBackgroundTex = (Resources.FindTexture("fancymap.tga") as Texture2D);
         if (universeBackgroundTex != null)
         {
             universeBackgroundRegistered = ImGuiHelper.RegisterTexture(universeBackgroundTex);
         }
         else
         {
             universeBackgroundRegistered = -1;
         }
         curSystem      = GameData.GetSystem(systems[sysIndex]);
         systemInfocard = GameData.GetInfocard(curSystem.Infocard, fontMan);
         if (icard != null)
         {
             icard.SetInfocard(systemInfocard);
         }
         GameData.LoadAllSystem(curSystem);
         world.LoadSystem(curSystem, Resources);
         systemMap.SetObjects(curSystem);
         sysIndexLoaded = sysIndex;
     }
 }
Пример #4
0
        void OnLoadComplete()
        {
            systemMap.CreateContext(this);
            fontMan.LoadFontsFromGameData(GameData);
            camera      = new DebugCamera(new Rectangle(0, 0, Width, Height));
            camera.Zoom = 5000;
            camera.UpdateProjection();
            var renderer = new SystemRenderer(camera, GameData, Resources, this);

            world   = new GameWorld(renderer);
            systems = GameData.ListSystems().OrderBy(x => x).ToArray();
            Resources.ClearTextures();
            string navPrettyMap;

            if ((navPrettyMap = GameData.VFS.Resolve(GameData.Ini.Freelancer.DataPath + "INTERFACE/NEURONET/NAVMAP/NEWNAVMAP/nav_prettymap.3db", false)) !=
                null)
            {
                Resources.LoadResourceFile(navPrettyMap);
            }
            universeBackgroundTex = (Resources.FindTexture("fancymap.tga") as Texture2D);
            if (universeBackgroundTex != null)
            {
                universeBackgroundRegistered = ImGuiHelper.RegisterTexture(universeBackgroundTex);
            }
            else
            {
                universeBackgroundRegistered = -1;
            }
            curSystem      = GameData.GetSystem(systems[0]);
            systemInfocard = GameData.GetInfocard(curSystem.Infocard, fontMan);
            GameData.LoadAllSystem(curSystem);
            world.LoadSystem(curSystem, Resources, false);
            systemMap.SetObjects(curSystem);
        }
Пример #5
0
        private void DrawExamplesWindow(int myParam)
        {
            var myLocalVariable = 100;

            Console.WriteLine(myLocalVariable + myParam);

            ImGui.Begin("Examples");

            if (ImGuiHelper.Button("None", _currentExample != null))
            {
                _currentExample?.Unload();
                _currentExample = null;
            }

            ImGui.Separator();

            for (int i = 0; i < _examples.Count; i++)
            {
                var example = _examples[i];
                var enabled = _currentExample != example;

                if (ImGuiHelper.Button(example.Name, enabled) && enabled)
                {
                    _currentExample?.Unload();
                    _currentExample = example;
                    _currentExample.InitializeImpl();
                }
            }

            ImGui.End();
        }
        static void LoadProperties(TexSampler sampler)
        {
            var flags = ImGuiTreeNodeFlags.DefaultOpen;

            if (ImGui.CollapsingHeader("Wrap Mode", flags))
            {
                ImGuiHelper.ComboFromEnum <GX2TexClamp>("Wrap X", sampler, "ClampX");
                ImGuiHelper.ComboFromEnum <GX2TexClamp>("Wrap Y", sampler, "ClampY");
                ImGuiHelper.ComboFromEnum <GX2TexClamp>("Wrap Z", sampler, "ClampZ");
            }
            if (ImGui.CollapsingHeader("Filter", flags))
            {
                ImGuiHelper.ComboFromEnum <GX2TexXYFilterType>("Mag Filter", sampler, "MagFilter");
                ImGuiHelper.ComboFromEnum <GX2TexXYFilterType>("Min Filter", sampler, "MinFilter");
                ImGuiHelper.ComboFromEnum <GX2TexZFilterType>("Z Filter", sampler, "ZFilter");
                ImGuiHelper.ComboFromEnum <GX2TexMipFilterType>("Mip Filter", sampler, "MipFilter");
                ImGuiHelper.ComboFromEnum <GX2TexAnisoRatio>("Anisotropic Ratio", sampler, "MaxAnisotropicRatio");
            }
            if (ImGui.CollapsingHeader("Mip LOD", flags))
            {
                ImGuiHelper.InputFromFloat("Lod Min", sampler, "MinLod", false, 1);
                ImGuiHelper.InputFromFloat("Lod Max", sampler, "MaxLod", false, 1);
                ImGuiHelper.InputFromFloat("Lod Bias", sampler, "LodBias", false, 1);
            }
            if (ImGui.CollapsingHeader("Depth", flags))
            {
                ImGuiHelper.InputFromBoolean("Depth Enabled", sampler, "DepthCompareEnabled");
                ImGuiHelper.ComboFromEnum <GX2CompareFunction>("Depth Compare", sampler, "DepthCompareFunc");
            }
            if (ImGui.CollapsingHeader("Border", flags))
            {
                ImGuiHelper.ComboFromEnum <GX2TexBorderType>("Border Type", sampler, "BorderType");
            }
        }
Пример #7
0
        public void Render(FSHP shape)
        {
            var model = shape.ParentModel;

            if (ImGui.CollapsingHeader("Shape Info", ImGuiTreeNodeFlags.DefaultOpen))
            {
                ImGuiHelper.InputFromText("Name", shape, "Name", 200);

                //Doesn't need a direct property bind as property is readonly
                var skinCount = (int)shape.VertexSkinCount;
                ImGui.InputInt("Vertex Skin Count", ref skinCount, 0, 0, ImGuiInputTextFlags.ReadOnly);
                LoadLODSelector(shape);
            }
            if (ImGui.CollapsingHeader("Material Info", ImGuiTreeNodeFlags.DefaultOpen))
            {
                LoadMaterialSelector(model, shape);
            }
            if (ImGui.CollapsingHeader("Bone Info", ImGuiTreeNodeFlags.DefaultOpen))
            {
                LoadBoneSelector(model, shape);
            }
            if (ImGui.CollapsingHeader("Vertex Buffer Info", ImGuiTreeNodeFlags.DefaultOpen))
            {
            }
            if (ImGui.CollapsingHeader("LOD Info"))
            {
            }
            if (ImGui.CollapsingHeader("Shape Morph Info"))
            {
            }
        }
Пример #8
0
 public DebugView(FreelancerGame game)
 {
     this.game               = game;
     igrender                = new ImGuiHelper(game, 1f);
     igrender.SetCursor      = false;
     igrender.HandleKeyboard = false;
 }
Пример #9
0
 protected override void Load()
 {
     Title = "Thn Player";
     LibreLancer.Shaders.AllShaders.Compile();
     guiHelper = new ImGuiHelper(this);
     FileDialog.RegisterParent(this);
     Viewport = new ViewportManager(this.RenderState);
     Viewport.Push(0, 0, 800, 600);
     Billboards = new Billboards();
     Nebulae    = new NebulaVertices();
     Resources  = new GameResourceManager(this);
     Renderer2D = new Renderer2D(this.RenderState);
     Audio      = new AudioManager(this);
     Sounds     = new SoundManager(Audio);
     Services.Add(Sounds);
     Services.Add(Billboards);
     Services.Add(Nebulae);
     Services.Add(Resources);
     Services.Add(Renderer2D);
     fontMan = new FontManager();
     fontMan.ConstructDefaultFonts();
     Services.Add(fontMan);
     Services.Add(new GameConfig());
     Typewriter = new Typewriter(this);
     Services.Add(Typewriter);
     Keyboard.KeyDown += KeyboardOnKeyDown;
 }
        void OnLoadComplete()
        {
            fontMan.LoadFontsFromGameData(GameData);
            camera      = new DebugCamera(new Viewport(0, 0, Width, Height));
            camera.Zoom = 5000;
            camera.UpdateProjection();
            var renderer = new SystemRenderer(camera, GameData, Resources, this);

            world   = new GameWorld(renderer);
            systems = GameData.ListSystems().OrderBy(x => x).ToArray();
            Resources.ClearTextures();
            Resources.LoadResourceFile(GameData.ResolveDataPath("INTERFACE/NEURONET/NAVMAP/NEWNAVMAP/nav_prettymap.3db"));
            universeBackgroundTex = (Resources.FindTexture("fancymap.tga") as Texture2D);
            if (universeBackgroundTex != null)
            {
                universeBackgroundRegistered = ImGuiHelper.RegisterTexture(universeBackgroundTex);
            }
            else
            {
                universeBackgroundRegistered = -1;
            }
            curSystem      = GameData.GetSystem(systems[0]);
            systemInfocard = GameData.GetInfocard(curSystem.Infocard, fontMan);
            GameData.LoadAllSystem(curSystem);
            world.LoadSystem(curSystem, Resources);
        }
Пример #11
0
 public override void Dispose()
 {
     if (renderTarget != null)
     {
         ImGuiHelper.DeregisterTexture(renderTarget.Texture);
         renderTarget.Dispose();
     }
     xmlEditor.Dispose();
 }
Пример #12
0
        public override void RenderNative()
        {
            ImGuiHelper.Begin();
            RenderGui();
            ImGuiHelper.End();

            Graphics.Batch.Begin();
            Graphics.Batch.DrawCircle(new CircleF(Mouse.GetState().Position, 3f), 8, Color.White);
            Graphics.Batch.End();
        }
        public static bool RenderProperies(AmbientLight ambLight, string id)
        {
            bool edited = false;

            edited |= ImGuiHelper.InputFromBoolean($"Enable{id}", ambLight, "Enable");

            edited |= EditColor($"Color", $"{id}_0", ambLight, "Color");
            edited |= ImGuiHelper.InputFromFloat($"Intensity{id}", ambLight, "Intensity");

            return(edited);
        }
Пример #14
0
        private void LoadLightingUI(LightingObj lighting)
        {
            var colorFlags = ImGuiColorEditFlags.HDR | ImGuiColorEditFlags.Float;

            ImGuiHelper.InputTKVector4Color4("Upper Color", lighting, "ColorHemiUpper", colorFlags);
            ImGuiHelper.InputTKVector4Color4("Lower Color", lighting, "ColorHemiLower", colorFlags);
            ImGuiHelper.InputTKVector4Color4("Direction Color", lighting, "DirectionalColor", colorFlags);
            ImGuiHelper.InputTKVector3("Direction", lighting, "Direction");
            ImGuiHelper.InputFromFloat("Lower Angle", lighting, "ColorHemiLowerMaxRotDegrees");
            ImGuiHelper.InputFromFloat("Upper Angle", lighting, "ColorHemiUpperMaxRotDegrees");
        }
Пример #15
0
        public override void Render(float time, float deltaTime)
        {
            RenderContext.Clear(_clearColor);

            ImGuiHelper.BeginGlobalDocking();

            _currentExample?.Render(time, deltaTime);

            DrawExamplesWindow();

            DrawMainMenuBar();
        }
Пример #16
0
        public override void RenderNative()
        {
            ImGuiHelper.Begin();
            Editor.Render();
            Console.Render();
            WindowManager.Render(Area);
            ImGuiHelper.End();

            Graphics.Batch.Begin();
            Graphics.Batch.DrawCircle(new CircleF(Mouse.GetState().Position, 3f), 8, Color.White);
            Graphics.Batch.End();
        }
Пример #17
0
 protected override void Load()
 {
     Title     = "InterfaceEdit";
     guiHelper = new ImGuiHelper(this);
     FileDialog.RegisterParent(this);
     Renderer2D = new Renderer2D(RenderState);
     Services.Add(Renderer2D);
     Viewport = new ViewportManager(RenderState);
     Viewport.Push(0, 0, Width, Height);
     new MaterialMap();
     Fonts = new FontManager();
 }
Пример #18
0
        public override void Render(float time, float deltaTime)
        {
            RenderContext.Clear(Color.CornflowerBlue);

            ImGuiHelper.BeginGlobalDocking(false);

            ImGui.Begin("Viewport");

            ImGui.End();

            ImGui.ShowMetricsWindow();
        }
Пример #19
0
        public override void Initialize()
        {
            base.Initialize();

            _roboto = new Font(RenderContext, "./Assets/Fonts/Roboto-Medium.ttf", 48);

            _textureHandle = ImGuiHelper.BindTexture(_roboto.FontAtlas);

            _shaderProgram = AssetManager.Load <ShaderProgram>("./Shaders/text.json", true);

            _spriteBatch = new SpriteBatch(RenderContext);

            Window.Maximize();
        }
Пример #20
0
        public static void LoadCurrent()
        {
            if (files.Length == 0)
            {
                return;
            }

            try {
                ImGuiHelper.ClearNodes();
                var name = files[current];
                LoadFromRoot(name, JsonValue.Parse(FileHandle.FromRoot($"Dialogs/{name}.json").ReadAll()));
            } catch (Exception e) {
                Log.Error(e);
            }
        }
        public static bool RenderProperies(HemisphereLight hemi, string id)
        {
            bool edited = false;

            edited |= ImGuiHelper.InputFromBoolean($"Enable{id}", hemi, "Enable");

            edited |= EditColor($"Sky Color", $"{id}_0", hemi, "SkyColor");
            edited |= EditColor($"Ground Color", $"{id}_1", hemi, "GroundColor");

            edited |= ImGuiHelper.InputFromFloat($"Intensity{id}", hemi, "Intensity");

            edited |= EditVector3($"Direction{id}", hemi, "Direction");

            return(edited);
        }
        public static bool RenderProperies(DirectionalLight dirLight, string id)
        {
            bool edited = false;

            edited |= ImGuiHelper.InputFromBoolean($"Enable{id}", dirLight, "Enable");

            edited |= EditColor($"Diffuse Color", $"{id}_0", dirLight, "DiffuseColor");
            edited |= EditColor($"Backside Color", $"{id}_1", dirLight, "BacksideColor");

            edited |= ImGuiHelper.InputFromFloat($"Intensity{id}", dirLight, "Intensity");

            edited |= EditVector3($"Direction{id}", dirLight, "Direction");

            return(edited);
        }
Пример #23
0
        public static void RenderParamEditor(BfresMaterialAnim anim,
                                             BfresMaterialAnim.ParamAnimGroup paramGroup)
        {
            if (ImGui.CollapsingHeader("Track Data", ImGuiTreeNodeFlags.DefaultOpen))
            {
                ImGuiHelper.ComboFromEnum <BfresLibrary.ShaderParamType>("Param Type", ParamProperty, "ParamType");

                ImGui.Checkbox("Show Full Interpolation", ref showInterpolated);

                if (ParamProperty.ParamType == ShaderParamType.Float3 ||
                    ParamProperty.ParamType == ShaderParamType.Float4)
                {
                    ImGui.Checkbox("Is Color", ref isColor);
                }
            }
            RenderColorParamEditor(anim, paramGroup);
        }
Пример #24
0
        public void Draw(float width)
        {
            icard.Recalculate(width);
            if (icard.Height < 1 || width < 1)
            {
                ImGui.Dummy(new Vector2(1, 1));
                return;
            }
            if (icard.Height != renderHeight || (int)width != renderWidth)
            {
                renderWidth  = (int)width;
                renderHeight = (int)icard.Height;
                if (renderTarget != null)
                {
                    ImGuiHelper.DeregisterTexture(renderTarget.Texture);
                    renderTarget.Dispose();
                }
                renderTarget = new RenderTarget2D(renderWidth, renderHeight);
                rid          = ImGuiHelper.RegisterTexture(renderTarget.Texture);
            }

            window.RenderContext.RenderTarget = renderTarget;
            window.RenderContext.PushViewport(0, 0, renderWidth, renderHeight);
            var cc = window.RenderContext.ClearColor;

            window.RenderContext.ClearColor = Color4.Transparent;
            window.RenderContext.ClearAll();
            window.RenderContext.ClearColor = cc;
            window.RichText.RenderText(icard, 0, 0);
            window.RenderContext.RenderTarget = null;
            window.RenderContext.PopViewport();

            //ImGui. Base off ImageButton so we can get input for selection later
            var style = ImGui.GetStyle();
            var btn   = style.Colors[(int)ImGuiCol.Button];

            ImGui.PushStyleColor(ImGuiCol.ButtonHovered, btn);
            ImGui.PushStyleColor(ImGuiCol.ButtonActive, btn);
            ImGui.ImageButton((IntPtr)rid, new Vector2(renderWidth, icard.Height),
                              new Vector2(0, 1), new Vector2(1, 0),
                              0,
                              Vector4.Zero, Vector4.One);
            ImGui.PopStyleColor();
            ImGui.PopStyleColor();
            //Somehow keep track of selection? (idk if InfocardDisplay should do this)
        }
Пример #25
0
        public void Draw(int width, int height)
        {
            //Set viewport
            height -= 30;
            if (width <= 0)
            {
                width = 1;
            }
            if (height <= 0)
            {
                height = 1;
            }
            if (width != rw || height != rh)
            {
                if (rtarget != null)
                {
                    ImGuiHelper.DeregisterTexture(rtarget.Texture);
                    rtarget.Dispose();
                }
                rtarget = new RenderTarget2D(width, height);
                rw      = width;
                rh      = height;
                rt      = ImGuiHelper.RegisterTexture(rtarget.Texture);
            }
            //Draw
            win.Viewport.Push(0, 0, width, height);
            ctx.ViewportWidth            = width;
            ctx.ViewportHeight           = height;
            ctx.RenderState.RenderTarget = rtarget;
            ctx.RenderState.ClearColor   = Color4.TransparentBlack;
            ctx.RenderState.ClearAll();
            ctx.RenderWidget();
            ctx.RenderState.RenderTarget = null;
            win.Viewport.Pop();
            //ImGui
            ImGui.Button("x##a");
            ImGui.SameLine();
            ImGui.Button("x##b");
            var cpos = ImGui.GetCursorPos();

            ImGui.Image((IntPtr)rt, new Vector2(width, height), new Vector2(0, 1), new Vector2(1, 0),
                        Color4.White);
            ImGui.SetCursorPos(cpos);
            ImGui.InvisibleButton("##navmap", new Vector2(width, height));
        }
Пример #26
0
        protected override void Load()
        {
            Title     = "System Viewer";
            guiHelper = new ImGuiHelper(this);
            FileDialog.RegisterParent(this);
            Viewport = new ViewportManager(this.RenderState);
            Viewport.Push(0, 0, 800, 600);
            Billboards = new Billboards();
            Nebulae    = new NebulaVertices();
            Resources  = new ResourceManager(this);
            Renderer2D = new Renderer2D(this.RenderState);

            Services.Add(Billboards);
            Services.Add(Nebulae);
            Services.Add(Resources);
            Services.Add(Renderer2D);
            Services.Add(new GameConfig());
        }
        static void SelectSampler(FMAT material, UVViewport UVViewport, int index, bool onLoad)
        {
            var materialData = material.Material;

            var sampler   = materialData.Samplers[index].TexSampler;
            var texMapSel = materialData.TextureRefs[index];

            //Texture map info
            if (ImGui.CollapsingHeader("Texture Info", ImGuiTreeNodeFlags.DefaultOpen))
            {
                ImGuiHelper.InputFromText("Name", texMapSel, "Name", 200);
            }

            var width = ImGui.GetWindowWidth();

            //A UV preview window drawn using opengl
            if (ImGui.CollapsingHeader("Preview", ImGuiTreeNodeFlags.DefaultOpen))
            {
                if (ImGui.BeginChild("uv_viewport1", new Vector2(width, 150)))
                {
                    if (onLoad)
                    {
                        var meshes = material.GetMappedMeshes();

                        UVViewport.ActiveObjects.Clear();
                        foreach (FSHP mesh in meshes)
                        {
                            UVViewport.ActiveObjects.Add(mesh);
                        }
                    }

                    UVViewport.ActiveTextureMap = material.TextureMaps[index];
                    UVViewport.Render((int)width, 150);
                }
                ImGui.EndChild();
            }

            if (ImGui.BeginChild("sampler_properties"))
            {
                LoadProperties(sampler);
                material.ReloadTextureMap(index);
                ImGui.EndChild();
            }
        }
Пример #28
0
 protected override void Load()
 {
     Title     = "InterfaceEdit";
     TestApi   = new TestingApi(this);
     guiHelper = new ImGuiHelper(this, DpiScale);
     FileDialog.RegisterParent(this);
     RenderContext.PushViewport(0, 0, Width, Height);
     new MaterialMap();
     Fonts = new FontManager();
     LibreLancer.Shaders.AllShaders.Compile();
     Keyboard.KeyDown += args =>
     {
         if (playing && args.Key == Keys.F1)
         {
             _playContext.Event("Pause");
         }
     };
     CommandBuffer = new CommandBuffer();
 }
Пример #29
0
        public void Draw(float width)
        {
            icard.SetRectangle(new Rectangle(0, 0, (int)width, int.MaxValue));

            if (icard.Height != renderHeight || (int)width != renderWidth)
            {
                renderWidth  = (int)width;
                renderHeight = (int)icard.Height;
                if (renderTarget != null)
                {
                    ImGuiHelper.DeregisterTexture(renderTarget);
                    renderTarget.Dispose();
                }
                renderTarget = new RenderTarget2D(renderWidth, renderHeight);
                rid          = ImGuiHelper.RegisterTexture(renderTarget);
            }
            renderTarget.BindFramebuffer();
            window.Viewport.Push(0, 0, renderWidth, renderHeight);
            var cc = window.RenderState.ClearColor;

            window.RenderState.ClearColor = Color4.Transparent;
            window.RenderState.ClearAll();
            window.RenderState.ClearColor = cc;
            window.Renderer2D.Start(renderWidth, renderHeight);
            icard.Draw(window.Renderer2D);
            window.Renderer2D.Finish();
            RenderTarget2D.ClearBinding();
            window.Viewport.Pop();

            //ImGui. Base off ImageButton so we can get input for selection later
            var style = ImGui.GetStyle();
            var btn   = style.Colors[(int)ImGuiCol.Button];

            ImGui.PushStyleColor(ImGuiCol.ButtonHovered, btn);
            ImGui.PushStyleColor(ImGuiCol.ButtonActive, btn);
            ImGui.ImageButton((IntPtr)rid, new Vector2(renderWidth, icard.Height),
                              new Vector2(0, 1), new Vector2(1, 0),
                              0,
                              Vector4.Zero, Vector4.One);
            ImGui.PopStyleColor();
            ImGui.PopStyleColor();
            //Somehow keep track of selection? (idk if InfocardDisplay should do this)
        }
Пример #30
0
 protected override void Load()
 {
     Title = "System Viewer";
     LibreLancer.Shaders.AllShaders.Compile();
     guiHelper = new ImGuiHelper(this, DpiScale);
     FileDialog.RegisterParent(this);
     RenderContext.PushViewport(0, 0, 800, 600);
     Billboards = new Billboards();
     Nebulae    = new NebulaVertices();
     Resources  = new GameResourceManager(this);
     RichText   = RenderContext.Renderer2D.CreateRichTextEngine();
     Services.Add(Billboards);
     Services.Add(Nebulae);
     Services.Add(Resources);
     fontMan = new FontManager();
     fontMan.ConstructDefaultFonts();
     Services.Add(fontMan);
     Services.Add(new GameConfig());
 }