├── .gitattributes ├── .gitignore ├── LIBRARIES.md ├── LICENSE ├── PORTS.md ├── README.md ├── TESTS.md ├── build.gradle ├── example ├── .gitignore ├── assets │ ├── Antenna Ball.png │ ├── Antenna.png │ ├── Robot.png │ ├── Wheel.png │ ├── drumstick.wav │ ├── font-export.fnt │ ├── font-over-export.fnt │ ├── font-pressed-export.fnt │ ├── robot.g3db │ ├── test-skin.atlas │ ├── test-skin.json │ ├── test-skin.png │ ├── test.mp3 │ ├── test.png │ ├── test.txt │ └── test.wav ├── build.gradle ├── core │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── thelogicmaster │ │ └── example │ │ └── Example.java ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lwjgl3 │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── thelogicmaster │ │ └── lwjgl3 │ │ └── Lwjgl3Launcher.java ├── settings.gradle └── switch │ ├── build.gradle │ ├── icon.jpg │ ├── src │ └── main │ │ └── java │ │ └── com │ │ └── thelogicmaster │ │ └── example │ │ └── SwitchLauncher.java │ └── switch.json ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── media ├── Agile.png ├── ArithmeticRun.png ├── Bomberman.png ├── BurgerParty.png ├── DarkMatter.png ├── JewelThief.png ├── Klooni1010.png ├── Mindustry.png ├── MysticGarden.png ├── PepperAndCarrot.png ├── PixelWheels.png ├── PlanetGenerator.png ├── RectBall.png ├── ShatteredPixel.png ├── SquareAstray.png ├── Tangler.png ├── TriPeaks.png ├── Unlucky.png ├── Xodus.png ├── logo.svg ├── logo_256.jpg ├── logo_256.png ├── logo_512.png └── nomoore.png ├── settings.gradle ├── switch-gdx ├── .gitignore ├── build.gradle ├── gradlew ├── gradlew.bat ├── res │ ├── Box2D │ │ ├── Box2D.h │ │ ├── CHANGES │ │ ├── Collision │ │ │ ├── Shapes │ │ │ │ ├── b2ChainShape.cpp │ │ │ │ ├── b2ChainShape.h │ │ │ │ ├── b2CircleShape.cpp │ │ │ │ ├── b2CircleShape.h │ │ │ │ ├── b2EdgeShape.cpp │ │ │ │ ├── b2EdgeShape.h │ │ │ │ ├── b2PolygonShape.cpp │ │ │ │ ├── b2PolygonShape.h │ │ │ │ └── b2Shape.h │ │ │ ├── b2BroadPhase.cpp │ │ │ ├── b2BroadPhase.h │ │ │ ├── b2CollideCircle.cpp │ │ │ ├── b2CollideEdge.cpp │ │ │ ├── b2CollidePolygon.cpp │ │ │ ├── b2Collision.cpp │ │ │ ├── b2Collision.h │ │ │ ├── b2Distance.cpp │ │ │ ├── b2Distance.h │ │ │ ├── b2DynamicTree.cpp │ │ │ ├── b2DynamicTree.h │ │ │ ├── b2TimeOfImpact.cpp │ │ │ └── b2TimeOfImpact.h │ │ ├── Common │ │ │ ├── b2BlockAllocator.cpp │ │ │ ├── b2BlockAllocator.h │ │ │ ├── b2Draw.cpp │ │ │ ├── b2Draw.h │ │ │ ├── b2GrowableStack.h │ │ │ ├── b2Math.cpp │ │ │ ├── b2Math.h │ │ │ ├── b2Settings.cpp │ │ │ ├── b2Settings.h │ │ │ ├── b2StackAllocator.cpp │ │ │ ├── b2StackAllocator.h │ │ │ ├── b2Timer.cpp │ │ │ └── b2Timer.h │ │ ├── Dynamics │ │ │ ├── Contacts │ │ │ │ ├── b2ChainAndCircleContact.cpp │ │ │ │ ├── b2ChainAndCircleContact.h │ │ │ │ ├── b2ChainAndPolygonContact.cpp │ │ │ │ ├── b2ChainAndPolygonContact.h │ │ │ │ ├── b2CircleContact.cpp │ │ │ │ ├── b2CircleContact.h │ │ │ │ ├── b2Contact.cpp │ │ │ │ ├── b2Contact.h │ │ │ │ ├── b2ContactSolver.cpp │ │ │ │ ├── b2ContactSolver.h │ │ │ │ ├── b2EdgeAndCircleContact.cpp │ │ │ │ ├── b2EdgeAndCircleContact.h │ │ │ │ ├── b2EdgeAndPolygonContact.cpp │ │ │ │ ├── b2EdgeAndPolygonContact.h │ │ │ │ ├── b2PolygonAndCircleContact.cpp │ │ │ │ ├── b2PolygonAndCircleContact.h │ │ │ │ ├── b2PolygonContact.cpp │ │ │ │ └── b2PolygonContact.h │ │ │ ├── Joints │ │ │ │ ├── b2DistanceJoint.cpp │ │ │ │ ├── b2DistanceJoint.h │ │ │ │ ├── b2FrictionJoint.cpp │ │ │ │ ├── b2FrictionJoint.h │ │ │ │ ├── b2GearJoint.cpp │ │ │ │ ├── b2GearJoint.h │ │ │ │ ├── b2Joint.cpp │ │ │ │ ├── b2Joint.h │ │ │ │ ├── b2MotorJoint.cpp │ │ │ │ ├── b2MotorJoint.h │ │ │ │ ├── b2MouseJoint.cpp │ │ │ │ ├── b2MouseJoint.h │ │ │ │ ├── b2PrismaticJoint.cpp │ │ │ │ ├── b2PrismaticJoint.h │ │ │ │ ├── b2PulleyJoint.cpp │ │ │ │ ├── b2PulleyJoint.h │ │ │ │ ├── b2RevoluteJoint.cpp │ │ │ │ ├── b2RevoluteJoint.h │ │ │ │ ├── b2RopeJoint.cpp │ │ │ │ ├── b2RopeJoint.h │ │ │ │ ├── b2WeldJoint.cpp │ │ │ │ ├── b2WeldJoint.h │ │ │ │ ├── b2WheelJoint.cpp │ │ │ │ └── b2WheelJoint.h │ │ │ ├── b2Body.cpp │ │ │ ├── b2Body.h │ │ │ ├── b2ContactManager.cpp │ │ │ ├── b2ContactManager.h │ │ │ ├── b2Fixture.cpp │ │ │ ├── b2Fixture.h │ │ │ ├── b2Island.cpp │ │ │ ├── b2Island.h │ │ │ ├── b2TimeStep.h │ │ │ ├── b2World.cpp │ │ │ ├── b2World.h │ │ │ ├── b2WorldCallbacks.cpp │ │ │ └── b2WorldCallbacks.h │ │ └── Rope │ │ │ ├── b2Rope.cpp │ │ │ └── b2Rope.h │ ├── KHR │ │ └── khrplatform.h │ ├── glad │ │ └── gles2.h │ ├── switchgdx.clearwing.json │ └── switchgdx │ │ ├── FreeType_native.cpp │ │ ├── Instrinsics.cpp │ │ ├── Platform.cpp │ │ ├── SDL_mixer.h │ │ ├── SwitchGDX.cpp │ │ ├── box2d │ │ ├── Body_native.cpp │ │ ├── ChainShape_native.cpp │ │ ├── CircleShape_native.cpp │ │ ├── ContactImpulse_native.cpp │ │ ├── Contact_native.cpp │ │ ├── DistanceJoint_native.cpp │ │ ├── EdgeShape_native.cpp │ │ ├── Fixture_native.cpp │ │ ├── FrictionJoint_native.cpp │ │ ├── GearJoint_native.cpp │ │ ├── Joint_native.cpp │ │ ├── Manifold_native.cpp │ │ ├── MotorJoint_native.cpp │ │ ├── MouseJoint_native.cpp │ │ ├── PolygonShape_native.cpp │ │ ├── PrismaticJoint_native.cpp │ │ ├── PulleyJoint_native.cpp │ │ ├── RevoluteJoint_native.cpp │ │ ├── RopeJoint_native.cpp │ │ ├── Shape_native.cpp │ │ ├── WeldJoint_native.cpp │ │ ├── WheelJoint_native.cpp │ │ └── World_native.cpp │ │ ├── bullet │ │ ├── bullet │ │ │ ├── BulletCollision │ │ │ │ ├── BroadphaseCollision │ │ │ │ │ ├── btAxisSweep3.cpp │ │ │ │ │ ├── btAxisSweep3.h │ │ │ │ │ ├── btAxisSweep3Internal.h │ │ │ │ │ ├── btBroadphaseInterface.h │ │ │ │ │ ├── btBroadphaseProxy.cpp │ │ │ │ │ ├── btBroadphaseProxy.h │ │ │ │ │ ├── btCollisionAlgorithm.cpp │ │ │ │ │ ├── btCollisionAlgorithm.h │ │ │ │ │ ├── btDbvt.cpp │ │ │ │ │ ├── btDbvt.h │ │ │ │ │ ├── btDbvtBroadphase.cpp │ │ │ │ │ ├── btDbvtBroadphase.h │ │ │ │ │ ├── btDispatcher.cpp │ │ │ │ │ ├── btDispatcher.h │ │ │ │ │ ├── btOverlappingPairCache.cpp │ │ │ │ │ ├── btOverlappingPairCache.h │ │ │ │ │ ├── btOverlappingPairCallback.h │ │ │ │ │ ├── btQuantizedBvh.cpp │ │ │ │ │ ├── btQuantizedBvh.h │ │ │ │ │ ├── btSimpleBroadphase.cpp │ │ │ │ │ └── btSimpleBroadphase.h │ │ │ │ ├── CollisionDispatch │ │ │ │ │ ├── SphereTriangleDetector.cpp │ │ │ │ │ ├── SphereTriangleDetector.h │ │ │ │ │ ├── btActivatingCollisionAlgorithm.cpp │ │ │ │ │ ├── btActivatingCollisionAlgorithm.h │ │ │ │ │ ├── btBox2dBox2dCollisionAlgorithm.cpp │ │ │ │ │ ├── btBox2dBox2dCollisionAlgorithm.h │ │ │ │ │ ├── btBoxBoxCollisionAlgorithm.cpp │ │ │ │ │ ├── btBoxBoxCollisionAlgorithm.h │ │ │ │ │ ├── btBoxBoxDetector.cpp │ │ │ │ │ ├── btBoxBoxDetector.h │ │ │ │ │ ├── btCollisionConfiguration.h │ │ │ │ │ ├── btCollisionCreateFunc.h │ │ │ │ │ ├── btCollisionDispatcher.cpp │ │ │ │ │ ├── btCollisionDispatcher.h │ │ │ │ │ ├── btCollisionDispatcherMt.cpp │ │ │ │ │ ├── btCollisionDispatcherMt.h │ │ │ │ │ ├── btCollisionObject.cpp │ │ │ │ │ ├── btCollisionObject.h │ │ │ │ │ ├── btCollisionObjectWrapper.h │ │ │ │ │ ├── btCollisionWorld.cpp │ │ │ │ │ ├── btCollisionWorld.h │ │ │ │ │ ├── btCollisionWorldImporter.cpp │ │ │ │ │ ├── btCollisionWorldImporter.h │ │ │ │ │ ├── btCompoundCollisionAlgorithm.cpp │ │ │ │ │ ├── btCompoundCollisionAlgorithm.h │ │ │ │ │ ├── btCompoundCompoundCollisionAlgorithm.cpp │ │ │ │ │ ├── btCompoundCompoundCollisionAlgorithm.h │ │ │ │ │ ├── btConvex2dConvex2dAlgorithm.cpp │ │ │ │ │ ├── btConvex2dConvex2dAlgorithm.h │ │ │ │ │ ├── btConvexConcaveCollisionAlgorithm.cpp │ │ │ │ │ ├── btConvexConcaveCollisionAlgorithm.h │ │ │ │ │ ├── btConvexConvexAlgorithm.cpp │ │ │ │ │ ├── btConvexConvexAlgorithm.h │ │ │ │ │ ├── btConvexPlaneCollisionAlgorithm.cpp │ │ │ │ │ ├── btConvexPlaneCollisionAlgorithm.h │ │ │ │ │ ├── btDefaultCollisionConfiguration.cpp │ │ │ │ │ ├── btDefaultCollisionConfiguration.h │ │ │ │ │ ├── btEmptyCollisionAlgorithm.cpp │ │ │ │ │ ├── btEmptyCollisionAlgorithm.h │ │ │ │ │ ├── btGhostObject.cpp │ │ │ │ │ ├── btGhostObject.h │ │ │ │ │ ├── btHashedSimplePairCache.cpp │ │ │ │ │ ├── btHashedSimplePairCache.h │ │ │ │ │ ├── btInternalEdgeUtility.cpp │ │ │ │ │ ├── btInternalEdgeUtility.h │ │ │ │ │ ├── btManifoldResult.cpp │ │ │ │ │ ├── btManifoldResult.h │ │ │ │ │ ├── btSimulationIslandManager.cpp │ │ │ │ │ ├── btSimulationIslandManager.h │ │ │ │ │ ├── btSphereBoxCollisionAlgorithm.cpp │ │ │ │ │ ├── btSphereBoxCollisionAlgorithm.h │ │ │ │ │ ├── btSphereSphereCollisionAlgorithm.cpp │ │ │ │ │ ├── btSphereSphereCollisionAlgorithm.h │ │ │ │ │ ├── btSphereTriangleCollisionAlgorithm.cpp │ │ │ │ │ ├── btSphereTriangleCollisionAlgorithm.h │ │ │ │ │ ├── btUnionFind.cpp │ │ │ │ │ └── btUnionFind.h │ │ │ │ ├── CollisionShapes │ │ │ │ │ ├── btBox2dShape.cpp │ │ │ │ │ ├── btBox2dShape.h │ │ │ │ │ ├── btBoxShape.cpp │ │ │ │ │ ├── btBoxShape.h │ │ │ │ │ ├── btBvhTriangleMeshShape.cpp │ │ │ │ │ ├── btBvhTriangleMeshShape.h │ │ │ │ │ ├── btCapsuleShape.cpp │ │ │ │ │ ├── btCapsuleShape.h │ │ │ │ │ ├── btCollisionMargin.h │ │ │ │ │ ├── btCollisionShape.cpp │ │ │ │ │ ├── btCollisionShape.h │ │ │ │ │ ├── btCompoundShape.cpp │ │ │ │ │ ├── btCompoundShape.h │ │ │ │ │ ├── btConcaveShape.cpp │ │ │ │ │ ├── btConcaveShape.h │ │ │ │ │ ├── btConeShape.cpp │ │ │ │ │ ├── btConeShape.h │ │ │ │ │ ├── btConvex2dShape.cpp │ │ │ │ │ ├── btConvex2dShape.h │ │ │ │ │ ├── btConvexHullShape.cpp │ │ │ │ │ ├── btConvexHullShape.h │ │ │ │ │ ├── btConvexInternalShape.cpp │ │ │ │ │ ├── btConvexInternalShape.h │ │ │ │ │ ├── btConvexPointCloudShape.cpp │ │ │ │ │ ├── btConvexPointCloudShape.h │ │ │ │ │ ├── btConvexPolyhedron.cpp │ │ │ │ │ ├── btConvexPolyhedron.h │ │ │ │ │ ├── btConvexShape.cpp │ │ │ │ │ ├── btConvexShape.h │ │ │ │ │ ├── btConvexTriangleMeshShape.cpp │ │ │ │ │ ├── btConvexTriangleMeshShape.h │ │ │ │ │ ├── btCylinderShape.cpp │ │ │ │ │ ├── btCylinderShape.h │ │ │ │ │ ├── btEmptyShape.cpp │ │ │ │ │ ├── btEmptyShape.h │ │ │ │ │ ├── btHeightfieldTerrainShape.cpp │ │ │ │ │ ├── btHeightfieldTerrainShape.h │ │ │ │ │ ├── btMaterial.h │ │ │ │ │ ├── btMinkowskiSumShape.cpp │ │ │ │ │ ├── btMinkowskiSumShape.h │ │ │ │ │ ├── btMultiSphereShape.cpp │ │ │ │ │ ├── btMultiSphereShape.h │ │ │ │ │ ├── btMultimaterialTriangleMeshShape.cpp │ │ │ │ │ ├── btMultimaterialTriangleMeshShape.h │ │ │ │ │ ├── btOptimizedBvh.cpp │ │ │ │ │ ├── btOptimizedBvh.h │ │ │ │ │ ├── btPolyhedralConvexShape.cpp │ │ │ │ │ ├── btPolyhedralConvexShape.h │ │ │ │ │ ├── btScaledBvhTriangleMeshShape.cpp │ │ │ │ │ ├── btScaledBvhTriangleMeshShape.h │ │ │ │ │ ├── btShapeHull.cpp │ │ │ │ │ ├── btShapeHull.h │ │ │ │ │ ├── btSphereShape.cpp │ │ │ │ │ ├── btSphereShape.h │ │ │ │ │ ├── btStaticPlaneShape.cpp │ │ │ │ │ ├── btStaticPlaneShape.h │ │ │ │ │ ├── btStridingMeshInterface.cpp │ │ │ │ │ ├── btStridingMeshInterface.h │ │ │ │ │ ├── btTetrahedronShape.cpp │ │ │ │ │ ├── btTetrahedronShape.h │ │ │ │ │ ├── btTriangleBuffer.cpp │ │ │ │ │ ├── btTriangleBuffer.h │ │ │ │ │ ├── btTriangleCallback.cpp │ │ │ │ │ ├── btTriangleCallback.h │ │ │ │ │ ├── btTriangleIndexVertexArray.cpp │ │ │ │ │ ├── btTriangleIndexVertexArray.h │ │ │ │ │ ├── btTriangleIndexVertexMaterialArray.cpp │ │ │ │ │ ├── btTriangleIndexVertexMaterialArray.h │ │ │ │ │ ├── btTriangleInfoMap.h │ │ │ │ │ ├── btTriangleMesh.cpp │ │ │ │ │ ├── btTriangleMesh.h │ │ │ │ │ ├── btTriangleMeshShape.cpp │ │ │ │ │ ├── btTriangleMeshShape.h │ │ │ │ │ ├── btTriangleShape.h │ │ │ │ │ ├── btUniformScalingShape.cpp │ │ │ │ │ └── btUniformScalingShape.h │ │ │ │ ├── Gimpact │ │ │ │ │ ├── btBoxCollision.h │ │ │ │ │ ├── btClipPolygon.h │ │ │ │ │ ├── btCompoundFromGimpact.h │ │ │ │ │ ├── btContactProcessing.cpp │ │ │ │ │ ├── btContactProcessing.h │ │ │ │ │ ├── btContactProcessingStructs.h │ │ │ │ │ ├── btGImpactBvh.cpp │ │ │ │ │ ├── btGImpactBvh.h │ │ │ │ │ ├── btGImpactBvhStructs.h │ │ │ │ │ ├── btGImpactCollisionAlgorithm.cpp │ │ │ │ │ ├── btGImpactCollisionAlgorithm.h │ │ │ │ │ ├── btGImpactMassUtil.h │ │ │ │ │ ├── btGImpactQuantizedBvh.cpp │ │ │ │ │ ├── btGImpactQuantizedBvh.h │ │ │ │ │ ├── btGImpactQuantizedBvhStructs.h │ │ │ │ │ ├── btGImpactShape.cpp │ │ │ │ │ ├── btGImpactShape.h │ │ │ │ │ ├── btGenericPoolAllocator.cpp │ │ │ │ │ ├── btGenericPoolAllocator.h │ │ │ │ │ ├── btGeometryOperations.h │ │ │ │ │ ├── btQuantization.h │ │ │ │ │ ├── btTriangleShapeEx.cpp │ │ │ │ │ ├── btTriangleShapeEx.h │ │ │ │ │ ├── gim_array.h │ │ │ │ │ ├── gim_basic_geometry_operations.h │ │ │ │ │ ├── gim_bitset.h │ │ │ │ │ ├── gim_box_collision.h │ │ │ │ │ ├── gim_box_set.cpp │ │ │ │ │ ├── gim_box_set.h │ │ │ │ │ ├── gim_clip_polygon.h │ │ │ │ │ ├── gim_contact.cpp │ │ │ │ │ ├── gim_contact.h │ │ │ │ │ ├── gim_geom_types.h │ │ │ │ │ ├── gim_geometry.h │ │ │ │ │ ├── gim_hash_table.h │ │ │ │ │ ├── gim_linear_math.h │ │ │ │ │ ├── gim_math.h │ │ │ │ │ ├── gim_memory.cpp │ │ │ │ │ ├── gim_memory.h │ │ │ │ │ ├── gim_radixsort.h │ │ │ │ │ ├── gim_tri_collision.cpp │ │ │ │ │ └── gim_tri_collision.h │ │ │ │ └── NarrowPhaseCollision │ │ │ │ │ ├── btComputeGjkEpaPenetration.h │ │ │ │ │ ├── btContinuousConvexCollision.cpp │ │ │ │ │ ├── btContinuousConvexCollision.h │ │ │ │ │ ├── btConvexCast.cpp │ │ │ │ │ ├── btConvexCast.h │ │ │ │ │ ├── btConvexPenetrationDepthSolver.h │ │ │ │ │ ├── btDiscreteCollisionDetectorInterface.h │ │ │ │ │ ├── btGjkCollisionDescription.h │ │ │ │ │ ├── btGjkConvexCast.cpp │ │ │ │ │ ├── btGjkConvexCast.h │ │ │ │ │ ├── btGjkEpa2.cpp │ │ │ │ │ ├── btGjkEpa2.h │ │ │ │ │ ├── btGjkEpa3.h │ │ │ │ │ ├── btGjkEpaPenetrationDepthSolver.cpp │ │ │ │ │ ├── btGjkEpaPenetrationDepthSolver.h │ │ │ │ │ ├── btGjkPairDetector.cpp │ │ │ │ │ ├── btGjkPairDetector.h │ │ │ │ │ ├── btManifoldPoint.h │ │ │ │ │ ├── btMinkowskiPenetrationDepthSolver.cpp │ │ │ │ │ ├── btMinkowskiPenetrationDepthSolver.h │ │ │ │ │ ├── btMprPenetration.h │ │ │ │ │ ├── btPersistentManifold.cpp │ │ │ │ │ ├── btPersistentManifold.h │ │ │ │ │ ├── btPointCollector.h │ │ │ │ │ ├── btPolyhedralContactClipping.cpp │ │ │ │ │ ├── btPolyhedralContactClipping.h │ │ │ │ │ ├── btRaycastCallback.cpp │ │ │ │ │ ├── btRaycastCallback.h │ │ │ │ │ ├── btSimplexSolverInterface.h │ │ │ │ │ ├── btSubSimplexConvexCast.cpp │ │ │ │ │ ├── btSubSimplexConvexCast.h │ │ │ │ │ ├── btVoronoiSimplexSolver.cpp │ │ │ │ │ └── btVoronoiSimplexSolver.h │ │ │ ├── BulletDynamics │ │ │ │ ├── Character │ │ │ │ │ ├── btCharacterControllerInterface.h │ │ │ │ │ ├── btKinematicCharacterController.cpp │ │ │ │ │ └── btKinematicCharacterController.h │ │ │ │ ├── ConstraintSolver │ │ │ │ │ ├── btConeTwistConstraint.cpp │ │ │ │ │ ├── btConeTwistConstraint.h │ │ │ │ │ ├── btConstraintSolver.h │ │ │ │ │ ├── btContactConstraint.cpp │ │ │ │ │ ├── btContactConstraint.h │ │ │ │ │ ├── btContactSolverInfo.h │ │ │ │ │ ├── btFixedConstraint.cpp │ │ │ │ │ ├── btFixedConstraint.h │ │ │ │ │ ├── btGearConstraint.cpp │ │ │ │ │ ├── btGearConstraint.h │ │ │ │ │ ├── btGeneric6DofConstraint.cpp │ │ │ │ │ ├── btGeneric6DofConstraint.h │ │ │ │ │ ├── btGeneric6DofSpring2Constraint.cpp │ │ │ │ │ ├── btGeneric6DofSpring2Constraint.h │ │ │ │ │ ├── btGeneric6DofSpringConstraint.cpp │ │ │ │ │ ├── btGeneric6DofSpringConstraint.h │ │ │ │ │ ├── btHinge2Constraint.cpp │ │ │ │ │ ├── btHinge2Constraint.h │ │ │ │ │ ├── btHingeConstraint.cpp │ │ │ │ │ ├── btHingeConstraint.h │ │ │ │ │ ├── btJacobianEntry.h │ │ │ │ │ ├── btNNCGConstraintSolver.cpp │ │ │ │ │ ├── btNNCGConstraintSolver.h │ │ │ │ │ ├── btPoint2PointConstraint.cpp │ │ │ │ │ ├── btPoint2PointConstraint.h │ │ │ │ │ ├── btSequentialImpulseConstraintSolver.cpp │ │ │ │ │ ├── btSequentialImpulseConstraintSolver.h │ │ │ │ │ ├── btSliderConstraint.cpp │ │ │ │ │ ├── btSliderConstraint.h │ │ │ │ │ ├── btSolve2LinearConstraint.cpp │ │ │ │ │ ├── btSolve2LinearConstraint.h │ │ │ │ │ ├── btSolverBody.h │ │ │ │ │ ├── btSolverConstraint.h │ │ │ │ │ ├── btTypedConstraint.cpp │ │ │ │ │ ├── btTypedConstraint.h │ │ │ │ │ ├── btUniversalConstraint.cpp │ │ │ │ │ └── btUniversalConstraint.h │ │ │ │ ├── Dynamics │ │ │ │ │ ├── btActionInterface.h │ │ │ │ │ ├── btDiscreteDynamicsWorld.cpp │ │ │ │ │ ├── btDiscreteDynamicsWorld.h │ │ │ │ │ ├── btDiscreteDynamicsWorldMt.cpp │ │ │ │ │ ├── btDiscreteDynamicsWorldMt.h │ │ │ │ │ ├── btDynamicsWorld.h │ │ │ │ │ ├── btRigidBody.cpp │ │ │ │ │ ├── btRigidBody.h │ │ │ │ │ ├── btSimpleDynamicsWorld.cpp │ │ │ │ │ ├── btSimpleDynamicsWorld.h │ │ │ │ │ ├── btSimulationIslandManagerMt.cpp │ │ │ │ │ └── btSimulationIslandManagerMt.h │ │ │ │ ├── Featherstone │ │ │ │ │ ├── btMultiBody.cpp │ │ │ │ │ ├── btMultiBody.h │ │ │ │ │ ├── btMultiBodyConstraint.cpp │ │ │ │ │ ├── btMultiBodyConstraint.h │ │ │ │ │ ├── btMultiBodyConstraintSolver.cpp │ │ │ │ │ ├── btMultiBodyConstraintSolver.h │ │ │ │ │ ├── btMultiBodyDynamicsWorld.cpp │ │ │ │ │ ├── btMultiBodyDynamicsWorld.h │ │ │ │ │ ├── btMultiBodyFixedConstraint.cpp │ │ │ │ │ ├── btMultiBodyFixedConstraint.h │ │ │ │ │ ├── btMultiBodyGearConstraint.cpp │ │ │ │ │ ├── btMultiBodyGearConstraint.h │ │ │ │ │ ├── btMultiBodyJointFeedback.h │ │ │ │ │ ├── btMultiBodyJointLimitConstraint.cpp │ │ │ │ │ ├── btMultiBodyJointLimitConstraint.h │ │ │ │ │ ├── btMultiBodyJointMotor.cpp │ │ │ │ │ ├── btMultiBodyJointMotor.h │ │ │ │ │ ├── btMultiBodyLink.h │ │ │ │ │ ├── btMultiBodyLinkCollider.h │ │ │ │ │ ├── btMultiBodyPoint2Point.cpp │ │ │ │ │ ├── btMultiBodyPoint2Point.h │ │ │ │ │ ├── btMultiBodySliderConstraint.cpp │ │ │ │ │ ├── btMultiBodySliderConstraint.h │ │ │ │ │ └── btMultiBodySolverConstraint.h │ │ │ │ ├── MLCPSolvers │ │ │ │ │ ├── btDantzigLCP.cpp │ │ │ │ │ ├── btDantzigLCP.h │ │ │ │ │ ├── btDantzigSolver.h │ │ │ │ │ ├── btLemkeAlgorithm.cpp │ │ │ │ │ ├── btLemkeAlgorithm.h │ │ │ │ │ ├── btLemkeSolver.h │ │ │ │ │ ├── btMLCPSolver.cpp │ │ │ │ │ ├── btMLCPSolver.h │ │ │ │ │ ├── btMLCPSolverInterface.h │ │ │ │ │ ├── btPATHSolver.h │ │ │ │ │ └── btSolveProjectedGaussSeidel.h │ │ │ │ └── Vehicle │ │ │ │ │ ├── btRaycastVehicle.cpp │ │ │ │ │ ├── btRaycastVehicle.h │ │ │ │ │ ├── btVehicleRaycaster.h │ │ │ │ │ ├── btWheelInfo.cpp │ │ │ │ │ └── btWheelInfo.h │ │ │ ├── BulletInverseDynamics │ │ │ │ ├── IDConfig.hpp │ │ │ │ ├── IDConfigBuiltin.hpp │ │ │ │ ├── IDConfigEigen.hpp │ │ │ │ ├── IDErrorMessages.hpp │ │ │ │ ├── IDMath.cpp │ │ │ │ ├── IDMath.hpp │ │ │ │ ├── MultiBodyTree.cpp │ │ │ │ ├── MultiBodyTree.hpp │ │ │ │ └── details │ │ │ │ │ ├── IDEigenInterface.hpp │ │ │ │ │ ├── IDLinearMathInterface.hpp │ │ │ │ │ ├── IDMatVec.hpp │ │ │ │ │ ├── MultiBodyTreeImpl.cpp │ │ │ │ │ ├── MultiBodyTreeImpl.hpp │ │ │ │ │ ├── MultiBodyTreeInitCache.cpp │ │ │ │ │ └── MultiBodyTreeInitCache.hpp │ │ │ ├── BulletSoftBody │ │ │ │ ├── btDefaultSoftBodySolver.cpp │ │ │ │ ├── btDefaultSoftBodySolver.h │ │ │ │ ├── btSoftBody.cpp │ │ │ │ ├── btSoftBody.h │ │ │ │ ├── btSoftBodyConcaveCollisionAlgorithm.cpp │ │ │ │ ├── btSoftBodyConcaveCollisionAlgorithm.h │ │ │ │ ├── btSoftBodyData.h │ │ │ │ ├── btSoftBodyHelpers.cpp │ │ │ │ ├── btSoftBodyHelpers.h │ │ │ │ ├── btSoftBodyInternals.h │ │ │ │ ├── btSoftBodyRigidBodyCollisionConfiguration.cpp │ │ │ │ ├── btSoftBodyRigidBodyCollisionConfiguration.h │ │ │ │ ├── btSoftBodySolverVertexBuffer.h │ │ │ │ ├── btSoftBodySolvers.h │ │ │ │ ├── btSoftMultiBodyDynamicsWorld.cpp │ │ │ │ ├── btSoftMultiBodyDynamicsWorld.h │ │ │ │ ├── btSoftRigidCollisionAlgorithm.cpp │ │ │ │ ├── btSoftRigidCollisionAlgorithm.h │ │ │ │ ├── btSoftRigidDynamicsWorld.cpp │ │ │ │ ├── btSoftRigidDynamicsWorld.h │ │ │ │ ├── btSoftSoftCollisionAlgorithm.cpp │ │ │ │ ├── btSoftSoftCollisionAlgorithm.h │ │ │ │ └── btSparseSDF.h │ │ │ ├── LinearMath │ │ │ │ ├── btAabbUtil2.h │ │ │ │ ├── btAlignedAllocator.cpp │ │ │ │ ├── btAlignedAllocator.h │ │ │ │ ├── btAlignedObjectArray.h │ │ │ │ ├── btConvexHull.cpp │ │ │ │ ├── btConvexHull.h │ │ │ │ ├── btConvexHullComputer.cpp │ │ │ │ ├── btConvexHullComputer.h │ │ │ │ ├── btCpuFeatureUtility.h │ │ │ │ ├── btDefaultMotionState.h │ │ │ │ ├── btGeometryUtil.cpp │ │ │ │ ├── btGeometryUtil.h │ │ │ │ ├── btGrahamScan2dConvexHull.h │ │ │ │ ├── btHashMap.h │ │ │ │ ├── btIDebugDraw.h │ │ │ │ ├── btList.h │ │ │ │ ├── btMatrix3x3.h │ │ │ │ ├── btMatrixX.h │ │ │ │ ├── btMinMax.h │ │ │ │ ├── btMotionState.h │ │ │ │ ├── btPolarDecomposition.cpp │ │ │ │ ├── btPolarDecomposition.h │ │ │ │ ├── btPoolAllocator.h │ │ │ │ ├── btQuadWord.h │ │ │ │ ├── btQuaternion.h │ │ │ │ ├── btQuickprof.cpp │ │ │ │ ├── btQuickprof.h │ │ │ │ ├── btRandom.h │ │ │ │ ├── btScalar.h │ │ │ │ ├── btSerializer.cpp │ │ │ │ ├── btSerializer.h │ │ │ │ ├── btSerializer64.cpp │ │ │ │ ├── btSpatialAlgebra.h │ │ │ │ ├── btStackAlloc.h │ │ │ │ ├── btThreads.cpp │ │ │ │ ├── btThreads.h │ │ │ │ ├── btTransform.h │ │ │ │ ├── btTransformUtil.h │ │ │ │ ├── btVector3.cpp │ │ │ │ └── btVector3.h │ │ │ ├── btBulletCollisionCommon.h │ │ │ └── btBulletDynamicsCommon.h │ │ ├── custom │ │ │ └── gdx │ │ │ │ ├── collision │ │ │ │ ├── ClosestNotMeConvexResultCallback.cpp │ │ │ │ ├── ClosestNotMeConvexResultCallback.h │ │ │ │ ├── ClosestNotMeRayResultCallback.cpp │ │ │ │ ├── ClosestNotMeRayResultCallback.h │ │ │ │ ├── CollisionObjectWrapper.h │ │ │ │ ├── ContactCache.cpp │ │ │ │ ├── ContactCache.h │ │ │ │ ├── ContactListener.cpp │ │ │ │ ├── ContactListener.h │ │ │ │ ├── CustomCollisionDispatcher.h │ │ │ │ └── GdxCollisionObjectBridge.h │ │ │ │ ├── common │ │ │ │ ├── jniHelpers.cpp │ │ │ │ └── jniHelpers.h │ │ │ │ ├── dynamics │ │ │ │ ├── CustomActionInterface.h │ │ │ │ ├── FilterableVehicleRaycaster.cpp │ │ │ │ ├── FilterableVehicleRaycaster.h │ │ │ │ ├── InternalTickCallback.cpp │ │ │ │ └── InternalTickCallback.h │ │ │ │ └── linearmath │ │ │ │ ├── mathtypes.cpp │ │ │ │ └── mathtypes.h │ │ ├── extras │ │ │ ├── InverseDynamics │ │ │ │ ├── BulletInverseDynamicsUtilsCommon.h │ │ │ │ ├── CloneTreeCreator.cpp │ │ │ │ ├── CloneTreeCreator.hpp │ │ │ │ ├── CoilCreator.cpp │ │ │ │ ├── CoilCreator.hpp │ │ │ │ ├── DillCreator.cpp │ │ │ │ ├── DillCreator.hpp │ │ │ │ ├── IDRandomUtil.cpp │ │ │ │ ├── IDRandomUtil.hpp │ │ │ │ ├── MultiBodyNameMap.cpp │ │ │ │ ├── MultiBodyNameMap.hpp │ │ │ │ ├── MultiBodyTreeCreator.cpp │ │ │ │ ├── MultiBodyTreeCreator.hpp │ │ │ │ ├── MultiBodyTreeDebugGraph.cpp │ │ │ │ ├── MultiBodyTreeDebugGraph.hpp │ │ │ │ ├── RandomTreeCreator.cpp │ │ │ │ ├── RandomTreeCreator.hpp │ │ │ │ ├── SimpleTreeCreator.cpp │ │ │ │ ├── SimpleTreeCreator.hpp │ │ │ │ ├── User2InternalIndex.cpp │ │ │ │ ├── User2InternalIndex.hpp │ │ │ │ ├── btMultiBodyTreeCreator.cpp │ │ │ │ ├── btMultiBodyTreeCreator.hpp │ │ │ │ ├── invdyn_bullet_comparison.cpp │ │ │ │ └── invdyn_bullet_comparison.hpp │ │ │ └── Serialize │ │ │ │ ├── BulletFileLoader │ │ │ │ ├── autogenerated │ │ │ │ │ └── bullet.h │ │ │ │ ├── bChunk.cpp │ │ │ │ ├── bChunk.h │ │ │ │ ├── bCommon.h │ │ │ │ ├── bDNA.cpp │ │ │ │ ├── bDNA.h │ │ │ │ ├── bDefines.h │ │ │ │ ├── bFile.cpp │ │ │ │ ├── bFile.h │ │ │ │ ├── btBulletFile.cpp │ │ │ │ └── btBulletFile.h │ │ │ │ └── BulletWorldImporter │ │ │ │ ├── btBulletWorldImporter.cpp │ │ │ │ ├── btBulletWorldImporter.h │ │ │ │ ├── btWorldImporter.cpp │ │ │ │ └── btWorldImporter.h │ │ └── swig │ │ │ ├── collision │ │ │ ├── collision_wrap.cpp │ │ │ └── collision_wrap.h │ │ │ ├── dynamics │ │ │ ├── dynamics_wrap.cpp │ │ │ └── dynamics_wrap.h │ │ │ ├── extras │ │ │ ├── extras_wrap.cpp │ │ │ └── extras_wrap.h │ │ │ ├── inversedynamics │ │ │ ├── inversedynamics_wrap.cpp │ │ │ └── inversedynamics_wrap.h │ │ │ ├── linearmath │ │ │ ├── linearmath_wrap.cpp │ │ │ └── linearmath_wrap.h │ │ │ └── softbody │ │ │ ├── softbody_wrap.cpp │ │ │ └── softbody_wrap.h │ │ ├── etc1_utils.cpp │ │ ├── etc1_utils.h │ │ ├── gdx2d.c │ │ ├── gdx2d.h │ │ ├── gdx_buffer_utils.h │ │ ├── gdx_matrix4.h │ │ ├── gles2.c │ │ ├── project │ │ ├── CMakeLists.txt │ │ ├── DevkitA64Libnx.cmake │ │ ├── FindFFI.cmake │ │ ├── FindPkgMacros.cmake │ │ ├── FindZZip.cmake │ │ ├── SwitchTools.cmake │ │ ├── bin2s_header.h.in │ │ ├── desktop.cmake │ │ ├── switch.cmake │ │ ├── uwp.cmake │ │ ├── uwp.cmd │ │ ├── vcpkg-configuration.json │ │ └── vcpkg.json │ │ ├── stb_image.h │ │ ├── tinyfiledialogs.c │ │ └── tinyfiledialogs.h └── src │ └── com │ ├── badlogic │ └── gdx │ │ └── utils │ │ ├── ReflectionPool.java │ │ ├── SharedLibraryLoader.java │ │ ├── Timer.java │ │ └── async │ │ ├── AsyncExecutor.java │ │ ├── AsyncResult.java │ │ └── AsyncTask.java │ └── thelogicmaster │ └── switchgdx │ ├── SwitchApplication.java │ ├── SwitchAudio.java │ ├── SwitchAudioDevice.java │ ├── SwitchController.java │ ├── SwitchControllerManager.java │ ├── SwitchControllerMapping.java │ ├── SwitchFileHandle.java │ ├── SwitchFiles.java │ ├── SwitchGL.java │ ├── SwitchGraphics.java │ ├── SwitchHttpResponse.java │ ├── SwitchInput.java │ ├── SwitchLogger.java │ ├── SwitchMusic.java │ ├── SwitchNet.java │ ├── SwitchPreferences.java │ ├── SwitchServerSocket.java │ ├── SwitchSocket.java │ └── SwitchSound.java └── tests ├── .gitignore ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── icon.jpg ├── src └── main │ └── java │ └── com │ └── thelogicmaster │ └── test │ ├── GarbageCollectorTest.java │ ├── JniGenTest.java │ ├── SwitchControllerTest.java │ ├── SwitchInputTest.java │ ├── SwitchLauncher.java │ ├── SwitchSocketTest.java │ ├── SwitchTestWrapper.java │ └── ThreadTest.java └── switch.json /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.sh text eol=lf 3 | *.c text 4 | *.cpp text 5 | *.h text 6 | *.java text 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # https://github.com/github/gitignore/blob/main/Java.gitignore 2 | 3 | .idea 4 | .gradle 5 | 6 | local.properties 7 | 8 | # Compiled class file 9 | *.class 10 | 11 | # Log file 12 | *.log 13 | 14 | # BlueJ files 15 | *.ctxt 16 | 17 | # Mobile Tools for Java (J2ME) 18 | .mtj.tmp/ 19 | 20 | # Package Files # 21 | *.jar 22 | *.war 23 | *.nar 24 | *.ear 25 | *.zip 26 | *.tar.gz 27 | *.rar 28 | 29 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 30 | hs_err_pid* 31 | replay_pid* 32 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | configure(allprojects) { 2 | apply plugin: 'java-library' 3 | sourceCompatibility = 1.8 4 | } 5 | 6 | allprojects { 7 | version = "3.0.1" + (System.env.JITPACK ? "" : "-dev") 8 | } 9 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | ## Gradle 2 | .gradle 3 | gradle-app.setting 4 | build/ 5 | 6 | ## Java: 7 | *.class 8 | *.war 9 | *.ear 10 | hs_err_pid* 11 | .attach_pid* 12 | 13 | ## Android: 14 | android/libs/armeabi-v7a/ 15 | android/libs/arm64-v8a/ 16 | android/libs/x86/ 17 | android/libs/x86_64/ 18 | android/gen/ 19 | local.properties 20 | com_crashlytics_export_strings.xml 21 | 22 | ## GWT: 23 | war/ 24 | html/war/gwt_bree/ 25 | html/gwt-unitCache/ 26 | .apt_generated/ 27 | html/war/WEB-INF/deploy/ 28 | html/war/WEB-INF/classes/ 29 | .gwt/ 30 | gwt-unitCache/ 31 | www-test/ 32 | .gwt-tmp/ 33 | *.symbolMap 34 | 35 | ## IntelliJ, Android Studio: 36 | .idea/ 37 | *.ipr 38 | *.iws 39 | *.iml 40 | out/ 41 | 42 | ## Eclipse 43 | .classpath 44 | .project 45 | .metadata 46 | **/bin/ 47 | tmp/ 48 | *.tmp 49 | *.bak 50 | *.swp 51 | *~.nib 52 | .settings/ 53 | .loadpath 54 | .externalToolBuilders/ 55 | *.launch 56 | 57 | ## NetBeans 58 | **/nbproject/private/ 59 | nbbuild/ 60 | dist/ 61 | nbdist/ 62 | nbactions.xml 63 | nb-configuration.xml 64 | 65 | ## OS Specific 66 | .DS_Store 67 | 68 | ## Miscellaneous 69 | *~ 70 | *.*# 71 | *#*# 72 | -------------------------------------------------------------------------------- /example/assets/Antenna Ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/example/assets/Antenna Ball.png -------------------------------------------------------------------------------- /example/assets/Antenna.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/example/assets/Antenna.png -------------------------------------------------------------------------------- /example/assets/Robot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/example/assets/Robot.png -------------------------------------------------------------------------------- /example/assets/Wheel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/example/assets/Wheel.png -------------------------------------------------------------------------------- /example/assets/drumstick.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/example/assets/drumstick.wav -------------------------------------------------------------------------------- /example/assets/robot.g3db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/example/assets/robot.g3db -------------------------------------------------------------------------------- /example/assets/test-skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/example/assets/test-skin.png -------------------------------------------------------------------------------- /example/assets/test.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/example/assets/test.mp3 -------------------------------------------------------------------------------- /example/assets/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/example/assets/test.png -------------------------------------------------------------------------------- /example/assets/test.txt: -------------------------------------------------------------------------------- 1 | Hello? -------------------------------------------------------------------------------- /example/assets/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/example/assets/test.wav -------------------------------------------------------------------------------- /example/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | maven { url 'https://s01.oss.sonatype.org' } 5 | mavenLocal() 6 | google() 7 | gradlePluginPortal() 8 | maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } 9 | maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' } 10 | } 11 | dependencies { 12 | 13 | 14 | // This follows advice from https://blog.gradle.org/log4j-vulnerability 15 | constraints { 16 | classpath("org.apache.logging.log4j:log4j-core") { 17 | version { 18 | strictly("[2.17, 3[") 19 | prefer("2.17.0") 20 | } 21 | because("CVE-2021-44228, CVE-2021-45046, CVE-2021-45105: Log4j vulnerable to remote code execution and other critical security vulnerabilities") 22 | } 23 | } 24 | } 25 | } 26 | 27 | allprojects { 28 | apply plugin: 'eclipse' 29 | apply plugin: 'idea' 30 | } 31 | 32 | configure(subprojects) { 33 | apply plugin: 'java-library' 34 | sourceCompatibility = 1.8 35 | compileJava { 36 | options.incremental = true 37 | } 38 | dependencies { 39 | // This follows advice from https://blog.gradle.org/log4j-vulnerability 40 | constraints { 41 | implementation("org.apache.logging.log4j:log4j-core") { 42 | version { 43 | strictly("[2.17, 3[") 44 | prefer("2.17.0") 45 | } 46 | because("CVE-2021-44228, CVE-2021-45046, CVE-2021-45105: Log4j vulnerable to remote code execution and other critical security vulnerabilities") 47 | } 48 | } 49 | } 50 | 51 | } 52 | 53 | subprojects { 54 | version = '0.0.1' 55 | ext.appName = 'example' 56 | repositories { 57 | mavenCentral() 58 | maven { url 'https://s01.oss.sonatype.org' } 59 | mavenLocal() 60 | gradlePluginPortal() 61 | maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } 62 | maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' } 63 | maven { url 'https://jitpack.io' } 64 | } 65 | } 66 | 67 | eclipse.project.name = 'example' + '-parent' 68 | -------------------------------------------------------------------------------- /example/core/build.gradle: -------------------------------------------------------------------------------- 1 | [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' 2 | eclipse.project.name = appName + '-core' 3 | 4 | dependencies { 5 | api "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion" 6 | api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" 7 | api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" 8 | api "com.badlogicgames.gdx:gdx:$gdxVersion" 9 | } 10 | -------------------------------------------------------------------------------- /example/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.daemon=true 2 | org.gradle.jvmargs=-Xms512M -Xmx1G -XX:MaxMetaspaceSize=1G 3 | org.gradle.configureondemand=false 4 | 5 | gdxControllersVersion=2.2.1 6 | regExodusVersion=0.1.15 7 | gdxVersion=1.12.0 8 | 9 | clearwingVersion=3.0.3 10 | switchGdxVersion=3.0.1 11 | -------------------------------------------------------------------------------- /example/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /example/lwjgl3/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'application' 2 | 3 | sourceSets.main.resources.srcDirs += [ rootProject.file('assets').path ] 4 | mainClassName = 'com.thelogicmaster.lwjgl3.Lwjgl3Launcher' 5 | eclipse.project.name = appName + '-lwjgl3' 6 | sourceCompatibility = 1.8 7 | 8 | dependencies { 9 | implementation "com.badlogicgames.gdx-controllers:gdx-controllers-desktop:$gdxControllersVersion" 10 | implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion" 11 | implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" 12 | implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" 13 | implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" 14 | implementation project(':core') 15 | } 16 | 17 | def os = System.properties['os.name'].toLowerCase() 18 | 19 | run { 20 | workingDir = rootProject.file('assets').path 21 | setIgnoreExitValue(true) 22 | 23 | if (os.contains('mac')) { 24 | // Required to run LWJGL3 Java apps on MacOS 25 | jvmArgs += "-XstartOnFirstThread" 26 | } 27 | } 28 | 29 | jar { 30 | // sets the name of the .jar file this produces to the name of the game or app. 31 | archiveBaseName.set(appName) 32 | // the duplicatesStrategy matters starting in Gradle 7.0; this setting works. 33 | duplicatesStrategy(DuplicatesStrategy.EXCLUDE) 34 | dependsOn configurations.runtimeClasspath 35 | from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } 36 | // these "exclude" lines remove some unnecessary duplicate files in the output JAR. 37 | exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA') 38 | dependencies { 39 | exclude('META-INF/INDEX.LIST', 'META-INF/maven/**') 40 | } 41 | // setting the manifest makes the JAR runnable. 42 | manifest { 43 | attributes 'Main-Class': project.mainClassName 44 | } 45 | // this last step may help on some OSes that need extra instruction to make runnable JARs. 46 | doLast { 47 | file(archiveFile).setExecutable(true, false) 48 | } 49 | } 50 | 51 | // Equivalent to the jar task; here for compatibility with gdx-setup. 52 | task dist(dependsOn: [jar]) { 53 | } 54 | -------------------------------------------------------------------------------- /example/lwjgl3/src/main/java/com/thelogicmaster/lwjgl3/Lwjgl3Launcher.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.lwjgl3; 2 | 3 | import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; 4 | import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; 5 | import com.thelogicmaster.example.Example; 6 | 7 | /** Launches the desktop (LWJGL3) application. */ 8 | public class Lwjgl3Launcher { 9 | public static void main(String[] args) { 10 | createApplication(); 11 | } 12 | 13 | private static Lwjgl3Application createApplication() { 14 | return new Lwjgl3Application(new Example(), getDefaultConfiguration()); 15 | } 16 | 17 | private static Lwjgl3ApplicationConfiguration getDefaultConfiguration() { 18 | Lwjgl3ApplicationConfiguration configuration = new Lwjgl3ApplicationConfiguration(); 19 | configuration.setTitle("example"); 20 | configuration.useVsync(true); 21 | //// Limits FPS to the refresh rate of the currently active monitor. 22 | configuration.setForegroundFPS(Lwjgl3ApplicationConfiguration.getDisplayMode().refreshRate); 23 | //// If you remove the above line and set Vsync to false, you can get unlimited FPS, which can be 24 | //// useful for testing performance, but can also be very stressful to some hardware. 25 | //// You may also need to configure GPU drivers to fully disable Vsync; this can cause screen tearing. 26 | configuration.setWindowedMode(1280, 720); 27 | configuration.setResizable(false); 28 | return configuration; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /example/settings.gradle: -------------------------------------------------------------------------------- 1 | include 'lwjgl3', 'core', 'switch' 2 | -------------------------------------------------------------------------------- /example/switch/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/example/switch/icon.jpg -------------------------------------------------------------------------------- /example/switch/src/main/java/com/thelogicmaster/example/SwitchLauncher.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.example; 2 | 3 | import com.thelogicmaster.switchgdx.SwitchApplication; 4 | 5 | public class SwitchLauncher { 6 | 7 | public static void main (String[] arg) { 8 | new SwitchApplication(new Example()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /example/switch/switch.json: -------------------------------------------------------------------------------- 1 | { 2 | "mainClass": "com.thelogicmaster.example.SwitchLauncher", 3 | "reflective": [], 4 | "useStackTraces": true, 5 | "useLineNumbers": true, 6 | "useValueChecks": true, 7 | "useStackCookies": true 8 | } 9 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.daemon=true 2 | org.gradle.jvmargs=-Xms512M -Xmx1G -XX:MaxMetaspaceSize=1G 3 | org.gradle.configureondemand=false 4 | 5 | gdxControllersVersion=2.2.1 6 | regExodusVersion=0.1.15 7 | gdxVersion=1.13.1 8 | 9 | clearwingVersion=3.1.2 10 | switchGdxVersion=3.0.2 11 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /media/Agile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/Agile.png -------------------------------------------------------------------------------- /media/ArithmeticRun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/ArithmeticRun.png -------------------------------------------------------------------------------- /media/Bomberman.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/Bomberman.png -------------------------------------------------------------------------------- /media/BurgerParty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/BurgerParty.png -------------------------------------------------------------------------------- /media/DarkMatter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/DarkMatter.png -------------------------------------------------------------------------------- /media/JewelThief.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/JewelThief.png -------------------------------------------------------------------------------- /media/Klooni1010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/Klooni1010.png -------------------------------------------------------------------------------- /media/Mindustry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/Mindustry.png -------------------------------------------------------------------------------- /media/MysticGarden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/MysticGarden.png -------------------------------------------------------------------------------- /media/PepperAndCarrot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/PepperAndCarrot.png -------------------------------------------------------------------------------- /media/PixelWheels.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/PixelWheels.png -------------------------------------------------------------------------------- /media/PlanetGenerator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/PlanetGenerator.png -------------------------------------------------------------------------------- /media/RectBall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/RectBall.png -------------------------------------------------------------------------------- /media/ShatteredPixel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/ShatteredPixel.png -------------------------------------------------------------------------------- /media/SquareAstray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/SquareAstray.png -------------------------------------------------------------------------------- /media/Tangler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/Tangler.png -------------------------------------------------------------------------------- /media/TriPeaks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/TriPeaks.png -------------------------------------------------------------------------------- /media/Unlucky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/Unlucky.png -------------------------------------------------------------------------------- /media/Xodus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/Xodus.png -------------------------------------------------------------------------------- /media/logo_256.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/logo_256.jpg -------------------------------------------------------------------------------- /media/logo_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/logo_256.png -------------------------------------------------------------------------------- /media/logo_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/logo_512.png -------------------------------------------------------------------------------- /media/nomoore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/media/nomoore.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include 'switch-gdx' 2 | 3 | if (new File("$rootDir/tests/libs").exists()) { 4 | include 'tests' 5 | } 6 | -------------------------------------------------------------------------------- /switch-gdx/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .idea 3 | build 4 | dist 5 | out 6 | -------------------------------------------------------------------------------- /switch-gdx/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java-library' 3 | } 4 | 5 | group = 'com.thelogicmaster' 6 | 7 | apply plugin: 'maven-publish' 8 | 9 | sourceCompatibility = 1.8 10 | targetCompatibility = 1.8 11 | 12 | java { 13 | withSourcesJar() 14 | withJavadocJar() 15 | } 16 | 17 | publishing { 18 | publications { 19 | maven(MavenPublication) { 20 | groupId project.group 21 | artifactId project.name 22 | version project.version 23 | from components.java 24 | } 25 | } 26 | } 27 | 28 | repositories { 29 | maven { url 'https://jitpack.io' } 30 | mavenCentral() 31 | } 32 | 33 | dependencies { 34 | implementation "com.badlogicgames.gdx:gdx:$gdxVersion" 35 | implementation "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion" 36 | implementation "com.github.tommyettinger:RegExodus:$regExodusVersion" 37 | implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" 38 | implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion" 39 | } 40 | 41 | sourceSets { 42 | main { 43 | java { 44 | srcDirs 'src' 45 | } 46 | resources { 47 | srcDirs 'res' 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Collision/b2TimeOfImpact.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #ifndef B2_TIME_OF_IMPACT_H 20 | #define B2_TIME_OF_IMPACT_H 21 | 22 | #include 23 | #include 24 | 25 | /// Input parameters for b2TimeOfImpact 26 | struct b2TOIInput 27 | { 28 | b2DistanceProxy proxyA; 29 | b2DistanceProxy proxyB; 30 | b2Sweep sweepA; 31 | b2Sweep sweepB; 32 | float32 tMax; // defines sweep interval [0, tMax] 33 | }; 34 | 35 | // Output parameters for b2TimeOfImpact. 36 | struct b2TOIOutput 37 | { 38 | enum State 39 | { 40 | e_unknown, 41 | e_failed, 42 | e_overlapped, 43 | e_touching, 44 | e_separated 45 | }; 46 | 47 | State state; 48 | float32 t; 49 | }; 50 | 51 | /// Compute the upper bound on time before two shapes penetrate. Time is represented as 52 | /// a fraction between [0,tMax]. This uses a swept separating axis and may miss some intermediate, 53 | /// non-tunneling collision. If you change the time interval, you should call this function 54 | /// again. 55 | /// Note: use b2Distance to compute the contact point and normal at the time of impact. 56 | void b2TimeOfImpact(b2TOIOutput* output, const b2TOIInput* input); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Common/b2Draw.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Erin Catto http://box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #include 20 | 21 | b2Draw::b2Draw() 22 | { 23 | m_drawFlags = 0; 24 | } 25 | 26 | void b2Draw::SetFlags(uint32 flags) 27 | { 28 | m_drawFlags = flags; 29 | } 30 | 31 | uint32 b2Draw::GetFlags() const 32 | { 33 | return m_drawFlags; 34 | } 35 | 36 | void b2Draw::AppendFlags(uint32 flags) 37 | { 38 | m_drawFlags |= flags; 39 | } 40 | 41 | void b2Draw::ClearFlags(uint32 flags) 42 | { 43 | m_drawFlags &= ~flags; 44 | } 45 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Common/b2Settings.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | b2Version b2_version = {2, 3, 1}; 25 | 26 | // Memory allocators. Modify these to use your own allocator. 27 | void* b2Alloc(int32 size) 28 | { 29 | return malloc(size); 30 | } 31 | 32 | void b2Free(void* mem) 33 | { 34 | free(mem); 35 | } 36 | 37 | // You can modify this to use your logging facility. 38 | void b2Log(const char* string, ...) 39 | { 40 | va_list args; 41 | va_start(args, string); 42 | vprintf(string, args); 43 | va_end(args); 44 | } 45 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Common/b2StackAllocator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #ifndef B2_STACK_ALLOCATOR_H 20 | #define B2_STACK_ALLOCATOR_H 21 | 22 | #include 23 | 24 | const int32 b2_stackSize = 100 * 1024; // 100k 25 | const int32 b2_maxStackEntries = 32; 26 | 27 | struct b2StackEntry 28 | { 29 | char* data; 30 | int32 size; 31 | bool usedMalloc; 32 | }; 33 | 34 | // This is a stack allocator used for fast per step allocations. 35 | // You must nest allocate/free pairs. The code will assert 36 | // if you try to interleave multiple allocate/free pairs. 37 | class b2StackAllocator 38 | { 39 | public: 40 | b2StackAllocator(); 41 | ~b2StackAllocator(); 42 | 43 | void* Allocate(int32 size); 44 | void Free(void* p); 45 | 46 | int32 GetMaxAllocation() const; 47 | 48 | private: 49 | 50 | char m_data[b2_stackSize]; 51 | int32 m_index; 52 | 53 | int32 m_allocation; 54 | int32 m_maxAllocation; 55 | 56 | b2StackEntry m_entries[b2_maxStackEntries]; 57 | int32 m_entryCount; 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Common/b2Timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Erin Catto http://box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #ifndef B2_TIMER_H 20 | #define B2_TIMER_H 21 | 22 | #include 23 | 24 | /// Timer for profiling. This has platform specific code and may 25 | /// not work on every platform. 26 | class b2Timer 27 | { 28 | public: 29 | 30 | /// Constructor 31 | b2Timer(); 32 | 33 | /// Reset the timer. 34 | void Reset(); 35 | 36 | /// Get the time since construction or the last reset. 37 | float32 GetMilliseconds() const; 38 | 39 | private: 40 | 41 | #if defined(_WIN32) 42 | float64 m_start; 43 | static float64 s_invFrequency; 44 | #elif defined(__linux__) || defined (__APPLE__) 45 | unsigned long m_start_sec; 46 | unsigned long m_start_usec; 47 | #endif 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #ifndef B2_CHAIN_AND_CIRCLE_CONTACT_H 20 | #define B2_CHAIN_AND_CIRCLE_CONTACT_H 21 | 22 | #include 23 | 24 | class b2BlockAllocator; 25 | 26 | class b2ChainAndCircleContact : public b2Contact 27 | { 28 | public: 29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA, 30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); 31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); 32 | 33 | b2ChainAndCircleContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB); 34 | ~b2ChainAndCircleContact() {} 35 | 36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #ifndef B2_CHAIN_AND_POLYGON_CONTACT_H 20 | #define B2_CHAIN_AND_POLYGON_CONTACT_H 21 | 22 | #include 23 | 24 | class b2BlockAllocator; 25 | 26 | class b2ChainAndPolygonContact : public b2Contact 27 | { 28 | public: 29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA, 30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); 31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); 32 | 33 | b2ChainAndPolygonContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB); 34 | ~b2ChainAndPolygonContact() {} 35 | 36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Dynamics/Contacts/b2CircleContact.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #ifndef B2_CIRCLE_CONTACT_H 20 | #define B2_CIRCLE_CONTACT_H 21 | 22 | #include 23 | 24 | class b2BlockAllocator; 25 | 26 | class b2CircleContact : public b2Contact 27 | { 28 | public: 29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA, 30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); 31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); 32 | 33 | b2CircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB); 34 | ~b2CircleContact() {} 35 | 36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #ifndef B2_EDGE_AND_CIRCLE_CONTACT_H 20 | #define B2_EDGE_AND_CIRCLE_CONTACT_H 21 | 22 | #include 23 | 24 | class b2BlockAllocator; 25 | 26 | class b2EdgeAndCircleContact : public b2Contact 27 | { 28 | public: 29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA, 30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); 31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); 32 | 33 | b2EdgeAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB); 34 | ~b2EdgeAndCircleContact() {} 35 | 36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #ifndef B2_EDGE_AND_POLYGON_CONTACT_H 20 | #define B2_EDGE_AND_POLYGON_CONTACT_H 21 | 22 | #include 23 | 24 | class b2BlockAllocator; 25 | 26 | class b2EdgeAndPolygonContact : public b2Contact 27 | { 28 | public: 29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA, 30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); 31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); 32 | 33 | b2EdgeAndPolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB); 34 | ~b2EdgeAndPolygonContact() {} 35 | 36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #ifndef B2_POLYGON_AND_CIRCLE_CONTACT_H 20 | #define B2_POLYGON_AND_CIRCLE_CONTACT_H 21 | 22 | #include 23 | 24 | class b2BlockAllocator; 25 | 26 | class b2PolygonAndCircleContact : public b2Contact 27 | { 28 | public: 29 | static b2Contact* Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); 30 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); 31 | 32 | b2PolygonAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB); 33 | ~b2PolygonAndCircleContact() {} 34 | 35 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Dynamics/Contacts/b2PolygonContact.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #ifndef B2_POLYGON_CONTACT_H 20 | #define B2_POLYGON_CONTACT_H 21 | 22 | #include 23 | 24 | class b2BlockAllocator; 25 | 26 | class b2PolygonContact : public b2Contact 27 | { 28 | public: 29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA, 30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator); 31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); 32 | 33 | b2PolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB); 34 | ~b2PolygonContact() {} 35 | 36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Dynamics/b2ContactManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #ifndef B2_CONTACT_MANAGER_H 20 | #define B2_CONTACT_MANAGER_H 21 | 22 | #include 23 | 24 | class b2Contact; 25 | class b2ContactFilter; 26 | class b2ContactListener; 27 | class b2BlockAllocator; 28 | 29 | // Delegate of b2World. 30 | class b2ContactManager 31 | { 32 | public: 33 | b2ContactManager(); 34 | 35 | // Broad-phase callback. 36 | void AddPair(void* proxyUserDataA, void* proxyUserDataB); 37 | 38 | void FindNewContacts(); 39 | 40 | void Destroy(b2Contact* c); 41 | 42 | void Collide(); 43 | 44 | b2BroadPhase m_broadPhase; 45 | b2Contact* m_contactList; 46 | int32 m_contactCount; 47 | b2ContactFilter* m_contactFilter; 48 | b2ContactListener* m_contactListener; 49 | b2BlockAllocator* m_allocator; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Dynamics/b2TimeStep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2011 Erin Catto http://www.box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #ifndef B2_TIME_STEP_H 20 | #define B2_TIME_STEP_H 21 | 22 | #include 23 | 24 | /// Profiling data. Times are in milliseconds. 25 | struct b2Profile 26 | { 27 | float32 step; 28 | float32 collide; 29 | float32 solve; 30 | float32 solveInit; 31 | float32 solveVelocity; 32 | float32 solvePosition; 33 | float32 broadphase; 34 | float32 solveTOI; 35 | }; 36 | 37 | /// This is an internal structure. 38 | struct b2TimeStep 39 | { 40 | float32 dt; // time step 41 | float32 inv_dt; // inverse time step (0 if dt == 0). 42 | float32 dtRatio; // dt * inv_dt0 43 | int32 velocityIterations; 44 | int32 positionIterations; 45 | bool warmStarting; 46 | }; 47 | 48 | /// This is an internal structure. 49 | struct b2Position 50 | { 51 | b2Vec2 c; 52 | float32 a; 53 | }; 54 | 55 | /// This is an internal structure. 56 | struct b2Velocity 57 | { 58 | b2Vec2 v; 59 | float32 w; 60 | }; 61 | 62 | /// Solver Data 63 | struct b2SolverData 64 | { 65 | b2TimeStep step; 66 | b2Position* positions; 67 | b2Velocity* velocities; 68 | }; 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /switch-gdx/res/Box2D/Dynamics/b2WorldCallbacks.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 3 | * 4 | * This software is provided 'as-is', without any express or implied 5 | * warranty. In no event will the authors be held liable for any damages 6 | * arising from the use of this software. 7 | * Permission is granted to anyone to use this software for any purpose, 8 | * including commercial applications, and to alter it and redistribute it 9 | * freely, subject to the following restrictions: 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software 12 | * in a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 2. Altered source versions must be plainly marked as such, and must not be 15 | * misrepresented as being the original software. 16 | * 3. This notice may not be removed or altered from any source distribution. 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | // Return true if contact calculations should be performed between these two shapes. 23 | // If you implement your own collision filter you may want to build from this implementation. 24 | bool b2ContactFilter::ShouldCollide(b2Fixture* fixtureA, b2Fixture* fixtureB) 25 | { 26 | const b2Filter& filterA = fixtureA->GetFilterData(); 27 | const b2Filter& filterB = fixtureB->GetFilterData(); 28 | 29 | if (filterA.groupIndex == filterB.groupIndex && filterA.groupIndex != 0) 30 | { 31 | return filterA.groupIndex > 0; 32 | } 33 | 34 | bool collide = (filterA.maskBits & filterB.categoryBits) != 0 && (filterA.categoryBits & filterB.maskBits) != 0; 35 | return collide; 36 | } 37 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/Platform.cpp: -------------------------------------------------------------------------------- 1 | #include "Clearwing.h" 2 | 3 | #ifdef __SWITCH__ 4 | #include 5 | #endif 6 | 7 | const char *getOSLanguage() { 8 | #ifdef __SWITCH__ 9 | return "en-US"; 10 | // u64 languageCode; 11 | // setGetSystemLanguage(&languageCode); 12 | // return (char *)&languageCode; 13 | #else 14 | return "en-US"; 15 | #endif 16 | } 17 | 18 | const char *getSystemProperty(const char *key) { 19 | std::string name(key); 20 | #if defined(__SWITCH__) 21 | if (name == "os.name") 22 | return "horizon"; 23 | if (name == "os.arch") 24 | return "aarch64"; 25 | #elif defined(__WINRT__) 26 | if (name == "os.name") 27 | return "uwp"; 28 | if (name == "os.arch") 29 | return "x86_64"; 30 | #else 31 | if (name == "os.name") 32 | return "unknown"; 33 | if (name == "os.arch") 34 | return "x86_64"; 35 | #endif 36 | if (name == "line.separator") 37 | return "\n"; 38 | if (name == "java.io.tmpdir") 39 | return "temp"; 40 | if (name == "user.home") 41 | return "home"; 42 | if (name == "user.name") 43 | return "user"; 44 | return nullptr; 45 | } 46 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/box2d/CircleShape_native.cpp: -------------------------------------------------------------------------------- 1 | #include "Clearwing.h" 2 | #include "java/nio/Buffer.h" 3 | #include 4 | 5 | 6 | #include 7 | 8 | jlong M_com_badlogic_gdx_physics_box2d_CircleShape_newCircleShape_R_long(jcontext ctx, jobject self) { 9 | 10 | return (jlong)(new b2CircleShape( )); 11 | } 12 | 13 | void M_com_badlogic_gdx_physics_box2d_CircleShape_jniGetPosition_long_Array1_float(jcontext ctx, jobject self, jlong addr, jobject position_object) { 14 | auto position = (jfloat *)((Array *)position_object)->data; 15 | 16 | b2CircleShape* circle = (b2CircleShape*)addr; 17 | position[0] = circle->m_p.x; 18 | position[1] = circle->m_p.y; 19 | } 20 | 21 | void M_com_badlogic_gdx_physics_box2d_CircleShape_jniSetPosition_long_float_float(jcontext ctx, jobject self, jlong addr, jfloat positionX, jfloat positionY) { 22 | 23 | b2CircleShape* circle = (b2CircleShape*)addr; 24 | circle->m_p.x = positionX; 25 | circle->m_p.y = positionY; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/box2d/ContactImpulse_native.cpp: -------------------------------------------------------------------------------- 1 | #include "Clearwing.h" 2 | #include "java/nio/Buffer.h" 3 | #include 4 | 5 | 6 | #include 7 | 8 | void M_com_badlogic_gdx_physics_box2d_ContactImpulse_jniGetNormalImpulses_long_Array1_float(jcontext ctx, jobject self, jlong addr, jobject values_object) { 9 | auto values = (jfloat *)((Array *)values_object)->data; 10 | 11 | b2ContactImpulse* contactImpulse = (b2ContactImpulse*)addr; 12 | values[0] = contactImpulse->normalImpulses[0]; 13 | values[1] = contactImpulse->normalImpulses[1]; 14 | } 15 | 16 | void M_com_badlogic_gdx_physics_box2d_ContactImpulse_jniGetTangentImpulses_long_Array1_float(jcontext ctx, jobject self, jlong addr, jobject values_object) { 17 | auto values = (jfloat *)((Array *)values_object)->data; 18 | 19 | b2ContactImpulse* contactImpulse = (b2ContactImpulse*)addr; 20 | values[0] = contactImpulse->tangentImpulses[0]; 21 | values[1] = contactImpulse->tangentImpulses[1]; 22 | } 23 | 24 | jint M_com_badlogic_gdx_physics_box2d_ContactImpulse_jniGetCount_long_R_int(jcontext ctx, jobject self, jlong addr) { 25 | 26 | b2ContactImpulse* contactImpulse = (b2ContactImpulse*)addr; 27 | return contactImpulse->count; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/box2d/FrictionJoint_native.cpp: -------------------------------------------------------------------------------- 1 | #include "Clearwing.h" 2 | #include "java/nio/Buffer.h" 3 | #include 4 | 5 | 6 | #include 7 | 8 | void M_com_badlogic_gdx_physics_box2d_joints_FrictionJoint_jniGetLocalAnchorA_long_Array1_float(jcontext ctx, jobject self, jlong addr, jobject anchor_object) { 9 | auto anchor = (jfloat *)((Array *)anchor_object)->data; 10 | 11 | b2FrictionJoint* joint = (b2FrictionJoint*)addr; 12 | anchor[0] = joint->GetLocalAnchorA().x; 13 | anchor[1] = joint->GetLocalAnchorA().y; 14 | } 15 | 16 | void M_com_badlogic_gdx_physics_box2d_joints_FrictionJoint_jniGetLocalAnchorB_long_Array1_float(jcontext ctx, jobject self, jlong addr, jobject anchor_object) { 17 | auto anchor = (jfloat *)((Array *)anchor_object)->data; 18 | 19 | b2FrictionJoint* joint = (b2FrictionJoint*)addr; 20 | anchor[0] = joint->GetLocalAnchorB().x; 21 | anchor[1] = joint->GetLocalAnchorB().y; 22 | } 23 | 24 | void M_com_badlogic_gdx_physics_box2d_joints_FrictionJoint_jniSetMaxForce_long_float(jcontext ctx, jobject self, jlong addr, jfloat force) { 25 | 26 | b2FrictionJoint* joint = (b2FrictionJoint*)addr; 27 | joint->SetMaxForce( force ); 28 | } 29 | 30 | jfloat M_com_badlogic_gdx_physics_box2d_joints_FrictionJoint_jniGetMaxForce_long_R_float(jcontext ctx, jobject self, jlong addr) { 31 | 32 | b2FrictionJoint* joint = (b2FrictionJoint*)addr; 33 | return joint->GetMaxForce(); 34 | } 35 | 36 | void M_com_badlogic_gdx_physics_box2d_joints_FrictionJoint_jniSetMaxTorque_long_float(jcontext ctx, jobject self, jlong addr, jfloat torque) { 37 | 38 | b2FrictionJoint* joint = (b2FrictionJoint*)addr; 39 | joint->SetMaxTorque( torque ); 40 | } 41 | 42 | jfloat M_com_badlogic_gdx_physics_box2d_joints_FrictionJoint_jniGetMaxTorque_long_R_float(jcontext ctx, jobject self, jlong addr) { 43 | 44 | b2FrictionJoint* joint = (b2FrictionJoint*)addr; 45 | return joint->GetMaxTorque(); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/box2d/GearJoint_native.cpp: -------------------------------------------------------------------------------- 1 | #include "Clearwing.h" 2 | #include "java/nio/Buffer.h" 3 | #include 4 | 5 | 6 | #include 7 | 8 | jlong M_com_badlogic_gdx_physics_box2d_joints_GearJoint_jniGetJoint1_long_R_long(jcontext ctx, jobject self, jlong addr) { 9 | 10 | b2GearJoint* joint = (b2GearJoint*)addr; 11 | b2Joint* joint1 = joint->GetJoint1(); 12 | return (jlong)joint1; 13 | } 14 | 15 | jlong M_com_badlogic_gdx_physics_box2d_joints_GearJoint_jniGetJoint2_long_R_long(jcontext ctx, jobject self, jlong addr) { 16 | 17 | b2GearJoint* joint = (b2GearJoint*)addr; 18 | b2Joint* joint2 = joint->GetJoint2(); 19 | return (jlong)joint2; 20 | } 21 | 22 | void M_com_badlogic_gdx_physics_box2d_joints_GearJoint_jniSetRatio_long_float(jcontext ctx, jobject self, jlong addr, jfloat ratio) { 23 | 24 | b2GearJoint* joint = (b2GearJoint*)addr; 25 | joint->SetRatio( ratio ); 26 | } 27 | 28 | jfloat M_com_badlogic_gdx_physics_box2d_joints_GearJoint_jniGetRatio_long_R_float(jcontext ctx, jobject self, jlong addr) { 29 | 30 | b2GearJoint* joint = (b2GearJoint*)addr; 31 | return joint->GetRatio(); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/box2d/Manifold_native.cpp: -------------------------------------------------------------------------------- 1 | #include "Clearwing.h" 2 | #include "java/nio/Buffer.h" 3 | #include 4 | 5 | 6 | #include 7 | 8 | jint M_com_badlogic_gdx_physics_box2d_Manifold_jniGetType_long_R_int(jcontext ctx, jobject self, jlong addr) { 9 | 10 | b2Manifold* manifold = (b2Manifold*)addr; 11 | return manifold->type; 12 | } 13 | 14 | jint M_com_badlogic_gdx_physics_box2d_Manifold_jniGetPointCount_long_R_int(jcontext ctx, jobject self, jlong addr) { 15 | 16 | b2Manifold* manifold = (b2Manifold*)addr; 17 | return manifold->pointCount; 18 | } 19 | 20 | void M_com_badlogic_gdx_physics_box2d_Manifold_jniGetLocalNormal_long_Array1_float(jcontext ctx, jobject self, jlong addr, jobject values_object) { 21 | auto values = (jfloat *)((Array *)values_object)->data; 22 | 23 | b2Manifold* manifold = (b2Manifold*)addr; 24 | values[0] = manifold->localNormal.x; 25 | values[1] = manifold->localNormal.y; 26 | } 27 | 28 | void M_com_badlogic_gdx_physics_box2d_Manifold_jniGetLocalPoint_long_Array1_float(jcontext ctx, jobject self, jlong addr, jobject values_object) { 29 | auto values = (jfloat *)((Array *)values_object)->data; 30 | 31 | b2Manifold* manifold = (b2Manifold*)addr; 32 | values[0] = manifold->localPoint.x; 33 | values[1] = manifold->localPoint.y; 34 | } 35 | 36 | jint M_com_badlogic_gdx_physics_box2d_Manifold_jniGetPoint_long_Array1_float_int_R_int(jcontext ctx, jobject self, jlong addr, jobject values_object, jint idx) { 37 | auto values = (jfloat *)((Array *)values_object)->data; 38 | 39 | b2Manifold* manifold = (b2Manifold*)addr; 40 | 41 | values[0] = manifold->points[idx].localPoint.x; 42 | values[1] = manifold->points[idx].localPoint.y; 43 | values[2] = manifold->points[idx].normalImpulse; 44 | values[3] = manifold->points[idx].tangentImpulse; 45 | 46 | return (jint)manifold->points[idx].id.key; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/box2d/PulleyJoint_native.cpp: -------------------------------------------------------------------------------- 1 | #include "Clearwing.h" 2 | #include "java/nio/Buffer.h" 3 | #include 4 | 5 | 6 | #include 7 | 8 | void M_com_badlogic_gdx_physics_box2d_joints_PulleyJoint_jniGetGroundAnchorA_long_Array1_float(jcontext ctx, jobject self, jlong addr, jobject anchor_object) { 9 | auto anchor = (jfloat *)((Array *)anchor_object)->data; 10 | 11 | b2PulleyJoint* joint = (b2PulleyJoint*)addr; 12 | anchor[0] = joint->GetGroundAnchorA().x; 13 | anchor[1] = joint->GetGroundAnchorA().y; 14 | } 15 | 16 | void M_com_badlogic_gdx_physics_box2d_joints_PulleyJoint_jniGetGroundAnchorB_long_Array1_float(jcontext ctx, jobject self, jlong addr, jobject anchor_object) { 17 | auto anchor = (jfloat *)((Array *)anchor_object)->data; 18 | 19 | b2PulleyJoint* joint = (b2PulleyJoint*)addr; 20 | anchor[0] = joint->GetGroundAnchorB().x; 21 | anchor[1] = joint->GetGroundAnchorB().y; 22 | } 23 | 24 | jfloat M_com_badlogic_gdx_physics_box2d_joints_PulleyJoint_jniGetLength1_long_R_float(jcontext ctx, jobject self, jlong addr) { 25 | 26 | b2PulleyJoint* joint = (b2PulleyJoint*)addr; 27 | return joint->GetLengthA(); 28 | } 29 | 30 | jfloat M_com_badlogic_gdx_physics_box2d_joints_PulleyJoint_jniGetLength2_long_R_float(jcontext ctx, jobject self, jlong addr) { 31 | 32 | b2PulleyJoint* joint = (b2PulleyJoint*)addr; 33 | return joint->GetLengthB(); 34 | } 35 | 36 | jfloat M_com_badlogic_gdx_physics_box2d_joints_PulleyJoint_jniGetRatio_long_R_float(jcontext ctx, jobject self, jlong addr) { 37 | 38 | b2PulleyJoint* joint = (b2PulleyJoint*)addr; 39 | return joint->GetRatio(); 40 | } 41 | 42 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/box2d/RopeJoint_native.cpp: -------------------------------------------------------------------------------- 1 | #include "Clearwing.h" 2 | #include "java/nio/Buffer.h" 3 | #include 4 | 5 | 6 | #include 7 | 8 | void M_com_badlogic_gdx_physics_box2d_joints_RopeJoint_jniGetLocalAnchorA_long_Array1_float(jcontext ctx, jobject self, jlong addr, jobject anchor_object) { 9 | auto anchor = (jfloat *)((Array *)anchor_object)->data; 10 | 11 | b2RopeJoint* joint = (b2RopeJoint*)addr; 12 | anchor[0] = joint->GetLocalAnchorA().x; 13 | anchor[1] = joint->GetLocalAnchorA().y; 14 | } 15 | 16 | void M_com_badlogic_gdx_physics_box2d_joints_RopeJoint_jniGetLocalAnchorB_long_Array1_float(jcontext ctx, jobject self, jlong addr, jobject anchor_object) { 17 | auto anchor = (jfloat *)((Array *)anchor_object)->data; 18 | 19 | b2RopeJoint* joint = (b2RopeJoint*)addr; 20 | anchor[0] = joint->GetLocalAnchorB().x; 21 | anchor[1] = joint->GetLocalAnchorB().y; 22 | } 23 | 24 | jfloat M_com_badlogic_gdx_physics_box2d_joints_RopeJoint_jniGetMaxLength_long_R_float(jcontext ctx, jobject self, jlong addr) { 25 | 26 | b2RopeJoint* rope = (b2RopeJoint*)addr; 27 | return rope->GetMaxLength(); 28 | } 29 | 30 | void M_com_badlogic_gdx_physics_box2d_joints_RopeJoint_jniSetMaxLength_long_float(jcontext ctx, jobject self, jlong addr, jfloat length) { 31 | 32 | b2RopeJoint* rope = (b2RopeJoint*)addr; 33 | rope->SetMaxLength(length); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/box2d/Shape_native.cpp: -------------------------------------------------------------------------------- 1 | #include "Clearwing.h" 2 | #include "java/nio/Buffer.h" 3 | #include 4 | 5 | 6 | #include 7 | 8 | jfloat M_com_badlogic_gdx_physics_box2d_Shape_jniGetRadius_long_R_float(jcontext ctx, jobject self, jlong addr) { 9 | 10 | b2Shape* shape = (b2Shape*)addr; 11 | return shape->m_radius; 12 | } 13 | 14 | void M_com_badlogic_gdx_physics_box2d_Shape_jniSetRadius_long_float(jcontext ctx, jobject self, jlong addr, jfloat radius) { 15 | 16 | b2Shape* shape = (b2Shape*)addr; 17 | shape->m_radius = radius; 18 | } 19 | 20 | void M_com_badlogic_gdx_physics_box2d_Shape_jniDispose_long(jcontext ctx, jobject self, jlong addr) { 21 | 22 | b2Shape* shape = (b2Shape*)addr; 23 | delete shape; 24 | } 25 | 26 | jint SM_com_badlogic_gdx_physics_box2d_Shape_jniGetType_long_R_int(jcontext ctx, jlong addr) { 27 | 28 | b2Shape* shape = (b2Shape*)addr; 29 | switch(shape->m_type) { 30 | case b2Shape::e_circle: return 0; 31 | case b2Shape::e_edge: return 1; 32 | case b2Shape::e_polygon: return 2; 33 | case b2Shape::e_chain: return 3; 34 | default: return -1; 35 | } 36 | } 37 | 38 | jint M_com_badlogic_gdx_physics_box2d_Shape_jniGetChildCount_long_R_int(jcontext ctx, jobject self, jlong addr) { 39 | 40 | b2Shape* shape = (b2Shape*)addr; 41 | return shape->GetChildCount(); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/box2d/WeldJoint_native.cpp: -------------------------------------------------------------------------------- 1 | #include "Clearwing.h" 2 | #include "java/nio/Buffer.h" 3 | #include 4 | 5 | 6 | #include 7 | 8 | void M_com_badlogic_gdx_physics_box2d_joints_WeldJoint_jniGetLocalAnchorA_long_Array1_float(jcontext ctx, jobject self, jlong addr, jobject anchor_object) { 9 | auto anchor = (jfloat *)((Array *)anchor_object)->data; 10 | 11 | b2WeldJoint* joint = (b2WeldJoint*)addr; 12 | anchor[0] = joint->GetLocalAnchorA().x; 13 | anchor[1] = joint->GetLocalAnchorA().y; 14 | } 15 | 16 | void M_com_badlogic_gdx_physics_box2d_joints_WeldJoint_jniGetLocalAnchorB_long_Array1_float(jcontext ctx, jobject self, jlong addr, jobject anchor_object) { 17 | auto anchor = (jfloat *)((Array *)anchor_object)->data; 18 | 19 | b2WeldJoint* joint = (b2WeldJoint*)addr; 20 | anchor[0] = joint->GetLocalAnchorB().x; 21 | anchor[1] = joint->GetLocalAnchorB().y; 22 | } 23 | 24 | jfloat M_com_badlogic_gdx_physics_box2d_joints_WeldJoint_jniGetReferenceAngle_long_R_float(jcontext ctx, jobject self, jlong addr) { 25 | 26 | b2WeldJoint* joint = (b2WeldJoint*)addr; 27 | return joint->GetReferenceAngle(); 28 | } 29 | 30 | jfloat M_com_badlogic_gdx_physics_box2d_joints_WeldJoint_jniGetFrequency_long_R_float(jcontext ctx, jobject self, jlong addr) { 31 | 32 | b2WeldJoint* joint = (b2WeldJoint*)addr; 33 | return joint->GetFrequency(); 34 | } 35 | 36 | void M_com_badlogic_gdx_physics_box2d_joints_WeldJoint_jniSetFrequency_long_float(jcontext ctx, jobject self, jlong addr, jfloat hz) { 37 | 38 | b2WeldJoint* joint = (b2WeldJoint*)addr; 39 | joint->SetFrequency(hz); 40 | } 41 | 42 | jfloat M_com_badlogic_gdx_physics_box2d_joints_WeldJoint_jniGetDampingRatio_long_R_float(jcontext ctx, jobject self, jlong addr) { 43 | 44 | b2WeldJoint* joint = (b2WeldJoint*)addr; 45 | return joint->GetDampingRatio(); 46 | } 47 | 48 | void M_com_badlogic_gdx_physics_box2d_joints_WeldJoint_jniSetDampingRatio_long_float(jcontext ctx, jobject self, jlong addr, jfloat ratio) { 49 | 50 | b2WeldJoint* joint = (b2WeldJoint*)addr; 51 | joint->SetDampingRatio(ratio); 52 | } 53 | 54 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp: -------------------------------------------------------------------------------- 1 | 2 | //Bullet Continuous Collision Detection and Physics Library 3 | //Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | 6 | // 7 | // btAxisSweep3 8 | // 9 | // Copyright (c) 2006 Simon Hobbs 10 | // 11 | // This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. 12 | // 13 | // Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 16 | // 17 | // 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 18 | // 19 | // 3. This notice may not be removed or altered from any source distribution. 20 | #include "btAxisSweep3.h" 21 | 22 | 23 | btAxisSweep3::btAxisSweep3(const btVector3& worldAabbMin,const btVector3& worldAabbMax, unsigned short int maxHandles, btOverlappingPairCache* pairCache, bool disableRaycastAccelerator) 24 | :btAxisSweep3Internal(worldAabbMin,worldAabbMax,0xfffe,0xffff,maxHandles,pairCache,disableRaycastAccelerator) 25 | { 26 | // 1 handle is reserved as sentinel 27 | btAssert(maxHandles > 1 && maxHandles < 32767); 28 | 29 | } 30 | 31 | 32 | bt32BitAxisSweep3::bt32BitAxisSweep3(const btVector3& worldAabbMin,const btVector3& worldAabbMax, unsigned int maxHandles , btOverlappingPairCache* pairCache , bool disableRaycastAccelerator) 33 | :btAxisSweep3Internal(worldAabbMin,worldAabbMax,0xfffffffe,0x7fffffff,maxHandles,pairCache,disableRaycastAccelerator) 34 | { 35 | // 1 handle is reserved as sentinel 36 | btAssert(maxHandles > 1 && maxHandles < 2147483647); 37 | } 38 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btBroadphaseProxy.h" 17 | 18 | BT_NOT_EMPTY_FILE // fix warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library 19 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btCollisionAlgorithm.h" 17 | #include "btDispatcher.h" 18 | 19 | btCollisionAlgorithm::btCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci) 20 | { 21 | m_dispatcher = ci.m_dispatcher1; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/BroadphaseCollision/btDispatcher.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btDispatcher.h" 17 | 18 | btDispatcher::~btDispatcher() 19 | { 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Bullet Continuous Collision Detection and Physics Library 4 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 5 | 6 | This software is provided 'as-is', without any express or implied warranty. 7 | In no event will the authors be held liable for any damages arising from the use of this software. 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it freely, 10 | subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 13 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 14 | 3. This notice may not be removed or altered from any source distribution. 15 | */ 16 | 17 | #ifndef OVERLAPPING_PAIR_CALLBACK_H 18 | #define OVERLAPPING_PAIR_CALLBACK_H 19 | 20 | class btDispatcher; 21 | struct btBroadphasePair; 22 | 23 | ///The btOverlappingPairCallback class is an additional optional broadphase user callback for adding/removing overlapping pairs, similar interface to btOverlappingPairCache. 24 | class btOverlappingPairCallback 25 | { 26 | protected: 27 | btOverlappingPairCallback() {} 28 | 29 | public: 30 | virtual ~btOverlappingPairCallback() 31 | { 32 | 33 | } 34 | 35 | virtual btBroadphasePair* addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) = 0; 36 | 37 | virtual void* removeOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1,btDispatcher* dispatcher) = 0; 38 | 39 | virtual void removeOverlappingPairsContainingProxy(btBroadphaseProxy* proxy0,btDispatcher* dispatcher) = 0; 40 | 41 | }; 42 | 43 | #endif //OVERLAPPING_PAIR_CALLBACK_H 44 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2008 Erwin Coumans http://bulletphysics.com 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btActivatingCollisionAlgorithm.h" 17 | #include "btCollisionDispatcher.h" 18 | #include "btCollisionObject.h" 19 | 20 | btActivatingCollisionAlgorithm::btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci) 21 | :btCollisionAlgorithm(ci) 22 | //, 23 | //m_colObj0(0), 24 | //m_colObj1(0) 25 | { 26 | } 27 | btActivatingCollisionAlgorithm::btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci, const btCollisionObjectWrapper* ,const btCollisionObjectWrapper* ) 28 | :btCollisionAlgorithm(ci) 29 | //, 30 | //m_colObj0(0), 31 | //m_colObj1(0) 32 | { 33 | // if (ci.m_dispatcher1->needsCollision(colObj0,colObj1)) 34 | // { 35 | // m_colObj0 = colObj0; 36 | // m_colObj1 = colObj1; 37 | // 38 | // m_colObj0->activate(); 39 | // m_colObj1->activate(); 40 | // } 41 | } 42 | 43 | btActivatingCollisionAlgorithm::~btActivatingCollisionAlgorithm() 44 | { 45 | // m_colObj0->activate(); 46 | // m_colObj1->activate(); 47 | } 48 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2008 Erwin Coumans http://bulletphysics.com 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef __BT_ACTIVATING_COLLISION_ALGORITHM_H 17 | #define __BT_ACTIVATING_COLLISION_ALGORITHM_H 18 | 19 | #include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h" 20 | 21 | ///This class is not enabled yet (work-in-progress) to more aggressively activate objects. 22 | class btActivatingCollisionAlgorithm : public btCollisionAlgorithm 23 | { 24 | // btCollisionObject* m_colObj0; 25 | // btCollisionObject* m_colObj1; 26 | 27 | protected: 28 | 29 | btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci); 30 | 31 | btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci, const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap); 32 | 33 | public: 34 | virtual ~btActivatingCollisionAlgorithm(); 35 | 36 | }; 37 | #endif //__BT_ACTIVATING_COLLISION_ALGORITHM_H 38 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionDispatch/btBoxBoxDetector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Box-Box collision detection re-distributed under the ZLib license with permission from Russell L. Smith 3 | * Original version is from Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. 4 | * All rights reserved. Email: russ@q12.org Web: www.q12.org 5 | 6 | Bullet Continuous Collision Detection and Physics Library 7 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 8 | 9 | This software is provided 'as-is', without any express or implied warranty. 10 | In no event will the authors be held liable for any damages arising from the use of this software. 11 | Permission is granted to anyone to use this software for any purpose, 12 | including commercial applications, and to alter it and redistribute it freely, 13 | subject to the following restrictions: 14 | 15 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 16 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | */ 19 | #ifndef BT_BOX_BOX_DETECTOR_H 20 | #define BT_BOX_BOX_DETECTOR_H 21 | 22 | 23 | class btBoxShape; 24 | #include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h" 25 | 26 | 27 | /// btBoxBoxDetector wraps the ODE box-box collision detector 28 | /// re-distributed under the Zlib license with permission from Russell L. Smith 29 | struct btBoxBoxDetector : public btDiscreteCollisionDetectorInterface 30 | { 31 | const btBoxShape* m_box1; 32 | const btBoxShape* m_box2; 33 | 34 | public: 35 | 36 | btBoxBoxDetector(const btBoxShape* box1,const btBoxShape* box2); 37 | 38 | virtual ~btBoxBoxDetector() {}; 39 | 40 | virtual void getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults=false); 41 | 42 | }; 43 | 44 | #endif //BT_BOX_BOX_DETECTOR_H 45 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionDispatch/btCollisionConfiguration.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_COLLISION_CONFIGURATION 17 | #define BT_COLLISION_CONFIGURATION 18 | 19 | struct btCollisionAlgorithmCreateFunc; 20 | 21 | class btPoolAllocator; 22 | 23 | ///btCollisionConfiguration allows to configure Bullet collision detection 24 | ///stack allocator size, default collision algorithms and persistent manifold pool size 25 | ///@todo: describe the meaning 26 | class btCollisionConfiguration 27 | { 28 | 29 | public: 30 | 31 | virtual ~btCollisionConfiguration() 32 | { 33 | } 34 | 35 | ///memory pools 36 | virtual btPoolAllocator* getPersistentManifoldPool() = 0; 37 | 38 | virtual btPoolAllocator* getCollisionAlgorithmPool() = 0; 39 | 40 | 41 | virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1) =0; 42 | 43 | virtual btCollisionAlgorithmCreateFunc* getClosestPointsAlgorithmCreateFunc(int proxyType0, int proxyType1) = 0; 44 | 45 | 46 | }; 47 | 48 | #endif //BT_COLLISION_CONFIGURATION 49 | 50 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_COLLISION_CREATE_FUNC 17 | #define BT_COLLISION_CREATE_FUNC 18 | 19 | #include "LinearMath/btAlignedObjectArray.h" 20 | class btCollisionAlgorithm; 21 | class btCollisionObject; 22 | struct btCollisionObjectWrapper; 23 | struct btCollisionAlgorithmConstructionInfo; 24 | 25 | ///Used by the btCollisionDispatcher to register and create instances for btCollisionAlgorithm 26 | struct btCollisionAlgorithmCreateFunc 27 | { 28 | bool m_swapped; 29 | 30 | btCollisionAlgorithmCreateFunc() 31 | :m_swapped(false) 32 | { 33 | } 34 | virtual ~btCollisionAlgorithmCreateFunc(){}; 35 | 36 | virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& , const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap) 37 | { 38 | 39 | (void)body0Wrap; 40 | (void)body1Wrap; 41 | return 0; 42 | } 43 | }; 44 | #endif //BT_COLLISION_CREATE_FUNC 45 | 46 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_COLLISION_DISPATCHER_MT_H 17 | #define BT_COLLISION_DISPATCHER_MT_H 18 | 19 | #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" 20 | #include "LinearMath/btThreads.h" 21 | 22 | 23 | class btCollisionDispatcherMt : public btCollisionDispatcher 24 | { 25 | public: 26 | btCollisionDispatcherMt( btCollisionConfiguration* config, int grainSize = 40 ); 27 | 28 | virtual btPersistentManifold* getNewManifold( const btCollisionObject* body0, const btCollisionObject* body1 ) BT_OVERRIDE; 29 | virtual void releaseManifold( btPersistentManifold* manifold ) BT_OVERRIDE; 30 | 31 | virtual void dispatchAllCollisionPairs( btOverlappingPairCache* pairCache, const btDispatcherInfo& info, btDispatcher* dispatcher ) BT_OVERRIDE; 32 | 33 | protected: 34 | bool m_batchUpdating; 35 | int m_grainSize; 36 | }; 37 | 38 | #endif //BT_COLLISION_DISPATCHER_MT_H 39 | 40 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h: -------------------------------------------------------------------------------- 1 | #ifndef BT_COLLISION_OBJECT_WRAPPER_H 2 | #define BT_COLLISION_OBJECT_WRAPPER_H 3 | 4 | ///btCollisionObjectWrapperis an internal data structure. 5 | ///Most users can ignore this and use btCollisionObject and btCollisionShape instead 6 | class btCollisionShape; 7 | class btCollisionObject; 8 | class btTransform; 9 | #include "LinearMath/btScalar.h" // for SIMD_FORCE_INLINE definition 10 | 11 | #define BT_DECLARE_STACK_ONLY_OBJECT \ 12 | private: \ 13 | void* operator new(size_t size); \ 14 | void operator delete(void*); 15 | 16 | struct btCollisionObjectWrapper; 17 | struct btCollisionObjectWrapper 18 | { 19 | BT_DECLARE_STACK_ONLY_OBJECT 20 | 21 | private: 22 | btCollisionObjectWrapper(const btCollisionObjectWrapper&); // not implemented. Not allowed. 23 | btCollisionObjectWrapper* operator=(const btCollisionObjectWrapper&); 24 | 25 | public: 26 | const btCollisionObjectWrapper* m_parent; 27 | const btCollisionShape* m_shape; 28 | const btCollisionObject* m_collisionObject; 29 | const btTransform& m_worldTransform; 30 | int m_partId; 31 | int m_index; 32 | 33 | btCollisionObjectWrapper(const btCollisionObjectWrapper* parent, const btCollisionShape* shape, const btCollisionObject* collisionObject, const btTransform& worldTransform, int partId, int index) 34 | : m_parent(parent), m_shape(shape), m_collisionObject(collisionObject), m_worldTransform(worldTransform), 35 | m_partId(partId), m_index(index) 36 | {} 37 | 38 | SIMD_FORCE_INLINE const btTransform& getWorldTransform() const { return m_worldTransform; } 39 | SIMD_FORCE_INLINE const btCollisionObject* getCollisionObject() const { return m_collisionObject; } 40 | SIMD_FORCE_INLINE const btCollisionShape* getCollisionShape() const { return m_shape; } 41 | }; 42 | 43 | #endif //BT_COLLISION_OBJECT_WRAPPER_H 44 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btEmptyCollisionAlgorithm.h" 17 | 18 | 19 | 20 | btEmptyAlgorithm::btEmptyAlgorithm(const btCollisionAlgorithmConstructionInfo& ci) 21 | : btCollisionAlgorithm(ci) 22 | { 23 | } 24 | 25 | void btEmptyAlgorithm::processCollision (const btCollisionObjectWrapper* ,const btCollisionObjectWrapper* ,const btDispatcherInfo& ,btManifoldResult* ) 26 | { 27 | } 28 | 29 | btScalar btEmptyAlgorithm::calculateTimeOfImpact(btCollisionObject* ,btCollisionObject* ,const btDispatcherInfo& ,btManifoldResult* ) 30 | { 31 | return btScalar(1.); 32 | } 33 | 34 | 35 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionDispatch/btInternalEdgeUtility.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef BT_INTERNAL_EDGE_UTILITY_H 3 | #define BT_INTERNAL_EDGE_UTILITY_H 4 | 5 | #include "LinearMath/btHashMap.h" 6 | #include "LinearMath/btVector3.h" 7 | 8 | #include "BulletCollision/CollisionShapes/btTriangleInfoMap.h" 9 | 10 | ///The btInternalEdgeUtility helps to avoid or reduce artifacts due to wrong collision normals caused by internal edges. 11 | ///See also http://code.google.com/p/bullet/issues/detail?id=27 12 | 13 | class btBvhTriangleMeshShape; 14 | class btCollisionObject; 15 | struct btCollisionObjectWrapper; 16 | class btManifoldPoint; 17 | class btIDebugDraw; 18 | 19 | 20 | 21 | enum btInternalEdgeAdjustFlags 22 | { 23 | BT_TRIANGLE_CONVEX_BACKFACE_MODE = 1, 24 | BT_TRIANGLE_CONCAVE_DOUBLE_SIDED = 2, //double sided options are experimental, single sided is recommended 25 | BT_TRIANGLE_CONVEX_DOUBLE_SIDED = 4 26 | }; 27 | 28 | 29 | ///Call btGenerateInternalEdgeInfo to create triangle info, store in the shape 'userInfo' 30 | void btGenerateInternalEdgeInfo (btBvhTriangleMeshShape*trimeshShape, btTriangleInfoMap* triangleInfoMap); 31 | 32 | 33 | ///Call the btFixMeshNormal to adjust the collision normal, using the triangle info map (generated using btGenerateInternalEdgeInfo) 34 | ///If this info map is missing, or the triangle is not store in this map, nothing will be done 35 | void btAdjustInternalEdgeContacts(btManifoldPoint& cp, const btCollisionObjectWrapper* trimeshColObj0Wrap,const btCollisionObjectWrapper* otherColObj1Wrap, int partId0, int index0, int normalAdjustFlags = 0); 36 | 37 | ///Enable the BT_INTERNAL_EDGE_DEBUG_DRAW define and call btSetDebugDrawer, to get visual info to see if the internal edge utility works properly. 38 | ///If the utility doesn't work properly, you might have to adjust the threshold values in btTriangleInfoMap 39 | //#define BT_INTERNAL_EDGE_DEBUG_DRAW 40 | 41 | #ifdef BT_INTERNAL_EDGE_DEBUG_DRAW 42 | void btSetDebugDrawer(btIDebugDraw* debugDrawer); 43 | #endif //BT_INTERNAL_EDGE_DEBUG_DRAW 44 | 45 | 46 | #endif //BT_INTERNAL_EDGE_UTILITY_H 47 | 48 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionShapes/btBox2dShape.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btBox2dShape.h" 17 | 18 | 19 | //{ 20 | 21 | 22 | void btBox2dShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const 23 | { 24 | btTransformAabb(getHalfExtentsWithoutMargin(),getMargin(),t,aabbMin,aabbMax); 25 | } 26 | 27 | 28 | void btBox2dShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const 29 | { 30 | //btScalar margin = btScalar(0.); 31 | btVector3 halfExtents = getHalfExtentsWithMargin(); 32 | 33 | btScalar lx=btScalar(2.)*(halfExtents.x()); 34 | btScalar ly=btScalar(2.)*(halfExtents.y()); 35 | btScalar lz=btScalar(2.)*(halfExtents.z()); 36 | 37 | inertia.setValue(mass/(btScalar(12.0)) * (ly*ly + lz*lz), 38 | mass/(btScalar(12.0)) * (lx*lx + lz*lz), 39 | mass/(btScalar(12.0)) * (lx*lx + ly*ly)); 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionShapes/btBoxShape.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | #include "btBoxShape.h" 16 | 17 | btBoxShape::btBoxShape( const btVector3& boxHalfExtents) 18 | : btPolyhedralConvexShape() 19 | { 20 | m_shapeType = BOX_SHAPE_PROXYTYPE; 21 | 22 | btVector3 margin(getMargin(),getMargin(),getMargin()); 23 | m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin; 24 | 25 | setSafeMargin(boxHalfExtents); 26 | }; 27 | 28 | 29 | 30 | 31 | void btBoxShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const 32 | { 33 | btTransformAabb(getHalfExtentsWithoutMargin(),getMargin(),t,aabbMin,aabbMax); 34 | } 35 | 36 | 37 | void btBoxShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const 38 | { 39 | //btScalar margin = btScalar(0.); 40 | btVector3 halfExtents = getHalfExtentsWithMargin(); 41 | 42 | btScalar lx=btScalar(2.)*(halfExtents.x()); 43 | btScalar ly=btScalar(2.)*(halfExtents.y()); 44 | btScalar lz=btScalar(2.)*(halfExtents.z()); 45 | 46 | inertia.setValue(mass/(btScalar(12.0)) * (ly*ly + lz*lz), 47 | mass/(btScalar(12.0)) * (lx*lx + lz*lz), 48 | mass/(btScalar(12.0)) * (lx*lx + ly*ly)); 49 | 50 | } 51 | 52 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionShapes/btCollisionMargin.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_COLLISION_MARGIN_H 17 | #define BT_COLLISION_MARGIN_H 18 | 19 | ///The CONVEX_DISTANCE_MARGIN is a default collision margin for convex collision shapes derived from btConvexInternalShape. 20 | ///This collision margin is used by Gjk and some other algorithms 21 | ///Note that when creating small objects, you need to make sure to set a smaller collision margin, using the 'setMargin' API 22 | #define CONVEX_DISTANCE_MARGIN btScalar(0.04)// btScalar(0.1)//;//btScalar(0.01) 23 | 24 | 25 | 26 | #endif //BT_COLLISION_MARGIN_H 27 | 28 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionShapes/btConcaveShape.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | 17 | #include "btConcaveShape.h" 18 | 19 | btConcaveShape::btConcaveShape() : m_collisionMargin(btScalar(0.)) 20 | { 21 | 22 | } 23 | 24 | btConcaveShape::~btConcaveShape() 25 | { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionShapes/btEmptyShape.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btEmptyShape.h" 17 | 18 | 19 | #include "btCollisionShape.h" 20 | 21 | 22 | btEmptyShape::btEmptyShape() : btConcaveShape () 23 | { 24 | m_shapeType = EMPTY_SHAPE_PROXYTYPE; 25 | } 26 | 27 | 28 | btEmptyShape::~btEmptyShape() 29 | { 30 | } 31 | 32 | 33 | ///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version 34 | void btEmptyShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const 35 | { 36 | btVector3 margin(getMargin(),getMargin(),getMargin()); 37 | 38 | aabbMin = t.getOrigin() - margin; 39 | 40 | aabbMax = t.getOrigin() + margin; 41 | 42 | } 43 | 44 | void btEmptyShape::calculateLocalInertia(btScalar ,btVector3& ) const 45 | { 46 | btAssert(0); 47 | } 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionShapes/btMaterial.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | /// This file was created by Alex Silverman 17 | 18 | #ifndef BT_MATERIAL_H 19 | #define BT_MATERIAL_H 20 | 21 | // Material class to be used by btMultimaterialTriangleMeshShape to store triangle properties 22 | class btMaterial 23 | { 24 | // public members so that materials can change due to world events 25 | public: 26 | btScalar m_friction; 27 | btScalar m_restitution; 28 | int pad[2]; 29 | 30 | btMaterial(){} 31 | btMaterial(btScalar fric, btScalar rest) { m_friction = fric; m_restitution = rest; } 32 | }; 33 | 34 | #endif // BT_MATERIAL_H 35 | 36 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionShapes/btTriangleBuffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btTriangleBuffer.h" 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | void btTriangleBuffer::processTriangle(btVector3* triangle,int partId,int triangleIndex) 25 | { 26 | btTriangle tri; 27 | tri.m_vertex0 = triangle[0]; 28 | tri.m_vertex1 = triangle[1]; 29 | tri.m_vertex2 = triangle[2]; 30 | tri.m_partId = partId; 31 | tri.m_triangleIndex = triangleIndex; 32 | 33 | m_triangleBuffer.push_back(tri); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionShapes/btTriangleCallback.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btTriangleCallback.h" 17 | 18 | btTriangleCallback::~btTriangleCallback() 19 | { 20 | 21 | } 22 | 23 | 24 | btInternalTriangleIndexCallback::~btInternalTriangleIndexCallback() 25 | { 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/CollisionShapes/btTriangleCallback.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_TRIANGLE_CALLBACK_H 17 | #define BT_TRIANGLE_CALLBACK_H 18 | 19 | #include "LinearMath/btVector3.h" 20 | 21 | 22 | ///The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTriangles. 23 | ///This callback is called by processAllTriangles for all btConcaveShape derived class, such as btBvhTriangleMeshShape, btStaticPlaneShape and btHeightfieldTerrainShape. 24 | class btTriangleCallback 25 | { 26 | public: 27 | 28 | virtual ~btTriangleCallback(); 29 | virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex) = 0; 30 | }; 31 | 32 | class btInternalTriangleIndexCallback 33 | { 34 | public: 35 | 36 | virtual ~btInternalTriangleIndexCallback(); 37 | virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex) = 0; 38 | }; 39 | 40 | 41 | 42 | #endif //BT_TRIANGLE_CALLBACK_H 43 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/Gimpact/btGImpactShape.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/Gimpact/btGImpactShape.h -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/Gimpact/gim_geometry.h: -------------------------------------------------------------------------------- 1 | #ifndef GIM_GEOMETRY_H_INCLUDED 2 | #define GIM_GEOMETRY_H_INCLUDED 3 | 4 | /*! \file gim_geometry.h 5 | \author Francisco Leon Najera 6 | */ 7 | /* 8 | ----------------------------------------------------------------------------- 9 | This source file is part of GIMPACT Library. 10 | 11 | For the latest info, see http://gimpact.sourceforge.net/ 12 | 13 | Copyright (c) 2006 Francisco Leon Najera. C.C. 80087371. 14 | email: projectileman@yahoo.com 15 | 16 | This library is free software; you can redistribute it and/or 17 | modify it under the terms of EITHER: 18 | (1) The GNU Lesser General Public License as published by the Free 19 | Software Foundation; either version 2.1 of the License, or (at 20 | your option) any later version. The text of the GNU Lesser 21 | General Public License is included with this library in the 22 | file GIMPACT-LICENSE-LGPL.TXT. 23 | (2) The BSD-style license that is included with this library in 24 | the file GIMPACT-LICENSE-BSD.TXT. 25 | (3) The zlib/libpng license that is included with this library in 26 | the file GIMPACT-LICENSE-ZLIB.TXT. 27 | 28 | This library is distributed in the hope that it will be useful, 29 | but WITHOUT ANY WARRANTY; without even the implied warranty of 30 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files 31 | GIMPACT-LICENSE-LGPL.TXT, GIMPACT-LICENSE-ZLIB.TXT and GIMPACT-LICENSE-BSD.TXT for more details. 32 | 33 | ----------------------------------------------------------------------------- 34 | */ 35 | 36 | ///Additional Headers for Collision 37 | #include "gim_basic_geometry_operations.h" 38 | #include "gim_clip_polygon.h" 39 | #include "gim_box_collision.h" 40 | #include "gim_tri_collision.h" 41 | 42 | #endif // GIM_VECTOR_H_INCLUDED 43 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/NarrowPhaseCollision/btConvexCast.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #include "btConvexCast.h" 17 | 18 | btConvexCast::~btConvexCast() 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | 17 | #ifndef BT_CONVEX_PENETRATION_DEPTH_H 18 | #define BT_CONVEX_PENETRATION_DEPTH_H 19 | 20 | class btVector3; 21 | #include "btSimplexSolverInterface.h" 22 | class btConvexShape; 23 | class btTransform; 24 | 25 | ///ConvexPenetrationDepthSolver provides an interface for penetration depth calculation. 26 | class btConvexPenetrationDepthSolver 27 | { 28 | public: 29 | 30 | virtual ~btConvexPenetrationDepthSolver() {}; 31 | virtual bool calcPenDepth( btSimplexSolverInterface& simplexSolver, 32 | const btConvexShape* convexA,const btConvexShape* convexB, 33 | const btTransform& transA,const btTransform& transB, 34 | btVector3& v, btVector3& pa, btVector3& pb, 35 | class btIDebugDraw* debugDraw) = 0; 36 | 37 | 38 | }; 39 | #endif //BT_CONVEX_PENETRATION_DEPTH_H 40 | 41 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/NarrowPhaseCollision/btGjkCollisionDescription.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2014 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | 17 | #ifndef GJK_COLLISION_DESCRIPTION_H 18 | #define GJK_COLLISION_DESCRIPTION_H 19 | 20 | #include "LinearMath/btVector3.h" 21 | 22 | struct btGjkCollisionDescription 23 | { 24 | btVector3 m_firstDir; 25 | int m_maxGjkIterations; 26 | btScalar m_maximumDistanceSquared; 27 | btScalar m_gjkRelError2; 28 | btGjkCollisionDescription() 29 | :m_firstDir(0,1,0), 30 | m_maxGjkIterations(1000), 31 | m_maximumDistanceSquared(1e30f), 32 | m_gjkRelError2(1.0e-6) 33 | { 34 | } 35 | virtual ~btGjkCollisionDescription() 36 | { 37 | } 38 | }; 39 | 40 | #endif //GJK_COLLISION_DESCRIPTION_H 41 | 42 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | 17 | 18 | #ifndef BT_GJK_CONVEX_CAST_H 19 | #define BT_GJK_CONVEX_CAST_H 20 | 21 | #include "BulletCollision/CollisionShapes/btCollisionMargin.h" 22 | 23 | #include "LinearMath/btVector3.h" 24 | #include "btConvexCast.h" 25 | class btConvexShape; 26 | class btMinkowskiSumShape; 27 | #include "btSimplexSolverInterface.h" 28 | 29 | ///GjkConvexCast performs a raycast on a convex object using support mapping. 30 | class btGjkConvexCast : public btConvexCast 31 | { 32 | btSimplexSolverInterface* m_simplexSolver; 33 | const btConvexShape* m_convexA; 34 | const btConvexShape* m_convexB; 35 | 36 | public: 37 | 38 | btGjkConvexCast(const btConvexShape* convexA,const btConvexShape* convexB,btSimplexSolverInterface* simplexSolver); 39 | 40 | /// cast a convex against another convex object 41 | virtual bool calcTimeOfImpact( 42 | const btTransform& fromA, 43 | const btTransform& toA, 44 | const btTransform& fromB, 45 | const btTransform& toB, 46 | CastResult& result); 47 | 48 | }; 49 | 50 | #endif //BT_GJK_CONVEX_CAST_H 51 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | EPA Copyright (c) Ricardo Padrela 2006 6 | 7 | This software is provided 'as-is', without any express or implied warranty. 8 | In no event will the authors be held liable for any damages arising from the use of this software. 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it freely, 11 | subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 14 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 15 | 3. This notice may not be removed or altered from any source distribution. 16 | */ 17 | #ifndef BT_GJP_EPA_PENETRATION_DEPTH_H 18 | #define BT_GJP_EPA_PENETRATION_DEPTH_H 19 | 20 | #include "btConvexPenetrationDepthSolver.h" 21 | 22 | ///EpaPenetrationDepthSolver uses the Expanding Polytope Algorithm to 23 | ///calculate the penetration depth between two convex shapes. 24 | class btGjkEpaPenetrationDepthSolver : public btConvexPenetrationDepthSolver 25 | { 26 | public : 27 | 28 | btGjkEpaPenetrationDepthSolver() 29 | { 30 | } 31 | 32 | bool calcPenDepth( btSimplexSolverInterface& simplexSolver, 33 | const btConvexShape* pConvexA, const btConvexShape* pConvexB, 34 | const btTransform& transformA, const btTransform& transformB, 35 | btVector3& v, btVector3& wWitnessOnA, btVector3& wWitnessOnB, 36 | class btIDebugDraw* debugDraw); 37 | 38 | private : 39 | 40 | }; 41 | 42 | #endif // BT_GJP_EPA_PENETRATION_DEPTH_H 43 | 44 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_MINKOWSKI_PENETRATION_DEPTH_SOLVER_H 17 | #define BT_MINKOWSKI_PENETRATION_DEPTH_SOLVER_H 18 | 19 | #include "btConvexPenetrationDepthSolver.h" 20 | 21 | ///MinkowskiPenetrationDepthSolver implements bruteforce penetration depth estimation. 22 | ///Implementation is based on sampling the depth using support mapping, and using GJK step to get the witness points. 23 | class btMinkowskiPenetrationDepthSolver : public btConvexPenetrationDepthSolver 24 | { 25 | protected: 26 | 27 | static btVector3* getPenetrationDirections(); 28 | 29 | public: 30 | 31 | virtual bool calcPenDepth( btSimplexSolverInterface& simplexSolver, 32 | const btConvexShape* convexA,const btConvexShape* convexB, 33 | const btTransform& transA,const btTransform& transB, 34 | btVector3& v, btVector3& pa, btVector3& pb, 35 | class btIDebugDraw* debugDraw 36 | ); 37 | }; 38 | 39 | #endif //BT_MINKOWSKI_PENETRATION_DEPTH_SOLVER_H 40 | 41 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletDynamics/ConstraintSolver/btFixedConstraint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2013 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | 17 | #include "btFixedConstraint.h" 18 | #include "BulletDynamics/Dynamics/btRigidBody.h" 19 | #include "LinearMath/btTransformUtil.h" 20 | #include 21 | 22 | 23 | btFixedConstraint::btFixedConstraint(btRigidBody& rbA,btRigidBody& rbB, const btTransform& frameInA,const btTransform& frameInB) 24 | :btGeneric6DofSpring2Constraint(rbA,rbB,frameInA,frameInB) 25 | { 26 | setAngularLowerLimit(btVector3(0,0,0)); 27 | setAngularUpperLimit(btVector3(0,0,0)); 28 | setLinearLowerLimit(btVector3(0,0,0)); 29 | setLinearUpperLimit(btVector3(0,0,0)); 30 | } 31 | 32 | 33 | 34 | 35 | btFixedConstraint::~btFixedConstraint () 36 | { 37 | } 38 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletDynamics/ConstraintSolver/btFixedConstraint.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2013 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_FIXED_CONSTRAINT_H 17 | #define BT_FIXED_CONSTRAINT_H 18 | 19 | #include "btGeneric6DofSpring2Constraint.h" 20 | 21 | 22 | ATTRIBUTE_ALIGNED16(class) btFixedConstraint : public btGeneric6DofSpring2Constraint 23 | { 24 | 25 | public: 26 | btFixedConstraint(btRigidBody& rbA,btRigidBody& rbB, const btTransform& frameInA,const btTransform& frameInB); 27 | 28 | 29 | virtual ~btFixedConstraint(); 30 | 31 | }; 32 | 33 | #endif //BT_FIXED_CONSTRAINT_H 34 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/switch-gdx/res/switchgdx/bullet/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletDynamics/Dynamics/btActionInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef _BT_ACTION_INTERFACE_H 17 | #define _BT_ACTION_INTERFACE_H 18 | 19 | class btIDebugDraw; 20 | class btCollisionWorld; 21 | 22 | #include "LinearMath/btScalar.h" 23 | #include "btRigidBody.h" 24 | 25 | ///Basic interface to allow actions such as vehicles and characters to be updated inside a btDynamicsWorld 26 | class btActionInterface 27 | { 28 | protected: 29 | 30 | static btRigidBody& getFixedBody(); 31 | 32 | 33 | public: 34 | 35 | virtual ~btActionInterface() 36 | { 37 | } 38 | 39 | virtual void updateAction( btCollisionWorld* collisionWorld, btScalar deltaTimeStep)=0; 40 | 41 | virtual void debugDraw(btIDebugDraw* debugDrawer) = 0; 42 | 43 | }; 44 | 45 | #endif //_BT_ACTION_INTERFACE_H 46 | 47 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletDynamics/Featherstone/btMultiBodyJointFeedback.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Google Inc. 3 | 4 | This software is provided 'as-is', without any express or implied warranty. 5 | In no event will the authors be held liable for any damages arising from the use of this software. 6 | Permission is granted to anyone to use this software for any purpose, 7 | including commercial applications, and to alter it and redistribute it freely, 8 | subject to the following restrictions: 9 | 10 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 11 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 12 | 3. This notice may not be removed or altered from any source distribution. 13 | */ 14 | 15 | 16 | 17 | #ifndef BT_MULTIBODY_JOINT_FEEDBACK_H 18 | #define BT_MULTIBODY_JOINT_FEEDBACK_H 19 | 20 | #include "LinearMath/btSpatialAlgebra.h" 21 | 22 | struct btMultiBodyJointFeedback 23 | { 24 | btSpatialForceVector m_reactionForces; 25 | }; 26 | 27 | #endif //BT_MULTIBODY_JOINT_FEEDBACK_H 28 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2013 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_MULTIBODY_JOINT_LIMIT_CONSTRAINT_H 17 | #define BT_MULTIBODY_JOINT_LIMIT_CONSTRAINT_H 18 | 19 | #include "btMultiBodyConstraint.h" 20 | struct btSolverInfo; 21 | 22 | class btMultiBodyJointLimitConstraint : public btMultiBodyConstraint 23 | { 24 | protected: 25 | 26 | btScalar m_lowerBound; 27 | btScalar m_upperBound; 28 | public: 29 | 30 | btMultiBodyJointLimitConstraint(btMultiBody* body, int link, btScalar lower, btScalar upper); 31 | virtual ~btMultiBodyJointLimitConstraint(); 32 | 33 | virtual void finalizeMultiDof(); 34 | 35 | virtual int getIslandIdA() const; 36 | virtual int getIslandIdB() const; 37 | 38 | virtual void createConstraintRows(btMultiBodyConstraintArray& constraintRows, 39 | btMultiBodyJacobianData& data, 40 | const btContactSolverInfo& infoGlobal); 41 | 42 | virtual void debugDraw(class btIDebugDraw* drawer) 43 | { 44 | //todo(erwincoumans) 45 | } 46 | 47 | }; 48 | 49 | #endif //BT_MULTIBODY_JOINT_LIMIT_CONSTRAINT_H 50 | 51 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletDynamics/MLCPSolvers/btLemkeSolver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/switch-gdx/res/switchgdx/bullet/bullet/BulletDynamics/MLCPSolvers/btLemkeSolver.h -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletDynamics/MLCPSolvers/btMLCPSolverInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2013 Erwin Coumans http://bulletphysics.org 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | ///original version written by Erwin Coumans, October 2013 16 | 17 | #ifndef BT_MLCP_SOLVER_INTERFACE_H 18 | #define BT_MLCP_SOLVER_INTERFACE_H 19 | 20 | #include "LinearMath/btMatrixX.h" 21 | 22 | class btMLCPSolverInterface 23 | { 24 | public: 25 | virtual ~btMLCPSolverInterface() 26 | { 27 | } 28 | 29 | //return true is it solves the problem successfully 30 | virtual bool solveMLCP(const btMatrixXu & A, const btVectorXu & b, btVectorXu& x, const btVectorXu & lo,const btVectorXu & hi,const btAlignedObjectArray& limitDependency, int numIterations, bool useSparsity = true)=0; 31 | }; 32 | 33 | #endif //BT_MLCP_SOLVER_INTERFACE_H 34 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletDynamics/Vehicle/btVehicleRaycaster.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005 Erwin Coumans http://bulletphysics.org 3 | * 4 | * Permission to use, copy, modify, distribute and sell this software 5 | * and its documentation for any purpose is hereby granted without fee, 6 | * provided that the above copyright notice appear in all copies. 7 | * Erwin Coumans makes no representations about the suitability 8 | * of this software for any purpose. 9 | * It is provided "as is" without express or implied warranty. 10 | */ 11 | #ifndef BT_VEHICLE_RAYCASTER_H 12 | #define BT_VEHICLE_RAYCASTER_H 13 | 14 | #include "LinearMath/btVector3.h" 15 | 16 | /// btVehicleRaycaster is provides interface for between vehicle simulation and raycasting 17 | struct btVehicleRaycaster 18 | { 19 | virtual ~btVehicleRaycaster() 20 | { 21 | } 22 | struct btVehicleRaycasterResult 23 | { 24 | btVehicleRaycasterResult() :m_distFraction(btScalar(-1.)){}; 25 | btVector3 m_hitPointInWorld; 26 | btVector3 m_hitNormalInWorld; 27 | btScalar m_distFraction; 28 | }; 29 | 30 | virtual void* castRay(const btVector3& from,const btVector3& to, btVehicleRaycasterResult& result) = 0; 31 | 32 | }; 33 | 34 | #endif //BT_VEHICLE_RAYCASTER_H 35 | 36 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletDynamics/Vehicle/btWheelInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/ 3 | * 4 | * Permission to use, copy, modify, distribute and sell this software 5 | * and its documentation for any purpose is hereby granted without fee, 6 | * provided that the above copyright notice appear in all copies. 7 | * Erwin Coumans makes no representations about the suitability 8 | * of this software for any purpose. 9 | * It is provided "as is" without express or implied warranty. 10 | */ 11 | #include "btWheelInfo.h" 12 | #include "BulletDynamics/Dynamics/btRigidBody.h" // for pointvelocity 13 | 14 | 15 | btScalar btWheelInfo::getSuspensionRestLength() const 16 | { 17 | 18 | return m_suspensionRestLength1; 19 | 20 | } 21 | 22 | void btWheelInfo::updateWheel(const btRigidBody& chassis,RaycastInfo& raycastInfo) 23 | { 24 | (void)raycastInfo; 25 | 26 | 27 | if (m_raycastInfo.m_isInContact) 28 | 29 | { 30 | btScalar project= m_raycastInfo.m_contactNormalWS.dot( m_raycastInfo.m_wheelDirectionWS ); 31 | btVector3 chassis_velocity_at_contactPoint; 32 | btVector3 relpos = m_raycastInfo.m_contactPointWS - chassis.getCenterOfMassPosition(); 33 | chassis_velocity_at_contactPoint = chassis.getVelocityInLocalPoint( relpos ); 34 | btScalar projVel = m_raycastInfo.m_contactNormalWS.dot( chassis_velocity_at_contactPoint ); 35 | if ( project >= btScalar(-0.1)) 36 | { 37 | m_suspensionRelativeVelocity = btScalar(0.0); 38 | m_clippedInvContactDotSuspension = btScalar(1.0) / btScalar(0.1); 39 | } 40 | else 41 | { 42 | btScalar inv = btScalar(-1.) / project; 43 | m_suspensionRelativeVelocity = projVel * inv; 44 | m_clippedInvContactDotSuspension = inv; 45 | } 46 | 47 | } 48 | 49 | else // Not in contact : position wheel in a nice (rest length) position 50 | { 51 | m_raycastInfo.m_suspensionLength = this->getSuspensionRestLength(); 52 | m_suspensionRelativeVelocity = btScalar(0.0); 53 | m_raycastInfo.m_contactNormalWS = -m_raycastInfo.m_wheelDirectionWS; 54 | m_clippedInvContactDotSuspension = btScalar(1.0); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletInverseDynamics/IDConfigBuiltin.hpp: -------------------------------------------------------------------------------- 1 | ///@file Configuration for Inverse Dynamics Library without external dependencies 2 | #ifndef INVDYNCONFIG_BUILTIN_HPP_ 3 | #define INVDYNCONFIG_BUILTIN_HPP_ 4 | #define btInverseDynamics btInverseDynamicsBuiltin 5 | #ifdef BT_USE_DOUBLE_PRECISION 6 | // choose double/single precision version 7 | typedef double idScalar; 8 | #else 9 | typedef float idScalar; 10 | #endif 11 | // use std::vector for arrays 12 | #include 13 | // this is to make it work with C++2003, otherwise we could do this 14 | // template 15 | // using idArray = std::vector; 16 | template 17 | struct idArray { 18 | typedef std::vector type; 19 | }; 20 | typedef std::vector::size_type idArrayIdx; 21 | // default to standard malloc/free 22 | #include 23 | #define idMalloc ::malloc 24 | #define idFree ::free 25 | // currently not aligned at all... 26 | #define ID_DECLARE_ALIGNED_ALLOCATOR() \ 27 | inline void* operator new(std::size_t sizeInBytes) { return idMalloc(sizeInBytes); } \ 28 | inline void operator delete(void* ptr) { idFree(ptr); } \ 29 | inline void* operator new(std::size_t, void* ptr) { return ptr; } \ 30 | inline void operator delete(void*, void*) {} \ 31 | inline void* operator new[](std::size_t sizeInBytes) { return idMalloc(sizeInBytes); } \ 32 | inline void operator delete[](void* ptr) { idFree(ptr); } \ 33 | inline void* operator new[](std::size_t, void* ptr) { return ptr; } \ 34 | inline void operator delete[](void*, void*) {} 35 | 36 | #include "details/IDMatVec.hpp" 37 | #endif 38 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletInverseDynamics/IDConfigEigen.hpp: -------------------------------------------------------------------------------- 1 | ///@file Configuration for Inverse Dynamics Library with Eigen 2 | #ifndef INVDYNCONFIG_EIGEN_HPP_ 3 | #define INVDYNCONFIG_EIGEN_HPP_ 4 | #define btInverseDynamics btInverseDynamicsEigen 5 | #ifdef BT_USE_DOUBLE_PRECISION 6 | // choose double/single precision version 7 | typedef double idScalar; 8 | #else 9 | typedef float idScalar; 10 | #endif 11 | 12 | // use std::vector for arrays 13 | #include 14 | // this is to make it work with C++2003, otherwise we could do this 15 | // template 16 | // using idArray = std::vector; 17 | template 18 | struct idArray { 19 | typedef std::vector type; 20 | }; 21 | typedef std::vector::size_type idArrayIdx; 22 | // default to standard malloc/free 23 | #include 24 | #define ID_DECLARE_ALIGNED_ALLOCATOR() EIGEN_MAKE_ALIGNED_OPERATOR_NEW 25 | // Note on interfaces: 26 | // Eigen::Matrix has data(), to get c-array storage 27 | // HOWEVER: default storage is column-major! 28 | #define ID_LINEAR_MATH_USE_EIGEN 29 | #include "Eigen/Eigen" 30 | #include "details/IDEigenInterface.hpp" 31 | #endif 32 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletInverseDynamics/IDErrorMessages.hpp: -------------------------------------------------------------------------------- 1 | ///@file error message utility functions 2 | #ifndef IDUTILS_HPP_ 3 | #define IDUTILS_HPP_ 4 | #include 5 | /// name of file being compiled, without leading path components 6 | #define __INVDYN_FILE_WO_DIR__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) 7 | 8 | #if !defined(BT_ID_WO_BULLET) && !defined(BT_USE_INVERSE_DYNAMICS_WITH_BULLET2) 9 | #include "Bullet3Common/b3Logging.h" 10 | #define error_message(...) b3Error(__VA_ARGS__) 11 | #define warning_message(...) b3Warning(__VA_ARGS__) 12 | #define id_printf(...) b3Printf(__VA_ARGS__) 13 | #else // BT_ID_WO_BULLET 14 | #include 15 | /// print error message with file/line information 16 | #define error_message(...) \ 17 | do { \ 18 | fprintf(stderr, "[Error:%s:%d] ", __INVDYN_FILE_WO_DIR__, __LINE__); \ 19 | fprintf(stderr, __VA_ARGS__); \ 20 | } while (0) 21 | /// print warning message with file/line information 22 | #define warning_message(...) \ 23 | do { \ 24 | fprintf(stderr, "[Warning:%s:%d] ", __INVDYN_FILE_WO_DIR__, __LINE__); \ 25 | fprintf(stderr, __VA_ARGS__); \ 26 | } while (0) 27 | #define id_printf(...) printf(__VA_ARGS__) 28 | #endif // BT_ID_WO_BULLET 29 | #endif 30 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletInverseDynamics/details/IDEigenInterface.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INVDYNEIGENINTERFACE_HPP_ 2 | #define INVDYNEIGENINTERFACE_HPP_ 3 | #include "../IDConfig.hpp" 4 | namespace btInverseDynamics { 5 | 6 | #define BT_ID_HAVE_MAT3X 7 | 8 | #ifdef BT_USE_DOUBLE_PRECISION 9 | typedef Eigen::Matrix vecx; 10 | typedef Eigen::Matrix vec3; 11 | typedef Eigen::Matrix mat33; 12 | typedef Eigen::Matrix matxx; 13 | typedef Eigen::Matrix mat3x; 14 | #else 15 | typedef Eigen::Matrix vecx; 16 | typedef Eigen::Matrix vec3; 17 | typedef Eigen::Matrix mat33; 18 | typedef Eigen::Matrix matxx; 19 | typedef Eigen::Matrix mat3x; 20 | #endif 21 | 22 | inline void resize(mat3x &m, Eigen::Index size) { 23 | m.resize(3, size); 24 | m.setZero(); 25 | } 26 | 27 | inline void setMatxxElem(const idArrayIdx row, const idArrayIdx col, const idScalar val, matxx*m){ 28 | (*m)(row, col) = val; 29 | } 30 | 31 | inline void setMat3xElem(const idArrayIdx row, const idArrayIdx col, const idScalar val, mat3x*m){ 32 | (*m)(row, col) = val; 33 | } 34 | 35 | } 36 | #endif // INVDYNEIGENINTERFACE_HPP_ 37 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/BulletSoftBody/btSoftBody.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/switch-gdx/res/switchgdx/bullet/bullet/BulletSoftBody/btSoftBody.cpp -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/LinearMath/btDefaultMotionState.h: -------------------------------------------------------------------------------- 1 | #ifndef BT_DEFAULT_MOTION_STATE_H 2 | #define BT_DEFAULT_MOTION_STATE_H 3 | 4 | #include "btMotionState.h" 5 | 6 | ///The btDefaultMotionState provides a common implementation to synchronize world transforms with offsets. 7 | ATTRIBUTE_ALIGNED16(struct) btDefaultMotionState : public btMotionState 8 | { 9 | btTransform m_graphicsWorldTrans; 10 | btTransform m_centerOfMassOffset; 11 | btTransform m_startWorldTrans; 12 | void* m_userPointer; 13 | 14 | BT_DECLARE_ALIGNED_ALLOCATOR(); 15 | 16 | btDefaultMotionState(const btTransform& startTrans = btTransform::getIdentity(),const btTransform& centerOfMassOffset = btTransform::getIdentity()) 17 | : m_graphicsWorldTrans(startTrans), 18 | m_centerOfMassOffset(centerOfMassOffset), 19 | m_startWorldTrans(startTrans), 20 | m_userPointer(0) 21 | 22 | { 23 | } 24 | 25 | ///synchronizes world transform from user to physics 26 | virtual void getWorldTransform(btTransform& centerOfMassWorldTrans ) const 27 | { 28 | centerOfMassWorldTrans = m_graphicsWorldTrans * m_centerOfMassOffset.inverse() ; 29 | } 30 | 31 | ///synchronizes world transform from physics to user 32 | ///Bullet only calls the update of worldtransform for active objects 33 | virtual void setWorldTransform(const btTransform& centerOfMassWorldTrans) 34 | { 35 | m_graphicsWorldTrans = centerOfMassWorldTrans * m_centerOfMassOffset; 36 | } 37 | 38 | 39 | 40 | }; 41 | 42 | #endif //BT_DEFAULT_MOTION_STATE_H 43 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/LinearMath/btGeometryUtil.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ 3 | 4 | This software is provided 'as-is', without any express or implied warranty. 5 | In no event will the authors be held liable for any damages arising from the use of this software. 6 | Permission is granted to anyone to use this software for any purpose, 7 | including commercial applications, and to alter it and redistribute it freely, 8 | subject to the following restrictions: 9 | 10 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 11 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 12 | 3. This notice may not be removed or altered from any source distribution. 13 | */ 14 | 15 | 16 | #ifndef BT_GEOMETRY_UTIL_H 17 | #define BT_GEOMETRY_UTIL_H 18 | 19 | #include "btVector3.h" 20 | #include "btAlignedObjectArray.h" 21 | 22 | ///The btGeometryUtil helper class provides a few methods to convert between plane equations and vertices. 23 | class btGeometryUtil 24 | { 25 | public: 26 | 27 | 28 | static void getPlaneEquationsFromVertices(btAlignedObjectArray& vertices, btAlignedObjectArray& planeEquationsOut ); 29 | 30 | static void getVerticesFromPlaneEquations(const btAlignedObjectArray& planeEquations , btAlignedObjectArray& verticesOut ); 31 | 32 | static bool isInside(const btAlignedObjectArray& vertices, const btVector3& planeNormal, btScalar margin); 33 | 34 | static bool isPointInsidePlanes(const btAlignedObjectArray& planeEquations, const btVector3& point, btScalar margin); 35 | 36 | static bool areVerticesBehindPlane(const btVector3& planeNormal, const btAlignedObjectArray& vertices, btScalar margin); 37 | 38 | }; 39 | 40 | 41 | #endif //BT_GEOMETRY_UTIL_H 42 | 43 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/LinearMath/btMinMax.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ 3 | 4 | This software is provided 'as-is', without any express or implied warranty. 5 | In no event will the authors be held liable for any damages arising from the use of this software. 6 | Permission is granted to anyone to use this software for any purpose, 7 | including commercial applications, and to alter it and redistribute it freely, 8 | subject to the following restrictions: 9 | 10 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 11 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 12 | 3. This notice may not be removed or altered from any source distribution. 13 | */ 14 | 15 | 16 | 17 | #ifndef BT_GEN_MINMAX_H 18 | #define BT_GEN_MINMAX_H 19 | 20 | #include "btScalar.h" 21 | 22 | template 23 | SIMD_FORCE_INLINE const T& btMin(const T& a, const T& b) 24 | { 25 | return a < b ? a : b ; 26 | } 27 | 28 | template 29 | SIMD_FORCE_INLINE const T& btMax(const T& a, const T& b) 30 | { 31 | return a > b ? a : b; 32 | } 33 | 34 | template 35 | SIMD_FORCE_INLINE const T& btClamped(const T& a, const T& lb, const T& ub) 36 | { 37 | return a < lb ? lb : (ub < a ? ub : a); 38 | } 39 | 40 | template 41 | SIMD_FORCE_INLINE void btSetMin(T& a, const T& b) 42 | { 43 | if (b < a) 44 | { 45 | a = b; 46 | } 47 | } 48 | 49 | template 50 | SIMD_FORCE_INLINE void btSetMax(T& a, const T& b) 51 | { 52 | if (a < b) 53 | { 54 | a = b; 55 | } 56 | } 57 | 58 | template 59 | SIMD_FORCE_INLINE void btClamp(T& a, const T& lb, const T& ub) 60 | { 61 | if (a < lb) 62 | { 63 | a = lb; 64 | } 65 | else if (ub < a) 66 | { 67 | a = ub; 68 | } 69 | } 70 | 71 | #endif //BT_GEN_MINMAX_H 72 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/LinearMath/btMotionState.h: -------------------------------------------------------------------------------- 1 | /* 2 | Bullet Continuous Collision Detection and Physics Library 3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef BT_MOTIONSTATE_H 17 | #define BT_MOTIONSTATE_H 18 | 19 | #include "btTransform.h" 20 | 21 | ///The btMotionState interface class allows the dynamics world to synchronize and interpolate the updated world transforms with graphics 22 | ///For optimizations, potentially only moving objects get synchronized (using setWorldPosition/setWorldOrientation) 23 | class btMotionState 24 | { 25 | public: 26 | 27 | virtual ~btMotionState() 28 | { 29 | 30 | } 31 | 32 | virtual void getWorldTransform(btTransform& worldTrans ) const =0; 33 | 34 | //Bullet only calls the update of worldtransform for active objects 35 | virtual void setWorldTransform(const btTransform& worldTrans)=0; 36 | 37 | 38 | }; 39 | 40 | #endif //BT_MOTIONSTATE_H 41 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/bullet/LinearMath/btRandom.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ 3 | 4 | This software is provided 'as-is', without any express or implied warranty. 5 | In no event will the authors be held liable for any damages arising from the use of this software. 6 | Permission is granted to anyone to use this software for any purpose, 7 | including commercial applications, and to alter it and redistribute it freely, 8 | subject to the following restrictions: 9 | 10 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 11 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 12 | 3. This notice may not be removed or altered from any source distribution. 13 | */ 14 | 15 | 16 | 17 | #ifndef BT_GEN_RANDOM_H 18 | #define BT_GEN_RANDOM_H 19 | 20 | #ifdef MT19937 21 | 22 | #include 23 | #include 24 | 25 | #define GEN_RAND_MAX UINT_MAX 26 | 27 | SIMD_FORCE_INLINE void GEN_srand(unsigned int seed) { init_genrand(seed); } 28 | SIMD_FORCE_INLINE unsigned int GEN_rand() { return genrand_int32(); } 29 | 30 | #else 31 | 32 | #include 33 | 34 | #define GEN_RAND_MAX RAND_MAX 35 | 36 | SIMD_FORCE_INLINE void GEN_srand(unsigned int seed) { srand(seed); } 37 | SIMD_FORCE_INLINE unsigned int GEN_rand() { return rand(); } 38 | 39 | #endif 40 | 41 | #endif //BT_GEN_RANDOM_H 42 | 43 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/custom/gdx/collision/ClosestNotMeConvexResultCallback.cpp: -------------------------------------------------------------------------------- 1 | #include "ClosestNotMeConvexResultCallback.h" 2 | 3 | ClosestNotMeConvexResultCallback::ClosestNotMeConvexResultCallback (btCollisionObject* me,const btVector3& fromA,const btVector3& toA) : 4 | ClosestConvexResultCallback(fromA,toA), 5 | m_me(me), 6 | m_allowedPenetration(0.0f) {} 7 | 8 | btScalar ClosestNotMeConvexResultCallback::addSingleResult(btCollisionWorld::LocalConvexResult& convexResult,bool normalInWorldSpace) 9 | { 10 | if (convexResult.m_hitCollisionObject == m_me) 11 | return 1.0f; 12 | 13 | //ignore result if there is no contact response 14 | if(!convexResult.m_hitCollisionObject->hasContactResponse()) 15 | return 1.0f; 16 | 17 | btVector3 linVelA,linVelB; 18 | linVelA = m_convexToWorld-m_convexFromWorld; 19 | linVelB = btVector3(0,0,0);//toB.getOrigin()-fromB.getOrigin(); 20 | 21 | btVector3 relativeVelocity = (linVelA-linVelB); 22 | //don't report time of impact for motion away from the contact normal (or causes minor penetration) 23 | if (convexResult.m_hitNormalLocal.dot(relativeVelocity)>=-m_allowedPenetration) 24 | return 1.f; 25 | 26 | return ClosestConvexResultCallback::addSingleResult (convexResult, normalInWorldSpace); 27 | } 28 | 29 | bool ClosestNotMeConvexResultCallback::needsCollision(btBroadphaseProxy* proxy0) 30 | { 31 | //don't collide with itself 32 | if (proxy0->m_clientObject == m_me) 33 | return false; 34 | 35 | ///don't do CCD when the collision filters are not matching 36 | if (!ClosestConvexResultCallback::needsCollision(proxy0)) 37 | return false; 38 | 39 | btCollisionObject* otherObj = (btCollisionObject*) proxy0->m_clientObject; 40 | 41 | return false; 42 | } 43 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/custom/gdx/collision/ClosestNotMeConvexResultCallback.h: -------------------------------------------------------------------------------- 1 | #ifndef ClosestNotMeConvexResultCallback_H 2 | #define ClosestNotMeConvexResultCallback_H 3 | 4 | #include "../../../bullet/LinearMath/btVector3.h" 5 | #include "../../../bullet/BulletCollision/CollisionDispatch/btCollisionObject.h" 6 | #include "../../../bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h" 7 | 8 | class ClosestNotMeConvexResultCallback : public btCollisionWorld::ClosestConvexResultCallback 9 | { 10 | public: 11 | 12 | btCollisionObject* m_me; 13 | btScalar m_allowedPenetration; 14 | 15 | public: 16 | ClosestNotMeConvexResultCallback (btCollisionObject* me,const btVector3& fromA,const btVector3& toA); 17 | virtual btScalar addSingleResult(btCollisionWorld::LocalConvexResult& convexResult,bool normalInWorldSpace); 18 | virtual bool needsCollision(btBroadphaseProxy* proxy0); 19 | }; 20 | 21 | #endif // ClosestNotMeConvexResultCallback_H 22 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/custom/gdx/collision/ClosestNotMeRayResultCallback.cpp: -------------------------------------------------------------------------------- 1 | #include "ClosestNotMeRayResultCallback.h" 2 | 3 | ClosestNotMeRayResultCallback::ClosestNotMeRayResultCallback (btCollisionObject* me) 4 | : ClosestRayResultCallback(btVector3(0.0, 0.0, 0.0), btVector3(0.0, 0.0, 0.0)) 5 | { 6 | m_me = me; 7 | } 8 | 9 | btScalar ClosestNotMeRayResultCallback::addSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace) 10 | { 11 | if (rayResult.m_collisionObject == m_me) 12 | return 1.0; 13 | 14 | return ClosestNotMeRayResultCallback::ClosestRayResultCallback::addSingleResult (rayResult, normalInWorldSpace); 15 | } 16 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/custom/gdx/collision/ClosestNotMeRayResultCallback.h: -------------------------------------------------------------------------------- 1 | #ifndef ClosestNotMeRayResultCallback_H 2 | #define ClosestNotMeRayResultCallback_H 3 | 4 | #include "../../../bullet/BulletCollision/CollisionDispatch/btCollisionObject.h" 5 | #include "../../../bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h" 6 | 7 | class ClosestNotMeRayResultCallback : public btCollisionWorld::ClosestRayResultCallback 8 | { 9 | public: 10 | ClosestNotMeRayResultCallback (btCollisionObject* me); 11 | virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace); 12 | protected: 13 | btCollisionObject* m_me; 14 | }; 15 | 16 | #endif // ClosestNotMeRayResultCallback_H 17 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/custom/gdx/collision/CustomCollisionDispatcher.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011 See AUTHORS file. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | ******************************************************************************/ 16 | #ifdef _MSC_VER 17 | #pragma once 18 | #endif 19 | 20 | #ifndef CustomCollisionDispatcher_H 21 | #define CustomCollisionDispatcher_H 22 | 23 | /** For some reason swig doesnt see the needsCollision/needsResponse inheritance (it does see the other virtual methods do). 24 | * @author Xoppa */ 25 | class CustomCollisionDispatcher : public btCollisionDispatcher { 26 | public: 27 | CustomCollisionDispatcher (btCollisionConfiguration* collisionConfiguration) 28 | : btCollisionDispatcher(collisionConfiguration) 29 | {} 30 | virtual bool needsCollision(const btCollisionObject* body0,const btCollisionObject* body1) { 31 | return btCollisionDispatcher::needsCollision(body0, body1); 32 | } 33 | virtual bool needsResponse(const btCollisionObject* body0,const btCollisionObject* body1) { 34 | return btCollisionDispatcher::needsResponse(body0, body1); 35 | } 36 | }; 37 | 38 | #endif //CustomCollisionDispatcher_H 39 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/custom/gdx/collision/GdxCollisionObjectBridge.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011 See AUTHORS file. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | ******************************************************************************/ 16 | 17 | #ifndef GdxCollsionObjectBridge_H 18 | #define GdxCollsionObjectBridge_H 19 | 20 | #include "../../../bullet/BulletCollision/CollisionDispatch/btCollisionObject.h" 21 | 22 | /** @author Xoppa */ 23 | class GdxCollisionObjectBridge { 24 | public: 25 | int userValue; 26 | int contactCallbackFlag; 27 | int contactCallbackFilter; 28 | 29 | GdxCollisionObjectBridge() : userValue(0), contactCallbackFlag(1), contactCallbackFilter(0) 30 | {} 31 | }; 32 | 33 | inline bool gdxCheckFilter(const int filter, const int flag) { 34 | return (filter & flag) == flag; 35 | } 36 | 37 | inline bool gdxCheckFilter(const btCollisionObject* colObj0, const btCollisionObject* colObj1) { 38 | return gdxCheckFilter(((GdxCollisionObjectBridge*)(colObj0->getUserPointer()))->contactCallbackFilter, 39 | ((GdxCollisionObjectBridge*)(colObj1->getUserPointer()))->contactCallbackFlag); 40 | } 41 | 42 | #endif // GdxCollsionObjectBridge_H 43 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/custom/gdx/dynamics/CustomActionInterface.h: -------------------------------------------------------------------------------- 1 | #ifndef CustomActionInterface_H 2 | #define CustomActionInterface_H 3 | 4 | #include "../../../bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h" 5 | 6 | class CustomActionInterface : public btActionInterface { 7 | public: 8 | virtual void updateAction(btScalar timeStep)=0; 9 | 10 | virtual void debugDraw()=0; 11 | 12 | virtual void updateAction(btCollisionWorld* collisionWorld, btScalar timeStep) { 13 | updateAction(timeStep); 14 | } 15 | 16 | virtual void debugDraw(btIDebugDraw* debugDrawer) { debugDraw(); } 17 | }; 18 | 19 | #endif // CustomActionInterface_H 20 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/custom/gdx/dynamics/FilterableVehicleRaycaster.cpp: -------------------------------------------------------------------------------- 1 | #include "FilterableVehicleRaycaster.h" 2 | 3 | void FilterableVehicleRaycaster::setCollisionFilterMask(short collisionFilterMask) { 4 | m_collisionFilterMask = collisionFilterMask; 5 | } 6 | 7 | void FilterableVehicleRaycaster::setCollisionFilterGroup(short collisionFilterGroup) { 8 | m_collisionFilterGroup = collisionFilterGroup; 9 | } 10 | 11 | void* FilterableVehicleRaycaster::castRay(const btVector3& from, const btVector3& to, btVehicleRaycasterResult& result) { 12 | btCollisionWorld::ClosestRayResultCallback rayCallback(from,to); 13 | rayCallback.m_collisionFilterMask = m_collisionFilterMask; 14 | rayCallback.m_collisionFilterGroup = m_collisionFilterGroup; 15 | m_testWorld->rayTest(from, to, rayCallback); 16 | if (rayCallback.hasHit()) { 17 | const btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject); 18 | if (body && body->hasContactResponse()) { 19 | result.m_hitPointInWorld = rayCallback.m_hitPointWorld; 20 | result.m_hitNormalInWorld = rayCallback.m_hitNormalWorld; 21 | result.m_hitNormalInWorld.normalize(); 22 | result.m_distFraction = rayCallback.m_closestHitFraction; 23 | return (void*)body; 24 | } 25 | } 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/custom/gdx/dynamics/FilterableVehicleRaycaster.h: -------------------------------------------------------------------------------- 1 | #ifndef FilterableVehicleRaycaster_H 2 | #define FilterableVehicleRaycaster_H 3 | 4 | #include "../../../bullet/LinearMath/btVector3.h" 5 | #include "../../../bullet/BulletDynamics/Vehicle/btRaycastVehicle.h" 6 | #include "../../../bullet/BulletDynamics/Vehicle/btVehicleRaycaster.h" 7 | #include "../../../bullet/BulletDynamics/Dynamics/btDynamicsWorld.h" 8 | 9 | class FilterableVehicleRaycaster : public btDefaultVehicleRaycaster { 10 | protected: 11 | btDynamicsWorld* m_testWorld; 12 | short m_collisionFilterMask; 13 | short m_collisionFilterGroup; 14 | public: 15 | FilterableVehicleRaycaster(btDynamicsWorld* world) 16 | :btDefaultVehicleRaycaster(world), 17 | m_testWorld(world), 18 | m_collisionFilterMask(btBroadphaseProxy::AllFilter), 19 | m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter) {}; 20 | void setCollisionFilterMask(short collisionFilterMask); 21 | void setCollisionFilterGroup(short collisionFilterGroup); 22 | void* castRay(const btVector3& from, const btVector3& to, btVehicleRaycasterResult& result); 23 | }; 24 | 25 | #endif // FilterableVehicleRaycaster_H 26 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/custom/gdx/dynamics/InternalTickCallback.cpp: -------------------------------------------------------------------------------- 1 | #include "InternalTickCallback.h" 2 | 3 | InternalTickCallback::InternalTickCallback(btDynamicsWorld *dynamicsWorld, bool isPreTick) { 4 | attach(dynamicsWorld, isPreTick); 5 | } 6 | 7 | void InternalTickCallback::detach() { 8 | detach(mWorld, mIsPreTick); 9 | } 10 | 11 | void InternalTickCallback::attach(btDynamicsWorld *dynamicsWorld, bool isPreTick) { 12 | mIsPreTick = isPreTick; 13 | mWorld = dynamicsWorld; 14 | if (mWorld != NULL) 15 | mWorld->setInternalTickCallback(InternalTickCallback_CB, static_cast(this), isPreTick); 16 | } 17 | 18 | void InternalTickCallback::attach() { 19 | attach(mWorld, mIsPreTick); 20 | } 21 | 22 | void InternalTickCallback::detach(btDynamicsWorld *dynamicsWorld, bool isPreTick) { 23 | if (dynamicsWorld != NULL) 24 | dynamicsWorld->setInternalTickCallback(NULL, 0, isPreTick); 25 | } -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/custom/gdx/dynamics/InternalTickCallback.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011 See AUTHORS file. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | ******************************************************************************/ 16 | 17 | #ifndef InternalTickCallback_H 18 | #define InternalTickCallback_H 19 | 20 | #include "../../../bullet/BulletDynamics/Dynamics/btDynamicsWorld.h" 21 | 22 | static void InternalTickCallback_CB(btDynamicsWorld *world, btScalar timeStep); 23 | 24 | /** @author xoppa */ 25 | class InternalTickCallback { 26 | protected: 27 | btDynamicsWorld *mWorld; 28 | bool mIsPreTick; 29 | public: 30 | InternalTickCallback(btDynamicsWorld *dynamicsWorld = NULL, bool isPreTick = false); 31 | virtual void onInternalTick(btDynamicsWorld *dynamicsWorld, btScalar timeStep) { } 32 | void detach(); 33 | void attach(btDynamicsWorld *dynamicsWorld, bool isPreTick); 34 | void attach(); 35 | static void detach(btDynamicsWorld *dynamicsWorld, bool isPreTick); 36 | }; 37 | 38 | static void InternalTickCallback_CB(btDynamicsWorld *world, btScalar timeStep) { 39 | InternalTickCallback *cb = static_cast(world->getWorldUserInfo()); 40 | cb->onInternalTick(world, timeStep); 41 | } 42 | 43 | #endif // InternalTickCallback_H 44 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/custom/gdx/linearmath/mathtypes.h: -------------------------------------------------------------------------------- 1 | #ifndef GDX_MATHTYPES_H 2 | #define GDX_MATHTYPES_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | void Vector3_to_btVector3(JNIEnv * const &jenv, btVector3 &target, jobject &source); 12 | void btVector3_to_Vector3(JNIEnv * const &jenv, jobject &target, const btVector3 &source); 13 | 14 | void Quaternion_to_btQuaternion(JNIEnv * const &jenv, btQuaternion &target, jobject &source); 15 | void btQuaternion_to_Quaternion(JNIEnv * const &jenv, jobject &target, const btQuaternion & source); 16 | 17 | void Matrix3_to_btMatrix3(JNIEnv * const &jenv, btMatrix3x3 &target, jobject &source); 18 | void btMatrix3_to_Matrix3(JNIEnv * const &jenv, jobject &target, const btMatrix3x3 &source); 19 | 20 | void Matrix4_to_btTransform(JNIEnv * const &jenv, btTransform &target, jobject &source); 21 | void btTransform_to_Matrix4(JNIEnv * const &jenv, jobject &target, const btTransform &source); 22 | 23 | #endif //GDX_MATHTYPES_H -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/InverseDynamics/BulletInverseDynamicsUtilsCommon.h: -------------------------------------------------------------------------------- 1 | #ifndef BULLET_INVERSE_DYNAMICS_UTILS_COMMON_H 2 | #define BULLET_INVERSE_DYNAMICS_UTILS_COMMON_H 3 | #include "CoilCreator.hpp" 4 | #include "MultiBodyTreeCreator.hpp" 5 | #include "DillCreator.hpp" 6 | #include "MultiBodyTreeDebugGraph.hpp" 7 | #include "btMultiBodyTreeCreator.hpp" 8 | #include "IDRandomUtil.hpp" 9 | #include "SimpleTreeCreator.hpp" 10 | #include "invdyn_bullet_comparison.hpp" 11 | #include "MultiBodyNameMap.hpp" 12 | #include "User2InternalIndex.hpp" 13 | 14 | #endif//BULLET_INVERSE_DYNAMICS_UTILS_COMMON_H 15 | 16 | 17 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/InverseDynamics/CloneTreeCreator.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CLONETREE_CREATOR_HPP_ 2 | #define CLONETREE_CREATOR_HPP_ 3 | 4 | #include "BulletInverseDynamics/IDConfig.hpp" 5 | #include "MultiBodyTreeCreator.hpp" 6 | 7 | namespace btInverseDynamics { 8 | /// Generate an identical multibody tree from a reference system. 9 | class CloneTreeCreator : public MultiBodyTreeCreator { 10 | public: 11 | /// ctor 12 | /// @param reference the MultiBodyTree to clone 13 | CloneTreeCreator(const MultiBodyTree*reference); 14 | ~CloneTreeCreator(); 15 | ///\copydoc MultiBodyTreeCreator::getNumBodies 16 | int getNumBodies(int* num_bodies) const; 17 | ///\copydoc MultiBodyTreeCreator::getBody 18 | int getBody(const int body_index, int* parent_index, JointType* joint_type, 19 | vec3* parent_r_parent_body_ref, mat33* body_T_parent_ref, vec3* body_axis_of_motion, 20 | idScalar* mass, vec3* body_r_body_com, mat33* body_I_body, int* user_int, 21 | void** user_ptr) const; 22 | 23 | private: 24 | const MultiBodyTree *m_reference; 25 | }; 26 | } 27 | #endif // CLONETREE_CREATOR_HPP_ 28 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/InverseDynamics/CoilCreator.hpp: -------------------------------------------------------------------------------- 1 | #ifndef COILCREATOR_HPP_ 2 | #define COILCREATOR_HPP_ 3 | 4 | #include "MultiBodyTreeCreator.hpp" 5 | 6 | namespace btInverseDynamics { 7 | 8 | /// Creator class for building a "coil" system as intruduced as benchmark example in 9 | /// Featherstone (1999), "A Divide-and-Conquer Articulated-Body Algorithm for Parallel O(log(n)) 10 | /// Calculation of Rigid-Body Dynamics. Part 2: Trees, Loops, and Accuracy.", The International 11 | /// Journal of Robotics Research 18 (9): 876–892. doi : 10.1177 / 02783649922066628. 12 | /// 13 | /// This is a serial chain, with an initial configuration resembling a coil. 14 | class CoilCreator : public MultiBodyTreeCreator { 15 | public: 16 | /// ctor. 17 | /// @param n the number of bodies in the system 18 | CoilCreator(int n); 19 | /// dtor 20 | ~CoilCreator(); 21 | // \copydoc MultiBodyTreeCreator::getNumBodies 22 | int getNumBodies(int* num_bodies) const; 23 | // \copydoc MultiBodyTreeCreator::getBody 24 | int getBody(const int body_index, int* parent_index, JointType* joint_type, 25 | vec3* parent_r_parent_body_ref, mat33* body_T_parent_ref, vec3* body_axis_of_motion, 26 | idScalar* mass, vec3* body_r_body_com, mat33* body_I_body, int* user_int, 27 | void** user_ptr) const; 28 | 29 | private: 30 | int m_num_bodies; 31 | std::vector m_parent; 32 | vec3 m_parent_r_parent_body_ref; 33 | mat33 m_body_T_parent_ref; 34 | vec3 m_body_axis_of_motion; 35 | idScalar m_mass; 36 | vec3 m_body_r_body_com; 37 | mat33 m_body_I_body; 38 | }; 39 | } 40 | #endif 41 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/InverseDynamics/DillCreator.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DILLCREATOR_HPP_ 2 | #define DILLCREATOR_HPP_ 3 | 4 | #include "MultiBodyTreeCreator.hpp" 5 | 6 | namespace btInverseDynamics { 7 | 8 | 9 | /// Creator class for building a "Dill" system as intruduced as benchmark example in 10 | /// Featherstone (1999), "A Divide-and-Conquer Articulated-Body Algorithm for Parallel O(log(n)) 11 | /// Calculation of Rigid-Body Dynamics. Part 2: Trees, Loops, and Accuracy.", The International 12 | /// Journal of Robotics Research 18 (9): 876–892. doi : 10.1177 / 02783649922066628. 13 | /// 14 | /// This is a self-similar branched tree, somewhat resembling a dill plant 15 | class DillCreator : public MultiBodyTreeCreator { 16 | public: 17 | /// ctor 18 | /// @param levels the number of dill levels 19 | DillCreator(int levels); 20 | /// dtor 21 | ~DillCreator(); 22 | ///\copydoc MultiBodyTreeCreator::getNumBodies 23 | int getNumBodies(int* num_bodies) const; 24 | ///\copydoc MultiBodyTreeCreator::getBody 25 | int getBody(const int body_index, int* parent_index, JointType* joint_type, 26 | vec3* parent_r_parent_body_ref, mat33* body_T_parent_ref, vec3* body_axis_of_motion, 27 | idScalar* mass, vec3* body_r_body_com, mat33* body_I_body, int* user_int, 28 | void** user_ptr) const; 29 | 30 | private: 31 | /// recursively generate dill bodies. 32 | /// TODO better documentation 33 | int recurseDill(const int levels, const int parent, const idScalar d_DH_in, 34 | const idScalar a_DH_in, const idScalar alpha_DH_in); 35 | int m_level; 36 | int m_num_bodies; 37 | idArray::type m_parent; 38 | idArray::type m_parent_r_parent_body_ref; 39 | idArray::type m_body_T_parent_ref; 40 | idArray::type m_body_axis_of_motion; 41 | idArray::type m_mass; 42 | idArray::type m_body_r_body_com; 43 | idArray::type m_body_I_body; 44 | int m_current_body; 45 | }; 46 | } 47 | #endif 48 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/InverseDynamics/IDRandomUtil.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ID_RANDOM_UTIL_HPP_ 2 | #define ID_RANDOM_UTIL_HPP_ 3 | #include "BulletInverseDynamics/IDConfig.hpp" 4 | namespace btInverseDynamics { 5 | /// seed random number generator using time() 6 | void randomInit(); 7 | /// seed random number generator with identical value to get repeatable results 8 | void randomInit(unsigned seed); 9 | /// Generate (not quite) uniformly distributed random integers in [low, high] 10 | /// Note: this is a low-quality implementation using only rand(), as 11 | /// C++11 is not supported in bullet. 12 | /// The results will *not* be perfectly uniform. 13 | /// \param low is the lower bound (inclusive) 14 | /// \param high is the lower bound (inclusive) 15 | /// \return a random number within [\param low, \param high] 16 | int randomInt(int low, int high); 17 | /// Generate a (not quite) uniformly distributed random floats in [low, high] 18 | /// Note: this is a low-quality implementation using only rand(), as 19 | /// C++11 is not supported in bullet. 20 | /// The results will *not* be perfectly uniform. 21 | /// \param low is the lower bound (inclusive) 22 | /// \param high is the lower bound (inclusive) 23 | /// \return a random number within [\param low, \param high] 24 | float randomFloat(float low, float high); 25 | 26 | /// generate a random valid mass value 27 | /// \returns random mass 28 | float randomMass(); 29 | /// generate a random valid vector of principal moments of inertia 30 | vec3 randomInertiaPrincipal(); 31 | /// generate a random valid moment of inertia matrix 32 | mat33 randomInertiaMatrix(); 33 | /// generate a random unit vector 34 | vec3 randomAxis(); 35 | } 36 | #endif 37 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/InverseDynamics/MultiBodyNameMap.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MULTIBODYNAMEMAP_HPP_ 2 | #define MULTIBODYNAMEMAP_HPP_ 3 | 4 | #include "BulletInverseDynamics/IDConfig.hpp" 5 | #include 6 | #include 7 | 8 | namespace btInverseDynamics { 9 | 10 | /// \brief The MultiBodyNameMap class 11 | /// Utility class that stores a maps from body/joint indices to/from body and joint names 12 | class MultiBodyNameMap { 13 | public: 14 | MultiBodyNameMap(); 15 | /// add a body to the map 16 | /// @param index of the body 17 | /// @param name name of the body 18 | /// @return 0 on success, -1 on failure 19 | int addBody(const int index, const std::string& name); 20 | /// add a joint to the map 21 | /// @param index of the joint 22 | /// @param name name of the joint 23 | /// @return 0 on success, -1 on failure 24 | int addJoint(const int index, const std::string& name); 25 | /// get body name from index 26 | /// @param index of the body 27 | /// @param body_name name of the body 28 | /// @return 0 on success, -1 on failure 29 | int getBodyName(const int index, std::string* name) const; 30 | /// get joint name from index 31 | /// @param index of the joint 32 | /// @param joint_name name of the joint 33 | /// @return 0 on success, -1 on failure 34 | int getJointName(const int index, std::string* name) const; 35 | /// get body index from name 36 | /// @param index of the body 37 | /// @param name name of the body 38 | /// @return 0 on success, -1 on failure 39 | int getBodyIndex(const std::string& name, int* index) const; 40 | /// get joint index from name 41 | /// @param index of the joint 42 | /// @param name name of the joint 43 | /// @return 0 on success, -1 on failure 44 | int getJointIndex(const std::string& name, int* index) const; 45 | 46 | private: 47 | std::map m_index_to_joint_name; 48 | std::map m_index_to_body_name; 49 | 50 | std::map m_joint_name_to_index; 51 | std::map m_body_name_to_index; 52 | }; 53 | } 54 | #endif // MULTIBODYNAMEMAP_HPP_ 55 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/InverseDynamics/MultiBodyTreeCreator.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MULTI_BODY_TREE_CREATOR_HPP_ 2 | #define MULTI_BODY_TREE_CREATOR_HPP_ 3 | 4 | #include 5 | #include 6 | #include "BulletInverseDynamics/IDConfig.hpp" 7 | #include "BulletInverseDynamics/IDMath.hpp" 8 | #include "BulletInverseDynamics/MultiBodyTree.hpp" 9 | #include "MultiBodyNameMap.hpp" 10 | 11 | namespace btInverseDynamics { 12 | /// Interface class for initializing a MultiBodyTree instance. 13 | /// Data to be provided is modeled on the URDF specification. 14 | /// The user can derive from this class in order to programmatically 15 | /// initialize a system. 16 | class MultiBodyTreeCreator { 17 | public: 18 | /// the dtor 19 | virtual ~MultiBodyTreeCreator() {} 20 | /// Get the number of bodies in the system 21 | /// @param num_bodies write number of bodies here 22 | /// @return 0 on success, -1 on error 23 | virtual int getNumBodies(int* num_bodies) const = 0; 24 | /// Interface for accessing link mass properties. 25 | /// For detailed description of data, @sa MultiBodyTree::addBody 26 | /// \copydoc MultiBodyTree::addBody 27 | virtual int getBody(const int body_index, int* parent_index, JointType* joint_type, 28 | vec3* parent_r_parent_body_ref, mat33* body_T_parent_ref, 29 | vec3* body_axis_of_motion, idScalar* mass, vec3* body_r_body_com, 30 | mat33* body_I_body, int* user_int, void** user_ptr) const = 0; 31 | /// @return a pointer to a name mapping utility class, or 0x0 if not available 32 | virtual const MultiBodyNameMap* getNameMap() const {return 0x0;} 33 | }; 34 | 35 | /// Create a multibody object. 36 | /// @param creator an object implementing the MultiBodyTreeCreator interface 37 | /// that returns data defining the system 38 | /// @return A pointer to an allocated multibodytree instance, or 39 | /// 0x0 if an error occured. 40 | MultiBodyTree* CreateMultiBodyTree(const MultiBodyTreeCreator& creator); 41 | } 42 | 43 | // does urdf have gravity direction ?? 44 | 45 | #endif // MULTI_BODY_TREE_CREATOR_HPP_ 46 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/InverseDynamics/MultiBodyTreeDebugGraph.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MULTIBODYTREEDEBUGGRAPH_HPP_ 2 | #define MULTIBODYTREEDEBUGGRAPH_HPP_ 3 | #include "BulletInverseDynamics/IDConfig.hpp" 4 | #include "BulletInverseDynamics/MultiBodyTree.hpp" 5 | #include "MultiBodyNameMap.hpp" 6 | 7 | namespace btInverseDynamics { 8 | /// generate a dot-file of the multibody tree for generating a graph using graphviz' dot tool 9 | /// @param tree the multibody tree 10 | /// @param map to add names of links (if 0x0, no names will be added) 11 | /// @param filename name for the output file 12 | /// @return 0 on success, -1 on error 13 | int writeGraphvizDotFile(const MultiBodyTree* tree, const MultiBodyNameMap* map, 14 | const char* filename); 15 | } 16 | 17 | #endif // MULTIBODYTREEDEBUGGRAPH_HPP 18 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/InverseDynamics/RandomTreeCreator.hpp: -------------------------------------------------------------------------------- 1 | #ifndef RANDOMTREE_CREATOR_HPP_ 2 | #define RANDOMTREE_CREATOR_HPP_ 3 | 4 | #include "BulletInverseDynamics/IDConfig.hpp" 5 | #include "MultiBodyTreeCreator.hpp" 6 | 7 | namespace btInverseDynamics { 8 | /// Generate a random MultiBodyTree with fixed or floating base and fixed, prismatic or revolute 9 | /// joints 10 | /// Uses a pseudo random number generator seeded from a random device. 11 | class RandomTreeCreator : public MultiBodyTreeCreator { 12 | public: 13 | /// ctor 14 | /// @param max_bodies maximum number of bodies 15 | /// @param gravity gravitational acceleration 16 | /// @param use_seed if true, seed random number generator 17 | RandomTreeCreator(const int max_bodies, bool use_seed=false); 18 | ~RandomTreeCreator(); 19 | ///\copydoc MultiBodyTreeCreator::getNumBodies 20 | int getNumBodies(int* num_bodies) const; 21 | ///\copydoc MultiBodyTreeCreator::getBody 22 | int getBody(const int body_index, int* parent_index, JointType* joint_type, 23 | vec3* parent_r_parent_body_ref, mat33* body_T_parent_ref, vec3* body_axis_of_motion, 24 | idScalar* mass, vec3* body_r_body_com, mat33* body_I_body, int* user_int, 25 | void** user_ptr) const; 26 | 27 | private: 28 | int m_num_bodies; 29 | }; 30 | } 31 | #endif // RANDOMTREE_CREATOR_HPP_ 32 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/InverseDynamics/SimpleTreeCreator.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SIMPLETREECREATOR_HPP_ 2 | #define SIMPLETREECREATOR_HPP_ 3 | 4 | #include "MultiBodyTreeCreator.hpp" 5 | 6 | namespace btInverseDynamics { 7 | 8 | /// minimal "tree" (chain) 9 | class SimpleTreeCreator : public MultiBodyTreeCreator { 10 | public: 11 | /// ctor 12 | /// @param dim number of bodies 13 | SimpleTreeCreator(int dim); 14 | // dtor 15 | ~SimpleTreeCreator() {} 16 | ///\copydoc MultiBodyTreeCreator::getNumBodies 17 | int getNumBodies(int* num_bodies) const; 18 | ///\copydoc MultiBodyTreeCreator::getBody 19 | int getBody(const int body_index, int* parent_index, JointType* joint_type, 20 | vec3* parent_r_parent_body_ref, mat33* body_T_parent_ref, vec3* body_axis_of_motion, 21 | idScalar* mass, vec3* body_r_body_com, mat33* body_I_body, int* user_int, 22 | void** user_ptr) const; 23 | 24 | private: 25 | int m_num_bodies; 26 | idScalar m_mass; 27 | mat33 m_body_T_parent_ref; 28 | vec3 m_parent_r_parent_body_ref; 29 | vec3 m_body_r_body_com; 30 | mat33 m_body_I_body; 31 | vec3 m_axis; 32 | }; 33 | } 34 | #endif // SIMPLETREECREATOR_HPP_ 35 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/InverseDynamics/User2InternalIndex.hpp: -------------------------------------------------------------------------------- 1 | #ifndef USER2INTERNALINDEX_HPP 2 | #define USER2INTERNALINDEX_HPP 3 | #include 4 | #include 5 | 6 | #include "BulletInverseDynamics/IDConfig.hpp" 7 | 8 | namespace btInverseDynamics { 9 | 10 | /// Convert arbitrary indexing scheme to internal indexing 11 | /// used for MultiBodyTree 12 | class User2InternalIndex { 13 | public: 14 | /// Ctor 15 | User2InternalIndex(); 16 | /// add body to index maps 17 | /// @param body index of body to add (external) 18 | /// @param parent index of parent body (external) 19 | void addBody(const int body, const int parent); 20 | /// build mapping from external to internal indexing 21 | /// @return 0 on success, -1 on failure 22 | int buildMapping(); 23 | /// get internal index from external index 24 | /// @param user external (user) index 25 | /// @param internal pointer for storage of corresponding internal index 26 | /// @return 0 on success, -1 on failure 27 | int user2internal(const int user, int *internal) const; 28 | /// get internal index from external index 29 | /// @param user external (user) index 30 | /// @param internal pointer for storage of corresponding internal index 31 | /// @return 0 on success, -1 on failure 32 | int internal2user(const int internal, int *user) const; 33 | 34 | private: 35 | int findRoot(int index); 36 | void recurseIndexSets(const int user_body_index); 37 | bool m_map_built; 38 | std::map m_user_parent_index_map; 39 | std::map m_user_to_internal; 40 | std::map m_internal_to_user; 41 | std::map > m_user_child_indices; 42 | int m_current_index; 43 | }; 44 | } 45 | 46 | #endif // USER2INTERNALINDEX_HPP 47 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/InverseDynamics/btMultiBodyTreeCreator.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BTMULTIBODYTREECREATOR_HPP_ 2 | #define BTMULTIBODYTREECREATOR_HPP_ 3 | 4 | #include 5 | 6 | #include "BulletInverseDynamics/IDConfig.hpp" 7 | #include "MultiBodyTreeCreator.hpp" 8 | #include "BulletDynamics/Featherstone/btMultiBody.h" 9 | 10 | namespace btInverseDynamics { 11 | 12 | /// MultiBodyTreeCreator implementation for converting 13 | /// a btMultiBody forward dynamics model into a MultiBodyTree inverse dynamics model 14 | class btMultiBodyTreeCreator : public MultiBodyTreeCreator { 15 | public: 16 | /// ctor 17 | btMultiBodyTreeCreator(); 18 | /// dtor 19 | ~btMultiBodyTreeCreator() {} 20 | /// extract model data from a btMultiBody 21 | /// @param btmb pointer to btMultiBody to convert 22 | /// @param verbose if true, some information is printed 23 | /// @return -1 on error, 0 on success 24 | int createFromBtMultiBody(const btMultiBody *btmb, const bool verbose = false); 25 | /// \copydoc MultiBodyTreeCreator::getNumBodies 26 | int getNumBodies(int *num_bodies) const; 27 | ///\copydoc MultiBodyTreeCreator::getBody 28 | int getBody(const int body_index, int *parent_index, JointType *joint_type, 29 | vec3 *parent_r_parent_body_ref, mat33 *body_T_parent_ref, 30 | vec3 *body_axis_of_motion, idScalar *mass, vec3 *body_r_body_com, 31 | mat33 *body_I_body, int *user_int, void **user_ptr) const; 32 | 33 | private: 34 | // internal struct holding data extracted from btMultiBody 35 | struct LinkData { 36 | int parent_index; 37 | JointType joint_type; 38 | vec3 parent_r_parent_body_ref; 39 | mat33 body_T_parent_ref; 40 | vec3 body_axis_of_motion; 41 | idScalar mass; 42 | vec3 body_r_body_com; 43 | mat33 body_I_body; 44 | }; 45 | idArray::type m_data; 46 | bool m_initialized; 47 | }; 48 | } 49 | 50 | #endif // BTMULTIBODYTREECREATOR_HPP_ 51 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/InverseDynamics/invdyn_bullet_comparison.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INVDYN_BULLET_COMPARISON_HPP 2 | #define INVDYN_BULLET_COMPARISON_HPP 3 | 4 | #include "BulletInverseDynamics/IDConfig.hpp" 5 | 6 | class btMultiBody; 7 | class btVector3; 8 | 9 | namespace btInverseDynamics { 10 | class MultiBodyTree; 11 | 12 | /// this function compares the forward dynamics computations implemented in btMultiBody to 13 | /// the inverse dynamics implementation in MultiBodyTree. This is done in three steps 14 | /// 1. run inverse dynamics for (q, u, dot_u) to obtain joint forces f 15 | /// 2. run forward dynamics (btMultiBody) for (q,u,f) to obtain dot_u_bullet 16 | /// 3. compare dot_u with dot_u_bullet for cross check of forward and inverse dynamics computations 17 | /// @param btmb the bullet forward dynamics model 18 | /// @param id_tree the inverse dynamics model 19 | /// @param q vector of generalized coordinates (matches id_tree) 20 | /// @param u vector of generalized speeds (matches id_tree) 21 | /// @param gravity gravitational acceleration in world frame 22 | /// @param dot_u vector of generalized accelerations (matches id_tree) 23 | /// @param gravity gravitational acceleration in world frame 24 | /// @param base_fixed set base joint to fixed or 25 | /// @param pos_error is set to the maximum of the euclidean norm of position+rotation errors of all 26 | /// center of gravity positions and link frames 27 | /// @param acc_error is set to the square root of the sum of squared differences of generalized 28 | /// accelerations 29 | /// computed in step 3 relative to dot_u 30 | /// @return -1 on error, 0 on success 31 | int compareInverseAndForwardDynamics(vecx &q, vecx &u, vecx &dot_u, btVector3 &gravity, bool verbose, 32 | btMultiBody *btmb, MultiBodyTree *id_tree, double *pos_error, 33 | double *acc_error); 34 | } 35 | #endif // INVDYN_BULLET_COMPARISON_HPP 36 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/extras/Serialize/BulletFileLoader/bCommon.h: -------------------------------------------------------------------------------- 1 | /* 2 | bParse 3 | Copyright (c) 2006-2009 Charlie C & Erwin Coumans http://gamekit.googlecode.com 4 | 5 | This software is provided 'as-is', without any express or implied warranty. 6 | In no event will the authors be held liable for any damages arising from the use of this software. 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it freely, 9 | subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 13 | 3. This notice may not be removed or altered from any source distribution. 14 | */ 15 | 16 | #ifndef __BCOMMON_H__ 17 | #define __BCOMMON_H__ 18 | 19 | 20 | #include 21 | //#include "bLog.h" 22 | #include "LinearMath/btAlignedObjectArray.h" 23 | #include "LinearMath/btHashMap.h" 24 | 25 | namespace bParse { 26 | 27 | class bMain; 28 | class bFileData; 29 | class bFile; 30 | class bDNA; 31 | 32 | // delete void* undefined 33 | typedef struct bStructHandle {int unused;}bStructHandle; 34 | typedef btAlignedObjectArray bListBasePtr; 35 | typedef btHashMap bPtrMap; 36 | } 37 | 38 | 39 | #endif//__BCOMMON_H__ 40 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/swig/dynamics/dynamics_wrap.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 3.0.11 4 | * 5 | * This file is not intended to be easily readable and contains a number of 6 | * coding conventions designed to improve portability and efficiency. Do not make 7 | * changes to this file unless you know what you are doing--modify the SWIG 8 | * interface file instead. 9 | * ----------------------------------------------------------------------------- */ 10 | 11 | #ifndef SWIG_Dynamics_WRAP_H_ 12 | #define SWIG_Dynamics_WRAP_H_ 13 | 14 | class SwigDirector_InternalTickCallback : public InternalTickCallback, public Swig::Director { 15 | 16 | public: 17 | void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); 18 | SwigDirector_InternalTickCallback(JNIEnv *jenv, btDynamicsWorld *dynamicsWorld = NULL, bool isPreTick = false); 19 | virtual void onInternalTick(btDynamicsWorld *dynamicsWorld, btScalar timeStep); 20 | public: 21 | bool swig_overrides(int n) { 22 | return (n < 1 ? swig_override[n] : false); 23 | } 24 | protected: 25 | Swig::BoolArray<1> swig_override; 26 | }; 27 | 28 | class SwigDirector_CustomActionInterface : public CustomActionInterface, public Swig::Director { 29 | 30 | public: 31 | void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global); 32 | SwigDirector_CustomActionInterface(JNIEnv *jenv); 33 | virtual ~SwigDirector_CustomActionInterface(); 34 | virtual void updateAction(btCollisionWorld *collisionWorld, btScalar timeStep); 35 | virtual void debugDraw(btIDebugDraw *debugDrawer); 36 | virtual void updateAction(btScalar timeStep); 37 | virtual void debugDraw(); 38 | public: 39 | bool swig_overrides(int n) { 40 | return (n < 2 ? swig_override[n] : false); 41 | } 42 | protected: 43 | Swig::BoolArray<2> swig_override; 44 | }; 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/swig/inversedynamics/inversedynamics_wrap.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 3.0.11 4 | * 5 | * This file is not intended to be easily readable and contains a number of 6 | * coding conventions designed to improve portability and efficiency. Do not make 7 | * changes to this file unless you know what you are doing--modify the SWIG 8 | * interface file instead. 9 | * ----------------------------------------------------------------------------- */ 10 | 11 | #ifndef SWIG_InverseDynamics_WRAP_H_ 12 | #define SWIG_InverseDynamics_WRAP_H_ 13 | 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/bullet/swig/softbody/softbody_wrap.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 3.0.11 4 | * 5 | * This file is not intended to be easily readable and contains a number of 6 | * coding conventions designed to improve portability and efficiency. Do not make 7 | * changes to this file unless you know what you are doing--modify the SWIG 8 | * interface file instead. 9 | * ----------------------------------------------------------------------------- */ 10 | 11 | #ifndef SWIG_Softbody_WRAP_H_ 12 | #define SWIG_Softbody_WRAP_H_ 13 | 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/project/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | project(SwitchGDX) 3 | 4 | if("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") 5 | include(uwp.cmake) 6 | elseif(${SWITCH}) 7 | include(switch.cmake) 8 | else() 9 | include(desktop.cmake) 10 | endif() 11 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/project/FindZZip.cmake: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------- 2 | # This file is part of the CMake build system for OGRE 3 | # (Object-oriented Graphics Rendering Engine) 4 | # For the latest info, see http://www.ogre3d.org/ 5 | # 6 | # The contents of this file are placed in the public domain. Feel 7 | # free to make use of it in any way you like. 8 | #------------------------------------------------------------------- 9 | 10 | # - Try to find zziplib 11 | # Once done, this will define 12 | # 13 | # ZZip_FOUND - system has ZZip 14 | # ZZip_INCLUDE_DIRS - the ZZip include directories 15 | # ZZip_LIBRARIES - link these to use ZZip 16 | 17 | include(FindPkgMacros) 18 | findpkg_begin(ZZip) 19 | 20 | # Get path, convert backslashes as ${ENV_${var}} 21 | getenv_path(ZZIP_HOME) 22 | 23 | 24 | # construct search paths 25 | set(ZZip_PREFIX_PATH ${ZZIP_HOME} ${ENV_ZZIP_HOME}) 26 | create_search_paths(ZZip) 27 | # redo search if prefix path changed 28 | clear_if_changed(ZZip_PREFIX_PATH 29 | ZZip_LIBRARY_FWK 30 | ZZip_LIBRARY_REL 31 | ZZip_LIBRARY_DBG 32 | ZZip_INCLUDE_DIR 33 | ) 34 | 35 | set(ZZip_LIBRARY_NAMES zzip zziplib) 36 | get_debug_names(ZZip_LIBRARY_NAMES) 37 | 38 | use_pkgconfig(ZZip_PKGC zziplib) 39 | 40 | findpkg_framework(ZZip) 41 | 42 | find_path(ZZip_INCLUDE_DIR NAMES zzip/zzip.h HINTS ${ZZip_INC_SEARCH_PATH} ${ZZip_PKGC_INCLUDE_DIRS}) 43 | 44 | find_library(ZZip_LIBRARY_REL NAMES ${ZZip_LIBRARY_NAMES} HINTS ${ZZip_LIB_SEARCH_PATH} ${ZZip_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel) 45 | find_library(ZZip_LIBRARY_DBG NAMES ${ZZip_LIBRARY_NAMES_DBG} HINTS ${ZZip_LIB_SEARCH_PATH} ${ZZip_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug) 46 | 47 | make_library_set(ZZip_LIBRARY) 48 | 49 | findpkg_finish(ZZip) 50 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/project/bin2s_header.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #include 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | 13 | extern const uint8_t @__HOMEBREW_BINARY_FILE@_end[]; 14 | 15 | extern const uint8_t @__HOMEBREW_BINARY_FILE@[]; 16 | 17 | extern const uint32_t @__HOMEBREW_BINARY_FILE@_size; 18 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/project/desktop.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | project(SwitchGDX) 3 | 4 | set(CMAKE_CXX_STANDARD 20) 5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-volatile") 6 | set(CMAKE_C_STANDARD 11) 7 | set(OpenGL_GL_PREFERENCE GLVND) 8 | 9 | SET(CMAKE_C_RESPONSE_FILE_LINK_FLAG "@") 10 | SET(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@") 11 | SET(CMAKE_NINJA_FORCE_RESPONSE_FILE 1 CACHE INTERNAL "") 12 | 13 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) 14 | 15 | include(FindPkgConfig) 16 | pkg_search_module(SDL2 REQUIRED sdl2) 17 | pkg_search_module(SDL2_mixer REQUIRED SDL2_mixer) 18 | find_package(OpenGL REQUIRED) 19 | find_package(ZLIB REQUIRED) 20 | find_package(Threads REQUIRED) 21 | find_package(Freetype REQUIRED) 22 | find_package(CURL REQUIRED) 23 | find_package(ZZip REQUIRED) 24 | find_package(FFI REQUIRED) 25 | 26 | add_definitions(-DNOJNI -DASMJIT_STATIC -DBT_NO_PROFILE -DBT_USE_INVERSE_DYNAMICS_WITH_BULLET2) 27 | 28 | file(GLOB_RECURSE SRCS src/*.cpp src/*.c) 29 | include_directories(src src/switchgdx/bullet/bullet src/switchgdx/bullet/custom src/switchgdx/bullet/extras/Serialize src/switchgdx/bullet/extras) 30 | add_executable(SwitchGDX ${SRCS}) 31 | 32 | target_compile_options(SwitchGDX PRIVATE -Wno-return-type) 33 | 34 | target_include_directories(SwitchGDX PUBLIC ${SDL2_INCLUDE_DIRS} ${SDL2_mixer_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} ${ZZip_INCLUDE_DIRS} ${FFI_INCLUDE_DIRS}) 35 | target_link_libraries(SwitchGDX ${SDL2_LIBRARIES} ${SDL2_mixer_LIBRARIES} ${OPENGL_LIBRARIES} ${ZLIB_LIBRARIES} stdc++fs ${FREETYPE_LIBRARIES} ${CURL_LIBRARIES} ${ZZip_LIBRARIES} ${FFI_LIBRARIES}) 36 | if(CMAKE_THREAD_LIBS_INIT) 37 | target_link_libraries(SwitchGDX "${CMAKE_THREAD_LIBS_INIT}") 38 | endif() 39 | if(WIN32) 40 | target_link_libraries(SwitchGDX wsock32 ws2_32) 41 | endif() 42 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/project/switch.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1) 2 | 3 | get_filename_component(PROJECT_NAME ${CMAKE_SOURCE_DIR} NAME) 4 | 5 | project(${PROJECT_NAME}) 6 | 7 | set(CMAKE_CXX_STANDARD 20) 8 | set(CMAKE_C_STANDARD 11) 9 | 10 | SET(CMAKE_C_RESPONSE_FILE_LINK_FLAG "@") 11 | SET(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@") 12 | set(CMAKE_ASM_USE_RESPONSE_FILE_FOR_OBJECTS 1) 13 | set(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) 14 | set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) 15 | 16 | set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}) 17 | include(SwitchTools) 18 | 19 | add_definitions(-DNOJNI -DEGL_NO_X11 -D_REENTRANT -DASMJIT_STATIC -DBT_NO_PROFILE -DBT_USE_INVERSE_DYNAMICS_WITH_BULLET2) 20 | 21 | file(GLOB_RECURSE SRCS src/*.cpp src/*.c) 22 | include_directories(src src/switchgdx/bullet/bullet src/switchgdx/bullet/custom src/switchgdx/bullet/extras/Serialize src/switchgdx/bullet/extras) 23 | add_executable(${PROJECT_NAME} ${SRCS}) 24 | 25 | target_compile_options(${PROJECT_NAME} PRIVATE -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-unused-label -Wno-unused-function) 26 | 27 | set_target_properties(${PROJECT_NAME} PROPERTIES 28 | APP_TITLE "$ENV{APP_TITLE}" 29 | APP_AUTHOR "$ENV{APP_AUTHOR}" 30 | APP_VERSION "$ENV{APP_VERSION}" 31 | ROMFS "${CMAKE_SOURCE_DIR}/romfs" 32 | ICON "${CMAKE_SOURCE_DIR}/icon.jpg") 33 | 34 | target_include_directories(${PROJECT_NAME} PUBLIC include ${DEVKITPRO}/libnx/include ${PORTLIBS}/include ${PORTLIBS}/include/freetype2 ${PORTLIBS}/include/SDL2) 35 | target_link_libraries(${PROJECT_NAME} -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec -fPIE -L${DEVKITPRO}/libnx/lib -L${PORTLIBS}/lib 36 | -lglad -lEGL -lglapi -ldrm_nouveau -lcurl -lzzip -lSDL2_mixer -lSDL2 -lvorbisidec -lvorbis -lmodplug -logg -lopusfile -lopus -lmpg123 -lpthread -lfreetype 37 | -lz -lbz2 -lpng -lnx -lffi -lstdc++ -lm) 38 | 39 | add_nro_target(${PROJECT_NAME}) 40 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/project/uwp.cmd: -------------------------------------------------------------------------------- 1 | if not defined DevEnvDir ( 2 | call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" 3 | ) 4 | cmake -B build-uwp -G "Visual Studio 17 2022" -S . -DVCPKG_ROOT="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\vcpkg" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" 5 | cmake --open build-uwp 6 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/project/vcpkg-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json", 3 | "default-registry": { 4 | "kind": "git", 5 | "baseline": "7476f0d4e77d3333fbb249657df8251c28c4faae", 6 | "repository": "https://github.com/microsoft/vcpkg" 7 | }, 8 | "overlay-triplets": [ "x64-uwp" ] 9 | } 10 | -------------------------------------------------------------------------------- /switch-gdx/res/switchgdx/project/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", 3 | "dependencies": [ 4 | "angle", 5 | "sdl2", 6 | "sdl2-mixer", 7 | "libffi", 8 | "curl", 9 | "freetype", 10 | "zziplib", 11 | "zlib", 12 | "libvorbis", 13 | "libogg", 14 | "mpg123" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /switch-gdx/src/com/badlogic/gdx/utils/ReflectionPool.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011 See AUTHORS file. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | ******************************************************************************/ 16 | 17 | package com.badlogic.gdx.utils; 18 | 19 | public class ReflectionPool extends Pool { 20 | private final Class type; 21 | 22 | public ReflectionPool (Class type) { 23 | this(type, 16, Integer.MAX_VALUE); 24 | } 25 | 26 | public ReflectionPool (Class type, int initialCapacity) { 27 | this(type, initialCapacity, Integer.MAX_VALUE); 28 | } 29 | 30 | public ReflectionPool (Class type, int initialCapacity, int max) { 31 | super(initialCapacity, max); 32 | this.type = type; 33 | } 34 | 35 | protected T newObject () { 36 | try { 37 | return (T)type.newInstance(); 38 | } catch (Exception ex) { 39 | throw new GdxRuntimeException("Unable to create new instance: " + type.getName(), ex); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /switch-gdx/src/com/badlogic/gdx/utils/async/AsyncResult.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011 See AUTHORS file. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | ******************************************************************************/ 16 | 17 | package com.badlogic.gdx.utils.async; 18 | 19 | /** Returned by {@link AsyncExecutor#submit(AsyncTask)}, allows to poll for the result of the asynch workload. 20 | * @author badlogic */ 21 | public class AsyncResult { 22 | private final T result; 23 | 24 | AsyncResult (T result) { 25 | this.result = result; 26 | } 27 | 28 | /** @return whether the {@link AsyncTask} is done */ 29 | public boolean isDone () { 30 | return true; 31 | } 32 | 33 | /** @return the result, or null if there was an error, no result, or the task is still running */ 34 | public T get () { 35 | return result; 36 | } 37 | } -------------------------------------------------------------------------------- /switch-gdx/src/com/badlogic/gdx/utils/async/AsyncTask.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011 See AUTHORS file. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | ******************************************************************************/ 16 | 17 | package com.badlogic.gdx.utils.async; 18 | 19 | /** Task to be submitted to an {@link AsyncExecutor}, returning a result of type T. 20 | * @author badlogic */ 21 | public interface AsyncTask { 22 | public T call () throws Exception; 23 | } -------------------------------------------------------------------------------- /switch-gdx/src/com/thelogicmaster/switchgdx/SwitchAudioDevice.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.switchgdx; 2 | 3 | import com.badlogic.gdx.audio.AudioDevice; 4 | 5 | public class SwitchAudioDevice implements AudioDevice { 6 | 7 | private final int rate; 8 | private final boolean mono; 9 | private long handle; 10 | 11 | public SwitchAudioDevice(int rate, boolean mono) { 12 | this.rate = rate; 13 | this.mono = mono; 14 | handle = create(rate, mono); 15 | } 16 | 17 | @Override 18 | public boolean isMono() { 19 | return mono; 20 | } 21 | 22 | @Override 23 | public void writeSamples(short[] shorts, int index, int length) { 24 | float[] samples = new float[length]; 25 | for (int i = 0; i < length; i++) 26 | samples[i] = shorts[index + i] / (float)Short.MAX_VALUE; 27 | sample(samples, 0, length); 28 | } 29 | 30 | @Override 31 | public void writeSamples(float[] floats, int index, int length) { 32 | sample(floats, index, length); 33 | } 34 | 35 | @Override 36 | public int getLatency() { 37 | return 0; 38 | } 39 | 40 | @Override 41 | public void setVolume(float v) { 42 | } 43 | 44 | @Override 45 | public void pause() { 46 | } 47 | 48 | @Override 49 | public void resume() { 50 | } 51 | 52 | @Override 53 | public void dispose() { 54 | if (handle == 0) return; 55 | dispose(handle); 56 | handle = 0; 57 | } 58 | 59 | @Override 60 | protected void finalize() { 61 | dispose(); 62 | } 63 | 64 | private static native long create(int rate, boolean mono); 65 | 66 | private static native void sample(float[] samples, int index, int length); 67 | 68 | private static native void dispose(long handle); 69 | } 70 | -------------------------------------------------------------------------------- /switch-gdx/src/com/thelogicmaster/switchgdx/SwitchControllerMapping.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.switchgdx; 2 | 3 | import com.badlogic.gdx.controllers.ControllerMapping; 4 | 5 | public class SwitchControllerMapping extends ControllerMapping { 6 | 7 | private static SwitchControllerMapping instance; 8 | 9 | private SwitchControllerMapping () { 10 | super(0, 1, 2, 3, 0, 1, 2, 3, 11, 10, 6, 8, 7, 9, 4, 5, 13, 15, 12, 14); 11 | } 12 | 13 | static SwitchControllerMapping getInstance() { 14 | if (instance == null) 15 | instance = new SwitchControllerMapping(); 16 | return instance; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /switch-gdx/src/com/thelogicmaster/switchgdx/SwitchFileHandle.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.switchgdx; 2 | 3 | import com.badlogic.gdx.Files; 4 | import com.badlogic.gdx.Gdx; 5 | import com.badlogic.gdx.files.FileHandle; 6 | import com.badlogic.gdx.utils.GdxRuntimeException; 7 | 8 | import java.io.File; 9 | import java.nio.ByteBuffer; 10 | import java.nio.channels.FileChannel; 11 | 12 | public class SwitchFileHandle extends FileHandle { 13 | 14 | public SwitchFileHandle (String fileName, Files.FileType type) { 15 | super(fileName, type); 16 | } 17 | 18 | public SwitchFileHandle (File file, Files.FileType type) { 19 | super(file, type); 20 | } 21 | 22 | @Override 23 | public FileHandle child (String name) { 24 | if (file.getPath().length() == 0) return new SwitchFileHandle(new File(name), type); 25 | return new SwitchFileHandle(new File(file, name), type); 26 | } 27 | 28 | @Override 29 | public FileHandle sibling (String name) { 30 | if (file.getPath().length() == 0) throw new GdxRuntimeException("Cannot get the sibling of the root."); 31 | return new SwitchFileHandle(new File(file.getParent(), name), type); 32 | } 33 | 34 | @Override 35 | public FileHandle parent () { 36 | File parent = file.getParentFile(); 37 | if (parent == null) { 38 | if (type == Files.FileType.Absolute) 39 | parent = new File("/"); 40 | else 41 | parent = new File(""); 42 | } 43 | return new SwitchFileHandle(parent, type); 44 | } 45 | 46 | @Override 47 | public File file () { 48 | if (type == Files.FileType.Internal) 49 | return new File(SwitchApplication.isSwitch ? "romfs:" : (SwitchApplication.isUWP ? "" : "romfs"), file.getPath()); 50 | if (type == Files.FileType.Local) 51 | return new File(Gdx.files.getLocalStoragePath(), file.getPath()); 52 | return super.file(); 53 | } 54 | 55 | @Override 56 | public boolean isDirectory() { 57 | if (path().startsWith("classpath/")) 58 | return false; 59 | return super.isDirectory(); 60 | } 61 | 62 | @Override 63 | public ByteBuffer map (FileChannel.MapMode mode) { 64 | throw new GdxRuntimeException("Cannot map files in Switch backend"); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /switch-gdx/src/com/thelogicmaster/switchgdx/SwitchFiles.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.switchgdx; 2 | 3 | import com.badlogic.gdx.Files; 4 | import com.badlogic.gdx.files.FileHandle; 5 | 6 | public class SwitchFiles implements Files { 7 | 8 | @Override 9 | public FileHandle getFileHandle (String path, FileType type) { 10 | if (type == FileType.Classpath) { 11 | type = FileType.Internal; 12 | path = "classpath/" + path; 13 | } 14 | return new SwitchFileHandle(path, type); 15 | } 16 | 17 | @Override 18 | public FileHandle classpath (String path) { 19 | return getFileHandle(path, FileType.Classpath); 20 | } 21 | 22 | @Override 23 | public FileHandle internal (String path) { 24 | return getFileHandle(path, FileType.Internal); 25 | } 26 | 27 | @Override 28 | public FileHandle external (String path) { 29 | return getFileHandle(path, FileType.External); 30 | } 31 | 32 | @Override 33 | public FileHandle absolute (String path) { 34 | return getFileHandle(path, FileType.Absolute); 35 | } 36 | 37 | @Override 38 | public FileHandle local (String path) { 39 | return getFileHandle(path, FileType.Local); 40 | } 41 | 42 | @Override 43 | public String getExternalStoragePath () { 44 | return SwitchApplication.isSwitch ? "sdmc:" : "sdmc"; 45 | } 46 | 47 | @Override 48 | public boolean isExternalStorageAvailable () { 49 | return true; 50 | } 51 | 52 | @Override 53 | public native String getLocalStoragePath (); 54 | 55 | @Override 56 | public boolean isLocalStorageAvailable () { 57 | return true; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /switch-gdx/src/com/thelogicmaster/switchgdx/SwitchHttpResponse.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.switchgdx; 2 | 3 | import com.badlogic.gdx.Net; 4 | import com.badlogic.gdx.net.HttpStatus; 5 | 6 | import java.io.ByteArrayInputStream; 7 | import java.io.InputStream; 8 | import java.util.ArrayList; 9 | import java.util.HashMap; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | public class SwitchHttpResponse implements Net.HttpResponse { 14 | 15 | private byte[] result; 16 | private int status; 17 | private final HashMap> headers = new HashMap<>(); 18 | private boolean cancelled; 19 | private Net.HttpResponseListener listener; 20 | 21 | public SwitchHttpResponse (Net.HttpResponseListener listener) { 22 | this.listener = listener; 23 | } 24 | 25 | @Override 26 | public byte[] getResult () { 27 | return result; 28 | } 29 | 30 | @Override 31 | public String getResultAsString () { 32 | if (result == null) 33 | return null; 34 | return new String(result); 35 | } 36 | 37 | @Override 38 | public InputStream getResultAsStream () { 39 | if (result == null) 40 | return null; 41 | return new ByteArrayInputStream(result); 42 | } 43 | 44 | @Override 45 | public HttpStatus getStatus () { 46 | return new HttpStatus(status); 47 | } 48 | 49 | @Override 50 | public String getHeader (String name) { 51 | if (headers.containsKey(name)) { 52 | List list = headers.get(name); 53 | return list.get(list.size() - 1); 54 | } 55 | return null; 56 | } 57 | 58 | @Override 59 | public Map> getHeaders () { 60 | return headers; 61 | } 62 | 63 | void cancel() { 64 | listener.cancelled(); 65 | cancelled = true; 66 | } 67 | 68 | public boolean isCancelled () { 69 | return cancelled; 70 | } 71 | 72 | private void addHeader(String name, String value) { 73 | if (!headers.containsKey(name)) 74 | headers.put(name, new ArrayList<>()); 75 | headers.get(name).add(value); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /switch-gdx/src/com/thelogicmaster/switchgdx/SwitchLogger.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.switchgdx; 2 | 3 | import com.badlogic.gdx.ApplicationLogger; 4 | 5 | public class SwitchLogger implements ApplicationLogger { 6 | 7 | @Override 8 | public void log (String tag, String message) { 9 | System.out.println(tag + ": " + message); 10 | } 11 | 12 | @Override 13 | public void log (String tag, String message, Throwable exception) { 14 | log(tag, message + ": " + exception); 15 | } 16 | 17 | @Override 18 | public void error (String tag, String message) { 19 | System.err.println(tag + ": " + message); 20 | } 21 | 22 | @Override 23 | public void error (String tag, String message, Throwable exception) { 24 | error(tag, message + ": " + exception); 25 | } 26 | 27 | @Override 28 | public void debug (String tag, String message) { 29 | System.out.println(tag + ": " + message); 30 | } 31 | 32 | @Override 33 | public void debug (String tag, String message, Throwable exception) { 34 | debug(tag, message + ": " + exception); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /switch-gdx/src/com/thelogicmaster/switchgdx/SwitchServerSocket.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.switchgdx; 2 | 3 | import com.badlogic.gdx.Net; 4 | import com.badlogic.gdx.net.ServerSocket; 5 | import com.badlogic.gdx.net.ServerSocketHints; 6 | import com.badlogic.gdx.net.Socket; 7 | import com.badlogic.gdx.net.SocketHints; 8 | import com.badlogic.gdx.utils.GdxRuntimeException; 9 | 10 | public class SwitchServerSocket implements ServerSocket { 11 | 12 | private final int fd; 13 | private final int acceptTimeout; 14 | 15 | public SwitchServerSocket (int port, ServerSocketHints hints) { 16 | if (hints == null) 17 | hints = new ServerSocketHints(); 18 | acceptTimeout = hints.acceptTimeout; 19 | fd = create(port, hints.reuseAddress); 20 | } 21 | 22 | @Override 23 | public Net.Protocol getProtocol () { 24 | return Net.Protocol.TCP; 25 | } 26 | 27 | @Override 28 | public Socket accept (SocketHints hints) { 29 | if (hints == null) 30 | hints = new SocketHints(); 31 | if (fd == 0) 32 | throw new GdxRuntimeException("Server socket closed"); 33 | return new SwitchSocket(accept(hints.socketTimeout)); 34 | } 35 | 36 | @Override 37 | public native void dispose (); 38 | 39 | private static native int create(int port, boolean reuseAddress); 40 | 41 | private native int accept(int timeout); 42 | } 43 | -------------------------------------------------------------------------------- /switch-gdx/src/com/thelogicmaster/switchgdx/SwitchSocket.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.switchgdx; 2 | 3 | import com.badlogic.gdx.net.Socket; 4 | import com.badlogic.gdx.net.SocketHints; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.io.OutputStream; 9 | 10 | public class SwitchSocket implements Socket { 11 | 12 | private boolean connected; 13 | private final int fd; 14 | private final SocketInputStream inputStream = new SocketInputStream(); 15 | private final SocketOutputStream outputStream = new SocketOutputStream(); 16 | 17 | public SwitchSocket (int fd) { 18 | this.fd = fd; 19 | connected = true; 20 | } 21 | 22 | public SwitchSocket (String host, int port, SocketHints hints) { 23 | if (hints == null) 24 | hints = new SocketHints(); 25 | this.fd = create(host, port, hints.connectTimeout, hints.socketTimeout); 26 | } 27 | 28 | @Override 29 | public boolean isConnected () { 30 | return connected; 31 | } 32 | 33 | @Override 34 | public InputStream getInputStream () { 35 | return inputStream; 36 | } 37 | 38 | @Override 39 | public OutputStream getOutputStream () { 40 | return outputStream; 41 | } 42 | 43 | @Override 44 | public native String getRemoteAddress (); 45 | 46 | @Override 47 | public native void dispose (); 48 | 49 | private static native int create (String host, int port, int connectTimeout, int timeout); 50 | 51 | private native int read (); 52 | 53 | private native void write (int b); 54 | 55 | class SocketInputStream extends InputStream { 56 | 57 | @Override 58 | public int read () throws IOException { 59 | return SwitchSocket.this.read(); 60 | } 61 | } 62 | 63 | class SocketOutputStream extends OutputStream { 64 | 65 | @Override 66 | public void write (int b) throws IOException { 67 | SwitchSocket.this.write(b); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | */build 2 | .idea 3 | .gradle 4 | build 5 | -------------------------------------------------------------------------------- /tests/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/tests/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /tests/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /tests/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SwitchGDX/switch-gdx/77691794eed0d5e88f5a5498220b7036a9de2302/tests/icon.jpg -------------------------------------------------------------------------------- /tests/src/main/java/com/thelogicmaster/test/GarbageCollectorTest.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.test; 2 | 3 | import com.badlogic.gdx.graphics.Color; 4 | import com.badlogic.gdx.tests.utils.GdxTest; 5 | import com.badlogic.gdx.utils.ScreenUtils; 6 | 7 | public class GarbageCollectorTest extends GdxTest { 8 | 9 | @Override 10 | public void create () { 11 | 12 | } 13 | 14 | @Override 15 | public void render () { 16 | ScreenUtils.clear(Color.BLACK); 17 | 18 | for (int i = 0; i < 1000; i++) { 19 | byte[] test = new byte[100000]; 20 | } 21 | } 22 | 23 | @Override 24 | public void dispose () { 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/src/main/java/com/thelogicmaster/test/SwitchControllerTest.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.test; 2 | 3 | import com.badlogic.gdx.controllers.Controller; 4 | import com.badlogic.gdx.controllers.Controllers; 5 | import com.badlogic.gdx.graphics.Color; 6 | import com.badlogic.gdx.graphics.g2d.BitmapFont; 7 | import com.badlogic.gdx.graphics.g2d.SpriteBatch; 8 | import com.badlogic.gdx.graphics.glutils.ShapeRenderer; 9 | import com.badlogic.gdx.math.Vector2; 10 | import com.badlogic.gdx.tests.utils.GdxTest; 11 | import com.badlogic.gdx.utils.Array; 12 | import com.badlogic.gdx.utils.ScreenUtils; 13 | 14 | public class SwitchControllerTest extends GdxTest { 15 | 16 | private ShapeRenderer shapeRenderer; 17 | private BitmapFont font; 18 | private SpriteBatch batch; 19 | private final Vector2[] positions = new Vector2[8]; 20 | private final static Color[] COLORS = {Color.BROWN, Color.BLUE, Color.RED, Color.CHARTREUSE, Color.CORAL, Color.GRAY, Color.GREEN, Color.FIREBRICK}; 21 | 22 | @Override 23 | public void create () { 24 | shapeRenderer = new ShapeRenderer(); 25 | shapeRenderer.setAutoShapeType(true); 26 | font = new BitmapFont(); 27 | font.setColor(Color.CYAN); 28 | batch = new SpriteBatch(); 29 | 30 | for (int i = 0; i < 8; i++) 31 | positions[i] = new Vector2(300 + 50 * i, 300); 32 | } 33 | 34 | @Override 35 | public void render () { 36 | ScreenUtils.clear(Color.BLACK); 37 | 38 | Array controllers = Controllers.getControllers(); 39 | 40 | batch.begin(); 41 | font.draw(batch, "Controllers: " + controllers.size, 50, 50); 42 | batch.end(); 43 | 44 | shapeRenderer.begin(); 45 | 46 | shapeRenderer.set(ShapeRenderer.ShapeType.Line); 47 | for (int i = 0; i < controllers.size; i++) { 48 | shapeRenderer.setColor(COLORS[i]); 49 | Vector2 position = positions[i]; 50 | Controller controller = controllers.get(i); 51 | 52 | position.x += controller.getAxis(0); 53 | position.y -= controller.getAxis(1); 54 | 55 | shapeRenderer.circle(position.x, position.y, 10); 56 | } 57 | 58 | shapeRenderer.end(); 59 | } 60 | 61 | @Override 62 | public void dispose () { 63 | shapeRenderer.dispose(); 64 | font.dispose(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /tests/src/main/java/com/thelogicmaster/test/SwitchLauncher.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.test; 2 | 3 | import com.thelogicmaster.switchgdx.SwitchApplication; 4 | 5 | public class SwitchLauncher { 6 | 7 | public static void main (String[] arg) { 8 | new SwitchApplication(new SwitchTestWrapper()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/switch.json: -------------------------------------------------------------------------------- 1 | { 2 | "mainClass": "com.thelogicmaster.test.SwitchLauncher", 3 | "reflective": [ 4 | "com.badlogic.gdx.tests.JsonTest$*", 5 | "com.badlogic.gdx.tests.AnnotationTest$*", 6 | "com.badlogic.gdx.tests.ReflectionCorrectnessTest$*", 7 | "com.badlogic.gdx.tests.AbstractTestWrapper", 8 | "com.badlogic.gdx.utils.*Array", 9 | "com.badlogic.gdx.utils.*Set", 10 | "com.badlogic.gdx.utils.*Map" 11 | ], 12 | "jniClasses": ["com.badlogic.gdx.physics.bullet.**JNI"], 13 | "useStackTraces": true, 14 | "useLineNumbers": true, 15 | "useValueChecks": true, 16 | "useStackCookies": true, 17 | "useLeakCheck": false 18 | } 19 | --------------------------------------------------------------------------------