예제 #1
0
        private void createNewScene()
        {
            this._graph = new SceneGraph();
            this._editorScripts.BindType("scene", this._graph);
            this._graph.RootNode.Id = "DefaultScene";

            ClearColorNode clearNode = new ClearColorNode();
            clearNode.Id = "ClearColor";
            clearNode.ClearColor = Color.CornflowerBlue;
            this._graph.RootNode.Children.Add(clearNode);

            PrimitiveNode triangle = new PrimitiveNode();
            triangle.Id = "SimpleTriangle";

            VertexNode p1 = new VertexNode();
            p1.Id = "triangle_p1";
            p1.Position = new OpenTK.Vector3(-0.5f, -0.5f, 1f);

            ColorNode c1 = new ColorNode();
            c1.Id = "triangle_color_p1";
            c1.Color = Color.Red;
            p1.Children.Add(c1);

            VertexNode p2 = new VertexNode();
            p2.Id = "triangle_p2";
            p2.Position = new OpenTK.Vector3(0.5f, -0.5f, 1f);

            ColorNode c2 = new ColorNode();
            c2.Id = "triangle_color_p2";
            c2.Color = Color.Green;
            p2.Children.Add(c2);

            VertexNode p3 = new VertexNode();
            p3.Id = "triangle_p3";
            p3.Position = new OpenTK.Vector3(0f, 0.5f, 1f);

            ColorNode c3 = new ColorNode();
            c3.Id = "triangle_color_p3";
            c3.Color = Color.Blue;
            p3.Children.Add(c3);

            triangle.Children.Add(p1);
            triangle.Children.Add(p2);
            triangle.Children.Add(p3);

            this._graph.RootNode.Children.Add(triangle);

            TextNode welcome = new TextNode();
            welcome.Text = "Welcome to EngineTK";
            welcome.TextHandler.Color = Color.Black;
            welcome.TextHandler.Alignment = OpenTK.Graphics.TextAlignment.Near;
            this._graph.RootNode.Children.Add(welcome);

            this._previewControl.Refresh();
            this.startBuildGraph();
        }
예제 #2
0
 private void _menuSceneLoad_Click(object sender, EventArgs e)
 {
     DialogResult result = this._openFileDialog.ShowDialog();
     if (result == DialogResult.OK)
     {
         Stream stream = this._openFileDialog.OpenFile();
         XmlSerializer serializer = this._addonManager.CreateXmlSerializer();
         this._graph = (SceneGraph)serializer.Deserialize(stream);
         stream.Close();
         this.startBuildGraph();
     }
 }