Ejemplo n.º 1
0
        public VirtualTextureSceneViewLink(OgreModelEditorController controller)
        {
            this.controller = controller;

            cameraLink = new CameraLink(controller.SceneViewController);

            CompressedTextureSupport textureFormat = OgreInterface.Instance.SelectedTextureFormat;

            virtualTextureManager = new VirtualTextureManager(UnifiedMaterialBuilder.GetNumCompressedTexturesNeeded(textureFormat), new IntSize2(4096, 4096), 128, 4096, textureFormat, 10, new IntSize2(256, 128), 100 * 1024 * 1024, UnifiedMaterialBuilder.AreTexturesPagedOnDisk(textureFormat));

            materialBuilder = new UnifiedMaterialBuilder(virtualTextureManager, OgreInterface.Instance.SelectedTextureFormat, controller.PluginManager.createLiveResourceManager("UnifiedShaders"));
            OgreInterface.Instance.MaterialParser.addMaterialBuilder(materialBuilder);
        }
Ejemplo n.º 2
0
        public MaterialController(OgreModelEditorController controller)
        {
            this.controller = controller;

            editInterface = ReflectedEditInterface.createEditInterface(this, "Materials");
            editInterface.addCommand(new EditInterfaceCommand("Add", () =>
            {
                createMaterial("NewMaterial");
            }));
            var descriptionManager = editInterface.createEditInterfaceManager <MaterialDescription>(i => i.getEditInterface());

            descriptionManager.addCommand(new EditInterfaceCommand("Remove", cb =>
            {
                var desc = descriptionManager.resolveSourceObject(cb.getSelectedEditInterface());
                removeMaterial(desc);
            }));
        }
Ejemplo n.º 3
0
        public override bool OnInit()
        {
            String defaultModel = null;

            String[] commandLine = Environment.GetCommandLineArgs();
            if (commandLine.Length > 1)
            {
                String file = commandLine[1];
                if (File.Exists(file) && file.EndsWith(".mesh"))
                {
                    defaultModel = file;
                }
            }

            controller = new OgreModelEditorController(this, defaultModel);

            return(true);
        }
