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 DeferredSimpleAnimationShader sas = new DeferredSimpleAnimationShader(arobo); DeferredAnimatedMaterial amat = new DeferredAnimatedMaterial(arobo, sas); CharacterControllerInput gp = new CharacterControllerInput(this, new Vector3(100, 50, 1), 25, 10, 10, Vector3.One); IObject marine = new IObject(amat, am, gp.Characterobj); ///Adiciona no mundo 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); }
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); }
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); }
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); }
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); }
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); ///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); 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); }
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()); }
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); }
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); { 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); 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()); }
/// <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); 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()); }
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); 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); 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); 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 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 LightThrowBepu LightThrowBepu = new LightThrowBepu(this.World, factory); this.AttachCleanUpAble(LightThrowBepu); 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"); 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 = 100; this.World.CameraManager.AddCamera(cam); Texture2D texture = factory.GetTexture2D("Textures//goo"); LightThrowBepu lt = new LightThrowBepu(this.World, factory); var projection = Matrix.CreatePerspectiveFieldOfView(cam.FieldOfView / 20, cam.AspectRatio, 1, 1000); var view = Matrix.CreateLookAt( new Vector3(1500, 200, 200), new Vector3(0, 0, 0), Vector3.Up ); Decal decal = new Decal(texture,view,projection); DecalComponent.Decals.Add(decal); 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); { 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); } ///Varios blocos transparentes for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { SimpleModel sm = new SimpleModel(factory, "Model\\block"); sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Yellow), TextureType.DIFFUSE); GhostObject pi = new GhostObject(new Vector3(i * 10, 50, j * 10), Matrix.Identity, new Vector3(5)); pi.isMotionLess = true; DeferredNormalShader s = new DeferredNormalShader(); DeferredMaterial mat = new DeferredMaterial(s); IObject obj4 = new IObject(mat, sm, pi); this.World.AddObject(obj4); } } 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 CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo); cam.MoveSpeed *= 5; this.World.CameraManager.AddCamera(cam); SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grasscube"); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc); //this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker()); //this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectTabula()); this.RenderTechnic.AddPostEffect(new MLAntiAliasingPostEffect()); //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//"); this.AttachCleanUpAble(ext); ModelLoaderData data = ext.Load(factory, GraphicInfo, "tree");//shadow WorldLoader wl = new WorldLoader(); wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject); wl.OnCreateILight += new CreateILight(wl_OnCreateILight); wl.LoadWorld(factory, GraphicInfo, World, data); ///Create the water ///Water is just a Shader that Creats a Water like texture and binds it to a model { IModelo sm = new SimpleModel(factory, "Model\\block"); Matrix trans = Matrix.CreateTranslation(new Vector3(0, 50, 0)); Plane plano = Plane.Transform(new Plane(0, 1, 0, 0), trans); ///The water is VERRRRY big, the reflection and refraction will looks like blocked, its normal, increasy the size of the reflection/refrection buffer to correct this (bigger cost) ///We normally use the SAME transformation applyied to the plane (if not stranges affects can happen) IPhysicObject pi = new BoxObject(new Vector3(0, 50, 0), 1, 1, 1, 5, new Vector3(3000, 0.1f, 3000), trans, MaterialDescription.DefaultBepuMaterial()); pi.isMotionLess = true; ///Water shader, will refract and reflect according to the plano passed in the parameter ///Using default Parameters, there are lots of things that can be changed. See WaterCompleteShader DeferredWaterCompleteShader shader = new DeferredWaterCompleteShader(800, 600, plano, 0.1f); shader.SpecularIntensity = 0.01f; shader.SpecularPower = 50; IMaterial mat = new DeferredMaterial(shader); IObject obj4 = new IObject(mat, sm, pi); this.World.AddObject(obj4); } IObject spobj = this.World.Objects[0]; 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); //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); SpotLightPE sl = new SpotLightPE(new Vector3(-56, 700, 30), new Vector3(0.1f, -0.8f, 0.3f), Color.White, 1f, 100000, (float)Math.Cos(Math.PI / 3), 1f); sl.CastShadown = true; this.World.AddLight(sl); #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); { 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); { 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 //HSVEffect hsv = new HSVEffect(new Vector4(), new Vector4(1.5f,1,1,1)); //this.RenderTechnic.AddPostEffect(hsv); //BackgroundTexture bt = new BackgroundTexture("Textures//Bubble"); //this.RenderTechnic.AddPostEffect(bt); //SharpenPostEffect sharpen = new SharpenPostEffect(); //this.RenderTechnic.AddPostEffect(sharpen); //DreamPostEffect dp = new DreamPostEffect(); //this.RenderTechnic.AddPostEffect(dp); //NightPostEffect np = new NightPostEffect(); //this.RenderTechnic.AddPostEffect(np); //HeatPostEffect h = new HeatPostEffect(); //this.RenderTechnic.AddPostEffect(h); //FogPostEffect fog = new FogPostEffect(1, 1000); //fog.FogColor = Color.Red; //this.RenderTechnic.AddPostEffect(fog); //BlackWhitePostEffect b = new BlackWhitePostEffect(); //this.RenderTechnic.AddPostEffect(b); //AntiAliasingPostEffect aa = new AntiAliasingPostEffect(); //this.RenderTechnic.AddPostEffect(aa); //DepthCueingPostEffect dc = new DepthCueingPostEffect(); //this.RenderTechnic.AddPostEffect(dc); //GaussianBlurPostEffect gb = new GaussianBlurPostEffect(); //this.RenderTechnic.AddPostEffect(gb); //RadialBlurPostEffect rb = new RadialBlurPostEffect(); //this.RenderTechnic.AddPostEffect(rb); //BloomPostEffect bloomPostEffect = new BloomPostEffect(); //this.RenderTechnic.AddPostEffect(bloomPostEffect); //DephtOfFieldPostEffect dof = new DephtOfFieldPostEffect(); //this.RenderTechnic.AddPostEffect(dof); //HdrPostEffect hdr = new HdrPostEffect(); //this.RenderTechnic.AddPostEffect(hdr); SSAOPostEffect ssao = new SSAOPostEffect(); //ssao.OutputONLYSSAOMAP = true; ssao.WhiteCorrection = 0.7f; ssao.Intensity = 5; ssao.Diffscale = 0.5f; ssao.BlurMode = BlurMode.NONE; this.RenderTechnic.AddPostEffect(ssao); //SunPostEffect sun = new SunPostEffect(); //this.RenderTechnic.AddPostEffect(sun); //AdvancedTone PostEffectTest = new AdvancedTone(); //this.RenderTechnic.AddPostEffect(PostEffectTest); //GlowPostEffect glow = new GlowPostEffect(); //this.RenderTechnic.AddPostEffect(glow); //UnderWater nt = new UnderWater(); //this.RenderTechnic.AddPostEffect(nt); CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo); cam.MoveSpeed *= 5; this.World.CameraManager.AddCamera(cam); LightThrowBepu lt = new LightThrowBepu(this.World, factory); //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); { 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 = 100; this.World.CameraManager.AddCamera(cam); Texture2D texture = factory.GetTexture2D("Textures//goo"); LightThrowBepu lt = new LightThrowBepu(this.World, factory); var projection = Matrix.CreatePerspectiveFieldOfView(cam.FieldOfView / 20, cam.AspectRatio, 1, 1000); var view = Matrix.CreateLookAt( new Vector3(1500, 200, 200), new Vector3(0, 0, 0), Vector3.Up ); Decal decal = new Decal(texture, view, projection); DecalComponent.Decals.Add(decal); 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(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager) { ///must be called before all base.LoadContent(GraphicInfo, factory, contentManager); this.gf = factory; ///Uncoment to Add an object /////Create a simple object /////Geomtric Info and textures (this model automaticaly loads the texture) //SimpleModel simpleModel = new SimpleModel(factory, "Model FILEPATH GOES HERE", "Diffuse Texture FILEPATH GOES HERE -- Use only if it is not embeded in the Model file"); /////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); List<IObject> balls = new List<IObject>(); Vector3 pos1,pos2; pos1 = Vector3.Zero; pos2 = new Vector3(0,-3,0); IObject ball1 = CreateSphere(pos1, Matrix.Identity); ball1.PhysicObject.isMotionLess = true; // Setting the Parent object as imovable World.AddObject(ball1); IObject ball2 = CreateSphere(pos2,Matrix.Identity); World.AddObject(ball2); balls.Add(ball2); constraint = new PointPointConstraint((pos1 + pos2) / 2, ball1.PhysicObject, ball2.PhysicObject); World.PhysicWorld.AddConstraint(constraint); ///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 LightThrowBepu 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"); 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); } ///Varios blocos transparentes for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { SimpleModel sm = new SimpleModel(factory, "Model\\block"); sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Yellow), TextureType.DIFFUSE); GhostObject pi = new GhostObject(new Vector3(i * 10, 50, j * 10), Matrix.Identity, new Vector3(5)); pi.isMotionLess = true; DeferredNormalShader s = new DeferredNormalShader(); DeferredMaterial mat = new DeferredMaterial(s); IObject obj4 = new IObject(mat, sm, pi); this.World.AddObject(obj4); } } 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 CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo); cam.MoveSpeed *= 5; this.World.CameraManager.AddCamera(cam); SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grasscube"); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc); //this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker()); //this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectTabula()); this.RenderTechnic.AddPostEffect(new MLAntiAliasingPostEffect()); //this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect()); }
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 DeferredSimpleAnimationShader sas = new DeferredSimpleAnimationShader(arobo); DeferredAnimatedMaterial amat = new DeferredAnimatedMaterial(arobo, sas); CharacterControllerInput gp = new CharacterControllerInput(this, new Vector3(100, 50, 1), 25, 10, 10, Vector3.One); IObject marine = new IObject(amat, am, gp.Characterobj); ///Adiciona no mundo 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); }