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


C# GraphicFactory.GetEffect方法代码示例

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


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

示例1: 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

示例2: LoadContent

        private void LoadContent(GraphicFactory factory)
        {
            reductionEffect = factory.GetEffect("reductionEffect",false,true);
            resolveShadowsEffect = factory.GetEffect("resolveShadowsEffect", false, true);

            distortRT = new RenderTarget2D(graphicsDevice, baseSize, baseSize, false, SurfaceFormat.HalfVector2,DepthFormat.None);
            distancesRT = new RenderTarget2D(graphicsDevice, baseSize, baseSize, false, SurfaceFormat.HalfVector2,DepthFormat.None);
            shadowMap = new RenderTarget2D(graphicsDevice, 2, baseSize, false, SurfaceFormat.HalfVector2,DepthFormat.None);
            reductionRT = new RenderTarget2D[reductionChainCount];
            for (int i = 0; i < reductionChainCount; i++)
            {
                reductionRT[i] = new RenderTarget2D(graphicsDevice, 2 << i, baseSize, false, SurfaceFormat.HalfVector2,DepthFormat.None);
            }

            shadowsRT = new RenderTarget2D(graphicsDevice, baseSize, baseSize);
            processedShadowsRT = new RenderTarget2D(graphicsDevice, baseSize, baseSize);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:17,代码来源:ShadowmapResolver.cs

示例3: BoltShader

        public BoltShader(GraphicFactory factory, Color color, bool CastShadowAndReflection = false)
        {
            effect = factory.GetEffect("effects/laser_shader"); // load effect before laserbolt

            effect_color = effect.Parameters["laser_bolt_color"];
            effect_center_to_viewer = effect.Parameters["center_to_viewer"];
            effect_technique = effect.Techniques["laserbolt_technique"];
            world = effect.Parameters["world"];
            wvp = effect.Parameters["wvp"];
            this.color = color;
            this.CastShadowAndReflection = CastShadowAndReflection;
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:12,代码来源:BoltShader.cs

示例4: LoadContent

        protected override void  LoadContent(Engine.GraphicInfo GraphicInfo,GraphicFactory factory)
        {
            base.LoadContent(GraphicInfo, factory);
            effect = factory.GetEffect("skybox",false,true);
            this.factory = factory;
            cubeVertices = new VertexPositionNormalTexture[36];

            Vector3 topLeftFront = new Vector3(-1.0f, 1.0f, 1.0f);
            Vector3 bottomLeftFront = new Vector3(-1.0f, -1.0f, 1.0f);
            Vector3 topRightFront = new Vector3(1.0f, 1.0f, 1.0f);
            Vector3 bottomRightFront = new Vector3(1.0f, -1.0f, 1.0f);
            Vector3 topLeftBack = new Vector3(-1.0f, 1.0f, -1.0f);
            Vector3 topRightBack = new Vector3(1.0f, 1.0f, -1.0f);
            Vector3 bottomLeftBack = new Vector3(-1.0f, -1.0f, -1.0f);
            Vector3 bottomRightBack = new Vector3(1.0f, -1.0f, -1.0f);

            Vector2 textureTopLeft = new Vector2(0.0f, 0.0f);
            Vector2 textureTopRight = new Vector2(1.0f, 0.0f);
            Vector2 textureBottomLeft = new Vector2(0.0f, 1.0f);
            Vector2 textureBottomRight = new Vector2(1.0f, 1.0f);

            Vector3 frontNormal = new Vector3(0.0f, 0.0f, 1.0f);
            Vector3 backNormal = new Vector3(0.0f, 0.0f, -1.0f);
            Vector3 topNormal = new Vector3(0.0f, 1.0f, 0.0f);
            Vector3 bottomNormal = new Vector3(0.0f, -1.0f, 0.0f);
            Vector3 leftNormal = new Vector3(-1.0f, 0.0f, 0.0f);
            Vector3 rightNormal = new Vector3(1.0f, 0.0f, 0.0f);

            // Front face
            cubeVertices[0] =
                new VertexPositionNormalTexture(
                topLeftFront, frontNormal, textureTopLeft);
            cubeVertices[1] =
                new VertexPositionNormalTexture(
                bottomLeftFront, frontNormal, textureBottomLeft);
            cubeVertices[2] =
                new VertexPositionNormalTexture(
                topRightFront, frontNormal, textureTopRight);
            cubeVertices[3] =
                new VertexPositionNormalTexture(
                bottomLeftFront, frontNormal, textureBottomLeft);
            cubeVertices[4] =
                new VertexPositionNormalTexture(
                bottomRightFront, frontNormal, textureBottomRight);
            cubeVertices[5] =
                new VertexPositionNormalTexture(
                topRightFront, frontNormal, textureTopRight);

            // Back face 
            cubeVertices[6] =
                new VertexPositionNormalTexture(
                topLeftBack, backNormal, textureTopRight);
            cubeVertices[7] =
                new VertexPositionNormalTexture(
                topRightBack, backNormal, textureTopLeft);
            cubeVertices[8] =
                new VertexPositionNormalTexture(
                bottomLeftBack, backNormal, textureBottomRight);
            cubeVertices[9] =
                new VertexPositionNormalTexture(
                bottomLeftBack, backNormal, textureBottomRight);
            cubeVertices[10] =
                new VertexPositionNormalTexture(
                topRightBack, backNormal, textureTopLeft);
            cubeVertices[11] =
                new VertexPositionNormalTexture(
                bottomRightBack, backNormal, textureBottomLeft);

            // Top face
            cubeVertices[12] =
                new VertexPositionNormalTexture(
                topLeftFront, topNormal, textureBottomLeft);
            cubeVertices[13] =
                new VertexPositionNormalTexture(
                topRightBack, topNormal, textureTopRight);
            cubeVertices[14] =
                new VertexPositionNormalTexture(
                topLeftBack, topNormal, textureTopLeft);
            cubeVertices[15] =
                new VertexPositionNormalTexture(
                topLeftFront, topNormal, textureBottomLeft);
            cubeVertices[16] =
                new VertexPositionNormalTexture(
                topRightFront, topNormal, textureBottomRight);
            cubeVertices[17] =
                new VertexPositionNormalTexture(
                topRightBack, topNormal, textureTopRight);

            // Bottom face 
            cubeVertices[18] =
                new VertexPositionNormalTexture(
                bottomLeftFront, bottomNormal, textureTopLeft);
            cubeVertices[19] =
                new VertexPositionNormalTexture(
                bottomLeftBack, bottomNormal, textureBottomLeft);
            cubeVertices[20] =
                new VertexPositionNormalTexture(
                bottomRightBack, bottomNormal, textureBottomRight);
            cubeVertices[21] =
                new VertexPositionNormalTexture(
//.........这里部分代码省略.........
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:101,代码来源:Skybox.cs

示例5: Initialize

 public override void Initialize(GraphicInfo ginfo, GraphicFactory factory, IObject obj)
 {
     _shader = factory.GetEffect("TransparentEffect",true,true);
     base.Initialize(ginfo, factory, obj);
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:5,代码来源:ForwardTransparenteShader.cs

示例6: Init

 public override void Init(GraphicInfo ginfo, GraphicFactory factory)
 {
     effect = factory.GetEffect("AntiAliasingtabulastalker",false,true);
     effect.CurrentTechnique = effect.Techniques["AntiAliasingTabula"];            
 }        
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:5,代码来源:AntiAliasingPostEffectTabula.cs

示例7: 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

示例8: 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

示例9: 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

示例10: Initialize

        /// <summary>
        /// Initializes this instance.
        /// </summary>
        public virtual void Initialize(GraphicInfo ginfo, GraphicFactory factory, IObject obj)
        {
            #if !WINDOWS_PHONE && !REACH
            basicDraw = factory.GetEffect("clippingPlane", false, true);
            getDepth = factory.GetEffect("ShadowDepth",false,true);
            BasicDrawSamplerState = SamplerState.LinearWrap;            
            #endif
            if (useOcclusionCulling)
            {
                if(Modelo==null)
                    Modelo = new SimpleModel(factory, "block", true);

                if (BasicEffect == null)
                {
                    BasicEffect = factory.GetBasicEffect();
                    BasicEffect.TextureEnabled = false;
                    BasicEffect.VertexColorEnabled = false;                    
                }

                if (BlendState == null)
                {
                    BlendState = new Microsoft.Xna.Framework.Graphics.BlendState();
                    BlendState.ColorWriteChannels = ColorWriteChannels.None;                    
                }
                OcclusionQuery = factory.CreateOcclusionQuery();
                OcclusionQuery.Tag = "Begin";
            }
            this.GraphicFactory = factory;
            isInitialized = true;    
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:33,代码来源:IShader.cs


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