/// <summary> /// Push a technique on top of the techniques stack /// </summary> /// <typeparam name="TTech"></typeparam> /// <param name="technique"></param> public static void PushTechnique <TTech>(Technique technique) where TTech : Technique { if (technique == null) { throw new ArgumentNullException("technique"); } var entry = TrCache <TTech> .Registry; entry.technique = technique; _activeTechStack.Push(entry); foreach (var item in entry.Renders) { item.PushRender(); } }
public static void InsertTechnique <TTech>(Predicate <Type> selectionSlotFunc, Technique technique = null) where TTech : Technique { if (_activeTechStack.Count == 0) { if (technique != null) { PushTechnique <TTech>(technique); } else { PushTechnique <TTech>(); } } else { TechniqueRegistry entry; while (_activeTechStack.Count > 0) { entry = _activeTechStack.Peek(); if (selectionSlotFunc(entry.Technique.GetType())) { break; } else { _entries.Push(entry); _activeTechStack.Pop(); foreach (var item in entry.Renders) { item.PopRender(); } } } if (technique != null) { PushTechnique <TTech>(technique); } else { PushTechnique <TTech>(); } while (_entries.Count > 0) { entry = _entries.Pop(); _activeTechStack.Push(entry); foreach (var item in entry.Renders) { item.PushRender(); } } } }
public static void PushRequiredTechnique <TTech>() where TTech : Technique, new() { Technique.Require <TTech>(); PushTechnique <TTech>(); }