// Fills given CommandBuffer with this Highlighter rendering commands public void FillBuffer(CommandBuffer buffer, int renderQueue) { //if (!highlighted) { return; } if (this.renderQueue != renderQueue) { return; } for (int i = highlightableRenderers.Count - 1; i >= 0; i--) { RendererCache renderer = highlightableRenderers[i]; if (!renderer.FillBuffer(buffer)) { highlightableRenderers.RemoveAt(i); } } }
// Returns true in case visibility changed in this frame private bool UpdateVisibility() { if (visibilityCheckFrame == Time.frameCount) { return(visibilityChanged); } visibilityCheckFrame = Time.frameCount; visible = false; visibilityChanged = false; for (int i = 0, imax = highlightableRenderers.Count; i < imax; i++) { RendererCache rc = highlightableRenderers[i]; visibilityChanged |= rc.UpdateVisibility(); visible |= rc.visible; } return(visibilityChanged); }
// This method defines the way in which renderers are initialized private bool UpdateRenderers() { if (renderersDirty) { List <Renderer> renderers = new List <Renderer>(); // Find all renderers which should be controlled by this Highlighter component GrabRenderers(tr, ref renderers); // Cache found renderers highlightableRenderers = new List <RendererCache>(); int l = renderers.Count; for (int i = 0; i < l; i++) { RendererCache cache = new RendererCache(renderers[i], opaqueMaterial, zTestFloat, stencilRefFloat); highlightableRenderers.Add(cache); } // Reset highlighted = false; renderersDirty = false; currentColor = Color.clear; return(true); } else { // To avoid null-reference exceptions when cached GameObject or Renderer has been removed but ReinitMaterials wasn't called bool changed = false; for (int i = highlightableRenderers.Count - 1; i >= 0; i--) { if (highlightableRenderers[i].IsDestroyed()) { highlightableRenderers.RemoveAt(i); changed = true; } } return(changed); } }
// This method defines the way in which renderers are initialized private bool UpdateRenderers() { if (renderersDirty) { List<Renderer> renderers = new List<Renderer>(); // Find all renderers which should be controlled by this Highlighter component GrabRenderers(tr, ref renderers); // Cache found renderers highlightableRenderers = new List<RendererCache>(); int l = renderers.Count; for (int i = 0; i < l; i++) { RendererCache cache = new RendererCache(renderers[i], opaqueMaterial, zTestFloat, stencilRefFloat); highlightableRenderers.Add(cache); } // Reset highlighted = false; renderersDirty = false; currentColor = Color.clear; return true; } else { // To avoid null-reference exceptions when cached GameObject or Renderer has been removed but ReinitMaterials wasn't called bool changed = false; for (int i = highlightableRenderers.Count - 1; i >= 0; i--) { if (highlightableRenderers[i].IsDestroyed()) { highlightableRenderers.RemoveAt(i); changed = true; } } return changed; } }
public GenerateCacheKey(RendererCache rendererCache) : base(rendererCache) { }
public static void ClearCache() { TemplateCache.ClearCache(); RendererCache.ClearCache(); }
public static void ClearCache() { Current = new RendererCache(); }
public RenderFromCache(RendererCache rendererCache, BaseClient baseClient) : base(rendererCache, baseClient) { }