protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);
            {
                ///Uncoment to add your model
                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());
                ///Forward Shader (look at this shader construction for more info)
                ForwardXNABasicShader shader = new ForwardXNABasicShader();
                ///Deferred material
                ForwardMaterial fmaterial = new ForwardMaterial(shader);
                ///The object itself
                IObject obj = new IObject(fmaterial, simpleModel, tmesh);
                ///Add to the world
                this.World.AddObject(obj);
            }

            {
                SnowParticleSystem snow = new SnowParticleSystem();
                DPFSParticleSystem ps = new DPFSParticleSystem("snow", snow);
                this.World.ParticleManager.AddAndInitializeParticleSystem(ps);

                ///cant set emiter position before adding the particle
                ///IF YOU DO SO, IT WILL NOT WORK
                snow.Emitter.PositionData.Position = new Vector3(500, 0, 0);
            }


            CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(-50), MathHelper.ToRadians(-10), new Vector3(-150, 150, 150), GraphicInfo);
            this.World.CameraManager.AddCamera(cam);
        }
Exemplo n.º 2
0
        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(), 1, 1,10);
            ///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");
            stm.SetTexture(factory.CreateTexture2DColor(1,1,Color.Green), TextureType.DIFFUSE);
            ///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
            ForwardXNABasicShader shader = new ForwardXNABasicShader();
            ///Deferred material
            ForwardMaterial fmaterial = new ForwardMaterial(shader);
            ///The object itself
            IObject obj = new IObject(fmaterial, stm, to);
            ///Add to the world
            this.World.AddObject(obj);

            shader.BasicEffect.EnableDefaultLighting();

            CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo.Viewport);
            this.World.CameraManager.AddCamera(cam);            
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            ExtractXmlModelLoader ext = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//");
            this.AttachCleanUpAble(ext);
            ModelLoaderData data = ext.Load(factory, GraphicInfo, "shadow");
            WorldLoader wl = new WorldLoader();
            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
            wl.OnCreateILight += new CreateILight(wl_OnCreateILight);
            wl.LoadWorld(factory, GraphicInfo, World, data);
        
            lt = new LightThrowBepu(this.World, factory);

            #region NormalLight            
            ld1 = new DirectionalLightPE(new Vector3(0.2f, -1, 0.2f), Color.White);
            ld1.CastShadown = true;
            float li = 0.9f;
            ld1.LightIntensity = li;
            this.World.AddLight(ld1);            
            #endregion

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

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

            ///Interpolator to change lightDirection
            inter.Start(new Vector3(0, -1, 0), new Vector3(1, -1, 1), 3, true);

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

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

            ExtractXmlModelLoader ext = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//");
            ModelLoaderData data = ext.Load(factory, GraphicInfo, "leonScene");
            WorldLoader wl = new WorldLoader();
            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
            wl.OnCreateILight += new CreateILight(wl_OnCreateILight);
            wl.LoadWorld(factory, GraphicInfo, World, data);

            //IModelo model = new SimpleModel(factory, "Model/leonScene");
            //IPhysicObject po = new TriangleMeshObject(model, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
            //GhostObject po = new GhostObject();
            //IShader shader = new ForwardXNABasicShader();
            //ForwardMaterial dm = new ForwardMaterial(shader);
            //this.World.AddObject(new IObject(dm, model, po));        
            
            CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo);
            cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);

            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker());

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

            CameraFirstPerson CameraFirstPerson = new CameraFirstPerson(true, GraphicInfo);

            Texture2D tMap = factory.GetTexture2D("Textures//hmap_10243");
            QuadTerrain q = new PloobsEngine.Material.QuadTerrain(factory, tMap, 33, 513, 10, 3f);

            DeferredTerrainMaterial mat = new DeferredTerrainMaterial(q);

            //Set various terrain stats.
            mat.diffuseScale = q.flatScale / 4;
            mat.detailScale = q.flatScale / 100;
            mat.detailMapStrength = 2;
            mat.textureBlend = factory.GetTexture2D("Textures//hmap_256blend");
            mat.textureDetail = factory.GetTexture2D("Textures//coolgrass2DOT3");
            mat.textureRed = factory.GetTexture2D("Textures//TexR");
            mat.textureGreen = factory.GetTexture2D("Textures//TexG");
            mat.textureBlue = factory.GetTexture2D("Textures//TexB");
            mat.textureBlack = factory.GetTexture2D("Textures//TexBase");

            TerrainObject to = new TerrainObject(factory,Vector3.Zero, Matrix.Identity, q.getHeightMap() ,MaterialDescription.DefaultBepuMaterial());            
                        
            IObject obj3 = new IObject(mat, null, 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(CameraFirstPerson);
            CameraFirstPerson.FarPlane = 20000;

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

        }
