Пример #1
0
 public void ExportResourceCDC(string resourceName, string filename, ExportOptions options)
 {
     if (resourceName != "" && Resources.ContainsKey(resourceName))
     {
         RenderResourceCDC renderResource = (RenderResourceCDC)Resources[resourceName];
         renderResource.ExportToFile(filename, options);
     }
 }
Пример #2
0
        public void SetCurrentObject(string objectName)
        {
            if (CurrentObject != null)
            {
                CurrentObject = null;
            }

            if (objectName != "" && Resources.ContainsKey(objectName))
            {
                RenderResourceCDC renderResource = (RenderResourceCDC)Resources[objectName];
                CurrentObject = new SceneCDC(renderResource.File, false);
            }
        }
Пример #3
0
        public void SetCurrentScene(string sceneName)
        {
            if (CurrentScene != null)
            {
                CurrentScene.Dispose();
                CurrentScene = null;
            }

            if (sceneName != "" && Resources.ContainsKey(sceneName))
            {
                RenderResourceCDC renderResource = (RenderResourceCDC)Resources[sceneName];
                CurrentScene = new SceneCDC(renderResource.File, true);
            }
        }
Пример #4
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;
        }