예제 #1
0
    public void Update(DeviceContext context, ImageBasedLightingEnvironment lightingEnvironment, ShaderResourceView controlVertexInfosView, ShapeNormals shapeNormals)
    {
        if (this.shapeNormals != shapeNormals || texturedVertexInfoPairsView == null)
        {
            this.shapeNormals = shapeNormals;

            texturedVertexInfoPairsView?.Dispose();
            var pairs = TexturedVertexInfoPair.Interleave(primaryTexturedVertexInfos, shapeNormals?.TexturedVertexInfos);
            texturedVertexInfoPairsView = BufferUtilities.ToStructuredBufferView(device, pairs);
        }

        scatterer?.Scatter(context, lightingEnvironment, controlVertexInfosView);
        vertexRefiner.RefineVertices(context, controlVertexInfosView, scatterer?.ScatteredIlluminationView);
    }
예제 #2
0
    public FigureRenderer(
        Device device, ShaderCache shaderCache, Scatterer scatterer, VertexRefiner vertexRefiner, MaterialSet materialSet, FigureSurface[] surfaces,
        bool isOneSided, int[] surfaceOrder, bool[] areUnorderedTranparent, TexturedVertexInfo[] texturedVertexInfos)
    {
        this.device        = device;
        this.scatterer     = scatterer;
        this.vertexRefiner = vertexRefiner;
        this.materialSet   = materialSet;
        this.surfaces      = surfaces;

        this.isOneSided              = isOneSided;
        this.surfaceOrder            = surfaceOrder;
        this.areUnorderedTransparent = areUnorderedTranparent;

        var vertexShaderAndBytecode = shaderCache.GetVertexShader <FigureRenderer>("figure/rendering/Figure");

        this.vertexShader      = vertexShaderAndBytecode;
        this.inputLayout       = new InputLayout(device, vertexShaderAndBytecode.Bytecode, vertexRefiner.RefinedVertexBufferInputElements);
        falseDepthVertexShader = shaderCache.GetVertexShader <FigureRenderer>("figure/rendering/Figure-FalseDepth");

        primaryTexturedVertexInfos  = texturedVertexInfos;
        texturedVertexInfoPairsView = BufferUtilities.ToStructuredBufferView(device, TexturedVertexInfoPair.Interleave(primaryTexturedVertexInfos, null));
    }