Exemplo n.º 6
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);

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

            ExtractXmlModelLoader ext = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//");
            ModelLoaderData data = ext.Load(factory, GraphicInfo, "sponza");
            WorldLoader wl = new WorldLoader();
            wl.LoadWorld(factory, GraphicInfo, World, data);            

            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.1f;
            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);

            //ld1 = new DirectionalLightPE(new Vector3(0.2f, -1, 0.2f), Color.White);
            //ld1.CastShadown = true;
            //float li = 0.9f;
            //ld1.LightIntensity = li;
            //this.World.AddLight(ld1);
            
            #endregion

            CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo);
            //cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);
            
            /////Interpolator to change lightDirection
            //inter.Start(new Vector3(0, -1, 0), new Vector3(1, -1, 1), 3, true);

            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker());
            this.RenderTechnic.AddPostEffect(new BloomPostEffect());
            //HdrPostEffect HdrPostEffect = new HdrPostEffect();
            //HdrPostEffect.bloomMultiplier = 0.3f;
            //this.RenderTechnic.AddPostEffect(HdrPostEffect);

        }
Exemplo n.º 8
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());
                ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
                ForwardMaterial fmaterial = new ForwardMaterial(shader);
                IObject obj = new IObject(fmaterial, simpleModel, tmesh);
                this.World.AddObject(obj);
            }

            var newCameraFirstPerson = new CameraFirstPerson(GraphicInfo.Viewport);
            //newCameraFirstPerson.UseAcelerometer = true;
            this.World.CameraManager.AddCamera(newCameraFirstPerson);            
        }
        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());
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo,factory, contentManager);

            ExtractMeshesFromMoldelLoader ext = new ExtractMeshesFromMoldelLoader();
            ModelLoaderData data = ext.Load(factory, GraphicInfo, "Model//leonScene");
            WorldLoader wl = new WorldLoader();
            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);            
            wl.LoadWorld(factory, GraphicInfo, World, data);
            
            LightThrowBepu lt = new LightThrowBepu(this.World, factory);

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

            this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker());
        }
Exemplo n.º 11
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());
                ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
                ForwardMaterial fmaterial = new ForwardMaterial(shader);
                IObject obj = new IObject(fmaterial, simpleModel, tmesh);
                obj.Name = "Cenario";
                this.World.AddObject(obj);
            }

            Picking pick = new Picking(this, Microsoft.Xna.Framework.Input.Touch.GestureType.DoubleTap);
            pick.Start();
            pick.OnPickedGesture += new OnPicked(pick_OnPickedGesture);

            var newCameraFirstPerson = new CameraFirstPerson(GraphicInfo);
            this.World.CameraManager.AddCamera(newCameraFirstPerson);
         
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            CameraFirstPerson CameraFirstPerson = new CameraFirstPerson(true, GraphicInfo);

            Texture2D tMap = factory.GetTexture2D("Textures//hmap_10243");
            QuadTerrain q = new PloobsEngine.Material.QuadTerrain(factory, tMap, 33, 513, 10, 3f);

            ForwardTerrainMaterial mat = new ForwardTerrainMaterial(q);

            //Set various terrain stats.
            mat.diffuseScale = q.flatScale / 4;
            mat.detailScale = q.flatScale / 100;
            mat.detailMapStrength = 2;
            mat.textureBlend = factory.GetTexture2D("Textures//hmap_256blend");
            mat.textureDetail = factory.GetTexture2D("Textures//coolgrass2DOT3");
            mat.textureRed = factory.GetTexture2D("Textures//TexR");
            mat.textureGreen = factory.GetTexture2D("Textures//TexG");
            mat.textureBlue = factory.GetTexture2D("Textures//TexB");
            mat.textureBlack = factory.GetTexture2D("Textures//TexBase");

            mat.sunlightVector = Vector3.Normalize(new Vector3(.5f, .5f, .8f));
            mat.sunlightColour = new Vector3(2.3f, 2f, 1.8f);
            TerrainObject to = new TerrainObject(factory,Vector3.Zero, Matrix.Identity, q.getHeightMap() ,MaterialDescription.DefaultBepuMaterial());            
                        
            IObject obj3 = new IObject(mat, null, to);
            this.World.AddObject(obj3);

            LightThrowBepu lt = new LightThrowBepu(this.World, factory);
                        
            this.World.CameraManager.AddCamera(CameraFirstPerson);
            CameraFirstPerson.FarPlane = 20000;

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

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

                ///Cria o shader e o material animados 
                ForwardSimpleAnimationShader sas = new ForwardSimpleAnimationShader(arobo);
                ForwardAnimatedMaterial amat = new ForwardAnimatedMaterial(arobo, sas);

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

            var newCameraFirstPerson = new CameraFirstPerson(GraphicInfo);
            //newCameraFirstPerson.UseAcelerometer = true;
            this.World.CameraManager.AddCamera(newCameraFirstPerson);
        }
