示例#1
0
        //public Dictionary<string, string>   parameters;

        public MaterialInfo(string path, MqoMaterial mat, ImportMaterialInfo import_mat_info)
        {
            name      = mat.name;
            color_tex = mat.tex;

            if (import_mat_info != null)
            {
                string file = Path.Combine(path, import_mat_info.Name);

                if (File.Exists(file))
                {
                    shader = import_mat_info.Name;
                }

                if (import_mat_info.ShadeTex != null)
                {
                    file = Path.Combine(path, import_mat_info.ShadeTex.File);

                    if (File.Exists(file))
                    {
                        shade_tex = import_mat_info.ShadeTex.File;
                    }
                }
            }
        }
示例#2
0
        bool DoWriteMaterials()
        {
            bw.Write(mqo.Materials.Count);

            foreach (MqoMaterial mat in mqo.Materials)
            {
                MaterialInfo mat_info = materials[mat.name];
                string[]     code     = mat_info.GetCode();

                WriteString(bw, mat.name);
                WriteString(bw, "cgfxShader");
                bw.Write(code.Length);

                foreach (string line in code)
                {
                    WriteString(bw, line.Trim('\r', '\n'));
                }

                ImportMaterialInfo import_mat_info = new ImportMaterialInfo();
                import_mat_info.Name = mat.name;
                import_mat_info.File = "cgfxShader";
                ii.materials.Add(import_mat_info);

                // コードを保存する
                File.WriteAllLines(Path.Combine(dir, mat.name), code);
            }

            return(true);
        }
示例#3
0
        private bool DoWriteMaterials()
        {
            bw.Write(mqo.Materials.Count);

            foreach (MqoMaterial i in mqo.Materials)
            {
                MaterialInfo mi   = materials[i.name];
                string[]     code = mi.GetCode();

                WriteString(bw, i.name);
                WriteString(bw, "cgfxShader");
                bw.Write(code.Length);

                foreach (string j in code)
                {
                    WriteString(bw, j.Trim('\r', '\n'));
                }

                ImportMaterialInfo imi = new ImportMaterialInfo();
                imi.Name = i.name;
                imi.File = "cgfxShader";
                ii.materials.Add(imi);

                // コードを保存する
                File.WriteAllLines(Path.Combine(dir, i.name), code);
            }

            return(true);
        }
示例#4
0
        //public Dictionary<string, string>   parameters;

        public MaterialInfo(string path, MqoMaterial mqom, ImportMaterialInfo impm)
        {
            name    = mqom.name;
            diffuse = mqom.tex;

            if (impm != null)
            {
                string file = Path.Combine(path, impm.Name);

                if (File.Exists(file))
                {
                    shader = file;
                }

                if (impm.shadow != null)
                {
                    file = Path.Combine(path, impm.shadow.File);

                    if (File.Exists(file))
                    {
                        shadow = file;
                    }
                }
            }
        }
示例#5
0
        public ImportMaterialInfo GetMaterial(string name)
        {
            ImportMaterialInfo info = null;

            materialmap.TryGetValue(name, out info);
            return(info);
        }