Пример #1
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.CompileInitialize1(datas, "VS", macroEntryVS);
            bool haveGS  = gs0.CompileInitialize1(datas, "GS", macroEntryGS);
            bool haveVS1 = vs1.CompileInitialize1(datas, "VS1", macroEntryVS);
            bool haveGS1 = gs1.CompileInitialize1(datas, "GS1", macroEntryGS);
            bool havePS1 = ps1.CompileInitialize1(datas, "PS1", macroEntryPS);

            bool haveVSParticle = vs2.CompileInitialize1(datas, "VSParticle", macroEntryVS);
            bool haveGSParticle = gs2.CompileInitialize1(datas, "GSParticle", macroEntryGS);
            bool havePSParticle = ps2.CompileInitialize1(datas, "PSParticle", macroEntryPS);


            bool haveCS1 = cs1.CompileInitialize1(datas, "CSParticle", macroEntryCS1);

            if (haveVS || haveGS)
            {
                processingList.UL(new ShaderWarp1()
                {
                    pipelineState = POSkinning, vs = haveVS ? vs0 : RPAssetsManager.VSAssets["VSMMDSkinning2.cso"], gs = haveGS ? gs0 : null, ps = null
                });
            }
            else
            {
                POSkinning.Status = GraphicsObjectStatus.unload;
            }
            if (haveVS1 || haveGS1 || havePS1)
            {
                processingList.UL(new ShaderWarp1()
                {
                    pipelineState = PODraw, vs = haveVS1 ? vs1 : RPAssetsManager.VSMMDTransform, gs = haveGS1 ? gs1 : null, ps = havePS1 ? ps1 : RPAssetsManager.PSMMD
                });
            }
            else
            {
                PODraw.Status = GraphicsObjectStatus.unload;
            }
            if (haveVSParticle || haveGSParticle || havePSParticle)
            {
                processingList.UL(new ShaderWarp1()
                {
                    pipelineState = POParticleDraw, vs = haveVSParticle ? vs2 : RPAssetsManager.VSMMDTransform, gs = haveGSParticle ? gs2 : null, ps = havePSParticle ? ps2 : RPAssetsManager.PSMMD
                });
            }
            else
            {
                POParticleDraw.Status = GraphicsObjectStatus.unload;
            }
            if (haveCS1)
            {
                processingList.UL(CSParticle, 0);
            }
            else
            {
                CSParticle.Status = GraphicsObjectStatus.unload;
            }

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