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
         };
     }
 }
Example #4
0
        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 = drawData.VertexBuffers.CreateInputElements();
            pipelineState.PrimitiveType = drawData.PrimitiveType;
        }
Example #5
0
 protected virtual void ProcessPipelineState(RenderContext context, RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState)
 {
 }
Example #6
0
        public override void Process(RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState)
        {
            var isMultisample = renderNode.RenderStage.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         = renderNode.RenderStage.Output.MultisampleCount;
                pipelineState.RasterizerState.MultisampleAntiAliasLine = true;
            }
        }
Example #7
0
        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 = drawData.VertexBuffers.CreateInputElements();
            pipelineState.PrimitiveType = drawData.PrimitiveType;
        }
 protected virtual void ProcessPipelineState(RenderContext context, RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState)
 {
 }
        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;
        }
        /// <inheritdoc/>
        protected override void ProcessPipelineState(RenderContext context, RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState)
        {
            var renderParticleEmitter = (RenderParticleEmitter)renderObject;

            pipelineState.InputElements = renderParticleEmitter.ParticleEmitter.VertexBuilder.VertexDeclaration.CreateInputElements();
            pipelineState.PrimitiveType = PrimitiveType.TriangleList;

            var material = renderParticleEmitter.ParticleMaterialInfo.Material;
            material.SetupPipeline(context, pipelineState);
        }
Example #11
0
        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);
            }
        }
Example #12
0
 public abstract void Process(RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState);