public void Initialization(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj) { RenderTargetCube = factory.CreateRenderTargetCube(128, SurfaceFormat.Color, false, DepthFormat.Depth24Stencil8, 0, RenderTargetUsage.DiscardContents); ForwardEnvironmentShader = new ForwardEnvironmentShader(RenderTargetCube, 0.5f, false); ForwardEnvironmentShader.Initialize(ginfo, factory, obj); //ForwardEnvironmentShader.EnvironmentMapEffect.EnableDefaultLighting(); }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); staticRandomTex = factory.CreateTexture2DRandom(32, 32); ///tem q ser 32, pq o shader espera isso (nao vale a pena alterar o shader para deixar independente de resolucao) target = factory.CreateRenderTarget(GraphicInfo.BackBufferWidth, GraphicInfo.BackBufferHeight); effect = factory.GetEffect("Effects\\perlin"); }
public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, IObject obj) { Effect = factory.GetEffect("Effects/baker"); base.Initialize(ginfo, factory, obj); Effect.Parameters["halfPixel"].SetValue(ginfo.HalfPixel); rt = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight); }
public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory) { shader = factory.GetEffect("HBAO\\HorizonBasedAmbientOcclusion"); Texture randomNormalTexture = factory.GetTexture2D("HBAO\\RandomNormal"); shader.Parameters["randomTexture"].SetValue(randomNormalTexture); epResolution = shader.Parameters["resolution"]; epInverseResolution = shader.Parameters["invResolution"]; epNumberSteps = shader.Parameters["numberSteps"]; epNumberDirections = shader.Parameters["numberDirections"]; epContrast = shader.Parameters["contrast"]; epLineAttenuation = shader.Parameters["attenuation"]; epRadius = shader.Parameters["radius"]; epAngleBias = shader.Parameters["angleBias"]; // Others epFocalLength = shader.Parameters["focalLength"]; epInvFocalLength = shader.Parameters["invFocalLength"]; epHalfPixel = shader.Parameters["halfPixel"]; epSqrRadius = shader.Parameters["sqrRadius"]; epInvRadius = shader.Parameters["invRadius"]; epTanAngleBias = shader.Parameters["tanAngleBias"]; RenderTarget2D = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight); RenderTarget2D2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight); depthrender = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Single, true); g = new GaussianBlurPostEffect(false); g.Init(ginfo, factory); renderdepth = factory.GetEffect("HBAO\\generateDepth"); ssaofinal = factory.GetEffect("ssaofinal", false, true); }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory) { basicEffect = factory.GetBasicEffect(); basicEffect.TextureEnabled = true; spriteBatch = factory.GetSpriteBatch(); base.LoadContent(GraphicInfo, factory); }
/// <summary> /// Initializes this instance. /// </summary> /// <param name="ginfo"></param> /// <param name="factory"></param> /// <param name="obj"></param> public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj) { this._shader = factory.GetEffect(effect, true, true); base.Initialize(ginfo, factory, obj); PProjection = this._shader.Parameters["Projection"]; PView = this._shader.Parameters["View"]; PuseSpecular = this._shader.Parameters["useSpecular"]; PuseBump = this._shader.Parameters["useBump"]; PuseGlow = this._shader.Parameters["useGlow"]; PuseParalax = this._shader.Parameters["useParalax"]; Pid = this._shader.Parameters["id"]; //PTexture = this._shader.Parameters["Texture"]; PspecularPowerScale = this._shader.Parameters["specularPowerScale"]; PspecularIntensityScale = this._shader.Parameters["specularIntensityScale"]; PspecularPower = this._shader.Parameters["specularPower"]; PspecularIntensity = this._shader.Parameters["specularIntensity"]; PWorld = this._shader.Parameters["World"]; PWorldInverseTranspose = this._shader.Parameters["WorldInverseTranspose"]; //PNormalMap = this._shader.Parameters["NormalMap"]; //PSpecularMap = this._shader.Parameters["SpecularMap"]; //Pglow = this._shader.Parameters["glow"]; //PAmbientCube = this._shader.Parameters["ambientcube"]; PAmbientCubeMapScale = this._shader.Parameters["ambientScale"]; if (useAmbientCubeMap == true) { this._shader.CurrentTechnique = this._shader.Techniques["Technique2"]; } else { this._shader.CurrentTechnique = this._shader.Techniques["Technique1"]; } }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); ngui = Gui as NeoforceGui; manager = ngui.Manager; Window window = new Window(manager); window.Init(); window.Text = "Options"; window.Width = 480; window.Height = 200; window.Center(); window.Visible = true; Button button = new Button(manager); button.Init(); button.Text = "OK"; button.Width = 72; button.Height = 24; button.Left = (window.ClientWidth / 2) - (button.Width / 2); button.Top = window.ClientHeight - button.Height - 8; button.Anchor = Anchors.Bottom; button.Parent = window; button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click); manager.Add(window); }
/// <summary> /// Initializes this instance. /// </summary> /// <param name="ginfo"></param> /// <param name="factory"></param> /// <param name="obj"></param> public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj) { this._shader = factory.GetEffect(effect, false, true); base.Initialize(ginfo, factory, obj); PProjection = this._shader.Parameters["Projection"]; PView = this._shader.Parameters["View"]; PuseSpecular = this._shader.Parameters["useSpecular"]; PuseBump = this._shader.Parameters["useBump"]; PuseGlow = this._shader.Parameters["useGlow"]; PCameraPos = this._shader.Parameters["CameraPos"]; Pid = this._shader.Parameters["id"]; //PTexture = this._shader.Parameters["Texture"]; PspecularPowerScale = this._shader.Parameters["specularPowerScale"]; PspecularIntensityScale = this._shader.Parameters["specularIntensityScale"]; PspecularPower = this._shader.Parameters["specularPower"]; PspecularIntensity = this._shader.Parameters["specularIntensity"]; PWorld = this._shader.Parameters["World"]; PWorldInverseTranspose = this._shader.Parameters["WorldInverseTranspose"]; //PNormalMap = this._shader.Parameters["NormalMap"]; //PSpecularMap = this._shader.Parameters["SpecularMap"]; //Pglow = this._shader.Parameters["glow"]; PreflectionIndex = this._shader.Parameters["reflectionIndex"]; //PDiffuse = this._shader.Parameters["DifTex"]; }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory) { this.GraphicInfo = GraphicInfo; this.factory = factory; base.LoadContent(GraphicInfo, factory); batch = new PrimitiveBatch(factory); }
public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory) { effect = factory.GetEffect("effects/TransparentOnBorder"); effectdistorcion = factory.GetEffect("effects/effect2"); target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight); SetBlurEffectParameters(1f / (float)ginfo.BackBufferWidth, 1f / (float)ginfo.BackBufferHeight); }
public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj) { this.ginfo = ginfo; spriteBatch = factory.GetSpriteBatch(); basicEffect = factory.GetBasicEffect(); basicEffect.TextureEnabled = true; base.Initialize(ginfo, factory, obj); }
public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj) { base.Initialize(ginfo, factory, obj); #if WINDOWS_PHONE || REACH SkinnedEffect = factory.GetSkinnedEffect(); SkinnedEffect.EnableDefaultLighting(); #endif }
public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj) { base.Initialize(ginfo, factory, obj); this._shader = factory.GetEffect("WaterComplete", true, true); refractionRT = factory.CreateRenderTarget(WIDTH, HEIGHT); reflectionRT = factory.CreateRenderTarget(WIDTH, HEIGHT); normal0 = factory.GetTexture2D("wave0", true); normal1 = factory.GetTexture2D("wave1", true); }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory) { SpriteFont = factory.GetAsset <SpriteFont>("ConsoleFont", true); basicEffect = factory.GetBasicEffect(); basicEffect.TextureEnabled = true; basicEffect.VertexColorEnabled = true; spriteBatch = factory.GetSpriteBatch(); base.LoadContent(GraphicInfo, factory); }
public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory) { Effect = factory.GetEffect("ssao", false, true); tex = factory.GetTexture2D("noisetex", true); sBlurPost = new SBlurPost(blurAmount, BlurRadiusSize); sBlurPost.Init(ginfo, factory); RenderTarget2D = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight); RenderTarget2D2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight); }
/// <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)); }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager) { arenScript = contentManager.GetAsset <SpriteFont>("Images//font//ArenScriptFont"); backT = contentManager.GetAsset <Texture2D>("Images//menus//MainMenu"); drawBackground = true; Init(); base.LoadContent(GraphicInfo, factory, contentManager); }
public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory) { switch (BlurRadiusSize) { case BlurRadiusSize.Fifteen: effect = factory.GetEffect("sblur", true, true); break; case BlurRadiusSize.Seven: effect = factory.GetEffect("sblur2", true, true); break; case BlurRadiusSize.Three: effect = factory.GetEffect("sblur3", true, true); break; default: ActiveLogger.LogMessage("Wrong Blur Radius Size Specified", LogLevel.RecoverableError); effect = factory.GetEffect("sblur", true, true); break; } if (!destinySize.HasValue) { destinySize = new Vector2(ginfo.BackBufferWidth, ginfo.BackBufferHeight); } if (SurfaceFormat.HasValue) { if (SurfaceFormat.Value == Microsoft.Xna.Framework.Graphics.SurfaceFormat.Single || SurfaceFormat.Value == Microsoft.Xna.Framework.Graphics.SurfaceFormat.HalfSingle) { effect.CurrentTechnique = effect.Techniques["GAUSSSingle"]; } else { effect.CurrentTechnique = effect.Techniques["GAUSSTriple"]; } RenderTarget2D = factory.CreateRenderTarget((int)destinySize.Value.X, (int)destinySize.Value.Y, SurfaceFormat.Value); } else { RenderTarget2D = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight); } ComputeKernel(BLUR_RADIUS, BLUR_AMOUNT); if (OriginSize.HasValue) { ComputeOffsets(OriginSize.Value.X, OriginSize.Value.Y); } else { ComputeOffsets(ginfo.BackBufferWidth, ginfo.BackBufferHeight); } }
public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj) { this.ginfo = ginfo; Effect = factory.GetEffect("Effects/fluid"); r1 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Single); r2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Single); r3 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color); gaussian = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Single); ComputeKernel(BLUR_RADIUS, BLUR_AMOUNT); ComputeOffsets(ginfo.BackBufferWidth, ginfo.BackBufferHeight); }
/// <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)); }
public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory) { eff = factory.GetEffect("Effects/MotionBlurComplete"); effectvelocity = factory.GetEffect("Effects/VelocityTextureMotionBlur"); if (ginfo.CheckIfRenderTargetFormatIsSupported(SurfaceFormat.Vector2, DepthFormat.None, false, 0)) { rt = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Vector2); } else { throw new Exception("required Buffer precision not found (Vector 2)"); } }
/// <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); { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { float x, y; x = -i * 100; y = -j * 100; TreeModel tm = new TreeModel(factory, "Trees\\Pine", null, null); DeferredTreeShader ts = new DeferredTreeShader(); TreeMaterial tmat = new TreeMaterial(ts, new WindStrengthSin()); GhostObject go = new GhostObject(new Vector3(x, 0, y), Matrix.Identity, new Vector3(0.05f)); IObject ox = new IObject(tmat, tm, go); this.World.AddObject(ox); } } } ///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(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); texts = new String[4] { "Loading ", "Loading . ", "Loading . . ", "Loading . . . " }; state = 0; interval = 0; maxInterval = 5; }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager) { texture = factory.CreateTexture2D(800, 600); Color[] c = new Color[800 * 600]; for (int i = 0; i < 800; i++) { for (int j = 0; j < 600; j++) { c[i + j * 800] = new Color(((float)i) / 800, ((float)j) / 600, 1); } } texture.SetData <Color>(c); base.LoadContent(GraphicInfo, factory, contentManager); }
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()); }
/// <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); ///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); ///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.Viewport)); }
/// <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)); }
public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj) { this.ginfo = ginfo; base.Initialize(ginfo, factory, obj); }
protected override void InitScreen(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.EngineStuff engine) { base.InitScreen(GraphicInfo, engine); engine.AddComponent(new DebugDraw()); }
/// <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); { IModelo sm = new SimpleModel(factory, "Model\\block"); Matrix trans = Matrix.CreateTranslation(new Vector3(100, 50, 0)); Plane plano = Plane.Transform(new Plane(0, 1, 0, 0), trans); IPhysicObject pi = new BoxObject(Vector3.Zero, 1, 1, 1, 5, new Vector3(1300, 0.1f, 1300), 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); shader.SpecularIntensity = 0.01f; shader.SpecularPower = 50; IMaterial mat = new DeferredMaterial(shader); IObject obj4 = new IObject(mat, sm, pi); this.World.AddObject(obj4); } { ///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); } { List <Vector3> poss = new List <Vector3>(); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { float x, y; x = i * 100; y = j * 100; poss.Add(new Vector3(x, 100, y)); } } StaticBilboardModel bm = new StaticBilboardModel(factory, "Bilbs", "..\\Content\\Textures\\tree", poss); DeferredCilindricGPUBilboardShader cb = new DeferredCilindricGPUBilboardShader(); DeferredMaterial matfor = new DeferredMaterial(cb); GhostObject go = new GhostObject(); IObject obj2 = new IObject(matfor, bm, go); this.World.AddObject(obj2); } ///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)); }
public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj) { this.ginfo = ginfo; base.Initialize(ginfo, factory, obj); }
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()); }