示例#1
0
        private SEAObject AppendTexture(EmbeddedTexture texture)
        {
            int sIndex = GetIndexByTag(texture);
            if (sIndex != -1) return (SEATexture)Writer.Objects[sIndex];

            SEATexture tex = new SEATexture(GetValidString(textures, "EmbeddedTexture"), texture.CompressedFormatHint.ToLower());
            tex.Data.WriteBytes(texture.CompressedData);
            tex.tag = texture;

            textures.Add(tex);
            Writer.AddObject(tex);

            return tex;
        }
示例#2
0
        private SEAObject AppendTexture(string url)
        {
            int sIndex = GetIndexByTag(url);
            if (sIndex != -1) return (SEATextureURL)Writer.Objects[sIndex];

            int end = Math.Max(0, url.LastIndexOf('.'));
            if (end == 0) end = url.Length;

            int start = url.LastIndexOf('/', end - 1) + 1;

            string name = url.Substring(start, end - start);
            string path = Path + url;

            SEAObject tex;

            if (EmbedTexture && File.Exists(path))
            {
                SEATexture texEmbed = new SEATexture(GetValidString(textures, name), url.Substring(end + 1).ToLower());
                texEmbed.Data = new ByteArray();
                texEmbed.Data.ReadFile(path);
                texEmbed.tag = url;

                tex = texEmbed;
            }
            else
            {
                SEATextureURL texurl = new SEATextureURL(GetValidString(textures, name));
                texurl.tag = texurl.url = url;

                tex = texurl;
            }

            textures.Add(tex);
            Writer.AddObject(tex);

            return tex;
        }