示例#1
0
        public static List <Texture2D> GetTextureList(ProcessingList processingList, MainCaches mainCaches, StorageFolder storageFolder, PMXFormat pmx)
        {
            List <Texture2D> textures      = new List <Texture2D>();
            List <string>    paths         = new List <string>();
            List <string>    relativePaths = new List <string>();

            foreach (var vTex in pmx.Textures)
            {
                string relativePath = vTex.TexturePath.Replace("//", "\\").Replace('/', '\\');
                string texPath      = Path.Combine(storageFolder.Path, relativePath);
                paths.Add(texPath);
                relativePaths.Add(relativePath);
            }
            lock (mainCaches.TextureCaches)
            {
                for (int i = 0; i < pmx.Textures.Count; i++)
                {
                    Texture2DPack tex = mainCaches.TextureCaches.GetOrCreate(paths[i]);
                    if (tex.Status != GraphicsObjectStatus.loaded)
                    {
                        tex.Mark(GraphicsObjectStatus.loading);
                    }
                    tex.relativePath = relativePaths[i];
                    tex.folder       = storageFolder;

                    textures.Add(tex.texture2D);
                }
            }
            return(textures);
        }
示例#2
0
        public ActionResult UserQueue(string userName)
        {
            var userQueue = db.Processing.Include(p => p.Record).Include(p => p.Record.StudentFile)
                            .Where(p => p.Username == userName && p.ProcUserComplete == null).ToList();
            ProcessingList pl = new ProcessingList();
            var            vm = pl.Setup(userQueue);

            return(View("../ProcessingList/Index", vm));
        }
 internal static void Reset()
 {
     TotalCount.Clear();
     TotalLatency.Clear();
     CurrentHourList.Clear();
     CurrentMinuteList.Clear();
     ZQueue.Clear();
     ProcessingList.Clear();
     TotalEndedCount.Clear();
     TotalErrorCount.Clear();
 }
示例#4
0
        public static void Reload2(this MMD3DEntity entity, ProcessingList processingList, ModelPack modelPack, List <Texture2D> textures, string ModelPath)
        {
            var modelResource = modelPack.pmx;

            entity.Name        = string.Format("{0} {1}", modelResource.Name, modelResource.NameEN);
            entity.Description = string.Format("{0}\n{1}", modelResource.Description, modelResource.DescriptionEN);
            entity.ModelPath   = ModelPath;
            entity.motionComponent.ReloadEmpty();

            ReloadModel(entity, processingList, modelPack, textures);
        }
示例#5
0
        public static void ReloadModel(this MMD3DEntity entity, ProcessingList processingList, ModelPack modelPack, List <Texture2D> textures)
        {
            entity.ComponentReady = false;
            var modelResource = modelPack.pmx;

            entity.morphStateComponent.Reload(modelResource);
            entity.boneComponent.Reload(modelResource);

            entity.rendererComponent.Reload(modelPack);
            processingList.AddObject(new MeshAppendUploadPack(entity.rendererComponent.meshAppend, entity.rendererComponent.meshPosData));
            //processingList.AddObject(entity.rendererComponent.meshParticleBuffer);
            entity.rendererComponent.textures = textures;

            entity.ComponentReady = true;
        }
        public virtual void ProcessElement(fo.DicomItem element)
        {
            for (int index = ProcessingList.Count - 1; index >= 0; index--)
            {
                IDicomDataParameter currentCondition = ProcessingList[index];


                if (currentCondition.IsSupported(element))
                {
                    currentCondition.SetElement(element);

                    if (!currentCondition.AllowExtraElement)
                    {
                        ProcessingList.RemoveAt(index);
                    }

                    return;
                }
            }

            foreach (var condition in ParametersTemplate)
            {
                if (condition.IsSupported(element))
                {
                    IDicomDataParameter dedicatedCondition = condition.CreateParameter( );


                    dedicatedCondition.SetElement(element);

                    InternalResult.Add((T)dedicatedCondition);

                    if (dedicatedCondition.AllowExtraElement)
                    {
                        ProcessingList.Add(dedicatedCondition);
                    }

                    return;
                }
            }
        }
