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


C# RenderContext.ThrowIfGBuffer1Missing方法代码示例

本文整理汇总了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;
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:51,代码来源:EdgeFilter.cs


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