Пример #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);
        }
Пример #2
0
        private static void ReadCustomTextures(BinaryReader reader, ModelReadConfig config, RawMMDModel 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(0, config.GlobalToonPath);
                }
            }
        }
 public Texture LoadTexture(MMDTexture mmdTexture)
 {
     return(mmdTexture == null ? null : LoadTexture(mmdTexture.TexturePath));
 }
Пример #4
0
 protected bool Equals(MMDTexture other)
 {
     return(string.Equals(TexturePath, other.TexturePath));
 }