本文整理汇总了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;
}
示例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!");
}
}
示例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;
}
示例4:
int INativeLibraryFacade.mdb_set_dupsort(IntPtr txn, uint dbi, CompareFunction cmp)
{
return FallbackLibraryFacade.mdb_set_dupsort(txn, dbi, cmp);
}
示例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;
}
示例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;
}
示例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;
}
示例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 ) );
}
示例9: SetDepthBufferParams
public override void SetDepthBufferParams( bool depthTest, bool depthWrite, CompareFunction depthFunction )
{
DepthBufferCheckEnabled = depthTest;
DepthBufferWriteEnabled = depthWrite;
DepthBufferFunction = depthFunction;
}
示例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));
}
示例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
}
}
示例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;
}
}
示例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();
}
示例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;
}
}
示例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();
}
}