Exemple #1
0
        public void ParseParameters()
        {
            codedata = new TSOMaterialCode(code);

            foreach (TSOParameter i in codedata.Values)
            {
                SetValue(i.Type, i.Name, i.Value);
            }
        }
Exemple #2
0
        public string[] GetCode()
        {
            TSOMaterialCode code = TSOMaterialCode.GenerateFromFile(shader);
            List <string>   line = new List <string>();

            code.SetValue("ColorTex", Path.GetFileNameWithoutExtension(diffuse));
            code.SetValue("ShadeTex", Path.GetFileNameWithoutExtension(shadow));

            foreach (KeyValuePair <string, TSOParameter> i in code)
            {
                line.Add(i.Value.ToString());
            }

            return(line.ToArray());
        }
Exemple #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);
                }
            }
        }