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; }
public SceneCDC(SRFile srFile, bool includeObjects) : base(includeObjects) { Name = srFile.Name; for (int m = 0; m < srFile.ModelCount; m++) { RenderInstance instance = new RenderInstance(srFile.Name, m, new SlimDX.Vector3(), new SlimDX.Vector3()); instance.Name = srFile.Models[m].Name + "-" + m.ToString(); _renderInstances.Add(instance); } if (includeObjects && srFile.Asset == CDC.Asset.Unit && srFile.IntroCount > 0) { foreach (CDC.Intro intro in srFile.Intros) { SlimDX.Vector3 position = new SlimDX.Vector3( 0.01f * intro.position.x, 0.01f * intro.position.z, 0.01f * intro.position.y ); // May be different for games besides SR1. Need to check. SlimDX.Vector3 rotation = new SlimDX.Vector3( -intro.rotation.z, // Yaw - Easy to spot from direction of raziel, enemies, flagall. -intro.rotation.y, // Pitch - Can be seen from the angle of hndtrch in huba6. -intro.rotation.x // Roll - Can be seen from the angle of stdorac in oracle3. ); RenderInstance instance = new RenderInstance(intro.fileName, intro.modelIndex, position, rotation); instance.Name = intro.name; _renderInstances.Add(instance); } } }
public RenderResourceCDC(SRFile srFile) : base(srFile.Name) { File = srFile; }
public SRModelParser(string objectName, SRFile srFile) { _objectName = objectName; _srFile = srFile; }