mirror of
https://github.com/DCFApixels/Unity-DebugX.git
synced 2025-09-18 01:54:37 +08:00
polishing
This commit is contained in:
parent
5274939632
commit
17d7f8a5a8
@ -25,7 +25,7 @@ namespace DCFApixels.DebugXCore.Internal
|
|||||||
|
|
||||||
private static bool _isCompilation;
|
private static bool _isCompilation;
|
||||||
private bool? _isHasDisableDebugXInBuildSymbols = false;
|
private bool? _isHasDisableDebugXInBuildSymbols = false;
|
||||||
private const string DEFINE_NAME = nameof(DebugX.DISABLE_DEBUGX_INBUILD);
|
private const string DEFINE_NAME = nameof(DebugXDefines.DISABLE_DEBUGX_INBUILD);
|
||||||
|
|
||||||
private void OnGUI()
|
private void OnGUI()
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,17 @@
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Rendering;
|
||||||
|
|
||||||
namespace DCFApixels
|
namespace DCFApixels
|
||||||
{
|
{
|
||||||
|
public static class DebugXConsts
|
||||||
|
{
|
||||||
|
public const float IMMEDIATE_DURATION = -1;
|
||||||
|
public const float DOT_SIZE = 0.05f;
|
||||||
|
|
||||||
|
public readonly static bool IsSRP = GraphicsSettings.currentRenderPipeline != null;
|
||||||
|
public readonly static bool IsSupportsComputeShaders = SystemInfo.supportsComputeShaders;
|
||||||
|
}
|
||||||
public static partial class DebugX
|
public static partial class DebugX
|
||||||
{
|
{
|
||||||
internal const MethodImplOptions LINE = MethodImplOptions.AggressiveInlining;
|
internal const MethodImplOptions LINE = MethodImplOptions.AggressiveInlining;
|
||||||
@ -10,9 +19,6 @@ namespace DCFApixels
|
|||||||
private const float DEFAULT_DURATION = 0f;
|
private const float DEFAULT_DURATION = 0f;
|
||||||
private static readonly Color DEFAULT_COLOR = Color.white;
|
private static readonly Color DEFAULT_COLOR = Color.white;
|
||||||
|
|
||||||
private const float DOT_SIZE = DOT_RADIUS * 2f;
|
|
||||||
private const float DOT_RADIUS = 0.05f;
|
|
||||||
|
|
||||||
private const string GLOBAL_TIME_SCALE_PREF_NAME = "DCFApixels.DebugX.TimeScale";
|
private const string GLOBAL_TIME_SCALE_PREF_NAME = "DCFApixels.DebugX.TimeScale";
|
||||||
private const string GLOBAL_DOT_SIZE_PREF_NAME = "DCFApixels.DebugX.DotSize";
|
private const string GLOBAL_DOT_SIZE_PREF_NAME = "DCFApixels.DebugX.DotSize";
|
||||||
private const string GLOBAL_COLOR_PREF_NAME = "DCFApixels.DebugX.Color";
|
private const string GLOBAL_COLOR_PREF_NAME = "DCFApixels.DebugX.Color";
|
||||||
@ -21,18 +27,7 @@ namespace DCFApixels
|
|||||||
private readonly static int GlobalColorPropertyID = Shader.PropertyToID("_DebugX_GlobalColor");
|
private readonly static int GlobalColorPropertyID = Shader.PropertyToID("_DebugX_GlobalColor");
|
||||||
internal readonly static int ColorPropertyID = Shader.PropertyToID("_Color");
|
internal readonly static int ColorPropertyID = Shader.PropertyToID("_Color");
|
||||||
|
|
||||||
public const float IMMEDIATE_DURATION = -1;
|
|
||||||
|
|
||||||
public readonly static bool IsSRP;
|
|
||||||
public readonly static bool IsSupportsComputeShaders = SystemInfo.supportsComputeShaders;
|
|
||||||
|
|
||||||
|
|
||||||
public const bool DISABLE_DEBUGX_INBUILD =
|
|
||||||
#if DISABLE_DEBUGX_INBUILD
|
|
||||||
true;
|
|
||||||
#else
|
|
||||||
false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private enum PauseStateX
|
private enum PauseStateX
|
||||||
{
|
{
|
||||||
@ -48,3 +43,15 @@ namespace DCFApixels
|
|||||||
Fade,
|
Fade,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
namespace DCFApixels.DebugXCore
|
||||||
|
{
|
||||||
|
public static class DebugXDefines
|
||||||
|
{
|
||||||
|
public const bool DISABLE_DEBUGX_INBUILD =
|
||||||
|
#if DISABLE_DEBUGX_INBUILD
|
||||||
|
true;
|
||||||
|
#else
|
||||||
|
false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
@ -19,7 +19,7 @@ using UnityEditor;
|
|||||||
namespace DCFApixels
|
namespace DCFApixels
|
||||||
{
|
{
|
||||||
using IN = System.Runtime.CompilerServices.MethodImplAttribute;
|
using IN = System.Runtime.CompilerServices.MethodImplAttribute;
|
||||||
|
using static DebugXConsts;
|
||||||
public static unsafe partial class DebugX
|
public static unsafe partial class DebugX
|
||||||
{
|
{
|
||||||
private static PauseStateX _pauseState = PauseStateX.Unpaused;
|
private static PauseStateX _pauseState = PauseStateX.Unpaused;
|
||||||
@ -59,10 +59,6 @@ namespace DCFApixels
|
|||||||
{
|
{
|
||||||
InitGlobals();
|
InitGlobals();
|
||||||
|
|
||||||
Meshes = DebugXUtility.LoadStaticData(new MeshesList(), $"DCFApixels.DebugX/MeshesList");
|
|
||||||
Materials = DebugXUtility.LoadStaticData(new MaterialsList(), $"DCFApixels.DebugX/MaterialsList");
|
|
||||||
|
|
||||||
IsSRP = GraphicsSettings.currentRenderPipeline != null;
|
|
||||||
|
|
||||||
if (IsSRP)
|
if (IsSRP)
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,9 @@ using UnityEditor;
|
|||||||
|
|
||||||
namespace DCFApixels
|
namespace DCFApixels
|
||||||
{
|
{
|
||||||
|
using static DebugXConsts;
|
||||||
using IN = System.Runtime.CompilerServices.MethodImplAttribute;
|
using IN = System.Runtime.CompilerServices.MethodImplAttribute;
|
||||||
|
|
||||||
public static unsafe partial class DebugX
|
public static unsafe partial class DebugX
|
||||||
{
|
{
|
||||||
public readonly partial struct DrawHandler
|
public readonly partial struct DrawHandler
|
||||||
|
@ -7,7 +7,7 @@ using DCFApixels.DebugXCore;
|
|||||||
namespace DCFApixels
|
namespace DCFApixels
|
||||||
{
|
{
|
||||||
using IN = System.Runtime.CompilerServices.MethodImplAttribute;
|
using IN = System.Runtime.CompilerServices.MethodImplAttribute;
|
||||||
|
using static DebugXConsts;
|
||||||
public unsafe static partial class DebugX
|
public unsafe static partial class DebugX
|
||||||
{
|
{
|
||||||
public readonly partial struct DrawHandler
|
public readonly partial struct DrawHandler
|
||||||
@ -123,11 +123,11 @@ namespace DCFApixels
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Dot
|
#region Dot
|
||||||
[IN(LINE)] public DrawHandler Dot(Vector3 position) => Mesh<DotMesh, DotMat>(position, Quaternion.identity, new Vector3(DOT_RADIUS, DOT_RADIUS, DOT_RADIUS));
|
[IN(LINE)] public DrawHandler Dot(Vector3 position) => Mesh<DotMesh, DotMat>(position, Quaternion.identity, new Vector3(DOT_SIZE, DOT_SIZE, DOT_SIZE));
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region WireDot
|
#region WireDot
|
||||||
[IN(LINE)] public DrawHandler WireDot(Vector3 position) => Mesh<WireCircleMesh, DotMat>(position, Quaternion.identity, new Vector3(DOT_RADIUS / 2, DOT_RADIUS / 2, DOT_RADIUS / 2));
|
[IN(LINE)] public DrawHandler WireDot(Vector3 position) => Mesh<WireCircleMesh, DotMat>(position, Quaternion.identity, new Vector3(DOT_SIZE / 2, DOT_SIZE / 2, DOT_SIZE / 2));
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Capsule
|
#region Capsule
|
||||||
@ -397,11 +397,11 @@ namespace DCFApixels
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region DotQuad
|
#region DotQuad
|
||||||
[IN(LINE)] public DrawHandler DotQuad(Vector3 position) => Mesh<DotQuadMesh, DotMat>(position, Quaternion.identity, new Vector3(DOT_RADIUS, DOT_RADIUS, DOT_RADIUS));
|
[IN(LINE)] public DrawHandler DotQuad(Vector3 position) => Mesh<DotQuadMesh, DotMat>(position, Quaternion.identity, new Vector3(DOT_SIZE, DOT_SIZE, DOT_SIZE));
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region DotDiamond
|
#region DotDiamond
|
||||||
[IN(LINE)] public DrawHandler DotDiamond(Vector3 position) => Mesh<DotDiamondMesh, DotMat>(position, Quaternion.identity, new Vector3(DOT_RADIUS * 0.9f, DOT_RADIUS * 0.9f, DOT_RADIUS * 0.9f));
|
[IN(LINE)] public DrawHandler DotDiamond(Vector3 position) => Mesh<DotDiamondMesh, DotMat>(position, Quaternion.identity, new Vector3(DOT_SIZE * 0.9f, DOT_SIZE * 0.9f, DOT_SIZE * 0.9f));
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DCFApixels
|
namespace DCFApixels.DebugXCore
|
||||||
{
|
{
|
||||||
public static partial class DebugX
|
public static partial class DebugXAssets
|
||||||
{
|
{
|
||||||
|
static DebugXAssets()
|
||||||
|
{
|
||||||
|
Meshes = DebugXUtility.LoadStaticData(new MeshesList(), $"DCFApixels.DebugX/MeshesList");
|
||||||
|
Materials = DebugXUtility.LoadStaticData(new MaterialsList(), $"DCFApixels.DebugX/MaterialsList");
|
||||||
|
}
|
||||||
public static MeshesList Meshes;
|
public static MeshesList Meshes;
|
||||||
public readonly struct MeshesList
|
public readonly struct MeshesList
|
||||||
{
|
{
|
@ -17,105 +17,105 @@ namespace DCFApixels.DebugXCore
|
|||||||
public readonly struct LitMat : IStaticMaterial
|
public readonly struct LitMat : IStaticMaterial
|
||||||
{
|
{
|
||||||
public int GetExecuteOrder() => 0;
|
public int GetExecuteOrder() => 0;
|
||||||
public Material GetMaterial() => DebugX.Materials.Lit;
|
public Material GetMaterial() => DebugXAssets.Materials.Lit;
|
||||||
}
|
}
|
||||||
public readonly struct UnlitMat : IStaticMaterial
|
public readonly struct UnlitMat : IStaticMaterial
|
||||||
{
|
{
|
||||||
public int GetExecuteOrder() => 100_000;
|
public int GetExecuteOrder() => 100_000;
|
||||||
public Material GetMaterial() => DebugX.Materials.Unlit;
|
public Material GetMaterial() => DebugXAssets.Materials.Unlit;
|
||||||
}
|
}
|
||||||
public readonly struct BillboardMat : IStaticMaterial
|
public readonly struct BillboardMat : IStaticMaterial
|
||||||
{
|
{
|
||||||
public int GetExecuteOrder() => 200_000;
|
public int GetExecuteOrder() => 200_000;
|
||||||
public Material GetMaterial() => DebugX.Materials.Billboard;
|
public Material GetMaterial() => DebugXAssets.Materials.Billboard;
|
||||||
}
|
}
|
||||||
public readonly struct DotMat : IStaticMaterial
|
public readonly struct DotMat : IStaticMaterial
|
||||||
{
|
{
|
||||||
public int GetExecuteOrder() => 300_000;
|
public int GetExecuteOrder() => 300_000;
|
||||||
public Material GetMaterial() => DebugX.Materials.Dot;
|
public Material GetMaterial() => DebugXAssets.Materials.Dot;
|
||||||
}
|
}
|
||||||
public readonly struct GeometryUnlitMat : IStaticMaterial
|
public readonly struct GeometryUnlitMat : IStaticMaterial
|
||||||
{
|
{
|
||||||
public int GetExecuteOrder() => 1_000_000;
|
public int GetExecuteOrder() => 1_000_000;
|
||||||
public Material GetMaterial() => DebugX.Materials.Unlit;
|
public Material GetMaterial() => DebugXAssets.Materials.Unlit;
|
||||||
}
|
}
|
||||||
public readonly struct WireMat : IStaticMaterial
|
public readonly struct WireMat : IStaticMaterial
|
||||||
{
|
{
|
||||||
public int GetExecuteOrder() => 1_000_000;
|
public int GetExecuteOrder() => 1_000_000;
|
||||||
public Material GetMaterial() => DebugX.Materials.Wire;
|
public Material GetMaterial() => DebugXAssets.Materials.Wire;
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
public readonly struct SphereMesh : IStaticMesh
|
public readonly struct SphereMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.Sphere;
|
public Mesh GetMesh() => DebugXAssets.Meshes.Sphere;
|
||||||
}
|
}
|
||||||
public readonly struct CubeMesh : IStaticMesh
|
public readonly struct CubeMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.Cube;
|
public Mesh GetMesh() => DebugXAssets.Meshes.Cube;
|
||||||
}
|
}
|
||||||
public readonly struct QuadMesh : IStaticMesh
|
public readonly struct QuadMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.Quad;
|
public Mesh GetMesh() => DebugXAssets.Meshes.Quad;
|
||||||
}
|
}
|
||||||
public readonly struct CircleMesh : IStaticMesh
|
public readonly struct CircleMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.Circle;
|
public Mesh GetMesh() => DebugXAssets.Meshes.Circle;
|
||||||
}
|
}
|
||||||
public readonly struct CapsuleBodyMesh : IStaticMesh
|
public readonly struct CapsuleBodyMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.CapsuleBody;
|
public Mesh GetMesh() => DebugXAssets.Meshes.CapsuleBody;
|
||||||
}
|
}
|
||||||
public readonly struct CapsuleHeadMesh : IStaticMesh
|
public readonly struct CapsuleHeadMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.CapsuleHead;
|
public Mesh GetMesh() => DebugXAssets.Meshes.CapsuleHead;
|
||||||
}
|
}
|
||||||
public readonly struct FlatCapsuleBodyMesh : IStaticMesh
|
public readonly struct FlatCapsuleBodyMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.FlatCapsuleBody;
|
public Mesh GetMesh() => DebugXAssets.Meshes.FlatCapsuleBody;
|
||||||
}
|
}
|
||||||
public readonly struct FlatCapsuleHeadMesh : IStaticMesh
|
public readonly struct FlatCapsuleHeadMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.FlatCapsuleHead;
|
public Mesh GetMesh() => DebugXAssets.Meshes.FlatCapsuleHead;
|
||||||
}
|
}
|
||||||
public readonly struct ArrowMesh : IStaticMesh
|
public readonly struct ArrowMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.Arrow;
|
public Mesh GetMesh() => DebugXAssets.Meshes.Arrow;
|
||||||
}
|
}
|
||||||
public readonly struct DotMesh : IStaticMesh
|
public readonly struct DotMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.Dot;
|
public Mesh GetMesh() => DebugXAssets.Meshes.Dot;
|
||||||
}
|
}
|
||||||
public readonly struct DotQuadMesh : IStaticMesh
|
public readonly struct DotQuadMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.DotQuad;
|
public Mesh GetMesh() => DebugXAssets.Meshes.DotQuad;
|
||||||
}
|
}
|
||||||
public readonly struct DotDiamondMesh : IStaticMesh
|
public readonly struct DotDiamondMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.DotDiamond;
|
public Mesh GetMesh() => DebugXAssets.Meshes.DotDiamond;
|
||||||
}
|
}
|
||||||
public readonly struct DotCrossMesh : IStaticMesh
|
public readonly struct DotCrossMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.DotCross;
|
public Mesh GetMesh() => DebugXAssets.Meshes.DotCross;
|
||||||
}
|
}
|
||||||
public readonly struct WireLineMesh : IStaticMesh
|
public readonly struct WireLineMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.WireLine;
|
public Mesh GetMesh() => DebugXAssets.Meshes.WireLine;
|
||||||
}
|
}
|
||||||
public readonly struct WireCubeMesh : IStaticMesh
|
public readonly struct WireCubeMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.WireCube;
|
public Mesh GetMesh() => DebugXAssets.Meshes.WireCube;
|
||||||
}
|
}
|
||||||
public readonly struct WireArcMesh : IStaticMesh
|
public readonly struct WireArcMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.WireArc;
|
public Mesh GetMesh() => DebugXAssets.Meshes.WireArc;
|
||||||
}
|
}
|
||||||
public readonly struct WireCircleMesh : IStaticMesh
|
public readonly struct WireCircleMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.WireCircle;
|
public Mesh GetMesh() => DebugXAssets.Meshes.WireCircle;
|
||||||
}
|
}
|
||||||
public readonly struct WireSphereMesh : IStaticMesh
|
public readonly struct WireSphereMesh : IStaticMesh
|
||||||
{
|
{
|
||||||
public Mesh GetMesh() => DebugX.Meshes.WireSphere;
|
public Mesh GetMesh() => DebugXAssets.Meshes.WireSphere;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user