コード例 #1
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);
        }
コード例 #2
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);
 }
コード例 #3
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);
 }
コード例 #4
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);
            }
        }
コード例 #5
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);
 }
コード例 #6
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);
 }
コード例 #7
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");
 }
コード例 #8
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);
 }
コード例 #9
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)");
     }
 }
コード例 #10
0
 public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory)
 {
     rt     = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight);
     rtend  = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight);
     Amount = 100;
 }