public override void Process(RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState) { if (renderNode.RenderStage == RenderStage) { pipelineState.RasterizerState = RasterizerStates.Wireframe; } }
internal RenderNodeReference CreateRenderNode(RenderObject renderObject, RenderView renderView, ViewObjectNodeReference renderPerViewNode, RenderStage renderStage) { var renderNode = new RenderNode(renderObject, renderView, renderPerViewNode, renderStage); // Create view node var index = RenderNodes.Add(renderNode); var result = new RenderNodeReference(index); return(result); }
public override void Process(RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState) { // Objects in the shadow map render stage disable culling and depth clip if (renderNode.RenderStage == ShadowMapRenderStage) { pipelineState.RasterizerState = new RasterizerStateDescription(CullMode.None) { DepthClipEnable = DepthClipping }; } }
public override void Process(RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState) { var output = renderNode.RenderStage.Output; var isMultisample = output.MultisampleCount != MultisampleCount.None; var renderMesh = (RenderMesh)renderObject; // Make object in transparent stage use AlphaBlend and DepthRead if (renderNode.RenderStage == TransparentRenderStage) { pipelineState.BlendState = renderMesh.MaterialPass.BlendState ?? BlendStates.AlphaBlend; pipelineState.DepthStencilState = DepthStencilStates.DepthRead; if (isMultisample) { pipelineState.BlendState.AlphaToCoverageEnable = true; } } var cullMode = pipelineState.RasterizerState.CullMode; // Apply material cull mode var cullModeOverride = renderMesh.MaterialInfo.CullMode; // No override, or already two-sided? if (cullModeOverride.HasValue && cullMode != CullMode.None) { if (cullModeOverride.Value == CullMode.None) { // Override to two-sided cullMode = CullMode.None; } else if (cullModeOverride.Value == cullMode) { // No or double flipping cullMode = CullMode.Back; } else { // Single flipping cullMode = CullMode.Front; } } // Flip faces when geometry is inverted if (renderMesh.IsScalingNegative) { if (cullMode == CullMode.Front) { cullMode = CullMode.Back; } else if (cullMode == CullMode.Back) { cullMode = CullMode.Front; } } pipelineState.RasterizerState.CullMode = cullMode; if (isMultisample) { pipelineState.RasterizerState.MultisampleCount = output.MultisampleCount; pipelineState.RasterizerState.MultisampleAntiAliasLine = true; } pipelineState.RasterizerState.ScissorTestEnable = output.ScissorTestEnable; }
protected override void ProcessPipelineState(RenderContext context, RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState) { var renderMesh = (RenderMesh)renderObject; var drawData = renderMesh.ActiveMeshDraw; pipelineState.InputElements = PrepareInputElements(pipelineState, drawData); pipelineState.PrimitiveType = drawData.PrimitiveType; // Prepare each sub render feature foreach (var renderFeature in RenderFeatures) { renderFeature.ProcessPipelineState(context, renderNodeReference, ref renderNode, renderObject, pipelineState); } }
public abstract void Process(RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState);
/// <summary> /// Does any changes required to the pipeline state by this render feature. /// </summary> /// <param name="context">Context object providing access to information and services.</param> /// <param name="renderNodeReference"></param> /// <param name="renderNode"></param> /// <param name="renderObject"></param> /// <param name="pipelineState"></param> public virtual void ProcessPipelineState(RenderContext context, RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState) { }