Ejemplo n.º 1
0
 private void newButtonClick(object sender, RoutedEventArgs e)
 {
     CurrentAssemblyName = "";
     CurrentSceneName    = "";
     CurrentAssembly     = null;
     CurrentScene        = null;
     SceneNames          = new List <string>();
     editorBox.Text      = "";
 }
Ejemplo n.º 2
0
 private void newButtonClick(object sender, RoutedEventArgs e)
 {
     CurrentAssemblyName = "";
     CurrentSceneName = "";
     CurrentAssembly = null;
     CurrentScene = null;
     SceneNames = new List<string>();
     editorBox.Text = "";
 }
Ejemplo n.º 3
0
        void RunScene(string scenename)
        {
            mainViewport.Children.Clear();
            blacklines.Points.Clear();
            redlines.Points.Clear();

            //create new buffers for lines
            blacklines.Color   = Colors.Black;
            redlines.Color     = Colors.Red;
            redlines.Thickness = 4;

            try
            {
                //print which scene is running
                resultBox.Text = "Running scene " + scenename + "\n";

                //create the main scene
                Shapes.Scene.DebugLines = redlines;
                CurrentScene            = (Shapes.Scene)CurrentAssembly.CreateInstance(scenename);
                CurrentScene.Run();

                //setup model if faces visible
                if (ShowFaces)
                {
                    MeshGeometry3D triangleMesh = new MeshGeometry3D();
                    foreach (Shapes.Shape s in Shapes.Scene.LastNode.Shapes)
                    {
                        s.BuildMeshGeometry3D(triangleMesh);
                    }

                    Color           c             = Colors.Blue; c.A = 100;
                    Material        material      = new DiffuseMaterial(new SolidColorBrush(c));
                    GeometryModel3D triangleModel = new GeometryModel3D(triangleMesh, material);
                    ModelVisual3D   model         = new ModelVisual3D();
                    model.Content = triangleModel;

                    mainViewport.Children.Add(model);
                }

                //setup screen space lines if edges visible
                if (ShowEdges)
                {
                    foreach (Shapes.Shape s in Shapes.Scene.LastNode.Shapes)
                    {
                        s.BuildScreenSpaceLines(blacklines);
                    }
                    foreach (Shapes.Shape s in Shapes.Scene.LastNode.Shapes)
                    {
                        s.BuildCrossesAtVertices(blacklines);
                    }
                }

                //success so print done
                resultBox.Text += "Done\n";
            }
            catch (System.ApplicationException ex)
            {
                //print exception if failed
                resultBox.Text += ex.Message + "\n";
            }
            finally
            {
                //add the line buffers to the main viewport
                mainViewport.Children.Add(redlines);
                mainViewport.Children.Add(blacklines);
            }
        }
Ejemplo n.º 4
0
        void RunScene(string scenename)
        {
            mainViewport.Children.Clear();
            blacklines.Points.Clear();
            redlines.Points.Clear();

            //create new buffers for lines
            blacklines.Color = Colors.Black;
            redlines.Color = Colors.Red;
            redlines.Thickness = 4;

            try
            {
                //print which scene is running
                resultBox.Text = "Running scene " + scenename + "\n";

                //create the main scene
                Shapes.Scene.DebugLines = redlines;
                CurrentScene = (Shapes.Scene)CurrentAssembly.CreateInstance(scenename);
                CurrentScene.Run();

                //setup model if faces visible
                if (ShowFaces)
                {
                    MeshGeometry3D triangleMesh = new MeshGeometry3D();
                    foreach (Shapes.Shape s in Shapes.Scene.LastNode.Shapes)
                        s.BuildMeshGeometry3D(triangleMesh);

                    Color c = Colors.Blue; c.A = 100;
                    Material material = new DiffuseMaterial(new SolidColorBrush(c));
                    GeometryModel3D triangleModel = new GeometryModel3D(triangleMesh, material);
                    ModelVisual3D model = new ModelVisual3D();
                    model.Content = triangleModel;

                    mainViewport.Children.Add(model);
                }

                //setup screen space lines if edges visible
                if (ShowEdges)
                {
                    foreach (Shapes.Shape s in Shapes.Scene.LastNode.Shapes)
                        s.BuildScreenSpaceLines(blacklines);
                    foreach (Shapes.Shape s in Shapes.Scene.LastNode.Shapes)
                        s.BuildCrossesAtVertices(blacklines);
                }

                //success so print done
                resultBox.Text += "Done\n";
            }
            catch (System.ApplicationException ex)
            {
                //print exception if failed
                resultBox.Text += ex.Message + "\n";
            }
            finally
            {
                //add the line buffers to the main viewport
                mainViewport.Children.Add(redlines);
                mainViewport.Children.Add(blacklines);
            }
        }