Exemplo n.º 14
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);
            }


            #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.FarPlane = 100;
            this.World.CameraManager.AddCamera(cam);

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


            {
                ///Add Decal To the Decal Component
                ///Texture
                Texture2D texture = factory.GetTexture2D("Textures//goo");
                ///The projection Matrix
                var projection = Matrix.CreatePerspectiveFieldOfView(cam.FieldOfView / 20, cam.AspectRatio, 1, 2000);

                ///The view Matrix
                var view = Matrix.CreateLookAt(
                    new Vector3(500, 300, 200),
                    new Vector3(0, 0, 0),
                    Vector3.Up
                    );
                Decal decal = new Decal(texture, view, projection);
                DecalComponent.Decals.Add(decal);
            }
            {
                ///Add Decal To the Decal Component
                ///Texture
                Texture2D texture = factory.GetTexture2D("Textures//goo");
                ///The projection Matrix
                var projection = Matrix.CreatePerspectiveFieldOfView(cam.FieldOfView / 10, cam.AspectRatio, 1, 2000);

                ///The view Matrix
                var view = Matrix.CreateLookAt(
                    new Vector3(500, 500, 700),
                    new Vector3(-200, 50, -10),
                    Vector3.Up
                    );
                Decal decal = new Decal(texture, view, projection);
                DecalComponent.Decals.Add(decal);
            }

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

        }
Exemplo n.º 15
0
        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)
        {
            ///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());
        }
        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);
            }
        }
Exemplo n.º 18
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);

        }
Exemplo n.º 20
0
        /// <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);

            {
                ///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);
            }


            ///Create and add a sound to the SoundAudioPlayer
            ap = new SoundAudioPlayer(factory);
            ap.AddSoundToRepository("Songs/bye", "bye");

            ///Create a sound effect without the SoundAudioPlayer (internaly the SoundAudioPlayer is a container of SimpleSoundEffect -- and some stuffs more)
            se = new SimpleSoundEffect(factory, "Songs/alarm");

            ///Load the Sounds that you hear in your Microsoft Media Player
            ///Just loading the first album found =P
            lm = new LocalMediaAudioPlayer();
            AlbumCollection ac = lm.MediaLibrary.Albums;
            lm.PlayAlbum(ac[0]);
            
            ///Creating a static 3D sound in the 0,0,0 (Bellow the island tree, go there and hear the sound getting louder)
            sound = new Static3DSound(factory, "Songs/pianosong", Vector3.Zero);            
            this.World.AddSoundEmitter(sound, true);

            #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);
        }
