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


C# DX11RenderSettings.PostShaderAction方法代码示例

本文整理汇总了C#中DX11RenderSettings.PostShaderAction方法的典型用法代码示例。如果您正苦于以下问题:C# DX11RenderSettings.PostShaderAction方法的具体用法?C# DX11RenderSettings.PostShaderAction怎么用?C# DX11RenderSettings.PostShaderAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DX11RenderSettings的用法示例。


在下文中一共展示了DX11RenderSettings.PostShaderAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render


//.........这里部分代码省略.........
                    int drawCount = doOrder ? orderedSlices.Count : this.spmax;

                    if (this.spmax == 0)
                    {
                        drawCount = 0;
                    }

                    for (int i = 0; i < drawCount; i++)
                    {
                        int idx = doOrder ? orderedSlices[i] : i;
                        if (multistate)
                        {
                            context.RenderStateStack.Push(this.FInState[idx]);

                        }

                        if (shaderdata.IsLayoutValid(idx) || settings.Geometry != null)
                        {
                            objectsettings.IterationCount = this.FIter[idx];
                            objectsettings.RenderStateTag = this.FInState[idx] != null ? this.FInState[idx].Tag : null;

                            for (int k = 0; k < objectsettings.IterationCount; k++)
                            {
                                objectsettings.IterationIndex = k;
                                if (settings.Geometry == null)
                                {
                                    if (this.FGeometry[idx] != pg)
                                    {
                                        pg = this.FGeometry[idx];

                                        objectsettings.Geometry = pg[context];

                                        shaderdata.SetInputAssembler(ctx, objectsettings.Geometry, idx);
                                    }
                                }
                                else
                                {
                                    objectsettings.Geometry = settings.Geometry;
                                    shaderdata.SetInputAssembler(ctx, objectsettings.Geometry, idx);
                                }

                                //Prepare settings
                                objectsettings.DrawCallIndex = idx;
                                objectsettings.WorldTransform = this.mworld[idx % this.mworldcount];

                                if (settings.ValidateObject(objectsettings))
                                {
                                    this.varmanager.ApplyPerObject(context, shaderdata.ShaderInstance, this.objectsettings, idx);

                                    for (int ip = 0; ip < shaderdata.PassCount;ip++)
                                    {
                                        shaderdata.ApplyPass(ctx, ip);

                                        if (settings.DepthOnly) { ctx.PixelShader.Set(null); }

                                        if (settings.PostPassAction != null) { settings.PostPassAction(context); }

                                        objectsettings.Geometry.Draw();
                                        shaderdata.ShaderInstance.CleanUp();
                                    }
                                }
                            }
                        }

                        if (multistate)
                        {
                            context.RenderStateStack.Pop();
                        }

                        if (settings.PostShaderAction != null)
                        {
                            settings.PostShaderAction(context);
                        }
                    }

                    if (pipelineState != null)
                    {
                        pipelineState.Restore(context);
                    }

                    this.OnEndQuery(context);
                }
                //this.query.End();
            }

            if (popstate)
            {
                context.RenderStateStack.Pop();
            }
            else
            {
                //Since shaders can define their own states, reapply top of the stack
                context.RenderStateStack.Apply();
            }

            if (this.FInLayer.IsConnected && this.FInEnabled[0])
            {
                this.FInLayer[0][context].Render(this.FInLayer.PluginIO, context, settings);
            }
        }
开发者ID:sebllll,项目名称:dx11-vvvv,代码行数:101,代码来源:DX11ShaderNode.cs

示例2: Render


//.........这里部分代码省略.........
                        context.RenderStateStack.Push(this.FInState[0]);
                        popstate = true;
                    }

                    if (!settings.PreserveShaderStages)
                    {
                        shaderdata.ResetShaderStages(ctx);
                    }

                    settings.DrawCallCount = spmax; //Set number of draw calls

                    this.varmanager.ApplyGlobal(shaderdata.ShaderInstance);

                    //IDX11Geometry drawgeom = null;
                    objectsettings.Geometry = null;
                    DX11Resource<IDX11Geometry> pg = null;

                    for (int i = 0; i < this.spmax; i++)
                    {
                        if (multistate)
                        {
                            context.RenderStateStack.Push(this.FInState[i]);
                        }

                        if (shaderdata.IsLayoutValid(i) || settings.Geometry != null)
                        {
                            objectsettings.IterationCount = this.FIter[i];

                            for (int k = 0; k < objectsettings.IterationCount; k++)
                            {
                                objectsettings.IterationIndex = k;
                                if (settings.Geometry == null)
                                {
                                    if (this.FGeometry[i] != pg)
                                    {
                                        pg = this.FGeometry[i];

                                        objectsettings.Geometry = pg[context];

                                        shaderdata.SetInputAssembler(ctx, objectsettings.Geometry, i);
                                    }
                                }
                                else
                                {
                                    objectsettings.Geometry = settings.Geometry;
                                    shaderdata.SetInputAssembler(ctx, objectsettings.Geometry, i);
                                }

                                //Prepare settings
                                objectsettings.DrawCallIndex = i;
                                objectsettings.WorldTransform = this.mworld[i % this.mworldcount];

                                if (settings.ValidateObject(objectsettings))
                                {
                                    this.varmanager.ApplyPerObject(context, shaderdata.ShaderInstance, this.objectsettings, i);

                                    shaderdata.ApplyPass(ctx);

                                    if (settings.DepthOnly) { ctx.PixelShader.Set(null); }

                                    if (settings.PostPassAction != null) { settings.PostPassAction(context); }

                                    objectsettings.Geometry.Draw();
                                    shaderdata.ShaderInstance.CleanUp();
                                }
                            }
                        }

                        if (multistate)
                        {
                            context.RenderStateStack.Pop();
                        }

                        if (settings.PostShaderAction != null)
                        {
                            settings.PostShaderAction(context);
                        }
                    }

                    this.OnEndQuery(context);

                }
                //this.query.End();
            }

            if (popstate)
            {
                context.RenderStateStack.Pop();
            }
            else
            {
                //Since shaders can define their own states, reapply top of the stack
                context.RenderStateStack.Apply();
            }

            if (this.FInLayer.PluginIO.IsConnected && this.FInEnabled[0])
            {
                this.FInLayer[0][context].Render(this.FInLayer.PluginIO, context, settings);
            }
        }
开发者ID:sunep,项目名称:dx11-vvvv,代码行数:101,代码来源:DX11ShaderNode.cs


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