Ejemplo n.º 4
0
        public OgreModelEditorMain(OgreModelEditorController controller)
            : base("OgreModelEditor.GUI.Main.OgreModelEditorMain.layout")
        {
            this.controller = controller;
            LayoutContainer = new MyGUISingleChildLayoutContainer(widget);

            MenuBar menuBar = widget.findWidget("MenuBar") as MenuBar;

            menuBar.AutoAcceptRunAction = true;
            MenuItem    fileItem = menuBar.addItem("File", MenuItemType.Popup);
            MenuControl file     = menuBar.createItemPopupMenuChild(fileItem);

            file.addItemAction("Open", open);
            file.addItemAction("Save", save);
            file.addItemAction("Save As", saveAs);
            file.addItemAction("Save Materials", controller.saveMaterials);
            file.addItemAction("Batch Upgrade", batchUpgrade);
            file.addItemAction("Export to JSON", exportToJson);
            MenuItem exit = file.addItemAction("Exit", controller.exit);

            MenuItem    resourcesItem = menuBar.addItem("Resources", MenuItemType.Popup);
            MenuControl resources     = menuBar.createItemPopupMenuChild(resourcesItem);

            resources.addItemAction("Reload All (F5)", reloadAll);
            resources.addItemAction("Delete Shader Microcode Cache", controller.clearMicrocodeCache);
            saveMicrocode          = resources.addItemAction("Save Shader Microcode Cache", changeSaveMicrocode);
            saveMicrocode.Selected = OgreConfig.SaveMicrocodeCache;

            MenuItem    debugItem = menuBar.addItem("Debug", MenuItemType.Popup);
            MenuControl debug     = menuBar.createItemPopupMenuChild(debugItem);

            debug.addItemAction("View Shaded (F1)", viewShaded);
            debug.addItemAction("View Binormals (F2)", viewBinormals);
            debug.addItemAction("View Tangents (F3)", viewTangents);
            debug.addItemAction("View Normals (F4)", viewNormals);
            debug.addItemAction("View Parity", controller.setParityDebug);
            MenuItem viewTexture = debug.addItem("View Texture", MenuItemType.Popup);

            textureMenu  = debug.createItemPopupMenuChild(viewTexture);
            showSkeleton = debug.addItemAction("Show Skeleton", changeShowSkeleton);
            debug.addItemAction("Show Virtual Texture Debugger", controller.showVirtualTextureDebugger);

            MenuItem    modelItem = menuBar.addItem("Model", MenuItemType.Popup);
            MenuControl model     = menuBar.createItemPopupMenuChild(modelItem);

            model.addItemAction("Recalculate Tangents", recalculateTangents);
            model.addItemAction("Invert Tangent W", controller.inverseTangentW);
            model.addItemAction("Calculate Volume", controller.calculateVolume);

            MenuItem    texturesItem = menuBar.addItem("Textures", MenuItemType.Popup);
            MenuControl textures     = menuBar.createItemPopupMenuChild(texturesItem);

            textures.addItemAction("Compile Textures", controller.compileTextures);

            MenuItem    windowItem = menuBar.addItem("Window", MenuItemType.Popup);
            MenuControl window     = menuBar.createItemPopupMenuChild(windowItem);

            showStats          = window.addItemAction("Show Stats", changeShowStats);
            showStats.Selected = controller.ShowStats;
            MenuItem    layoutItem = window.addItem("Layout", MenuItemType.Popup);
            MenuControl layout     = window.createItemPopupMenuChild(layoutItem);

            layout.addItemAction("One Window", oneWindow);
            layout.addItemAction("Two Window", twoWindow);
            layout.addItemAction("Three Window", threeWindow);
            layout.addItemAction("Four Window", fourWindow);
            MenuItem    renderingModeItem = window.addItem("Rendering Mode", MenuItemType.Popup);
            MenuControl renderingMode     = window.createItemPopupMenuChild(renderingModeItem);

            renderingMode.addItemAction("Solid (F6)", setSolid);
            renderingMode.addItemAction("Wireframe (F7)", setWireframe);
            renderingMode.addItemAction("Point (F8)", setPoints);
            window.addItemAction("Change Background Color", changeBackgroundColor);
            MenuItem    rendererItem = window.addItem("Renderer", MenuItemType.Popup);
            MenuControl renderer     = window.createItemPopupMenuChild(rendererItem);

            defaultRenderer   = renderer.addItemAction("Default", () => setRenderer(RenderSystemType.Default));
            d3d11Renderer     = renderer.addItemAction("DirectX 11", () => setRenderer(RenderSystemType.D3D11));
            openGLRenderer    = renderer.addItemAction("OpenGL", () => setRenderer(RenderSystemType.OpenGL));
            openGLES2Renderer = renderer.addItemAction("OpenGLES2", () => setRenderer(RenderSystemType.OpenGLES2));

            //Buttons
            ButtonGroup toolButtons = new ButtonGroup();
            Button      none        = widget.findWidget("None") as Button;

            none.MouseButtonClick += none_MouseButtonClick;
            toolButtons.addButton(none);

            Button move = widget.findWidget("Move") as Button;

            move.MouseButtonClick += move_MouseButtonClick;
            toolButtons.addButton(move);

            Button rotate = widget.findWidget("Rotate") as Button;

            rotate.MouseButtonClick += rotate_MouseButtonClick;
            toolButtons.addButton(rotate);

            showBiNormalShortcut.FirstFrameUpEvent  += layer => viewBinormals();
            showTangentShortcut.FirstFrameUpEvent   += layer => viewTangents();
            showNormalShortcut.FirstFrameUpEvent    += layer => viewNormals();
            showShadedShortcut.FirstFrameUpEvent    += layer => viewShaded();
            refreshShortcut.FirstFrameUpEvent       += layer => reloadAll();
            showSolidShortcut.FirstFrameUpEvent     += layer => setSolid();
            showWireframeShortcut.FirstFrameUpEvent += layer => setWireframe();
            showPointShortcut.FirstFrameUpEvent     += layer => setPoints();

            setSelectedRenderer();
        }