public void SceneNode_AddRenameEntity_ShouldNotThrowException()
        {
            sceneNode.AttachObject(entity);
            entity.Name = "newName_" + "SceneNode_AddRenameEntity";
            Assert.IsTrue(sceneNode.GetObject(entity.Name) != null);

            sceneNode.DetachAllObjects();
        }
Example #2
0
        public override void Destroy()
        {
            Node.DetachAllObjects();
            Engine.Singleton.SceneManager.DestroySceneNode(Node);
            Engine.Singleton.SceneManager.DestroyEntity(Entity);
            Body.Dispose();
            Body = null;

            base.Destroy();
        }
        /// <summary>
        ///
        /// </summary>
        public void Clear()
        {
            if (mRenderMethod == BillboardMethod.Accelerated)
            {
                //Delete the entity and mesh data
                if (mEntity != null)
                {
                    //Delete entity
                    mNode.DetachAllObjects();
                    mSceneMgr.RemoveEntity(mEntity);
                    mEntity = null;

                    //Delete mesh
                    Debug.Assert(mMesh != null);
                    string meshName = mMesh.Name;
                    mMesh = null;
                    if (MeshManager.Instance != null)
                    {
                        MeshManager.Instance.Remove(meshName);
                    }
                }

                //Remove any billboard data which might be left over if the user forgot to call build()
                mBillboardBuffer.Clear();
            }
            else
            {
                mFallbackSet.Clear();
            }
        }
        /// <summary>
        /// This method detaches and dispode of all the elements of the compound model
        /// </summary>
        public void Dispose()
        {
            if (wheelsGroupNode != null)                     // Start removing from the leaves of the sub-graph
            {
                if (wheelsGroupNode.Parent != null)
                {
                    wheelsGroupNode.Parent.RemoveChild(wheelsGroupNode);
                }
                wheelsGroupNode.DetachAllObjects();
                wheelsGroupNode.Dispose();
                sphere.Dispose();
            }

            if (hullGroupNode != null)
            {
                if (hullGroupNode.Parent != null)
                {
                    hullGroupNode.Parent.RemoveChild(hullGroupNode);
                }
                hullGroupNode.DetachAllObjects();
                hullGroupNode.Dispose();
                hull.Dispose();
            }

            if (model != null)                      // Stop removing with the sub-graph root
            {
                if (model.Parent != null)
                {
                    model.Parent.RemoveChild(model);
                }
                model.Dispose();
            }
        }
Example #5
0
 /// <summary>
 /// Dispose method to remove the borderNode.
 /// </summary>
 public void Dispose()
 {
     borderNode.DetachAllObjects();
     borderNode.Parent.RemoveChild(borderNode);
     borderNode.Dispose();
     borderEntity.Dispose();
 }
Example #6
0
 /// <summary>
 /// This method disposes of  the Cube
 /// </summary>
 public void Dispose()
 {
     groundNode.DetachAllObjects();
     groundNode.Parent.RemoveChild(groundNode);
     groundNode.Dispose();
     groundEntity.Dispose();
 }
Example #7
0
        public override void Dispose()
        {
            if (EngineConfig.DisplayingMinimap && minimapItem != null)
            {
                minimapItem.Dispose();
                minimapItem = null;
            }
            if (innerNode != null)
            {
                innerNode.DetachAllObjects();
                innerNode.Dispose();
                innerNode = null;
            }
            if (ammunitionModel != null)
            {
                ammunitionModel.Dispose();
                ammunitionModel = null;
            }
            missileAnimation = null;

            if (ammunitionNode != null)
            {
                ammunitionNode.DetachAllObjects();
                ammunitionNode.Dispose();
                ammunitionNode = null;
            }
        }
Example #8
0
        /// <summary>
        /// This method disposes of all noes and entities in the scene
        /// </summary>
        protected override void DestroyScene()
        {
            cameraNode.DetachAllObjects();
            cameraNode.Dispose();
            player.Model.Dispose();
            if (robot != null)
            {
                robot.Model.Dispose();
            }
            //cube.Dispose();
            gameHMD.Dispose();
            int a;

            for (a = 0; a < cubeNum; a++)
            {
                obstacle_cube[a].Dispose();
            }
            foreach (GemAmmo gemAmmo in gems_ammo)
            {
                gemAmmo.Dispose();
            }
            foreach (GemHealth gemHealth in gems_health)
            {
                gemHealth.Dispose();
            }
            physics.Dispose();
            base.DestroyScene();
        }
