示例#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);
    }
    public void SyncWithModel()
    {
        SyncMaterialSet();

        if (model.Shape != currentShape)
        {
            var newShapeNormals = shapeNormalsLoader.Load(definition.Directory, model.Shape);
            shapeNormals?.Dispose();

            shapeNormals = newShapeNormals;
            currentShape = model.Shape;
        }

        var childControlVertexProviders = children
                                          .Select(child => child.controlVertexProvider)
                                          .ToList();

        controlVertexProvider.SyncWithModel(model, childControlVertexProviders);
    }