예제 #1
0
        public void draw()
        {
            updatePostProcessorInspectorList();

            ImGui.Indent();
            for (var i = 0; i < _postProcessorInspectors.Count; i++)
            {
                if (_postProcessorInspectors[i].postProcessor._scene != null)
                {
                    _postProcessorInspectors[i].draw();
                    NezImGui.SmallVerticalSpace();
                }
            }

            if (_postProcessorInspectors.Count == 0)
            {
                NezImGui.SmallVerticalSpace();
            }

            if (NezImGui.CenteredButton("Add PostProcessor", 0.6f))
            {
                ImGui.OpenPopup("postprocessor-selector");
            }

            ImGui.Unindent();

            NezImGui.MediumVerticalSpace();
            drawPostProcessorSelectorPopup();
        }
예제 #2
0
        public unsafe void Draw()
        {
            if (Core.Scene.Entities.Count > MIN_ENTITIES_FOR_CLIPPER)
            {
                ImGuiListClipper *  clipperPtr = ImGuiNative.ImGuiListClipper_ImGuiListClipper(Core.Scene.Entities.Count, -1);
                ImGuiListClipperPtr clipper    = new ImGuiListClipperPtr(clipperPtr);

                while (clipper.Step())
                {
                    for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
                    {
                        DrawEntity(Core.Scene.Entities[i]);
                    }
                }

                ImGuiNative.ImGuiListClipper_destroy(clipperPtr);
            }
            else
            {
                for (int i = 0; i < Core.Scene.Entities.Count; i++)
                {
                    DrawEntity(Core.Scene.Entities[i]);
                }
            }

            NezImGui.MediumVerticalSpace();
            if (NezImGui.CenteredButton("Create Entity", 0.6f))
            {
                ImGui.OpenPopup("create-entity");
            }

            DrawCreateEntityPopup();
        }
 private void DrawNullMaterial()
 {
     if (NezImGui.CenteredButton("Create Material", 0.5f, ImGui.GetStyle().IndentSpacing * 0.5f))
     {
         Material material = new Material();
         SetValue(material);
         _inspectors = TypeInspectorUtils.GetInspectableProperties(material);
     }
 }
예제 #4
0
        public void Draw()
        {
            for (var i = 0; i < Core.Scene.Entities.Count; i++)
            {
                DrawEntity(Core.Scene.Entities[i]);
            }

            NezImGui.MediumVerticalSpace();
            if (NezImGui.CenteredButton("Create Entity", 0.6f))
            {
                ImGui.OpenPopup("create-entity");
            }

            DrawCreateEntityPopup();
        }
        public override void DrawMutable()
        {
            bool isOpen = ImGui.CollapsingHeader($"{_name}", ImGuiTreeNodeFlags.FramePadding);

            if (GetValue() == null)
            {
                if (isOpen)
                {
                    DrawNullMaterial();
                }

                return;
            }

            NezImGui.ShowContextMenuTooltip();

            if (ImGui.BeginPopupContextItem())
            {
                if (AllowsMaterialRemoval && ImGui.Selectable("Remove Material"))
                {
                    SetValue(null);
                    _inspectors.Clear();
                    ImGui.CloseCurrentPopup();
                }

                if (ImGui.Selectable("Set Effect", false, ImGuiSelectableFlags.DontClosePopups))
                {
                    ImGui.OpenPopup("effect-chooser");
                }

                ImGui.EndPopup();
            }

            if (isOpen)
            {
                ImGui.Indent();

                if (_inspectors.Count == 0)
                {
                    if (NezImGui.CenteredButton("Set Effect", 0.6f))
                    {
                        ImGui.OpenPopup("effect-chooser");
                    }
                }

                for (int i = _inspectors.Count - 1; i >= 0; i--)
                {
                    if (_inspectors[i].IsTargetDestroyed)
                    {
                        _inspectors.RemoveAt(i);
                        continue;
                    }

                    _inspectors[i].Draw();
                }

                ImGui.Unindent();
            }

            if (DrawEffectChooserPopup())
            {
                ImGui.CloseCurrentPopup();
            }
        }