コード例 #1
0
 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();
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
        /// <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"];
            }
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 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);
 }
        /// <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"];
        }
コード例 #8
0
 public void CleanUp(PloobsEngine.Engine.GraphicFactory factory)
 {
     ForwardEnvironmentShader.Cleanup(factory);
     if (RenderTargetCube != null && !RenderTargetCube.IsDisposed)
     {
         RenderTargetCube.Dispose();
     }
 }
コード例 #9
0
        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
        }
コード例 #10
0
 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);
 }
コード例 #11
0
 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);
 }
コード例 #12
0
        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);
            }
        }
コード例 #13
0
 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);
 }
コード例 #14
0
 public virtual void CleanUp(PloobsEngine.Engine.GraphicFactory factory)
 {
     this.Material.CleanUp(factory);
     this.PhysicObject = null;
     this.Modelo.CleanUp(factory);
     this.Material     = null;
     this.PhysicObject = null;
     this.Modelo       = null;
     this.Material     = null;
     I2DObjectAtachtment.Clear();
     I2DObjectAtachtment = null;
 }
コード例 #15
0
 /// <summary>
 /// Cleans up.
 /// </summary>
 /// <param name="factory">The factory.</param>
 public virtual void CleanUp(PloobsEngine.Engine.GraphicFactory factory)
 {
     if (Modelo != null)
     {
         Modelo.CleanUp(factory);
     }
     Material.CleanUp(factory);
     Modelo       = null;
     Material     = null;
     PhysicObject = null;
     IObjectAttachment.Clear();
     IObjectAttachment = null;
 }
コード例 #16
0
 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)");
     }
 }
コード例 #17
0
        /// <summary>
        /// Cleans up.
        /// </summary>
        /// <param name="factory">The factory.</param>
        public virtual void CleanUp(PloobsEngine.Engine.GraphicFactory factory)
        {
            String fullName = Texture.Tag as String;

            if (fullName != null)
            {
                factory.ReleaseAsset(fullName);
            }
            if (fullName == "CREATED")
            {
                Texture.Dispose();
            }
        }
コード例 #18
0
        /// <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));
        }
コード例 #19
0
 /// <summary>
 /// Cleans up.
 /// </summary>
 /// <param name="factory"></param>
 public void CleanUp(PloobsEngine.Engine.GraphicFactory factory)
 {
     shader.Cleanup(factory);
 }
コード例 #20
0
        /// <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));
        }
コード例 #21
0
 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);
 }
コード例 #22
0
        /// <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));
        }
コード例 #23
0
 public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj)
 {
     alphagradative = factory.GetEffect("effects/alphagradative");
     base.Initialize(ginfo, factory, obj);
 }
コード例 #24
0
 public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory)
 {
     effect = factory.GetEffect("MotionBlur", false, true);
 }
コード例 #25
0
        /// <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));
        }
コード例 #26
0
        /// <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));
        }
コード例 #27
0
        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());
        }
コード例 #28
0
 public override void Initialize(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IObject obj)
 {
     this.ginfo = ginfo;
     base.Initialize(ginfo, factory, obj);
 }
コード例 #29
0
 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");
 }
コード例 #30
0
 public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory)
 {
     effect = factory.GetEffect("Night", false, true);
     tex    = factory.GetTexture2D("noise_tex6", true);
 }