示例#1
0
        public Material(TkMaterialData md)
        {
            Name   = md.Name;
            Shader = md.Shader;
            Link   = md.Link;
            Class  = md.Class;
            TransparencyLayerID = md.TransparencyLayerID;
            CastShadow          = md.CastShadow;
            DisableZTest        = md.DisableZTest;
            Flags    = new List <TkMaterialFlags>();
            Samplers = new List <TkMaterialSampler>();
            Uniforms = new List <TkMaterialUniform>();

            for (int i = 0; i < md.Flags.Count; i++)
            {
                Flags.Add(md.Flags[i]);
            }
            for (int i = 0; i < md.Samplers.Count; i++)
            {
                Samplers.Add(md.Samplers[i]);
            }
            for (int i = 0; i < md.Uniforms.Count; i++)
            {
                Uniforms.Add(md.Uniforms[i]);
            }

            //Clear material flags
            for (int i = 0; i < 64; i++)
            {
                material_flags[i] = 0.0f;
            }
        }
示例#2
0
        public static Material Parse(string path, textureManager input_texMgr)
        {
            //Load template
            //Try to use libMBIN to load the Material files
            TkMaterialData template = NMSUtils.LoadNMSTemplate(path, ref Common.RenderState.activeResMgr) as TkMaterialData;

#if DEBUG
            //Save NMSTemplate to exml
            template.WriteToExml("Temp\\" + template.Name + ".exml");
#endif

            //Make new material based on the template
            Material mat = new Material(template);

            mat.texMgr = input_texMgr;
            mat.init();
            return(mat);
        }