10using System.Collections.Generic;
27 public abstract class LeapRenderingMethod : ILeapInternalRenderingMethod {
66 LeapGraphicGroup ILeapInternalRenderingMethod.group {
95 public virtual void OnEnableRendererEditor() {
102 public virtual void OnDisableRendererEditor() {
110 public virtual void OnUpdateRendererEditor() { }
118 private static Dictionary<UnityObject, object> _assetToOwner =
new Dictionary<UnityObject, object>();
123 if (_assetToOwner.TryGetValue(t, out owner)) {
124 if (owner.Equals(
this)) {
128 if (t is Texture2D) {
129 Texture2D tex = t as Texture2D;
131 RenderTexture rt =
new RenderTexture(tex.width, tex.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
134 Texture2D newTex =
new Texture2D(tex.width, tex.height, TextureFormat.ARGB32, tex.mipmapCount > 1,
true);
135 RenderTexture.active = rt;
136 newTex.ReadPixels(
new Rect(0, 0, tex.width, tex.height), 0, 0);
138 RenderTexture.active =
null;
147 _assetToOwner[t] =
this;
153 public const string ASSET_PATH =
"Assets/Generated/RendererData/";
157 Type graphicType = typeof(GraphicType);
159 return t == graphicType || (t.IsSubclassOf(graphicType));
163 return graphic is GraphicType;
167 return obj.GetComponent<GraphicType>();
UnityEngine.Object UnityObject
abstract void OnUpdateRenderer()
Called from LateUpdate during runtime. Use this to update the renderer using any changes made to duri...
LeapGraphicGroup group
Gets the group this rendering method is attached to.
abstract void OnDisableRenderer()
Called when the renderer is disabled at runtime.
LeapGraphicRenderer renderer
Gets the renderer this rendering method is attached to.
void PreventDuplication< T >(ref T t)
abstract bool IsValidGraphic< T >()
abstract bool IsValidGraphic(LeapGraphic graphic)
override LeapGraphic GetValidGraphicOnObject(GameObject obj)
abstract LeapGraphic GetValidGraphicOnObject(GameObject obj)
const string DATA_FOLDER_NAME
override bool IsValidGraphic(LeapGraphic graphic)
abstract void OnEnableRenderer()
Called when the renderer is enabled at runtime.
abstract SupportInfo GetSpaceSupportInfo(LeapSpace space)
LeapGraphicRenderer renderer
UnityEngine.Object UnityObject
The support info class provides a very basic way to notify that something is fully supported,...