/// <summary> /// Removes all techniques from this material. /// </summary> public void RemoveAllTechniques() { techniques.Clear(); supportedTechniques.Clear(); bestTechniquesByScheme.Clear(); compilationRequired = true; }
/// <summary> /// 'Compiles' this Material. /// </summary> /// <remarks> /// Compiling a material involves determining which Techniques are supported on the /// card on which the engine is currently running, and for fixed-function Passes within those /// Techniques, splitting the passes down where they contain more TextureUnitState /// instances than the curren card has texture units. /// <p/> /// This process is automatically done when the Material is loaded, but may be /// repeated if you make some procedural changes. /// <p/> /// This method should be safe for use on threads other than the main render thread. /// </remarks> /// <param name="autoManageTextureUnits"> /// If true, when a fixed function pass has too many TextureUnitState /// entries than the card has texture units, the Pass in question will be split into /// more than one Pass in order to emulate the Pass. If you set this to false and /// this situation arises, an Exception will be thrown. /// </param> public void Compile(bool autoManageTextureUnits) { // clear current list of supported techniques supportedTechniques.Clear(); bestTechniquesByScheme.Clear(); unsupportedReasons = ""; string compileMessages = ""; // compile each technique, adding supported ones to the list of supported techniques for (int i = 0; i < techniques.Count; i++) { Technique t = (Technique)techniques[i]; // compile the technique, splitting texture passes if required compileMessages = t.Compile(autoManageTextureUnits); // if supported, add it to the list if (t.IsSupported) { InsertSupportedTechnique(t); } else { string s = "Material " + name + " Technique " + i; if (t.Name != "") { s += " (" + t.Name + ")"; } s += " is not supported. " + compileMessages; LogManager.Instance.Write(s); unsupportedReasons = compileMessages; } } // TODO: Order best techniques compilationRequired = false; // Did we find any? if (supportedTechniques.Count == 0) { LogManager.Instance.Write("Warning: Material '{0}' has no supportable Techniques on this hardware. Will be rendered blank. Explanation: {1}", name, compileMessages); } }
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); } }