Example #1
0
        private Area Operations()
        {
            Button expand = new Button(renderer, "Operations");

            expand.Action = TogglePopup;

            MenuList list  = new MenuList(renderer, Orientation.Vertical);
            Popup    popup = new Popup(expand, list);

            Button collapse = new Button(renderer, "Operations");

            collapse.Action = TogglePopup;
            collapse.Link   = popup;

            Button merge       = new Button(renderer, "Merge");
            Button delete      = new Button(renderer, "Delete");
            Button truncate    = new Button(renderer, "Truncate");
            Button triangulate = new Button(renderer, "Triangulate");
            Button subdivide   = new Button(renderer, "Subdivide");
            Button sqrt3       = new Button(renderer, "Sqrt(3)");
            Button catmull     = new Button(renderer, "Catmull-Clark");
            Button smooth      = new Button(renderer, "Smooth Normals");
            Button flat        = new Button(renderer, "Flat Normals");
            Button undo        = new Button(renderer, "Undo");
            Button redo        = new Button(renderer, "Redo");

            list.Add(collapse);
            list.Add(undo);
            list.Add(redo);
            list.Add(merge);
            list.Add(delete);
            list.Add(smooth);
            list.Add(flat);
            list.Add(truncate);
            list.Add(triangulate);
            list.Add(subdivide);
            list.Add(sqrt3);
            list.Add(catmull);

            expand.Link = popup;
            return(popup);
        }
Example #2
0
        private Area Scene()
        {
            Button expand = new Button(renderer, "Scene");

            expand.Name   = "expand";
            expand.Action = TogglePopup;

            MenuList list  = new MenuList(renderer, Orientation.Vertical);
            Popup    popup = new Popup(expand, list);

            list.Name             = "list";
            list.ChildLayoutStyle = Area.AreaLayoutStyle.ExtendHorizontal;
            popup.Name            = "popup";

            Button collapse = new Button(renderer, "Scene");

            collapse.Action = TogglePopup;
            collapse.Link   = popup;
            collapse.Name   = "collapse";
            list.Add(collapse);

            list.ChildLayoutStyle = Area.AreaLayoutStyle.ExtendHorizontal;

            {
                Choice choice = new Choice(Orientation.Horizontal);
                choice.Name  = "Scene choice";
                choice.Style = Style.NullPadding;
                choice.Add(new ChoiceItem(renderer, "Simple"));
                choice.Add(new ChoiceItem(renderer, "Polyhedra"));
                choice.Add(new ChoiceItem(renderer, "Spheres"));
                //choice.Action = SceneChoiceAction;
                choice.Selected = choice.Items.First();
                list.Add(choice);
            }

            expand.Link = popup;
            popup.Set(false);

            return(popup);
        }
Example #3
0
        private Area Materials()
        {
            if (materialManager == null)
            {
                return(null);
            }

            Button expand = new Button(renderer, "Materials");

            expand.Action = TogglePopup;

            MenuList list  = new MenuList(renderer, Orientation.Vertical);
            Popup    popup = new Popup(expand, list);

            Button collapse = new Button(renderer, "Materials");

            collapse.Action = TogglePopup;
            collapse.Link   = popup;

            list.Add(collapse);
            list.ChildLayoutStyle = Area.AreaLayoutStyle.ExtendHorizontal;

            Choice choice = new Choice(Orientation.Vertical);

            choice.Style = Style.NullPadding;
            //choice.Action = MaterialChoiceAction;
            string[] materials = { "pearl", "gold", "red", "green", "cyan", "blue", "magenta", "pink", "EdgeLines", "Grid" };

            foreach (var name in materials)
            {
                ChoiceItem item = new ChoiceItem(renderer, name);
                choice.Add(item);
            }
            choice.Selected = choice.Items.First();
            list.Add(choice);

            expand.Link = popup;
            return(popup);
        }
