Skip to content

Commit 1881d86

Browse files
committed
Access modifiers (#53)
1 parent 58e735a commit 1881d86

32 files changed

+268
-268
lines changed

src/Box2D.NET/B2ArenaAllocatorIndexer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ internal static int Next<T>()
1414
return b2AtomicFetchAddInt(ref _indices, 1);
1515
}
1616

17-
public static int Index<T>() where T : new()
17+
internal static int Index<T>() where T : new()
1818
{
1919
return B2ArenaAllocatorIndexer<T>.Index;
2020
}
2121
}
2222

2323
internal class B2ArenaAllocatorIndexer<T> where T : new()
2424
{
25-
public static readonly int Index = B2ArenaAllocatorIndexer.Next<T>();
25+
internal static readonly int Index = B2ArenaAllocatorIndexer.Next<T>();
2626

2727
private B2ArenaAllocatorIndexer()
2828
{

src/Box2D.NET/B2BoardPhases.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ public static bool b2BroadPhase_TestOverlap(B2BroadPhase bp, int proxyKeyA, int
505505
return b2AABB_Overlaps(aabbA, aabbB);
506506
}
507507

508-
public static void b2BroadPhase_RebuildTrees(B2BroadPhase bp)
508+
internal static void b2BroadPhase_RebuildTrees(B2BroadPhase bp)
509509
{
510510
b2DynamicTree_Rebuild(bp.trees[(int)B2BodyType.b2_dynamicBody], false);
511511
b2DynamicTree_Rebuild(bp.trees[(int)B2BodyType.b2_kinematicBody], false);
@@ -519,15 +519,15 @@ public static int b2BroadPhase_GetShapeIndex(B2BroadPhase bp, int proxyKey)
519519
return (int)b2DynamicTree_GetUserData(bp.trees[typeIndex], proxyId);
520520
}
521521

522-
public static void b2ValidateBroadphase(B2BroadPhase bp)
522+
internal static void b2ValidateBroadphase(B2BroadPhase bp)
523523
{
524524
b2DynamicTree_Validate(bp.trees[(int)B2BodyType.b2_dynamicBody]);
525525
b2DynamicTree_Validate(bp.trees[(int)B2BodyType.b2_kinematicBody]);
526526

527527
// TODO_ERIN validate every shape AABB is contained in tree AABB
528528
}
529529

530-
public static void b2ValidateNoEnlarged(B2BroadPhase bp)
530+
internal static void b2ValidateNoEnlarged(B2BroadPhase bp)
531531
{
532532
#if DEBUG
533533
for (int j = 0; j < (int)B2BodyType.b2_bodyTypeCount; ++j)

src/Box2D.NET/B2Bodies.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static class B2Bodies
2828
public const int B2_NAME_LENGTH = 32;
2929

3030
// Identity body state, notice the deltaRotation is {1, 0}
31-
public static readonly B2BodyState b2_identityBodyState = new B2BodyState()
31+
internal static readonly B2BodyState b2_identityBodyState = new B2BodyState()
3232
{
3333
linearVelocity = new B2Vec2(0.0f, 0.0f),
3434
angularVelocity = 0.0f,
@@ -119,7 +119,7 @@ public static void b2CreateIslandForBody(B2World world, int setIndex, B2Body bod
119119
island.bodyCount = 1;
120120
}
121121

122-
public static void b2RemoveBodyFromIsland(B2World world, B2Body body)
122+
internal static void b2RemoveBodyFromIsland(B2World world, B2Body body)
123123
{
124124
if (body.islandId == B2_NULL_INDEX)
125125
{
@@ -351,7 +351,7 @@ public static B2BodyId b2CreateBody(B2WorldId worldId, ref B2BodyDef def)
351351
}
352352

353353
// careful calling this because it can invalidate body, state, joint, and contact pointers
354-
public static bool b2WakeBody(B2World world, B2Body body)
354+
internal static bool b2WakeBody(B2World world, B2Body body)
355355
{
356356
if (body.setIndex >= (int)B2SetType.b2_firstSleepingSet)
357357
{
@@ -549,7 +549,7 @@ public static B2AABB b2Body_ComputeAABB(B2BodyId bodyId)
549549
return aabb;
550550
}
551551

552-
public static void b2UpdateBodyMassData(B2World world, B2Body body)
552+
internal static void b2UpdateBodyMassData(B2World world, B2Body body)
553553
{
554554
B2BodySim bodySim = b2GetBodySim(world, body);
555555

@@ -1050,7 +1050,7 @@ public static void b2Body_ApplyTorque(B2BodyId bodyId, float torque, bool wake)
10501050
/// step. So this only needs to be called if the application wants to remove the effect of previous
10511051
/// calls to apply forces and torques before the world step is called.
10521052
/// @param bodyId The body id
1053-
public static void b2Body_ClearForces(B2BodyId bodyId)
1053+
internal static void b2Body_ClearForces(B2BodyId bodyId)
10541054
{
10551055
B2World world = b2GetWorld(bodyId.world0);
10561056
B2Body body = b2GetBodyFullId(world, bodyId);
@@ -2035,7 +2035,7 @@ public static int b2Body_GetJoints(B2BodyId bodyId, Span<B2JointId> jointArray,
20352035
}
20362036

20372037

2038-
public static bool b2ShouldBodiesCollide(B2World world, B2Body bodyA, B2Body bodyB)
2038+
internal static bool b2ShouldBodiesCollide(B2World world, B2Body bodyA, B2Body bodyB)
20392039
{
20402040
if (bodyA.type != B2BodyType.b2_dynamicBody && bodyB.type != B2BodyType.b2_dynamicBody)
20412041
{

src/Box2D.NET/B2BodyState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class B2BodyState
4747
// the solver and must use zero delta rotation for static bodies (c,s) = (1,0)
4848
public B2Rot deltaRotation; // 8
4949

50-
public static B2BodyState Create(B2BodyState other) // todo : @ikpil how to remove
50+
internal static B2BodyState Create(B2BodyState other) // todo : @ikpil how to remove
5151
{
5252
var state = new B2BodyState();
5353
state.CopyFrom(other);

src/Box2D.NET/B2Constants.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static class B2Constants
1010
{
1111
// Used to detect bad values. Positions greater than about 16km will have precision
1212
// problems, so 100km as a limit should be fine in all cases.
13-
public static float B2_HUGE => (100000.0f * b2_lengthUnitsPerMeter);
13+
internal static float B2_HUGE => (100000.0f * b2_lengthUnitsPerMeter);
1414

1515
// Maximum parallel workers. Used to size some static arrays.
1616
public const int B2_MAX_WORKERS = 64;
@@ -24,26 +24,26 @@ public static class B2Constants
2424
// chosen to be numerically significant, but visually insignificant. In meters.
2525
// Normally this is 0.5cm.
2626
// @warning modifying this can have a significant impact on stability
27-
public static float B2_LINEAR_SLOP => (0.005f * b2_lengthUnitsPerMeter);
27+
internal static float B2_LINEAR_SLOP => (0.005f * b2_lengthUnitsPerMeter);
2828

2929
// Maximum number of simultaneous worlds that can be allocated
3030
public const int B2_MAX_WORLDS = 128;
3131

3232
// The maximum rotation of a body per time step. This limit is very large and is used
3333
// to prevent numerical problems. You shouldn't need to adjust this.
3434
// @warning increasing this to 0.5f * b2_pi or greater will break continuous collision.
35-
public static readonly float B2_MAX_ROTATION = (0.25f * B2MathFunction.B2_PI);
35+
internal static readonly float B2_MAX_ROTATION = (0.25f * B2MathFunction.B2_PI);
3636

3737
// Box2D uses limited speculative collision. This reduces jitter.
3838
// Normally this is 2cm.
3939
// @warning modifying this can have a significant impact on performance and stability
40-
public static readonly float B2_SPECULATIVE_DISTANCE = (4.0f * B2_LINEAR_SLOP);
40+
internal static readonly float B2_SPECULATIVE_DISTANCE = (4.0f * B2_LINEAR_SLOP);
4141

4242
// This is used to fatten AABBs in the dynamic tree. This allows proxies
4343
// to move by a small amount without triggering a tree adjustment. This is in meters.
4444
// Normally this is 5cm.
4545
// @warning modifying this can have a significant impact on performance
46-
public static float B2_AABB_MARGIN => (0.05f * b2_lengthUnitsPerMeter);
46+
internal static float B2_AABB_MARGIN => (0.05f * b2_lengthUnitsPerMeter);
4747

4848
// The time that a body must be still before it will go to sleep. In seconds.
4949
public const float B2_TIME_TO_SLEEP = 0.5f;

src/Box2D.NET/B2ConstraintGraphs.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static void b2DestroyGraph(ref B2ConstraintGraph graph)
8787

8888
// Contacts are always created as non-touching. They get cloned into the constraint
8989
// graph once they are found to be touching.
90-
public static void b2AddContactToGraph(B2World world, B2ContactSim contactSim, B2Contact contact)
90+
internal static void b2AddContactToGraph(B2World world, B2ContactSim contactSim, B2Contact contact)
9191
{
9292
B2_ASSERT(contactSim.manifold.pointCount > 0);
9393
B2_ASSERT(0 != (contactSim.simFlags & (uint)B2ContactSimFlags.b2_simTouchingFlag));
@@ -215,7 +215,7 @@ public static void b2AddContactToGraph(B2World world, B2ContactSim contactSim, B
215215
}
216216
}
217217

218-
public static void b2RemoveContactFromGraph(B2World world, int bodyIdA, int bodyIdB, int colorIndex, int localIndex)
218+
internal static void b2RemoveContactFromGraph(B2World world, int bodyIdA, int bodyIdB, int colorIndex, int localIndex)
219219
{
220220
ref B2ConstraintGraph graph = ref world.constraintGraph;
221221

@@ -311,7 +311,7 @@ static int b2AssignJointColor(ref B2ConstraintGraph graph, int bodyIdA, int body
311311
return B2_OVERFLOW_INDEX;
312312
}
313313

314-
public static ref B2JointSim b2CreateJointInGraph(B2World world, B2Joint joint)
314+
internal static ref B2JointSim b2CreateJointInGraph(B2World world, B2Joint joint)
315315
{
316316
ref B2ConstraintGraph graph = ref world.constraintGraph;
317317

@@ -331,14 +331,14 @@ public static ref B2JointSim b2CreateJointInGraph(B2World world, B2Joint joint)
331331
return ref jointSim;
332332
}
333333

334-
public static void b2AddJointToGraph(B2World world, B2JointSim jointSim, B2Joint joint)
334+
internal static void b2AddJointToGraph(B2World world, B2JointSim jointSim, B2Joint joint)
335335
{
336336
B2JointSim jointDst = b2CreateJointInGraph(world, joint);
337337
//memcpy( jointDst, jointSim, sizeof( b2JointSim ) );
338338
jointDst.CopyFrom(jointSim);
339339
}
340340

341-
public static void b2RemoveJointFromGraph(B2World world, int bodyIdA, int bodyIdB, int colorIndex, int localIndex)
341+
internal static void b2RemoveJointFromGraph(B2World world, int bodyIdA, int bodyIdB, int colorIndex, int localIndex)
342342
{
343343
ref B2ConstraintGraph graph = ref world.constraintGraph;
344344

@@ -366,7 +366,7 @@ public static void b2RemoveJointFromGraph(B2World world, int bodyIdA, int bodyId
366366
}
367367
}
368368

369-
public static readonly B2HexColor[] b2_graphColors = new B2HexColor[]
369+
internal static readonly B2HexColor[] b2_graphColors = new B2HexColor[]
370370
{
371371
B2HexColor.b2_colorRed, B2HexColor.b2_colorOrange, B2HexColor.b2_colorYellow, B2HexColor.b2_colorGreen, B2HexColor.b2_colorCyan, B2HexColor.b2_colorBlue,
372372
B2HexColor.b2_colorViolet, B2HexColor.b2_colorPink, B2HexColor.b2_colorChocolate, B2HexColor.b2_colorGoldenRod, B2HexColor.b2_colorCoral, B2HexColor.b2_colorRosyBrown,

src/Box2D.NET/B2ContactSolvers.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static class B2ContactSolvers
2828
// s(t) = s0 + dot(cB0 + dpB + rot(dqB, rB0) - cA0 - dpA - rot(dqA, rA0), normal)
2929
// s(t) = s0 + dot(cB0 - cA0, normal) + dot(dpB - dpA + rot(dqB, rB0) - rot(dqA, rA0), normal)
3030
// s_base = s0 + dot(cB0 - cA0, normal)
31-
public static void b2PrepareOverflowContacts(B2StepContext context)
31+
internal static void b2PrepareOverflowContacts(B2StepContext context)
3232
{
3333
b2TracyCZoneNC(B2TracyCZone.prepare_overflow_contact, "Prepare Overflow Contact", B2HexColor.b2_colorYellow, true);
3434

@@ -165,7 +165,7 @@ public static void b2PrepareOverflowContacts(B2StepContext context)
165165
b2TracyCZoneEnd(B2TracyCZone.prepare_overflow_contact);
166166
}
167167

168-
public static void b2WarmStartOverflowContacts(B2StepContext context)
168+
internal static void b2WarmStartOverflowContacts(B2StepContext context)
169169
{
170170
b2TracyCZoneNC(B2TracyCZone.warmstart_overflow_contact, "WarmStart Overflow Contact", B2HexColor.b2_colorDarkOrange, true);
171171

@@ -239,7 +239,7 @@ public static void b2WarmStartOverflowContacts(B2StepContext context)
239239
b2TracyCZoneEnd(B2TracyCZone.warmstart_overflow_contact);
240240
}
241241

242-
public static void b2SolveOverflowContacts(B2StepContext context, bool useBias)
242+
internal static void b2SolveOverflowContacts(B2StepContext context, bool useBias)
243243
{
244244
b2TracyCZoneNC(B2TracyCZone.solve_contact, "Solve Contact", B2HexColor.b2_colorAliceBlue, true);
245245

@@ -401,7 +401,7 @@ public static void b2SolveOverflowContacts(B2StepContext context, bool useBias)
401401
b2TracyCZoneEnd(B2TracyCZone.solve_contact);
402402
}
403403

404-
public static void b2ApplyOverflowRestitution(B2StepContext context)
404+
internal static void b2ApplyOverflowRestitution(B2StepContext context)
405405
{
406406
b2TracyCZoneNC(B2TracyCZone.overflow_resitution, "Overflow Restitution", B2HexColor.b2_colorViolet, true);
407407

@@ -506,7 +506,7 @@ public static void b2ApplyOverflowRestitution(B2StepContext context)
506506
b2TracyCZoneEnd(B2TracyCZone.overflow_resitution);
507507
}
508508

509-
public static void b2StoreOverflowImpulses(B2StepContext context)
509+
internal static void b2StoreOverflowImpulses(B2StepContext context)
510510
{
511511
b2TracyCZoneNC(B2TracyCZone.store_impulses, "Store", B2HexColor.b2_colorFireBrick, true);
512512

@@ -1107,7 +1107,7 @@ static void b2ScatterBodies( b2BodyState* states, int* indices, const b2BodyStat
11071107
#else
11081108

11091109
// This is a load and transpose
1110-
public static B2BodyStateW b2GatherBodies(B2BodyState[] states, ReadOnlySpan<int> indices)
1110+
internal static B2BodyStateW b2GatherBodies(B2BodyState[] states, ReadOnlySpan<int> indices)
11111111
{
11121112
B2BodyState identity = b2_identityBodyState;
11131113

@@ -1130,7 +1130,7 @@ public static B2BodyStateW b2GatherBodies(B2BodyState[] states, ReadOnlySpan<int
11301130
}
11311131

11321132
// This writes only the velocities back to the solver bodies
1133-
public static void b2ScatterBodies(B2BodyState[] states, ReadOnlySpan<int> indices, ref B2BodyStateW simdBody)
1133+
internal static void b2ScatterBodies(B2BodyState[] states, ReadOnlySpan<int> indices, ref B2BodyStateW simdBody)
11341134
{
11351135
if (indices[0] != B2_NULL_INDEX && (states[indices[0]].flags & (uint)B2BodyFlags.b2_dynamicFlag) != 0)
11361136
{
@@ -1168,7 +1168,7 @@ public static void b2ScatterBodies(B2BodyState[] states, ReadOnlySpan<int> indic
11681168
#endif
11691169

11701170
// Contacts that live within the constraint graph coloring
1171-
public static void b2PrepareContactsTask(int startIndex, int endIndex, B2StepContext context)
1171+
internal static void b2PrepareContactsTask(int startIndex, int endIndex, B2StepContext context)
11721172
{
11731173
b2TracyCZoneNC(B2TracyCZone.prepare_contact, "Prepare Contact", B2HexColor.b2_colorYellow, true);
11741174
B2World world = context.world;
@@ -1423,7 +1423,7 @@ public static void b2PrepareContactsTask(int startIndex, int endIndex, B2StepCon
14231423
b2TracyCZoneEnd(B2TracyCZone.prepare_contact);
14241424
}
14251425

1426-
public static void b2WarmStartContactsTask(int startIndex, int endIndex, B2StepContext context, int colorIndex)
1426+
internal static void b2WarmStartContactsTask(int startIndex, int endIndex, B2StepContext context, int colorIndex)
14271427
{
14281428
b2TracyCZoneNC(B2TracyCZone.warm_start_contact, "Warm Start", B2HexColor.b2_colorGreen, true);
14291429

@@ -1481,7 +1481,7 @@ public static void b2WarmStartContactsTask(int startIndex, int endIndex, B2StepC
14811481
b2TracyCZoneEnd(B2TracyCZone.warm_start_contact);
14821482
}
14831483

1484-
public static void b2SolveContactsTask(int startIndex, int endIndex, B2StepContext context, int colorIndex, bool useBias)
1484+
internal static void b2SolveContactsTask(int startIndex, int endIndex, B2StepContext context, int colorIndex, bool useBias)
14851485
{
14861486
b2TracyCZoneNC(B2TracyCZone.solve_contact, "Solve Contact", B2HexColor.b2_colorAliceBlue, true);
14871487

@@ -1719,7 +1719,7 @@ public static void b2SolveContactsTask(int startIndex, int endIndex, B2StepConte
17191719
b2TracyCZoneEnd(B2TracyCZone.solve_contact);
17201720
}
17211721

1722-
public static void b2ApplyRestitutionTask(int startIndex, int endIndex, B2StepContext context, int colorIndex)
1722+
internal static void b2ApplyRestitutionTask(int startIndex, int endIndex, B2StepContext context, int colorIndex)
17231723
{
17241724
b2TracyCZoneNC(B2TracyCZone.restitution, "Restitution", B2HexColor.b2_colorDodgerBlue, true);
17251725

@@ -1834,7 +1834,7 @@ public static void b2ApplyRestitutionTask(int startIndex, int endIndex, B2StepCo
18341834
b2TracyCZoneEnd(B2TracyCZone.restitution);
18351835
}
18361836

1837-
public static void b2StoreImpulsesTask(int startIndex, int endIndex, B2StepContext context)
1837+
internal static void b2StoreImpulsesTask(int startIndex, int endIndex, B2StepContext context)
18381838
{
18391839
b2TracyCZoneNC(B2TracyCZone.store_impulses, "Store", B2HexColor.b2_colorFireBrick, true);
18401840

0 commit comments

Comments
 (0)