本文整理汇总了C#中RenderContext.ThrowIfGBuffer1Missing方法的典型用法代码示例。如果您正苦于以下问题:C# RenderContext.ThrowIfGBuffer1Missing方法的具体用法?C# RenderContext.ThrowIfGBuffer1Missing怎么用?C# RenderContext.ThrowIfGBuffer1Missing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderContext
的用法示例。
在下文中一共展示了RenderContext.ThrowIfGBuffer1Missing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnProcess
protected override void OnProcess(RenderContext context)
{
context.ThrowIfCameraMissing();
context.ThrowIfGBuffer0Missing();
context.ThrowIfGBuffer1Missing();
var graphicsDevice = GraphicsService.GraphicsDevice;
var source = context.SourceTexture;
var target = context.RenderTarget;
var viewport = context.Viewport;
if (TextureHelper.IsFloatingPointFormat(source.Format))
graphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
else
graphicsDevice.SamplerStates[0] = SamplerState.LinearClamp;
graphicsDevice.SetRenderTarget(target);
graphicsDevice.Viewport = viewport;
_parameterViewportSize.SetValue(new Vector2(viewport.Width, viewport.Height));
_parameterHalfEdgeWidth.SetValue(_halfEdgeWidth);
_parameterDepthThreshold.SetValue(DepthThreshold);
_parameterDepthSensitivity.SetValue(DepthSensitivity);
_parameterNormalThreshold.SetValue(NormalThreshold);
_parameterNormalSensitivity.SetValue(NormalSensitivity);
_parameterCameraBackward.SetValue((Vector3)(context.CameraNode.ViewInverse.GetColumn(2).XYZ));
_parameterSilhouetteColor.SetValue((Vector4)SilhouetteColor);
_parameterCreaseColor.SetValue((Vector4)CreaseColor);
if (_parameterSourceTexture != null)
_parameterSourceTexture.SetValue(source);
if (_parameterGBuffer0 != null)
_parameterGBuffer0.SetValue(context.GBuffer0);
if (_parameterGBuffer1 != null)
_parameterGBuffer1.SetValue(context.GBuffer1);
var pass = Numeric.IsLessOrEqual(_halfEdgeWidth, 0.5f) ? _passOnePixelEdge : _passEdge;
pass.Apply();
graphicsDevice.DrawFullScreenQuad();
if (_parameterSourceTexture != null)
_parameterSourceTexture.SetValue((Texture2D)null);
if (_parameterGBuffer0 != null)
_parameterGBuffer0.SetValue((Texture2D)null);
if (_parameterGBuffer1 != null)
_parameterGBuffer1.SetValue((Texture2D)null);
context.SourceTexture = source;
context.RenderTarget = target;
context.Viewport = viewport;
}