/// <summary>
        /// Create a simple Sphere object
        /// </summary>
        /// <param name="pos"></param>
        /// <param name="ori"></param>
        /// <returns></returns>
        private IObject SpawnPrimitive(Vector3 pos, Matrix ori)
        {
            ///Load a Model with a custom texture
            sm2 = new SimpleModel(factory,"Model\\ball");
            sm2.SetTexture(factory.CreateTexture2DColor(1,1,Color.White,false), TextureType.DIFFUSE);
            IMaterial m;
            if (forward)
            {
                ForwardXNABasicShader nd = new ForwardXNABasicShader();
                m = new ForwardMaterial(nd);
            }
            else
            {
                DeferredNormalShader nd = new DeferredNormalShader();
                m = new DeferredMaterial(nd);
            }

            PhysxPhysicWorld PhysxPhysicWorld = _mundo.PhysicWorld as PhysxPhysicWorld;

            ///First we create a shape description
            SphereShapeDescription SphereGeometry = new SphereShapeDescription(ballSize);
            ///then we create the physic object
            PhysxPhysicObject PhysxPhysicObject = new PhysxPhysicObject(SphereGeometry,
                0.5f, Matrix.CreateTranslation(pos), Vector3.One * ballSize);
            
            IObject o = new IObject(m, sm2, PhysxPhysicObject);
            return o;
        }
        /// <summary>
        /// Load content for the screen.
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            #region Models

            {
                ///Need to load the height, the normal texture and the difuse texture
                SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\block", "..\\Content\\Textures\\color_map");
                sm.SetTexture("Textures\\normal_map", TextureType.BUMP);                
                sm.SetCubeTexture(factory.GetTextureCube("Textures//cubemap"),TextureType.ENVIRONMENT);

                BoxObject pi = new BoxObject(new Vector3(200, 110, 0), 1, 1, 1, 5, new Vector3(100, 100, 100), Matrix.Identity, MaterialDescription.DefaultBepuMaterial());
                DeferredEnvironmentCustomShader DeferredEnvironmentCustomShader = new DeferredEnvironmentCustomShader(false, true, false);
                DeferredEnvironmentCustomShader.SpecularIntensity = 0.2f;
                DeferredEnvironmentCustomShader.SpecularPower = 30;
                DeferredEnvironmentCustomShader.ShaderId = ShaderUtils.CreateSpecificBitField(true);
                IMaterial mat = new DeferredMaterial(DeferredEnvironmentCustomShader);
                IObject obj3 = new IObject(mat, sm, pi);
                this.World.AddObject(obj3);
            }

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

            #endregion            

            #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(10), MathHelper.ToRadians(-10), new Vector3(200, 150, 250), GraphicInfo);
            this.World.CameraManager.AddCamera(cam);

            new LightThrowBepu(this.World, GraphicFactory);

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

            {
                SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\block");
                sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Blue), TextureType.DIFFUSE);

                DeferredNormalShader shader = new DeferredNormalShader();

                IMaterial mat = new DeferredMaterial(shader);
                CharacterControllerInput character = new CharacterControllerInput(this, new Vector3(100, 150, 1), 1, 1, 50, Vector3.One * 10,0.5f);

                marine = new IObject(mat, sm, character.Characterobj);                
                this.World.AddObject(marine);

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

            {
                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(GraphicInfo);
            cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);

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

        }       
Пример #4
0
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo,factory, contentManager);
            {
                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);
            }

            {
                SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\block");
                sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.White), TextureType.DIFFUSE);
                BoxObject pi = new BoxObject(new Vector3(100, 40, 0), 1, 1, 1, 25, new Vector3(100, 10, 100), Matrix.Identity, MaterialDescription.DefaultBepuMaterial());
                DeferredNormalShader shader = new DeferredNormalShader();
                IMaterial mat = new DeferredMaterial(shader);
                IObject obj3 = new IObject(mat, sm, pi);
                this.World.AddObject(obj3);
            }            

            #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

            //SBlurPost hsv = new SBlurPost(1, SurfaceFormat.HdrBlendable);
            //hsv.ImageSamplerState = SamplerState.PointClamp;
            //this.RenderTechnic.AddPostEffect(hsv);

            DownSamplePostEffect DownSamplePostEffect = new Post.DownSamplePostEffect();
            this.RenderTechnic.AddPostEffect(DownSamplePostEffect);
            
            CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo);
            cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);

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

        }   
        /// <summary>
        /// Load content for the screen.
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
        {
            ///must be called before all
            base.LoadContent(GraphicInfo, factory, contentManager);

            RegisterDebugDrawCommand rc = new RegisterDebugDrawCommand(ddrawer);
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(rc);

            ddrawer.AddShape(new DebugBox(new BoundingBox(new Vector3(-50),new Vector3(50)),Color.Red));

            DebugLine dl = new DebugLine(Vector3.Zero, new Vector3(1000, 1000, 1000), Color.Red);
            ddrawer.AddShape(dl);

            DebugLines dls = new DebugLines();
            ddrawer.AddShape(dls);

            dls.AddLine(Vector3.Zero, new Vector3(-1000, 1000, -1000), Color.Green);
            dls.AddLine(Vector3.Zero, new Vector3(-1000, 1000, 1000), Color.Pink);

            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);

            ///Add some directional lights to completely iluminate the world
            #region Lights
            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.4f;
            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

            ///Add a AA post effect
            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect());

            ///add a camera
            this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
        }
