示例#1
0
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            IObject            marine;
            AnimatedController marinecontroler;
            {
                ///carrega o Modelo
                AnimatedModel am = new AnimatedModel(factory, "..\\Content\\Model\\PlayerMarine", "..\\Content\\Textures\\PlayerMarineDiffuse");
                ///Inicializa o Controlador (Idle eh o nome da animacao inicial)
                marinecontroler = new AnimatedController(am, "Idle");

                ///Cria o shader e o material animados
                ForwardSimpleAnimationShader sas  = new ForwardSimpleAnimationShader(marinecontroler);
                ForwardAnimatedMaterial      amat = new ForwardAnimatedMaterial(marinecontroler, sas);
                marine = new IObject(amat, am, new GhostObject(new Vector3(0, -30, 0), Matrix.CreateRotationX(MathHelper.ToRadians(30)), Vector3.One * 0.4f));

                ///Adiciona no mundo
                this.World.AddObject(marine);

                CharacterControllerInput gp = new CharacterControllerInput(this, new Vector3(100, 50, 1), 25, 10, 10, Vector3.One);
                marine = new IObject(amat, am, gp.Characterobj);
                ///Adiciona no mundo
                this.World.AddObject(marine);
            }

            {
                ///carrega o Modelo
                AnimatedModel am = new AnimatedModel(factory, "..\\Content\\Model\\WeaponMachineGun", "..\\Content\\Textures\\WeaponMachineGunDiffuse");
                ///Inicializa o Controlador (Idle eh o nome da animacao inicial)
                AnimatedController arobo = new AnimatedController(am);
                //arobo.isLoop = true;

                ///Cria o shader e o material animados
                ForwardSimpleAnimationShader sas  = new ForwardSimpleAnimationShader(arobo, marine, marinecontroler, "R_Hand2");
                ForwardAnimatedMaterial      amat = new ForwardAnimatedMaterial(arobo, sas);
                IObject gun = new IObject(amat, am, new GhostObject(new Vector3(0, 0, 0), Matrix.Identity, Vector3.One));

                ///Adiciona no mundo
                this.World.AddObject(gun);
            }

            {
                SimpleModel           simpleModel = new SimpleModel(factory, "Model//cenario");
                TriangleMeshObject    tmesh       = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
                ForwardXNABasicShader shader      = new ForwardXNABasicShader();
                ForwardMaterial       fmaterial   = new ForwardMaterial(shader);
                IObject obj = new IObject(fmaterial, simpleModel, tmesh);
                this.World.AddObject(obj);
            }


            CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(-60), MathHelper.ToRadians(-20), new Vector3(30, 50, 50), GraphicInfo);

            cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);

            SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grasscube");

            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            IObject marine;
            AnimatedController marinecontroler;
            {
                ///carrega o Modelo
                AnimatedModel am = new AnimatedModel(factory, "..\\Content\\Model\\PlayerMarine", "..\\Content\\Textures\\PlayerMarineDiffuse");
                ///Inicializa o Controlador (Idle eh o nome da animacao inicial)
                marinecontroler = new AnimatedController(am, "Idle");

                ///Cria o shader e o material animados 
                ForwardSimpleAnimationShader sas = new ForwardSimpleAnimationShader(marinecontroler);
                ForwardAnimatedMaterial amat = new ForwardAnimatedMaterial(marinecontroler, sas);
                marine = new IObject(amat, am, new GhostObject(new Vector3(0, -30, 0), Matrix.CreateRotationX(MathHelper.ToRadians(30)), Vector3.One * 0.4f));

                ///Adiciona no mundo
                this.World.AddObject(marine);                  

                CharacterControllerInput gp = new CharacterControllerInput(this, new Vector3(100, 50, 1), 25, 10, 10, Vector3.One);
                marine = new IObject(amat, am, gp.Characterobj);
                ///Adiciona no mundo
                this.World.AddObject(marine);

            }

            {
                ///carrega o Modelo
                AnimatedModel am = new AnimatedModel(factory, "..\\Content\\Model\\WeaponMachineGun", "..\\Content\\Textures\\WeaponMachineGunDiffuse");
                ///Inicializa o Controlador (Idle eh o nome da animacao inicial)
                AnimatedController arobo = new AnimatedController(am);
                //arobo.isLoop = true;               
                                
                ///Cria o shader e o material animados 
                ForwardSimpleAnimationShader sas = new ForwardSimpleAnimationShader(arobo, marine, marinecontroler, "R_Hand2");
                ForwardAnimatedMaterial amat = new ForwardAnimatedMaterial(arobo, sas);
                IObject gun = new IObject(amat, am, new GhostObject(new Vector3(0, 0, 0), Matrix.Identity, Vector3.One));

                ///Adiciona no mundo
                this.World.AddObject(gun);


            }

            {
                SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
                TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
                ForwardXNABasicShader shader = new ForwardXNABasicShader();
                ForwardMaterial fmaterial = new ForwardMaterial(shader);
                IObject obj = new IObject(fmaterial, simpleModel, tmesh);
                this.World.AddObject(obj);
            }


            CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(-60), MathHelper.ToRadians(-20), new Vector3(30, 50, 50), GraphicInfo);
            cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);

            SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grasscube");
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            var a = AppDomain.CurrentDomain.GetAssemblies();

            IObject            marine;
            AnimatedController marinecontroler;

            {
                ///carrega o Modelo
                AnimatedModel am = new AnimatedModel(factory, "..\\Content\\Model\\PlayerMarine", "..\\Content\\Textures\\PlayerMarineDiffuse");
                ///Inicializa o Controlador (Idle eh o nome da animacao inicial)
                marinecontroler = new AnimatedController(am, "Idle");

                ///Cria o shader e o material animados
                DeferredSimpleAnimationShader sas  = new DeferredSimpleAnimationShader(marinecontroler);
                DeferredAnimatedMaterial      amat = new DeferredAnimatedMaterial(marinecontroler, sas);

                CharacterControllerInput gp = new CharacterControllerInput(this, new Vector3(100, 50, 1), 25, 10, 10, Vector3.One);

                marine = new IObject(amat, am, gp.Characterobj);
                ///Adiciona no mundo
                this.World.AddObject(marine);

                lt = new LightThrowBepu(this.World, factory);
            }

            {
                ///carrega o Modelo
                AnimatedModel am = new AnimatedModel(factory, "..\\Content\\Model\\WeaponMachineGun", "..\\Content\\Textures\\WeaponMachineGunDiffuse");
                ///Inicializa o Controlador (Idle eh o nome da animacao inicial)
                AnimatedController arobo = new AnimatedController(am);
                //arobo.isLoop = true;

                ///Cria o shader e o material animados
                DeferredSimpleAnimationShader sas  = new DeferredSimpleAnimationShader(arobo, marine, marinecontroler, "R_Hand2");
                DeferredAnimatedMaterial      amat = new DeferredAnimatedMaterial(arobo, sas);
                IObject gun = new IObject(amat, am, new GhostObject(new Vector3(0, 0, 0), Matrix.Identity, Vector3.One));

                ///Adiciona no mundo
                this.World.AddObject(gun);
            }

            {
                SimpleModel          simpleModel = new SimpleModel(factory, "Model//cenario");
                TriangleMeshObject   tmesh       = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
                DeferredNormalShader shader      = new DeferredNormalShader();
                DeferredMaterial     fmaterial   = new DeferredMaterial(shader);
                IObject obj = new IObject(fmaterial, simpleModel, tmesh);
                this.World.AddObject(obj);
            }

            #region NormalLight
            DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White);
            DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White);
            DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White);
            DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White);
            DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White);
            float li = 0.5f;
            ld1.LightIntensity = li;
            ld2.LightIntensity = li;
            ld3.LightIntensity = li;
            ld4.LightIntensity = li;
            ld5.LightIntensity = li;
            this.World.AddLight(ld1);
            this.World.AddLight(ld2);
            this.World.AddLight(ld3);
            this.World.AddLight(ld4);
            this.World.AddLight(ld5);
            #endregion



            CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(-60), MathHelper.ToRadians(-20), new Vector3(30, 50, 50), GraphicInfo);
            cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);

            SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grasscube");
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);
        }