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


C# Graphics.EffectTechnique类代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.EffectTechnique的典型用法代码示例。如果您正苦于以下问题:C# EffectTechnique类的具体用法?C# EffectTechnique怎么用?C# EffectTechnique使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EffectTechnique类属于Microsoft.Xna.Framework.Graphics命名空间,在下文中一共展示了EffectTechnique类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Effect

 internal Effect(GraphicsDevice device)
 {
     graphicsDevice = device;
     Parameters = new EffectParameterCollection();
     Techniques = new EffectTechniqueCollection();
     CurrentTechnique = new EffectTechnique(this);
 }
开发者ID:HaKDMoDz,项目名称:Zazumo,代码行数:7,代码来源:Effect.cs

示例2: Draw

        public void Draw(EffectTechnique technique)
        {
            if (vertices.Count > 0)
            {
                UniversalEffect effect = RendererAssetPool.UniversalEffect;
                if (technique == null)
                    effect.CurrentTechnique = this.Technique;
                else
                    effect.CurrentTechnique = technique;

                Ready();
                effect.Begin();
                foreach (EffectPass pass in effect.CurrentTechnique.Passes)//TODO1 remove this when shading i
                {
                    pass.Begin();
                    GraphicsDevice device = GraphicOptions.graphics.GraphicsDevice;
                    device.VertexDeclaration = vertDeclaration;
                    device.Vertices[0].SetSource(vertexBuffer, 0, VertexPositionColorTexture.SizeInBytes);
                    device.DrawUserPrimitives<VertexPositionColorTexture>(
                        PrimitiveType.LineList, vertices.ToArray(), 0, 2);
                    pass.End();
                }
                effect.End();
            }
        }
开发者ID:summer-of-software,项目名称:vtank,代码行数:25,代码来源:VertexPositionColorTextureGroup.cs

示例3: createBasicEffect

        private void createBasicEffect()
        {
            var et = new EffectTechnique(this);
            Techniques["Wtf"] = et;
            CurrentTechnique = et;

            et.Passes["Wtf2"] = new EffectPass(et);
        }
开发者ID:adison,项目名称:Tank-Wars,代码行数:8,代码来源:BasicEffect.cs

示例4: EffectTechnique

        internal EffectTechnique(Effect effect, EffectTechnique cloneSource)
        {
            // Share all the immutable types.
            Name = cloneSource.Name;
            Annotations = cloneSource.Annotations;

            // Clone the mutable types.
            Passes = new EffectPassCollection(effect, cloneSource.Passes);
        }
开发者ID:fragcastle,项目名称:MonoGame,代码行数:9,代码来源:EffectTechnique.cs

示例5: createBasicEffect

        private void createBasicEffect()
        {
            var et = new EffectTechnique(this);
            Techniques["Wtf"] = et;
            CurrentTechnique = et;
			var pass = new EffectPass(et);
			pass.Name = "Wtf2";
            et.Passes[pass.Name] = pass; 
        }
开发者ID:Nick0n,项目名称:MonoGame,代码行数:9,代码来源:BasicEffect.cs

示例6: EffectTechniqueDescription

        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="EffectTechniqueDescription"/> class.
        /// </summary>
        /// <param name="effect">The effect.</param>
        /// <param name="technique">The effect technique.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="effect"/> or <paramref name="technique"/> is <see langword="null"/>.
        /// </exception>
        public EffectTechniqueDescription(Effect effect, EffectTechnique technique)
        {
            if (effect == null)
            throw new ArgumentNullException("effect");
              if (technique == null)
            throw new ArgumentNullException("technique");

              Technique = technique;
              Index = GetIndex(effect, technique);

            #if !MONOGAME
              // Check if there is an associated technique for hardware instancing.
              var annotation = technique.Annotations["InstancingTechnique"];
              if (annotation != null && annotation.ParameterType == EffectParameterType.String)
              {
            var techniqueName = annotation.GetValueString();
            if (!string.IsNullOrEmpty(techniqueName))
            {
              InstancingTechnique = effect.Techniques[techniqueName];

              if (InstancingTechnique == null)
              {
            string message = string.Format(CultureInfo.InvariantCulture, "Could not find instancing technique \"{0}\" in the effect \"{1}\".", techniqueName, effect.Name);
            throw new GraphicsException(message);
              }
            }
              }
            #else
              // Workaround: MonoGame does not support effect semantics and annotations.
              if (technique.Name.IndexOf("INSTANCING", StringComparison.OrdinalIgnoreCase) == -1)
              {
            if (effect.Techniques.Count == 2
            && effect.Techniques[1].Name.IndexOf("INSTANCING", StringComparison.OrdinalIgnoreCase) >= 0)
            {
              InstancingTechnique = effect.Techniques[1];
            }

            if (InstancingTechnique == null)
            {
              foreach (var otherTechnique in effect.Techniques)
              {
            if (technique == otherTechnique)
              continue;

            if (otherTechnique.Name.IndexOf(technique.Name, StringComparison.OrdinalIgnoreCase) >= 0
                && otherTechnique.Name.IndexOf("INSTANCING", StringComparison.OrdinalIgnoreCase) >= 0)
            {
              InstancingTechnique = otherTechnique;
              break;
            }
              }
            }
              }
            #endif
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:64,代码来源:EffectTechniqueDescription.cs

示例7: RenderScreenQuad

        public void RenderScreenQuad(Effect effect, EffectTechnique technique, Texture2D texture)
        {
            effect.CurrentTechnique = technique;

            sb.Begin(SpriteBlendMode.None, SpriteSortMode.Immediate, SaveStateMode.None);
            effect.Begin();
            technique.Passes[0].Begin();
            sb.Draw(texture, screen, Color.White);
            technique.Passes[0].End();
            effect.End();
            sb.End();
        }
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:12,代码来源:PostProcessManager.cs

示例8: GetDescription

        /// <inheritdoc/>
        public override EffectTechniqueDescription GetDescription(Effect effect, EffectTechnique technique)
        {
            if (effect is AlphaTestEffect
              || effect is BasicEffect
              || effect is DualTextureEffect
              || effect is EnvironmentMapEffect
              || effect is SkinnedEffect)
              {
            return new EffectTechniqueDescription(effect, technique);
              }

              return null;
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:14,代码来源:StockEffectInterpreter.cs

示例9: Draw

        public override void Draw(EffectTechnique technique)
        {
            if (!flag)
                flag = true;
            else
            {
                flag = false;
                return;
            }

            if (ServiceManager.Game.Options.GamePlay.ShowNames)
            {
                /*GraphicsDevice device = GraphicOptions.graphics.GraphicsDevice;
                Vector3 offset = new Vector3(0, 0, 0);
                Vector3 pPosition = Vector3.Zero;// position + offset;
                Matrix projection = GraphicOptions.CurrentCamera.Projection;
                Matrix view = GraphicOptions.CurrentCamera.View;
                Matrix world = Matrix.CreateTranslation(position + offset);//Matrix.Identity;// Matrix.Invert(GraphicOptions.CurrentCamera.View);

                Vector3 projectedPosition = device.Viewport.Project(pPosition, projection, view, world);

                Vector2 newPosition = new Vector2(projectedPosition.X, projectedPosition.Y);
                newPosition.X = newPosition.X - (width / 2.0f);
                newPosition.Y = newPosition.Y - (height / 2.0f);

                ServiceManager.Game.Batch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None);
                ServiceManager.Game.Batch.DrawString(ServiceManager.Game.Font, text, newPosition, Color.Black);
                ServiceManager.Game.Batch.End();*/

                GraphicsDevice device = GraphicOptions.graphics.GraphicsDevice;
                device.RenderState.AlphaBlendEnable = true;
                device.RenderState.SourceBlend = Blend.SourceAlpha;
                device.RenderState.DestinationBlend = Blend.InverseSourceAlpha;
                device.RenderState.AlphaFunction = CompareFunction.Greater;
                device.RenderState.SeparateAlphaBlendEnabled = false;
                device.RenderState.AlphaTestEnable = true;

                base.Draw(technique);

                device.RenderState.AlphaBlendEnable = false;
                device.RenderState.SourceBlend = Blend.One;
                device.RenderState.DestinationBlend = Blend.Zero;
            }
        }
开发者ID:summer-of-software,项目名称:vtank,代码行数:44,代码来源:TextObject.cs

示例10: SsaoMapBlur

        public SsaoMapBlur(Effect effect, SpriteBatch spriteBatch, int width, int height, SurfaceFormat format, int radius, float amount)
        {
            if (effect == null) throw new ArgumentNullException("effect");
            if (spriteBatch == null) throw new ArgumentNullException("spriteBatch");
            if (width < 1) throw new ArgumentOutOfRangeException("width");
            if (height < 1) throw new ArgumentOutOfRangeException("height");
            if (radius < MinAmount || MaxRadius < radius) throw new ArgumentOutOfRangeException("value");
            if (amount < MinAmount) throw new ArgumentOutOfRangeException("value");

            this.effect = effect;
            this.spriteBatch = spriteBatch;
            Width = width;
            Height = height;
            Radius = radius;
            Amount = amount;

            graphicsDevice = effect.GraphicsDevice;

            normalDepthMap = effect.Parameters["NormalDepthMap"];
            horizontalBlurTechnique = effect.Techniques["HorizontalBlur"];
            verticalBlurTechnique = effect.Techniques["VerticalBlur"];

            InitializeEffectParameters();

            backingRenderTarget = new RenderTarget2D(graphicsDevice, width, height, false, format,
                DepthFormat.None, 0, RenderTargetUsage.PlatformContents);
        }
开发者ID:willcraftia,项目名称:TestBlocks,代码行数:27,代码来源:SsaoMapBlur.cs

示例11: ShadowEffect

        public ShadowEffect(Effect clone)
            : base(clone)
        {
            SoftShadowEnabled = true;

            RenderShadowmap = Techniques["RenderShadowmap"];
            RenderLightmap = Techniques["RenderLightmap"];
            BlurLightmap = Techniques["BlurLightmap"];
        }
开发者ID:sp-alex-osou,项目名称:Shaders,代码行数:9,代码来源:ShadowEffect.cs

示例12: ShapeEffect

        public ShapeEffect(Effect clone)
            : base(clone)
        {
            NormalmapEnabled = true;
            HeightmapEnabled = false;
            ShadowEnabled = false;
            SpotlightEnabled = false;

            RenderScene = Techniques["RenderScene"];
        }
开发者ID:sp-alex-osou,项目名称:Shaders,代码行数:10,代码来源:ShapeEffect.cs

示例13: DrawHelper

 public DrawHelper(GraphicsDeviceManager ingraphics, Effect ineffect)
 {
     graphics = ingraphics;
     effect = ineffect;
     techniqueBasicTexturedRender = effect.Techniques["BasicTexturedRender"];
     techniqueBasicColorRender = effect.Techniques["BasicColorRender"];
     paramBoundTexture = effect.Parameters["xBoundTexture"];
     paramViewMatrix = effect.Parameters["xViewMatrix"];
     ortho = Matrix.CreateOrthographicOffCenter(0, 1, 0, 1, -1, 1);
 }
开发者ID:luqui,项目名称:luqui-misc,代码行数:10,代码来源:DrawHelper.cs

示例14: init

 public void init(Effect effect)
 {
     this.effect = effect;
     masterTechnique = effect.Techniques["Master"];
     color = new MasterTechnique(MasterTechnique.Mode.Color, effect, masterTechnique);
     texture = new MasterTechnique(MasterTechnique.Mode.Texture, effect, masterTechnique);
     textureAlpha = new MasterTechnique(MasterTechnique.Mode.TextureAlpha, effect, masterTechnique);
     gradient = new MasterTechnique(MasterTechnique.Mode.Gradient, effect, masterTechnique);
     silhouette = new MasterTechnique(MasterTechnique.Mode.Silhouette, effect, masterTechnique);
     modulate = new MasterTechnique(MasterTechnique.Mode.Modulate, effect, masterTechnique);
     add = new MasterTechnique(MasterTechnique.Mode.Add, effect, masterTechnique);
 }
开发者ID:Gayo,项目名称:Gayo-CAROT,代码行数:12,代码来源:Graphics.Techniques.cs

示例15: LoadContent

        public void LoadContent(GraphicsDevice g, ContentManager cm)
        {
            e = cm.Load<Effect>(@"shaders/bloom");
            luminosityExtractTechnique = e.Techniques["LuminosityExtract"];
            gaussianBlurTechnique = e.Techniques["Blur"];
            compositeTechnique = e.Techniques["Composite"];

            PresentationParameters pp = g.PresentationParameters;
            rTarget1 = new RenderTarget2D(g, pp.BackBufferWidth, pp.BackBufferHeight, 1, g.DisplayMode.Format);
            rTarget2 = new RenderTarget2D(g, pp.BackBufferWidth, pp.BackBufferHeight, 1, g.DisplayMode.Format);

            // calculate the blur parameters
            SetBlur(8);
        }
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:14,代码来源:Bloom.cs


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