private void OnPostRender()
    {
        Presentable uavContent = (Presentable)content;

        if (debugMaterial != null && uavContent != null)
        {
            Matrix4x4 toMVP = cam.projectionMatrix * cam.worldToCameraMatrix * env.transform.localToWorldMatrix;
            debugMaterial.SetMatrix("toMVP", toMVP);
            debugMaterial.SetTexture("gVoxelList", uavContent.uavContent);
            debugMaterial.SetVector("voxelDim", new Vector3(env.xCells, env.yCells, env.zCells));
            debugMaterial.SetPass(0);
            Graphics.DrawProcedural(MeshTopology.Points, env.xCells * env.yCells * env.zCells);
        }
    }
Example #2
0
                /// <summary>
                /// Parses the supplied XML node for widgets and adds them to this page.
                /// </summary>
                /// <param name="XMLWidget">The widget (in XML format) to add.</param>
                /// <param name="Parent">The parent layout this page belongs to.</param>
                /// <remarks>This constructor is used primarily in conjunction with XML-based layouts</remarks>
                public void AddWidget(XmlNode XMLWidget, Layout Parent)
                {
                    Presentable w     = null;
                    string      style = Xml.Att(XMLWidget.Attributes["style"]);

                    switch (XMLWidget.Name)
                    {
                    case "img":

                        w = new Image(Xml.Att(XMLWidget.Attributes["id"]),
                                      Parent.styleSheet.Apply(style, "src", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "colour", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "scale", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "x", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "y", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "width", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "height", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "alignH", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "alignV", XMLWidget.Attributes),
                                      Xml.Att(XMLWidget.Attributes["visible"]));
                        break;

                    case "label":

                        w = new Label(Xml.Att(XMLWidget.Attributes["id"]),
                                      XMLWidget.InnerText,
                                      Xml.Att(XMLWidget.Attributes["textAlign"]),
                                      Xml.Att(XMLWidget.Attributes["wordWrap"]),
                                      Parent.styleSheet.Apply(style, "colour", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "fontFace", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "fontSize", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "x", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "y", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "width", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "height", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "alignH", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "alignV", XMLWidget.Attributes),
                                      Xml.Att(XMLWidget.Attributes["visible"]));
                        break;

                    case "input":

                        w = new Input(Parent.styleSheet,
                                      Xml.Att(XMLWidget.Attributes["id"]),
                                      Xml.Att(XMLWidget.Attributes["type"]),
                                      Parent.styleSheet.Apply(style, "maxLength", XMLWidget.Attributes),
                                      XMLWidget.ChildNodes,
                                      Parent.styleSheet.Apply(style, "x", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "y", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "width", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "height", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "alignH", XMLWidget.Attributes),
                                      Parent.styleSheet.Apply(style, "alignV", XMLWidget.Attributes),
                                      Xml.Att(XMLWidget.Attributes["visible"]));

                        break;

                    case "button":

                        Button b = new Button(Parent.styleSheet, Xml.Att(XMLWidget.Attributes["id"]),
                                              XMLWidget.ChildNodes,
                                              Parent.styleSheet.Apply(style, "x", XMLWidget.Attributes),
                                              Parent.styleSheet.Apply(style, "y", XMLWidget.Attributes),
                                              Parent.styleSheet.Apply(style, "width", XMLWidget.Attributes),
                                              Parent.styleSheet.Apply(style, "height", XMLWidget.Attributes),
                                              Parent.styleSheet.Apply(style, "alignH", XMLWidget.Attributes),
                                              Parent.styleSheet.Apply(style, "alignV", XMLWidget.Attributes),
                                              Xml.Att(XMLWidget.Attributes["enabled"]),
                                              Xml.Att(XMLWidget.Attributes["visible"]));

                        b.guiDispatcher.AttachHandler("onClick", Parent.handler, Xml.Att(XMLWidget.Attributes["onClick"]));
                        w = b;
                        break;

                    case "tab":

                        w = new Tab(Parent.styleSheet, Xml.Att(XMLWidget.Attributes["id"]),
                                    Parent.styleSheet.Apply(style, "maxW", XMLWidget.Attributes),
                                    Parent,
                                    XMLWidget.ChildNodes,
                                    Parent.styleSheet.Apply(style, "x", XMLWidget.Attributes),
                                    Parent.styleSheet.Apply(style, "y", XMLWidget.Attributes),
                                    Parent.styleSheet.Apply(style, "width", XMLWidget.Attributes),
                                    Parent.styleSheet.Apply(style, "height", XMLWidget.Attributes),
                                    Parent.styleSheet.Apply(style, "alignH", XMLWidget.Attributes),
                                    Parent.styleSheet.Apply(style, "alignV", XMLWidget.Attributes),
                                    Xml.Att(XMLWidget.Attributes["visible"]));
                        break;

                    case "list":

                        List l = new List(Parent.styleSheet, Xml.Att(XMLWidget.Attributes["id"]),
                                          XMLWidget.ChildNodes,
                                          Parent.styleSheet.Apply(style, "x", XMLWidget.Attributes),
                                          Parent.styleSheet.Apply(style, "y", XMLWidget.Attributes),
                                          Parent.styleSheet.Apply(style, "width", XMLWidget.Attributes),
                                          Parent.styleSheet.Apply(style, "height", XMLWidget.Attributes),
                                          Parent.styleSheet.Apply(style, "alignH", XMLWidget.Attributes),
                                          Parent.styleSheet.Apply(style, "alignV", XMLWidget.Attributes),
                                          Xml.Att(XMLWidget.Attributes["visible"]));

                        l.guiDispatcher.AttachHandler("onClick", Parent.handler, Xml.Att(XMLWidget.Attributes["onClick"]));
                        w = l;

                        break;

                    default:

                        throw new Exception(string.Format("Encountered unknown widget: {0}", XMLWidget.Name));
                    }

                    widgets.Add(w);
                    Parent.RegisterId(w);
                }
Example #3
0
 public void AddWidget(Presentable W, Layout Parent)
 {
     widgets.Add(W);
     Parent.RegisterId(W);
 }