diff --git a/src/Box2D.NET.Samples/Samples/Benchmarks/BenchmarkCast.cs b/src/Box2D.NET.Samples/Samples/Benchmarks/BenchmarkCast.cs index 6a56a3f..0981875 100644 --- a/src/Box2D.NET.Samples/Samples/Benchmarks/BenchmarkCast.cs +++ b/src/Box2D.NET.Samples/Samples/Benchmarks/BenchmarkCast.cs @@ -163,7 +163,7 @@ void BuildScene() m_minTime = 1e6f; } - static float CastCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) + static float CastCallback(B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) { CastResult result = context as CastResult; result.point = point; @@ -173,7 +173,7 @@ static float CastCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, flo } - static bool OverlapCallback(in B2ShapeId shapeId, object context) + static bool OverlapCallback(B2ShapeId shapeId, object context) { OverlapResult result = context as OverlapResult; if (result.count < 32) diff --git a/src/Box2D.NET.Samples/Samples/Benchmarks/BenchmarkSensor.cs b/src/Box2D.NET.Samples/Samples/Benchmarks/BenchmarkSensor.cs index e2420d3..d34dce2 100644 --- a/src/Box2D.NET.Samples/Samples/Benchmarks/BenchmarkSensor.cs +++ b/src/Box2D.NET.Samples/Samples/Benchmarks/BenchmarkSensor.cs @@ -143,7 +143,7 @@ void CreateRow(float y) } } - private bool Filter(in B2ShapeId idA, in B2ShapeId idB) + private bool Filter(B2ShapeId idA, B2ShapeId idB) { ShapeUserData userData = null; if (b2Shape_IsSensor(idA)) @@ -163,7 +163,7 @@ private bool Filter(in B2ShapeId idA, in B2ShapeId idB) return true; } - private static bool FilterFcn(in B2ShapeId idA, in B2ShapeId idB, object context) + private static bool FilterFcn(B2ShapeId idA, B2ShapeId idB, object context) { BenchmarkSensor self = context as BenchmarkSensor; return self.Filter(idA, idB); diff --git a/src/Box2D.NET.Samples/Samples/Characters/Mover.cs b/src/Box2D.NET.Samples/Samples/Characters/Mover.cs index b98269c..4c599ed 100644 --- a/src/Box2D.NET.Samples/Samples/Characters/Mover.cs +++ b/src/Box2D.NET.Samples/Samples/Characters/Mover.cs @@ -93,7 +93,7 @@ private static Sample Create(SampleContext context) return new Mover(context); } - private static float CastCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) + private static float CastCallback(B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) { CastResult result = (CastResult)context; result.point = point; @@ -497,7 +497,7 @@ public override void UpdateGui() ImGui.End(); } - static bool PlaneResultFcn(in B2ShapeId shapeId, ref B2PlaneResult planeResult, object context) + static bool PlaneResultFcn(B2ShapeId shapeId, ref B2PlaneResult planeResult, object context) { B2_ASSERT(planeResult.hit == true); @@ -521,7 +521,7 @@ static bool PlaneResultFcn(in B2ShapeId shapeId, ref B2PlaneResult planeResult, return true; } - static bool Kick(in B2ShapeId shapeId, object context) + static bool Kick(B2ShapeId shapeId, object context) { Mover self = (Mover)context; B2BodyId bodyId = b2Shape_GetBody(shapeId); diff --git a/src/Box2D.NET.Samples/Samples/Collisions/CastWorld.cs b/src/Box2D.NET.Samples/Samples/Collisions/CastWorld.cs index 17147af..378ca1d 100644 --- a/src/Box2D.NET.Samples/Samples/Collisions/CastWorld.cs +++ b/src/Box2D.NET.Samples/Samples/Collisions/CastWorld.cs @@ -556,7 +556,7 @@ public override void Draw() // This callback finds the closest hit. This is the most common callback used in games. - static float RayCastClosestCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) + static float RayCastClosestCallback(B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) { CastContext rayContext = (CastContext)context; @@ -584,7 +584,7 @@ static float RayCastClosestCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 n // This callback finds any hit. For this type of query we are usually just checking for obstruction, // so the hit data is not relevant. // NOTE: shape hits are not ordered, so this may not return the closest hit - static float RayCastAnyCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) + static float RayCastAnyCallback(B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) { CastContext rayContext = (CastContext)context; @@ -614,7 +614,7 @@ static float RayCastAnyCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 norma // NOTE: shape hits are not ordered, so this may return hits in any order. This means that // if you limit the number of results, you may discard the closest hit. You can see this // behavior in the sample. - static float RayCastMultipleCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) + static float RayCastMultipleCallback(B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) { CastContext rayContext = (CastContext)context; @@ -648,7 +648,7 @@ static float RayCastMultipleCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 } // This ray cast collects multiple hits along the ray and sorts them. - static float RayCastSortedCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) + static float RayCastSortedCallback(B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) { CastContext rayContext = (CastContext)context; diff --git a/src/Box2D.NET.Samples/Samples/Collisions/OverlapWorld.cs b/src/Box2D.NET.Samples/Samples/Collisions/OverlapWorld.cs index 89edd20..92978fc 100644 --- a/src/Box2D.NET.Samples/Samples/Collisions/OverlapWorld.cs +++ b/src/Box2D.NET.Samples/Samples/Collisions/OverlapWorld.cs @@ -64,7 +64,7 @@ private static Sample Create(SampleContext context) } - static bool OverlapResultFcn(in B2ShapeId shapeId, object context) + static bool OverlapResultFcn(B2ShapeId shapeId, object context) { ShapeUserData userData = b2Shape_GetUserData(shapeId).GetRef(); if (userData != null && userData.ignore) diff --git a/src/Box2D.NET.Samples/Samples/Events/Platform.cs b/src/Box2D.NET.Samples/Samples/Events/Platform.cs index 3e62c56..c772f26 100644 --- a/src/Box2D.NET.Samples/Samples/Events/Platform.cs +++ b/src/Box2D.NET.Samples/Samples/Events/Platform.cs @@ -116,7 +116,7 @@ public Platform(SampleContext context) : base(context) m_jumping = false; } - private static bool PreSolveStatic(in B2ShapeId shapeIdA, in B2ShapeId shapeIdB, B2Vec2 point, B2Vec2 normal, object context) + private static bool PreSolveStatic(B2ShapeId shapeIdA, B2ShapeId shapeIdB, B2Vec2 point, B2Vec2 normal, object context) { Platform self = context as Platform; return self.PreSolve(shapeIdA, shapeIdB, point, normal); @@ -125,7 +125,7 @@ private static bool PreSolveStatic(in B2ShapeId shapeIdA, in B2ShapeId shapeIdB, // This callback must be thread-safe. It may be called multiple times simultaneously. // Notice how this method is constant and doesn't change any data. It also // does not try to access any values in the world that may be changing, such as contact data. - public bool PreSolve(in B2ShapeId shapeIdA, in B2ShapeId shapeIdB, B2Vec2 point, B2Vec2 normal) + public bool PreSolve(B2ShapeId shapeIdA, B2ShapeId shapeIdB, B2Vec2 point, B2Vec2 normal) { B2_ASSERT(b2Shape_IsValid(shapeIdA)); B2_ASSERT(b2Shape_IsValid(shapeIdB)); diff --git a/src/Box2D.NET.Samples/Samples/Events/SensorHits.cs b/src/Box2D.NET.Samples/Samples/Events/SensorHits.cs index c314cf3..ca22722 100644 --- a/src/Box2D.NET.Samples/Samples/Events/SensorHits.cs +++ b/src/Box2D.NET.Samples/Samples/Events/SensorHits.cs @@ -189,7 +189,7 @@ public override void UpdateGui() ImGui.End(); } - void CollectTransforms(in B2ShapeId sensorShapeId) + void CollectTransforms(B2ShapeId sensorShapeId) { const int capacity = 5; Span visitorIds = stackalloc B2ShapeId[capacity]; diff --git a/src/Box2D.NET.Samples/Samples/Events/SensorTypes.cs b/src/Box2D.NET.Samples/Samples/Events/SensorTypes.cs index 731aac3..b639eb8 100644 --- a/src/Box2D.NET.Samples/Samples/Events/SensorTypes.cs +++ b/src/Box2D.NET.Samples/Samples/Events/SensorTypes.cs @@ -139,7 +139,7 @@ public SensorTypes(SampleContext context) : base(context) } } - void PrintOverlaps(in B2ShapeId sensorShapeId, string prefix) + void PrintOverlaps(B2ShapeId sensorShapeId, string prefix) { // Determine the necessary capacity int capacity = b2Shape_GetSensorCapacity(sensorShapeId); diff --git a/src/Box2D.NET.Samples/Samples/Issues/ShapeCastChain.cs b/src/Box2D.NET.Samples/Samples/Issues/ShapeCastChain.cs index af8233f..9e86f78 100644 --- a/src/Box2D.NET.Samples/Samples/Issues/ShapeCastChain.cs +++ b/src/Box2D.NET.Samples/Samples/Issues/ShapeCastChain.cs @@ -234,7 +234,7 @@ private bool ShapeCastSingle(ref PhysicsHitQueryResult2D outResult, B2Vec2 start return false; } - private static float b2CastResult_Closest(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object c) + private static float b2CastResult_Closest(B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object c) { CastContext_Single context = c as CastContext_Single; diff --git a/src/Box2D.NET.Samples/Samples/Sample.cs b/src/Box2D.NET.Samples/Samples/Sample.cs index 84fc1dd..2ceb5a8 100644 --- a/src/Box2D.NET.Samples/Samples/Sample.cs +++ b/src/Box2D.NET.Samples/Samples/Sample.cs @@ -251,7 +251,7 @@ public void ResetText() m_textLine = m_textIncrement; } - public bool QueryCallback(in B2ShapeId shapeId, object context) + public bool QueryCallback(B2ShapeId shapeId, object context) { QueryContext queryContext = context as QueryContext; diff --git a/src/Box2D.NET.Samples/Samples/Shapes/CustomFilter.cs b/src/Box2D.NET.Samples/Samples/Shapes/CustomFilter.cs index 7cd0d6b..eb3d6d6 100644 --- a/src/Box2D.NET.Samples/Samples/Shapes/CustomFilter.cs +++ b/src/Box2D.NET.Samples/Samples/Shapes/CustomFilter.cs @@ -73,7 +73,7 @@ public override void Step() base.Step(); } - bool ShouldCollide(in B2ShapeId shapeIdA, in B2ShapeId shapeIdB) + bool ShouldCollide(B2ShapeId shapeIdA, B2ShapeId shapeIdB) { var userDataA = b2Shape_GetUserData(shapeIdA); var userDataB = b2Shape_GetUserData(shapeIdB); @@ -89,7 +89,7 @@ bool ShouldCollide(in B2ShapeId shapeIdA, in B2ShapeId shapeIdB) return ((indexA & 1) + (indexB & 1)) != 1; } - static bool CustomFilterStatic(in B2ShapeId shapeIdA, in B2ShapeId shapeIdB, object context) + static bool CustomFilterStatic(B2ShapeId shapeIdA, B2ShapeId shapeIdB, object context) { CustomFilter customFilter = context as CustomFilter; diff --git a/src/Box2D.NET/B2ContactBeginTouchEvent.cs b/src/Box2D.NET/B2ContactBeginTouchEvent.cs index 8216897..f6863c8 100644 --- a/src/Box2D.NET/B2ContactBeginTouchEvent.cs +++ b/src/Box2D.NET/B2ContactBeginTouchEvent.cs @@ -17,7 +17,7 @@ public struct B2ContactBeginTouchEvent /// Used b2Contact_IsValid before using this id. public B2ContactId contactId; - public B2ContactBeginTouchEvent(in B2ShapeId shapeIdA, in B2ShapeId shapeIdB, in B2ContactId contactId) + public B2ContactBeginTouchEvent(B2ShapeId shapeIdA, B2ShapeId shapeIdB, B2ContactId contactId) { this.shapeIdA = shapeIdA; this.shapeIdB = shapeIdB; diff --git a/src/Box2D.NET/B2ContactData.cs b/src/Box2D.NET/B2ContactData.cs index 1d3e42f..d2a1331 100644 --- a/src/Box2D.NET/B2ContactData.cs +++ b/src/Box2D.NET/B2ContactData.cs @@ -14,7 +14,7 @@ public struct B2ContactData public B2ShapeId shapeIdB; public B2Manifold manifold; - public B2ContactData(in B2ContactId contactId, in B2ShapeId shapeIdA, in B2ShapeId shapeIdB, in B2Manifold manifold) + public B2ContactData(B2ContactId contactId, B2ShapeId shapeIdA, B2ShapeId shapeIdB, in B2Manifold manifold) { this.contactId = contactId; this.shapeIdA = shapeIdA; diff --git a/src/Box2D.NET/B2ContactEndTouchEvent.cs b/src/Box2D.NET/B2ContactEndTouchEvent.cs index 37faf1d..157480b 100644 --- a/src/Box2D.NET/B2ContactEndTouchEvent.cs +++ b/src/Box2D.NET/B2ContactEndTouchEvent.cs @@ -25,7 +25,7 @@ public struct B2ContactEndTouchEvent /// @see b2Contact_IsValid public B2ContactId contactId; - public B2ContactEndTouchEvent(in B2ShapeId shapeIdA, in B2ShapeId shapeIdB, in B2ContactId contactId) + public B2ContactEndTouchEvent(B2ShapeId shapeIdA, B2ShapeId shapeIdB, B2ContactId contactId) { this.shapeIdA = shapeIdA; this.shapeIdB = shapeIdB; diff --git a/src/Box2D.NET/B2Contacts.cs b/src/Box2D.NET/B2Contacts.cs index 917ec9c..21203af 100644 --- a/src/Box2D.NET/B2Contacts.cs +++ b/src/Box2D.NET/B2Contacts.cs @@ -630,7 +630,7 @@ internal static bool b2UpdateContact(B2World world, B2ContactSim contactSim, B2S return touching; } - internal static B2Contact b2GetContactFullId(B2World world, in B2ContactId contactId) + internal static B2Contact b2GetContactFullId(B2World world, B2ContactId contactId) { int id = contactId.index1 - 1; B2Contact contact = b2Array_Get(ref world.contacts, id); @@ -640,7 +640,7 @@ internal static B2Contact b2GetContactFullId(B2World world, in B2ContactId conta /// Get the data for a contact. The manifold may have no points if the contact is not touching. - public static B2ContactData b2Contact_GetData(in B2ContactId contactId) + public static B2ContactData b2Contact_GetData(B2ContactId contactId) { B2World world = b2GetWorld(contactId.world0); B2Contact contact = b2GetContactFullId(world, contactId); diff --git a/src/Box2D.NET/B2Delegates.cs b/src/Box2D.NET/B2Delegates.cs index 7036093..b9bad37 100644 --- a/src/Box2D.NET/B2Delegates.cs +++ b/src/Box2D.NET/B2Delegates.cs @@ -81,7 +81,7 @@ namespace Box2D.NET /// @see b2ShapeDef /// @warning Do not attempt to modify the world inside this callback /// @ingroup world - public delegate bool b2CustomFilterFcn(in B2ShapeId shapeIdA, in B2ShapeId shapeIdB, object context); + public delegate bool b2CustomFilterFcn(B2ShapeId shapeIdA, B2ShapeId shapeIdB, object context); /// Prototype for a pre-solve callback. /// This is called after a contact is updated. This allows you to inspect a @@ -96,14 +96,14 @@ namespace Box2D.NET /// Return false if you want to disable the contact this step /// @warning Do not attempt to modify the world inside this callback /// @ingroup world - public delegate bool b2PreSolveFcn(in B2ShapeId shapeIdA, in B2ShapeId shapeIdB, B2Vec2 point, B2Vec2 normal, object context); + public delegate bool b2PreSolveFcn(B2ShapeId shapeIdA, B2ShapeId shapeIdB, B2Vec2 point, B2Vec2 normal, object context); /// Prototype callback for overlap queries. /// Called for each shape found in the query. /// @see b2World_OverlapABB /// @return false to terminate the query. /// @ingroup world - public delegate bool b2OverlapResultFcn(in B2ShapeId shapeId, object context); + public delegate bool b2OverlapResultFcn(B2ShapeId shapeId, object context); /// Prototype callback for ray and shape casts. /// Called for each shape found in the query. You control how the ray cast @@ -121,11 +121,11 @@ namespace Box2D.NET /// @return -1 to filter, 0 to terminate, fraction to clip the ray for closest hit, 1 to continue /// @see b2World_CastRay /// @ingroup world - public delegate float b2CastResultFcn(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context); + public delegate float b2CastResultFcn(B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context); // Used to collect collision planes for character movers. // Return true to continue gathering planes. - public delegate bool b2PlaneResultFcn(in B2ShapeId shapeId, ref B2PlaneResult plane, object context); + public delegate bool b2PlaneResultFcn(B2ShapeId shapeId, ref B2PlaneResult plane, object context); // Manifold functions should compute important results in local space to improve precision. However, this // interface function takes two world transforms instead of a relative transform for these reasons: diff --git a/src/Box2D.NET/B2Ids.cs b/src/Box2D.NET/B2Ids.cs index 660a976..71f80bc 100644 --- a/src/Box2D.NET/B2Ids.cs +++ b/src/Box2D.NET/B2Ids.cs @@ -52,7 +52,7 @@ public static class B2Ids public static bool B2_IS_NULL(B2BodyId id) => id.index1 == 0; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool B2_IS_NULL(in B2ShapeId id) => id.index1 == 0; + public static bool B2_IS_NULL(B2ShapeId id) => id.index1 == 0; [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool B2_IS_NULL(B2ChainId id) => id.index1 == 0; @@ -68,7 +68,7 @@ public static class B2Ids public static bool B2_IS_NON_NULL(B2BodyId id) => id.index1 != 0; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool B2_IS_NON_NULL(in B2ShapeId id) => id.index1 != 0; + public static bool B2_IS_NON_NULL(B2ShapeId id) => id.index1 != 0; [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool B2_IS_NON_NULL(B2ChainId id) => id.index1 != 0; @@ -77,14 +77,14 @@ public static class B2Ids public static bool B2_IS_NON_NULL(B2JointId id) => id.index1 != 0; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool B2_IS_NON_NULL(in B2ContactId id) => id.index1 != 0; + public static bool B2_IS_NON_NULL(B2ContactId id) => id.index1 != 0; /// Compare two ids for equality. Doesn't work for b2WorldId. Don't mix types. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool B2_ID_EQUALS(B2BodyId id1, B2BodyId id2) => id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.generation == id2.generation; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool B2_ID_EQUALS(in B2ShapeId id1, in B2ShapeId id2) => id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.generation == id2.generation; + public static bool B2_ID_EQUALS(B2ShapeId id1, B2ShapeId id2) => id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.generation == id2.generation; [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool B2_ID_EQUALS(B2ChainId id1, B2ChainId id2) => id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.generation == id2.generation; @@ -92,7 +92,7 @@ public static class B2Ids public static bool B2_ID_EQUALS(B2JointId id1, B2JointId id2) => id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.generation == id2.generation; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool B2_ID_EQUALS(in B2ContactId id1, in B2ContactId id2) => id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.generation == id2.generation; + public static bool B2_ID_EQUALS(B2ContactId id1, B2ContactId id2) => id1.index1 == id2.index1 && id1.world0 == id2.world0 && id1.generation == id2.generation; /// Store a world id into a uint32_t. [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -126,7 +126,7 @@ public static B2BodyId b2LoadBodyId(ulong x) /// Store a shape id into a ulong. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ulong b2StoreShapeId(in B2ShapeId id) + public static ulong b2StoreShapeId(B2ShapeId id) { return ((ulong)id.index1 << 32) | ((ulong)id.world0) << 16 | (ulong)id.generation; } @@ -171,7 +171,7 @@ public static B2JointId b2LoadJointId(ulong x) /// Store a contact id into 16 bytes [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void b2StoreContactId(in B2ContactId id, Span values) + public static void b2StoreContactId(B2ContactId id, Span values) { values[0] = (uint)id.index1; values[1] = (uint)id.world0; diff --git a/src/Box2D.NET/B2SensorBeginTouchEvent.cs b/src/Box2D.NET/B2SensorBeginTouchEvent.cs index 83b8954..8b2de6c 100644 --- a/src/Box2D.NET/B2SensorBeginTouchEvent.cs +++ b/src/Box2D.NET/B2SensorBeginTouchEvent.cs @@ -29,7 +29,7 @@ public struct B2SensorBeginTouchEvent /// The id of the shape that began touching the sensor shape public B2ShapeId visitorShapeId; - public B2SensorBeginTouchEvent(in B2ShapeId sensorShapeId, in B2ShapeId visitorShapeId) + public B2SensorBeginTouchEvent(B2ShapeId sensorShapeId, B2ShapeId visitorShapeId) { this.sensorShapeId = sensorShapeId; this.visitorShapeId = visitorShapeId; diff --git a/src/Box2D.NET/B2SensorEndTouchEvent.cs b/src/Box2D.NET/B2SensorEndTouchEvent.cs index bc11d4a..2b36307 100644 --- a/src/Box2D.NET/B2SensorEndTouchEvent.cs +++ b/src/Box2D.NET/B2SensorEndTouchEvent.cs @@ -20,7 +20,7 @@ public struct B2SensorEndTouchEvent /// @see b2Shape_IsValid public B2ShapeId visitorShapeId; - public B2SensorEndTouchEvent(in B2ShapeId sensorShapeId, in B2ShapeId visitorShapeId) + public B2SensorEndTouchEvent(B2ShapeId sensorShapeId, B2ShapeId visitorShapeId) { this.sensorShapeId = sensorShapeId; this.visitorShapeId = visitorShapeId; diff --git a/src/Box2D.NET/B2Shapes.cs b/src/Box2D.NET/B2Shapes.cs index b422668..a681757 100644 --- a/src/Box2D.NET/B2Shapes.cs +++ b/src/Box2D.NET/B2Shapes.cs @@ -58,7 +58,7 @@ internal static bool b2ShouldQueryCollide(in B2Filter shapeFilter, in B2QueryFil } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static B2Shape b2GetShape(B2World world, in B2ShapeId shapeId) + internal static B2Shape b2GetShape(B2World world, B2ShapeId shapeId) { int id = shapeId.index1 - 1; B2Shape shape = b2Array_Get(ref world.shapes, id); @@ -360,7 +360,7 @@ public static void b2DestroyShapeInternal(B2World world, B2Shape shape, B2Body b b2ValidateSolverSets(world); } - public static void b2DestroyShape(in B2ShapeId shapeId, bool updateBodyMass) + public static void b2DestroyShape(B2ShapeId shapeId, bool updateBodyMass) { B2World world = b2GetWorldLocked(shapeId.world0); if (world == null) @@ -1016,27 +1016,27 @@ public static B2ShapeProxy b2MakeShapeDistanceProxy(B2Shape shape) } } - public static B2BodyId b2Shape_GetBody(in B2ShapeId shapeId) + public static B2BodyId b2Shape_GetBody(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); return b2MakeBodyId(world, shape.bodyId); } - public static B2WorldId b2Shape_GetWorld(in B2ShapeId shapeId) + public static B2WorldId b2Shape_GetWorld(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); return new B2WorldId((ushort)(shapeId.world0 + 1), world.generation); } - public static void b2Shape_SetUserData(in B2ShapeId shapeId, B2UserData userData) + public static void b2Shape_SetUserData(B2ShapeId shapeId, B2UserData userData) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); shape.userData = userData; } - public static B2UserData b2Shape_GetUserData(in B2ShapeId shapeId) + public static B2UserData b2Shape_GetUserData(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1046,14 +1046,14 @@ public static B2UserData b2Shape_GetUserData(in B2ShapeId shapeId) /// Returns true if the shape is a sensor. It is not possible to change a shape /// from sensor to solid dynamically because this breaks the contract for /// sensor events. - public static bool b2Shape_IsSensor(in B2ShapeId shapeId) + public static bool b2Shape_IsSensor(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); return shape.sensorIndex != B2_NULL_INDEX; } - public static bool b2Shape_TestPoint(in B2ShapeId shapeId, B2Vec2 point) + public static bool b2Shape_TestPoint(B2ShapeId shapeId, B2Vec2 point) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1078,7 +1078,7 @@ public static bool b2Shape_TestPoint(in B2ShapeId shapeId, B2Vec2 point) } // todo_erin untested - internal static B2CastOutput b2Shape_RayCast(in B2ShapeId shapeId, in B2RayCastInput input) + internal static B2CastOutput b2Shape_RayCast(B2ShapeId shapeId, in B2RayCastInput input) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1129,7 +1129,7 @@ internal static B2CastOutput b2Shape_RayCast(in B2ShapeId shapeId, in B2RayCastI return output; } - public static void b2Shape_SetDensity(in B2ShapeId shapeId, float density, bool updateBodyMass) + public static void b2Shape_SetDensity(B2ShapeId shapeId, float density, bool updateBodyMass) { B2_ASSERT(b2IsValidFloat(density) && density >= 0.0f); @@ -1155,7 +1155,7 @@ public static void b2Shape_SetDensity(in B2ShapeId shapeId, float density, bool } } - public static float b2Shape_GetDensity(in B2ShapeId shapeId) + public static float b2Shape_GetDensity(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1163,7 +1163,7 @@ public static float b2Shape_GetDensity(in B2ShapeId shapeId) } /// Set the friction on a shape - public static void b2Shape_SetFriction(in B2ShapeId shapeId, float friction) + public static void b2Shape_SetFriction(B2ShapeId shapeId, float friction) { B2_ASSERT(b2IsValidFloat(friction) && friction >= 0.0f); @@ -1178,14 +1178,14 @@ public static void b2Shape_SetFriction(in B2ShapeId shapeId, float friction) shape.material.friction = friction; } - public static float b2Shape_GetFriction(in B2ShapeId shapeId) + public static float b2Shape_GetFriction(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); return shape.material.friction; } - public static void b2Shape_SetRestitution(in B2ShapeId shapeId, float restitution) + public static void b2Shape_SetRestitution(B2ShapeId shapeId, float restitution) { B2_ASSERT(b2IsValidFloat(restitution) && restitution >= 0.0f); @@ -1200,7 +1200,7 @@ public static void b2Shape_SetRestitution(in B2ShapeId shapeId, float restitutio shape.material.restitution = restitution; } - public static float b2Shape_GetRestitution(in B2ShapeId shapeId) + public static float b2Shape_GetRestitution(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1208,7 +1208,7 @@ public static float b2Shape_GetRestitution(in B2ShapeId shapeId) } /// Set the user material identifier - public static void b2Shape_SetUserMaterial(in B2ShapeId shapeId, ulong material) + public static void b2Shape_SetUserMaterial(B2ShapeId shapeId, ulong material) { B2World world = b2GetWorld(shapeId.world0); B2_ASSERT(world.locked == false); @@ -1222,7 +1222,7 @@ public static void b2Shape_SetUserMaterial(in B2ShapeId shapeId, ulong material) } /// Get the user material identifier - public static ulong b2Shape_GetUserMaterial(in B2ShapeId shapeId) + public static ulong b2Shape_GetUserMaterial(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1230,7 +1230,7 @@ public static ulong b2Shape_GetUserMaterial(in B2ShapeId shapeId) } /// Get the shape surface material - public static B2SurfaceMaterial b2Shape_GetSurfaceMaterial(in B2ShapeId shapeId) + public static B2SurfaceMaterial b2Shape_GetSurfaceMaterial(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1238,14 +1238,14 @@ public static B2SurfaceMaterial b2Shape_GetSurfaceMaterial(in B2ShapeId shapeId) } /// Set the shape surface material - public static void b2Shape_SetSurfaceMaterial(in B2ShapeId shapeId, in B2SurfaceMaterial surfaceMaterial) + public static void b2Shape_SetSurfaceMaterial(B2ShapeId shapeId, in B2SurfaceMaterial surfaceMaterial) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); shape.material = surfaceMaterial; } - public static B2Filter b2Shape_GetFilter(in B2ShapeId shapeId) + public static B2Filter b2Shape_GetFilter(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1306,7 +1306,7 @@ internal static void b2ResetProxy(B2World world, B2Shape shape, bool wakeBodies, /// contacts to be immediately destroyed. However contacts are not created until the next world step. /// Sensor overlap state is also not updated until the next world step. /// @see b2ShapeDef::filter - public static void b2Shape_SetFilter(in B2ShapeId shapeId, in B2Filter filter) + public static void b2Shape_SetFilter(B2ShapeId shapeId, in B2Filter filter) { B2World world = b2GetWorldLocked(shapeId.world0); if (world == null) @@ -1336,7 +1336,7 @@ public static void b2Shape_SetFilter(in B2ShapeId shapeId, in B2Filter filter) /// Enable sensor events for this shape. /// @see b2ShapeDef::enableSensorEvents - public static void b2Shape_EnableSensorEvents(in B2ShapeId shapeId, bool flag) + public static void b2Shape_EnableSensorEvents(B2ShapeId shapeId, bool flag) { B2World world = b2GetWorldLocked(shapeId.world0); if (world == null) @@ -1349,14 +1349,14 @@ public static void b2Shape_EnableSensorEvents(in B2ShapeId shapeId, bool flag) } /// Returns true if sensor events are enabled. - public static bool b2Shape_AreSensorEventsEnabled(in B2ShapeId shapeId) + public static bool b2Shape_AreSensorEventsEnabled(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); return shape.enableSensorEvents; } - public static void b2Shape_EnableContactEvents(in B2ShapeId shapeId, bool flag) + public static void b2Shape_EnableContactEvents(B2ShapeId shapeId, bool flag) { B2World world = b2GetWorldLocked(shapeId.world0); if (world == null) @@ -1368,14 +1368,14 @@ public static void b2Shape_EnableContactEvents(in B2ShapeId shapeId, bool flag) shape.enableContactEvents = flag; } - internal static bool b2Shape_AreContactEventsEnabled(in B2ShapeId shapeId) + internal static bool b2Shape_AreContactEventsEnabled(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); return shape.enableContactEvents; } - public static void b2Shape_EnablePreSolveEvents(in B2ShapeId shapeId, bool flag) + public static void b2Shape_EnablePreSolveEvents(B2ShapeId shapeId, bool flag) { B2World world = b2GetWorldLocked(shapeId.world0); if (world == null) @@ -1387,14 +1387,14 @@ public static void b2Shape_EnablePreSolveEvents(in B2ShapeId shapeId, bool flag) shape.enablePreSolveEvents = flag; } - internal static bool b2Shape_ArePreSolveEventsEnabled(in B2ShapeId shapeId) + internal static bool b2Shape_ArePreSolveEventsEnabled(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); return shape.enablePreSolveEvents; } - public static void b2Shape_EnableHitEvents(in B2ShapeId shapeId, bool flag) + public static void b2Shape_EnableHitEvents(B2ShapeId shapeId, bool flag) { B2World world = b2GetWorldLocked(shapeId.world0); if (world == null) @@ -1406,21 +1406,21 @@ public static void b2Shape_EnableHitEvents(in B2ShapeId shapeId, bool flag) shape.enableHitEvents = flag; } - internal static bool b2Shape_AreHitEventsEnabled(in B2ShapeId shapeId) + internal static bool b2Shape_AreHitEventsEnabled(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); return shape.enableHitEvents; } - public static B2ShapeType b2Shape_GetType(in B2ShapeId shapeId) + public static B2ShapeType b2Shape_GetType(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); return shape.type; } - public static B2Circle b2Shape_GetCircle(in B2ShapeId shapeId) + public static B2Circle b2Shape_GetCircle(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1428,7 +1428,7 @@ public static B2Circle b2Shape_GetCircle(in B2ShapeId shapeId) return shape.us.circle; } - public static B2Segment b2Shape_GetSegment(in B2ShapeId shapeId) + public static B2Segment b2Shape_GetSegment(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1436,7 +1436,7 @@ public static B2Segment b2Shape_GetSegment(in B2ShapeId shapeId) return shape.us.segment; } - public static B2ChainSegment b2Shape_GetChainSegment(in B2ShapeId shapeId) + public static B2ChainSegment b2Shape_GetChainSegment(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1444,7 +1444,7 @@ public static B2ChainSegment b2Shape_GetChainSegment(in B2ShapeId shapeId) return shape.us.chainSegment; } - public static B2Capsule b2Shape_GetCapsule(in B2ShapeId shapeId) + public static B2Capsule b2Shape_GetCapsule(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1452,7 +1452,7 @@ public static B2Capsule b2Shape_GetCapsule(in B2ShapeId shapeId) return shape.us.capsule; } - public static B2Polygon b2Shape_GetPolygon(in B2ShapeId shapeId) + public static B2Polygon b2Shape_GetPolygon(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1460,7 +1460,7 @@ public static B2Polygon b2Shape_GetPolygon(in B2ShapeId shapeId) return shape.us.polygon; } - public static void b2Shape_SetCircle(in B2ShapeId shapeId, in B2Circle circle) + public static void b2Shape_SetCircle(B2ShapeId shapeId, in B2Circle circle) { B2World world = b2GetWorldLocked(shapeId.world0); if (world == null) @@ -1478,7 +1478,7 @@ public static void b2Shape_SetCircle(in B2ShapeId shapeId, in B2Circle circle) b2ResetProxy(world, shape, wakeBodies, destroyProxy); } - public static void b2Shape_SetCapsule(in B2ShapeId shapeId, in B2Capsule capsule) + public static void b2Shape_SetCapsule(B2ShapeId shapeId, in B2Capsule capsule) { B2World world = b2GetWorldLocked(shapeId.world0); if (world == null) @@ -1502,7 +1502,7 @@ public static void b2Shape_SetCapsule(in B2ShapeId shapeId, in B2Capsule capsule b2ResetProxy(world, shape, wakeBodies, destroyProxy); } - public static void b2Shape_SetSegment(in B2ShapeId shapeId, in B2Segment segment) + public static void b2Shape_SetSegment(B2ShapeId shapeId, in B2Segment segment) { B2World world = b2GetWorldLocked(shapeId.world0); if (world == null) @@ -1520,7 +1520,7 @@ public static void b2Shape_SetSegment(in B2ShapeId shapeId, in B2Segment segment b2ResetProxy(world, shape, wakeBodies, destroyProxy); } - public static void b2Shape_SetPolygon(in B2ShapeId shapeId, ref B2Polygon polygon) + public static void b2Shape_SetPolygon(B2ShapeId shapeId, ref B2Polygon polygon) { B2World world = b2GetWorldLocked(shapeId.world0); if (world == null) @@ -1538,7 +1538,7 @@ public static void b2Shape_SetPolygon(in B2ShapeId shapeId, ref B2Polygon polygo b2ResetProxy(world, shape, wakeBodies, destroyProxy); } - public static B2ChainId b2Shape_GetParentChain(in B2ShapeId shapeId) + public static B2ChainId b2Shape_GetParentChain(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1607,7 +1607,7 @@ public static B2SurfaceMaterial b2Chain_GetSurfaceMaterial(B2ChainId chainId, in return chainShape.materials[segmentIndex]; } - public static int b2Shape_GetContactCapacity(in B2ShapeId shapeId) + public static int b2Shape_GetContactCapacity(B2ShapeId shapeId) { B2World world = b2GetWorldLocked(shapeId.world0); if (world == null) @@ -1627,7 +1627,7 @@ public static int b2Shape_GetContactCapacity(in B2ShapeId shapeId) return body.contactCount; } - public static int b2Shape_GetContactData(in B2ShapeId shapeId, Span contactData, int capacity) + public static int b2Shape_GetContactData(B2ShapeId shapeId, Span contactData, int capacity) { B2World world = b2GetWorldLocked(shapeId.world0); if (world == null) @@ -1675,7 +1675,7 @@ public static int b2Shape_GetContactData(in B2ShapeId shapeId, Span visitorIds, int capacity) + public static int b2Shape_GetSensorData(B2ShapeId shapeId, Span visitorIds, int capacity) { B2World world = b2GetWorldLocked(shapeId.world0); if (world == null) @@ -1733,7 +1733,7 @@ public static int b2Shape_GetSensorData(in B2ShapeId shapeId, Span vi } /// Get the current world AABB - public static B2AABB b2Shape_GetAABB(in B2ShapeId shapeId) + public static B2AABB b2Shape_GetAABB(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); if (world == null) @@ -1746,7 +1746,7 @@ public static B2AABB b2Shape_GetAABB(in B2ShapeId shapeId) } /// Compute the mass data for a shape - internal static B2MassData b2Shape_ComputeMassData(in B2ShapeId shapeId) + internal static B2MassData b2Shape_ComputeMassData(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); if (world == null) @@ -1758,7 +1758,7 @@ internal static B2MassData b2Shape_ComputeMassData(in B2ShapeId shapeId) return b2ComputeShapeMass(shape); } - public static B2Vec2 b2Shape_GetClosestPoint(in B2ShapeId shapeId, B2Vec2 target) + public static B2Vec2 b2Shape_GetClosestPoint(B2ShapeId shapeId, B2Vec2 target) { B2World world = b2GetWorld(shapeId.world0); if (world == null) @@ -1796,7 +1796,7 @@ public static B2Vec2 b2Shape_GetClosestPoint(in B2ShapeId shapeId, B2Vec2 target /// @param drag the drag coefficient, the force that opposes the relative velocity /// @param lift the lift coefficient, the force that is perpendicular to the relative velocity /// @param wake should this wake the body - public static void b2Shape_ApplyWind(in B2ShapeId shapeId, B2Vec2 wind, float drag, float lift, bool wake) + public static void b2Shape_ApplyWind(B2ShapeId shapeId, B2Vec2 wind, float drag, float lift, bool wake) { B2World world = b2GetWorld(shapeId.world0); if (world == null) diff --git a/src/Box2D.NET/B2Worlds.cs b/src/Box2D.NET/B2Worlds.cs index dd8c129..36acf15 100644 --- a/src/Box2D.NET/B2Worlds.cs +++ b/src/Box2D.NET/B2Worlds.cs @@ -1385,7 +1385,7 @@ public static bool b2Body_IsValid(B2BodyId id) return true; } - public static bool b2Shape_IsValid(in B2ShapeId id) + public static bool b2Shape_IsValid(B2ShapeId id) { if (B2_MAX_WORLDS <= id.world0) { @@ -2013,7 +2013,7 @@ public static B2TreeStats b2World_CastRay(B2WorldId worldId, B2Vec2 origin, B2Ve } // This callback finds the closest hit. This is the most common callback used in games. - internal static float b2RayCastClosestFcn(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) + internal static float b2RayCastClosestFcn(B2ShapeId shapeId, B2Vec2 point, B2Vec2 normal, float fraction, object context) { // Ignore initial overlap if (fraction == 0.0f) @@ -3010,7 +3010,7 @@ internal static void b2ValidateContacts(B2World world) * @{ */ /// Contact identifier validation. Provides validation for up to 2^32 allocations. - public static bool b2Contact_IsValid(in B2ContactId id) + public static bool b2Contact_IsValid(B2ContactId id) { if (B2_MAX_WORLDS <= id.world0) { diff --git a/test/Box2D.NET.Test/B2WorldTest.cs b/test/Box2D.NET.Test/B2WorldTest.cs index 9ae9c4d..68e6ad4 100644 --- a/test/Box2D.NET.Test/B2WorldTest.cs +++ b/test/Box2D.NET.Test/B2WorldTest.cs @@ -247,7 +247,7 @@ public void TestWorldRecycle() } } - public static bool CustomFilter(in B2ShapeId shapeIdA, in B2ShapeId shapeIdB, object context) + public static bool CustomFilter(B2ShapeId shapeIdA, B2ShapeId shapeIdB, object context) { B2_UNUSED(shapeIdA); B2_UNUSED(shapeIdB); @@ -255,7 +255,7 @@ public static bool CustomFilter(in B2ShapeId shapeIdA, in B2ShapeId shapeIdB, ob return true; } - public static bool PreSolveStatic(in B2ShapeId shapeIdA, in B2ShapeId shapeIdB, B2Vec2 point, B2Vec2 normal, object context) + public static bool PreSolveStatic(B2ShapeId shapeIdA, B2ShapeId shapeIdB, B2Vec2 point, B2Vec2 normal, object context) { B2_UNUSED(shapeIdA); B2_UNUSED(shapeIdB);