Skip to content

Commit

Permalink
TestRbc: add 3 tests for custom collision shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Jan 25, 2024
1 parent ed34314 commit 68fee86
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions MinieExamples/src/main/java/jme3utilities/minie/test/TestRbc.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2018-2023, Stephen Gold
Copyright (c) 2018-2024 Stephen Gold
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand All @@ -26,6 +26,8 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
*/
package jme3utilities.minie.test;

import com.github.stephengold.shapes.custom.CustomBox;
import com.github.stephengold.shapes.custom.CustomEllipsoid;
import com.jme3.app.Application;
import com.jme3.app.StatsAppState;
import com.jme3.app.state.AppState;
Expand Down Expand Up @@ -137,15 +139,16 @@ public class TestRbc
*/
final private static String[] testNames = {
"17x17Terrain", "33x33Terrain", "5x5Terrain", "65x65Terrain",
"9x9Terrain", "Box", "BoxGImpact", "BoxHull", "BoxMesh", "Cone",
"ConeGImpact", "ConeHull", "ConeMesh", "Cylinder", "CylinderGImpact",
"CylinderHull", "CylinderMesh", "FourSphere", "KissCapsule", "KissHull",
"KissMesh", "KissMultiSphere", "KissSphere", "LargeTerrain",
"OneSphere", "Prism", "Saucer", "SaucerGImpact", "SaucerHull",
"SaucerMesh", "Simplex", "SmallTerrain", "Sphere", "SphereCapsule",
"SphereGImpact", "SphereHull", "SphereMesh", "Square", "SquareBox",
"SquareConvex2d", "SquareGImpact", "SquareHeightfield", "SquareHull",
"SquareMesh", "TetraGImpact", "TetraHull", "TetraMesh", "TwoSphere"
"9x9Terrain", "Box", "BoxCustom", "BoxGImpact", "BoxHull", "BoxMesh",
"Cone", "ConeGImpact", "ConeHull", "ConeMesh", "Cylinder",
"CylinderGImpact", "CylinderHull", "CylinderMesh", "FourSphere",
"KissCapsule", "KissHull", "KissMesh", "KissMultiSphere", "KissSphere",
"LargeTerrain", "OneSphere", "Prism", "Saucer", "SaucerGImpact",
"SaucerHull", "SaucerMesh", "Simplex", "SmallTerrain", "Sphere",
"SphereCapsule", "SphereCustom", "SphereGImpact", "SphereHull",
"SphereMesh", "Square", "SquareBox", "SquareConvex2d", "SquareCustom",
"SquareGImpact", "SquareHeightfield", "SquareHull", "SquareMesh",
"TetraGImpact", "TetraHull", "TetraMesh", "TwoSphere"
};
// *************************************************************************
// fields
Expand Down Expand Up @@ -590,6 +593,7 @@ private void addAShape() {
break;

case "Box":
case "BoxCustom":
case "BoxGImpact":
case "BoxHull":
case "BoxMesh":
Expand Down Expand Up @@ -642,6 +646,7 @@ private void addAShape() {
case "OneSphere":
case "Sphere":
case "SphereCapsule":
case "SphereCustom":
case "SphereGImpact":
case "SphereHull":
case "SphereMesh":
Expand All @@ -650,6 +655,7 @@ private void addAShape() {

case "Square":
case "SquareBox":
case "SquareCustom":
case "SquareConvex2d":
case "SquareGImpact":
case "SquareHeightfield":
Expand Down Expand Up @@ -685,6 +691,10 @@ private void addBox() {
= new BoxCollisionShape(radius, halfThickness, radius);
break;

case "BoxCustom":
testShape = new CustomBox(radius, halfThickness, radius);
break;

case "BoxGImpact":
testShape = new GImpactCollisionShape(mesh);
break;
Expand Down Expand Up @@ -1019,6 +1029,10 @@ private void addSphere() {
testShape = new CapsuleCollisionShape(radius, height);
break;

case "SphereCustom":
testShape = new CustomEllipsoid(radius);
break;

case "SphereGImpact":
testShape = new GImpactCollisionShape(mesh);
break;
Expand Down Expand Up @@ -1055,6 +1069,10 @@ private void addSquare() {
testShape = new BoxCollisionShape(he, he, 0.04f);
break;

case "SquareCustom":
testShape = new CustomBox(he, he, 0.001f);
break;

case "SquareConvex2d":
FloatBuffer buffer
= mesh.getFloatBuffer(VertexBuffer.Type.Position);
Expand Down

0 comments on commit 68fee86

Please sign in to comment.