Ejemplo n.º 1
0
 public void Dispose()
 {
     fixedFunctionTextured.Dispose();
     skeletonWindow.Dispose();
     animationWindow.Dispose();
     customParameters.Dispose();
 }
Ejemplo n.º 2
0
        protected void drawLine(SceneNode p_Node, string lineName, Vector3 p_Point1, Vector3 p_Point2)
        {
            // create material (colour)
            MaterialPtr moMaterial = MaterialManager.Singleton.Create(lineName, "debugger");

            moMaterial.ReceiveShadows = false;
            moMaterial.GetTechnique(0).SetLightingEnabled(true);
            moMaterial.GetTechnique(0).GetPass(0).SetDiffuse(0, 0, 1, 0);
            moMaterial.GetTechnique(0).GetPass(0).SetAmbient(0, 0, 1);
            moMaterial.GetTechnique(0).GetPass(0).SetSelfIllumination(0, 0, 1);
            moMaterial.Dispose();  // dispose pointer, not the material


            // create line object
            ManualObject manOb = mSceneManager.CreateManualObject(lineName);

            manOb.Begin(lineName, RenderOperation.OperationTypes.OT_LINE_LIST);
            manOb.Position(p_Point1.x, p_Point1.y, p_Point1.z);
            manOb.Position(p_Point2.x, p_Point2.y, p_Point2.z);
            // ... maybe more points
            manOb.End();

            // create SceneNode and attach the line
            //            p_Node.Position = Vector3.ZERO;
            p_Node.AttachObject(manOb);
        }
