/// <summary>
        /// Assists in loading a texture from a byte array.
        /// </summary>
        /// <param name="data">The texture file data.</param>
        /// <param name="name">A name to assign the texture instance.</param>
        /// <param name="flags">A set of flags from the <c>TextureOpFlags</c> enum.</param>
        /// <returns></returns>
        public static Texture Load(byte[] data, TextureOpFlags flags, string name = null)
        {
            if (data == null || data.Length <= 0)
            {
                return(null);
            }
            var tex = (Texture2D)TextureHelper.Load(data, name);

            Enforce_Flags(ref tex, flags);
            return(tex);
        }
예제 #2
0
        private Texture LoadTexture(string file, out TextureHelper.TextureType texType)
        {
            texType = TextureHelper.TextureType.UNKNOWN;
            var strm = Resolve(file);

            if (strm == null)
            {
                return(null);
            }

            var data = Util.Read_Stream(strm);

            strm.Close();

            texType = TextureHelper.Identify_Texture_Type(data);
            var tex = TextureHelper.Load(data);

            tex.name = file;
            return(tex);
        }
예제 #3
0
        private void Load_Assets()
        {
            if (this.dll == null)
            {
                return;
            }
            string icon_file  = this.data.ICON;
            string thumb_file = this.data.PREVIEW;


            if (icon_file != null)
            {
                byte[] buf = this.Load_Resource(icon_file);
                if (buf != null)
                {
                    this.icon = (Texture2D)TextureHelper.Load(buf, icon_file);
                }
                else
                {
                    this.icon = null;
                }
            }

            if (thumb_file != null)
            {
                byte[] buf = this.Load_Resource(thumb_file);
                if (buf != null)
                {
                    this.thumbnail = (Texture2D)TextureHelper.Load(buf, thumb_file);
                }
                else
                {
                    this.thumbnail = null;
                }
            }
        }
예제 #4
0
 public static Texture2D Load_Texture_From_Data(byte[] data)
 {
     return((Texture2D)TextureHelper.Load(data));
 }