Esempio n. 1
0
        public void UnloadResources()
        {
            _loadRequestsCDC.Clear();

            if (CurrentScene != null)
            {
                CurrentScene.Dispose();
                CurrentScene = null;
            }

            if (CurrentObject != null)
            {
                CurrentObject.Dispose();
                CurrentObject = null;
            }

            while (Resources.Count > 1)
            {
                RenderResource resource = Resources[Resources.Keys[1]];
                Resources.Remove(Resources.Keys[1]);
                CurrentObject?.UpdateModels();
                CurrentScene?.UpdateModels();
                resource.Dispose();
            }
        }
Esempio n. 2
0
        public void LoadResourceCDC(LoadRequestCDC loadRequest)
        {
            SceneCDC.progressLevel  = 0;
            SceneCDC.progressLevels = 1;
            SceneCDC.ProgressStage  = "Reading Data";

            SRFile srFile = SRFile.Create(loadRequest.DataFile, loadRequest.ObjectListFile, loadRequest.GameType, loadRequest.ExportOptions, loadRequest.ChildIndex);

            if (srFile == null)
            {
                SceneCDC.progressLevel = 1;
                SceneCDC.ProgressStage = "Done";
            }

            RenderResourceCDC renderResource;

            if (Resources.ContainsKey(srFile.Name))
            {
                renderResource = (RenderResourceCDC)Resources[srFile.Name];
                Resources.Remove(srFile.Name);
                CurrentObject?.UpdateModels();
                CurrentScene?.UpdateModels();
                renderResource.Dispose();
            }

            renderResource = new RenderResourceCDC(srFile);
            renderResource.LoadModels(loadRequest.ExportOptions);

            SceneCDC.progressLevel = 1;

            renderResource.LoadTextures(loadRequest.TextureFile, loadRequest.ExportOptions);

            Resources.Add(renderResource.Name, renderResource);

            CurrentObject?.UpdateModels();
            CurrentScene?.UpdateModels();

            SceneCDC.progressLevel = SceneCDC.progressLevels;
            SceneCDC.ProgressStage = "Done";

            loadRequest.ResourceName = srFile.Name;
        }
Esempio n. 3
0
        public void UnloadResource(string resourceName)
        {
            if (resourceName != "" && Resources.ContainsKey(resourceName))
            {
                RenderResource renderResource = Resources[resourceName];
                Resources.Remove(resourceName);
                CurrentObject?.UpdateModels();
                CurrentScene?.UpdateModels();
                renderResource.Dispose();

                if (CurrentScene != null && CurrentScene.Name == resourceName)
                {
                    CurrentScene.Dispose();
                    CurrentScene = null;
                }

                if (CurrentObject != null && CurrentObject.Name == resourceName)
                {
                    CurrentObject.Dispose();
                    CurrentObject = null;
                }
            }
        }