Ejemplo n.º 3
0
 public void Dispose()
 {
     Material.Dispose();
     _tech.Dispose();
     Pass.Dispose();
     VertexShader.Dispose();
     PixelShader.Dispose();
     MatToProg.Remove(Material.Target);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Shut down the state
        /// </summary>
        public override void Shutdown()
        {
            CompositorManager.Singleton.RemoveAll();
            CompositorManager.Singleton.UnloadAll();
            CompositorManager.Singleton.Dispose();
            CityManager.DisposeAll();

            scratchZoneMaterial.Unload();
            scratchZoneMaterial.Dispose();
        }
Ejemplo n.º 5
0
 public void Dispose()
 {
     if (material != null)
     {
         material.Dispose();
         material = null;
     }
     if (root != null)
     {
         root.Dispose();
         root = null;
     }
 }
Ejemplo n.º 6
0
        public void Dispose()
        {
            Stream.GetFrameClose();
            PixelBuffer.Dispose();
            screen.Dispose();
            videoMat.Dispose();
            videoTex.Dispose();

            videoTex    = null;
            videoMat    = null;
            screen      = null;
            PixelBuffer = null;
            FrameNum    = 0;
        }
Ejemplo n.º 7
0
        public static string CreateColoredMaterial(float r, float g, float b, string name = "")
        {
            if (name == "")
            {
                name = Guid.NewGuid().ToString();
            }

            MaterialPtr moMaterial = MaterialManager.Singleton.Create(name, RESOURCE_GROUP_NAME);

            moMaterial.ReceiveShadows = false;
            moMaterial.GetTechnique(0).SetLightingEnabled(true);
            moMaterial.GetTechnique(0).GetPass(0).SetDiffuse(r, g, b, 0);
            moMaterial.GetTechnique(0).GetPass(0).SetAmbient(r, g, b);
            moMaterial.GetTechnique(0).GetPass(0).SetSelfIllumination(r, g, b);
            moMaterial.Dispose();  // dispose pointer, not the material

            return(name);
        }
Ejemplo n.º 8
0
 public void Dispose()
 {
     if (material != null)
     {
         material.Dispose();
         material = null;
     }
     if (root != null)
     {
         sceneMgr.DestroyQuery(raySceneQuery);
         raySceneQuery = null;
         root.Dispose();
         root     = null;
         camera   = null;
         sceneMgr = null;
         viewport = null;
         window   = null;
         hWnd     = (IntPtr)0;
     }
 }
 private void delPluginSphere(string pluginName)
 {
     OgreWindow.Instance.pause();
     try
     {
         MaterialPtr ptrMat = MaterialManager.Singleton.GetByName(sphereNamePrefix + "_SphereMaterial_" + pluginName);
         ptrMat.Unload();
         MaterialManager.Singleton.Remove(ptrMat.Handle);
         ptrMat.Dispose();
         MeshPtr ptrMesh = MeshManager.Singleton.GetByName(sphereNamePrefix + "_SphereMesh_" + pluginName);
         ptrMesh.Unload();
         MeshManager.Singleton.Remove(ptrMesh.Handle);
         ptrMesh.Dispose();
         OgreWindow.Instance.mSceneMgr.DestroyEntity(sphereNamePrefix + "_SphereEntity_" + pluginName);
         OgreWindow.Instance.mSceneMgr.DestroySceneNode(sphereNamePrefix + "_SphereSceneNode_" + pluginName);
     }
     catch (Exception ex)
     {
         log("error deleting plugin sphere: " + ex.ToString());
     }
     OgreWindow.Instance.unpause();
 }
Ejemplo n.º 10
0
        ManualObject CreateGrid(SceneManager theSceneMng, float theWidth, float theStep, string theName)
        {
            float halfW = theWidth / 2f;

            // create material (colour)
            MaterialPtr moMaterial = MaterialManager.Singleton.Create("line_material", "General");

            moMaterial.ReceiveShadows = false;
            moMaterial.GetTechnique(0).SetLightingEnabled(true);
            moMaterial.GetTechnique(0).GetPass(0).SetDiffuse(0.1f, 0.1f, 0.1f, 0);
            moMaterial.GetTechnique(0).GetPass(0).SetAmbient(0.1f, 0.1f, 0.1f);
            moMaterial.GetTechnique(0).GetPass(0).SetSelfIllumination(0.1f, 0.1f, 0.1f);
            moMaterial.Dispose();  // dispose pointer, not the material

            // create line object
            ManualObject manOb = theSceneMng.CreateManualObject("line_" + theName);

            // X lines
            for (float x = -halfW; x <= halfW; x += theStep)
            {
                // draw line
                manOb.Begin("line_material", RenderOperation.OperationTypes.OT_LINE_LIST);
                manOb.Position(x, 0, -halfW);
                manOb.Position(x, 0, halfW);
                manOb.End();
            }

            // Z lines
            for (float z = -halfW; z <= halfW; z += theStep)
            {
                // draw line
                manOb.Begin("line_material", RenderOperation.OperationTypes.OT_LINE_LIST);
                manOb.Position(-halfW, 0, z);
                manOb.Position(halfW, 0, z);
                manOb.End();
            }

            return(manOb);
        }
Ejemplo n.º 11
0
 public void DisposeCachedMaterials()
 {
     plotMaterial.Unload();
     plotMaterial.Dispose();
 }
Ejemplo n.º 12
0
 public void Dispose()
 {
     Material.Dispose();
     Heightmap.Dispose();
 }
Ejemplo n.º 13
0
        static void Main(string[] args)
        {
            bool DebugMode = false;

            Engine.Singleton.Initialise();

            //MENUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUu

            SubMenu MainMenu = new SubMenu();
            SubMenu Continue = new SubMenu();
            SubMenu NewGame  = new SubMenu();
            SubMenu LoadGame = new SubMenu();
            SubMenu SaveGame = new SubMenu();
            SubMenu Options  = new SubMenu();
            SubMenu Credits  = new SubMenu();
            SubMenu End      = new SubMenu();

            MainMenu.MenuName = "MENU";
            MainMenu.AddSub(NewGame);
            MainMenu.AddSub(Continue);
            MainMenu.AddSub(LoadGame);
            MainMenu.AddSub(SaveGame);
            MainMenu.AddSub(Options);
            //MainMenu.AddSub(Credits);
            MainMenu.AddSub(End);

            Continue.MenuName = "Kontynuuj";
            Continue.Ending   = true;
            Continue.Enabled  = false;
            Continue.Parent   = MainMenu;
            Continue.AddAction(ContinueGame);

            NewGame.Ending   = true;
            NewGame.MenuName = "Nowa gra";
            NewGame.Parent   = MainMenu;
            NewGame.AddAction(New);

            LoadGame.MenuName = "Laduj gre";
            LoadGame.Enabled  = false;
            LoadGame.Parent   = MainMenu;

            SaveGame.MenuName = "Zapisz gre";
            SaveGame.Enabled  = false;
            SaveGame.Parent   = MainMenu;

            Options.MenuName = "Opcje";
            Options.Enabled  = false;
            Options.Parent   = MainMenu;

            Credits.MenuName = "Autorzy";
            Credits.Enabled  = false;
            Credits.Parent   = MainMenu;

            End.MenuName = "Koniec";
            End.Enabled  = true;
            End.Parent   = MainMenu;
            End.Ending   = true;                //CZASEM BYWA, ZE END NIE JEST ENDING .... POZDRO RABIS
            End.AddAction(Exit);

            Engine.Singleton.Menu = MainMenu;
            Engine.Singleton.HumanController.SwitchState(HumanController.HumanControllerState.MENU);

            //KONIEC MENUUUUUUUUUUUUUUUUUUUUUUUUUUUu

            Engine.Singleton.SoundManager.BGMPlaylist.Add("title.mp3");
            Engine.Singleton.SoundManager.BGMPlaylist.Add("Folk Round.mp3");
            Engine.Singleton.SoundManager.BGMPlaylist.Add("Achaidh Cheide.mp3");
            Engine.Singleton.SoundManager.BGMPlaylist.Add("Thatched Villagers.mp3");

            Engine.Singleton.SoundManager.PlayBGM();

            Light light = Engine.Singleton.SceneManager.CreateLight();

            light.Type          = Light.LightTypes.LT_DIRECTIONAL;
            light.Direction     = new Vector3(1, -3, 1).NormalisedCopy;
            light.DiffuseColour = new ColourValue(0.2f, 0.2f, 0.2f);

            //Engine.Singleton.SceneManager.AmbientLight = new ColourValue(0.24f, 0.30f, 0.24f);

            Engine.Singleton.SceneManager.ShadowTechnique = ShadowTechnique.SHADOWTYPE_STENCIL_MODULATIVE;

            Engine.Singleton.Mysz = Engine.Singleton.Mouse.MouseState;

            Character player = new Character(CharacterProfileManager.character);

            player.Position    = new Vector3(-3.5f, 0, 1);
            player.Orientation = new Quaternion(new Radian(new Degree(90)), Vector3.UNIT_Y);

            player.Statistics    = new Statistics();
            player.Sword         = (ItemSword)Items.I["sSword"];
            player.GetSwordOrder = true;

            Engine.Singleton.ObjectManager.Add(player);
            Engine.Singleton.HumanController.Character = player;

            Engine.Singleton.CurrentLevel           = new Level();
            Engine.Singleton.CurrentLevel.WayPoints = new List <WayPoint>();
            Engine.Singleton.CurrentLevel.LoadLevel("MenuLevel", "KarczmaNav", true); // MENU LVL

            Engine.Singleton.GameCamera.Character = player;
            Engine.Singleton.GameCamera.Distance  = 7;
            Engine.Singleton.GameCamera.Angle     = new Degree(33);



            String resourceGroupName = "debugger";

            if (ResourceGroupManager.Singleton.ResourceGroupExists(resourceGroupName) == false)
            {
                ResourceGroupManager.Singleton.CreateResourceGroup(resourceGroupName);
            }

            // create material (colour)
            MaterialPtr moMaterial = Mogre.MaterialManager.Singleton.Create("line_material", resourceGroupName);

            moMaterial.ReceiveShadows = false;
            moMaterial.GetTechnique(0).SetLightingEnabled(true);
            moMaterial.GetTechnique(0).GetPass(0).SetDiffuse(0, 0, 1, 0);
            moMaterial.GetTechnique(0).GetPass(0).SetAmbient(0, 0, 1);
            moMaterial.GetTechnique(0).GetPass(0).SetSelfIllumination(0, 0, 1);
            moMaterial.Dispose();

            SceneNode    moNode = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode("line_node");
            ManualObject manOb  = Engine.Singleton.SceneManager.CreateManualObject("line");

            while (true)
            {
                Engine.Singleton.Update();

                if (Engine.Singleton.Keyboard.IsKeyDown(MOIS.KeyCode.KC_ESCAPE) || Engine.Singleton.GameEnder)
                {
                    break;
                }

                if (Engine.Singleton.IsKeyTyped(MOIS.KeyCode.KC_GRAVE))
                {
                    if (Engine.Singleton.HumanController.State == Gra.HumanController.HumanControllerState.TALK)
                    {
                        continue;
                    }

                    Engine.Singleton.Pause = !Engine.Singleton.Pause;
                }

                if (Engine.Singleton.IsKeyTyped(MOIS.KeyCode.KC_F3))
                {
                    DebugMode = !DebugMode;
                }

                if (DebugMode)
                {
                    Engine.Singleton.NewtonDebugger.ShowDebugInformation();
                }
                else
                {
                    Engine.Singleton.NewtonDebugger.HideDebugInformation();
                }

                /*
                 * if (Engine.Singleton.IsKeyTyped(MOIS.KeyCode.KC_P))
                 * {
                 * Engine.Singleton.CurrentLevel.navMesh.AStar(NPCManager.npc.Position, Engine.Singleton.HumanController.Character.Position);
                 * if (Engine.Singleton.CurrentLevel.navMesh.TriPath.Count > 1)
                 * {
                 * Engine.Singleton.CurrentLevel.navMesh.GetPortals();
                 * NPCManager.npc.WalkPath = Engine.Singleton.CurrentLevel.navMesh.Funnel();
                 *
                 * NPCManager.npc.FollowPathOrder = true;
                 * }
                 * }
                 */
            }

            Engine.Singleton.IngameConsole.Exit();
            Engine.Singleton.Root.Dispose();
        }
Ejemplo n.º 14
0
 public override void Dispose()
 {
     MaterialManager.Singleton.Remove(materialPtr.Name);
     materialPtr.Dispose();
 }