Example #9
0
 public void Dispose()
 {
     gemNode.Parent.RemoveChild(gemNode);
     gemNode.DetachAllObjects();
     gemNode.Dispose();
     gemEntity.Dispose();
 }
Example #10
0
        /// <summary>
        /// This method is detaches from the scene graph and derstroies the game node and the game entity
        /// </summary>
        public virtual void Dispose()
        {
            //Console.WriteLine("Delete Object");
            if (physObj != null)
            {
                Physics.RemovePhysObj(physObj);
                physObj = null;
                //Console.WriteLine("Delete Physics");
            }


            if (gameNode != null)
            {
                if (gameNode.Parent != null)
                {
                    gameNode.DetachAllObjects();
                    gameNode.RemoveAndDestroyAllChildren();
                    gameNode.Parent.RemoveChild(gameNode.Name);
                }
                gameNode.Dispose();
            }

            if (gameEntity != null)
            {
                gameEntity.Dispose();
            }
        }
Example #11
0
 public void Dispose()
 {
     cubeNode.Parent.RemoveChild(cubeNode);
     cubeNode.DetachAllObjects();
     cubeNode.Dispose();
     cubeEntity.Dispose();
 }
Example #12
0
        /// <summary>
        /// This method detaches and dispode of all the elements of the compound model
        /// </summary>
        public void Dispose()
        {
            if (sphere != null)                     // Start removing from the leaves of the sub-graph
            {
                if (sphere.Parent != null)
                {
                    sphere.Parent.RemoveChild(sphere);
                }
                sphere.DetachAllObjects();
                sphere.Dispose();
                sphereEntity.Dispose();
            }

            if (mainHull != null)
            {
                if (mainHull.Parent != null)
                {
                    mainHull.Parent.RemoveChild(mainHull);
                }
                mainHull.DetachAllObjects();
                mainHull.Dispose();
                hullEntity.Dispose();
            }

            if (model != null)                      // Stop removing with the sub-graph root
            {
                if (model.Parent != null)
                {
                    model.Parent.RemoveChild(model);
                }
                model.Dispose();
            }
        }
Example #13
0
 /// <summary>
 /// This method detaches the robot node from the scene graph and destroies it and the robot enetity
 /// </summary>
 public void Dispose()
 {
     robotNode.Parent.RemoveChild(robotNode);
     robotNode.DetachAllObjects();
     robotNode.Dispose();
     robotEntity.Dispose();
 }
Example #14
0
        protected override void DestroyScene()
        {
            base.DestroyScene();
            player.Model.GameNode.Dispose();
            //robot1.Dispose();
            //robot2.Dispose();
            //robot3.Dispose();
            cameraNode.DetachAllObjects();
            cameraNode.Dispose();

            foreach (Bomb bomb in testGun.bombs)
            {
                bomb.Dispose();
            }

            foreach (BlueGem blueGem in blueGems)
            {
                blueGem.Dispose();
            }

            foreach (RedGem redGem in redGems)
            {
                redGem.Dispose();
            }

            foreach (ShieldPU shield in shieldPU)
            {
                shield.Dispose();
            }

            hudElement.Dispose();
            physics.Dispose();
            environment.Dispose();
        }
Example #15
0
        public void Dispose()
        {
            wallNode1.DetachAllObjects();
            wallNode1.Parent.RemoveChild(wallNode1);
            wallNode1.Dispose();

            wallNode2.DetachAllObjects();
            wallNode2.Parent.RemoveChild(wallNode2);
            wallNode2.Dispose();

            //wallNode3.DetachAllObjects();
            //wallNode3.Parent.RemoveChild(wallNode3);
            //wallNode3.Dispose();

            //wallNode4.DetachAllObjects();
            //wallNode4.Parent.RemoveChild(wallNode4);
            //wallNode4.Dispose();

            wallMainNode.DetachAllObjects();
            wallMainNode.Parent.RemoveChild(wallMainNode);
            wallMainNode.Dispose();

            wallEntity1.Dispose();
            wallEntity2.Dispose();
            //wallEntity3.Dispose();
            //wallEntity4.Dispose();
        }
Example #16
0
 /// <summary>
 // Disposes of the physObj and gamenode
 /// </summary>
 public override void Dispose()
 {
     base.Dispose();
     Physics.RemovePhysObj(PhysObj);
     physObj = null;
     gemNode.DetachAllObjects();
     gemNode.Dispose();
 }
