Beispiel #1
0
        public void ChangeRenderTargetFormat(DeviceResources deviceResources, ProcessingList uploadProcess, DxgiFormat outputFormat, DxgiFormat middleFormat, DxgiFormat swapChainFormat, DxgiFormat depthFormat)
        {
            Ready             = false;
            this.outputFormat = outputFormat;
            this.middleFormat = middleFormat;
            this.depthFormat  = depthFormat;

            PObjectMMDSkinning.ReloadSkinning(VSMMDSkinning2, null);
            uploadProcess.UL(PObjectMMDSkinning, 1);

            PObjectMMD.ReloadDrawing(BlendState.alpha, VSMMDTransform, null, PSMMD, outputFormat, depthFormat);
            PObjectMMDTransparent.ReloadDrawing(BlendState.alpha, VSMMDTransform, null, PSMMDTransparent, outputFormat, depthFormat);
            PObjectMMD_DisneyBrdf.ReloadDrawing(BlendState.alpha, VSMMDTransform, null, PSMMD_DisneyBrdf, outputFormat, depthFormat);
            PObjectMMD_Toon1.ReloadDrawing(BlendState.alpha, VSMMDTransform, null, PSMMD_Toon1, outputFormat, depthFormat);
            PObjectMMDLoading.ReloadDrawing(BlendState.alpha, VSMMDTransform, null, PSMMDLoading, outputFormat, depthFormat);
            PObjectMMDError.ReloadDrawing(BlendState.alpha, VSMMDTransform, null, PSMMDError, outputFormat, depthFormat);
            uploadProcess.UL(PObjectMMD, 0);
            uploadProcess.UL(PObjectMMDTransparent, 0);
            uploadProcess.UL(PObjectMMD_DisneyBrdf, 0);
            uploadProcess.UL(PObjectMMD_Toon1, 0);
            uploadProcess.UL(PObjectMMDLoading, 0);
            uploadProcess.UL(PObjectMMDError, 0);

            PObjectDeferredRenderGBuffer.ReloadDrawing(BlendState.none, VSMMDTransform, null, PSDeferredRenderGBuffer, middleFormat, depthFormat, 3);
            PObjectDeferredRenderIBL.ReloadDrawing(BlendState.add, VSSkyBox, null, PSDeferredRenderIBL, outputFormat, DxgiFormat.DXGI_FORMAT_UNKNOWN);
            PObjectDeferredRenderDirectLight.ReloadDrawing(BlendState.add, VSSkyBox, null, PSDeferredRenderDirectLight, outputFormat, DxgiFormat.DXGI_FORMAT_UNKNOWN);
            PObjectDeferredRenderPointLight.ReloadDrawing(BlendState.add, VSDeferredRenderPointLight, null, PSDeferredRenderPointLight, outputFormat, DxgiFormat.DXGI_FORMAT_UNKNOWN);
            uploadProcess.UL(PObjectDeferredRenderGBuffer, 0);
            uploadProcess.UL(PObjectDeferredRenderIBL, 0);
            uploadProcess.UL(PObjectDeferredRenderDirectLight, 0);
            uploadProcess.UL(PObjectDeferredRenderPointLight, 0);

            //PObjectMMDShadowDepth.ReloadDepthOnly(VSMMDTransform, PSMMDAlphaClip, 2500);
            PObjectMMDShadowDepth.ReloadDepthOnly(VSMMDTransform, null, 2500, depthFormat);
            PObjectMMDDepth.ReloadDepthOnly(VSMMDTransform, PSMMDAlphaClip1, 0, depthFormat);
            uploadProcess.UL(PObjectMMDShadowDepth, 0);
            uploadProcess.UL(PObjectMMDDepth, 0);


            PObjectSkyBox.Reload(deviceResources, rootSignature, eInputLayout.postProcess, BlendState.none, VSSkyBox, null, PSSkyBox, outputFormat, DxgiFormat.DXGI_FORMAT_UNKNOWN);
            PObjectPostProcess.Reload(deviceResources, rootSignaturePostProcess, eInputLayout.postProcess, BlendState.none, VSPostProcess, null, PSPostProcess, swapChainFormat, DxgiFormat.DXGI_FORMAT_UNKNOWN);
            PObjectWidgetUI1.Reload(deviceResources, rootSignaturePostProcess, eInputLayout.postProcess, BlendState.alpha, VSWidgetUI1, null, PSWidgetUI1, swapChainFormat, DxgiFormat.DXGI_FORMAT_UNKNOWN);
            PObjectWidgetUI2.Reload(deviceResources, rootSignaturePostProcess, eInputLayout.postProcess, BlendState.alpha, VSWidgetUI2, null, PSWidgetUI2, swapChainFormat, DxgiFormat.DXGI_FORMAT_UNKNOWN);
            PObjectWidgetUILight.Reload(deviceResources, rootSignaturePostProcess, eInputLayout.postProcess, BlendState.alpha, VSWidgetUILight, null, PSWidgetUILight, swapChainFormat, DxgiFormat.DXGI_FORMAT_UNKNOWN, D3D12PrimitiveTopologyType.LINE);
            Ready = true;
        }
