Ejemplo n.º 1
0
        public ImportTextureInfo GetTexture(string name)
        {
            ImportTextureInfo info = null;

            texturemap.TryGetValue(name, out info);
            return(info);
        }
Ejemplo n.º 2
0
        private bool DoWriteTextures()
        {
            bw.Write(textures.Count);

            foreach (TextureInfo i in textures.Values)
            {
                string file = i.file;
                string name = i.name;

                WriteString(bw, name);
                WriteString(bw, "\"" + Path.GetFileName(file) + "\"");

                // テクスチャの読み込み
                TSOTex tex = LoadTex(file);
                tex.name = name;
                bw.Write(tex.Width);
                bw.Write(tex.Height);
                bw.Write(tex.Depth);
                bw.Write(tex.data, 0, tex.data.Length);

                ImportTextureInfo iti = new ImportTextureInfo(tex);
                ii.textures.Add(iti);

                // テクスチャが同じフォルダにない場合、コピーしておく
                if (Path.GetDirectoryName(file).ToUpper() != dir.ToUpper())
                {
                    iti.File = Path.Combine(dir, Path.GetFileName(file));
                    File.Copy(file, iti.File, true);
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
        public override void PostLoad(ImportInfo owner)
        {
            base.PostLoad(owner);

            string dir      = Path.GetDirectoryName(owner.filename);
            string codefile = Path.Combine(dir, Name);

            if (System.IO.File.Exists(codefile))
            {
                TSOMaterialCode code = TSOMaterialCode.GenerateFromFile(codefile);
                TSOParameter    p;

                if (code.TryGetValue("ColorTex", out p))
                {
                    color = owner.GetTexture(p.Value);
                }

                if (code.TryGetValue("ShadeTex", out p))
                {
                    shadow = owner.GetTexture(p.Value);
                }
            }
        }
Ejemplo n.º 4
0
        bool DoWriteTextures()
        {
            bw.Write(textures.Count);

            foreach (TextureInfo tex_info in textures.Values)
            {
                string file = tex_info.file;
                string name = tex_info.name;

                string file_directory_name = Path.GetDirectoryName(file);
                string file_name           = Path.GetFileName(file);

                WriteString(bw, name);
                WriteString(bw, "\"" + file_name + "\"");

                // テクスチャの読み込み
                TSOTex tex = LoadTex(file);
                tex.name = name;
                bw.Write(tex.Width);
                bw.Write(tex.Height);
                bw.Write(tex.Depth);
                bw.Write(tex.data, 0, tex.data.Length);

                ImportTextureInfo import_tex_info = new ImportTextureInfo(tex);
                ii.textures.Add(import_tex_info);

                // テクスチャが同じフォルダにない場合、コピーしておく
                if (file_directory_name != "" && file_directory_name.ToUpper() != dir.ToUpper())
                {
                    import_tex_info.File = Path.Combine(dir, file_name);
                    File.Copy(file, import_tex_info.File, true);
                }
            }

            return(true);
        }