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); ///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); }
private CameraYawPitchRoll ChangeNormalMode() { if (m_NormalMode != null) { CameraThirdPerson tp = m_NormalMode as CameraThirdPerson; CameraFirstPerson fp = m_NormalMode as CameraFirstPerson; Transform tar = null; if (tp != null) { tar = tp.m_Character; } if (fp != null) { tar = fp.m_Character; } string name = "Normal Mode F" + m_ControlType.ToString(); m_NormalMode = m_Controller.ReplaceMode(m_NormalMode, name) as CameraYawPitchRoll; if (m_NormalMode is CameraThirdPerson) { (m_NormalMode as CameraThirdPerson).m_Character = tar; } if (m_NormalMode is CameraFirstPerson) { (m_NormalMode as CameraFirstPerson).m_Character = tar; } if (m_Controller.currentMode == m_NormalMode) { m_NormalMode.ModeEnter(); } } return(m_NormalMode); }
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()); }
void UpdateSyncRoll() { CameraThirdPerson tp = m_Controller.currentMode as CameraThirdPerson; CameraFirstPerson fp = m_Controller.currentMode as CameraFirstPerson; CameraYawPitchRoll ypr = m_Controller.currentMode as CameraYawPitchRoll; if (tp != null) { tp.m_SyncRoll = _sync_roll; } if (fp != null) { fp.m_SyncRoll = _sync_roll; } if (!_sync_roll) { if (ypr != null) { ypr.m_Roll *= 0.85f; if (Mathf.Abs(ypr.m_Roll) < 0.005f) { ypr.m_Roll = 0; } } } }
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(-200, 150, 250), GraphicInfo); this.World.CameraManager.AddCamera(cam); }
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); }
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(Vector3.Zero, Matrix.Identity, Vector3.One * 10)); ///Adiciona no mundo this.World.AddObject(marine); //sas.EnableTexture = true; } var newCameraFirstPerson = new CameraFirstPerson(GraphicInfo); this.World.CameraManager.AddCamera(newCameraFirstPerson); }
/// <summary> /// Load content for the screen. /// </summary> /// <param name="GraphicInfo"></param> /// <param name="factory"></param> /// <param name="contentManager"></param> protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); #region Models { ///Need to load the height, the normal texture and the difuse texture SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\block", "..\\Content\\Textures\\color_map"); sm.SetTexture("Textures\\normal_map", TextureType.BUMP); sm.SetCubeTexture(factory.GetTextureCube("Textures//cubemap"), TextureType.ENVIRONMENT); BoxObject pi = new BoxObject(new Vector3(200, 110, 0), 1, 1, 1, 5, new Vector3(100, 100, 100), Matrix.Identity, MaterialDescription.DefaultBepuMaterial()); DeferredEnvironmentCustomShader DeferredEnvironmentCustomShader = new DeferredEnvironmentCustomShader(false, true, false); DeferredEnvironmentCustomShader.SpecularIntensity = 0.2f; DeferredEnvironmentCustomShader.SpecularPower = 30; DeferredEnvironmentCustomShader.ShaderId = ShaderUtils.CreateSpecificBitField(true); IMaterial mat = new DeferredMaterial(DeferredEnvironmentCustomShader); IObject obj3 = new IObject(mat, sm, pi); this.World.AddObject(obj3); } { SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario"); TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial()); DeferredCustomShader shader = new DeferredCustomShader(false, false, false, false); DeferredMaterial fmaterial = new DeferredMaterial(shader); IObject obj = new IObject(fmaterial, simpleModel, tmesh); this.World.AddObject(obj); } #endregion #region NormalLight DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White); DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White); DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White); DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White); DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White); float li = 0.5f; ld1.LightIntensity = li; ld2.LightIntensity = li; ld3.LightIntensity = li; ld4.LightIntensity = li; ld5.LightIntensity = li; this.World.AddLight(ld1); this.World.AddLight(ld2); this.World.AddLight(ld3); this.World.AddLight(ld4); this.World.AddLight(ld5); #endregion CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(10), MathHelper.ToRadians(-10), new Vector3(200, 150, 250), GraphicInfo); this.World.CameraManager.AddCamera(cam); new LightThrowBepu(this.World, GraphicFactory); SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//cubemap"); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc); }
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); { SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\block"); sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Blue), TextureType.DIFFUSE); DeferredNormalShader shader = new DeferredNormalShader(); IMaterial mat = new DeferredMaterial(shader); CharacterControllerInput character = new CharacterControllerInput(this, new Vector3(100, 150, 1), 1, 1, 50, Vector3.One * 10, 0.5f); marine = new IObject(mat, sm, character.Characterobj); this.World.AddObject(marine); LightThrowBepu lt = new LightThrowBepu(this.World, factory); } { SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario"); TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial()); DeferredNormalShader shader = new DeferredNormalShader(); DeferredMaterial fmaterial = new DeferredMaterial(shader); IObject obj = new IObject(fmaterial, simpleModel, tmesh); this.World.AddObject(obj); } #region NormalLight DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White); DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White); DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White); DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White); DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White); float li = 0.5f; ld1.LightIntensity = li; ld2.LightIntensity = li; ld3.LightIntensity = li; ld4.LightIntensity = li; ld5.LightIntensity = li; this.World.AddLight(ld1); this.World.AddLight(ld2); this.World.AddLight(ld3); this.World.AddLight(ld4); this.World.AddLight(ld5); #endregion CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo); cam.MoveSpeed *= 5; this.World.CameraManager.AddCamera(cam); SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grasscube"); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc); }
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); }
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(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); ///Cenario SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\cenario"); IShader normal = new DeferredNormalShader(); IMaterial mat = new DeferredMaterial(normal); IPhysicObject pi = new TriangleMeshObject(sm, new Vector3(0, 10, 100), Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial()); pi.isMotionLess = true; IObject obj4 = new IObject(mat, sm, pi); this.World.AddObject(obj4); ///Luzes DirectionalLightPE ld = new DirectionalLightPE(new Vector3(4, -2, 7), Color.White); this.World.AddLight(ld); ///Camera basica ICamera cam = new CameraFirstPerson(GraphicInfo); cam.Name = "stdCam"; this.World.CameraManager.AddCamera(cam); ///Associando callbacks com eventos do teclado { InputPlayableKeyBoard ipp = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.R, Start); bkk0 = new BindKeyCommand(ipp, BindAction.ADD); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(bkk0); InputPlayableKeyBoard ipp2 = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.T, Stop); bkk1 = new BindKeyCommand(ipp2, BindAction.ADD); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(bkk1); InputPlayableKeyBoard ipp3 = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Y, Load); bkk2 = new BindKeyCommand(ipp3, BindAction.ADD); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(bkk2); } ///Camera Recorder (objeto q gravara e carregara os caminhos) record = new CameraRecordPath(this, cam); record.FinishInTheStartPosition = true; }
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()); }
void Start() { // Player movement scripts click = player.GetComponent <ClickToMove>(); directional = player.GetComponent <DirectionalMove>(); firstPerson = player.GetComponent <FirstPersonMove>(); // Camera movement scripts topDown = cam.GetComponent <CameraTopDown>(); topDownPan = cam.GetComponent <CameraTopDownPan>(); fps = cam.GetComponent <CameraFirstPerson>(); // Set variables for initial camera position and rotation camPos = cam.transform.position; camRot = cam.transform.rotation; }
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(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); 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); #region NormalLight { ld1 = new DirectionalLightPE(new Vector3(0.2f, -1, 0.2f), Color.White); ld1.CastShadown = false; float li = 0.9f; ld1.LightIntensity = li; this.World.AddLight(ld1); } { ld1 = new DirectionalLightPE(new Vector3(0.2f, -1, 0.2f), Color.Red); ld1.CastShadown = true; float li = 2.0f; 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()); }
public FirstPersonCamera(Vector3 position, float rotX, float rotY, ProjectionType projectionType, float zPlaneFar = 50.0f, float zPlaneNear = 0.1f, float fov = 0.6f, float aspectRatio = 1, float width = 1, float height = 1) { cam = new CameraFirstPerson(); cam.Position = position; cam.Heading = rotY; cam.Tilt = rotX; cam.NearClip = zPlaneNear; cam.FarClip = zPlaneFar; this.fov = fov; this.aspectRatio = aspectRatio; this.width = width; this.height = height; this.zPlaneNear = zPlaneNear; this.zPlaneFar = zPlaneFar; this.projectionType = projectionType; InitProjection(); }
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(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); OceanModel wm = new OceanModel(factory, "WaterModel", Vector3.Zero, 256, 256); GhostObject go = new GhostObject(new Vector3(-300, 0, -300), Matrix.Identity, Vector3.One * 2); waterShader = new DeferredWaterShader("Textures/cubemap"); waterShader.SetDefault(); DeferredMaterial wmaterial = new DeferredMaterial(waterShader); IObject obj = new IObject(wmaterial, wm, go); 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.4f; ld1.LightIntensity = li; ld2.LightIntensity = li; ld3.LightIntensity = li; ld4.LightIntensity = li; ld5.LightIntensity = li; this.World.AddLight(ld1); this.World.AddLight(ld2); this.World.AddLight(ld3); this.World.AddLight(ld4); this.World.AddLight(ld5); #endregion this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker()); CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(-120), MathHelper.ToRadians(-5), new Vector3(-70, 70, 90), GraphicInfo); this.World.CameraManager.AddCamera(cam); 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); 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); { 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); }
public override void _Ready() { // Get nodes BodyNode = GetNode("Body") as Spatial; CameraNode = BodyNode.GetNode("Camera") as CameraFirstPerson; ViewModel = CameraNode.GetNode("ViewModel") as PlayerViewModel; // Firing Raycast FiringRaycast = CameraNode.GetNode("FiringRaycast") as RayCast; FiringRaycast.Enabled = true; FiringRaycast.AddException(this); FiringRaycast.CastTo = new Vector3(0, 0, -100.0f); // FloorRay setup FloorRay = GetNode("FloorRay") as RayCast; FloorRay.AddException(this); // Set mouse mode to captured Input.SetMouseMode(Input.MOUSE_MODE_CAPTURED); // Set default vars ResetVars(); }
/// <summary> /// Adds the first person camera events. /// </summary> /// <param name="window">The window.</param> /// <param name="camera">The camera.</param> public static CameraFirstPersonMovementState AddFirstPersonCameraEvents(this INativeWindow window, CameraFirstPerson camera) { window.Resize += (s, e) => camera.Aspect = (float)window.Width / window.Height; window.MouseMove += (s, e) => { if (ButtonState.Pressed == e.Mouse.LeftButton) { camera.Heading += 300 * e.XDelta / (float)window.Width; camera.Tilt += 300 * e.YDelta / (float)window.Height; } }; var movementState = new CameraFirstPersonMovementState(); window.KeyDown += (s, e) => { var delta = 1f; switch (e.Key) { case Key.A: movementState.X = -delta; break; case Key.D: movementState.X = delta; break; case Key.Q: movementState.Y = -delta; break; case Key.E: movementState.Y = delta; break; case Key.W: movementState.Z = -delta; break; case Key.S: movementState.Z = delta; break; } }; window.KeyUp += (s, e) => { switch (e.Key) { case Key.A: movementState.X = 0f; break; case Key.D: movementState.X = 0f; break; case Key.Q: movementState.Y = 0f; break; case Key.E: movementState.Y = 0f; break; case Key.W: movementState.Z = 0f; break; case Key.S: movementState.Z = 0f; break; } }; return(movementState); }
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); }
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()); }