/// <summary>
        ///    Creates a new Technique for this Material.
        /// </summary>
        /// <remarks>
        ///    A Technique is a single way of rendering geometry in order to achieve the effect
        ///    you are intending in a material. There are many reason why you would want more than
        ///    one - the main one being to handle variable graphics card abilities; you might have
        ///    one technique which is impressive but only runs on 4th-generation graphics cards,
        ///    for example. In this case you will want to create at least one fallback Technique.
        ///    The engine will work out which Techniques a card can support and pick the best one.
        ///    <p/>
        ///    If multiple Techniques are available, the order in which they are created is
        ///    important - the engine will consider lower-indexed Techniques to be preferable
        ///    to higher-indexed Techniques, ie when asked for the 'best' technique it will
        ///    return the first one in the technique list which is supported by the hardware.
        /// </remarks>
        /// <returns></returns>
        public Technique CreateTechnique()
        {
            Technique t = new Technique(this);

            techniques.Add(t);
            compilationRequired = true;
            return(t);
        }
        /// <summary>
        ///		Insert a supported technique into the local
        ///     collections, if it's not already present. */
        /// </summary>
        protected void InsertSupportedTechnique(Technique t)
        {
            supportedTechniques.Add(t);
            // get scheme
            int schemeIndex = t.SchemeIndex;
            Dictionary <int, Technique> lodTechniques;

            if (!bestTechniquesByScheme.TryGetValue(schemeIndex, out lodTechniques))
            {
                lodTechniques = new Dictionary <int, Technique>();
                bestTechniquesByScheme[schemeIndex] = lodTechniques;
            }
            if (!lodTechniques.ContainsKey(t.LodIndex))
            {
                lodTechniques[t.LodIndex] = t;
            }
        }
Example #3
0
        private void Import()
        {
            var path = OpenFileDialog(OpenFileFilter);

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            var manager = EffectsManager;

            EffectsManager = null;
            manager.ImportTechniques(path, true);
            EffectsManager = manager;
            TechniqueList.Clear();
            foreach (var tech in EffectsManager.RenderTechniques)
            {
                TechniqueList.Add(tech);
            }
        }