当前位置: 首页>>代码示例>>C#>>正文


C# GraphicFactory.CreateRenderTarget方法代码示例

本文整理汇总了C#中GraphicFactory.CreateRenderTarget方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicFactory.CreateRenderTarget方法的具体用法?C# GraphicFactory.CreateRenderTarget怎么用?C# GraphicFactory.CreateRenderTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GraphicFactory的用法示例。


在下文中一共展示了GraphicFactory.CreateRenderTarget方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RestoreDepth

        //EffectParameter Depth;
        //EffectParameter Color;
        /// <summary>
        /// Initializes a new instance of the <see cref="RestoreDepth"/> class.
        /// </summary>
        /// <param name="useFloatBuffer">if set to <c>true</c> [use float buffer].</param>
        /// <param name="manager">The manager.</param>
        /// <param name="factory">The factory.</param>
        /// <param name="ginfo">The ginfo.</param>
        public RestoreDepth(bool useFloatBuffer,IContentManager manager,GraphicFactory factory, GraphicInfo ginfo)
        {
            this.usefloatBuffer = useFloatBuffer;
            this.restore = manager.GetAsset<Effect>("RestoreDepth",true);
            this.restore.Parameters["halfPixel"].SetValue(ginfo.HalfPixel);
            
            //Depth = restore.Parameters["DepthTexture"];
            //Color = restore.Parameters["ColorTexture"];

            if (useFloatBuffer)
                target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.HdrBlendable, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample, RenderTargetUsage.DiscardContents);
            else
                target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample, RenderTargetUsage.DiscardContents);
        }        
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:23,代码来源:RestoreDepth.cs

示例2: DownSampler

 public DownSampler(GraphicFactory factory,float width, float height,
     SurfaceFormat SurfaceFormat = SurfaceFormat.Color,bool mipmap = false)
 {
     this.Rectangle = new Rectangle(0,0,(int)width,(int)height);
     RenderTarget2D = factory.CreateRenderTarget(Rectangle.Width,
         Rectangle.Height, SurfaceFormat, mipmap);
     effect = factory.GetEffect("SBlurPost/DownsampleDepth");
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:8,代码来源:DownSampler.cs

示例3: LoadContent

 protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
 {
     RenderTarget2D = factory.CreateRenderTarget(GraphicInfo.BackBufferWidth, GraphicInfo.BackBufferHeight);
     this.contentManager = contentManager;
     base.LoadContent(GraphicInfo, factory, contentManager);
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:6,代码来源:TestProcessor.cs

示例4: Init

 /// <summary>
 /// Initiates the specified Post Effect.
 /// Called by the engine
 /// </summary>
 /// <param name="ginfo">The ginfo.</param>
 /// <param name="factory">The factory.</param>
 public override void Init(PloobsEngine.Engine.GraphicInfo ginfo, PloobsEngine.Engine.GraphicFactory factory)
 {
     this.info = ginfo;
     this.factory = factory;
     rt = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight);
     rtend = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight);
     ginfo.OnGraphicInfoChange += ginfo_OnGraphicInfoChange;
     Amount = 100;
     
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:16,代码来源:SimpleMotionBlurPostEffect.cs

示例5: Load

        internal void Load(GraphicFactory factory,GraphicInfo ginfo)
        {
            // Load the effect we need
            shadowMapEffect = factory.GetEffect("ShadowMap",false,true);

            // Create the shadow map, using a 32-bit floating-point surface format
            shadowMap = factory.CreateRenderTarget(ShadowMapSize * NumSplits, ShadowMapSize, SurfaceFormat.Single,true,DepthFormat.Depth24Stencil8,ginfo.MultiSample);
            
            // Create the shadow occlusion texture using the same dimensions as the backbuffer
            shadowOcclusion = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight);

            // We'll keep an array of EffectTechniques that will let us map a
            // ShadowFilteringType to a technique for calculating shadow occlusion
            shadowOcclusionTechniques[0] = shadowMapEffect.Techniques["CreateShadowTerm2x2PCF"];
            shadowOcclusionTechniques[1] = shadowMapEffect.Techniques["CreateShadowTerm3x3PCF"];
            shadowOcclusionTechniques[2] = shadowMapEffect.Techniques["CreateShadowTerm5x5PCF"];
            shadowOcclusionTechniques[3] = shadowMapEffect.Techniques["CreateShadowTerm7x7PCF"];
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:18,代码来源:ShadowRenderer.cs

示例6: Init

 public override void Init(GraphicInfo ginfo, GraphicFactory factory)
 {
     effect = factory.GetEffect("Effects/mlaa");
     pass = factory.GetEffect("Effects/Effect1");
     rt0 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight);
     rt1 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight);
     tex = factory.GetTexture2D("AA//AreaMap65");
     pass.Parameters["halfPixel"].SetValue(ginfo.HalfPixel);
     effect.Parameters["halfPixel"].SetValue(ginfo.HalfPixel);            
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:10,代码来源:MLAntiAliasingPostEffect.cs