Exemplo n.º 22
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
                        
            CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo);
            cam.FarPlane = 1000;
            this.World.CameraManager.AddCamera(cam);
            
            this.RenderTechnic.AddPostEffect(new SSAOPost());

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

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

            ExtractXmlModelLoader ext = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//");
            ModelLoaderData data = ext.Load(factory, GraphicInfo, "techdemo");
            WorldLoader wl = new WorldLoader();
            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
            wl.OnCreateILight += new CreateILight(wl_OnCreateILight);
            wl.LoadWorld(factory, GraphicInfo, World, data);

            LightThrowBepu lt = new LightThrowBepu(this.World, factory);
            {
                l = new DirectionalLightPE(new Vector3(0.2f, -1, 0.2f), Color.White);
                l.CastShadown = true;
                float lii = 0.6f;
                l.LightIntensity = lii;
                this.World.AddLight(l);
            }

            #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.5f;
            //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.FarPlane = 1000;
            cam.MoveSpeed *= 5;
            this.World.CameraManager.AddCamera(cam);

            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 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, "lionscene");
            ///Create the WOrld Loader
            ///Convert the ModelLoaderData in World Entities
            WorldLoader wl = new WorldLoader();
            ///Register some Custom Handler
            ///The Default arent good all the time
            ///Called when an object is created, the default creates a triangle mesh entity and a deferred Material (whith Custom Shader) and add it to the world
            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
            ///When a ligh is created, the default just add the light
            wl.OnCreateILight += new CreateILight(wl_OnCreateILight);
            ///when a camera is created, the default just add the camera
            wl.OnCreateICamera += new CreateICamera(wl_OnCreateICamera);
            wl.LoadWorld(factory, GraphicInfo, World, data);

            ///Add some directional lights
            #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.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

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

            ///add a camera
            CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(30), MathHelper.ToRadians(-30), new Vector3(50,50,75), GraphicInfo);
            cam.FarPlane = 500;
            cam.NearPlane = 1;

            this.World.CameraManager.AddCamera(cam);

            {
                SimpleConcreteKeyboardInputPlayable ik = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.B, bumpChange);
                this.BindInput(ik);
            }
            {
                SimpleConcreteKeyboardInputPlayable ik = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.V, specularChange);
                this.BindInput(ik);
            }

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

        }
