Esempio n. 1
0
        private void openAsSeperateSceneToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Show the dialog and get result.
            DialogResult result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                List <GameObject> objs = ApexEngine.Rendering.Util.RenderUtil.GatherObjects(apxCtrl.Game.RootNode);
                foreach (GameObject g in objs)
                {
                    apxCtrl.Game.PhysicsWorld.RemoveObject(g);
                }

                for (int i = apxCtrl.Game.RootNode.Children.Count - 1; i > -1; i--)
                {
                    apxCtrl.Game.RootNode.RemoveChild(apxCtrl.Game.RootNode.GetChild(i));
                }
                treeView1.Nodes.Clear();
                ApexEngine.Scene.GameObject loadedModel = ApexEngine.Assets.AssetManager.LoadModel(openFileDialog1.FileName);
                apxCtrl.Game.RootNode.AddChild(loadedModel);
                apxCtrl.Game.PhysicsWorld.AddObject(loadedModel, 0f, ApexEngine.Scene.Physics.PhysicsWorld.PhysicsShape.Box);
                activeNodeID = apxCtrl.Game.RootNode.Children.Count - 1;
                PopulateTreeView(apxCtrl.Game.RootNode);
            }
        }
Esempio n. 2
0
        private void addToSceneToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Show the dialog and get result.
            DialogResult result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                ApexEngine.Scene.GameObject loadedModel = ApexEngine.Assets.AssetManager.LoadModel(openFileDialog1.FileName);
                apxCtrl.Game.RootNode.AddChild(loadedModel);
                // List<Geometry> geoms = ApexEngine.Rendering.Util.MeshUtil.GatherGeometry(loadedModel);
                // foreach (Geometry g in geoms)
                apxCtrl.Game.PhysicsWorld.AddObject(loadedModel, 0f, ApexEngine.Scene.Physics.PhysicsWorld.PhysicsShape.Box);
                activeNodeID = apxCtrl.Game.RootNode.Children.Count - 1;
                AddTreeViewItem(treeView1.Nodes[0], loadedModel);
            }
        }