From 4743ba68f99f8176b777467b87934b8b9f2aa3bb Mon Sep 17 00:00:00 2001 From: ikpil Date: Thu, 4 Jul 2024 23:34:25 +0900 Subject: [PATCH] Changed static readonly to const --- src/DotRecast.Core/Numerics/RcVec.cs | 2 +- src/DotRecast.Detour/DtConvexConvexIntersections.cs | 2 +- src/DotRecast.Recast.Demo/Draw/DebugDraw.cs | 6 +++--- src/DotRecast.Recast.Demo/Draw/RecastDebugDraw.cs | 6 +++--- .../Builder/SampleAreaModifications.cs | 12 ++++++------ src/DotRecast.Recast.Toolset/Gizmos/RcGizmoHelper.cs | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/DotRecast.Core/Numerics/RcVec.cs b/src/DotRecast.Core/Numerics/RcVec.cs index 6753661..33c473f 100644 --- a/src/DotRecast.Core/Numerics/RcVec.cs +++ b/src/DotRecast.Core/Numerics/RcVec.cs @@ -6,7 +6,7 @@ namespace DotRecast.Core.Numerics public static class RcVec { public const float EPSILON = 1e-6f; - private static readonly float EQUAL_THRESHOLD = RcMath.Sqr(1.0f / 16384.0f); + public static readonly float EQUAL_THRESHOLD = RcMath.Sqr(1.0f / 16384.0f); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static RcVec3f Create(Span values, int n) diff --git a/src/DotRecast.Detour/DtConvexConvexIntersections.cs b/src/DotRecast.Detour/DtConvexConvexIntersections.cs index f66fa61..7537679 100644 --- a/src/DotRecast.Detour/DtConvexConvexIntersections.cs +++ b/src/DotRecast.Detour/DtConvexConvexIntersections.cs @@ -28,7 +28,7 @@ namespace DotRecast.Detour */ public static class DtConvexConvexIntersections { - private static readonly float EPSILON = 0.0001f; + private const float EPSILON = 0.0001f; public static float[] Intersect(float[] p, float[] q) { diff --git a/src/DotRecast.Recast.Demo/Draw/DebugDraw.cs b/src/DotRecast.Recast.Demo/Draw/DebugDraw.cs index 4bd293a..97a5e09 100644 --- a/src/DotRecast.Recast.Demo/Draw/DebugDraw.cs +++ b/src/DotRecast.Recast.Demo/Draw/DebugDraw.cs @@ -326,9 +326,9 @@ public class DebugDraw } } - private static readonly int NUM_ARC_PTS = 8; - private static readonly float PAD = 0.05f; - private static readonly float ARC_PTS_SCALE = (1.0f - PAD * 2) / NUM_ARC_PTS; + private const int NUM_ARC_PTS = 8; + private const float PAD = 0.05f; + private const float ARC_PTS_SCALE = (1.0f - PAD * 2) / NUM_ARC_PTS; public void AppendArc(float x0, float y0, float z0, float x1, float y1, float z1, float h, float as0, float as1, int col) { diff --git a/src/DotRecast.Recast.Demo/Draw/RecastDebugDraw.cs b/src/DotRecast.Recast.Demo/Draw/RecastDebugDraw.cs index 00203bb..e97d9f3 100644 --- a/src/DotRecast.Recast.Demo/Draw/RecastDebugDraw.cs +++ b/src/DotRecast.Recast.Demo/Draw/RecastDebugDraw.cs @@ -33,9 +33,9 @@ using static DtDetour; public class RecastDebugDraw : DebugDraw { - public static readonly int DU_DRAWNAVMESH_OFFMESHCONS = 0x01; - public static readonly int DU_DRAWNAVMESH_CLOSEDLIST = 0x02; - public static readonly int DU_DRAWNAVMESH_COLOR_TILES = 0x04; + public const int DU_DRAWNAVMESH_OFFMESHCONS = 0x01; + public const int DU_DRAWNAVMESH_CLOSEDLIST = 0x02; + public const int DU_DRAWNAVMESH_COLOR_TILES = 0x04; public RecastDebugDraw(GL gl) : base(gl) { diff --git a/src/DotRecast.Recast.Toolset/Builder/SampleAreaModifications.cs b/src/DotRecast.Recast.Toolset/Builder/SampleAreaModifications.cs index 47545e7..9269952 100644 --- a/src/DotRecast.Recast.Toolset/Builder/SampleAreaModifications.cs +++ b/src/DotRecast.Recast.Toolset/Builder/SampleAreaModifications.cs @@ -34,12 +34,12 @@ namespace DotRecast.Recast.Toolset.Builder public const int SAMPLE_POLYAREA_TYPE_JUMP_AUTO = 0x6; public const int SAMPLE_POLYAREA_TYPE_WALKABLE = 0x3f; - public static readonly int SAMPLE_POLYFLAGS_WALK = 0x01; // Ability to walk (ground, grass, road) - public static readonly int SAMPLE_POLYFLAGS_SWIM = 0x02; // Ability to swim (water). - public static readonly int SAMPLE_POLYFLAGS_DOOR = 0x04; // Ability to move through doors. - public static readonly int SAMPLE_POLYFLAGS_JUMP = 0x08; // Ability to jump. - public static readonly int SAMPLE_POLYFLAGS_DISABLED = 0x10; // Disabled polygon - public static readonly int SAMPLE_POLYFLAGS_ALL = 0xffff; // All abilities. + public const int SAMPLE_POLYFLAGS_WALK = 0x01; // Ability to walk (ground, grass, road) + public const int SAMPLE_POLYFLAGS_SWIM = 0x02; // Ability to swim (water). + public const int SAMPLE_POLYFLAGS_DOOR = 0x04; // Ability to move through doors. + public const int SAMPLE_POLYFLAGS_JUMP = 0x08; // Ability to jump. + public const int SAMPLE_POLYFLAGS_DISABLED = 0x10; // Disabled polygon + public const int SAMPLE_POLYFLAGS_ALL = 0xffff; // All abilities. public static readonly RcAreaModification SAMPLE_AREAMOD_WALKABLE = new RcAreaModification(SAMPLE_POLYAREA_TYPE_WALKABLE); public static readonly RcAreaModification SAMPLE_AREAMOD_GROUND = new RcAreaModification(SAMPLE_POLYAREA_TYPE_GROUND); diff --git a/src/DotRecast.Recast.Toolset/Gizmos/RcGizmoHelper.cs b/src/DotRecast.Recast.Toolset/Gizmos/RcGizmoHelper.cs index 72ce931..c814b27 100644 --- a/src/DotRecast.Recast.Toolset/Gizmos/RcGizmoHelper.cs +++ b/src/DotRecast.Recast.Toolset/Gizmos/RcGizmoHelper.cs @@ -4,8 +4,8 @@ namespace DotRecast.Recast.Toolset.Gizmos { public static class RcGizmoHelper { - private static readonly int SEGMENTS = 16; - private static readonly int RINGS = 8; + private const int SEGMENTS = 16; + private const int RINGS = 8; private static float[] sphericalVertices;