Пример #6
0
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo,factory, contentManager);
            this.contentManager = contentManager;
    
            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);            
            
            //ap = new SoundAudioPlayer(contentManager);
            //ap.AddSoundToRepository("Songs/bye", "bye");

            //se = new SimpleSoundEffect(contentManager, "Songs/alarm");

            //LocalMediaAudioPlayer lm = new LocalMediaAudioPlayer();
            //AlbumCollection ac = lm.MediaLibrary.Albums;
            //lm.PlayAlbum(ac[0]);
            
            sound = new Static3DSound(factory, "Songs/pianosong", Vector3.Zero);
            this.World.AddSoundEmitter(sound, true);

            //ObjectFollower3DSound sound2 = new ObjectFollower3DSound(contentManager, "Songs/pianosong", 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

            this.World.CameraManager.AddCamera(new CameraFirstPerson(true,GraphicInfo));

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

        }
        /// <summary>
        /// Load content for the screen.
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
        {
            ///must be called before all
            base.LoadContent(GraphicInfo, factory, contentManager);

            RegisterDebugDrawCommand rc = new RegisterDebugDrawCommand(ddrawer);
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(rc);
            
            ///Create a simple object
            ///Geomtric Info and textures (this model automaticaly loads the texture)
            SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
            ///Physic info (position, rotation and scale are set here)
            TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
            ///Shader info (must be a deferred type)
            DeferredNormalShader shader = new DeferredNormalShader();
            ///Material info (must be a deferred type also)
            DeferredMaterial fmaterial = new DeferredMaterial(shader);
            ///The object itself
            IObject obj = new IObject(fmaterial, simpleModel, tmesh);
            ///Add to the world
            this.World.AddObject(obj);

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

            ///Add some directional lights to completely iluminate the world
            #region Lights
            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.4f;
            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

            ///Add a AA post effect
            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect());

            ///add a camera
            this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {

            base.LoadContent(GraphicInfo,factory, contentManager);


            Picking picking = new Picking(this);
            this.AddScreenUpdateable(picking);

            perlim = factory.CreateTexture2DPerlinNoise(512, 512, 0.03f, 3f, 0.5f, 1);
            to = new TerrainObject(factory,perlim, Vector3.Zero, Matrix.Identity, MaterialDescription.DefaultBepuMaterial(), 2, 2);
            //TerrainObject to = new TerrainObject(factory,"..\\Content\\Textures\\Untitled",Vector3.Zero,Matrix.Identity,MaterialDescription.DefaultBepuMaterial(),2,1);
            TerrainModel stm = new TerrainModel(factory, to,"TerrainName","..\\Content\\Textures\\Terraingrass", "..\\Content\\Textures\\rock", "..\\Content\\Textures\\sand", "..\\Content\\Textures\\snow");
            DeferredTerrainShader shader = new DeferredTerrainShader(TerrainType.MULTITEXTURE);
            DeferredMaterial mat = new DeferredMaterial(shader);
            IObject obj3 = new IObject(mat, stm, to);
            this.World.AddObject(obj3);

            
        
            #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

            this.World.CameraManager.AddCamera(new CameraFirstPerson(true,GraphicInfo));

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

            ///O PICKING FUNCIONA APENAS COM OBJETOS QUE TENHAM CORPO FISICO REAL !!!
            ///OS GHOST E OS DUMMY NUNCA SERAO SELECIONADOS
            ///Para ser informado a todo frame sobre as colisoes do raio, basta utilizar o outro construtor
            picking.OnPickedLeftButton += new OnPicked(onPick); 

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


            {
                SimpleModel simpleModel = new SimpleModel(factory, "Model//techdemo");
                GhostObject tmesh = new GhostObject();
                DeferredNormalShader shader = new DeferredNormalShader();
                DeferredMaterial fmaterial = new DeferredMaterial(shader);
                IObject obj = new IObject(fmaterial, simpleModel, tmesh);
                this.World.AddObject(obj);
            }



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

            #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);
            DirectionalLightPE ld6 = new DirectionalLightPE(Vector3.Up, Color.White);
            float li = 0.9f;
            ld1.LightIntensity = li;
            ld2.LightIntensity = li;
            ld3.LightIntensity = li;
            ld4.LightIntensity = li;
            ld5.LightIntensity = li;            
            ld6.LightIntensity = li;
            this.World.AddLight(ld1);
            this.World.AddLight(ld2);
            this.World.AddLight(ld3);
            this.World.AddLight(ld4);
            this.World.AddLight(ld5);
            this.World.AddLight(ld6);

            #endregion

            CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo);
            cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);
            
            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect());

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

            ///Create the Terrain Object
            ///Controls how the heigh map is loaded
            TerrainObject to = new TerrainObject(factory,"..\\Content\\Textures\\Untitled",Vector3.Zero,Matrix.Identity,MaterialDescription.DefaultBepuMaterial(),2,1);
            ///Create the Model using the Terrain Object. Here we pass the textures used, in our case we are using MultiTextured Terrain so we pass lots of textures
            TerrainModel stm = new TerrainModel(factory, to,"TerrainName","..\\Content\\Textures\\Terraingrass", "..\\Content\\Textures\\rock", "..\\Content\\Textures\\sand", "..\\Content\\Textures\\snow");
            ///Create the shader
            ///In this sample we passed lots of textures, each one describe a level in the terrain, the ground is the sand and grass. the hills are rocks and the "mountains" are snow
            ///They are interpolated in the shader, you can control how using the shader parameters exposed in the DeferredTerrainShader
            DeferredTerrainShader shader = new DeferredTerrainShader(TerrainType.MULTITEXTURE);
            ///the classic material
            DeferredMaterial mat = new DeferredMaterial(shader);
            IObject obj3 = new IObject(mat, stm, to);
            this.World.AddObject(obj3);

            lt = new LightThrowBepu(this.World, factory);
        
            #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(30), MathHelper.ToRadians(-10), new Vector3(200, 150, 250), GraphicInfo);
            this.World.CameraManager.AddCamera(cam);

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

            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker());
        }
        protected override void  LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
        {
 	        base.LoadContent(GraphicInfo, factory, contentManager);     

            ///Create a Simple Model
            IModelo sm = new SimpleModel(factory, "..\\Content\\Model\\cenario");            
            ///Create a Physic Object
            IPhysicObject pi = new TriangleMeshObject(sm, Vector3.Zero, Matrix.Identity, Vector3.One,MaterialDescription.DefaultBepuMaterial());
            pi.isMotionLess = true;
            ///Create a shader 
            IShader shader = new DeferredNormalShader();            
            ///Create a Material
            IMaterial mat = new DeferredMaterial(shader);
            ///Create a an Object that englobs everything and add it to the world
            IObject obj4 = new IObject(mat, sm,pi);
            this.World.AddObject(obj4);

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

            ///Create a FirstPerson Camera
            ///This is a special camera, used in the development
            ///You can move around using wasd / qz / and the mouse
            ICamera cam = new CameraFirstPerson(GraphicInfo);
            this.World.CameraManager.AddCamera(cam);

            PointLightCircularUpdater lcu = new PointLightCircularUpdater(this);

            ///Create 100 moving point lights and add to the world
            ///IF the radius of the point light is TOO big like 250, it will make the game slower
            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    PointLightPE pl0 = new PointLightPE(new Vector3(i * 5, 25, j * 5), StaticRandom.RandomColor(), 100, 2);
                    pl0.UsePointLightQuadraticAttenuation = true;
                    lcu.AddLight(pl0, 0.01f, 50 * i, j / StaticRandom.Random());                    
                    this.World.AddLight(pl0);
                }
            }

            lcu.Start();
            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect());
        }
        /// <summary>
        /// Load content for the screen.
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
        {
            ///must be called before all
            base.LoadContent(GraphicInfo, factory, contentManager);

            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);

            ///Add some directional lights to completely iluminate the world
            #region Lights
            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.4f;
            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

            ///Add a AA post effect
            //this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect());

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

            ///add a camera
            this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo,factory, contentManager);

            SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
            simpleModel.SetTexture(factory.GetTexture2D("textures/islandmap2"), TextureType.DIFFUSE);
            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);

            this.RenderTechnic.AddPostEffect(new GammaCorrectionPostEffect(GammaType.Normal)); 
            
            #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

            this.World.CameraManager.AddCamera(new CameraFirstPerson(true,GraphicInfo));

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

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

            TerrainObject to = new TerrainObject(factory,"..\\Content\\Textures\\Untitled",Vector3.Zero,Matrix.Identity,MaterialDescription.DefaultBepuMaterial(),2,1);
            TerrainModel stm = new TerrainModel(factory, to,"TerrainName","..\\Content\\Textures\\Terraingrass", "..\\Content\\Textures\\rock", "..\\Content\\Textures\\sand", "..\\Content\\Textures\\snow");
            DeferredTerrainShader shader = new DeferredTerrainShader(TerrainType.MULTITEXTURE);
            DeferredMaterial mat = new DeferredMaterial(shader);
            IObject obj3 = new IObject(mat, stm, to);
            this.World.AddObject(obj3);

            LightThrowBepu lt = new LightThrowBepu(this.World, factory);
        
            #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

            this.World.CameraManager.AddCamera(new CameraFirstPerson(true,GraphicInfo));

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

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

            {
                SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
                TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
                PrePassShader shader = new PrePassShader();                
                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.3f;
            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

            LightThrowBepu LightThrowBepu = new LightThrowBepu(this.World,factory);
            this.AttachCleanUpAble(LightThrowBepu);

            this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
        }
        protected IObject CreateTriangleMeshModelU(String fileName, Vector3 position, Matrix orientation, Vector3 scale)
        {
            CreateInternalModel(fileName);
            SimpleModel simpleModel = new SimpleModel(graphicFactory, "Loaded/" + modelLoaded[fileName]);

            ///Physic info (position, rotation and scale are set here)
            TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, position, orientation, scale, MaterialDescription.DefaultBepuMaterial());
            ///Shader info (must be a deferred type)
            DeferredNormalShader shader = new DeferredNormalShader();
            ///Material info (must be a deferred type also)
            DeferredMaterial fmaterial = new DeferredMaterial(shader);
            ///The object itself
            return new IObject(fmaterial, simpleModel, tmesh);
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            PhysxPhysicWorld PhysxPhysicWorld = World.PhysicWorld as PhysxPhysicWorld;
            
            base.LoadContent(GraphicInfo, factory, contentManager);

            const int maximumParticles = 1000;
            var fluidEmitterDesc = new FluidEmitterDescription()
            {
                DimensionX = 0.5f,
                DimensionY = 0.5f,
                Rate = 15,
                RelativePose =
                    Phyx.Matrix.RotationAxis(new Phyx.Vector3(0, 1, 0), (float)Math.PI) *
                    Phyx.Matrix.Translation(-40, 10, -50),
                Shape = EmitterShape.Rectangular,
                Type = EmitterType.ConstantFlowRate,
                RandomAngle = 0.5f
            };
            fluidEmitterDesc.Flags |= (FluidEmitterFlag.Enabled | FluidEmitterFlag.Visualization);

            var fluidDesc = new FluidDescription()
            {
                Emitters = { fluidEmitterDesc },
                Flags = FluidFlag.Enabled | FluidFlag.Visualization | FluidFlag.Enabled,
                MaximumParticles = maximumParticles,
                
            };
            fluidDesc.ParticleWriteData.AllocatePositionBuffer<Vector3>(maximumParticles);
            fluidDesc.ParticleWriteData.NumberOfParticles = maximumParticles;

            InstancedBilboardModel InstancedBilboardModel = new InstancedBilboardModel(factory, "teste", "Textures/Smoke", new BilboardInstance[] {new BilboardInstance() }, maximumParticles);
            PhysxFluidObject PhysxFluidObject = new PloobsEngine.Physics.PhysxFluidObject(fluidDesc);
            DeferredInstancedBilboardShader DeferredInstancedBilboardShader = new PloobsEngine.Material.DeferredInstancedBilboardShader(BilboardType.Spherical);
            DeferredInstancedBilboardShader.AlphaTestLimit = 0.2f;
            FluidMaterial DeferredMaterial = new FluidMaterial(DeferredInstancedBilboardShader,maximumParticles,new Vector2(0.2f));
            IObject IObject = new IObject(DeferredMaterial, InstancedBilboardModel, PhysxFluidObject);
            this.World.AddObject(IObject);


            // Ledge
            {
                var boxShapeDesc = new BoxShapeDescription(5, 0.1f, 5);
                SimpleModel SimpleModel = new PloobsEngine.Modelo.SimpleModel(factory, "Model/block");
                SimpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Red), TextureType.DIFFUSE);

                PhysxPhysicObject PhysxPhysicObject = new PloobsEngine.Physics.PhysxPhysicObject(boxShapeDesc,
                    (Phyx.Matrix.RotationX(-0.5f) * Phyx.Matrix.Translation(-40, 5, -52)).AsXNA(),new Vector3(5,0.1f,5));
                DeferredNormalShader shader = new DeferredNormalShader();
                DeferredMaterial fmaterial = new DeferredMaterial(shader);
                IObject obj = new IObject(fmaterial, SimpleModel, PhysxPhysicObject);
                this.World.AddObject(obj);
            }

            // Drain
            {
                var boxShapeDesc = new BoxShapeDescription(5, 0.1f, 5);
                boxShapeDesc.Flags |= ShapeFlag.FluidDrain;

                var drainActorDesc = new ActorDescription()
                {
                    GlobalPose = Phyx.Matrix.Translation(-40, 0, -55),
                    Shapes = { boxShapeDesc }
                };

                var drianActor = PhysxPhysicWorld.Scene.CreateActor(drainActorDesc);
            }

            #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


            BallThrowPhysx28 BallThrowBullet = new BallThrowPhysx28(this.World, GraphicFactory,false);
            this.AttachCleanUpAble(BallThrowBullet);

            this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
        }
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
        {
            ///Must be called before everything in the LoadContent
            base.LoadContent(GraphicInfo, factory, contentManager);            

            ///Create a Simple Model
            IModelo sm = new SimpleModel(factory,"..\\Content\\Model\\cenario");            
            ///Create a Physic Object
            IPhysicObject pi = new TriangleMeshObject(sm, Vector3.Zero,Matrix.Identity,Vector3.One,MaterialDescription.DefaultBepuMaterial());
            pi.isMotionLess = true;
            ///Create a shader 
            IShader shader = new DeferredNormalShader();            
            ///Create a Material
            IMaterial mat = new DeferredMaterial(shader);
            ///Create a an Object that englobs everything and add it to the world
            IObject obj4 = new IObject(mat, sm,pi);
            this.World.AddObject(obj4);


            ///Create the Physic Objects
            {
                for (int i = 0; i < 15; i++)
                {
                    CreateThrash(new Vector3(-70 + i * 5, 50, 10));
                }

                for (int i = 0; i < 15; i++)
                {
                    CreateBox(new Vector3(-70 + i * 7, 100, 50));
                }

                for (int i = 0; i < 15; i++)
                {
                    CreateThrash(new Vector3(-70 + i * 5, 80, 50));
                }

                for (int i = 0; i < 15; i++)
                {
                    CreateBall(new Vector3(-70 + i * 5, 50, 30));
                }

                for (int i = 0; i < 15; i++)
                {
                    CreateBox(new Vector3(-70 + i * 7, 130, -20));
                }

                for (int i = 0; i < 15; i++)
                {
                    CreateBox(new Vector3(-70 + i * 7, 60, -50));
                }


                ///Create A Ghost Object (Do Not Collide)
                {
                    ///Create a Simple Model
                    SimpleModel model = new SimpleModel(factory, "..\\Content\\Model\\ball");
                    model.SetTexture(factory.CreateTexture2DColor(1,1,Color.Purple), TextureType.DIFFUSE);                    
                    ///Create a Physic Object
                    IPhysicObject pobj = new GhostObject(new Vector3(50, 13f, 50), Matrix.Identity, Vector3.One * 5);
                    pobj.isMotionLess = true;
                    ///Create a shader   
                    IShader nd = new DeferredNormalShader();
                    ///Create a Material
                    IMaterial material = new DeferredMaterial(shader);
                    ///Create a an Object that englobs everything and add it to the world
                    IObject obj = new IObject(material, model, pobj);
                    this.World.AddObject(obj);

                }

            }

            ///Call the function releaseObjects when Space key is pressed
            InputPlayableKeyBoard ip1 = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Microsoft.Xna.Framework.Input.Keys.Space, releaseObjects);
            ///Using the Global Method, need to release when screen is cleaned
            ///Check the KeyboardInputScreen for how to use it locally
            mm = new BindKeyCommand(ip1, BindAction.ADD);
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(mm);

            ///Create a FirstPerson Camera
            ///This is a special camera, used in the development
            ///You can move around using wasd / qz / and the mouse
            CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo);            
            this.World.CameraManager.AddCamera(cam);

            ///Create some directionals lights and add to the world
            DirectionalLightPE ld = new DirectionalLightPE(Vector3.Forward, Color.White);
            DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Left, Color.White);
            DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Down, Color.White);
            ld.LightIntensity = 0.5f;
            ld2.LightIntensity = 0.5f;
            ld3.LightIntensity = 0.5f;
            this.World.AddLight(ld);
            this.World.AddLight(ld2);
            this.World.AddLight(ld3);

            lightThrow = new LightThrowBepu(this.World,factory);

            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect());
        }
        private void CreateBox(Vector3 pos)
        {
            ///Create a Simple Model
            SimpleModel model = new SimpleModel(GraphicFactory,"..\\Content\\Model\\cubo");
            model.SetTexture(GraphicFactory.CreateTexture2DColor(1,1, StaticRandom.RandomColor()), TextureType.DIFFUSE);
            
            ///Create a Physic Object
            IPhysicObject pobj = new BoxObject(pos,1,1,1, 10, new Vector3(2),Matrix.Identity,MaterialDescription.DefaultBepuMaterial());
            pobj.isMotionLess = true;
            ///Create a shader   
            IShader nd = new DeferredNormalShader();

            ///Create a Material                
            IMaterial material = new DeferredMaterial(nd);
            ///Create a an Object that englobs everything and add it to the world
            IObject obj = new IObject(material, model,pobj);
            this.World.AddObject(obj);
            objects.Add(obj);
        }
        private void CreateThrash(Vector3 pos)
        {
            ///Create a Simple Model
            ///thash Has a Texture Inside the .X file (not the texture itself, just the name of it) 
            ///The simpleModel will find it and will attach to the Object
            IModelo model = new SimpleModel(GraphicFactory,"..\\Content\\Model\\trash");
            
            ///Create a Physic Object
            IPhysicObject pobj = new CapsuleObject(pos,2,1,10,Matrix.Identity,MaterialDescription.DefaultBepuMaterial());
            pobj.isMotionLess = true;
            ///Create a shader 
            IShader nd = new DeferredNormalShader();

            ///Create a Material                
            IMaterial material = new DeferredMaterial(nd);
            ///Create a an Object that englobs everything and add it to the world
            IObject obj = new IObject(material, model, pobj);
            this.World.AddObject(obj);
            objects.Add(obj);            
        }
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);                        

            #region Models
            ///Cria um modelo Controlavel pelo teclado
            {
                SimpleModel sm = new SimpleModel(factory,"..\\Content\\Model\\cubo");
                sm.SetTexture(factory.CreateTexture2DColor(1,1,Color.Blue),TextureType.DIFFUSE);

                DeferredNormalShader shader = new DeferredNormalShader();                
                
                IMaterial mat = new DeferredMaterial(shader);
                CharacterControllerInput character = new CharacterControllerInput(this, new Vector3(100, 150, 1), 1, 1, 50, Vector3.One * 10, 0.5f);
                
                character.AheadKey = Keys.G;
                character.BackKey = Keys.T;
                character.LeftKey = Keys.F;
                character.RightKey = Keys.H;
                character.JumpKey = Keys.R;                
                character.Characterobj.CharacterController.MaxSpeed = 35f;
                character.Characterobj.CharacterController.JumpSpeed = 15f;
                player = new IObject(mat, sm, character.Characterobj);
                this.World.AddObject(player);
            }            

            ///Cria o cenario padrao de sempre ;)
            {
                SimpleModel sm = new SimpleModel(factory,"..\\Content\\Model\\cenario");
                
                IPhysicObject pi = new TriangleMeshObject(sm,Vector3.Zero, Matrix.Identity,Vector3.One,MaterialDescription.DefaultBepuMaterial());
                DeferredNormalShader shader = new DeferredNormalShader();                                
                IMaterial mat = new DeferredMaterial(shader);
                IObject obj3 = new IObject(mat, sm, pi);
                this.World.AddObject(obj3);
            }
            
            #endregion

            #region Cameras

            cam0 = new CameraFollowObject(player); 
            ///Dando um nome a ela (para poder recupera-la depois)
            cam0.Name = "follow";
            cam0.FarPlane = 3000;
            ///Adiciona ao Manager (NAO ESTA SENDO ATIVADA, APENAS ADICIONADA)
            this.World.CameraManager.AddCamera(cam0, cam0.Name);
            ///Ativa a camera atual (AO ADICIONAR UMA CAMERA AO WORLD USANDO mundo.AddCamera(cam) A CAMERA EH AUTOMATICAMENTE ATIVADA  )
            this.World.CameraManager.SetActiveCamera(cam0.Name);
            ///Adiciona na lista circular
            camerasNames.Value = cam0.Name;
            camerasNames.Next();

            cam1 = new CameraFirstPerson(GraphicInfo);
            ///Dando um nome a ela (para poder recupera-la depois)
            cam1.Name = "first person";
            cam1.FarPlane = 3000;
            ///Adiciona ao Manager (NAO ESTA SENDO ATIVADA, APENAS ADICIONADA)
            this.World.CameraManager.AddCamera(cam1, cam1.Name);
            ///Ativa a camera atual (AO ADICIONAR UMA CAMERA AO WORLD USANDO mundo.AddCamera(cam) A CAMERA EH AUTOMATICAMENTE ATIVADA  )
            this.World.CameraManager.SetActiveCamera(cam1.Name);
            ///Adiciona na lista circular
            camerasNames.Value = cam1.Name;
            //camerasNames.Next();

            #endregion

            ///Objeto que permite atirar bolas de luzes na cena
            lt = new LightThrowBepu(this.World, factory);

            #region NormalLight
            ///Conjunto de luzes direcionais
            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.4f;
            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
            
            {
                SimpleConcreteKeyboardInputPlayable ik = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Space, ChangeCamera);
                BindKeyCommand bk = new BindKeyCommand(ik, BindAction.ADD);
                CommandProcessor.getCommandProcessor().SendCommandAssyncronous(bk);
            }
        }
