From 1934d0c12a37c674cb113daac23ae7139caca2ee Mon Sep 17 00:00:00 2001 From: ikpil Date: Wed, 5 Nov 2025 23:52:09 +0900 Subject: [PATCH] Access modifiers (#53) --- src/Box2D.NET/B2ArenaAllocatorIndexer.cs | 4 +- src/Box2D.NET/B2BoardPhases.cs | 6 +-- src/Box2D.NET/B2Bodies.cs | 12 +++--- src/Box2D.NET/B2BodyState.cs | 2 +- src/Box2D.NET/B2Constants.cs | 10 ++--- src/Box2D.NET/B2ConstraintGraphs.cs | 12 +++--- src/Box2D.NET/B2ContactSolvers.cs | 24 +++++------ src/Box2D.NET/B2Contacts.cs | 34 ++++++++-------- src/Box2D.NET/B2Cores.cs | 28 ++++++------- src/Box2D.NET/B2Diagnostics.cs | 2 +- src/Box2D.NET/B2DistanceJoints.cs | 12 +++--- src/Box2D.NET/B2Distances.cs | 28 ++++++------- src/Box2D.NET/B2DynamicTrees.cs | 40 +++++++++--------- src/Box2D.NET/B2Geometries.cs | 20 ++++----- src/Box2D.NET/B2Hulls.cs | 2 +- src/Box2D.NET/B2IdPools.cs | 18 ++++---- src/Box2D.NET/B2Islands.cs | 22 +++++----- src/Box2D.NET/B2Joints.cs | 26 ++++++------ src/Box2D.NET/B2Manifolds.cs | 10 ++--- src/Box2D.NET/B2MotorJoints.cs | 10 ++--- src/Box2D.NET/B2Mutexes.cs | 4 +- src/Box2D.NET/B2PrismaticJoints.cs | 14 +++---- src/Box2D.NET/B2RevoluteJoints.cs | 12 +++--- src/Box2D.NET/B2RuntimeValidator.cs | 2 +- src/Box2D.NET/B2Sensors.cs | 8 ++-- src/Box2D.NET/B2ShapeRefComparer.cs | 2 +- src/Box2D.NET/B2Shapes.cs | 44 ++++++++++---------- src/Box2D.NET/B2SolverSets.cs | 10 ++--- src/Box2D.NET/B2Solvers.cs | 34 ++++++++-------- src/Box2D.NET/B2WeldJoints.cs | 20 ++++----- src/Box2D.NET/B2WheelJoints.cs | 12 +++--- src/Box2D.NET/B2Worlds.cs | 52 ++++++++++++------------ 32 files changed, 268 insertions(+), 268 deletions(-) diff --git a/src/Box2D.NET/B2ArenaAllocatorIndexer.cs b/src/Box2D.NET/B2ArenaAllocatorIndexer.cs index 38b67d67..6ff9acfe 100644 --- a/src/Box2D.NET/B2ArenaAllocatorIndexer.cs +++ b/src/Box2D.NET/B2ArenaAllocatorIndexer.cs @@ -14,7 +14,7 @@ internal static int Next() return b2AtomicFetchAddInt(ref _indices, 1); } - public static int Index() where T : new() + internal static int Index() where T : new() { return B2ArenaAllocatorIndexer.Index; } @@ -22,7 +22,7 @@ internal static int Next() internal class B2ArenaAllocatorIndexer where T : new() { - public static readonly int Index = B2ArenaAllocatorIndexer.Next(); + internal static readonly int Index = B2ArenaAllocatorIndexer.Next(); private B2ArenaAllocatorIndexer() { diff --git a/src/Box2D.NET/B2BoardPhases.cs b/src/Box2D.NET/B2BoardPhases.cs index 24900e34..5f53a3b7 100644 --- a/src/Box2D.NET/B2BoardPhases.cs +++ b/src/Box2D.NET/B2BoardPhases.cs @@ -505,7 +505,7 @@ public static bool b2BroadPhase_TestOverlap(B2BroadPhase bp, int proxyKeyA, int return b2AABB_Overlaps(aabbA, aabbB); } - public static void b2BroadPhase_RebuildTrees(B2BroadPhase bp) + internal static void b2BroadPhase_RebuildTrees(B2BroadPhase bp) { b2DynamicTree_Rebuild(bp.trees[(int)B2BodyType.b2_dynamicBody], false); b2DynamicTree_Rebuild(bp.trees[(int)B2BodyType.b2_kinematicBody], false); @@ -519,7 +519,7 @@ public static int b2BroadPhase_GetShapeIndex(B2BroadPhase bp, int proxyKey) return (int)b2DynamicTree_GetUserData(bp.trees[typeIndex], proxyId); } - public static void b2ValidateBroadphase(B2BroadPhase bp) + internal static void b2ValidateBroadphase(B2BroadPhase bp) { b2DynamicTree_Validate(bp.trees[(int)B2BodyType.b2_dynamicBody]); b2DynamicTree_Validate(bp.trees[(int)B2BodyType.b2_kinematicBody]); @@ -527,7 +527,7 @@ public static void b2ValidateBroadphase(B2BroadPhase bp) // TODO_ERIN validate every shape AABB is contained in tree AABB } - public static void b2ValidateNoEnlarged(B2BroadPhase bp) + internal static void b2ValidateNoEnlarged(B2BroadPhase bp) { #if DEBUG for (int j = 0; j < (int)B2BodyType.b2_bodyTypeCount; ++j) diff --git a/src/Box2D.NET/B2Bodies.cs b/src/Box2D.NET/B2Bodies.cs index 80ab7d31..22e6f8e3 100644 --- a/src/Box2D.NET/B2Bodies.cs +++ b/src/Box2D.NET/B2Bodies.cs @@ -28,7 +28,7 @@ public static class B2Bodies public const int B2_NAME_LENGTH = 32; // Identity body state, notice the deltaRotation is {1, 0} - public static readonly B2BodyState b2_identityBodyState = new B2BodyState() + internal static readonly B2BodyState b2_identityBodyState = new B2BodyState() { linearVelocity = new B2Vec2(0.0f, 0.0f), angularVelocity = 0.0f, @@ -119,7 +119,7 @@ public static void b2CreateIslandForBody(B2World world, int setIndex, B2Body bod island.bodyCount = 1; } - public static void b2RemoveBodyFromIsland(B2World world, B2Body body) + internal static void b2RemoveBodyFromIsland(B2World world, B2Body body) { if (body.islandId == B2_NULL_INDEX) { @@ -351,7 +351,7 @@ public static B2BodyId b2CreateBody(B2WorldId worldId, ref B2BodyDef def) } // careful calling this because it can invalidate body, state, joint, and contact pointers - public static bool b2WakeBody(B2World world, B2Body body) + internal static bool b2WakeBody(B2World world, B2Body body) { if (body.setIndex >= (int)B2SetType.b2_firstSleepingSet) { @@ -549,7 +549,7 @@ public static B2AABB b2Body_ComputeAABB(B2BodyId bodyId) return aabb; } - public static void b2UpdateBodyMassData(B2World world, B2Body body) + internal static void b2UpdateBodyMassData(B2World world, B2Body body) { B2BodySim bodySim = b2GetBodySim(world, body); @@ -1050,7 +1050,7 @@ public static void b2Body_ApplyTorque(B2BodyId bodyId, float torque, bool wake) /// step. So this only needs to be called if the application wants to remove the effect of previous /// calls to apply forces and torques before the world step is called. /// @param bodyId The body id - public static void b2Body_ClearForces(B2BodyId bodyId) + internal static void b2Body_ClearForces(B2BodyId bodyId) { B2World world = b2GetWorld(bodyId.world0); B2Body body = b2GetBodyFullId(world, bodyId); @@ -2035,7 +2035,7 @@ public static int b2Body_GetJoints(B2BodyId bodyId, Span jointArray, } - public static bool b2ShouldBodiesCollide(B2World world, B2Body bodyA, B2Body bodyB) + internal static bool b2ShouldBodiesCollide(B2World world, B2Body bodyA, B2Body bodyB) { if (bodyA.type != B2BodyType.b2_dynamicBody && bodyB.type != B2BodyType.b2_dynamicBody) { diff --git a/src/Box2D.NET/B2BodyState.cs b/src/Box2D.NET/B2BodyState.cs index 60724777..8891cd99 100644 --- a/src/Box2D.NET/B2BodyState.cs +++ b/src/Box2D.NET/B2BodyState.cs @@ -47,7 +47,7 @@ public class B2BodyState // the solver and must use zero delta rotation for static bodies (c,s) = (1,0) public B2Rot deltaRotation; // 8 - public static B2BodyState Create(B2BodyState other) // todo : @ikpil how to remove + internal static B2BodyState Create(B2BodyState other) // todo : @ikpil how to remove { var state = new B2BodyState(); state.CopyFrom(other); diff --git a/src/Box2D.NET/B2Constants.cs b/src/Box2D.NET/B2Constants.cs index b942346b..72ddd071 100644 --- a/src/Box2D.NET/B2Constants.cs +++ b/src/Box2D.NET/B2Constants.cs @@ -10,7 +10,7 @@ public static class B2Constants { // Used to detect bad values. Positions greater than about 16km will have precision // problems, so 100km as a limit should be fine in all cases. - public static float B2_HUGE => (100000.0f * b2_lengthUnitsPerMeter); + internal static float B2_HUGE => (100000.0f * b2_lengthUnitsPerMeter); // Maximum parallel workers. Used to size some static arrays. public const int B2_MAX_WORKERS = 64; @@ -24,7 +24,7 @@ public static class B2Constants // chosen to be numerically significant, but visually insignificant. In meters. // Normally this is 0.5cm. // @warning modifying this can have a significant impact on stability - public static float B2_LINEAR_SLOP => (0.005f * b2_lengthUnitsPerMeter); + internal static float B2_LINEAR_SLOP => (0.005f * b2_lengthUnitsPerMeter); // Maximum number of simultaneous worlds that can be allocated public const int B2_MAX_WORLDS = 128; @@ -32,18 +32,18 @@ public static class B2Constants // The maximum rotation of a body per time step. This limit is very large and is used // to prevent numerical problems. You shouldn't need to adjust this. // @warning increasing this to 0.5f * b2_pi or greater will break continuous collision. - public static readonly float B2_MAX_ROTATION = (0.25f * B2MathFunction.B2_PI); + internal static readonly float B2_MAX_ROTATION = (0.25f * B2MathFunction.B2_PI); // Box2D uses limited speculative collision. This reduces jitter. // Normally this is 2cm. // @warning modifying this can have a significant impact on performance and stability - public static readonly float B2_SPECULATIVE_DISTANCE = (4.0f * B2_LINEAR_SLOP); + internal static readonly float B2_SPECULATIVE_DISTANCE = (4.0f * B2_LINEAR_SLOP); // This is used to fatten AABBs in the dynamic tree. This allows proxies // to move by a small amount without triggering a tree adjustment. This is in meters. // Normally this is 5cm. // @warning modifying this can have a significant impact on performance - public static float B2_AABB_MARGIN => (0.05f * b2_lengthUnitsPerMeter); + internal static float B2_AABB_MARGIN => (0.05f * b2_lengthUnitsPerMeter); // The time that a body must be still before it will go to sleep. In seconds. public const float B2_TIME_TO_SLEEP = 0.5f; diff --git a/src/Box2D.NET/B2ConstraintGraphs.cs b/src/Box2D.NET/B2ConstraintGraphs.cs index 0262e189..f416bc62 100644 --- a/src/Box2D.NET/B2ConstraintGraphs.cs +++ b/src/Box2D.NET/B2ConstraintGraphs.cs @@ -87,7 +87,7 @@ public static void b2DestroyGraph(ref B2ConstraintGraph graph) // Contacts are always created as non-touching. They get cloned into the constraint // graph once they are found to be touching. - public static void b2AddContactToGraph(B2World world, B2ContactSim contactSim, B2Contact contact) + internal static void b2AddContactToGraph(B2World world, B2ContactSim contactSim, B2Contact contact) { B2_ASSERT(contactSim.manifold.pointCount > 0); B2_ASSERT(0 != (contactSim.simFlags & (uint)B2ContactSimFlags.b2_simTouchingFlag)); @@ -215,7 +215,7 @@ public static void b2AddContactToGraph(B2World world, B2ContactSim contactSim, B } } - public static void b2RemoveContactFromGraph(B2World world, int bodyIdA, int bodyIdB, int colorIndex, int localIndex) + internal static void b2RemoveContactFromGraph(B2World world, int bodyIdA, int bodyIdB, int colorIndex, int localIndex) { ref B2ConstraintGraph graph = ref world.constraintGraph; @@ -311,7 +311,7 @@ static int b2AssignJointColor(ref B2ConstraintGraph graph, int bodyIdA, int body return B2_OVERFLOW_INDEX; } - public static ref B2JointSim b2CreateJointInGraph(B2World world, B2Joint joint) + internal static ref B2JointSim b2CreateJointInGraph(B2World world, B2Joint joint) { ref B2ConstraintGraph graph = ref world.constraintGraph; @@ -331,14 +331,14 @@ public static ref B2JointSim b2CreateJointInGraph(B2World world, B2Joint joint) return ref jointSim; } - public static void b2AddJointToGraph(B2World world, B2JointSim jointSim, B2Joint joint) + internal static void b2AddJointToGraph(B2World world, B2JointSim jointSim, B2Joint joint) { B2JointSim jointDst = b2CreateJointInGraph(world, joint); //memcpy( jointDst, jointSim, sizeof( b2JointSim ) ); jointDst.CopyFrom(jointSim); } - public static void b2RemoveJointFromGraph(B2World world, int bodyIdA, int bodyIdB, int colorIndex, int localIndex) + internal static void b2RemoveJointFromGraph(B2World world, int bodyIdA, int bodyIdB, int colorIndex, int localIndex) { ref B2ConstraintGraph graph = ref world.constraintGraph; @@ -366,7 +366,7 @@ public static void b2RemoveJointFromGraph(B2World world, int bodyIdA, int bodyId } } - public static readonly B2HexColor[] b2_graphColors = new B2HexColor[] + internal static readonly B2HexColor[] b2_graphColors = new B2HexColor[] { B2HexColor.b2_colorRed, B2HexColor.b2_colorOrange, B2HexColor.b2_colorYellow, B2HexColor.b2_colorGreen, B2HexColor.b2_colorCyan, B2HexColor.b2_colorBlue, B2HexColor.b2_colorViolet, B2HexColor.b2_colorPink, B2HexColor.b2_colorChocolate, B2HexColor.b2_colorGoldenRod, B2HexColor.b2_colorCoral, B2HexColor.b2_colorRosyBrown, diff --git a/src/Box2D.NET/B2ContactSolvers.cs b/src/Box2D.NET/B2ContactSolvers.cs index b97d18c0..e62df618 100644 --- a/src/Box2D.NET/B2ContactSolvers.cs +++ b/src/Box2D.NET/B2ContactSolvers.cs @@ -28,7 +28,7 @@ public static class B2ContactSolvers // s(t) = s0 + dot(cB0 + dpB + rot(dqB, rB0) - cA0 - dpA - rot(dqA, rA0), normal) // s(t) = s0 + dot(cB0 - cA0, normal) + dot(dpB - dpA + rot(dqB, rB0) - rot(dqA, rA0), normal) // s_base = s0 + dot(cB0 - cA0, normal) - public static void b2PrepareOverflowContacts(B2StepContext context) + internal static void b2PrepareOverflowContacts(B2StepContext context) { b2TracyCZoneNC(B2TracyCZone.prepare_overflow_contact, "Prepare Overflow Contact", B2HexColor.b2_colorYellow, true); @@ -165,7 +165,7 @@ public static void b2PrepareOverflowContacts(B2StepContext context) b2TracyCZoneEnd(B2TracyCZone.prepare_overflow_contact); } - public static void b2WarmStartOverflowContacts(B2StepContext context) + internal static void b2WarmStartOverflowContacts(B2StepContext context) { b2TracyCZoneNC(B2TracyCZone.warmstart_overflow_contact, "WarmStart Overflow Contact", B2HexColor.b2_colorDarkOrange, true); @@ -239,7 +239,7 @@ public static void b2WarmStartOverflowContacts(B2StepContext context) b2TracyCZoneEnd(B2TracyCZone.warmstart_overflow_contact); } - public static void b2SolveOverflowContacts(B2StepContext context, bool useBias) + internal static void b2SolveOverflowContacts(B2StepContext context, bool useBias) { b2TracyCZoneNC(B2TracyCZone.solve_contact, "Solve Contact", B2HexColor.b2_colorAliceBlue, true); @@ -401,7 +401,7 @@ public static void b2SolveOverflowContacts(B2StepContext context, bool useBias) b2TracyCZoneEnd(B2TracyCZone.solve_contact); } - public static void b2ApplyOverflowRestitution(B2StepContext context) + internal static void b2ApplyOverflowRestitution(B2StepContext context) { b2TracyCZoneNC(B2TracyCZone.overflow_resitution, "Overflow Restitution", B2HexColor.b2_colorViolet, true); @@ -506,7 +506,7 @@ public static void b2ApplyOverflowRestitution(B2StepContext context) b2TracyCZoneEnd(B2TracyCZone.overflow_resitution); } - public static void b2StoreOverflowImpulses(B2StepContext context) + internal static void b2StoreOverflowImpulses(B2StepContext context) { b2TracyCZoneNC(B2TracyCZone.store_impulses, "Store", B2HexColor.b2_colorFireBrick, true); @@ -1107,7 +1107,7 @@ static void b2ScatterBodies( b2BodyState* states, int* indices, const b2BodyStat #else // This is a load and transpose - public static B2BodyStateW b2GatherBodies(B2BodyState[] states, ReadOnlySpan indices) + internal static B2BodyStateW b2GatherBodies(B2BodyState[] states, ReadOnlySpan indices) { B2BodyState identity = b2_identityBodyState; @@ -1130,7 +1130,7 @@ public static B2BodyStateW b2GatherBodies(B2BodyState[] states, ReadOnlySpan indices, ref B2BodyStateW simdBody) + internal static void b2ScatterBodies(B2BodyState[] states, ReadOnlySpan indices, ref B2BodyStateW simdBody) { if (indices[0] != B2_NULL_INDEX && (states[indices[0]].flags & (uint)B2BodyFlags.b2_dynamicFlag) != 0) { @@ -1168,7 +1168,7 @@ public static void b2ScatterBodies(B2BodyState[] states, ReadOnlySpan indic #endif // Contacts that live within the constraint graph coloring - public static void b2PrepareContactsTask(int startIndex, int endIndex, B2StepContext context) + internal static void b2PrepareContactsTask(int startIndex, int endIndex, B2StepContext context) { b2TracyCZoneNC(B2TracyCZone.prepare_contact, "Prepare Contact", B2HexColor.b2_colorYellow, true); B2World world = context.world; @@ -1423,7 +1423,7 @@ public static void b2PrepareContactsTask(int startIndex, int endIndex, B2StepCon b2TracyCZoneEnd(B2TracyCZone.prepare_contact); } - public static void b2WarmStartContactsTask(int startIndex, int endIndex, B2StepContext context, int colorIndex) + internal static void b2WarmStartContactsTask(int startIndex, int endIndex, B2StepContext context, int colorIndex) { b2TracyCZoneNC(B2TracyCZone.warm_start_contact, "Warm Start", B2HexColor.b2_colorGreen, true); @@ -1481,7 +1481,7 @@ public static void b2WarmStartContactsTask(int startIndex, int endIndex, B2StepC b2TracyCZoneEnd(B2TracyCZone.warm_start_contact); } - public static void b2SolveContactsTask(int startIndex, int endIndex, B2StepContext context, int colorIndex, bool useBias) + internal static void b2SolveContactsTask(int startIndex, int endIndex, B2StepContext context, int colorIndex, bool useBias) { b2TracyCZoneNC(B2TracyCZone.solve_contact, "Solve Contact", B2HexColor.b2_colorAliceBlue, true); @@ -1719,7 +1719,7 @@ public static void b2SolveContactsTask(int startIndex, int endIndex, B2StepConte b2TracyCZoneEnd(B2TracyCZone.solve_contact); } - public static void b2ApplyRestitutionTask(int startIndex, int endIndex, B2StepContext context, int colorIndex) + internal static void b2ApplyRestitutionTask(int startIndex, int endIndex, B2StepContext context, int colorIndex) { b2TracyCZoneNC(B2TracyCZone.restitution, "Restitution", B2HexColor.b2_colorDodgerBlue, true); @@ -1834,7 +1834,7 @@ public static void b2ApplyRestitutionTask(int startIndex, int endIndex, B2StepCo b2TracyCZoneEnd(B2TracyCZone.restitution); } - public static void b2StoreImpulsesTask(int startIndex, int endIndex, B2StepContext context) + internal static void b2StoreImpulsesTask(int startIndex, int endIndex, B2StepContext context) { b2TracyCZoneNC(B2TracyCZone.store_impulses, "Store", B2HexColor.b2_colorFireBrick, true); diff --git a/src/Box2D.NET/B2Contacts.cs b/src/Box2D.NET/B2Contacts.cs index 2366e9d3..5119be7f 100644 --- a/src/Box2D.NET/B2Contacts.cs +++ b/src/Box2D.NET/B2Contacts.cs @@ -42,77 +42,77 @@ public static class B2Contacts private static readonly B2ContactRegister[,] s_registers = new B2ContactRegister[(int)B2ShapeType.b2_shapeTypeCount, (int)B2ShapeType.b2_shapeTypeCount]; private static bool s_initialized = false; - public static B2Manifold b2CircleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) + internal static B2Manifold b2CircleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) { B2_UNUSED(cache); return b2CollideCircles(ref shapeA.us.circle, xfA, ref shapeB.us.circle, xfB); } - public static B2Manifold b2CapsuleAndCircleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) + internal static B2Manifold b2CapsuleAndCircleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) { B2_UNUSED(cache); return b2CollideCapsuleAndCircle(ref shapeA.us.capsule, xfA, ref shapeB.us.circle, xfB); } - public static B2Manifold b2CapsuleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) + internal static B2Manifold b2CapsuleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) { B2_UNUSED(cache); return b2CollideCapsules(ref shapeA.us.capsule, xfA, ref shapeB.us.capsule, xfB); } - public static B2Manifold b2PolygonAndCircleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) + internal static B2Manifold b2PolygonAndCircleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) { B2_UNUSED(cache); return b2CollidePolygonAndCircle(ref shapeA.us.polygon, xfA, ref shapeB.us.circle, xfB); } - public static B2Manifold b2PolygonAndCapsuleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) + internal static B2Manifold b2PolygonAndCapsuleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) { B2_UNUSED(cache); return b2CollidePolygonAndCapsule(ref shapeA.us.polygon, xfA, ref shapeB.us.capsule, xfB); } - public static B2Manifold b2PolygonManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) + internal static B2Manifold b2PolygonManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) { B2_UNUSED(cache); return b2CollidePolygons(ref shapeA.us.polygon, xfA, ref shapeB.us.polygon, xfB); } - public static B2Manifold b2SegmentAndCircleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) + internal static B2Manifold b2SegmentAndCircleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) { B2_UNUSED(cache); return b2CollideSegmentAndCircle(ref shapeA.us.segment, xfA, ref shapeB.us.circle, xfB); } - public static B2Manifold b2SegmentAndCapsuleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) + internal static B2Manifold b2SegmentAndCapsuleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) { B2_UNUSED(cache); return b2CollideSegmentAndCapsule(ref shapeA.us.segment, xfA, ref shapeB.us.capsule, xfB); } - public static B2Manifold b2SegmentAndPolygonManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) + internal static B2Manifold b2SegmentAndPolygonManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) { B2_UNUSED(cache); return b2CollideSegmentAndPolygon(ref shapeA.us.segment, xfA, ref shapeB.us.polygon, xfB); } - public static B2Manifold b2ChainSegmentAndCircleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) + internal static B2Manifold b2ChainSegmentAndCircleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) { B2_UNUSED(cache); return b2CollideChainSegmentAndCircle(ref shapeA.us.chainSegment, xfA, ref shapeB.us.circle, xfB); } - public static B2Manifold b2ChainSegmentAndCapsuleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) + internal static B2Manifold b2ChainSegmentAndCapsuleManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) { return b2CollideChainSegmentAndCapsule(ref shapeA.us.chainSegment, xfA, ref shapeB.us.capsule, xfB, ref cache); } - public static B2Manifold b2ChainSegmentAndPolygonManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) + internal static B2Manifold b2ChainSegmentAndPolygonManifold(B2Shape shapeA, B2Transform xfA, B2Shape shapeB, B2Transform xfB, ref B2SimplexCache cache) { return b2CollideChainSegmentAndPolygon(ref shapeA.us.chainSegment, xfA, ref shapeB.us.polygon, xfB, ref cache); } - public static void b2AddType(b2ManifoldFcn fcn, B2ShapeType type1, B2ShapeType type2) + internal static void b2AddType(b2ManifoldFcn fcn, B2ShapeType type1, B2ShapeType type2) { B2_ASSERT(0 <= type1 && type1 < B2ShapeType.b2_shapeTypeCount); B2_ASSERT(0 <= type2 && type2 < B2ShapeType.b2_shapeTypeCount); @@ -127,7 +127,7 @@ public static void b2AddType(b2ManifoldFcn fcn, B2ShapeType type1, B2ShapeType t } } - public static void b2InitializeContactRegisters() + internal static void b2InitializeContactRegisters() { if (s_initialized == false) { @@ -433,7 +433,7 @@ public static void b2DestroyContact(B2World world, B2Contact contact, bool wakeB } } - public static B2ContactSim b2GetContactSim(B2World world, B2Contact contact) + internal static B2ContactSim b2GetContactSim(B2World world, B2Contact contact) { if (contact.setIndex == (int)B2SetType.b2_awakeSet && contact.colorIndex != B2_NULL_INDEX) { @@ -450,7 +450,7 @@ public static B2ContactSim b2GetContactSim(B2World world, B2Contact contact) // Update the contact manifold and touching status. // Note: do not assume the shape AABBs are overlapping or are valid. - public static bool b2UpdateContact(B2World world, B2ContactSim contactSim, B2Shape shapeA, B2Transform transformA, B2Vec2 centerOffsetA, + internal static bool b2UpdateContact(B2World world, B2ContactSim contactSim, B2Shape shapeA, B2Transform transformA, B2Vec2 centerOffsetA, B2Shape shapeB, B2Transform transformB, B2Vec2 centerOffsetB) { // Save old manifold @@ -630,7 +630,7 @@ public static bool b2UpdateContact(B2World world, B2ContactSim contactSim, B2Sha return touching; } - public static B2Contact b2GetContactFullId(B2World world, B2ContactId contactId) + internal static B2Contact b2GetContactFullId(B2World world, B2ContactId contactId) { int id = contactId.index1 - 1; B2Contact contact = b2Array_Get(ref world.contacts, id); diff --git a/src/Box2D.NET/B2Cores.cs b/src/Box2D.NET/B2Cores.cs index dbdb5b20..f05bea67 100644 --- a/src/Box2D.NET/B2Cores.cs +++ b/src/Box2D.NET/B2Cores.cs @@ -25,7 +25,7 @@ public static B2Version b2GetVersion() } // This allows the user to change the length units at runtime - public static float b2_lengthUnitsPerMeter = 1.0f; + internal static float b2_lengthUnitsPerMeter = 1.0f; /// Box2D bases all length units on meters, but you may need different units for your game. /// You can set this value to use different units. This should be done at application startup @@ -42,7 +42,7 @@ public static B2Version b2GetVersion() /// forces. /// @warning This must be modified before any calls to Box2D [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void b2SetLengthUnitsPerMeter(float lengthUnits) + internal static void b2SetLengthUnitsPerMeter(float lengthUnits) { B2_ASSERT(b2IsValidFloat(lengthUnits) && lengthUnits > 0.0f); b2_lengthUnitsPerMeter = lengthUnits; @@ -50,73 +50,73 @@ public static void b2SetLengthUnitsPerMeter(float lengthUnits) /// Get the current length units per meter. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static float b2GetLengthUnitsPerMeter() + internal static float b2GetLengthUnitsPerMeter() { return b2_lengthUnitsPerMeter; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void B2_CHECK_DEF(ref B2WheelJointDef def) + internal static void B2_CHECK_DEF(ref B2WheelJointDef def) { B2_ASSERT(def.internalValue == B2_SECRET_COOKIE); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void B2_CHECK_DEF(ref B2WeldJointDef def) + internal static void B2_CHECK_DEF(ref B2WeldJointDef def) { B2_ASSERT(def.internalValue == B2_SECRET_COOKIE); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void B2_CHECK_DEF(ref B2PrismaticJointDef def) + internal static void B2_CHECK_DEF(ref B2PrismaticJointDef def) { B2_ASSERT(def.internalValue == B2_SECRET_COOKIE); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void B2_CHECK_DEF(ref B2RevoluteJointDef def) + internal static void B2_CHECK_DEF(ref B2RevoluteJointDef def) { B2_ASSERT(def.internalValue == B2_SECRET_COOKIE); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void B2_CHECK_DEF(ref b2FilterJointDef def) + internal static void B2_CHECK_DEF(ref b2FilterJointDef def) { B2_ASSERT(def.internalValue == B2_SECRET_COOKIE); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void B2_CHECK_DEF(ref B2MotorJointDef def) + internal static void B2_CHECK_DEF(ref B2MotorJointDef def) { B2_ASSERT(def.internalValue == B2_SECRET_COOKIE); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void B2_CHECK_DEF(ref B2DistanceJointDef def) + internal static void B2_CHECK_DEF(ref B2DistanceJointDef def) { B2_ASSERT(def.internalValue == B2_SECRET_COOKIE); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void B2_CHECK_DEF(ref B2ChainDef def) + internal static void B2_CHECK_DEF(ref B2ChainDef def) { B2_ASSERT(def.internalValue == B2_SECRET_COOKIE); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void B2_CHECK_DEF(ref B2BodyDef def) + internal static void B2_CHECK_DEF(ref B2BodyDef def) { B2_ASSERT(def.internalValue == B2_SECRET_COOKIE); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void B2_CHECK_DEF(ref B2WorldDef def) + internal static void B2_CHECK_DEF(ref B2WorldDef def) { B2_ASSERT(def.internalValue == B2_SECRET_COOKIE); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void B2_CHECK_DEF(ref B2ShapeDef def) + internal static void B2_CHECK_DEF(ref B2ShapeDef def) { B2_ASSERT(def.internalValue == B2_SECRET_COOKIE); } diff --git a/src/Box2D.NET/B2Diagnostics.cs b/src/Box2D.NET/B2Diagnostics.cs index ab124451..363e13c0 100644 --- a/src/Box2D.NET/B2Diagnostics.cs +++ b/src/Box2D.NET/B2Diagnostics.cs @@ -74,7 +74,7 @@ public static void b2SetAssertFcn(b2AssertFcn assertFcn) b2AssertHandler = assertFcn; } - public static int b2InternalAssertFcn(string condition, string fileName, int lineNumber) + internal static int b2InternalAssertFcn(string condition, string fileName, int lineNumber) { return b2AssertHandler(condition, fileName, lineNumber); } diff --git a/src/Box2D.NET/B2DistanceJoints.cs b/src/Box2D.NET/B2DistanceJoints.cs index 36e1de75..ee5772a5 100644 --- a/src/Box2D.NET/B2DistanceJoints.cs +++ b/src/Box2D.NET/B2DistanceJoints.cs @@ -202,7 +202,7 @@ public static float b2DistanceJoint_GetMaxMotorForce(B2JointId jointId) return joint.uj.distanceJoint.maxMotorForce; } - public static B2Vec2 b2GetDistanceJointForce(B2World world, B2JointSim @base) + internal static B2Vec2 b2GetDistanceJointForce(B2World world, B2JointSim @base) { ref readonly B2DistanceJoint joint = ref @base.uj.distanceJoint; @@ -232,7 +232,7 @@ public static B2Vec2 b2GetDistanceJointForce(B2World world, B2JointSim @base) // K = J * invM * JT // = invMass1 + invI1 * cross(r1, u)^2 + invMass2 + invI2 * cross(r2, u)^2 - public static void b2PrepareDistanceJoint(B2JointSim @base, B2StepContext context) + internal static void b2PrepareDistanceJoint(B2JointSim @base, B2StepContext context) { B2_ASSERT(@base.type == B2JointType.b2_distanceJoint); @@ -297,7 +297,7 @@ public static void b2PrepareDistanceJoint(B2JointSim @base, B2StepContext contex } } - public static void b2WarmStartDistanceJoint(B2JointSim @base, B2StepContext context) + internal static void b2WarmStartDistanceJoint(B2JointSim @base, B2StepContext context) { B2_ASSERT(@base.type == B2JointType.b2_distanceJoint); @@ -336,7 +336,7 @@ public static void b2WarmStartDistanceJoint(B2JointSim @base, B2StepContext cont } } - public static void b2SolveDistanceJoint(B2JointSim @base, B2StepContext context, bool useBias) + internal static void b2SolveDistanceJoint(B2JointSim @base, B2StepContext context, bool useBias) { B2_ASSERT(@base.type == B2JointType.b2_distanceJoint); @@ -527,7 +527,7 @@ public static void b2SolveDistanceJoint(B2JointSim @base, B2StepContext context, } #if FALSE - public static void b2DistanceJoint::Dump() + internal static void b2DistanceJoint::Dump() { int32 indexA = m_bodyA.m_islandIndex; int32 indexB = m_bodyB.m_islandIndex; @@ -547,7 +547,7 @@ public static void b2SolveDistanceJoint(B2JointSim @base, B2StepContext context, } #endif - public static void b2DrawDistanceJoint(B2DebugDraw draw, B2JointSim @base, B2Transform transformA, B2Transform transformB) + internal static void b2DrawDistanceJoint(B2DebugDraw draw, B2JointSim @base, B2Transform transformA, B2Transform transformB) { B2_ASSERT(@base.type == B2JointType.b2_distanceJoint); diff --git a/src/Box2D.NET/B2Distances.cs b/src/Box2D.NET/B2Distances.cs index d0875241..982f22e6 100644 --- a/src/Box2D.NET/B2Distances.cs +++ b/src/Box2D.NET/B2Distances.cs @@ -15,13 +15,13 @@ public static class B2Distances { // Warning: writing to these globals significantly slows multithreading performance #if B2_SNOOP_TOI_COUNTERS - public static float b2_toiTime, b2_toiMaxTime; - public static int b2_toiCalls, b2_toiDistanceIterations, b2_toiMaxDistanceIterations; - public static int b2_toiRootIterations, b2_toiMaxRootIterations; - public static int b2_toiFailedCount; - public static int b2_toiOverlappedCount; - public static int b2_toiHitCount; - public static int b2_toiSeparatedCount; + internal static float b2_toiTime, b2_toiMaxTime; + internal static int b2_toiCalls, b2_toiDistanceIterations, b2_toiMaxDistanceIterations; + internal static int b2_toiRootIterations, b2_toiMaxRootIterations; + internal static int b2_toiFailedCount; + internal static int b2_toiOverlappedCount; + internal static int b2_toiHitCount; + internal static int b2_toiSeparatedCount; #endif /// Evaluate the transform sweep at a specific time. @@ -178,19 +178,19 @@ public static B2ShapeProxy b2MakeProxy(B2Vec2 v1, B2Vec2 v2, int count, float ra [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static B2Vec2 b2Weight2(float a1, B2Vec2 w1, float a2, B2Vec2 w2) + internal static B2Vec2 b2Weight2(float a1, B2Vec2 w1, float a2, B2Vec2 w2) { return new B2Vec2(a1 * w1.X + a2 * w2.X, a1 * w1.Y + a2 * w2.Y); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static B2Vec2 b2Weight3(float a1, B2Vec2 w1, float a2, B2Vec2 w2, float a3, B2Vec2 w3) + internal static B2Vec2 b2Weight3(float a1, B2Vec2 w1, float a2, B2Vec2 w2, float a3, B2Vec2 w3) { return new B2Vec2(a1 * w1.X + a2 * w2.X + a3 * w3.X, a1 * w1.Y + a2 * w2.Y + a3 * w3.Y); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static int b2FindSupport(ref B2ShapeProxy proxy, B2Vec2 direction) + internal static int b2FindSupport(ref B2ShapeProxy proxy, B2Vec2 direction) { Span points = proxy.points.AsSpan(); int count = proxy.count; @@ -259,7 +259,7 @@ public static void b2MakeSimplexCache(ref B2SimplexCache cache, ref B2Simplex si } } - public static void b2ComputeSimplexWitnessPoints(ref B2Vec2 a, ref B2Vec2 b, ref B2Simplex s) + internal static void b2ComputeSimplexWitnessPoints(ref B2Vec2 a, ref B2Vec2 b, ref B2Simplex s) { switch (s.count) { @@ -313,7 +313,7 @@ public static void b2ComputeSimplexWitnessPoints(ref B2Vec2 a, ref B2Vec2 b, ref // a2 = d12_2 / d12 // // returns a vector that points towards the origin - public static B2Vec2 b2SolveSimplex2(ref B2Simplex s) + internal static B2Vec2 b2SolveSimplex2(ref B2Simplex s) { B2Vec2 w1 = s.v1.w; B2Vec2 w2 = s.v2.w; @@ -348,7 +348,7 @@ public static B2Vec2 b2SolveSimplex2(ref B2Simplex s) return b2CrossSV(b2Cross(b2Add(w1, w2), e12), e12); } - public static B2Vec2 b2SolveSimplex3(ref B2Simplex s) + internal static B2Vec2 b2SolveSimplex3(ref B2Simplex s) { B2Vec2 w1 = s.v1.w; B2Vec2 w2 = s.v2.w; @@ -1047,7 +1047,7 @@ public static B2SeparationFunction b2MakeSeparationFunction(ref B2SimplexCache c } } - public static float b2FindMinSeparation(ref B2SeparationFunction f, ref int indexA, ref int indexB, float t) + internal static float b2FindMinSeparation(ref B2SeparationFunction f, ref int indexA, ref int indexB, float t) { B2Transform xfA = b2GetSweepTransform(ref f.sweepA, t); B2Transform xfB = b2GetSweepTransform(ref f.sweepB, t); diff --git a/src/Box2D.NET/B2DynamicTrees.cs b/src/Box2D.NET/B2DynamicTrees.cs index e22b2e1e..9f6c991e 100644 --- a/src/Box2D.NET/B2DynamicTrees.cs +++ b/src/Box2D.NET/B2DynamicTrees.cs @@ -16,7 +16,7 @@ public static class B2DynamicTrees { public const int B2_TREE_STACK_SIZE = 1024; - public static readonly B2TreeNode b2_defaultTreeNode = new B2TreeNode() + internal static readonly B2TreeNode b2_defaultTreeNode = new B2TreeNode() { aabb = new B2AABB(new B2Vec2(0.0f, 0.0f), new B2Vec2(0.0f, 0.0f)), categoryBits = B2_DEFAULT_CATEGORY_BITS, @@ -34,19 +34,19 @@ public static class B2DynamicTrees }; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool b2IsLeaf(ref B2TreeNode node) + internal static bool b2IsLeaf(ref B2TreeNode node) { return 0 != (node.flags & (ushort)B2TreeNodeFlags.b2_leafNode); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool b2IsAllocated(ref B2TreeNode node) + internal static bool b2IsAllocated(ref B2TreeNode node) { return 0 != (node.flags & (ushort)B2TreeNodeFlags.b2_allocatedNode); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ushort b2MaxUInt16(ushort a, ushort b) + internal static ushort b2MaxUInt16(ushort a, ushort b) { return a > b ? a : b; } @@ -96,7 +96,7 @@ public static void b2DynamicTree_Destroy(B2DynamicTree tree) } // Allocate a node from the pool. Grow the pool if necessary. - public static int b2AllocateNode(B2DynamicTree tree) + internal static int b2AllocateNode(B2DynamicTree tree) { // Expand the node pool as needed. if (tree.freeList == B2_NULL_INDEX) @@ -137,7 +137,7 @@ public static int b2AllocateNode(B2DynamicTree tree) } // Return a node to the pool. - public static void b2FreeNode(B2DynamicTree tree, int nodeId) + internal static void b2FreeNode(B2DynamicTree tree, int nodeId) { B2_ASSERT(0 <= nodeId && nodeId < tree.nodeCapacity); B2_ASSERT(0 < tree.nodeCount); @@ -164,7 +164,7 @@ public static void b2FreeNode(B2DynamicTree tree, int nodeId) // Suppose B (or C) is an internal node, then the lowest cost would be one of two cases: // case1: D becomes a sibling of B // case2: D becomes a descendant of B along with a new internal node of area(D). - public static int b2FindBestSibling(B2DynamicTree tree, B2AABB boxD) + internal static int b2FindBestSibling(B2DynamicTree tree, B2AABB boxD) { B2Vec2 centerD = b2AABB_Center(boxD); float areaD = b2Perimeter(boxD); @@ -307,7 +307,7 @@ public static int b2FindBestSibling(B2DynamicTree tree, B2AABB boxD) // Perform a left or right rotation if node A is imbalanced. // Returns the new root index. - public static void b2RotateNodes(B2DynamicTree tree, int iA) + internal static void b2RotateNodes(B2DynamicTree tree, int iA) { B2_ASSERT(iA != B2_NULL_INDEX); @@ -594,7 +594,7 @@ public static void b2RotateNodes(B2DynamicTree tree, int iA) } } - public static void b2InsertLeaf(B2DynamicTree tree, int leaf, bool shouldRotate) + internal static void b2InsertLeaf(B2DynamicTree tree, int leaf, bool shouldRotate) { if (tree.root == B2_NULL_INDEX) { @@ -670,7 +670,7 @@ public static void b2InsertLeaf(B2DynamicTree tree, int leaf, bool shouldRotate) } } - public static void b2RemoveLeaf(B2DynamicTree tree, int leaf) + internal static void b2RemoveLeaf(B2DynamicTree tree, int leaf) { if (leaf == tree.root) { @@ -766,7 +766,7 @@ public static int b2DynamicTree_CreateProxy(B2DynamicTree tree, B2AABB aabb, ulo } /// Destroy a proxy. This asserts if the id is invalid. - public static void b2DynamicTree_DestroyProxy(B2DynamicTree tree, int proxyId) + internal static void b2DynamicTree_DestroyProxy(B2DynamicTree tree, int proxyId) { B2_ASSERT(0 <= proxyId && proxyId < tree.nodeCapacity); B2_ASSERT(b2IsLeaf(ref tree.nodes[proxyId])); @@ -929,7 +929,7 @@ public static B2AABB b2DynamicTree_GetRootBounds(B2DynamicTree tree) #if DEBUG // Compute the height of a sub-tree. - public static int b2ComputeHeight(B2DynamicTree tree, int nodeId) + internal static int b2ComputeHeight(B2DynamicTree tree, int nodeId) { B2_ASSERT(0 <= nodeId && nodeId < tree.nodeCapacity); ref B2TreeNode node = ref tree.nodes[nodeId]; @@ -944,7 +944,7 @@ public static int b2ComputeHeight(B2DynamicTree tree, int nodeId) return 1 + b2MaxInt(height1, height2); } - public static void b2ValidateStructure(B2DynamicTree tree, int index) + internal static void b2ValidateStructure(B2DynamicTree tree, int index) { if (index == B2_NULL_INDEX) { @@ -984,7 +984,7 @@ public static void b2ValidateStructure(B2DynamicTree tree, int index) b2ValidateStructure(tree, child2); } - public static void b2ValidateMetrics(B2DynamicTree tree, int index) + internal static void b2ValidateMetrics(B2DynamicTree tree, int index) { if (index == B2_NULL_INDEX) { @@ -1060,7 +1060,7 @@ public static void b2DynamicTree_Validate(B2DynamicTree tree) } /// Validate this tree has no enlarged AABBs. For testing. - public static void b2DynamicTree_ValidateNoEnlarged(B2DynamicTree tree) + internal static void b2DynamicTree_ValidateNoEnlarged(B2DynamicTree tree) { #if DEBUG int capacity = tree.nodeCapacity; @@ -1169,7 +1169,7 @@ public static B2TreeStats b2DynamicTree_Query(B2DynamicTree tree, B2AABB aabb /// Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB. /// No filtering is performed. /// @return performance data - public static B2TreeStats b2DynamicTree_QueryAll(B2DynamicTree tree, B2AABB aabb, b2TreeQueryCallbackFcn callback, ref T context) + internal static B2TreeStats b2DynamicTree_QueryAll(B2DynamicTree tree, B2AABB aabb, b2TreeQueryCallbackFcn callback, ref T context) { B2TreeStats result = new B2TreeStats(); @@ -1368,7 +1368,7 @@ public static B2TreeStats b2DynamicTree_RayCast(B2DynamicTree tree, ref B2Ray /// @param callback a callback class that is called for each proxy that is hit by the shape /// @param context user context that is passed to the callback /// @return performance data - public static B2TreeStats b2DynamicTree_ShapeCast(B2DynamicTree tree, ref B2ShapeCastInput input, ulong maskBits, + internal static B2TreeStats b2DynamicTree_ShapeCast(B2DynamicTree tree, ref B2ShapeCastInput input, ulong maskBits, b2TreeShapeCastCallbackFcn callback, ref T context) where T : struct { B2TreeStats stats = new B2TreeStats(); @@ -1506,7 +1506,7 @@ public static B2TreeStats b2DynamicTree_ShapeCast(B2DynamicTree tree, ref B2S // #if B2_TREE_HEURISTIC == 0 // Median split heuristic - public static int b2PartitionMid(Span indices, Span centers, int count) + internal static int b2PartitionMid(Span indices, Span centers, int count) { // Handle trivial case if (count <= 2) @@ -1630,7 +1630,7 @@ public static int b2PartitionMid(Span indices, Span centers, int co // "On Fast Construction of SAH-based Bounding Volume Hierarchies" by Ingo Wald // Returns the left child count - public static int b2PartitionSAH(int[] indices, int[] binIndices, B2AABB[] boxes, int count) + internal static int b2PartitionSAH(int[] indices, int[] binIndices, B2AABB[] boxes, int count) { B2_ASSERT(count > 0); @@ -1785,7 +1785,7 @@ public static int b2PartitionSAH(int[] indices, int[] binIndices, B2AABB[] boxes // Returns root node index - public static int b2BuildTree(B2DynamicTree tree, int leafCount) + internal static int b2BuildTree(B2DynamicTree tree, int leafCount) { B2TreeNode[] nodes = tree.nodes; int[] leafIndices = tree.leafIndices; diff --git a/src/Box2D.NET/B2Geometries.cs b/src/Box2D.NET/B2Geometries.cs index bb41c889..b08d9915 100644 --- a/src/Box2D.NET/B2Geometries.cs +++ b/src/Box2D.NET/B2Geometries.cs @@ -16,14 +16,14 @@ public static class B2Geometries // B2_ASSERT( B2_MAX_POLYGON_VERTICES > 2, "must be 3 or more" ); /// Validate ray cast input data (NaN, etc) - public static bool b2IsValidRay(ref B2RayCastInput input) + internal static bool b2IsValidRay(ref B2RayCastInput input) { bool isValid = b2IsValidVec2(input.origin) && b2IsValidVec2(input.translation) && b2IsValidFloat(input.maxFraction) && 0.0f <= input.maxFraction && input.maxFraction < B2_HUGE; return isValid; } - public static B2Vec2 b2ComputePolygonCentroid(ReadOnlySpan vertices, int count) + internal static B2Vec2 b2ComputePolygonCentroid(ReadOnlySpan vertices, int count) { B2Vec2 center = new B2Vec2(0.0f, 0.0f); float area = 0.0f; @@ -935,7 +935,7 @@ public static B2CastOutput b2RayCastPolygon(ref B2Polygon shape, ref B2RayCastIn } /// Shape cast versus a circle. - public static B2CastOutput b2ShapeCastCircle(ref B2Circle shape, ref B2ShapeCastInput input) + internal static B2CastOutput b2ShapeCastCircle(ref B2Circle shape, ref B2ShapeCastInput input) { B2ShapeCastPairInput pairInput = new B2ShapeCastPairInput(); pairInput.proxyA = b2MakeProxy(shape.center, 1, shape.radius); @@ -951,7 +951,7 @@ public static B2CastOutput b2ShapeCastCircle(ref B2Circle shape, ref B2ShapeCast } /// Shape cast versus a capsule. - public static B2CastOutput b2ShapeCastCapsule(ref B2Capsule shape, ref B2ShapeCastInput input) + internal static B2CastOutput b2ShapeCastCapsule(ref B2Capsule shape, ref B2ShapeCastInput input) { B2ShapeCastPairInput pairInput = new B2ShapeCastPairInput(); pairInput.proxyA = b2MakeProxy(shape.center1, shape.center2, 2, shape.radius); @@ -967,7 +967,7 @@ public static B2CastOutput b2ShapeCastCapsule(ref B2Capsule shape, ref B2ShapeCa } /// Shape cast versus a line segment. - public static B2CastOutput b2ShapeCastSegment(ref B2Segment shape, ref B2ShapeCastInput input) + internal static B2CastOutput b2ShapeCastSegment(ref B2Segment shape, ref B2ShapeCastInput input) { B2ShapeCastPairInput pairInput = new B2ShapeCastPairInput(); pairInput.proxyA = b2MakeProxy(shape.point1, shape.point2, 2, 0.0f); @@ -983,7 +983,7 @@ public static B2CastOutput b2ShapeCastSegment(ref B2Segment shape, ref B2ShapeCa } /// Shape cast versus a convex polygon. - public static B2CastOutput b2ShapeCastPolygon(ref B2Polygon shape, ref B2ShapeCastInput input) + internal static B2CastOutput b2ShapeCastPolygon(ref B2Polygon shape, ref B2ShapeCastInput input) { B2ShapeCastPairInput pairInput = new B2ShapeCastPairInput(); pairInput.proxyA = b2MakeProxy(shape.vertices.AsSpan(), shape.count, shape.radius); @@ -998,7 +998,7 @@ public static B2CastOutput b2ShapeCastPolygon(ref B2Polygon shape, ref B2ShapeCa return output; } - public static B2PlaneResult b2CollideMoverAndCircle(ref B2Capsule mover, ref B2Circle shape) + internal static B2PlaneResult b2CollideMoverAndCircle(ref B2Capsule mover, ref B2Circle shape) { B2DistanceInput distanceInput = new B2DistanceInput(); distanceInput.proxyA = b2MakeProxy(shape.center, 1, 0.0f); @@ -1021,7 +1021,7 @@ public static B2PlaneResult b2CollideMoverAndCircle(ref B2Capsule mover, ref B2C return new B2PlaneResult(); } - public static B2PlaneResult b2CollideMoverAndCapsule(ref B2Capsule mover, ref B2Capsule shape) + internal static B2PlaneResult b2CollideMoverAndCapsule(ref B2Capsule mover, ref B2Capsule shape) { B2DistanceInput distanceInput = new B2DistanceInput(); distanceInput.proxyA = b2MakeProxy(shape.center1, shape.center2, 2, 0.0f); @@ -1044,7 +1044,7 @@ public static B2PlaneResult b2CollideMoverAndCapsule(ref B2Capsule mover, ref B2 return new B2PlaneResult(); } - public static B2PlaneResult b2CollideMoverAndPolygon(ref B2Capsule mover, ref B2Polygon shape) + internal static B2PlaneResult b2CollideMoverAndPolygon(ref B2Capsule mover, ref B2Polygon shape) { B2DistanceInput distanceInput = new B2DistanceInput(); distanceInput.proxyA = b2MakeProxy(shape.vertices.AsSpan(), shape.count, shape.radius); @@ -1067,7 +1067,7 @@ public static B2PlaneResult b2CollideMoverAndPolygon(ref B2Capsule mover, ref B2 return new B2PlaneResult(); } - public static B2PlaneResult b2CollideMoverAndSegment(ref B2Capsule mover, ref B2Segment shape) + internal static B2PlaneResult b2CollideMoverAndSegment(ref B2Capsule mover, ref B2Segment shape) { B2DistanceInput distanceInput = new B2DistanceInput(); distanceInput.proxyA = b2MakeProxy(shape.point1, shape.point2, 2, 0.0f); diff --git a/src/Box2D.NET/B2Hulls.cs b/src/Box2D.NET/B2Hulls.cs index 07870212..d8219118 100644 --- a/src/Box2D.NET/B2Hulls.cs +++ b/src/Box2D.NET/B2Hulls.cs @@ -12,7 +12,7 @@ namespace Box2D.NET public static class B2Hulls { // quickhull recursion - public static B2Hull b2RecurseHull(B2Vec2 p1, B2Vec2 p2, Span ps, int count) + internal static B2Hull b2RecurseHull(B2Vec2 p1, B2Vec2 p2, Span ps, int count) { B2Hull hull = new B2Hull(); hull.count = 0; diff --git a/src/Box2D.NET/B2IdPools.cs b/src/Box2D.NET/B2IdPools.cs index e056e77e..dd6a69ef 100644 --- a/src/Box2D.NET/B2IdPools.cs +++ b/src/Box2D.NET/B2IdPools.cs @@ -9,17 +9,17 @@ namespace Box2D.NET { public static class B2IdPools { - public static int b2GetIdCount(B2IdPool pool) + internal static int b2GetIdCount(B2IdPool pool) { return pool.nextIndex - pool.freeArray.count; } - public static int b2GetIdCapacity(B2IdPool pool) + internal static int b2GetIdCapacity(B2IdPool pool) { return pool.nextIndex; } - public static int b2GetIdBytes(B2IdPool pool) + internal static int b2GetIdBytes(B2IdPool pool) { return b2Array_ByteCount(ref pool.freeArray); } @@ -39,7 +39,7 @@ public static void b2DestroyIdPool(ref B2IdPool pool) pool.Clear(); } - public static int b2AllocId(B2IdPool pool) + internal static int b2AllocId(B2IdPool pool) { int count = pool.freeArray.count; if (count > 0) @@ -53,7 +53,7 @@ public static int b2AllocId(B2IdPool pool) return nextId; } - public static void b2FreeId(B2IdPool pool, int id) + internal static void b2FreeId(B2IdPool pool, int id) { B2_ASSERT(pool.nextIndex > 0); B2_ASSERT(0 <= id && id < pool.nextIndex); @@ -61,7 +61,7 @@ public static void b2FreeId(B2IdPool pool, int id) } #if DEBUG - public static void b2ValidateFreeId(B2IdPool pool, int id) + internal static void b2ValidateFreeId(B2IdPool pool, int id) { int freeCount = pool.freeArray.count; for (int i = 0; i < freeCount; ++i) @@ -75,7 +75,7 @@ public static void b2ValidateFreeId(B2IdPool pool, int id) B2_ASSERT(false); } - public static void b2ValidateUsedId(B2IdPool pool, int id) + internal static void b2ValidateUsedId(B2IdPool pool, int id) { int freeCount = pool.freeArray.count; for (int i = 0; i < freeCount; ++i) @@ -88,13 +88,13 @@ public static void b2ValidateUsedId(B2IdPool pool, int id) } #else - public static void b2ValidateFreeId(B2IdPool pool, int id) + internal static void b2ValidateFreeId(B2IdPool pool, int id) { B2_UNUSED(pool); B2_UNUSED(id); } - public static void b2ValidateUsedId(B2IdPool pool, int id) + internal static void b2ValidateUsedId(B2IdPool pool, int id) { B2_UNUSED(pool); B2_UNUSED(id); diff --git a/src/Box2D.NET/B2Islands.cs b/src/Box2D.NET/B2Islands.cs index f294e28b..cc2810b8 100644 --- a/src/Box2D.NET/B2Islands.cs +++ b/src/Box2D.NET/B2Islands.cs @@ -94,7 +94,7 @@ public static void b2DestroyIsland(B2World world, int islandId) } - public static int b2MergeIslands(B2World world, int islandIdA, int islandIdB) + internal static int b2MergeIslands(B2World world, int islandIdA, int islandIdB) { if (islandIdA == islandIdB) { @@ -245,7 +245,7 @@ public static int b2MergeIslands(B2World world, int islandIdA, int islandIdB) return bigId; } - public static void b2AddContactToIsland(B2World world, int islandId, B2Contact contact) + internal static void b2AddContactToIsland(B2World world, int islandId, B2Contact contact) { B2_ASSERT(contact.islandId == B2_NULL_INDEX); B2_ASSERT(contact.islandPrev == B2_NULL_INDEX); @@ -273,7 +273,7 @@ public static void b2AddContactToIsland(B2World world, int islandId, B2Contact c } // Link a contact into an island. - public static void b2LinkContact(B2World world, B2Contact contact) + internal static void b2LinkContact(B2World world, B2Contact contact) { B2_ASSERT((contact.flags & (uint)B2ContactFlags.b2_contactTouchingFlag) != 0); @@ -315,7 +315,7 @@ public static void b2LinkContact(B2World world, B2Contact contact) // Unlink contact from the island graph when it stops having contact points // This is called when a contact no longer has contact points or when a contact is destroyed. - public static void b2UnlinkContact(B2World world, B2Contact contact) + internal static void b2UnlinkContact(B2World world, B2Contact contact) { B2_ASSERT(contact.islandId != B2_NULL_INDEX); @@ -358,7 +358,7 @@ public static void b2UnlinkContact(B2World world, B2Contact contact) b2ValidateIsland(world, islandId); } - public static void b2AddJointToIsland(B2World world, int islandId, B2Joint joint) + internal static void b2AddJointToIsland(B2World world, int islandId, B2Joint joint) { B2_ASSERT(joint.islandId == B2_NULL_INDEX); B2_ASSERT(joint.islandPrev == B2_NULL_INDEX); @@ -386,7 +386,7 @@ public static void b2AddJointToIsland(B2World world, int islandId, B2Joint joint } // Link a joint into the island graph when it is created - public static void b2LinkJoint(B2World world, B2Joint joint) + internal static void b2LinkJoint(B2World world, B2Joint joint) { B2Body bodyA = b2Array_Get(ref world.bodies, joint.edges[0].bodyId); B2Body bodyB = b2Array_Get(ref world.bodies, joint.edges[1].bodyId); @@ -415,7 +415,7 @@ public static void b2LinkJoint(B2World world, B2Joint joint) } // Unlink a joint from the island graph when it is destroyed - public static void b2UnlinkJoint(B2World world, B2Joint joint) + internal static void b2UnlinkJoint(B2World world, B2Joint joint) { if (joint.islandId == B2_NULL_INDEX) { @@ -464,7 +464,7 @@ public static void b2UnlinkJoint(B2World world, B2Joint joint) // Possible optimizations: // 2. start from the sleepy bodies and stop processing if a sleep body is connected to a non-sleepy body // 3. use a sleepy flag on bodies to avoid velocity access - public static void b2SplitIsland(B2World world, int baseId) + internal static void b2SplitIsland(B2World world, int baseId) { B2Island baseIsland = b2Array_Get(ref world.islands, baseId); int setIndex = baseIsland.setIndex; @@ -705,7 +705,7 @@ public static void b2SplitIsland(B2World world, int baseId) // Note: static bodies are never in an island // Note: this task interacts with some allocators without locks under the assumption that no other tasks // are interacting with these data structures. - public static void b2SplitIslandTask(int startIndex, int endIndex, uint threadIndex, object context) + internal static void b2SplitIslandTask(int startIndex, int endIndex, uint threadIndex, object context) { b2TracyCZoneNC(B2TracyCZone.split, "Split Island", B2HexColor.b2_colorOlive, true); @@ -723,7 +723,7 @@ public static void b2SplitIslandTask(int startIndex, int endIndex, uint threadIn } #if DEBUG - public static void b2ValidateIsland(B2World world, int islandId) + internal static void b2ValidateIsland(B2World world, int islandId) { if (islandId == B2_NULL_INDEX) { @@ -838,7 +838,7 @@ public static void b2ValidateIsland(B2World world, int islandId) } #else - public static void b2ValidateIsland(B2World world, int islandId) + internal static void b2ValidateIsland(B2World world, int islandId) { B2_UNUSED(world); B2_UNUSED(islandId); diff --git a/src/Box2D.NET/B2Joints.cs b/src/Box2D.NET/B2Joints.cs index 30b9e07b..586c5b46 100644 --- a/src/Box2D.NET/B2Joints.cs +++ b/src/Box2D.NET/B2Joints.cs @@ -119,7 +119,7 @@ public static B2ExplosionDef b2DefaultExplosionDef() return def; } - public static B2Joint b2GetJointFullId(B2World world, B2JointId jointId) + internal static B2Joint b2GetJointFullId(B2World world, B2JointId jointId) { int id = jointId.index1 - 1; B2Joint joint = b2Array_Get(ref world.joints, id); @@ -127,7 +127,7 @@ public static B2Joint b2GetJointFullId(B2World world, B2JointId jointId) return joint; } - public static B2JointSim b2GetJointSim(B2World world, B2Joint joint) + internal static B2JointSim b2GetJointSim(B2World world, B2Joint joint) { if (joint.setIndex == (int)B2SetType.b2_awakeSet) { @@ -140,7 +140,7 @@ public static B2JointSim b2GetJointSim(B2World world, B2Joint joint) return b2Array_Get(ref set.jointSims, joint.localIndex); } - public static B2JointSim b2GetJointSimCheckType(B2JointId jointId, B2JointType type) + internal static B2JointSim b2GetJointSimCheckType(B2JointId jointId, B2JointType type) { B2_UNUSED(type); @@ -911,7 +911,7 @@ public static void b2Joint_WakeBodies(B2JointId jointId) b2WakeBody(world, bodyB); } - public static void b2GetJointReaction(B2JointSim sim, float invTimeStep, out float force, out float torque) + internal static void b2GetJointReaction(B2JointSim sim, float invTimeStep, out float force, out float torque) { float linearImpulse = 0.0f; float angularImpulse = 0.0f; @@ -978,7 +978,7 @@ public static void b2GetJointReaction(B2JointSim sim, float invTimeStep, out flo torque = angularImpulse * invTimeStep; } - public static B2Vec2 b2GetJointConstraintForce(B2World world, B2Joint joint) + internal static B2Vec2 b2GetJointConstraintForce(B2World world, B2Joint joint) { B2JointSim @base = b2GetJointSim(world, joint); @@ -1012,7 +1012,7 @@ public static B2Vec2 b2GetJointConstraintForce(B2World world, B2Joint joint) } /// Get the current constraint torque for this joint. Usually in Newton * meters. - public static float b2GetJointConstraintTorque(B2World world, B2Joint joint) + internal static float b2GetJointConstraintTorque(B2World world, B2Joint joint) { B2JointSim @base = b2GetJointSim(world, joint); @@ -1311,7 +1311,7 @@ public static float b2Joint_GetTorqueThreshold(B2JointId jointId) return @base.torqueThreshold; } - public static void b2PrepareJoint(B2JointSim joint, B2StepContext context) + internal static void b2PrepareJoint(B2JointSim joint, B2StepContext context) { // Clamp joint hertz based on the time step to reduce jitter. float hertz = b2MinFloat(joint.constraintHertz, 0.25f * context.inv_h); @@ -1352,7 +1352,7 @@ public static void b2PrepareJoint(B2JointSim joint, B2StepContext context) } } - public static void b2WarmStartJoint(B2JointSim joint, B2StepContext context) + internal static void b2WarmStartJoint(B2JointSim joint, B2StepContext context) { switch (joint.type) { @@ -1389,7 +1389,7 @@ public static void b2WarmStartJoint(B2JointSim joint, B2StepContext context) } } - public static void b2SolveJoint(B2JointSim joint, B2StepContext context, bool useBias) + internal static void b2SolveJoint(B2JointSim joint, B2StepContext context, bool useBias) { switch (joint.type) { @@ -1426,7 +1426,7 @@ public static void b2SolveJoint(B2JointSim joint, B2StepContext context, bool us } } - public static void b2PrepareOverflowJoints(B2StepContext context) + internal static void b2PrepareOverflowJoints(B2StepContext context) { b2TracyCZoneNC(B2TracyCZone.prepare_joints, "PrepJoints", B2HexColor.b2_colorOldLace, true); @@ -1443,7 +1443,7 @@ public static void b2PrepareOverflowJoints(B2StepContext context) b2TracyCZoneEnd(B2TracyCZone.prepare_joints); } - public static void b2WarmStartOverflowJoints(B2StepContext context) + internal static void b2WarmStartOverflowJoints(B2StepContext context) { b2TracyCZoneNC(B2TracyCZone.prepare_joints, "PrepJoints", B2HexColor.b2_colorOldLace, true); @@ -1460,7 +1460,7 @@ public static void b2WarmStartOverflowJoints(B2StepContext context) b2TracyCZoneEnd(B2TracyCZone.prepare_joints); } - public static void b2SolveOverflowJoints(B2StepContext context, bool useBias) + internal static void b2SolveOverflowJoints(B2StepContext context, bool useBias) { b2TracyCZoneNC(B2TracyCZone.solve_joints, "SolveJoints", B2HexColor.b2_colorLemonChiffon, true); @@ -1477,7 +1477,7 @@ public static void b2SolveOverflowJoints(B2StepContext context, bool useBias) b2TracyCZoneEnd(B2TracyCZone.solve_joints); } - public static void b2DrawJoint(B2DebugDraw draw, B2World world, B2Joint joint) + internal static void b2DrawJoint(B2DebugDraw draw, B2World world, B2Joint joint) { B2Body bodyA = b2Array_Get(ref world.bodies, joint.edges[0].bodyId); B2Body bodyB = b2Array_Get(ref world.bodies, joint.edges[1].bodyId); diff --git a/src/Box2D.NET/B2Manifolds.cs b/src/Box2D.NET/B2Manifolds.cs index a6f4e8bf..e3987ac5 100644 --- a/src/Box2D.NET/B2Manifolds.cs +++ b/src/Box2D.NET/B2Manifolds.cs @@ -12,7 +12,7 @@ namespace Box2D.NET { public static class B2Manifolds { - public static ushort B2_MAKE_ID(int A, int B) + internal static ushort B2_MAKE_ID(int A, int B) { return (ushort)((byte)(A) << 8 | (byte)(B)); } @@ -551,7 +551,7 @@ public static B2Manifold b2CollidePolygonAndCapsule(ref B2Polygon polygonA, B2Tr } // Polygon clipper used to compute contact points when there are potentially two contact points. - public static B2Manifold b2ClipPolygons(ref B2Polygon polyA, ref B2Polygon polyB, int edgeA, int edgeB, bool flip) + internal static B2Manifold b2ClipPolygons(ref B2Polygon polyA, ref B2Polygon polyB, int edgeA, int edgeB, bool flip) { B2Manifold manifold = new B2Manifold(); @@ -686,7 +686,7 @@ public static B2Manifold b2ClipPolygons(ref B2Polygon polyA, ref B2Polygon polyB } // Find the max separation between poly1 and poly2 using edge normals from poly1. - public static float b2FindMaxSeparation(ref int edgeIndex, ref B2Polygon poly1, B2Polygon poly2) + internal static float b2FindMaxSeparation(ref int edgeIndex, ref B2Polygon poly1, B2Polygon poly2) { int count1 = poly1.count; int count2 = poly2.count; @@ -1196,7 +1196,7 @@ public static B2Manifold b2CollideChainSegmentAndCapsule(ref B2ChainSegment segm return b2CollideChainSegmentAndPolygon(ref segmentA, xfA, ref polyB, xfB, ref cache); } - public static B2Manifold b2ClipSegments(B2Vec2 a1, B2Vec2 a2, B2Vec2 b1, B2Vec2 b2, B2Vec2 normal, float ra, float rb, ushort id1, ushort id2) + internal static B2Manifold b2ClipSegments(B2Vec2 a1, B2Vec2 a2, B2Vec2 b1, B2Vec2 b2, B2Vec2 normal, float ra, float rb, ushort id1, ushort id2) { B2Manifold manifold = new B2Manifold(); @@ -1270,7 +1270,7 @@ public static B2Manifold b2ClipSegments(B2Vec2 a1, B2Vec2 a2, B2Vec2 b1, B2Vec2 // Evaluate Gauss map // See https://box2d.org/posts/2020/06/ghost-collisions/ - public static B2NormalType b2ClassifyNormal(B2ChainSegmentParams param, B2Vec2 normal) + internal static B2NormalType b2ClassifyNormal(B2ChainSegmentParams param, B2Vec2 normal) { const float sinTol = 0.01f; diff --git a/src/Box2D.NET/B2MotorJoints.cs b/src/Box2D.NET/B2MotorJoints.cs index 0bfd3d0e..93d4d8e6 100644 --- a/src/Box2D.NET/B2MotorJoints.cs +++ b/src/Box2D.NET/B2MotorJoints.cs @@ -166,13 +166,13 @@ public static float b2MotorJoint_GetMaxSpringTorque(B2JointId jointId) return joint.uj.motorJoint.maxSpringTorque; } - public static B2Vec2 b2GetMotorJointForce(B2World world, B2JointSim @base) + internal static B2Vec2 b2GetMotorJointForce(B2World world, B2JointSim @base) { B2Vec2 force = b2MulSV(world.inv_h, b2Add(@base.uj.motorJoint.linearVelocityImpulse, @base.uj.motorJoint.linearSpringImpulse)); return force; } - public static float b2GetMotorJointTorque(B2World world, B2JointSim @base) + internal static float b2GetMotorJointTorque(B2World world, B2JointSim @base) { return world.inv_h * (@base.uj.motorJoint.angularVelocityImpulse + @base.uj.motorJoint.angularSpringImpulse); } @@ -191,7 +191,7 @@ public static float b2GetMotorJointTorque(B2World world, B2JointSim @base) // J = [0 0 -1 0 0 1] // K = invI1 + invI2 - public static void b2PrepareMotorJoint(B2JointSim @base, B2StepContext context) + internal static void b2PrepareMotorJoint(B2JointSim @base, B2StepContext context) { B2_ASSERT(@base.type == B2JointType.b2_motorJoint); @@ -263,7 +263,7 @@ public static void b2PrepareMotorJoint(B2JointSim @base, B2StepContext context) } } - public static void b2WarmStartMotorJoint(B2JointSim @base, B2StepContext context) + internal static void b2WarmStartMotorJoint(B2JointSim @base, B2StepContext context) { B2_ASSERT(@base.type == B2JointType.b2_motorJoint); @@ -299,7 +299,7 @@ public static void b2WarmStartMotorJoint(B2JointSim @base, B2StepContext context } } - public static void b2SolveMotorJoint(B2JointSim @base, B2StepContext context) + internal static void b2SolveMotorJoint(B2JointSim @base, B2StepContext context) { B2_ASSERT(@base.type == B2JointType.b2_motorJoint); diff --git a/src/Box2D.NET/B2Mutexes.cs b/src/Box2D.NET/B2Mutexes.cs index 43618e09..b843af46 100644 --- a/src/Box2D.NET/B2Mutexes.cs +++ b/src/Box2D.NET/B2Mutexes.cs @@ -20,12 +20,12 @@ public static void b2DestroyMutex(ref B2Mutex m) m.lc = null; } - public static void b2LockMutex(ref B2Mutex m) + internal static void b2LockMutex(ref B2Mutex m) { Monitor.Enter(m.lc); } - public static void b2UnlockMutex(ref B2Mutex m) + internal static void b2UnlockMutex(ref B2Mutex m) { Monitor.Exit(m.lc); } diff --git a/src/Box2D.NET/B2PrismaticJoints.cs b/src/Box2D.NET/B2PrismaticJoints.cs index 9b4983e4..ff0a862b 100644 --- a/src/Box2D.NET/B2PrismaticJoints.cs +++ b/src/Box2D.NET/B2PrismaticJoints.cs @@ -214,7 +214,7 @@ public static float b2PrismaticJoint_GetSpeed(B2JointId jointId) return speed; } - public static B2Vec2 b2GetPrismaticJointForce(B2World world, B2JointSim @base) + internal static B2Vec2 b2GetPrismaticJointForce(B2World world, B2JointSim @base) { int idA = @base.bodyIdA; B2Transform transformA = b2GetBodyTransform(world, idA); @@ -233,7 +233,7 @@ public static B2Vec2 b2GetPrismaticJointForce(B2World world, B2JointSim @base) return force; } - public static float b2GetPrismaticJointTorque(B2World world, B2JointSim @base) + internal static float b2GetPrismaticJointTorque(B2World world, B2JointSim @base) { return world.inv_h * @base.uj.prismaticJoint.impulse.Y; } @@ -283,7 +283,7 @@ public static float b2GetPrismaticJointTorque(B2World world, B2JointSim @base) // s1 = cross(d + r1, u), s2 = cross(r2, u) // a1 = cross(d + r1, v), a2 = cross(r2, v) - public static void b2PreparePrismaticJoint(B2JointSim @base, B2StepContext context) + internal static void b2PreparePrismaticJoint(B2JointSim @base, B2StepContext context) { B2_ASSERT(@base.type == B2JointType.b2_prismaticJoint); @@ -341,7 +341,7 @@ public static void b2PreparePrismaticJoint(B2JointSim @base, B2StepContext conte } } - public static void b2WarmStartPrismaticJoint(B2JointSim @base, B2StepContext context) + internal static void b2WarmStartPrismaticJoint(B2JointSim @base, B2StepContext context) { B2_ASSERT(@base.type == B2JointType.b2_prismaticJoint); @@ -395,7 +395,7 @@ public static void b2WarmStartPrismaticJoint(B2JointSim @base, B2StepContext con } } - public static void b2SolvePrismaticJoint(B2JointSim @base, B2StepContext context, bool useBias) + internal static void b2SolvePrismaticJoint(B2JointSim @base, B2StepContext context, bool useBias) { B2_ASSERT(@base.type == B2JointType.b2_prismaticJoint); @@ -657,7 +657,7 @@ public static void b2SolvePrismaticJoint(B2JointSim @base, B2StepContext context } #if FALSE - public static void b2PrismaticJoint::Dump() + internal static void b2PrismaticJoint::Dump() { int32 indexA = joint.bodyA.joint.islandIndex; int32 indexB = joint.bodyB.joint.islandIndex; @@ -679,7 +679,7 @@ public static void b2SolvePrismaticJoint(B2JointSim @base, B2StepContext context } #endif - public static void b2DrawPrismaticJoint(B2DebugDraw draw, B2JointSim @base, B2Transform transformA, B2Transform transformB, float drawScale) + internal static void b2DrawPrismaticJoint(B2DebugDraw draw, B2JointSim @base, B2Transform transformA, B2Transform transformB, float drawScale) { B2_ASSERT(@base.type == B2JointType.b2_prismaticJoint); diff --git a/src/Box2D.NET/B2RevoluteJoints.cs b/src/Box2D.NET/B2RevoluteJoints.cs index e94db556..1df3ad50 100644 --- a/src/Box2D.NET/B2RevoluteJoints.cs +++ b/src/Box2D.NET/B2RevoluteJoints.cs @@ -191,20 +191,20 @@ public static float b2RevoluteJoint_GetMaxMotorTorque(B2JointId jointId) return joint.uj.revoluteJoint.maxMotorTorque; } - public static B2Vec2 b2GetRevoluteJointForce(B2World world, B2JointSim @base) + internal static B2Vec2 b2GetRevoluteJointForce(B2World world, B2JointSim @base) { B2Vec2 force = b2MulSV(world.inv_h, @base.uj.revoluteJoint.linearImpulse); return force; } - public static float b2GetRevoluteJointTorque(B2World world, B2JointSim @base) + internal static float b2GetRevoluteJointTorque(B2World world, B2JointSim @base) { ref readonly B2RevoluteJoint revolute = ref @base.uj.revoluteJoint; float torque = world.inv_h * (revolute.motorImpulse + revolute.lowerImpulse - revolute.upperImpulse); return torque; } - public static void b2PrepareRevoluteJoint(B2JointSim @base, B2StepContext context) + internal static void b2PrepareRevoluteJoint(B2JointSim @base, B2StepContext context) { B2_ASSERT(@base.type == B2JointType.b2_revoluteJoint); @@ -270,7 +270,7 @@ public static void b2PrepareRevoluteJoint(B2JointSim @base, B2StepContext contex } } - public static void b2WarmStartRevoluteJoint(B2JointSim @base, B2StepContext context) + internal static void b2WarmStartRevoluteJoint(B2JointSim @base, B2StepContext context) { B2_ASSERT(@base.type == B2JointType.b2_revoluteJoint); @@ -304,7 +304,7 @@ public static void b2WarmStartRevoluteJoint(B2JointSim @base, B2StepContext cont } } - public static void b2SolveRevoluteJoint(B2JointSim @base, B2StepContext context, bool useBias) + internal static void b2SolveRevoluteJoint(B2JointSim @base, B2StepContext context, bool useBias) { B2_ASSERT(@base.type == B2JointType.b2_revoluteJoint); @@ -512,7 +512,7 @@ public static void b2SolveRevoluteJoint(B2JointSim @base, B2StepContext context, } #endif - public static void b2DrawRevoluteJoint(B2DebugDraw draw, B2JointSim @base, B2Transform transformA, B2Transform transformB, float drawScale) + internal static void b2DrawRevoluteJoint(B2DebugDraw draw, B2JointSim @base, B2Transform transformA, B2Transform transformB, float drawScale) { B2_ASSERT(@base.type == B2JointType.b2_revoluteJoint); diff --git a/src/Box2D.NET/B2RuntimeValidator.cs b/src/Box2D.NET/B2RuntimeValidator.cs index d03e9176..e445bbe5 100644 --- a/src/Box2D.NET/B2RuntimeValidator.cs +++ b/src/Box2D.NET/B2RuntimeValidator.cs @@ -10,7 +10,7 @@ namespace Box2D.NET { public class B2RuntimeValidator { - public static readonly B2RuntimeValidator Shared = new B2RuntimeValidator(); + internal static readonly B2RuntimeValidator Shared = new B2RuntimeValidator(); private B2RuntimeValidator() { diff --git a/src/Box2D.NET/B2Sensors.cs b/src/Box2D.NET/B2Sensors.cs index 188c6796..49bdd973 100644 --- a/src/Box2D.NET/B2Sensors.cs +++ b/src/Box2D.NET/B2Sensors.cs @@ -37,7 +37,7 @@ public static class B2Sensors // Each sensor has an double buffered array of overlaps // These overlaps use a shape reference with index and generation - public static bool b2SensorQueryCallback(int proxyId, ulong userData, ref B2SensorQueryContext context) + internal static bool b2SensorQueryCallback(int proxyId, ulong userData, ref B2SensorQueryContext context) { B2_UNUSED(proxyId); @@ -115,7 +115,7 @@ public static bool b2SensorQueryCallback(int proxyId, ulong userData, ref B2Sens return true; } - public static int b2CompareVisitors(ref B2Visitor a, ref B2Visitor b) + internal static int b2CompareVisitors(ref B2Visitor a, ref B2Visitor b) { ref readonly B2Visitor sa = ref a; ref readonly B2Visitor sb = ref b; @@ -128,7 +128,7 @@ public static int b2CompareVisitors(ref B2Visitor a, ref B2Visitor b) return 1; } - public static void b2SensorTask(int startIndex, int endIndex, uint threadIndex, object context) + internal static void b2SensorTask(int startIndex, int endIndex, uint threadIndex, object context) { b2TracyCZoneNC(B2TracyCZone.sensor_task, "Overlap", B2HexColor.b2_colorBrown, true); @@ -236,7 +236,7 @@ public static void b2SensorTask(int startIndex, int endIndex, uint threadIndex, b2TracyCZoneEnd(B2TracyCZone.sensor_task); } - public static void b2OverlapSensors(B2World world) + internal static void b2OverlapSensors(B2World world) { int sensorCount = world.sensors.count; if (sensorCount == 0) diff --git a/src/Box2D.NET/B2ShapeRefComparer.cs b/src/Box2D.NET/B2ShapeRefComparer.cs index 90deca72..6c1becad 100644 --- a/src/Box2D.NET/B2ShapeRefComparer.cs +++ b/src/Box2D.NET/B2ShapeRefComparer.cs @@ -8,7 +8,7 @@ namespace Box2D.NET { public class B2ShapeRefComparer : IComparer { - public static readonly B2ShapeRefComparer Shared = new B2ShapeRefComparer(); + internal static readonly B2ShapeRefComparer Shared = new B2ShapeRefComparer(); private B2ShapeRefComparer() { diff --git a/src/Box2D.NET/B2Shapes.cs b/src/Box2D.NET/B2Shapes.cs index e4d27e90..009b6965 100644 --- a/src/Box2D.NET/B2Shapes.cs +++ b/src/Box2D.NET/B2Shapes.cs @@ -25,7 +25,7 @@ namespace Box2D.NET public static class B2Shapes { [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static float b2GetShapeRadius(B2Shape shape) + internal static float b2GetShapeRadius(B2Shape shape) { switch (shape.type) { @@ -41,7 +41,7 @@ public static float b2GetShapeRadius(B2Shape shape) } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool b2ShouldShapesCollide(B2Filter filterA, B2Filter filterB) + internal static bool b2ShouldShapesCollide(B2Filter filterA, B2Filter filterB) { if (filterA.groupIndex == filterB.groupIndex && filterA.groupIndex != 0) { @@ -52,13 +52,13 @@ public static bool b2ShouldShapesCollide(B2Filter filterA, B2Filter filterB) } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool b2ShouldQueryCollide(B2Filter shapeFilter, B2QueryFilter queryFilter) + internal static bool b2ShouldQueryCollide(B2Filter shapeFilter, B2QueryFilter queryFilter) { return (shapeFilter.categoryBits & queryFilter.maskBits) != 0 && (shapeFilter.maskBits & queryFilter.categoryBits) != 0; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static B2Shape b2GetShape(B2World world, B2ShapeId shapeId) + internal static B2Shape b2GetShape(B2World world, B2ShapeId shapeId) { int id = shapeId.index1 - 1; B2Shape shape = b2Array_Get(ref world.shapes, id); @@ -66,7 +66,7 @@ public static B2Shape b2GetShape(B2World world, B2ShapeId shapeId) return shape; } - public static B2ChainShape b2GetChainShape(B2World world, B2ChainId chainId) + internal static B2ChainShape b2GetChainShape(B2World world, B2ChainId chainId) { int id = chainId.index1 - 1; B2ChainShape chain = b2Array_Get(ref world.chainShapes, id); @@ -74,7 +74,7 @@ public static B2ChainShape b2GetChainShape(B2World world, B2ChainId chainId) return chain; } - public static void b2UpdateShapeAABBs(B2Shape shape, B2Transform transform, B2BodyType proxyType) + internal static void b2UpdateShapeAABBs(B2Shape shape, B2Transform transform, B2BodyType proxyType) { // Compute a bounding box with a speculative margin float speculativeDistance = B2_SPECULATIVE_DISTANCE; @@ -506,7 +506,7 @@ public static B2ChainId b2CreateChain(B2BodyId bodyId, ref B2ChainDef def) return id; } - public static void b2FreeChainData(B2ChainShape chain) + internal static void b2FreeChainData(B2ChainShape chain) { b2Free(chain.shapeIndices, chain.count); chain.shapeIndices = null; @@ -607,7 +607,7 @@ public static int b2Chain_GetSegments(B2ChainId chainId, B2ShapeId[] segmentArra return count; } - public static B2AABB b2ComputeShapeAABB(B2Shape shape, B2Transform xf) + internal static B2AABB b2ComputeShapeAABB(B2Shape shape, B2Transform xf) { switch (shape.type) { @@ -630,7 +630,7 @@ public static B2AABB b2ComputeShapeAABB(B2Shape shape, B2Transform xf) } } - public static B2Vec2 b2GetShapeCentroid(B2Shape shape) + internal static B2Vec2 b2GetShapeCentroid(B2Shape shape) { switch (shape.type) { @@ -650,7 +650,7 @@ public static B2Vec2 b2GetShapeCentroid(B2Shape shape) } // todo_erin maybe compute this on shape creation - public static float b2GetShapePerimeter(B2Shape shape) + internal static float b2GetShapePerimeter(B2Shape shape) { switch (shape.type) { @@ -685,7 +685,7 @@ public static float b2GetShapePerimeter(B2Shape shape) } // This projects the shape perimeter onto an infinite line - public static float b2GetShapeProjectedPerimeter(B2Shape shape, B2Vec2 line) + internal static float b2GetShapeProjectedPerimeter(B2Shape shape, B2Vec2 line) { switch (shape.type) { @@ -736,7 +736,7 @@ public static float b2GetShapeProjectedPerimeter(B2Shape shape, B2Vec2 line) } } - public static B2MassData b2ComputeShapeMass(B2Shape shape) + internal static B2MassData b2ComputeShapeMass(B2Shape shape) { switch (shape.type) { @@ -751,7 +751,7 @@ public static B2MassData b2ComputeShapeMass(B2Shape shape) } } - public static B2ShapeExtent b2ComputeShapeExtent(B2Shape shape, B2Vec2 localCenter) + internal static B2ShapeExtent b2ComputeShapeExtent(B2Shape shape, B2Vec2 localCenter) { B2ShapeExtent extent = new B2ShapeExtent(); @@ -821,7 +821,7 @@ public static B2ShapeExtent b2ComputeShapeExtent(B2Shape shape, B2Vec2 localCent return extent; } - public static B2CastOutput b2RayCastShape(ref B2RayCastInput input, B2Shape shape, B2Transform transform) + internal static B2CastOutput b2RayCastShape(ref B2RayCastInput input, B2Shape shape, B2Transform transform) { B2RayCastInput localInput = input; localInput.origin = b2InvTransformPoint(transform, input.origin); @@ -854,7 +854,7 @@ public static B2CastOutput b2RayCastShape(ref B2RayCastInput input, B2Shape shap return output; } - public static B2CastOutput b2ShapeCastShape(ref B2ShapeCastInput input, B2Shape shape, B2Transform transform) + internal static B2CastOutput b2ShapeCastShape(ref B2ShapeCastInput input, B2Shape shape, B2Transform transform) { B2CastOutput output = new B2CastOutput(); @@ -918,7 +918,7 @@ public static B2CastOutput b2ShapeCastShape(ref B2ShapeCastInput input, B2Shape return output; } - public static B2PlaneResult b2CollideMover(ref B2Capsule mover, B2Shape shape, B2Transform transform) + internal static B2PlaneResult b2CollideMover(ref B2Capsule mover, B2Shape shape, B2Transform transform) { B2Capsule localMover = new B2Capsule(); localMover.center1 = b2InvTransformPoint(transform, mover.center1); @@ -1063,7 +1063,7 @@ public static bool b2Shape_TestPoint(B2ShapeId shapeId, B2Vec2 point) } // todo_erin untested - public static B2CastOutput b2Shape_RayCast(B2ShapeId shapeId, ref B2RayCastInput input) + internal static B2CastOutput b2Shape_RayCast(B2ShapeId shapeId, ref B2RayCastInput input) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1237,7 +1237,7 @@ public static B2Filter b2Shape_GetFilter(B2ShapeId shapeId) return shape.filter; } - public static void b2ResetProxy(B2World world, B2Shape shape, bool wakeBodies, bool destroyProxy) + internal static void b2ResetProxy(B2World world, B2Shape shape, bool wakeBodies, bool destroyProxy) { B2Body body = b2Array_Get(ref world.bodies, shape.bodyId); @@ -1353,7 +1353,7 @@ public static void b2Shape_EnableContactEvents(B2ShapeId shapeId, bool flag) shape.enableContactEvents = flag; } - public static bool b2Shape_AreContactEventsEnabled(B2ShapeId shapeId) + internal static bool b2Shape_AreContactEventsEnabled(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1372,7 +1372,7 @@ public static void b2Shape_EnablePreSolveEvents(B2ShapeId shapeId, bool flag) shape.enablePreSolveEvents = flag; } - public static bool b2Shape_ArePreSolveEventsEnabled(B2ShapeId shapeId) + internal static bool b2Shape_ArePreSolveEventsEnabled(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1391,7 +1391,7 @@ public static void b2Shape_EnableHitEvents(B2ShapeId shapeId, bool flag) shape.enableHitEvents = flag; } - public static bool b2Shape_AreHitEventsEnabled(B2ShapeId shapeId) + internal static bool b2Shape_AreHitEventsEnabled(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); B2Shape shape = b2GetShape(world, shapeId); @@ -1718,7 +1718,7 @@ public static B2AABB b2Shape_GetAABB(B2ShapeId shapeId) } /// Compute the mass data for a shape - public static B2MassData b2Shape_ComputeMassData(B2ShapeId shapeId) + internal static B2MassData b2Shape_ComputeMassData(B2ShapeId shapeId) { B2World world = b2GetWorld(shapeId.world0); if (world == null) diff --git a/src/Box2D.NET/B2SolverSets.cs b/src/Box2D.NET/B2SolverSets.cs index e65cee03..867c55c2 100644 --- a/src/Box2D.NET/B2SolverSets.cs +++ b/src/Box2D.NET/B2SolverSets.cs @@ -47,7 +47,7 @@ public static void b2DestroySolverSet(B2World world, int setIndex) // 2. non-touching contacts already in the awake set // 3. touching contacts in the sleeping set // This handles contact types 1 and 3. Type 2 doesn't need any action. - public static void b2WakeSolverSet(B2World world, int setIndex) + internal static void b2WakeSolverSet(B2World world, int setIndex) { B2_ASSERT(setIndex >= (int)B2SetType.b2_firstSleepingSet); B2SolverSet set = b2Array_Get(ref world.solverSets, setIndex); @@ -169,7 +169,7 @@ public static void b2WakeSolverSet(B2World world, int setIndex) b2DestroySolverSet(world, setIndex); } - public static void b2TrySleepIsland(B2World world, int islandId) + internal static void b2TrySleepIsland(B2World world, int islandId) { B2Island island = b2Array_Get(ref world.islands, islandId); B2_ASSERT(island.setIndex == (int)B2SetType.b2_awakeSet); @@ -447,7 +447,7 @@ public static void b2TrySleepIsland(B2World world, int islandId) // This is called when joints are created between sets. I want to allow the sets // to continue sleeping if both are asleep. Otherwise one set is waked. // Islands will get merge when the set is waked. - public static void b2MergeSolverSets(B2World world, int setId1, int setId2) + internal static void b2MergeSolverSets(B2World world, int setId1, int setId2) { B2_ASSERT(setId1 >= (int)B2SetType.b2_firstSleepingSet); B2_ASSERT(setId2 >= (int)B2SetType.b2_firstSleepingSet); @@ -545,7 +545,7 @@ public static void b2MergeSolverSets(B2World world, int setId1, int setId2) b2ValidateSolverSets(world); } - public static void b2TransferBody(B2World world, B2SolverSet targetSet, B2SolverSet sourceSet, B2Body body) + internal static void b2TransferBody(B2World world, B2SolverSet targetSet, B2SolverSet sourceSet, B2Body body) { if (targetSet == sourceSet) { @@ -591,7 +591,7 @@ public static void b2TransferBody(B2World world, B2SolverSet targetSet, B2Solver body.localIndex = targetIndex; } - public static void b2TransferJoint(B2World world, B2SolverSet targetSet, B2SolverSet sourceSet, B2Joint joint) + internal static void b2TransferJoint(B2World world, B2SolverSet targetSet, B2SolverSet sourceSet, B2Joint joint) { if (targetSet == sourceSet) { diff --git a/src/Box2D.NET/B2Solvers.cs b/src/Box2D.NET/B2Solvers.cs index 0d2fef95..f3dedd2c 100644 --- a/src/Box2D.NET/B2Solvers.cs +++ b/src/Box2D.NET/B2Solvers.cs @@ -43,9 +43,9 @@ public static class B2Solvers public const float B2_CORE_FRACTION = 0.25f; // TODO: @ikpil. check SIMD - public static readonly int B2_SIMD_SHIFT = b2SIMDShift(); + internal static readonly int B2_SIMD_SHIFT = b2SIMDShift(); - public static int b2SIMDShift() + internal static int b2SIMDShift() { if (8 == B2_SIMD_WIDTH) { @@ -99,7 +99,7 @@ public static B2Softness b2MakeSoft(float hertz, float zeta, float h) } - public static void b2Pause() + internal static void b2Pause() { // TODO: @ikpil, check sleep or yield Task.Yield(); @@ -107,7 +107,7 @@ public static void b2Pause() // Integrate velocities and apply damping - public static void b2IntegrateVelocitiesTask(int startIndex, int endIndex, B2StepContext context) + internal static void b2IntegrateVelocitiesTask(int startIndex, int endIndex, B2StepContext context) { b2TracyCZoneNC(B2TracyCZone.integrate_velocity, "IntVel", B2HexColor.b2_colorDeepPink, true); @@ -188,7 +188,7 @@ public static void b2IntegrateVelocitiesTask(int startIndex, int endIndex, B2Ste b2TracyCZoneEnd(B2TracyCZone.integrate_velocity); } - public static void b2PrepareJointsTask(int startIndex, int endIndex, B2StepContext context) + internal static void b2PrepareJointsTask(int startIndex, int endIndex, B2StepContext context) { b2TracyCZoneNC(B2TracyCZone.prepare_joints, "PrepJoints", B2HexColor.b2_colorOldLace, true); @@ -203,7 +203,7 @@ public static void b2PrepareJointsTask(int startIndex, int endIndex, B2StepConte b2TracyCZoneEnd(B2TracyCZone.prepare_joints); } - public static void b2WarmStartJointsTask(int startIndex, int endIndex, B2StepContext context, int colorIndex) + internal static void b2WarmStartJointsTask(int startIndex, int endIndex, B2StepContext context, int colorIndex) { b2TracyCZoneNC(B2TracyCZone.warm_joints, "WarmJoints", B2HexColor.b2_colorGold, true); @@ -257,7 +257,7 @@ static void b2SolveJointsTask(int startIndex, int endIndex, B2StepContext contex b2TracyCZoneEnd(B2TracyCZone.solve_joints); } - public static void b2IntegratePositionsTask(int startIndex, int endIndex, B2StepContext context) + internal static void b2IntegratePositionsTask(int startIndex, int endIndex, B2StepContext context) { b2TracyCZoneNC(B2TracyCZone.integrate_positions, "IntPos", B2HexColor.b2_colorDarkSeaGreen, true); @@ -294,7 +294,7 @@ public static void b2IntegratePositionsTask(int startIndex, int endIndex, B2Step // This is called from b2DynamicTree_Query for continuous collision - public static bool b2ContinuousQueryCallback(int proxyId, ulong userData, ref B2ContinuousContext context) + internal static bool b2ContinuousQueryCallback(int proxyId, ulong userData, ref B2ContinuousContext context) { B2_UNUSED(proxyId); @@ -496,7 +496,7 @@ public static bool b2ContinuousQueryCallback(int proxyId, ulong userData, ref B2 return true; } - public static void b2SolveContinuous(B2World world, int bodySimIndex, B2TaskContext taskContext) + internal static void b2SolveContinuous(B2World world, int bodySimIndex, B2TaskContext taskContext) { b2TracyCZoneNC(B2TracyCZone.ccd, "CCD", B2HexColor.b2_colorDarkGoldenRod, true); @@ -658,7 +658,7 @@ public static void b2SolveContinuous(B2World world, int bodySimIndex, B2TaskCont b2TracyCZoneEnd(B2TracyCZone.ccd); } - public static void b2FinalizeBodiesTask(int startIndex, int endIndex, uint threadIndex, object context) + internal static void b2FinalizeBodiesTask(int startIndex, int endIndex, uint threadIndex, object context) { b2TracyCZoneNC(B2TracyCZone.finalize_transfprms, "Transforms", B2HexColor.b2_colorMediumSeaGreen, true); @@ -884,7 +884,7 @@ public enum b2SolverBlockType } b2SolverBlockType; */ - public static void b2ExecuteBlock(B2SolverStage stage, B2StepContext context, B2SolverBlock block, int workerIndex) + internal static void b2ExecuteBlock(B2SolverStage stage, B2StepContext context, B2SolverBlock block, int workerIndex) { B2SolverStageType stageType = stage.type; B2SolverBlockType blockType = (B2SolverBlockType)block.blockType; @@ -959,7 +959,7 @@ public static void b2ExecuteBlock(B2SolverStage stage, B2StepContext context, B2 } } - public static int GetWorkerStartIndex(int workerIndex, int blockCount, int workerCount) + internal static int GetWorkerStartIndex(int workerIndex, int blockCount, int workerCount) { if (blockCount <= workerCount) { @@ -971,7 +971,7 @@ public static int GetWorkerStartIndex(int workerIndex, int blockCount, int worke return blocksPerWorker * workerIndex + b2MinInt(remainder, workerIndex); } - public static void b2ExecuteStage(B2SolverStage stage, B2StepContext context, int previousSyncIndex, int syncIndex, int workerIndex) + internal static void b2ExecuteStage(B2SolverStage stage, B2StepContext context, int previousSyncIndex, int syncIndex, int workerIndex) { int completedCount = 0; ArraySegment blocks = stage.blocks; @@ -1032,7 +1032,7 @@ public static void b2ExecuteStage(B2SolverStage stage, B2StepContext context, in b2AtomicFetchAddInt(ref stage.completionCount, completedCount); } - public static void b2ExecuteMainStage(B2SolverStage stage, B2StepContext context, uint syncBits) + internal static void b2ExecuteMainStage(B2SolverStage stage, B2StepContext context, uint syncBits) { int blockCount = stage.blockCount; if (blockCount == 0) @@ -1067,7 +1067,7 @@ public static void b2ExecuteMainStage(B2SolverStage stage, B2StepContext context } // This should not use the thread index because thread 0 can be called twice by enkiTS. - public static void b2SolverTask(int startIndex, int endIndex, uint threadIndexIgnore, object taskContext) + internal static void b2SolverTask(int startIndex, int endIndex, uint threadIndexIgnore, object taskContext) { B2_UNUSED(startIndex, endIndex, threadIndexIgnore); @@ -1305,7 +1305,7 @@ public static void b2SolverTask(int startIndex, int endIndex, uint threadIndexIg } } - public static void b2BulletBodyTask(int startIndex, int endIndex, uint threadIndex, object context) + internal static void b2BulletBodyTask(int startIndex, int endIndex, uint threadIndex, object context) { B2_UNUSED(threadIndex); @@ -1327,7 +1327,7 @@ public static void b2BulletBodyTask(int startIndex, int endIndex, uint threadInd // Solve with graph coloring - public static void b2Solve(B2World world, B2StepContext stepContext) + internal static void b2Solve(B2World world, B2StepContext stepContext) { world.stepIndex += 1; diff --git a/src/Box2D.NET/B2WeldJoints.cs b/src/Box2D.NET/B2WeldJoints.cs index 768537b9..2e26d319 100644 --- a/src/Box2D.NET/B2WeldJoints.cs +++ b/src/Box2D.NET/B2WeldJoints.cs @@ -47,13 +47,13 @@ public B2Mat33(B2Vec3 cx, B2Vec3 cy, B2Vec3 cz) } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static float b2Dot3(B2Vec3 a, B2Vec3 b) + internal static float b2Dot3(B2Vec3 a, B2Vec3 b) { return a.X * b.X + a.Y * b.Y + a.Z * b.Z; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static B2Vec3 b2Cross3(B2Vec3 a, B2Vec3 b) + internal static B2Vec3 b2Cross3(B2Vec3 a, B2Vec3 b) { return new B2Vec3() { @@ -64,7 +64,7 @@ public static B2Vec3 b2Cross3(B2Vec3 a, B2Vec3 b) } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static B2Vec3 b2Solve33(ref B2Mat33 m, B2Vec3 b) + internal static B2Vec3 b2Solve33(ref B2Mat33 m, B2Vec3 b) { float det = b2Dot3(m.cx, b2Cross3(m.cy, m.cz)); if (det != 0.0f) @@ -132,13 +132,13 @@ public static float b2WeldJoint_GetAngularDampingRatio(B2JointId jointId) return joint.uj.weldJoint.angularDampingRatio; } - public static B2Vec2 b2GetWeldJointForce(B2World world, B2JointSim @base) + internal static B2Vec2 b2GetWeldJointForce(B2World world, B2JointSim @base) { B2Vec2 force = b2MulSV(world.inv_h, @base.uj.weldJoint.linearImpulse); return force; } - public static float b2GetWeldJointTorque(B2World world, B2JointSim @base) + internal static float b2GetWeldJointTorque(B2World world, B2JointSim @base) { return world.inv_h * @base.uj.weldJoint.angularImpulse; } @@ -165,7 +165,7 @@ public static float b2GetWeldJointTorque(B2World world, B2JointSim @base) // = [J1 * invM * J1T J1 * invM * J2T] // [J2 * invM * J1T J2 * invM * J2T] - public static void b2PrepareWeldJoint(B2JointSim @base, B2StepContext context) + internal static void b2PrepareWeldJoint(B2JointSim @base, B2StepContext context) { B2_ASSERT(@base.type == B2JointType.b2_weldJoint); @@ -239,7 +239,7 @@ public static void b2PrepareWeldJoint(B2JointSim @base, B2StepContext context) } } - public static void b2WarmStartWeldJoint(B2JointSim @base, B2StepContext context) + internal static void b2WarmStartWeldJoint(B2JointSim @base, B2StepContext context) { float mA = @base.invMassA; float mB = @base.invMassB; @@ -270,7 +270,7 @@ public static void b2WarmStartWeldJoint(B2JointSim @base, B2StepContext context) } } - public static void b2SolveWeldJoint(B2JointSim @base, B2StepContext context, bool useBias) + internal static void b2SolveWeldJoint(B2JointSim @base, B2StepContext context, bool useBias) { B2_ASSERT(@base.type == B2JointType.b2_weldJoint); @@ -471,7 +471,7 @@ public static void b2SolveWeldJoint(B2JointSim @base, B2StepContext context, boo } #if FALSE - public static void b2DumpWeldJoint() + internal static void b2DumpWeldJoint() { int32 indexA = bodyA->islandIndex; int32 indexB = bodyB->islandIndex; @@ -489,7 +489,7 @@ public static void b2DumpWeldJoint() } #endif - public static void b2DrawWeldJoint(B2DebugDraw draw, B2JointSim @base, B2Transform transformA, B2Transform transformB, float drawScale) + internal static void b2DrawWeldJoint(B2DebugDraw draw, B2JointSim @base, B2Transform transformA, B2Transform transformB, float drawScale) { B2_ASSERT(@base.type == B2JointType.b2_weldJoint); diff --git a/src/Box2D.NET/B2WheelJoints.cs b/src/Box2D.NET/B2WheelJoints.cs index 05924823..59399c47 100644 --- a/src/Box2D.NET/B2WheelJoints.cs +++ b/src/Box2D.NET/B2WheelJoints.cs @@ -146,7 +146,7 @@ public static float b2WheelJoint_GetMaxMotorTorque(B2JointId jointId) return joint.uj.wheelJoint.maxMotorTorque; } - public static B2Vec2 b2GetWheelJointForce(B2World world, B2JointSim @base) + internal static B2Vec2 b2GetWheelJointForce(B2World world, B2JointSim @base) { int idA = @base.bodyIdA; B2Transform transformA = b2GetBodyTransform(world, idA); @@ -164,7 +164,7 @@ public static B2Vec2 b2GetWheelJointForce(B2World world, B2JointSim @base) return force; } - public static float b2GetWheelJointTorque(B2World world, B2JointSim @base) + internal static float b2GetWheelJointTorque(B2World world, B2JointSim @base) { return world.inv_h * @base.uj.wheelJoint.motorImpulse; } @@ -185,7 +185,7 @@ public static float b2GetWheelJointTorque(B2World world, B2JointSim @base) // Cdot = wB - wA // J = [0 0 -1 0 0 1] - public static void b2PrepareWheelJoint(B2JointSim @base, B2StepContext context) + internal static void b2PrepareWheelJoint(B2JointSim @base, B2StepContext context) { B2_ASSERT(@base.type == B2JointType.b2_wheelJoint); @@ -268,7 +268,7 @@ public static void b2PrepareWheelJoint(B2JointSim @base, B2StepContext context) } } - public static void b2WarmStartWheelJoint(B2JointSim @base, B2StepContext context) + internal static void b2WarmStartWheelJoint(B2JointSim @base, B2StepContext context) { B2_ASSERT(@base.type == B2JointType.b2_wheelJoint); @@ -317,7 +317,7 @@ public static void b2WarmStartWheelJoint(B2JointSim @base, B2StepContext context } } - public static void b2SolveWheelJoint(B2JointSim @base, B2StepContext context, bool useBias) + internal static void b2SolveWheelJoint(B2JointSim @base, B2StepContext context, bool useBias) { B2_ASSERT(@base.type == B2JointType.b2_wheelJoint); @@ -536,7 +536,7 @@ void b2WheelJoint_Dump() } #endif - public static void b2DrawWheelJoint(B2DebugDraw draw, B2JointSim @base, B2Transform transformA, B2Transform transformB, float drawScale) + internal static void b2DrawWheelJoint(B2DebugDraw draw, B2JointSim @base, B2Transform transformA, B2Transform transformB, float drawScale) { B2_ASSERT(@base.type == B2JointType.b2_wheelJoint); diff --git a/src/Box2D.NET/B2Worlds.cs b/src/Box2D.NET/B2Worlds.cs index e0beb9b4..dbd4fdce 100644 --- a/src/Box2D.NET/B2Worlds.cs +++ b/src/Box2D.NET/B2Worlds.cs @@ -60,7 +60,7 @@ public static B2World b2GetWorldFromId(B2WorldId id) return world; } - public static B2World b2GetWorld(int index) + internal static B2World b2GetWorld(int index) { B2_ASSERT(0 <= index && index < B2_MAX_WORLDS); B2World world = b2_worlds[index]; @@ -68,7 +68,7 @@ public static B2World b2GetWorld(int index) return world; } - public static B2World b2GetWorldLocked(int index) + internal static B2World b2GetWorldLocked(int index) { B2_ASSERT(0 <= index && index < B2_MAX_WORLDS); B2World world = b2_worlds[index]; @@ -82,25 +82,25 @@ public static B2World b2GetWorldLocked(int index) return world; } - public static object b2DefaultAddTaskFcn(b2TaskCallback task, int count, int minRange, object taskContext, object userContext) + internal static object b2DefaultAddTaskFcn(b2TaskCallback task, int count, int minRange, object taskContext, object userContext) { B2_UNUSED(minRange, userContext); task(0, count, 0, taskContext); return null; } - public static void b2DefaultFinishTaskFcn(object userTask, object userContext) + internal static void b2DefaultFinishTaskFcn(object userTask, object userContext) { B2_UNUSED(userTask, userContext); } - public static float b2DefaultFrictionCallback(float frictionA, ulong materialA, float frictionB, ulong materialB) + internal static float b2DefaultFrictionCallback(float frictionA, ulong materialA, float frictionB, ulong materialB) { B2_UNUSED(materialA, materialB); return MathF.Sqrt(frictionA * frictionB); } - public static float b2DefaultRestitutionCallback(float restitutionA, ulong materialA, float restitutionB, ulong materialB) + internal static float b2DefaultRestitutionCallback(float restitutionA, ulong materialA, float restitutionB, ulong materialB) { B2_UNUSED(materialA, materialB); return b2MaxFloat(restitutionA, restitutionB); @@ -381,7 +381,7 @@ public static void b2DestroyWorld(B2WorldId worldId) world.generation = (ushort)(generation + 1); } - public static void b2CollideTask(int startIndex, int endIndex, uint threadIndex, object context) + internal static void b2CollideTask(int startIndex, int endIndex, uint threadIndex, object context) { b2TracyCZoneNC(B2TracyCZone.collide_task, "Collide", B2HexColor.b2_colorDodgerBlue, true); @@ -471,7 +471,7 @@ public static void b2CollideTask(int startIndex, int endIndex, uint threadIndex, b2TracyCZoneEnd(B2TracyCZone.collide_task); } - public static void b2UpdateTreesTask(int startIndex, int endIndex, uint threadIndex, object context) + internal static void b2UpdateTreesTask(int startIndex, int endIndex, uint threadIndex, object context) { B2_UNUSED(startIndex); B2_UNUSED(endIndex); @@ -485,7 +485,7 @@ public static void b2UpdateTreesTask(int startIndex, int endIndex, uint threadIn b2TracyCZoneEnd(B2TracyCZone.tree_task); } - public static void b2AddNonTouchingContact(B2World world, B2Contact contact, B2ContactSim contactSim) + internal static void b2AddNonTouchingContact(B2World world, B2Contact contact, B2ContactSim contactSim) { B2_ASSERT(contact.setIndex == (int)B2SetType.b2_awakeSet); B2SolverSet set = b2Array_Get(ref world.solverSets, (int)B2SetType.b2_awakeSet); @@ -497,7 +497,7 @@ public static void b2AddNonTouchingContact(B2World world, B2Contact contact, B2C newContactSim.CopyFrom(contactSim); } - public static void b2RemoveNonTouchingContact(B2World world, int setIndex, int localIndex) + internal static void b2RemoveNonTouchingContact(B2World world, int setIndex, int localIndex) { B2SolverSet set = b2Array_Get(ref world.solverSets, setIndex); int movedIndex = b2Array_RemoveSwap(ref set.contactSims, localIndex); @@ -513,7 +513,7 @@ public static void b2RemoveNonTouchingContact(B2World world, int setIndex, int l } // Narrow-phase collision - public static void b2Collide(B2StepContext context) + internal static void b2Collide(B2StepContext context) { B2World world = context.world; @@ -847,7 +847,7 @@ public static void b2World_Step(B2WorldId worldId, float timeStep, int subStepCo world.locked = false; } - public static void b2DrawShape(B2DebugDraw draw, B2Shape shape, B2Transform xf, B2HexColor color) + internal static void b2DrawShape(B2DebugDraw draw, B2Shape shape, B2Transform xf, B2HexColor color) { switch (shape.type) { @@ -900,7 +900,7 @@ public static void b2DrawShape(B2DebugDraw draw, B2Shape shape, B2Transform xf, } } - public static bool DrawQueryCallback(int proxyId, ulong userData, ref B2DrawContext context) + internal static bool DrawQueryCallback(int proxyId, ulong userData, ref B2DrawContext context) { B2_UNUSED(proxyId); @@ -1857,7 +1857,7 @@ public static B2TreeStats b2World_OverlapAABB(B2WorldId worldId, B2AABB aabb, B2 } - public static bool TreeOverlapCallback(int proxyId, ulong userData, ref B2WorldOverlapContext context) + internal static bool TreeOverlapCallback(int proxyId, ulong userData, ref B2WorldOverlapContext context) { B2_UNUSED(proxyId); @@ -1926,7 +1926,7 @@ public static B2TreeStats b2World_OverlapShape(B2WorldId worldId, ref B2ShapePro return treeStats; } - public static float RayCastCallback(ref B2RayCastInput input, int proxyId, ulong userData, ref B2WorldRayCastContext context) + internal static float RayCastCallback(ref B2RayCastInput input, int proxyId, ulong userData, ref B2WorldRayCastContext context) { B2_UNUSED(proxyId); @@ -2010,7 +2010,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. - public static float b2RayCastClosestFcn(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) @@ -2064,7 +2064,7 @@ public static B2RayResult b2World_CastRayClosest(B2WorldId worldId, B2Vec2 origi return result; } - public static float ShapeCastCallback(ref B2ShapeCastInput input, int proxyId, ulong userData, ref B2WorldRayCastContext context) + internal static float ShapeCastCallback(ref B2ShapeCastInput input, int proxyId, ulong userData, ref B2WorldRayCastContext context) { B2_UNUSED(proxyId); @@ -2143,7 +2143,7 @@ public static B2TreeStats b2World_CastShape(B2WorldId worldId, ref B2ShapeProxy return treeStats; } - public static float MoverCastCallback(ref B2ShapeCastInput input, int proxyId, ulong userData, ref B2WorldMoverCastContext context) + internal static float MoverCastCallback(ref B2ShapeCastInput input, int proxyId, ulong userData, ref B2WorldMoverCastContext context) { B2_UNUSED(proxyId); @@ -2212,7 +2212,7 @@ public static float b2World_CastMover(B2WorldId worldId, ref B2Capsule mover, B2 return worldContext.fraction; } - public static bool TreeCollideCallback(int proxyId, ulong userData, ref B2WorldMoverContext context) + internal static bool TreeCollideCallback(int proxyId, ulong userData, ref B2WorldMoverContext context) { B2_UNUSED(proxyId); @@ -2368,7 +2368,7 @@ public static B2Vec2 b2World_GetGravity(B2WorldId worldId) return world.gravity; } - public static bool ExplosionCallback(int proxyId, ulong userData, ref B2ExplosionContext context) + internal static bool ExplosionCallback(int proxyId, ulong userData, ref B2ExplosionContext context) { B2_UNUSED(proxyId); @@ -2498,7 +2498,7 @@ public static void b2World_EnableSpeculative(B2WorldId worldId, bool flag) #if DEBUG // This validates island graph connectivity for each body - public static void b2ValidateConnectivity(B2World world) + internal static void b2ValidateConnectivity(B2World world) { B2Body[] bodies = world.bodies.data; int bodyCapacity = world.bodies.count; @@ -2585,7 +2585,7 @@ public static void b2ValidateConnectivity(B2World world) } // Validates solver sets, but not island connectivity - public static void b2ValidateSolverSets(B2World world) + internal static void b2ValidateSolverSets(B2World world) { B2_ASSERT(b2GetIdCapacity(world.bodyIdPool) == world.bodies.count); B2_ASSERT(b2GetIdCapacity(world.contactIdPool) == world.contacts.count); @@ -2925,7 +2925,7 @@ public static void b2ValidateSolverSets(B2World world) } // Validate contact touching status. - public static void b2ValidateContacts(B2World world) + internal static void b2ValidateContacts(B2World world) { int contactCount = world.contacts.count; B2_ASSERT(contactCount == b2GetIdCapacity(world.contactIdPool)); @@ -2985,17 +2985,17 @@ public static void b2ValidateContacts(B2World world) } #else - public static void b2ValidateConnectivity(B2World world) + internal static void b2ValidateConnectivity(B2World world) { B2_UNUSED(world); } - public static void b2ValidateSolverSets(B2World world) + internal static void b2ValidateSolverSets(B2World world) { B2_UNUSED(world); } - public static void b2ValidateContacts(B2World world) + internal static void b2ValidateContacts(B2World world) { B2_UNUSED(world); }