Skip to content

Commit

Permalink
refactor 2 tests to replace Shape with ShapeRefC
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Jul 14, 2024
1 parent 3db40c6 commit 6d8aabb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/test/java/testjoltjni/app/ConvexVsMeshScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ static boolean Load()
mMeshSettings.setShapeSettings(mesh_shape_settings);

// Create other shapes
mShapes = new Shape[] {
new BoxShape(new Vec3(0.5f, 0.75f, 1.0f)),
new SphereShape(0.5f),
new CapsuleShape(0.75f, 0.5f),
new ConvexHullShapeSettings(new Vec3(0, 1, 0), new Vec3(1, 0, 0), new Vec3(-1, 0, 0), new Vec3(0, 0, 1), new Vec3(0, 0, -1)).createShape(),
mShapes = new ShapeRefC[] {
new BoxShape(new Vec3(0.5f, 0.75f, 1.0f)).toRefC(),
new SphereShape(0.5f).toRefC(),
new CapsuleShape(0.75f, 0.5f).toRefC(),
new ConvexHullShapeSettings(new Vec3(0, 1, 0), new Vec3(1, 0, 0), new Vec3(-1, 0, 0), new Vec3(0, 0, 1), new Vec3(0, 0, -1)).create().get(),
};

return true;
Expand Down Expand Up @@ -164,5 +164,5 @@ static void StartTest(PhysicsSystem inPhysicsSystem, EMotionQuality inMotionQu
}

static BodyCreationSettings mMeshSettings;
static Shape[] mShapes;
static ShapeRefC[] mShapes;
}
14 changes: 7 additions & 7 deletions src/test/java/testjoltjni/junit/Test002.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ of this software and associated documentation files (the "Software"), to deal
import com.github.stephengold.joltjni.PhysicsSettings;
import com.github.stephengold.joltjni.PhysicsSystem;
import com.github.stephengold.joltjni.RVec3;
import com.github.stephengold.joltjni.Shape;
import com.github.stephengold.joltjni.ShapeRefC;
import com.github.stephengold.joltjni.SphereShape;
import com.github.stephengold.joltjni.TempAllocatorImpl;
import com.github.stephengold.joltjni.Vec3;
Expand Down Expand Up @@ -84,7 +84,7 @@ public class Test002 {
/**
* convex shapes for dynamic bodies
*/
private static Shape[] dynamicShapes;
private static ShapeRefC[] dynamicShapes;
// *************************************************************************
// new methods exposed

Expand Down Expand Up @@ -218,11 +218,11 @@ private static void load() {
Vec3[] hullVertices = {new Vec3(0f, 1f, 0f), new Vec3(1f, 0f, 0f),
new Vec3(-1f, 0f, 0f), new Vec3(0f, 0f, 1f), new Vec3(0f, 0f, -1f)};

dynamicShapes = new Shape[]{
new BoxShape(new Vec3(0.5f, 0.75f, 1f)),
new SphereShape(0.5f),
new CapsuleShape(0.75f, 0.5f),
new ConvexHullShapeSettings(hullVertices).createShape()
dynamicShapes = new ShapeRefC[]{
new BoxShape(new Vec3(0.5f, 0.75f, 1f)).toRefC(),
new SphereShape(0.5f).toRefC(),
new CapsuleShape(0.75f, 0.5f).toRefC(),
new ConvexHullShapeSettings(hullVertices).create().get()
};
}

Expand Down

0 comments on commit 6d8aabb

Please sign in to comment.