Пример #22
0
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            #region Models
            {
                SimpleModel simpleModel = new SimpleModel(factory, "..\\Content\\Model\\teapot");
                simpleModel.SetTexture(factory.CreateTexture2DColor(1,1, Color.Red), TextureType.DIFFUSE);
                //TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());

                GhostObject tmesh = new GhostObject(Vector3.Zero, Matrix.Identity, Vector3.One);
                ///Environment Map Shader, there are 2 options, the first is a fully reflective surface (dont use the object texture) and the second
                ///is a mix of the object texture and the environment texture
                ///Used to fake ambient reflection, give metal appearence to an object ....
                DeferredEMReflectiveShader shader = new DeferredEMReflectiveShader("Textures\\grassCUBE", 0.9f);
                DeferredMaterial fmaterial = new DeferredMaterial(shader);
                tea = new IObject(fmaterial, simpleModel, tmesh);

                tea.OnUpdate += new OnUpdate(tea_OnUpdate);
                this.World.AddObject(tea);                
                
            }

            //{
            //    SimpleModel simpleModel = new SimpleModel(factory, "Model//block");
            //    simpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.White), TextureType.DIFFUSE);
            //    BoxObject tmesh = new BoxObject(new Vector3(0,-20,0), 1, 1, 1, 10, new Vector3(200, 1, 200), Matrix.Identity, MaterialDescription.DefaultBepuMaterial());
            //    tmesh.isMotionLess = true;
            //    DeferredNormalShader shader = new DeferredNormalShader();
            //    DeferredMaterial fmaterial = new DeferredMaterial(shader);
            //    IObject obj = new IObject(fmaterial, simpleModel, tmesh);
            //    this.World.AddObject(obj);
            //}


            #endregion

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

            #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

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

            CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(30), MathHelper.ToRadians(-30), new Vector3(30, 30, 50), GraphicInfo);
            cam.FarPlane = 500;
            cam.NearPlane = 1;
            this.World.CameraManager.AddCamera(cam);

            //AntiAliasingPostEffectTabula aa = new AntiAliasingPostEffectTabula();
            //aa.Weights = 2;
            //this.RenderTechnic.AddPostEffect(aa);
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            {
                {
                    ///Create the xml file model extractor
                    ///Loads a XML file that was export by our 3DS MAX plugin
                    ExtractXmlModelLoader ext = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//");
                    this.AttachCleanUpAble(ext);
                    ///Extract all the XML info (Model,Cameras, ...)
                    ModelLoaderData data = ext.Load(factory, GraphicInfo, "ilha");
                    ///Create the WOrld Loader
                    ///Convert the ModelLoaderData in World Entities
                    WorldLoader wl = new WorldLoader(); ///all default                
                    wl.LoadWorld(factory, GraphicInfo, World, data);
                }
            }

            {
                SimpleModel sm2 = new SimpleModel(factory, "Model\\ball");
                sm2.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Red, false), TextureType.DIFFUSE);
                DeferredNormalShader nd = new DeferredNormalShader();
                IMaterial m = new DeferredMaterial(nd);
                SphereObject pi2 = new SphereObject(new Vector3(100,50,0), 1, 10, 10, MaterialDescription.DefaultBepuMaterial());
                IObject o = new IObject(m, sm2, pi2);
                this.World.AddObject(o);

                sound2 = new ObjectFollower3DSound(factory, "Songs/pianosong", o);                
                this.World.AddSoundEmitter(sound2,true);                
            }

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

            #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(30), MathHelper.ToRadians(-10), new Vector3(200, 150, 250), GraphicInfo);
            this.World.CameraManager.AddCamera(cam);

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

        }
        /// <summary>
        /// Load content for the screen.
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            ///Classic Island
            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);

            {
                ///Procedural yellow diffuse texture
                SimpleModel sm = new SimpleModel(factory, "Model\\block");
                sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.BlueViolet), TextureType.DIFFUSE);
                ///physic Ghost object(no collision)
                GhostObject pi = new GhostObject(new Vector3(0, 0, 0), Matrix.Identity, new Vector3(500, 500, 500));
                pi.isMotionLess = true;
                ///Transparency shader                    
                ///Transparent objects are NOT affected by lights
                ///It is a forward shader in the deferred engine (applied after all deferreed processing)
                ForwardTransparenteShader s = new ForwardTransparenteShader();
                ///If the texture does not have Alpha, you can create an alpha for all the model
                s.TransparencyLevel = 0.3f;
                ///THIS MODEL is DRAW AFTER all the Deferred ones (remember:light wont afect it)
                ///You can use all the forward material the same way we are using this
                ForwardMaterial mat = new ForwardMaterial(s);
                IObject obj4 = new IObject(mat, sm, pi);
                this.World.AddObject(obj4);
            }


            ///Transparent blocks
            for (int k = 0; k < 5; k++)
            {
                for (int i = 0; i < 5; i++)
                {
                    for (int j = 0; j < 5; j++)
                    {
                        ///Procedural yellow diffuse texture
                        SimpleModel sm = new SimpleModel(factory, "Model\\block");
                        sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Yellow), TextureType.DIFFUSE);
                        ///physic Ghost object(no collision)
                        GhostObject pi = new GhostObject(new Vector3(i * 10, 50 + k * 10, j * 10), Matrix.Identity, new Vector3(5));
                        pi.isMotionLess = true;
                        ///Transparency shader                    
                        ///Transparent objects are NOT affected by lights
                        ///It is a forward shader in the deferred engine (applied after all deferreed processing)
                        ForwardTransparenteShader s = new ForwardTransparenteShader();
                        ///If the texture does not have Alpha, you can create an alpha for all the model
                        s.TransparencyLevel = 0.3f;
                        ///THIS MODEL is DRAW AFTER all the Deferred ones (remember:light wont afect it)
                        ///You can use all the forward material the same way we are using this
                        ForwardMaterial mat = new ForwardMaterial(s);
                        IObject obj4 = new IObject(mat, sm, pi);
                        this.World.AddObject(obj4);
                    }

                }
            }            

            #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(30), MathHelper.ToRadians(-10), new Vector3(200, 150, 250), GraphicInfo);

            this.World.CameraManager.AddCamera(cam);

            SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grassCUBE");
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);
        }
 protected IObject CreateBoxMeshModelU(String fileName, Vector3 position, Matrix orientation, float xlengh, float ylengh, float zlengh, Vector3 scale, float mass = 10)
 {
     SimpleModel simpleModel = new SimpleModel(graphicFactory, fileName);
     ///Physic info (position, rotation and scale are set here)
     BoxObject tmesh = new BoxObject(position, xlengh, ylengh, zlengh, mass, scale, orientation, MaterialDescription.DefaultBepuMaterial());
     ///Shader info (must be a deferred type)
     DeferredNormalShader shader = new DeferredNormalShader();
     ///Material info (must be a deferred type also)
     DeferredMaterial fmaterial = new DeferredMaterial(shader);
     ///The object itself
     return new IObject(fmaterial, simpleModel, tmesh);
 }
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);                        
        
            #region Models
            ///Paralelepipelo (cubo com scale ) enviara mensagens quando colidir com objetos
            ///Object that will send messages when something collides with it
            {
                SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\cubo");
                sm.SetTexture(factory.CreateTexture2DColor(1,1, Color.White), TextureType.DIFFUSE);                
                BoxObject pi = new BoxObject(new Vector3(100, 40, 0), 1,1,1, 25,new Vector3(100, 10, 100),Matrix.Identity,MaterialDescription.DefaultBepuMaterial());                
                ///Adiciona um handler que sera chamada quando uma colisao acontecer
                ///Add a handler that will handle the colision =P
                pi.Entity.CollisionInformation.Events.InitialCollisionDetected += new BEPUphysics.Collidables.Events.InitialCollisionDetectedEventHandler<BEPUphysics.Collidables.MobileCollidables.EntityCollidable>(Events_InitialCollisionDetected);
                DeferredNormalShader shader = new DeferredNormalShader();                                
                IMaterial mat = new DeferredMaterial(shader);
                IObject obj3 = new IObject(mat, sm, pi);                
                this.World.AddObject(obj3);
            }

            ////CUBO Q VAI MUDAR DE COR
            ///Object that will recieve the message (collision message send from the above object) and will change color.
            {
                SimpleModel sm = new SimpleModel(factory,"..\\Content\\Model\\cubo");
                sm.SetTexture(factory.CreateTexture2DColor(1,1, Color.Yellow), TextureType.DIFFUSE);                
                BoxObject pi = new BoxObject(new Vector3(50, 50, 50), 1,1,1, 5, new Vector3(15),Matrix.Identity,MaterialDescription.DefaultBepuMaterial());
                pi.isMotionLess = true;
                DeferredNormalShader shader = new DeferredNormalShader();
                IMaterial mat = new DeferredMaterial(shader);
                IObject obj3 = new IObject(mat, sm, pi);                
                ///Adiciona um handler para tratar das mensagens (existe outra maneira mais robusta de fazer isto, conforme citado no exemplo sobre Triggers)
                ///hanlde incomming messages
                obj3.OnRecieveMessage += new OnRecieveMessage(obj3_OnRecieveMessage);
                ///Forcando um ID, normalmente ele eh setado automaticamente ao adicionar o objeto no mundo
                ///Set the Id, forcing it  (you can only force ids less than 1000)
                obj3.SetId(77);
                this.World.AddObject(obj3);
                long id = obj3.GetId();
                ///Testa se o Id atribuido eh o forcado 
                ///Internamente a Engine atribui Ids acima de 1000 (valores abaixo funcionarao, a menos que alguem ja tenha forcado este Id antes)                
                ///Como neste caso nao forcamos o id de ninguem para 77, entao o obj3 tera id 77
                ///Soh pra garantir ;)
                ///Just check
                Debug.Assert(id == 77);
             
            }

            ////cubo que escuta um canal de mensagens
            ///Cube that listen a channel
            {
                SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\cubo");
                sm.SetTexture(factory.CreateTexture2DColor(1,1,Color.Red), TextureType.DIFFUSE);                
                BoxObject pi = new BoxObject(new Vector3(100, 50, 50), 1,1,1, 50, new Vector3(15),Matrix.Identity,MaterialDescription.DefaultBepuMaterial());
                pi.isMotionLess = true;
                DeferredNormalShader shader = new DeferredNormalShader();
                IMaterial mat = new DeferredMaterial(shader);
                IObject obj3 = new IObject(mat, sm, pi);                
                ///Adiciona um handler para tratar das mensagens (existe outra maneira mais robusta de fazer isto, conforme citado no exemplo sobre Triggers)
                ///OBSERVAR QUE FOI USADO O MESMO HANDLER QUE O OBJETO ANTERIOR (JA QUE DESEJA-SE TER O MESMO EFEITO)
                ///hanle messages
                obj3.OnRecieveMessage += new OnRecieveMessage(obj3_OnRecieveMessage);                
                this.World.AddObject(obj3);                

                ///Adiciona este objeto ao canal de comunicao chamado "cubo" (recebera mensagens deste grupo tb)
                ///REGISTER IN THIS MESSAGE CHANNEL
                EntityMapper.getInstance().AddgrouptagRecieveEntity("cubo", obj3);
            }


            {
                SimpleModel sm = new SimpleModel(factory,"..\\Content\\Model\\cenario");
                IPhysicObject pi = new TriangleMeshObject(sm, Vector3.Zero,Matrix.Identity,Vector3.One,MaterialDescription.DefaultBepuMaterial());
                DeferredNormalShader shader = new DeferredNormalShader();
                IMaterial mat = new DeferredMaterial(shader);
                IObject obj3 = new IObject(mat, sm, pi);                
                this.World.AddObject(obj3);
            }            
            

            #endregion            

            cam = new CameraFirstPerson(GraphicInfo);            
            cam.FarPlane = 3000;

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

            #region NormalLight
            ///Conjunto de luzes direcionais
            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.4f;
            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
            
            this.World.CameraManager.AddCamera(cam);
            
        }
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);
        
            ///Create a Simple Model
            IModelo sm = new SimpleModel(factory, "..\\Content\\Model\\cenario");            
            ///Create a Physic Object
            IPhysicObject pi = new TriangleMeshObject(sm, Vector3.Zero, Matrix.Identity, Vector3.One,MaterialDescription.DefaultBepuMaterial());
            ///Create a shader 
            IShader shader = new DeferredNormalShader();            
            ///Create a Material
            IMaterial mat = new DeferredMaterial(shader);
            ///Create a an Object that englobs everything and add it to the world
            IObject obj4 = new IObject(mat, sm, pi);
            this.World.AddObject(obj4);

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

            ///Create a FirstPerson Camera
            ///This is a special camera, used in the development
            ///You can move around using wasd / qz / and the mouse
            ICamera cam = new CameraFirstPerson(GraphicInfo);
            this.World.CameraManager.AddCamera(cam);

            {
                SpotLightPE sp1 = new SpotLightPE(new Vector3(0, 150, 0), new Vector3(0, -1, 0), Color.YellowGreen, 1, 600, (float)Math.Cos(Math.PI / 7), 0.5f);
                SpotLightCircularUpdater spc1 = new SpotLightCircularUpdater(this, sp1, 0.01f, 1, 0, true);
                this.World.AddLight(sp1);

                SpotLightPE sp2 = new SpotLightPE(new Vector3(0, 150, 0), new Vector3(0, -1, 0),Color.Red, 1, 600, (float)Math.Cos(Math.PI / 7), 0.5f);
                SpotLightCircularUpdater spc2 = new SpotLightCircularUpdater(this, sp2, 0.01f, 1, (float)Math.PI / 2, true);
                this.World.AddLight(sp2);

                SpotLightPE sp3 = new SpotLightPE(new Vector3(0, 150, 0), new Vector3(0, -1, 0), Color.Red, 1, 600, (float)Math.Cos(Math.PI / 7), 0.5f);
                SpotLightCircularUpdater spc3 = new SpotLightCircularUpdater(this, sp3, 0.01f, 1, (float)Math.PI, true);
                this.World.AddLight(sp3);

                SpotLightPE sp4 = new SpotLightPE(new Vector3(0, 150, 0), new Vector3(0, -1, 0), Color.Green, 1, 600, (float)Math.Cos(Math.PI / 7), 0.5f);
                SpotLightCircularUpdater spc4 = new SpotLightCircularUpdater(this, sp4, 0.01f, 1, (float)(Math.PI * 3) / 2, true);
                this.World.AddLight(sp4);
            }

            {
                SpotLightPE sp1 = new SpotLightPE(new Vector3(0, 150, 0), new Vector3(0, -1, 0), Color.Purple, 1, 600, (float)Math.Cos(Math.PI / 7), 0.5f);
                SpotLightCircularUpdater spc1 = new SpotLightCircularUpdater(this, sp1, 0.02f, 2, 0, false);
                this.World.AddLight(sp1);

                SpotLightPE sp2 = new SpotLightPE(new Vector3(0, 150, 0), new Vector3(0, -1, 0), Color.PowderBlue, 1, 600, (float)Math.Cos(Math.PI / 7), 0.5f);
                SpotLightCircularUpdater spc2 = new SpotLightCircularUpdater(this, sp2, 0.02f, 2, (float)Math.PI / 2, false);
                this.World.AddLight(sp2);

                SpotLightPE sp3 = new SpotLightPE(new Vector3(0, 150, 0), new Vector3(0, -1, 0),Color.YellowGreen, 1, 600 , (float)Math.Cos(Math.PI / 7), 0.5f);
                SpotLightCircularUpdater spc3 = new SpotLightCircularUpdater(this, sp3, 0.02f, 2, (float)Math.PI, false);
                this.World.AddLight(sp3);

                SpotLightPE sp4 = new SpotLightPE(new Vector3(0, 150, 0), new Vector3(0, -1, 0), Color.Maroon, 1, 600, (float)Math.Cos(Math.PI / 7), 0.5f);
                SpotLightCircularUpdater spc4 = new SpotLightCircularUpdater(this, sp4, 0.02f, 2, (float)(Math.PI * 3) / 2, false);
                this.World.AddLight(sp4);
            }


            {
                SpotLightPE sp1 = new SpotLightPE(new Vector3(0, 150, 0), new Vector3(0, -1, 0), Color.PapayaWhip,1, 600 , (float)Math.Cos(Math.PI / 7), 0.5f);
                SpotLightCircularUpdater spc1 = new SpotLightCircularUpdater(this, sp1, 0.03f, 3, (float)Math.PI / 4, true);
                this.World.AddLight(sp1);

                SpotLightPE sp2 = new SpotLightPE(new Vector3(0, 150, 0), new Vector3(0, -1, 0), Color.LightSeaGreen, 1, 600, (float)Math.Cos(Math.PI / 7), 0.5f);
                SpotLightCircularUpdater spc2 = new SpotLightCircularUpdater(this, sp2, 0.03f, 3, (float)Math.PI / 4 + (float)Math.PI / 2, true);
                this.World.AddLight(sp2);

                SpotLightPE sp3 = new SpotLightPE(new Vector3(0, 150, 0), new Vector3(0, -1, 0), Color.Gold, 1, 600, (float)Math.Cos(Math.PI / 7), 0.5f);
                SpotLightCircularUpdater spc3 = new SpotLightCircularUpdater(this, sp3, 0.03f, 3, (float)Math.PI / 4 + (float)Math.PI, true);
                this.World.AddLight(sp3);

                SpotLightPE sp4 = new SpotLightPE(new Vector3(0, 150, 0), new Vector3(0, -1, 0), Color.Aqua,1, 600 , (float)Math.Cos(Math.PI / 7), 0.5f);
                SpotLightCircularUpdater spc4 = new SpotLightCircularUpdater(this, sp4, 0.03f, 3, (float)Math.PI / 4 + (float)(Math.PI * 3) / 2, true);
                this.World.AddLight(sp4);
            }

            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect());
        }
        /// <summary>
        /// Load content for the screen.
        /// </summary>
        /// <param name="GraphicInfo"></param>
        /// <param name="factory"></param>
        /// <param name="contentManager"></param>
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
        {
            ///must be called before all
            base.LoadContent(GraphicInfo, factory, contentManager);

            {
                ///Create a simple object
                ///Geomtric Info and textures (this model automaticaly loads the texture)
                SimpleModel simpleModel = new SimpleModel(factory, "model/dude");
                //simpleModel.SetTexture(factory.CreateTexture2DColor(1,1,Color.Red), TextureType.DIFFUSE);
                ///Physic info (position, rotation and scale are set here)
                GhostObject pi = new GhostObject(new Vector3(200, 10, 0), Matrix.Identity, new Vector3(4));
                ///Shader info (must be a deferred type)
                DeferredNormalShader shader = new DeferredNormalShader();
                shader.ShaderId = ShaderUtils.CreateBitField(false,false,false,false,true);
                ///Material info (must be a deferred type also)
                DeferredMaterial fmaterial = new DeferredMaterial(shader);
                fmaterial.IsVisible = false;
                ///The object itself
                IObject obj = new IObject(fmaterial, simpleModel, pi);
                ///Add to the world
                this.World.AddObject(obj);
                StealthPostEffect StealthPostEffect = new StealthPostEffect();
                StealthPostEffect.objs.Add(obj);
                this.RenderTechnic.AddPostEffect(StealthPostEffect);
            }

            

            {
                ///Create a simple object
                ///Geomtric Info and textures (this model automaticaly loads the texture)
                SimpleModel simpleModel = new SimpleModel(factory, "model/cenario");
                ///Physic info (position, rotation and scale are set here)
                TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
                ///Shader info (must be a deferred type)
                DeferredNormalShader shader = new DeferredNormalShader();
                ///Material info (must be a deferred type also)
                DeferredMaterial fmaterial = new DeferredMaterial(shader);
                ///The object itself
                IObject obj = new IObject(fmaterial, simpleModel, tmesh);
                ///Add to the world
                this.World.AddObject(obj);
            }
            ///Add some directional lights to completely iluminate the world
            #region Lights
            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.4f;
            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

            ///Add a AA post effect
            //this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect());

            ///add a camera
            this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));

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

            #region Models

            ///Cria uma textura 1x1 com a cor branca
            Texture2D white = factory.CreateTexture2DColor(1,1, Color.White);
            {
                SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\cubo");
                sm.SetTexture(white, TextureType.DIFFUSE);
                
                BoxObject pi = new BoxObject(new Vector3(100, 20, 0), 1,1,1, 5,new Vector3(100, 5, 100),Matrix.Identity,MaterialDescription.DefaultBepuMaterial());
                DeferredNormalShader shader = new DeferredNormalShader();                
                ///Setando alguns parametros do material
                shader.SpecularIntensity = 0.01f;
                shader.SpecularPower = 50;                
                IMaterial mat = new DeferredMaterial(shader);
                IObject obj3 = new IObject(mat, sm, pi);
                this.World.AddObject(obj3);
            }

            {
                SimpleModel sm = new SimpleModel(factory,"..\\Content\\Model\\cubo");
                sm.SetTexture(white, TextureType.DIFFUSE);
                
                BoxObject pi = new BoxObject(new Vector3(90, 30, 0), 1,1,1, 10,new Vector3(1),Matrix.Identity,MaterialDescription.DefaultBepuMaterial());
                DeferredNormalShader shader = new DeferredNormalShader();                
                
                IMaterial mat = new DeferredMaterial(shader);
                IObject obj3 = new IObject(mat, sm, pi);
                this.World.AddObject(obj3);                
            }


            {
                SimpleModel sm = new SimpleModel(factory,"..\\Content\\Model\\cenario");                
                IPhysicObject pi = new TriangleMeshObject(sm,Vector3.Zero,Matrix.Identity,Vector3.One,MaterialDescription.DefaultBepuMaterial());
                DeferredNormalShader shader = new DeferredNormalShader();
                IMaterial mat = new DeferredMaterial(shader);
                IObject obj3 = new IObject(mat, sm, pi);
                this.World.AddObject(obj3);
            }
            

            #endregion                                    
           
            #region NormalLight
            ///Conjunto de luzes direcionais
            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.4f;
            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

            
            ///Criando uma camera estatica
            CameraStatic camx = new CameraStatic(new Vector3(130, 100, 700), Vector3.Zero);
            ///Dando um nome a ela (para poder recupera-la depois)
            camx.Name = "default";
            camx.FarPlane = 3000;
            ///Adiciona ao Manager (NAO ESTA SENDO ATIVADA, APENAS ADICIONADA)
            this.World.CameraManager.AddCamera(camx, camx.Name);
            ///Ativa a camera atual (AO ADICIONAR UMA CAMERA AO WORLD USANDO mundo.AddCamera(cam) A CAMERA EH AUTOMATICAMENTE ATIVADA  )
            this.World.CameraManager.SetActiveCamera(camx.Name);
            ///Adiciona na lista circular
            camerasNames.Value = camx.Name;
            camerasNames.Next();          

            ///Idem para uma segunda camera (Porem esta nao eh ativada)
            CameraStatic cam2 = new CameraStatic(new Vector3(100, 100, 100), Vector3.Zero);
            cam2.Name = "StaticCamera";
            cam2.FarPlane = 3000;
            this.World.CameraManager.AddCamera(cam2, cam2.Name);
            camerasNames.Value = cam2.Name;
            camerasNames.Next();

            ///Idem para a terceira
            CameraStatic cam3 = new CameraStatic(new Vector3(500, 300, 300), Vector3.Zero);
            cam3.Name = "StaticCamera3";
            cam3.FarPlane = 3000;
            this.World.CameraManager.AddCamera(cam3, cam3.Name);
            camerasNames.Value = cam3.Name;
            camerasNames.Next();


            SimpleConcreteKeyboardInputPlayable ikp = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Space, KeyStateChange);
            bk = new BindKeyCommand(ikp, BindAction.ADD);
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(bk);            
        }
        protected override void  LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);
            
            #region Models

            {
                SimpleModel sm = new SimpleModel(factory,"..\\Content\\Model\\cenario");                
                IPhysicObject pi = new TriangleMeshObject(sm,Vector3.Zero, Matrix.Identity,Vector3.One,MaterialDescription.DefaultBepuMaterial());
                DeferredNormalShader shader = new DeferredNormalShader();
                shader.SpecularIntensity = 0;
                shader.SpecularPower = 0;                
                IMaterial mat = new DeferredMaterial(shader);
                IObject obj3 = new IObject(mat, sm, pi);
                this.World.AddObject(obj3);
            }


            #endregion

            cam = new CameraFirstPerson(GraphicInfo);
            cam.FarPlane = 3000;

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

            #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.4f;
            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
            
            this.World.CameraManager.AddCamera(cam);            
            

            ///Bind a Key event (combination of Key + state(pressed, Released ...) + inputMask ) to a function
            SimpleConcreteKeyboardInputPlayable ik1 = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.T,g1, InputMask.G1);
            ///When you use the method Bind of a IScreen, The key event will be sent by the engine while this screen remains added in the ScreenManager.
            ///TO create a Gloal Input (Keep working even if the screen goes away), see the DemosHomeScreen.cs
            this.BindInput(ik1);            
           
            SimpleConcreteKeyboardInputPlayable ik2 = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Y, g2,InputMask.G2);
            this.BindInput(ik2);
            
            ///The SYSTEM Mask is Always On (cant be turned off)
            SimpleConcreteKeyboardInputPlayable ik3 = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Space, ChangeGroup,InputMask.GSYSTEM);
            this.BindInput(ik3);            
            
            ///StateKey.DOWN mean when the key is down the event will be fired --looooots of times(samae as UP)
            ///StateKey.PRESS is fired ONCE when the key is pressed (same as RELEASE)
            ///WHEN USING COMBOS, use DOWN AND UP (better for precision)
            ///The parameter EntityType is not used internaly 
            SimpleConcreteKeyboardInputPlayable ik4 = new SimpleConcreteKeyboardInputPlayable(StateKey.DOWN, new Keys[] { Keys.LeftControl, Keys.U }, Multiple);
            this.BindInput(ik4);

            ///Send a command (design pattern) to the InputSystem to change the InputMask            
            TurnOnInputMaskCommand tom = new TurnOnInputMaskCommand(InputMask.GALL);
            CommandProcessor.getCommandProcessor().SendCommandAssyncronous(tom);

            isAllActive = true;

            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect());
        }