Example #17
0
 public void DeleteLevel()
 {
     GraphicsNode.DetachAllObjects();
     CollisionNode.DetachAllObjects();
     Body.Dispose();
     Engine.Singleton.SceneManager.RootSceneNode.RemoveChild(GraphicsNode);
     Engine.Singleton.SceneManager.RootSceneNode.RemoveChild(CollisionNode);
 }
Example #18
0
 public override void Dispose()
 {
     Physics.RemovePhysObj(physObj);
     physObj = null;
     //gameNode.Parent.RemoveChild(gameNode);
     gameNode.DetachAllObjects();
     gameNode.Dispose();
     gameEntity.Dispose();
 }
Example #19
0
 public void Dispose()
 {
     bodyNode.DetachAllObjects();
     sceneMgr.RootSceneNode.RemoveChild(bodyNode);
     if (controlled)
     {
         removeCamera();
     }
 }
Example #20
0
 /// <summary>
 /// This method detaches the robot node from the scene graph and destroies it and the robot enetity
 /// </summary>
 public override void Dispose()
 {
     Physics.RemovePhysObj(physObj);
     physObj = null;
     robotNode.Parent.RemoveChild(robotNode);
     robotNode.DetachAllObjects();
     robotNode.Dispose();
     robotEntity.Dispose();
 }
Example #21
0
 /// <summary>
 /// This method destroys the scene & components within it
 /// </summary>
 protected override void DestroyScene()
 {
     base.DestroyScene();
     gameHMD.Dispose();
     cameraNode.DetachAllObjects();
     cameraNode.Dispose();
     environment.Dispose();
     physics.Dispose();
 }
Example #22
0
        /// <summary>
        /// This method remove from the 3D overlay and destries the passed scene node
        /// </summary>
        /// <param name="life"></param>
        private void RemoveAndDestroyLife(SceneNode life)
        {
            overlay3D.Remove3D(life);
            lives.Remove(life);
            MovableObject heart = life.GetAttachedObject(0);

            life.DetachAllObjects();
            life.Dispose();
            heart.Dispose();
        }
        /// <summary>
        /// This method dispose of the bomb, destroying the physics object, and removing the bomb and its mesh from the scenegraph
        /// </summary>
        public void Dispose()
        {
            Physics.RemovePhysObj(physObj);
            physObj = null;

            bombNode.Parent.RemoveChild(bombNode);
            bombNode.DetachAllObjects();
            bombNode.Dispose();
            bombEntity.Dispose();
        }
Example #24
0
        /// <summary>
        /// This method detaches the robot node from the scene graph and destroies it and the robot enetity
        /// </summary>
        public void Dispose()
        {
            robotNode.RemoveAllChildren();
            robotNode.Parent.RemoveChild(robotNode);
            robotNode.DetachAllObjects();
            robotNode.Dispose();
            robotEntity.Dispose();

            Physics.RemovePhysObj(physObj);
            physObj = null;
        }
 public override void Dispose()
 {
     Physics.RemovePhysObj(physObj);
     physObj = null;
     if (gemNode.Parent != null)
     {
         gemNode.Parent.RemoveChild(gemNode);
     }
     gemNode.DetachAllObjects();
     gemNode.Dispose();
     gemEntity.Dispose();
 }                                                                            /////////
Example #26
0
 public override void Dispose()
 {
     Physics.RemovePhysObj(physObj);
     physObj = null;
     if (projectileNode.Parent != null)
     {
         projectileNode.Parent.RemoveChild(projectileNode);
     }
     projectileNode.DetachAllObjects();
     projectileNode.Dispose();
     projectileEntity.Dispose();
 }
Example #27
0
        public void DeleteLevel()
        {
            if (DeleteWithAutoSave)
            {
                Engine.Singleton.AutoSave(null);
            }

            GraphicsNode.DetachAllObjects();
            CollisionNode.DetachAllObjects();
            Body.Dispose();
            Engine.Singleton.SceneManager.RootSceneNode.RemoveChild(GraphicsNode);
            Engine.Singleton.SceneManager.RootSceneNode.RemoveChild(CollisionNode);
        }
Example #28
0
        public Camera removeCamera()
        {
            Camera cam = (Camera)cameraNode.GetAttachedObjectIterator().ElementAt(0);

            cameraNode.DetachAllObjects();
            sceneManager.DestroySceneNode(cameraNode);
            sceneManager.DestroySceneNode(cameraGoal);
            sceneManager.DestroySceneNode(cameraPivot);
            cameraNode  = null;
            cameraGoal  = null;
            cameraPivot = null;
            return(cam);
        }
