示例#1
0
        /// <summary>
        ///     Sets up default materials and parses all material scripts.
        /// </summary>
        public void Initialize()
        {
            // Set up default material - don't use name contructor as we want to avoid applying defaults
            Material.defaultSettings = new Material();
            Material.defaultSettings.SetName("DefaultSettings");
            // Add a single technique and pass, non-programmable
            Material.defaultSettings.CreateTechnique().CreatePass();

            // just create the default BaseWhite material
            Material baseWhite = (Material)instance.Create("BaseWhite");

            baseWhite.Lighting = false;

            // parse all material scripts.
            // programs are parsed first since they may be referenced by materials
            ParseAllSources(".program");
            ParseAllSources(".material");

            // parse any materials defined as fx files
            FXReader.ParseAllSources(".fx");
            FXReader.ParseAllSources(".cgfx");

            // I don't think we have support for cgfx yet
            // FXReader.ParseAllSources(".cgfx");
        }