/// <summary> /// Load content for the screen. /// </summary> /// <param name="GraphicInfo"></param> /// <param name="factory"></param> /// <param name="contentManager"></param> protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager) { ///must be called before all base.LoadContent(GraphicInfo, factory, contentManager); RegisterDebugDrawCommand rc = new RegisterDebugDrawCommand(ddrawer); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(rc); ddrawer.AddShape(new DebugBox(new BoundingBox(new Vector3(-50), new Vector3(50)), Color.Red)); DebugLine dl = new DebugLine(Vector3.Zero, new Vector3(1000, 1000, 1000), Color.Red); ddrawer.AddShape(dl); DebugLines dls = new DebugLines(); ddrawer.AddShape(dls); dls.AddLine(Vector3.Zero, new Vector3(-1000, 1000, -1000), Color.Green); dls.AddLine(Vector3.Zero, new Vector3(-1000, 1000, 1000), Color.Pink); SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario"); TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial()); DeferredNormalShader shader = new DeferredNormalShader(); DeferredMaterial fmaterial = new DeferredMaterial(shader); IObject obj = new IObject(fmaterial, simpleModel, tmesh); this.World.AddObject(obj); ///Add some directional lights to completely iluminate the world #region Lights DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White); DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White); DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White); DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White); DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White); float li = 0.4f; ld1.LightIntensity = li; ld2.LightIntensity = li; ld3.LightIntensity = li; ld4.LightIntensity = li; ld5.LightIntensity = li; this.World.AddLight(ld1); this.World.AddLight(ld2); this.World.AddLight(ld3); this.World.AddLight(ld4); this.World.AddLight(ld5); #endregion ///Add a AA post effect this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect()); ///add a camera this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); }
/// <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); RegisterDebugDrawCommand rc = new RegisterDebugDrawCommand(ddrawer); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(rc); dlines = new DebugLines(); ddrawer.AddShape(dlines); Picking pick = new Picking(this, 2000); pick.OnPickedLeftButton += new OnPicked(pick_OnPickedLeftButton); { SimpleModel simpleModel = new SimpleModel(factory, "Model//block"); simpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.White), TextureType.DIFFUSE); ///Physic info (position, rotation and scale are set here) BoxObject tmesh = new BoxObject(Vector3.Zero, 1, 1, 1, 10, new Vector3(1000, 1, 1000), Matrix.Identity, MaterialDescription.DefaultBepuMaterial()); tmesh.isMotionLess = true; ///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); } wh = new WaypointHandler(); wh.LoadConnectedWaypoints("waypoints.xml"); start = wh.CurrentWaypointsCollection.GetWaypointsList()[0]; { ///Procedural yellow diffuse texture SimpleModel sm = new SimpleModel(factory, "Model\\block"); sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Yellow), TextureType.DIFFUSE); ///physic Ghost object(no collision) GhostObject pi = new GhostObject(start.WorldPos, Matrix.Identity, new Vector3(5)); ForwardXNABasicShader s = new ForwardXNABasicShader(); ForwardMaterial mat = new ForwardMaterial(s); IObject obj4 = new IObject(mat, sm, pi); this.World.AddObject(obj4); } ///add a camera this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); { SimpleModel sm = new SimpleModel(factory, "Model\\block"); sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Blue), TextureType.DIFFUSE); GhostObject pi = new GhostObject(start.WorldPos, Matrix.Identity, new Vector3(5)); ForwardXNABasicShader s = new ForwardXNABasicShader(); ForwardMaterial mat = new ForwardMaterial(s); IObject obj4 = new IObject(mat, sm, pi); obj4.OnUpdate += new OnUpdate(obj4_OnUpdate); this.World.AddObject(obj4); } }
/// <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); RegisterDebugDrawCommand rc = new RegisterDebugDrawCommand(ddrawer); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(rc); dlines = new DebugLines(); ddrawer.AddShape(dlines); Picking pick = new Picking(this, 2000); pick.OnPickedLeftButton += new OnPicked(pick_OnPickedLeftButton); wh = new WaypointHandler(); SimpleModel simpleModel = new SimpleModel(factory, "Model//block"); simpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.White), TextureType.DIFFUSE); ///Physic info (position, rotation and scale are set here) BoxObject tmesh = new BoxObject(Vector3.Zero, 1, 1, 1, 10, new Vector3(1000, 1, 1000), Matrix.Identity, MaterialDescription.DefaultBepuMaterial()); tmesh.isMotionLess = true; ///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); { InputPlayableKeyBoard ipk = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Microsoft.Xna.Framework.Input.Keys.Space); ipk.KeyStateChange += new KeyStateChange(ipk_KeyStateChange); this.BindInput(ipk); } { InputPlayableKeyBoard ipk = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Microsoft.Xna.Framework.Input.Keys.Enter); ipk.KeyStateChange += new KeyStateChange(ipk_KeyStateChange2); this.BindInput(ipk); } ///add a camera this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); }
/// <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); RegisterDebugDrawCommand rc = new RegisterDebugDrawCommand(ddrawer); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(rc); path.AddCircularObstacle(Vector3.Zero, 10); path.AddCircularObstacle(new Vector3(0, 20, 0), 15); path.AddCircularObstacle(new Vector3(200), 10); foreach (var item in path.Obstacles) { SphericalObstacle SphericalObstacle = item as SphericalObstacle; DebugSphere s = new DebugSphere(SphericalObstacle.Center, SphericalObstacle.Radius, Color.Blue); ddrawer.AddShape(s); } //DebugSphere.WireFrameEnabled = true; DebugLines dls = new DebugLines(); ddrawer.AddShape(dls); for (int i = 0; i < path.PolyPath.pointCount - 1; i++) { dls.AddLine(path.PolyPath.points[i], path.PolyPath.points[i] + Vector3.Up * 200, Color.Brown); dls.AddLine(path.PolyPath.points[i], path.PolyPath.points[i + 1], Color.Red); } dls.AddLine(path.PolyPath.points[path.PolyPath.pointCount - 1], path.PolyPath.points[path.PolyPath.pointCount - 1] + Vector3.Up * 200, Color.Brown); PlugIn = new PedestrianPlugIn(this.World, path, (pd) => { SimpleModel simpleModel = new SimpleModel(factory, "Model//block"); simpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Green), TextureType.DIFFUSE); ///Physic info (position, rotation and scale are set here) GhostObject tmesh = new GhostObject(); ///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); obj.IObjectAttachment.Add(new SteerAtachment(pd)); return(obj); }); PlugIn.Init(); { SimpleModel simpleModel = new SimpleModel(factory, "Model//block"); simpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.White), TextureType.DIFFUSE); ///Physic info (position, rotation and scale are set here) BoxObject tmesh = new BoxObject(Vector3.Zero, 1, 1, 1, 10, new Vector3(1000, 1, 1000), Matrix.Identity, MaterialDescription.DefaultBepuMaterial()); tmesh.isMotionLess = true; ///Forward Shader (look at this shader construction for more info) ForwardXNABasicShader shader = new ForwardXNABasicShader(); ///Deferred material ForwardMaterial fmaterial = new ForwardMaterial(shader); ///The object itself this.World.AddObject(new IObject(fmaterial, simpleModel, tmesh)); } ///add a camera this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); }