public void LoadModel(uint id) { TextureCache.Init(); // can be either a gfxobj or setup id // if gfxobj, create a simple setup MainWindow.Status.WriteLine($"Loading {id:X8}"); GfxObjMode = id >> 24 == 0x01; Setup = new SetupInstance(id); InitObject(id); Camera.InitModel(Setup.Setup.BoundingBox); ModelType = ModelType.Setup; }
/// <summary> /// Load a model with a ClothingTable /// </summary> public void LoadModel(uint setupID, ClothingTable clothingBase, PaletteTemplate paletteTemplate, float shade) { TextureCache.Init(); // assumed to be in Setup mode for ClothingBase GfxObjMode = false; // create the ObjDesc, describing any changes to palettes / textures / gfxobj parts var objDesc = new Model.ObjDesc(setupID, clothingBase.Id, paletteTemplate, shade); Setup = new SetupInstance(setupID, objDesc); if (ViewObject == null || ViewObject.PhysicsObj.PartArray.Setup._dat.Id != setupID) { InitObject(setupID); Camera.InitModel(Setup.Setup.BoundingBox); } ModelType = ModelType.Setup; MainWindow.Status.WriteLine($"Loading {setupID:X8} with ClothingBase {clothingBase.Id:X8}, PaletteTemplate {paletteTemplate}, and Shade {shade}"); }
private static string GetVisualStudioInstanceId() { SetupInstance instance = SetupEnvironment.GetSetupInstance(); return(instance.InstanceId); }
private static string GetVisualStudioInstallationFolder() { SetupInstance instance = SetupEnvironment.GetSetupInstance(); return(instance.InstallationPath); }
public R_PhysicsObj(PhysicsObj obj) { PhysicsObj = obj; PartArray = new R_PartArray(obj.PartArray); Setup = new SetupInstance(this); }
public void LoadModel(uint id, ClothingTable clothingBase, uint palTemplate, float shade) { TextureCache.Init(); // can be either a gfxobj or setup id // if gfxobj, create a simple setup GfxObjMode = false; // create the objDesc, describing the "Changed" items to the base setup. // We won't bother loading the palette stuff, we'll just create that dictionary directly FileTypes.ObjDesc objDesc = new FileTypes.ObjDesc(); var cbe = clothingBase.ClothingBaseEffects[id].CloObjectEffects; foreach (var objEffect in cbe) { ACE.DatLoader.Entity.AnimationPartChange apChange = new ACE.DatLoader.Entity.AnimationPartChange(); apChange.PartID = objEffect.ModelId; apChange.PartIndex = (byte)objEffect.Index; objDesc.AnimPartChanges.Add(apChange.PartIndex, apChange); foreach (var texEffect in objEffect.CloTextureEffects) { ACE.DatLoader.Entity.TextureMapChange tmChange = new ACE.DatLoader.Entity.TextureMapChange(); tmChange.PartIndex = apChange.PartIndex; tmChange.OldTexture = texEffect.OldTexture; tmChange.NewTexture = texEffect.NewTexture; if (!objDesc.TextureChanges.TryGetValue(tmChange.PartIndex, out var tmChanges)) { tmChanges = new List <ACE.DatLoader.Entity.TextureMapChange>(); objDesc.TextureChanges.Add(tmChange.PartIndex, tmChanges); } tmChanges.Add(tmChange); } } // To hold our Custom Palette (palette swaps) Dictionary <int, uint> customPaletteColors = new Dictionary <int, uint>(); // Load all the custom palette colors... var subPalEffect = clothingBase.ClothingSubPalEffects[palTemplate]; foreach (var subPals in subPalEffect.CloSubPalettes) { var palSet = DatManager.PortalDat.ReadFromDat <PaletteSet>(subPals.PaletteSet); uint palId = palSet.GetPaletteID(shade); // Load our palette dictated by the shade in the palset var palette = DatManager.PortalDat.ReadFromDat <Palette>(palId); foreach (var range in subPals.Ranges) { int offset = (int)(range.Offset); int numColors = (int)(range.NumColors); // add the appropriate colors to our custom palette for (int i = 0; i < numColors; i++) { customPaletteColors.Add(i + offset, palette.Colors[i + offset]); } } } Setup = new SetupInstance(id, objDesc, customPaletteColors); if (ViewObject == null || ViewObject.PhysicsObj.PartArray.Setup._dat.Id != id) { InitObject(id); Render.Camera.InitModel(Setup.Setup.BoundingBox); } else { ViewObject.PhysicsObj.destroy_particle_manager(); } ModelType = ModelType.Setup; MainWindow.Status.WriteLine($"Loading {id:X8} with ClothingBase {clothingBase.Id:X8}, PaletteTemplate {palTemplate}, and Shade {shade}"); }