Example #4
0
        private Area Camera()
        {
            Button expand = new Button(renderer, "Camera");

            expand.Name   = "expand";
            expand.Action = TogglePopup;

            MenuList list  = new MenuList(renderer, Orientation.Vertical);
            Popup    popup = new Popup(expand, list);

            list.Name             = "list";
            list.ChildLayoutStyle = Area.AreaLayoutStyle.ExtendHorizontal;
            popup.Name            = "popup";

            Button collapse = new Button(renderer, "Camera");

            collapse.Action = TogglePopup;
            collapse.Link   = popup;
            collapse.Name   = "collapse";
            list.Add(collapse);

            Camera           camera = sceneManager.Camera;
            StereoParameters stereo = camera.StereoParameters;

            list.ChildLayoutStyle   = Area.AreaLayoutStyle.ExtendHorizontal;
            stereo.ViewportCenter.Z = 4.0f;
            list.Add(new Slider(renderer, "Fov X", camera.FovXParameter, 0, 0.0f, (float)(System.Math.PI), 0.0f, 180.0f));
            list.Add(new Slider(renderer, "Fov Y", camera.FovYParameter, 0, 0.0f, (float)(System.Math.PI), 0.0f, 180.0f));

#if false
            {
                list.Add(new Slider(renderer, "Eye Separation", stereo.EyeSeparation, 0, -1.0f, 1.0f, -1.0f, 1.0f));
                list.Add(new Slider(renderer, "Perspective", stereo.Perspective, 0, 0.0f, 1.0f, 0.0f, 1.0f));
                list.Add(new Slider(renderer, "Center X", stereo.ViewportCenter, 0, -4.0f, 4.0f, -4.0f, 4.0f));
                list.Add(new Slider(renderer, "Center Y", stereo.ViewportCenter, 1, -4.0f, 4.0f, -4.0f, 4.0f));
                list.Add(new Slider(renderer, "Center Z", stereo.ViewportCenter, 2, 0.0f, 20.0f,   0.0f, 20.0f));
                list.Add(new Slider(renderer, "Eye X", stereo.EyePosition, 0, -4.0f, 4.0f, -4.0f, 4.0f));
                list.Add(new Slider(renderer, "Eye Y", stereo.EyePosition, 1, -4.0f, 4.0f, -4.0f, 4.0f));
                list.Add(new Slider(renderer, "Eye Z", stereo.EyePosition, 2, -20.0f, 20.0f, -20.0f, 20.0f));
                //list.Add(new Slider(renderer, "Near",           camera.NearParameter,   0,    0.0f,  10.0f,    0.0f,  10.0f));
                //list.Add(new Slider(renderer, "Far",            camera.FarParameter,    0,    0.0f, 100.0f,    0.0f, 100.0f));
            }

            {
                Choice choice = new Choice(Orientation.Horizontal);
                choice.Name  = "Focus choice";
                choice.Style = Style.NullPadding;
                choice.Add(new ChoiceItem(renderer, "AutoFocus"));
                choice.Add(new ChoiceItem(renderer, "Manual"));
                choice.Action   = FocusChoiceAction;
                choice.Selected = choice.Items.First();
                list.Add(choice);
            }
#endif

            {
                Choice choice = new Choice(Orientation.Horizontal);
                choice.Name  = "FOV choice";
                choice.Style = Style.NullPadding;
                choice.Add(new ChoiceItem(renderer, "Vertical"));
                choice.Add(new ChoiceItem(renderer, "Horizontal"));

#if false
                {
                    choice.Add(new ChoiceItem(renderer, "V. Stereo"));
                    choice.Add(new ChoiceItem(renderer, "H. Stereo"));
                }
#endif
                choice.Action   = ProjectionChoiceAction;
                choice.Selected = choice.Items.First();
                list.Add(choice);
            }

#if false
            {
                Choice choice = new Choice(Orientation.Horizontal);
                choice.Name  = "StereoMode choice";
                choice.Style = Style.NullPadding;
                foreach (var kvp in stereoModes)
                {
                    choice.Add(new ChoiceItem(renderer, kvp.Key));
                }
                choice.Action   = StereoModeChoiceAction;
                choice.Selected = choice.Items.First();
                list.Add(choice);
            }

            {
                list.Add(new Slider(renderer, "Saturation", (renderer.GlobalParameters["saturation"]    as Floats), 0, 0.0f, 1.0f, 0.0f, 1.0f));
                list.Add(new Slider(renderer, "Contrast", (renderer.GlobalParameters["contrast"]      as Floats), 0, 0.0f, 1.0f, 0.0f, 1.0f));
                list.Add(new Slider(renderer, "Deghost", (renderer.GlobalParameters["deghost"]       as Floats), 0, 0.0f, 1.0f, 0.0f, 1.0f));
            }
#endif

            {
                Dock dock = new Dock(Orientation.Horizontal);
                dock.Name  = "Reset Home dock";
                dock.Style = Style.NullPadding;

                Button reset = new Button(renderer, "Reset");
                reset.Action = ResetCamera;
                dock.Add(reset);

                list.Add(dock);
            }

            expand.Link = popup;
            popup.Set(false);

            return(popup);
        }