/// <summary> /// Do any changes required to the pipeline state. /// </summary> /// <param name="context"></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) { }
public abstract void Process(RenderObject renderObject);
public RenderNodeFeatureReference(RootRenderFeature rootRenderFeature, RenderNodeReference renderNode, RenderObject renderObject) { RootRenderFeature = rootRenderFeature; RenderNode = renderNode; RenderObject = renderObject; }
/// <summary> /// Removes a <see cref="RenderObject"/> from the rendering. /// </summary> /// <param name="renderObject"></param> public void RemoveRenderObject(RenderObject renderObject) { var renderFeature = renderObject.RenderFeature; renderFeature?.RemoveRenderObject(renderObject); }
protected override void ProcessPipelineState(RenderContext context, RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState) { var renderMesh = (RenderMesh)renderObject; var drawData = renderMesh.ActiveMeshDraw; if (drawData is StagedMeshDraw smd && smd.VertexBuffers == null) { smd.performStage(context.GraphicsDevice, smd); } 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 override void Process(RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState) { // Disable culling and depth clip if (renderNode.RenderStage == VoxelRenderStage) { pipelineState.RasterizerState = new RasterizerStateDescription(CullMode.None) { DepthClipEnable = DepthClipping }; pipelineState.DepthStencilState.DepthBufferEnable = false; pipelineState.DepthStencilState.DepthBufferWriteEnable = false; pipelineState.DepthStencilState.StencilEnable = false; pipelineState.DepthStencilState.StencilWriteMask = 0; pipelineState.DepthStencilState.StencilMask = 0; pipelineState.BlendState.RenderTarget0.BlendEnable = false; pipelineState.BlendState.IndependentBlendEnable = false; } }
public abstract void Process(RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState);
/// <summary> /// Called when a render object is removed. /// </summary> /// <param name="renderObject">The render object.</param> protected virtual void OnRemoveRenderObject(RenderObject renderObject) { }
/// <summary> /// Called when a render object is added. /// </summary> /// <param name="renderObject"></param> protected virtual void OnAddRenderObject(RenderObject renderObject) { }
public override void Process(RenderNodeReference renderNodeReference, ref RenderNode renderNode, RenderObject renderObject, PipelineStateDescription pipelineState) { // Disable culling and depth clip if (renderNode.RenderStage == VoxelRenderStage) { pipelineState.RasterizerState = new RasterizerStateDescription(CullMode.None) { DepthClipEnable = DepthClipping }; } }
/// <summary> /// Implemented by subclasses to reset effect dependent data. /// </summary> protected virtual void InvalidateEffectPermutation(RenderObject renderObject, RenderEffect renderEffect) { }
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); } }