• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CompareFunction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PrepareStencilReadWrite

 public static void PrepareStencilReadWrite(this GraphicsDevice _, CompareFunction comparison, StencilMask reference)
 {
   GraphicsDeviceExtensions.dssCombiner.StencilEnable = true;
   GraphicsDeviceExtensions.dssCombiner.StencilPass = StencilOperation.Replace;
   GraphicsDeviceExtensions.dssCombiner.StencilFunction = comparison;
   GraphicsDeviceExtensions.dssCombiner.ReferenceStencil = (int) reference;
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:7,代码来源:GraphicsDeviceExtensions.cs


示例2: GetComparison

        static private SharpDX.Direct3D11.Comparison GetComparison( CompareFunction compare)
        {
            switch (compare)
            {
                case CompareFunction.Always:
                    return SharpDX.Direct3D11.Comparison.Always;

                case CompareFunction.Equal:
                    return SharpDX.Direct3D11.Comparison.Equal;

                case CompareFunction.Greater:
                    return SharpDX.Direct3D11.Comparison.Greater;

                case CompareFunction.GreaterEqual:
                    return SharpDX.Direct3D11.Comparison.GreaterEqual;

                case CompareFunction.Less:
                    return SharpDX.Direct3D11.Comparison.Less;

                case CompareFunction.LessEqual:
                    return SharpDX.Direct3D11.Comparison.LessEqual;

                case CompareFunction.Never:
                    return SharpDX.Direct3D11.Comparison.Never;

                case CompareFunction.NotEqual:
                    return SharpDX.Direct3D11.Comparison.NotEqual;

                default:
                    throw new ArgumentException("Invalid comparison!");
            }
        }
开发者ID:Breadmouth,项目名称:Gravitas,代码行数:32,代码来源:DepthStencilState.DirectX.cs


示例3: SetDefault

        /// <summary>
        /// Sets default values for this instance.
        /// </summary>
        public DepthStencilStateDescription SetDefault()
        {
            DepthBufferEnable = true;
            DepthBufferWriteEnable = true;
            DepthBufferFunction = CompareFunction.LessEqual;
            StencilEnable = false;

            FrontFace.StencilFunction = CompareFunction.Always;
            FrontFace.StencilPass = StencilOperation.Keep;
            FrontFace.StencilFail = StencilOperation.Keep;
            FrontFace.StencilDepthBufferFail = StencilOperation.Keep;

            BackFace.StencilFunction = CompareFunction.Always;
            BackFace.StencilPass = StencilOperation.Keep;
            BackFace.StencilFail = StencilOperation.Keep;
            BackFace.StencilDepthBufferFail = StencilOperation.Keep;
            
            StencilMask = byte.MaxValue;
            StencilWriteMask = byte.MaxValue;
            return this;
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:24,代码来源:DepthStencilStateDescription.cs


示例4:

 int INativeLibraryFacade.mdb_set_dupsort(IntPtr txn, uint dbi, CompareFunction cmp)
 {
     return FallbackLibraryFacade.mdb_set_dupsort(txn, dbi, cmp);
 }
开发者ID:malyn,项目名称:Lightning.NET,代码行数:4,代码来源:NativeLibraryFacades.cs


示例5: CompositionPass

 public CompositionPass(CompositionTargetPass parent)
 {
     this.parent = parent;
     type = CompositorPassType.RenderQuad;
     identifier = 0;
     firstRenderQueue = RenderQueueGroupID.SkiesEarly;
     lastRenderQueue = RenderQueueGroupID.SkiesLate;
     clearBuffers = FrameBuffer.Color | FrameBuffer.Depth;
     clearColor = new ColorEx(0f, 0f, 0f, 0f);
     clearDepth = 1.0f;
     clearStencil = 0;
     stencilCheck = false;
     stencilFunc = CompareFunction.AlwaysPass;
     stencilRefValue = 0;
     stencilMask = (int)0x7FFFFFFF;
     stencilFailOp = StencilOperation.Keep;
     stencilDepthFailOp = StencilOperation.Keep;
     stencilPassOp = StencilOperation.Keep;
     stencilTwoSidedOperation = false;
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:20,代码来源:CompositionPass.cs


示例6: SetAlphaRejectSettings

		/// <summary>
		/// Sets the way the pass will have use alpha to totally reject pixels from the pipeline.
		/// </summary>
		/// <remarks>
		/// The default is <see ref="CompareFunction.AlwaysPass" /> i.e. alpha is not used to reject pixels.
		/// <para>This option applies in both the fixed function and the programmable pipeline.</para></remarks>
		/// <param name="alphaRejectFunction">The comparison which must pass for the pixel to be written.</param>
		/// <param name="value">value against which alpha values will be tested [(0-255]</param>
		public void SetAlphaRejectSettings( CompareFunction alphaRejectFunction, int value )
		{
			_alphaRejectFunction = alphaRejectFunction;
			_alphaRejectValue = value;
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:13,代码来源:Pass.cs


示例7: SetAlphaRejectSettings

        public override void SetAlphaRejectSettings( CompareFunction func, byte value, bool alphaToCoverage)
        {
            var a2C = false;

            if ( func != CompareFunction.AlwaysPass )
            {
                SetRenderState( RenderState.AlphaTestEnable, true );
                a2C = alphaToCoverage;
            }
            else
            {
                SetRenderState( RenderState.AlphaTestEnable, false );
            }

            // Set always just be sure
            SetRenderState(RenderState.AlphaFunc, (int)D3DHelper.ConvertEnum(func));
            SetRenderState(RenderState.AlphaRef, value);

            // Alpha to coverage
            if ( !Capabilities.HasCapability( Graphics.Capabilities.AlphaToCoverage ) )
                return;

            // Vendor-specific hacks on renderstate, gotta love 'em
            switch ( Capabilities.Vendor )
            {
                case GPUVendor.Nvidia:
                    if ( a2C )
                    {
                        SetRenderState( RenderState.AdaptiveTessY, ( 'A' | ( 'T' ) << 8 | ( 'O' ) << 16 | ( 'C' ) << 24 ) );
                    }
                    else
                    {
                        SetRenderState( RenderState.AdaptiveTessY, (int)Format.Unknown );
                    }
                    break;
                case GPUVendor.Ati:
                    if ( a2C )
                    {
                        SetRenderState( RenderState.AdaptiveTessY, ( 'A' | ( '2' ) << 8 | ( 'M' ) << 16 | ( '1' ) << 24 ) );
                    }
                    else
                    {
                        // discovered this through trial and error, seems to work
                        SetRenderState( RenderState.AdaptiveTessY, ( 'A' | ( '2' ) << 8 | ( 'M' ) << 16 | ( '0' ) << 24 ) );
                    }
                    break;
            }
            // no hacks available for any other vendors?
            //lasta2c = a2c;
        }
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:50,代码来源:D3DRenderSystem.cs


示例8: SetStencilBufferParams

        public override void SetStencilBufferParams( CompareFunction function = CompareFunction.AlwaysPass, 
            int refValue = 0, int mask = -1, 
            StencilOperation stencilFailOp = StencilOperation.Keep, StencilOperation depthFailOp = StencilOperation.Keep, 
            StencilOperation passOp = StencilOperation.Keep, bool twoSidedOperation = false )
        {
            bool flip;

            // 2 sided operation?
            if ( twoSidedOperation )
            {
                if (!currentCapabilities.HasCapability(Graphics.Capabilities.TwoSidedStencil))
                {
                    throw new AxiomException( "2-sided stencils are not supported on this hardware!" );
                }

                SetRenderState( RenderState.TwoSidedStencilMode, true );

                // NB: We should always treat CCW as front face for consistent with default
                // culling mode. Therefore, we must take care with two-sided stencil settings.
                flip = (invertVertexWinding && activeRenderTarget.RequiresTextureFlipping) ||
                    (!invertVertexWinding && !activeRenderTarget.RequiresTextureFlipping);

                SetRenderState( RenderState.CcwStencilFail, (int)D3DHelper.ConvertEnum( stencilFailOp, !flip ) );
                SetRenderState( RenderState.CcwStencilZFail, (int)D3DHelper.ConvertEnum( depthFailOp, !flip ) );
                SetRenderState( RenderState.CcwStencilPass, (int)D3DHelper.ConvertEnum( passOp, !flip ) );
            }
            else
            {
                SetRenderState( RenderState.TwoSidedStencilMode, false );
                flip = false;
            }

            // configure standard version of the stencil operations
            SetRenderState( RenderState.StencilFunc, (int)D3DHelper.ConvertEnum( function ) );
            SetRenderState( RenderState.StencilRef, refValue );
            SetRenderState( RenderState.StencilMask, mask );
            SetRenderState( RenderState.StencilFail, (int)D3DHelper.ConvertEnum( stencilFailOp, flip ) );
            SetRenderState( RenderState.StencilZFail, (int)D3DHelper.ConvertEnum( depthFailOp, flip ) );
            SetRenderState( RenderState.StencilPass, (int)D3DHelper.ConvertEnum( passOp, flip ) );
        }
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:40,代码来源:D3DRenderSystem.cs


示例9: SetDepthBufferParams

 public override void SetDepthBufferParams( bool depthTest, bool depthWrite, CompareFunction depthFunction )
 {
     DepthBufferCheckEnabled = depthTest;
     DepthBufferWriteEnabled = depthWrite;
     DepthBufferFunction = depthFunction;
 }
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:6,代码来源:D3DRenderSystem.cs


示例10: mdb_set_dupsort

 public static int mdb_set_dupsort(IntPtr txn, uint dbi, CompareFunction cmp)
 {
     return check(LmdbMethods.mdb_set_dupsort(txn, dbi, cmp));
 }
开发者ID:sebastienros,项目名称:Lightning.NET,代码行数:4,代码来源:Lmdb.cs


示例11: ConvertCompareFunction

		public GLenum ConvertCompareFunction( CompareFunction func )
		{
			switch ( func )
			{
				case CompareFunction.AlwaysFail:
					return GLenum.Never;
				case CompareFunction.AlwaysPass:
					return GLenum.Always;
				case CompareFunction.Less:
					return GLenum.Less;
				case CompareFunction.LessEqual:
					return GLenum.Lequal;
				case CompareFunction.Equal:
					return GLenum.Equal;
				case CompareFunction.NotEqual:
					return GLenum.Notequal;
				case CompareFunction.GreaterEqual:
					return GLenum.Gequal;
				case CompareFunction.Greater:
					return GLenum.Greater;
				default:
					return GLenum.Always; //To keep compiler happy
			}
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:24,代码来源:GLES2RenderSystem.cs


示例12: SetAlphaRejectSettings

		public override void SetAlphaRejectSettings( CompareFunction func, byte value, bool alphaToCoverage )
		{
			bool a2c = false;

			if ( func != CompareFunction.AlwaysPass )
			{
				a2c = alphaToCoverage;
			}

			if ( a2c != this.lasta2c && Capabilities.HasCapability( Graphics.Capabilities.AlphaToCoverage ) )
			{
				if ( a2c )
				{
					GL.Enable( All.SampleAlphaToCoverage );
					GLES2Config.GlCheckError( this );
				}
				else
				{
					GL.Disable( All.SampleAlphaToCoverage );
					GLES2Config.GlCheckError( this );
				}

				this.lasta2c = a2c;
			}
		}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:25,代码来源:GLES2RenderSystem.cs


示例13: GL

 public GL()
 {
     int num;
     camera = new GLExCamera();
     camera.viewMatrix = camera.Result;
     this.rstateScissor = new RasterizerState();
     this.rstateScissor.CullMode = CullMode.None;
     this.rstateScissor.ScissorTestEnable = true;
     this.color = new float[4];
     this.clearColor = Color.Black;
     this.ColorWriteChannels = Microsoft.Xna.Framework.Graphics.ColorWriteChannels.All;
     this.AlphaDestinationBlend = Blend.InverseSourceAlpha;
     this.depthFunc = CompareFunction.Always;
     this.vertex = new Vertex[8];
     sTextures.Add(null);
     this.matrixStack = new Stack<Matrix>();
     this.matrixStack.Push(Matrix.Identity);
     this.effect = new BasicEffect(device);
     this.effect.VertexColorEnabled = true;
     this.effect.Projection = Microsoft.Xna.Framework.Matrix.CreateOrthographicOffCenter(0f, LSystem.screenRect.width, LSystem.screenRect.height, 0f, -1.0f, 1.0f);
     this.alphaTestEffect = new AlphaTestEffect(device);
     this.alphaTestEffect.VertexColorEnabled = true;
     device.RasterizerState = RasterizerState.CullNone;
     device.DepthStencilState = DepthStencilState.None;
     for (num = 0; num < this.vertex.Length; num++)
     {
         this.vertex[num] = new Vertex();
     }
     for (num = 0; num < 4; num++)
     {
         this.color[num] = 1f;
     }
     EnableTextures();
 }
开发者ID:ordanielcmessias,项目名称:LGame,代码行数:34,代码来源:GL.cs


示例14: GLDepthFunc

        public void GLDepthFunc(int func)
        {
            switch (func)
            {
                case 0x206:
                    this.depthFunc = CompareFunction.GreaterEqual;
                    break;

                case 0x207:
                    this.depthFunc = CompareFunction.Always;
                    break;

                case 0x202:
                    this.depthFunc = CompareFunction.Equal;
                    break;
            }
        }
开发者ID:ordanielcmessias,项目名称:LGame,代码行数:17,代码来源:GL.cs


示例15: ConvertComparisonFunction

 public static CompareOperation ConvertComparisonFunction(CompareFunction comparison)
 {
     switch (comparison)
     {
         case CompareFunction.Always:
             return CompareOperation.Always;
         case CompareFunction.Never:
             return CompareOperation.Never;
         case CompareFunction.Equal:
             return CompareOperation.Equal;
         case CompareFunction.Greater:
             return CompareOperation.Greater;
         case CompareFunction.GreaterEqual:
             return CompareOperation.GreaterOrEqual;
         case CompareFunction.Less:
             return CompareOperation.Less;
         case CompareFunction.LessEqual:
             return CompareOperation.LessOrEqual;
         case CompareFunction.NotEqual:
             return CompareOperation.NotEqual;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:24,代码来源:VulkanConvertExtensions.cs


示例16: mdb_set_compare

 public static extern int mdb_set_compare(IntPtr txn, uint dbi, CompareFunction cmp);
开发者ID:CoreyKaylor,项目名称:Lightning.NET,代码行数:1,代码来源:LmdbMethods.cs


示例17: Add

 public static Material Add(Material baseMat, int stencilID, StencilOp operation, CompareFunction compareFunction, ColorWriteMask colorWriteMask)
 {
   return StencilMaterial.Add(baseMat, stencilID, operation, compareFunction, colorWriteMask, (int) byte.MaxValue, (int) byte.MaxValue);
 }
开发者ID:NetherDrk,项目名称:Eternal-Empire,代码行数:4,代码来源:StencilMaterial.cs


示例18: Pass

		/// <summary>
		///    Default constructor.
		/// </summary>
		/// <param name="parent">Technique that owns this Pass.</param>
		/// <param name="index">Index of this pass.</param>
		public Pass( Technique parent, int index )
		{
			this._parent = parent;
			this._index = index;

			lock ( passLock )
			{
				this.passId = nextPassId++;
			}

			// color defaults
			_ambient = ColorEx.White;
			_diffuse = ColorEx.White;
			_specular = ColorEx.Black;
			_emissive = ColorEx.Black;

			// by default, don't override the scene's fog settings
			_fogOverride = false;
			_fogMode = FogMode.None;
			_fogColor = ColorEx.White;
			_fogStart = 0;
			_fogEnd = 1;
			_fogDensity = 0.001f;

			// default blending (overwrite)
			_sourceBlendFactor = SceneBlendFactor.One;
			_destinationBlendFactor = SceneBlendFactor.Zero;



			// depth buffer settings
			_depthCheck = true;
			_depthWrite = true;
			_colorWriteEnabled = true;
			_depthFunction = CompareFunction.LessEqual;

			// cull settings
			_cullingMode = CullingMode.Clockwise;
			_manualCullingMode = ManualCullingMode.Back;

			// light settings
			_lightingEnabled = true;
			_runOnlyForOneLightType = true;
			_onlyLightType = LightType.Point;
			_shadingMode = Shading.Gouraud;

			// Default max lights to the global max
			_maxSimultaneousLights = Config.MaxSimultaneousLights;

			_name = index.ToString();

            IterationCount = 1;

			DirtyHash();
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:60,代码来源:Pass.cs


示例19: GetStencilFunc

 private static GLStencilFunction GetStencilFunc(CompareFunction function)
 {
     switch (function)
     {
     case CompareFunction.Always:
         return GLStencilFunction.Always;
     case CompareFunction.Equal:
         return GLStencilFunction.Equal;
     case CompareFunction.Greater:
         return GLStencilFunction.Greater;
     case CompareFunction.GreaterEqual:
         return GLStencilFunction.Gequal;
     case CompareFunction.Less:
         return GLStencilFunction.Less;
     case CompareFunction.LessEqual:
         return GLStencilFunction.Lequal;
     case CompareFunction.Never:
         return GLStencilFunction.Never;
     case CompareFunction.NotEqual:
         return GLStencilFunction.Notequal;
     default:
         return GLStencilFunction.Always;
     }
 }
开发者ID:GhostTap,项目名称:MonoGame,代码行数:24,代码来源:DepthStencilState.cs


示例20: GL10

 public GL10()
 {
     int num;
     this.color = new float[4];
     this.clearColor = Color.Black;
     this.ColorWriteChannels = ColorWriteChannels.All;
     this.AlphaDestinationBlend = Blend.InverseSourceAlpha;
     this.depthFunc = CompareFunction.Always;
     this.textureFilter = TextureFilter.Linear;
     this.textureAddressU = TextureAddressMode.Clamp;
     this.textureAddressV = TextureAddressMode.Clamp;
     this.vertex = new Vertex[8];
     this.texture = new Texture[0x100];
     this.matrixStack = new Stack<Matrix>();
     this.effect = new BasicEffect(GLEx.device);
     this.effect.VertexColorEnabled = true;
     this.alphaTestEffect = new AlphaTestEffect(GLEx.device);
     this.alphaTestEffect.VertexColorEnabled = true;
     for (num = 0; num < this.vertex.Length; num++)
     {
         this.vertex[num] = new Vertex();
     }
     for (num = 0; num < 4; num++)
     {
         this.color[num] = 1f;
     }
 }
开发者ID:hellogithubtesting,项目名称:LGame,代码行数:27,代码来源:GL10.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CompareOptions类代码示例发布时间:2022-05-24
下一篇:
C# Company类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap