public static Appearance GetAppearance(ulong id) { if (Appearances.ContainsKey(id)) { return Appearances[id]; } var bytes = ContentManager.GetResourceFromLongID(id); var app = new Appearance(bytes); Appearances.Add(id, app); return app; }
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); }
public static void LoadSimHands(Sim sim) { ulong ID = SimCatalog.GetOutfit(sim.BodyOutfitID).HandGroup; Hag HandGrp = new Hag(new MemoryStream(ContentManager.GetResourceFromLongID(ID))); Appearance Apr; //This is UGLY, there must be a better way of doing this. :\ switch (sim.AppearanceType) { case AppearanceType.Light: if (HandGrp.LightSkin.LeftHand.FistGesture != 0) { Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.LightSkin.LeftHand.FistGesture))); sim.LeftHandBindings.FistBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.LightSkin.RightHand.FistGesture))); sim.RightHandBindings.FistBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); } if (HandGrp.LightSkin.LeftHand.IdleGesture != 0) { Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.LightSkin.LeftHand.IdleGesture))); sim.LeftHandBindings.IdleBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.LightSkin.RightHand.IdleGesture))); sim.RightHandBindings.IdleBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); } if (HandGrp.LightSkin.LeftHand.PointingGesture != 0) { Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.LightSkin.LeftHand.PointingGesture))); sim.LeftHandBindings.PointingBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.LightSkin.RightHand.PointingGesture))); sim.RightHandBindings.PointingBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); } break; case AppearanceType.Medium: if (HandGrp.MediumSkin.LeftHand.FistGesture != 0) { Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.MediumSkin.LeftHand.FistGesture))); sim.LeftHandBindings.FistBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.MediumSkin.RightHand.FistGesture))); sim.RightHandBindings.FistBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); } if (HandGrp.MediumSkin.LeftHand.IdleGesture != 0) { Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.MediumSkin.LeftHand.IdleGesture))); sim.LeftHandBindings.IdleBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.MediumSkin.RightHand.IdleGesture))); sim.RightHandBindings.IdleBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); } if (HandGrp.MediumSkin.LeftHand.PointingGesture != 0) { Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.MediumSkin.LeftHand.PointingGesture))); sim.LeftHandBindings.PointingBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.MediumSkin.RightHand.PointingGesture))); sim.RightHandBindings.PointingBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); } break; case AppearanceType.Dark: if (HandGrp.DarkSkin.LeftHand.FistGesture != 0) { Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.DarkSkin.LeftHand.FistGesture))); sim.LeftHandBindings.FistBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.DarkSkin.RightHand.FistGesture))); sim.RightHandBindings.FistBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); } if (HandGrp.DarkSkin.LeftHand.IdleGesture != 0) { Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.DarkSkin.LeftHand.IdleGesture))); sim.LeftHandBindings.IdleBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.DarkSkin.RightHand.IdleGesture))); sim.RightHandBindings.IdleBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); } if (HandGrp.DarkSkin.LeftHand.PointingGesture != 0) { Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.DarkSkin.LeftHand.PointingGesture))); sim.LeftHandBindings.PointingBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); Apr = new Appearance(); Apr.Read(new MemoryStream(ContentManager.GetResourceFromLongID( HandGrp.DarkSkin.RightHand.PointingGesture))); sim.RightHandBindings.PointingBindings = Apr.Bindings.Select(x => new SimModelBinding(x.ID)).ToList(); } break; } }
/// <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); }