Exemplo n.º 25
0
        /// <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)
        {
            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, "SSAO");
            ///Create the WOrld Loader
            ///Convert the ModelLoaderData in World Entities
            WorldLoader wl = new WorldLoader();
            ///Register some Custom HAnlder
            ///The Default arent good all the time
            ///Called when an object is created, the default creates a triangle mesh entity and a deferred Material (whith Custom Shader) and add it to the world
            wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
            ///When a ligh is created, the default just add the light
            wl.OnCreateILight += new CreateILight(wl_OnCreateILight);
            ///when a camera is created, the default just add the camera
            wl.OnCreateICamera += new CreateICamera(wl_OnCreateICamera);
            wl.LoadWorld(factory, GraphicInfo, World, data);
            ///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
                        
            {
                ///har way
                SimpleConcreteKeyboardInputPlayable ik = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Enter,Active);
                this.BindInput(ik);
            }

            {
                ///easy way
                SimpleConcreteKeyboardInputPlayable ik = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Space);
                ik.KeyStateChange += new KeyStateChange(ik_KeyStateChange);
                this.BindInput(ik);
            }

            ssao = new SSAOPostEffect();
            //ssao.OutputONLYSSAOMAP = true;
            ssao.WhiteCorrection = 0.7f;
            ssao.Intensity = 5;
            ssao.Diffscale = 0.5f;            

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


            CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(0), MathHelper.ToRadians(-10), new Vector3(0,100, 150), GraphicInfo);
            ///add a camera
            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());
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            PhysxPhysicWorld PhysxPhysicWorld = World.PhysicWorld as PhysxPhysicWorld;
            
            base.LoadContent(GraphicInfo, factory, contentManager);

            const int maximumParticles = 3000;

            ///Remember
            ///There are 2 math apis (XNA AND PHYSX)
            ///Sometimes we need to convert between then
            ///Use the extension methods AsPhysx() in XNA API and AsXNA in Physx APi

            ///emitter
            var fluidEmitterDesc = new FluidEmitterDescription()
            {
                DimensionX = 1.5f,
                DimensionY = 1.5f,
                Rate = 65,
                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);

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

            
            ///create and add the fluid to the world
            fluid = PhysxPhysicWorld.Scene.CreateFluid(fluidDesc);

            
            ///Use Billboards to render the fuild particles (dummy way)
            Texture2D tex = factory.GetTexture2D("Textures/Smoke");
            for (int i = 0; i < maximumParticles; i++)
            {
                Billboard3D Billboard3D = new Billboard3D(tex,Vector3.Zero,new Vector2(0.001f));
                Billboard3D.Enabled = false;
                CPUSphericalBillboardComponent.Billboards.Add(Billboard3D);
            }


            // 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));
                ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
                ForwardMaterial fmaterial = new ForwardMaterial(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, -20, -55),
                    Shapes = { boxShapeDesc }
                };

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

            BallThrowPhysx28 BallThrowBullet = new BallThrowPhysx28(this.World, GraphicFactory);
            BallThrowBullet.ballSize = 1f;
            BallThrowBullet.Speed = 25;
            this.AttachCleanUpAble(BallThrowBullet);

            CameraFirstPerson CameraFirstPerson = new CameraFirstPerson(GraphicInfo);
            CameraFirstPerson.Position = new Vector3(-35, 8, -52);
            CameraFirstPerson.LeftRightRot = MathHelper.ToRadians(125);
            this.World.CameraManager.AddCamera(CameraFirstPerson);
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo,factory, contentManager);

            SimpleModel simpleModel = new SimpleModel(factory, "Model//block");
            simpleModel.SetTexture(factory.CreateTexture2DColor(1,1,Color.White),TextureType.DIFFUSE);
            BoxObject tmesh = new BoxObject(new Vector3(0,10,0), 1, 1,1,50,new  Vector3(5000,1,5000),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);            
            
            {
                List<BilboardInstance> poss = new List<BilboardInstance>();
                for (int i = -10 ; i < 20; i++)
                {
                    for (int j = -10; j < 20; j++)
                    {
                        float x, y;
                        x = i * 100;
                        y = j * 100;
                        BilboardInstance bi = new BilboardInstance();
                        bi.Scale = new Vector2(100, 100);
                        bi.Position = new Vector3(x, 5, y);
                        poss.Add(bi);
                    }
                }

                ///same as before, just the name of the class change
                ///You can change the position of a individual bilboard using bm.GetBilboardInstances(), updating the structure recieved and 
                ///using bm.SetBilboardInstances(). Dont do this every frame pls =P
                ///You can change lots of parameters of the DeferredInstancedBilboardShader, check it
                InstancedBilboardModel bm = new InstancedBilboardModel(factory, "Bilbs", "..\\Content\\Textures\\tree",poss.ToArray());                
                DeferredInstancedBilboardShader cb = new DeferredInstancedBilboardShader(BilboardType.Cilindric);                
                DeferredMaterial matfor = new DeferredMaterial(cb);
                GhostObject go = new GhostObject();
                IObject obj2 = new IObject(matfor, bm, go);
                this.World.AddObject(obj2);
            }


            #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(-50), MathHelper.ToRadians(-15), new Vector3(-200, 300, 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);

            #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//grassCUBE"), TextureType.AMBIENT_CUBE_MAP);

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

            {
                SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
                simpleModel.SetCubeTexture(factory.GetTextureCube("Textures//grassCUBE"), TextureType.AMBIENT_CUBE_MAP);

                TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
                DeferredNormalShader shader = new DeferredNormalShader(0,0,true,0.05f);
                DeferredMaterial fmaterial = new DeferredMaterial(shader);
                IObject obj = new IObject(fmaterial, simpleModel, tmesh);
                this.World.AddObject(obj);
            }


            {
                SimpleModel simpleModel = new SimpleModel(factory, "Model//ball");
                simpleModel.SetCubeTexture(factory.GetTextureCube("Textures//grassCUBE"), TextureType.AMBIENT_CUBE_MAP);
                simpleModel.SetTexture(factory.CreateTexture2DColor(1,1,Color.White),TextureType.DIFFUSE);

                TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, new Vector3(50,50,-100), Matrix.Identity, Vector3.One * 20, MaterialDescription.DefaultBepuMaterial());
                DeferredNormalShader shader = new DeferredNormalShader(0, 0, true, 0.2f);
                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.2f;
            ld1.LightIntensity = li;
            ld2.LightIntensity = li;
            ld3.LightIntensity = li;
            ld4.LightIntensity = li;
            ld5.LightIntensity = li;
            this.World.AddLight(ld1);            
            this.World.AddLight(ld3);            
            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//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);
         
            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);

            {
                List<Vector3> poss = new List<Vector3>();
                for (int i = 0; i < 10; i++)
                {
                    for (int j = 0; j < 10; j++)
                    {
                        float x, y;
                        x = i * 15;
                        y = j * 15;
                        poss.Add(new Vector3(x, 5, y));
                    }
                }

                ///The Bilboard Model
                StaticBilboardModel bm = new StaticBilboardModel(factory, "Bilbs", "Textures\\grama2", poss);
                ///The Procedural Animated BilboardShader
                DeferredProceduralAnimatedcilindricBilboardShader cb = new DeferredProceduralAnimatedcilindricBilboardShader();
                ///You can change parameters like Amplitude and Speed to control the movement                
                cb.MovimentSpeedControl = 1000;
                
                DeferredMaterial matfor = new DeferredMaterial(cb);
                GhostObject go = new GhostObject();
                go.Position = new Vector3(70, 0, 0);
                IObject obj2 = new IObject(matfor, bm, go);
                this.World.AddObject(obj2);

            }





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

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