示例#1
0
        public static Image LoadThumbnail(IMaterial material)
        {
            string TexturePath = string.Empty;
            Image  Thumbnail   = null;
            ulong  SamplerHash = 0;

            if (material != null)
            {
                HashName TextureHash = material.GetTextureByID("S000");

                if (TextureHash != null)
                {
                    SamplerHash = TextureHash.Hash;

                    // If our storage doesn't contain a thumbnail, then we go ahead and produce another.
                    if (!RenderStorageSingleton.Instance.TextureThumbnails.TryGetValue(SamplerHash, out Thumbnail))
                    {
                        TexturePath = GetTextureFromPath(TextureHash.String, false);
                    }
                }
            }
            else
            {
                Thumbnail = RenderStorageSingleton.Instance.TextureThumbnails[1];
            }

            return(Thumbnail != null ? Thumbnail : LoadDDSSquish(TexturePath, SamplerHash));
        }