This commit is contained in:
DCFApixels 2025-03-06 15:11:41 +08:00
parent 887b6dadb9
commit e564799ffa
2 changed files with 18 additions and 6 deletions

View File

@ -277,9 +277,11 @@ namespace DCFApixels
_material = material;
_matrices = PinnedArray<Matrix4x4>.Pin(DummyArray<Matrix4x4>.Get());
_colors = PinnedArray<Vector4>.Pin(DummyArray<Vector4>.Get());
#if UNITY_EDITOR
AssemblyReloadEvents.beforeAssemblyReload += AssemblyReloadEvents_beforeAssemblyReload;
#endif
}
#if UNITY_EDITOR
private void AssemblyReloadEvents_beforeAssemblyReload()
{
AssemblyReloadEvents.beforeAssemblyReload -= AssemblyReloadEvents_beforeAssemblyReload;
@ -288,6 +290,7 @@ namespace DCFApixels
_colors.Dispose();
_gizmos.Dispose();
}
#endif
public void Prepare(GizmosList rawList)
{
var list = rawList.As<GizmoData>();
@ -390,9 +393,11 @@ namespace DCFApixels
_materialPropertyBlock = new MaterialPropertyBlock();
_drawDatas = PinnedArray<DrawData>.Pin(DummyArray<DrawData>.Get());
_enableInstancing = IsSupportsComputeShaders && _material.GetMaterial().enableInstancing;
#if UNITY_EDITOR
AssemblyReloadEvents.beforeAssemblyReload += AssemblyReloadEvents_beforeAssemblyReload;
#endif
}
#if UNITY_EDITOR
private void AssemblyReloadEvents_beforeAssemblyReload()
{
AssemblyReloadEvents.beforeAssemblyReload -= AssemblyReloadEvents_beforeAssemblyReload;
@ -402,7 +407,7 @@ namespace DCFApixels
_drawDatas.Dispose();
_gizmos.Dispose();
}
#endif
public virtual int ExecuteOrder => _material.GetExecuteOrder();
public virtual bool IsStaticRender => true;
protected void Prepare(GizmosList rawList)
@ -519,9 +524,11 @@ namespace DCFApixels
_materialPropertyBlock = new MaterialPropertyBlock();
_drawDatas = PinnedArray<DrawData>.Pin(DummyArray<DrawData>.Get());
_enableInstancing = IsSupportsComputeShaders && _material.GetMaterial().enableInstancing;
#if UNITY_EDITOR
AssemblyReloadEvents.beforeAssemblyReload += AssemblyReloadEvents_beforeAssemblyReload;
#endif
}
#if UNITY_EDITOR
private void AssemblyReloadEvents_beforeAssemblyReload()
{
AssemblyReloadEvents.beforeAssemblyReload -= AssemblyReloadEvents_beforeAssemblyReload;
@ -531,6 +538,7 @@ namespace DCFApixels
_drawDatas.Dispose();
_gizmos.Dispose();
}
#endif
public virtual int ExecuteOrder => _material.GetExecuteOrder() - 1;
public virtual bool IsStaticRender => true;
public void Prepare(GizmosList rawList)

View File

@ -1,9 +1,9 @@
using DCFApixels.DebugXCore;
using System.Runtime.CompilerServices;
//#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
//#if UNITY_EDITOR
using UnityEditor;
//#endif
namespace DCFApixels
@ -213,7 +213,11 @@ namespace DCFApixels
Vector3 pos1 = camera.WorldToScreenPoint(cameraPos + cameraTransform.TransformDirection(new Vector3(0f, 0f, z)));
Vector3 pos2 = camera.WorldToScreenPoint(cameraPos + cameraTransform.TransformDirection(new Vector3(1f, 0f, z)));
float magnitude = (pos1 - pos2).magnitude;
#if UNITY_EDITOR
return 80f / Mathf.Max(magnitude, 0.0001f) * EditorGUIUtility.pixelsPerPoint;
#else
return 80f / Mathf.Max(magnitude, 0.0001f);
#endif
}
#endregion
}