Ejemplo n.º 1
0
    public ControlVertexProvider(Device device, ShaderCache shaderCache,
                                 OccluderLoader occluderLoader,
                                 FigureDefinition definition,
                                 ShaperParameters shaperParameters)
    {
        this.occluderLoader = occluderLoader;
        this.definition     = definition;
        this.shaper         = new GpuShaper(device, shaderCache, definition, shaperParameters);
        this.vertexCount    = shaperParameters.InitialPositions.Length;

        controlVertexInfosBufferManager = new InOutStructuredBufferManager <ControlVertexInfo>(device, vertexCount);
        if (definition.ChannelSystem.Parent == null)
        {
            this.controlVertexInfoStagingBufferManager = new StagingStructuredBufferManager <ControlVertexInfo>(device, vertexCount, BackingArrayCount);
        }
    }
Ejemplo n.º 2
0
    public GpuShaper(Device device, ShaderCache shaderCache, FigureDefinition definition, ShaperParameters parameters)
    {
        this.device              = device;
        this.withDeltasShader    = shaderCache.GetComputeShader <GpuShaper>("figure/shaping/shader/Shaper-WithDeltas");
        this.withoutDeltasShader = shaderCache.GetComputeShader <GpuShaper>("figure/shaping/shader/Shaper-WithoutDeltas");

        this.vertexCount         = parameters.InitialPositions.Length;
        this.morphChannelIndices = parameters.MorphChannelIndices;
        this.boneIndices         = parameters.BoneIndices;
        this.occlusionSurrogates = OcclusionSurrogate.MakeAll(definition, parameters.OcclusionSurrogateParameters);

        this.initialPositionsView      = BufferUtilities.ToStructuredBufferView(device, parameters.InitialPositions);
        this.deltaSegmentsView         = BufferUtilities.ToStructuredBufferView(device, parameters.MorphDeltas.Segments);
        this.deltaElemsView            = BufferUtilities.ToStructuredBufferView(device, parameters.MorphDeltas.Elems);
        this.morphWeightsBufferManager = new StructuredBufferManager <float>(device, parameters.MorphCount);

        if (parameters.BaseDeltaWeights != null)
        {
            this.baseDeltaWeightSegmentsView = BufferUtilities.ToStructuredBufferView(device, parameters.BaseDeltaWeights.Segments);
            this.baseDeltaWeightElemsView    = BufferUtilities.ToStructuredBufferView(device, parameters.BaseDeltaWeights.Elems);
        }
        else
        {
            this.baseDeltaWeightSegmentsView = null;
            this.baseDeltaWeightElemsView    = null;
        }

        this.boneWeightSegmentsView      = BufferUtilities.ToStructuredBufferView(device, parameters.BoneWeights.Segments);
        this.boneWeightElemsView         = BufferUtilities.ToStructuredBufferView(device, parameters.BoneWeights.Elems);
        this.boneTransformsBufferManager = new StructuredBufferManager <StagedSkinningTransform>(device, parameters.BoneCount);

        this.occlusionSurrogateMapView            = BufferUtilities.ToStructuredBufferView(device, parameters.OcclusionSurrogateMap);
        this.occlusionSurrogateFacesView          = BufferUtilities.ToStructuredBufferView(device, OcclusionSurrogateCommon.Mesh.Faces.ToArray());
        this.occlusionSurrogateInfosBufferManager = new StructuredBufferManager <OcclusionSurrogate.Info>(device, parameters.OcclusionSurrogateParameters.Length);
    }