Beispiel #2
0
        public async Task <bool> Reload(IStorageItem storageItem, RPAssetsManager RPAssetsManager, ProcessingList processingList)
        {
            Mark(GraphicsObjectStatus.loading);

            if (!(storageItem is StorageFile file))
            {
                Mark(GraphicsObjectStatus.error);
                return(false);
            }
            Windows.Storage.Streams.IBuffer datas;
            try
            {
                datas = await FileIO.ReadBufferAsync(file);
            }
            catch
            {
                Mark(GraphicsObjectStatus.error);
                return(false);
            }
            VertexShader   vs0 = VS;
            GeometryShader gs0 = GS;
            VertexShader   vs1 = VS1;
            GeometryShader gs1 = GS1;
            PixelShader    ps1 = PS1;

            VertexShader   vs2 = VSParticle;
            GeometryShader gs2 = GSParticle;
            PixelShader    ps2 = PSParticle;
            ComputePO      cs1 = CSParticle;


            bool haveVS  = vs0.CompileReload1(datas, "VS", ShaderMacro.DEFINE_COO_SURFACE);
            bool haveGS  = gs0.CompileReload1(datas, "GS", ShaderMacro.DEFINE_COO_SURFACE);
            bool haveVS1 = vs1.CompileReload1(datas, "VS1", ShaderMacro.DEFINE_COO_SURFACE);
            bool haveGS1 = gs1.CompileReload1(datas, "GS1", ShaderMacro.DEFINE_COO_SURFACE);
            bool havePS1 = ps1.CompileReload1(datas, "PS1", ShaderMacro.DEFINE_COO_SURFACE);

            bool haveVSParticle = vs2.CompileReload1(datas, "VSParticle", ShaderMacro.DEFINE_COO_SURFACE);
            bool haveGSParticle = gs2.CompileReload1(datas, "GSParticle", ShaderMacro.DEFINE_COO_SURFACE);
            bool havePSParticle = ps2.CompileReload1(datas, "PSParticle", ShaderMacro.DEFINE_COO_SURFACE);


            bool haveCS1 = cs1.CompileReload1(datas, "CSParticle", ShaderMacro.DEFINE_COO_PARTICLE);

            if (haveVS || haveGS)
            {
                POSkinning.ReloadSkinning(
                    haveVS ? vs0 : RPAssetsManager.VSMMDSkinning2,
                    haveGS ? gs0 : null);
                processingList.UL(POSkinning, 1);
            }
            else
            {
                POSkinning.Status = GraphicsObjectStatus.unload;
            }
            if (haveVS1 || haveGS1 || havePS1)
            {
                PODraw.ReloadDrawing(BlendState.alpha,
                                     haveVS1 ? vs1 : RPAssetsManager.VSMMDTransform,
                                     haveGS1 ? gs1 : null,
                                     havePS1 ? ps1 : RPAssetsManager.PSMMD, RPAssetsManager.outputFormat, RPAssetsManager.depthFormat);
                processingList.UL(PODraw, 0);
            }
            else
            {
                PODraw.Status = GraphicsObjectStatus.unload;
            }
            if (haveVSParticle || haveGSParticle || havePSParticle)
            {
                POParticleDraw.ReloadDrawing(BlendState.alpha,
                                             haveVSParticle ? vs2 : RPAssetsManager.VSMMDTransform,
                                             haveGSParticle ? gs2 : null,
                                             havePSParticle ? ps2 : RPAssetsManager.PSMMD, RPAssetsManager.outputFormat, RPAssetsManager.depthFormat);
                processingList.UL(POParticleDraw, 0);
            }
            else
            {
                POParticleDraw.Status = GraphicsObjectStatus.unload;
            }
            if (haveCS1)
            {
                processingList.UL(CSParticle, 0);
            }
            else
            {
                CSParticle.Status = GraphicsObjectStatus.unload;
            }

            Status = GraphicsObjectStatus.loaded;
            return(true);
        }