Example #29
0
 public void xRemoveEmitterModels(string name)
 {
     try
     {
         SceneNode node = sceneMgr.GetSceneNode(name);
         node.DetachAllObjects();
         sceneMgr.DestroySceneNode(node);
         sceneMgr.DestroyManualObject(name); // destroy dummy model
     }
     catch (Exception err)
     {
         MessageBox.Show("Error: " + err);
     }
 }
Example #30
0
 /// <summary>
 /// This method disposes of  the Cube
 /// </summary>
 public void Dispose()
 {
     if (manualObjNode != null)
     {
         manualObjNode.Parent.RemoveChild(manualObjNode);
         manualObjNode.DetachAllObjects();
         manualObjNode.Dispose();
         manualObjNode = null;
     }
     if (manualObjEntity != null)
     {
         manualObjEntity.Dispose();
         manualObjEntity = null;
     }
 }
Example #31
0
 /// <summary>
 /// This method remove from the 3D overlay and destries the passed scene node
 /// </summary>
 /// <param name="life"></param>
 private void RemoveAndDestroyLife(SceneNode life)
 {
     overlay3D.Remove3D(life);
     lives.Remove(life);
     MovableObject heart = life.GetAttachedObject(0);
     life.DetachAllObjects();
     life.Dispose();
     heart.Dispose();
 }
Example #32
0
        public List<String> SetViewModel(String _model)
        {
            String nameOnly = Path.GetFileNameWithoutExtension(_model);
            String filename = Path.GetFileName(_model);
            String modelDir = Path.GetDirectoryName(_model);

            AddResourcesDirectory(nameOnly, modelDir);

            if (sceneMgr.HasEntity(nameOnly))
                sceneMgr.DestroyEntity(nameOnly);

            modelEntity = sceneMgr.CreateEntity(nameOnly, filename, nameOnly);

            if (sceneMgr.HasSceneNode(MODEL_NODE))
                sceneMgr.DestroySceneNode(MODEL_NODE);

            modelNode = sceneMgr.RootSceneNode.CreateChildSceneNode(MODEL_NODE);
            modelNode.SetInitialState();

            modelNode.DetachAllObjects();
            modelNode.AttachObject(modelEntity);

            // check for material textures
            foreach (var subMesh in modelEntity.GetMesh().GetSubMeshIterator())
            {
                bool needsReload = false;
                var matPtr = (MaterialPtr)MaterialManager.Singleton.GetByName(subMesh.MaterialName);
                if (matPtr != null)
                {
                    foreach (var mtrPass in matPtr.GetTechnique(0).GetPassIterator())
                    {
                        foreach (var mtrTex in mtrPass.GetTextureUnitStateIterator())
                        {
                            if (mtrTex.IsTextureLoadFailing)
                            {
                                mtrTex.SetTextureName(mtrTex.TextureName.Replace(".png", ".dds"));
                                needsReload = true;
                            }
                        }
                    }
                }
                if (needsReload) matPtr.Reload();
            }

            //if (modelEntity.HasSkeleton)
            //{
            //    foreach (String skltFiles in Directory.GetFiles(modelDir, "*.skeleton"))
            //    {
            //        try
            //        {
            //            SkeletonPtr source = SkeletonManager.Singleton.Load(Path.GetFileName(skltFiles), "General");
            //            Skeleton.BoneHandleMap boneHandleMap = new Skeleton.BoneHandleMap();
            //            source._buildMapBoneByHandle(source, boneHandleMap);
            //            modelEntity.Skeleton._mergeSkeletonAnimations(source, boneHandleMap);
            //            modelEntity.Skeleton._refreshAnimationState(modelEntity.AllAnimationStates);
            //        }
            //        catch { }
            //    }
            //    modelEntity.DisplaySkeleton = true;
            //}

            SetInitialCamera(modelEntity, modelNode);

            if (sceneMgr.HasLight("SimpleLight"))
                sceneMgr.DestroyLight("SimpleLight");

            Light light = sceneMgr.CreateLight("SimpleLight");
            sceneMgr.RootSceneNode.AttachObject(light);
            light.DiffuseColour = new ColourValue(1f, 1f, 1f);
            light.Position = this.camera.Position;
            light.Direction = this.camera.Direction;

            return GetAnimationNames(modelEntity);
        }