protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); #region Models { SimpleModel sm = new SimpleModel(factory,"..\\Content\\Model\\cenario"); IPhysicObject pi = new TriangleMeshObject(sm,Vector3.Zero, Matrix.Identity,Vector3.One,MaterialDescription.DefaultBepuMaterial()); DeferredNormalShader shader = new DeferredNormalShader(); shader.SpecularIntensity = 0; shader.SpecularPower = 0; IMaterial mat = new DeferredMaterial(shader); IObject obj3 = new IObject(mat, sm, pi); this.World.AddObject(obj3); } #endregion cam = new CameraFirstPerson(GraphicInfo); cam.FarPlane = 3000; lt = new LightThrowBepu(this.World,factory); #region NormalLight DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White); DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White); DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White); DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White); DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White); float li = 0.4f; ld1.LightIntensity = li; ld2.LightIntensity = li; ld3.LightIntensity = li; ld4.LightIntensity = li; ld5.LightIntensity = li; this.World.AddLight(ld1); this.World.AddLight(ld2); this.World.AddLight(ld3); this.World.AddLight(ld4); this.World.AddLight(ld5); #endregion this.World.CameraManager.AddCamera(cam); ///Bind a Key event (combination of Key + state(pressed, Released ...) + inputMask ) to a function SimpleConcreteKeyboardInputPlayable ik1 = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.T,g1, InputMask.G1); ///When you use the method Bind of a IScreen, The key event will be sent by the engine while this screen remains added in the ScreenManager. ///TO create a Gloal Input (Keep working even if the screen goes away), see the DemosHomeScreen.cs this.BindInput(ik1); SimpleConcreteKeyboardInputPlayable ik2 = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Y, g2,InputMask.G2); this.BindInput(ik2); ///The SYSTEM Mask is Always On (cant be turned off) SimpleConcreteKeyboardInputPlayable ik3 = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Space, ChangeGroup,InputMask.GSYSTEM); this.BindInput(ik3); ///StateKey.DOWN mean when the key is down the event will be fired --looooots of times(samae as UP) ///StateKey.PRESS is fired ONCE when the key is pressed (same as RELEASE) ///WHEN USING COMBOS, use DOWN AND UP (better for precision) ///The parameter EntityType is not used internaly SimpleConcreteKeyboardInputPlayable ik4 = new SimpleConcreteKeyboardInputPlayable(StateKey.DOWN, new Keys[] { Keys.LeftControl, Keys.U }, Multiple); this.BindInput(ik4); ///Send a command (design pattern) to the InputSystem to change the InputMask TurnOnInputMaskCommand tom = new TurnOnInputMaskCommand(InputMask.GALL); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(tom); isAllActive = true; this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect()); }
public void ChangeGroup(InputPlayableKeyBoard ipk) { index = (index + 1) % 3; ///Turn Off all Masks (we cant turn the GSYSTEM MASK, even if we try ....) TurnOffInputMaskCommand tof = new TurnOffInputMaskCommand(InputMask.GALL); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(tof); ///Turn only the right mask ///Masks are Bit Field, You can turn more than one using InputMask.GALL | InputMask.G1 for example ///The TurnOnInputMaskCommand Just combine its actual mask with the mask provided, It does not TURN OFFthe active masks (this is the reason why i sent a turn off mask before) TurnOnInputMaskCommand tom = new TurnOnInputMaskCommand(Im[index] | InputMask.GNONE); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(tom); isAllActive = false; isGroup1 = false; isGroup2 = false; isComboPressed = false; isChangeGroup = true; }