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


C# CompareFunction类代码示例

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


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


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