//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; } } } }
//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; } } } }
bool SectionMaterial(string[] tokens) { if (tokens[0] == "}") { return(false); } StringBuilder sb = new StringBuilder(); foreach (string i in tokens) { sb.Append(' ').Append(i); } string line = sb.ToString().Trim(); MqoMaterial m = new MqoMaterial(tokens[0].Trim('"')); tokens = SplitString(line); mqo.materials.Add(m); for (int i = 1; i < tokens.Length; ++i) { string t = tokens[i]; if (t.StartsWith("shader(")) { m.shader = int.Parse(SplitParam(t)[1]); } else if (t.StartsWith("col(")) { m.col = Color3.Parse(SplitParam(t), 1); } else if (t.StartsWith("dif(")) { m.dif = float.Parse(SplitParam(t)[1]); } else if (t.StartsWith("amb(")) { m.amb = float.Parse(SplitParam(t)[1]); } else if (t.StartsWith("emi(")) { m.emi = float.Parse(SplitParam(t)[1]); } else if (t.StartsWith("spc(")) { m.spc = float.Parse(SplitParam(t)[1]); } else if (t.StartsWith("power(")) { m.power = float.Parse(SplitParam(t)[1]); } else if (t.StartsWith("tex(")) { m.tex = t.Substring(3).Trim('(', ')', '"'); } } return(true); }