示例#7
0
        public static void ReloadModels(Scene scene, MainCaches mainCaches, ProcessingList processingList, GameDriverContext gameDriverContext)
        {
            if (mainCaches.modelTaskLocker.GetLocker())
            {
                Task.Run(async() =>
                {
                    List <ModelPack> packs = new List <ModelPack>();
                    lock (mainCaches.ModelPackCaches)
                        foreach (var modelPack in mainCaches.ModelPackCaches.Values)
                        {
                            if (modelPack.Status == GraphicsObjectStatus.loaded || modelPack.Status == GraphicsObjectStatus.error)
                            {
                                packs.Add(modelPack);
                            }
                        }

                    List <ModelPack> updatePacks = new List <ModelPack>();
                    for (int i = 0; i < packs.Count; i++)
                    {
                        var pack = packs[i];
                        if (pack.LoadTask == null)
                        {
                            try
                            {
                                var file = await pack.folder.GetFileAsync(pack.relativePath);
                                var attr = await file.GetBasicPropertiesAsync();
                                if (attr.DateModified != pack.lastModifiedTime)
                                {
                                    updatePacks.Add(pack);
                                    pack.lastModifiedTime = attr.DateModified;
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                    List <ModelPack> newPacks = new List <ModelPack>();
                    for (int i = 0; i < updatePacks.Count; i++)
                    {
                        var file       = await updatePacks[i].folder.GetFileAsync(updatePacks[i].relativePath);
                        ModelPack pack = new ModelPack();
                        pack.LoadTask  = LoadPMX(file, updatePacks[i].folder, pack, processingList);
                        newPacks.Add(pack);
                    }
                    for (int i = 0; i < newPacks.Count; i++)
                    {
                        var pack = newPacks[i];
                        void fun1()
                        {
                            lock (mainCaches.ModelPackCaches)
                            {
                                mainCaches.ModelPackCaches[pack.fullPath] = pack;
                            }
                            for (int j = 0; j < scene.Entities.Count; j++)
                            {
                                if (scene.Entities[j].ModelPath == pack.fullPath)
                                {
                                    scene.Entities[j].ReloadModel(processingList, pack, GetTextureList(processingList, mainCaches, pack.folder, pack.pmx));
                                    scene.EntityRefreshList.Add(scene.Entities[j]);
                                    gameDriverContext.RequireResetPhysics = true;
                                    gameDriverContext.RequireRender(true);

                                    mainCaches.ReloadTextures(processingList, gameDriverContext.RequireRender);
                                }
                            }
                        }
                        if (pack.LoadTask == null && pack.Status == GraphicsObjectStatus.loaded)
                        {
                            fun1();
                        }
                        else
                        {
                            try
                            {
                                pack.LoadTask.Wait();
                                fun1();
                            }
                            catch
                            {
                            }
                        }
                    }
                    mainCaches.modelTaskLocker.FreeLocker();
                }).Wait();
            }
        }
示例#8
0
        static async Task LoadPMX(StorageFile file, StorageFolder folder, ModelPack pack, ProcessingList processingList)
        {
            string       path   = file.Path;
            BinaryReader reader = new BinaryReader((await file.OpenReadAsync()).AsStreamForRead());

            pack.Reload2(reader);
            pack.fullPath     = path;
            pack.folder       = folder;
            pack.relativePath = file.Name;
            reader.Dispose();
            processingList.AddObject(pack.GetMesh());
            pack.Status = GraphicsObjectStatus.loaded;

            pack.LoadTask = null;
        }
示例#9
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);
        }
示例#10
0
        public async Task <bool> Reload1(StorageFolder folder, string relativePath, RPAssetsManager RPAssetsManager, ProcessingList processingList)
        {
            this.relativePath = relativePath;
            this.folder       = folder;
            Mark(GraphicsObjectStatus.loading);
            IStorageItem storageItem = await folder.TryGetItemAsync(relativePath);

            try
            {
                var attr = await storageItem.GetBasicPropertiesAsync();

                lastModifiedTime = attr.DateModified;
            }
            catch
            {
                Mark(GraphicsObjectStatus.error);
                return(false);
            }
            return(await Reload(storageItem, RPAssetsManager, processingList));
        }
示例#11
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);
        }