Esempio n. 1
0
        private static MmdTexture[] ReadTextureList(BinaryReader reader, PmxConfig pmxConfig)
        {
            var textureNum  = reader.ReadInt32();
            var textureList = new MmdTexture[textureNum];

            for (var i = 0; i < textureNum; ++i)
            {
                var texturePathEncoding = pmxConfig.Utf8Encoding ? Encoding.UTF8 : Encoding.Unicode;
                var texturePath         = MmdReaderUtil.ReadSizedString(reader, texturePathEncoding);
                textureList[i] = new MmdTexture(texturePath);
            }
            return(textureList);
        }
Esempio n. 2
0
        private static void ReadCustomTextures(BinaryReader reader, ModelReadConfig config, MmdModel model,
                                               List <int> toonTextureIds)
        {
            var customTextures = new MmdTexture[10];

            for (var i = 0; i < 10; ++i)
            {
                customTextures[i] =
                    new MmdTexture(MmdReaderUtil.ReadStringFixedLength(reader, 100, Tools.JapaneseEncoding));
            }

            for (var i = 0; i < model.Parts.Length; ++i)
            {
                var material = model.Parts[i].Material;
                if (toonTextureIds[i] < 10)
                {
                    material.Toon = customTextures[toonTextureIds[i]];
                }
                else
                {
                    material.Toon = MmdTextureUtil.GetGlobalToon(-1, config.GlobalToonPath);
                }
            }
        }
 public Texture LoadTexture(MmdTexture mmdTexture)
 {
     return(mmdTexture == null ? null : LoadTexture(mmdTexture.TexturePath));
 }
 protected bool Equals(MmdTexture other)
 {
     return(string.Equals(TexturePath, other.TexturePath));
 }