public static Outfit GetOutfit(ulong id) { if (Outfits.ContainsKey(id)) { return Outfits[id]; } var bytes = ContentManager.GetResourceFromLongID(id); var outfit = new Outfit(bytes); Outfits.Add(id, outfit); return outfit; }
void RefreshSim() { var selectedHead = (CollectionItem)((UIGridViewerItem)HeadSkinBrowser.SelectedItem).Data; Outfit TmpOutfit = new Outfit(ContentManager.GetResourceFromLongID( selectedHead.PurchasableOutfit.OutfitID)); SimCatalog.LoadSim3D(Sim, TmpOutfit, AppearanceType); SimBox.Sim = Sim; }
private List<object> CollectionToDataProvider(Collection collection) { var dataProvider = new List<object>(); foreach (var outfit in collection) { Outfit TmpOutfit = new Outfit(ContentManager.GetResourceFromLongID( outfit.PurchasableOutfit.OutfitID)); Appearance TmpAppearance = new Appearance(ContentManager.GetResourceFromLongID( TmpOutfit.GetAppearance(AppearanceType))); ulong thumbID = TmpAppearance.ThumbnailID; dataProvider.Add(new UIGridViewerItem { Data = outfit, Thumb = new TSOClient.Code.Utils.Promise<Texture2D>(x => GetTexture(thumbID)) }); } return dataProvider; }
/// <summary> /// Loads a head mesh. /// </summary> /// <param name="MeshID">The ID of the mesh to load.</param> /// <param name="TexID">The ID of the texture to load.</param> public void LoadHeadMesh(Sim Character, Outfit Outf, int SkinColor) { Appearance Apr; switch (SkinColor) { case 0: Apr = new Appearance(ContentManager.GetResourceFromLongID(Outf.LightAppearanceID)); break; case 1: Apr = new Appearance(ContentManager.GetResourceFromLongID(Outf.MediumAppearanceID)); break; case 2: Apr = new Appearance(ContentManager.GetResourceFromLongID(Outf.DarkAppearanceID)); break; default: Apr = new Appearance(ContentManager.GetResourceFromLongID(Outf.LightAppearanceID)); break; } Binding Bnd = new Binding(ContentManager.GetResourceFromLongID(Apr.BindingIDs[0])); if (m_CurrentSims.Count > 0) { if (!m_SingleRenderer) { m_Effects.Add(new BasicEffect(m_Scene.SceneMgr.Device, null)); m_CurrentSims.Add(Character); Skeleton SimSkeleton = m_CurrentSims[m_CurrentSims.Count - 1].SimSkeleton; //m_CurrentSims[m_CurrentSims.Count - 1].HeadMesh = new Mesh(); //m_CurrentSims[m_CurrentSims.Count - 1].HeadMesh. // Read(ContentManager.GetResourceFromLongID(Bnd.MeshAssetID)); //m_CurrentSims[m_CurrentSims.Count - 1].SimSkeleton.ComputeBonePositions(SimSkeleton.RootBone, // GameFacade.Scenes.WorldMatrix); //m_CurrentSims[m_CurrentSims.Count - 1].HeadMesh.ProcessMesh(); //m_CurrentSims[m_CurrentSims.Count - 1].HeadTexture = Texture2D.FromFile(m_Scene.SceneMgr.Device, // new MemoryStream(ContentManager.GetResourceFromLongID(Bnd.TextureAssetID))); } else { Skeleton SimSkeleton = m_CurrentSims[0].SimSkeleton; //m_Effects[0] = new BasicEffect(m_Scene.SceneMgr.Device, null); //m_CurrentSims[0].HeadMesh = new Mesh(); //m_CurrentSims[0].HeadMesh.Read(ContentManager.GetResourceFromLongID(Bnd.MeshAssetID)); //m_CurrentSims[0].SimSkeleton.ComputeBonePositions(SimSkeleton.RootBone, // GameFacade.Scenes.WorldMatrix); //m_CurrentSims[0].HeadMesh.ProcessMesh(); //m_CurrentSims[0].HeadTexture = Texture2D.FromFile(m_Scene.SceneMgr.Device, // new MemoryStream(ContentManager.GetResourceFromLongID(Bnd.TextureAssetID))); } } else { m_Effects.Add(new BasicEffect(m_Scene.SceneMgr.Device, null)); m_CurrentSims.Add(Character); Skeleton SimSkeleton = m_CurrentSims[0].SimSkeleton; //m_CurrentSims[0].HeadMesh = new Mesh(); //m_CurrentSims[0].HeadMesh.Read(ContentManager.GetResourceFromLongID(Bnd.MeshAssetID)); //m_CurrentSims[0].SimSkeleton.ComputeBonePositions(SimSkeleton.RootBone, // GameFacade.Scenes.WorldMatrix); //m_CurrentSims[0].HeadMesh.ProcessMesh(); //m_CurrentSims[0].HeadTexture = Texture2D.FromFile(m_Scene.SceneMgr.Device, // new MemoryStream(ContentManager.GetResourceFromLongID(Bnd.TextureAssetID))); } }
public static void LoadSim3D(Sim sim, Outfit OutfHead, AppearanceType skin) { var Apr = new Appearance(ContentManager.GetResourceFromLongID(OutfHead.GetAppearance(skin))); var Bnd = new Binding(ContentManager.GetResourceFromLongID(Apr.BindingIDs[0])); sim.HeadTexture = GetOutfitTexture(Bnd.TextureAssetID); sim.HeadMesh = GetOutfitMesh(sim.SimSkeleton, Bnd.MeshAssetID); }
private void RefreshSim() { var selectedHead = (CollectionItem)((UIGridViewerItem)m_HeadSkinBrowser.SelectedItem).Data; Outfit TmpOutfit = new Outfit(ContentManager.GetResourceFromLongID( selectedHead.PurchasableOutfit.OutfitID)); var selectedBody = (CollectionItem)((UIGridViewerItem)m_BodySkinBrowser.SelectedItem).Data; System.Diagnostics.Debug.WriteLine("Head = " + selectedHead.PurchasableOutfit.OutfitID); System.Diagnostics.Debug.WriteLine("Body = " + selectedBody.PurchasableOutfit.OutfitID); //SimCatalog.LoadSim3D(Sim, TmpOutfit, AppearanceType); SimBox.Sim.AppearanceType = AppearanceType; SimBox.Sim.HeadOutfitID = selectedHead.PurchasableOutfit.OutfitID; SimBox.Sim.BodyOutfitID = selectedBody.PurchasableOutfit.OutfitID; SimCatalog.LoadSim3D(SimBox.Sim); }
/// <summary> /// Loads a head mesh. /// </summary> /// <param name="MeshID">The ID of the mesh to load.</param> /// <param name="TexID">The ID of the texture to load.</param> public void LoadHeadMesh(Outfit Outf, int SkinColor) { Appearance Apr; switch (SkinColor) { case 0: Apr = new Appearance(ContentManager.GetResourceFromLongID(Outf.LightAppearanceID)); break; case 1: Apr = new Appearance(ContentManager.GetResourceFromLongID(Outf.MediumAppearanceID)); break; case 2: Apr = new Appearance(ContentManager.GetResourceFromLongID(Outf.DarkAppearanceID)); break; default: Apr = new Appearance(ContentManager.GetResourceFromLongID(Outf.LightAppearanceID)); break; } Binding Bnd = new Binding(ContentManager.GetResourceFromLongID(Apr.BindingIDs[0])); if (m_CurrentHeadMeshes.Count > 0) { if (!m_SingleRenderer) { m_Effects.Add(new BasicEffect(m_Scene.SceneMgr.Device, null)); m_CurrentHeadMeshes.Add(new Mesh(ContentManager.GetResourceFromLongID(Bnd.MeshAssetID), false)); m_CurrentHeadMeshes[m_CurrentHeadMeshes.Count - 1].ProcessMesh(); m_HeadTextures.Add(Texture2D.FromFile(m_Scene.SceneMgr.Device, new MemoryStream(ContentManager.GetResourceFromLongID(Bnd.TextureAssetID)))); } else { m_Effects[0] = new BasicEffect(m_Scene.SceneMgr.Device, null); m_CurrentHeadMeshes[0] = new Mesh(ContentManager.GetResourceFromLongID(Bnd.MeshAssetID), false); m_CurrentHeadMeshes[m_CurrentHeadMeshes.Count - 1].ProcessMesh(); m_HeadTextures[0] = Texture2D.FromFile(m_Scene.SceneMgr.Device, new MemoryStream(ContentManager.GetResourceFromLongID(Bnd.TextureAssetID))); } } else { m_Effects.Add(new BasicEffect(m_Scene.SceneMgr.Device, null)); m_CurrentHeadMeshes.Add(new Mesh(ContentManager.GetResourceFromLongID(Bnd.MeshAssetID), false)); m_CurrentHeadMeshes[m_CurrentHeadMeshes.Count - 1].ProcessMesh(); m_HeadTextures.Add(Texture2D.FromFile(m_Scene.SceneMgr.Device, new MemoryStream(ContentManager.GetResourceFromLongID(Bnd.TextureAssetID)))); } //m_RenderTarget = CreateRenderTarget(m_Screen.ScreenMgr.GraphicsDevice, 0, SurfaceFormat.Color); /*m_RenderTarget = new RenderTarget2D(m_Scene.SceneMgr.Device, 800, 600, 1, SurfaceFormat.Color);*/ //m_DSBuffer = CreateDepthStencil(m_RenderTarget); }