Example #1
0
        public void Add(TSOTex tso_tex, int tso_num)
        {
            if (tso_tex.width == 0 || tso_tex.height == 0)
            {
                return;
            }

            Bitmap bmp = new Bitmap(tso_tex.width, tso_tex.height);

            SetBitmapBytes(bmp, tso_tex.data);

            PMD_Texture tex = new PMD_Texture(GenName(tso_num, tso_tex.Name));

            tex.Bitmap = bmp;

            foreach (PMD_Texture other in items)
            {
                if (other.Bitmap != null && EqualBitmaps(bmp, other.Bitmap))
                {
                    map[tex.Code] = other;

                    if (use_spheremap && other.IsToon)
                    {
                        PMD_Texture tex_sphere = new PMD_Texture(GenName(tso_num, tso_tex.Name), tex);

                        map[tex_sphere.Code] = other.Sphere;
                    }
                    return;
                }
            }

            tex.SetID((sbyte)items.Count);
            items.Add(tex);
            map[tex.Code] = tex;

            if (use_spheremap && tex.IsToon)
            {
                PMD_Texture tex_sphere = new PMD_Texture(GenName(tso_num, tso_tex.Name), tex);

                tex_sphere.SetID((sbyte)items.Count);
                items.Add(tex_sphere);
                map[tex_sphere.Code] = tex_sphere;
            }
        }
Example #2
0
 /// <summary>
 /// テクスチャを登録します。
 /// スフィアマップを登録する場合は元になるToonを指定します。
 /// </summary>
 /// <param name="name">テクスチャ名</param>
 /// <param name="toon">Toon</param>
 public PMD_Texture(string name, PMD_Texture toon)
 {
     this.name = name;
     this.toon = toon;
     toon.SetSphere(this);
 }
Example #3
0
 /// <summary>
 /// スフィアマップを設定します。
 /// </summary>
 /// <param name="sphere">スフィアマップ</param>
 public void SetSphere(PMD_Texture sphere)
 {
     this.sphere = sphere;
 }