public static Binding GetBinding(ulong id)
        {
            if (Bindings.ContainsKey(id))
            {
                return Bindings[id];
            }

            var bytes = ContentManager.GetResourceFromLongID(id);
            var binding = new Binding(bytes);
            Bindings.Add(id, binding);
            return binding;
        }
Example #2
0
        /// <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);
        }
Example #4
0
        /// <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);
        }