示例7: Init

        public override void Init(Engine.GraphicInfo ginfo, Engine.GraphicFactory factory)
        {
            this.factory = factory;
            effect = factory.GetEffect("DownScaling", false, true);             
            luminance = factory.GetEffect("Luminance", false, true);             
            threshold = factory.GetEffect("Threshold", false, true);             
            fULLGPUBlur = factory.GetEffect("FULLGPUBlur", false, true);             
            tone = factory.GetEffect("ToneHdr", false, true);             
                      

            int chainLength = 1;
            int startSize = (int)MathHelper.Min(ginfo.BackBufferWidth / 16, ginfo.BackBufferHeight / 16);
            int size = 16;
            for (size = 16; size < startSize; size *= 4)
                chainLength++;

            luminanceChain = new RenderTarget2D[chainLength];
            size /= 4;
            for (int i = 0; i < chainLength; i++)
            {
                luminanceChain[i] = factory.CreateRenderTarget(size, size, SurfaceFormat.Single, false, DepthFormat.None);
                size /= 4;
            }


            currentFrameLuminance = factory.CreateRenderTarget(1, 1, SurfaceFormat.Single,false,DepthFormat.None,0,RenderTargetUsage.PreserveContents);
            currentFrameAdaptedLuminance = factory.CreateRenderTarget(1, 1, SurfaceFormat.Single, false, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);
            lastFrameAdaptedLuminance = factory.CreateRenderTarget(1, 1, SurfaceFormat.Single, false, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);            

        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:30,代码来源:HdrPostEffect.cs

示例8: CreateGBuffer

        private void CreateGBuffer(GraphicFactory factory)
        {
            //One of our premises is to do not use the PRESERVE CONTENTS flags, 
            //that is supposed to be more expensive than DISCARD CONTENT.
            //We use a floating point (32bit) buffer for Z values, although our HW use only 24bits.
            //We could use some packing and use a 24bit buffer too, but lets start simpler
            _depthBuffer = factory.CreateRenderTarget( _width, _height, SurfaceFormat.Single,false,
                                              DepthFormat.None, 0, RenderTargetUsage.DiscardContents);

            //the downsampled depth buffer must have the same format as the main one
            _halfDepth = factory.CreateRenderTarget(_width / 2, _height / 2,
                                              SurfaceFormat.Single, false, DepthFormat.None, 0,
                                              RenderTargetUsage.DiscardContents);

            //Our normal buffer stores encoded view-space normal into RG (10bit each) and the specular power in B.
            //Some engines encode the specular power with some log or ln functions. We will output 
            //only the normal texture's alpha channel multiplied by a const value (100),
            //so we have specular power in the range [1..100].
            //Currently, A is not used (2bit).
            _normalBuffer = factory.CreateRenderTarget(_width, _height, SurfaceFormat.Color, false,
                                               DepthFormat.Depth24Stencil8, 0, RenderTargetUsage.DiscardContents);

            //This buffer stores all the "pure" lighting on the scene, no albedo applied to it. We use an floating
            //point format to allow us "overbright" some areas. Read the blog for more information. We use a depth buffer
            //to optimize light rendering.
            _lightBuffer = factory.CreateRenderTarget(_width, _height, SurfaceFormat.HdrBlendable,false,
                                              DepthFormat.Depth24Stencil8, 0, RenderTargetUsage.DiscardContents);

            //we need a separate texture for the specular, since the xbox doesnt allow a RGBA64 buffer
            _lightSpecularBuffer = factory.CreateRenderTarget(_width, _height, 
                                             SurfaceFormat.HdrBlendable, false,DepthFormat.None, 0,
                                             RenderTargetUsage.DiscardContents);

            //We need another depth here because we need to render all objects again, to reconstruct their shading 
            //using our light texture.
            _outputTexture = factory.CreateRenderTarget(_width, _height, SurfaceFormat.Color,false,
                                                DepthFormat.Depth24Stencil8, 0, RenderTargetUsage.DiscardContents);

            int halfRes = 2;
            _halfBuffer0 = factory.CreateRenderTarget(_width / halfRes, _height / halfRes, 
                                              SurfaceFormat.Color,false, DepthFormat.None, 0,
                                              RenderTargetUsage.DiscardContents);
            _halfBuffer1 = factory.CreateRenderTarget(_width / halfRes, _height / halfRes,
                                              SurfaceFormat.Color, false, DepthFormat.None, 0,
                                              RenderTargetUsage.DiscardContents);

            _gBufferBinding[0] = new RenderTargetBinding(_normalBuffer);
            _gBufferBinding[1] = new RenderTargetBinding(_depthBuffer);

            _lightAccumBinding[0] = new RenderTargetBinding(_lightBuffer);
            _lightAccumBinding[1] = new RenderTargetBinding(_lightSpecularBuffer);

            target = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample);
            target2 = factory.CreateRenderTarget(ginfo.BackBufferWidth, ginfo.BackBufferHeight, SurfaceFormat.Color, ginfo.UseMipMap, DepthFormat.Depth24Stencil8, ginfo.MultiSample);
            PostEffectTarget = target;
            

        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:58,代码来源:LightPrePassRenderTechnic.cs


注:本文中的GraphicFactory.CreateRenderTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。