sharpdx / SharpDX-Samples

Official repository for all SharpDX Samples
346 stars 222 forks source link

remove model #19

Closed PedroAlvesq closed 9 years ago

PedroAlvesq commented 9 years ago

how i remove a 3D model of my game this is my code

  protected override void LoadContent()
        {
            arial16BMFont = Content.Load<SpriteFont>("Arial16");

            // Load the model (by default the model is loaded with a BasicEffect. Use ModelContentReaderOptions to change the behavior at loading time.
            models = new List<Model>();
            foreach (var modelName in new[] { "Dude" })
            {
                model = Content.Load<Model>(modelName);

                // Enable default lighting  on model.
                BasicEffect.EnableDefaultLighting(model, true);

                models.Add(model);
            }
            model = models[0];

            // Instantiate a SpriteBatch
            spriteBatch = ToDisposeContent(new SpriteBatch(GraphicsDevice));

            InitRes();

            base.LoadContent();

            // initialize the basic effect (shader) to draw the geometry, the BasicEffect class is similar to one from XNA

        }

        public override void Update(GameTime gameTime)
        {

            modelBounds = model.CalculateBounds();

            // Calculates the world and the view based on the model size
            const float MaxModelSize = 10.0f;
            var scaling = MaxModelSize / modelBounds.Radius;
            view = Matrix.LookAtRH(new Vector3(0, 0, MaxModelSize * 2.5f), new Vector3(2, -4, 0), Vector3.UnitY);
            projection = Matrix.PerspectiveFovRH(0.9f, (float)GraphicsDevice.BackBuffer.Width / GraphicsDevice.BackBuffer.Height, 0.1f, MaxModelSize * 10.0f);
            world = Matrix.Translation(-modelBounds.Center.X, -modelBounds.Center.Y, -modelBounds.Center.Z) * Matrix.Scaling(scaling); //* Matrix.RotationY((float)gameTime.TotalGameTime.TotalSeconds);

            base.Update(gameTime);

            // get the total elapsed seconds since the start of the game

        }
        public override void Draw(GameTime gameTime)
        {
            NeoManager.BeginDraw(gameTime);
            GraphicsDevice.Clear(SharpDX.Color.CornflowerBlue);
            model.Draw(GraphicsDevice, world, view, projection);

            /*     spriteBatch.Begin();

                 spriteBatch.DrawString(arial16BMFont, "Press the pointer to switch models...\r\nCurrent Model: " + model.Name, new Vector2(16, 16), Color.White);

                 spriteBatch.End();
                 */
            NeoManager.EndDraw();
            base.Draw(gameTime);
            SharpDX.Toolkit.Graphics.BlendState graphics = GraphicsDevice.BlendStates.Opaque;
            SharpDX.Toolkit.Graphics.DepthStencilState graphics1 = GraphicsDevice.DepthStencilStates.Default;

        }

return the previsious class it is a gamesystem show me the model but i don´t want it show it this is the code

  void btnPrevious_Click(object sender, Controls.EventArgs e)
        {
            chosename.Hide();
            Face.Hide(); ;
            Bodyframe.Hide();
            Names.Hide();
            ServerSection.Hide();
            face.Hide();
            body.Hide();
            Race.Hide();
            Classes.Hide();
            previsius.Hide();
            next.Hide();
            cancel.Hide();
            Quit.Hide();
            mais.Hide();
            menos.Hide();
            esquerda.Hide();
            direita.Hide();
            tbc.Hide();

            ChoseClasscharacters ola = new ChoseClasscharacters(Game, NeoManager);

        }
PedroAlvesq commented 9 years ago

topic can be close problem as been solve with this code this.Game.GameSystem.remove();