├── README ├── build.xml ├── changelog.txt ├── dist ├── javadoc │ ├── allclasses-frame.html │ ├── allclasses-noframe.html │ ├── com │ │ └── bulletphysics │ │ │ ├── BulletGlobals.html │ │ │ ├── BulletStats.html │ │ │ ├── ContactAddedCallback.html │ │ │ ├── ContactDestroyedCallback.html │ │ │ ├── ContactProcessedCallback.html │ │ │ ├── collision │ │ │ ├── broadphase │ │ │ │ ├── AxisSweep3.html │ │ │ │ ├── AxisSweep3Internal.html │ │ │ │ ├── AxisSweep3_32.html │ │ │ │ ├── BroadphaseInterface.html │ │ │ │ ├── BroadphaseNativeType.html │ │ │ │ ├── BroadphasePair.html │ │ │ │ ├── BroadphaseProxy.html │ │ │ │ ├── CollisionAlgorithm.html │ │ │ │ ├── CollisionAlgorithmConstructionInfo.html │ │ │ │ ├── CollisionFilterGroups.html │ │ │ │ ├── Dbvt.IClone.html │ │ │ │ ├── Dbvt.ICollide.html │ │ │ │ ├── Dbvt.IWriter.html │ │ │ │ ├── Dbvt.Node.html │ │ │ │ ├── Dbvt.html │ │ │ │ ├── Dbvt.sStkCLN.html │ │ │ │ ├── Dbvt.sStkNN.html │ │ │ │ ├── Dbvt.sStkNP.html │ │ │ │ ├── Dbvt.sStkNPS.html │ │ │ │ ├── DbvtAabbMm.html │ │ │ │ ├── DbvtBroadphase.html │ │ │ │ ├── DbvtLeafCollider.html │ │ │ │ ├── DbvtProxy.html │ │ │ │ ├── DbvtTreeCollider.html │ │ │ │ ├── DispatchFunc.html │ │ │ │ ├── Dispatcher.html │ │ │ │ ├── DispatcherInfo.html │ │ │ │ ├── HashedOverlappingPairCache.html │ │ │ │ ├── OverlapCallback.html │ │ │ │ ├── OverlapFilterCallback.html │ │ │ │ ├── OverlappingPairCache.html │ │ │ │ ├── OverlappingPairCallback.html │ │ │ │ ├── SimpleBroadphase.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── dispatch │ │ │ │ ├── CollisionAlgorithmCreateFunc.html │ │ │ │ ├── CollisionConfiguration.html │ │ │ │ ├── CollisionDispatcher.html │ │ │ │ ├── CollisionFlags.html │ │ │ │ ├── CollisionObject.html │ │ │ │ ├── CollisionObjectType.html │ │ │ │ ├── CollisionWorld.ClosestConvexResultCallback.html │ │ │ │ ├── CollisionWorld.ClosestRayResultCallback.html │ │ │ │ ├── CollisionWorld.ConvexResultCallback.html │ │ │ │ ├── CollisionWorld.LocalConvexResult.html │ │ │ │ ├── CollisionWorld.LocalRayResult.html │ │ │ │ ├── CollisionWorld.LocalShapeInfo.html │ │ │ │ ├── CollisionWorld.RayResultCallback.html │ │ │ │ ├── CollisionWorld.html │ │ │ │ ├── CompoundCollisionAlgorithm.CreateFunc.html │ │ │ │ ├── CompoundCollisionAlgorithm.SwappedCreateFunc.html │ │ │ │ ├── CompoundCollisionAlgorithm.html │ │ │ │ ├── ConvexConcaveCollisionAlgorithm.CreateFunc.html │ │ │ │ ├── ConvexConcaveCollisionAlgorithm.SwappedCreateFunc.html │ │ │ │ ├── ConvexConcaveCollisionAlgorithm.html │ │ │ │ ├── ConvexConvexAlgorithm.CreateFunc.html │ │ │ │ ├── ConvexConvexAlgorithm.html │ │ │ │ ├── ConvexPlaneCollisionAlgorithm.CreateFunc.html │ │ │ │ ├── ConvexPlaneCollisionAlgorithm.html │ │ │ │ ├── DefaultCollisionConfiguration.html │ │ │ │ ├── DefaultNearCallback.html │ │ │ │ ├── EmptyAlgorithm.CreateFunc.html │ │ │ │ ├── EmptyAlgorithm.html │ │ │ │ ├── GhostObject.html │ │ │ │ ├── GhostPairCallback.html │ │ │ │ ├── ManifoldResult.html │ │ │ │ ├── NearCallback.html │ │ │ │ ├── PairCachingGhostObject.html │ │ │ │ ├── SimulationIslandManager.IslandCallback.html │ │ │ │ ├── SimulationIslandManager.html │ │ │ │ ├── SphereSphereCollisionAlgorithm.CreateFunc.html │ │ │ │ ├── SphereSphereCollisionAlgorithm.html │ │ │ │ ├── UnionFind.Element.html │ │ │ │ ├── UnionFind.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── narrowphase │ │ │ │ ├── ConvexCast.CastResult.html │ │ │ │ ├── ConvexCast.html │ │ │ │ ├── ConvexPenetrationDepthSolver.html │ │ │ │ ├── DiscreteCollisionDetectorInterface.ClosestPointInput.html │ │ │ │ ├── DiscreteCollisionDetectorInterface.Result.html │ │ │ │ ├── DiscreteCollisionDetectorInterface.html │ │ │ │ ├── GjkConvexCast.html │ │ │ │ ├── GjkEpaPenetrationDepthSolver.html │ │ │ │ ├── GjkEpaSolver.Face.html │ │ │ │ ├── GjkEpaSolver.He.html │ │ │ │ ├── GjkEpaSolver.Mkv.html │ │ │ │ ├── GjkEpaSolver.Results.html │ │ │ │ ├── GjkEpaSolver.ResultsStatus.html │ │ │ │ ├── GjkEpaSolver.html │ │ │ │ ├── GjkPairDetector.html │ │ │ │ ├── ManifoldPoint.html │ │ │ │ ├── PersistentManifold.html │ │ │ │ ├── PointCollector.html │ │ │ │ ├── SimplexSolverInterface.html │ │ │ │ ├── SubsimplexConvexCast.html │ │ │ │ ├── TriangleConvexcastCallback.html │ │ │ │ ├── TriangleRaycastCallback.html │ │ │ │ ├── VoronoiSimplexSolver.SubSimplexClosestResult.html │ │ │ │ ├── VoronoiSimplexSolver.UsageBitfield.html │ │ │ │ ├── VoronoiSimplexSolver.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ └── shapes │ │ │ │ ├── BU_Simplex1to4.html │ │ │ │ ├── BoxShape.html │ │ │ │ ├── BvhSubtreeInfo.html │ │ │ │ ├── BvhTriangleMeshShape.html │ │ │ │ ├── ByteBufferVertexData.html │ │ │ │ ├── CapsuleShape.html │ │ │ │ ├── CapsuleShapeX.html │ │ │ │ ├── CapsuleShapeZ.html │ │ │ │ ├── CollisionShape.html │ │ │ │ ├── CompoundShape.html │ │ │ │ ├── CompoundShapeChild.html │ │ │ │ ├── ConcaveShape.html │ │ │ │ ├── ConeShape.html │ │ │ │ ├── ConeShapeX.html │ │ │ │ ├── ConeShapeZ.html │ │ │ │ ├── ConvexHullShape.html │ │ │ │ ├── ConvexInternalShape.html │ │ │ │ ├── ConvexShape.html │ │ │ │ ├── CylinderShape.html │ │ │ │ ├── CylinderShapeX.html │ │ │ │ ├── CylinderShapeZ.html │ │ │ │ ├── IndexedMesh.html │ │ │ │ ├── InternalTriangleIndexCallback.html │ │ │ │ ├── MinkowskiSumShape.html │ │ │ │ ├── NodeOverlapCallback.html │ │ │ │ ├── OptimizedBvh.html │ │ │ │ ├── OptimizedBvhNode.html │ │ │ │ ├── PolyhedralConvexShape.html │ │ │ │ ├── QuantizedBvhNodes.html │ │ │ │ ├── ScalarType.html │ │ │ │ ├── ScaledBvhTriangleMeshShape.html │ │ │ │ ├── ShapeHull.html │ │ │ │ ├── SphereShape.html │ │ │ │ ├── StaticPlaneShape.html │ │ │ │ ├── StridingMeshInterface.html │ │ │ │ ├── TraversalMode.html │ │ │ │ ├── TriangleCallback.html │ │ │ │ ├── TriangleIndexVertexArray.html │ │ │ │ ├── TriangleMeshShape.html │ │ │ │ ├── TriangleShape.html │ │ │ │ ├── UniformScalingShape.html │ │ │ │ ├── VertexData.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── dynamics │ │ │ ├── ActionInterface.html │ │ │ ├── DiscreteDynamicsWorld.html │ │ │ ├── DynamicsWorld.html │ │ │ ├── DynamicsWorldType.html │ │ │ ├── InternalTickCallback.html │ │ │ ├── RigidBody.html │ │ │ ├── RigidBodyConstructionInfo.html │ │ │ ├── SimpleDynamicsWorld.html │ │ │ ├── character │ │ │ │ ├── KinematicCharacterController.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── constraintsolver │ │ │ │ ├── ConeTwistConstraint.html │ │ │ │ ├── ConstraintPersistentData.html │ │ │ │ ├── ConstraintSolver.html │ │ │ │ ├── ContactConstraint.html │ │ │ │ ├── ContactSolverFunc.html │ │ │ │ ├── ContactSolverInfo.html │ │ │ │ ├── Generic6DofConstraint.html │ │ │ │ ├── HingeConstraint.html │ │ │ │ ├── JacobianEntry.html │ │ │ │ ├── Point2PointConstraint.ConstraintSetting.html │ │ │ │ ├── Point2PointConstraint.html │ │ │ │ ├── RotationalLimitMotor.html │ │ │ │ ├── SequentialImpulseConstraintSolver.html │ │ │ │ ├── SliderConstraint.html │ │ │ │ ├── SolverBody.html │ │ │ │ ├── SolverConstraint.html │ │ │ │ ├── SolverConstraintType.html │ │ │ │ ├── SolverMode.html │ │ │ │ ├── TranslationalLimitMotor.html │ │ │ │ ├── TypedConstraint.html │ │ │ │ ├── TypedConstraintType.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── vehicle │ │ │ │ ├── DefaultVehicleRaycaster.html │ │ │ │ ├── RaycastVehicle.html │ │ │ │ ├── VehicleRaycaster.html │ │ │ │ ├── VehicleRaycasterResult.html │ │ │ │ ├── VehicleTuning.html │ │ │ │ ├── WheelInfo.RaycastInfo.html │ │ │ │ ├── WheelInfo.html │ │ │ │ ├── WheelInfoConstructionInfo.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── extras │ │ │ └── gimpact │ │ │ │ ├── GImpactCollisionAlgorithm.CreateFunc.html │ │ │ │ ├── GImpactCollisionAlgorithm.html │ │ │ │ ├── GImpactMeshShape.html │ │ │ │ ├── GImpactMeshShapePart.html │ │ │ │ ├── GImpactShapeInterface.html │ │ │ │ ├── PrimitiveTriangle.html │ │ │ │ ├── TriangleContact.html │ │ │ │ ├── TriangleShapeEx.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── linearmath │ │ │ ├── AabbUtil2.html │ │ │ ├── CProfileIterator.html │ │ │ ├── CProfileManager.html │ │ │ ├── Clock.html │ │ │ ├── DebugDrawModes.html │ │ │ ├── DefaultMotionState.html │ │ │ ├── GeometryUtil.html │ │ │ ├── IDebugDraw.html │ │ │ ├── MatrixUtil.html │ │ │ ├── MiscUtil.html │ │ │ ├── MotionState.html │ │ │ ├── QuaternionUtil.html │ │ │ ├── ScalarUtil.html │ │ │ ├── Transform.html │ │ │ ├── TransformUtil.html │ │ │ ├── VectorUtil.html │ │ │ ├── convexhull │ │ │ │ ├── HullDesc.html │ │ │ │ ├── HullFlags.html │ │ │ │ ├── HullLibrary.html │ │ │ │ ├── HullResult.html │ │ │ │ ├── package-frame.html │ │ │ │ ├── package-summary.html │ │ │ │ └── package-tree.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ ├── package-tree.html │ │ │ └── util │ │ │ ├── ArrayPool.html │ │ │ ├── FloatArrayList.html │ │ │ ├── IntArrayList.html │ │ │ ├── ObjectArrayList.html │ │ │ ├── ObjectPool.html │ │ │ ├── ObjectStackList.html │ │ │ ├── StackList.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ ├── constant-values.html │ ├── deprecated-list.html │ ├── help-doc.html │ ├── index-all.html │ ├── index.html │ ├── overview-frame.html │ ├── overview-summary.html │ ├── overview-tree.html │ ├── package-list │ ├── resources │ │ └── inherit.gif │ ├── serialized-form.html │ └── stylesheet.css ├── jbullet-demos.jar └── jbullet.jar ├── lib ├── ASM3.1 │ ├── asm-all-3.1.jar │ └── src.zip ├── javadoc │ ├── jdk │ │ └── package-list │ └── vecmath │ │ └── package-list ├── jstackalloc │ ├── jstackalloc-20080716.zip │ ├── stack-alloc-javadoc.zip │ └── stack-alloc.jar ├── lwjgl │ ├── jinput.jar │ ├── linux │ │ ├── libjinput-linux.so │ │ ├── libjinput-linux64.so │ │ ├── liblwjgl.so │ │ ├── liblwjgl64.so │ │ └── libopenal.so │ ├── lwjgl.jar │ ├── lwjgl_util.jar │ ├── macosx │ │ ├── libjinput-osx.jnilib │ │ ├── liblwjgl.jnilib │ │ └── openal.dylib │ └── win32 │ │ ├── OpenAL32.dll │ │ ├── jinput-dx8.dll │ │ ├── jinput-raw.dll │ │ └── lwjgl.dll ├── nblibraries.properties ├── swing-layout │ └── swing-layout-1.0.3.jar └── vecmath │ └── vecmath.jar ├── nbproject ├── build-impl.xml ├── configs │ ├── AppletDemo.properties │ ├── BasicDemo.properties │ ├── BspDemo.properties │ ├── CharacterDemo.properties │ ├── ConcaveConvexcastDemo.properties │ ├── ConcaveDemo.properties │ ├── DynamicControlDemo.properties │ ├── ForkLiftDemo.properties │ ├── GenericJointDemo.properties │ ├── HelloWorldDemo.properties │ ├── MovingConcaveDemo.properties │ └── VehicleDemo.properties ├── genfiles.properties ├── profiler-build-impl.xml ├── project.properties └── project.xml ├── porting_status.txt └── src └── com └── bulletphysics ├── BulletGlobals.java ├── BulletStats.java ├── ContactAddedCallback.java ├── ContactDestroyedCallback.java ├── ContactProcessedCallback.java ├── collision ├── broadphase │ ├── AxisSweep3.java │ ├── AxisSweep3Internal.java │ ├── AxisSweep3_32.java │ ├── BroadphaseInterface.java │ ├── BroadphaseNativeType.java │ ├── BroadphasePair.java │ ├── BroadphaseProxy.java │ ├── CollisionAlgorithm.java │ ├── CollisionAlgorithmConstructionInfo.java │ ├── CollisionFilterGroups.java │ ├── Dbvt.java │ ├── DbvtAabbMm.java │ ├── DbvtBroadphase.java │ ├── DbvtLeafCollider.java │ ├── DbvtProxy.java │ ├── DbvtTreeCollider.java │ ├── DispatchFunc.java │ ├── Dispatcher.java │ ├── DispatcherInfo.java │ ├── HashedOverlappingPairCache.java │ ├── OverlapCallback.java │ ├── OverlapFilterCallback.java │ ├── OverlappingPairCache.java │ ├── OverlappingPairCallback.java │ ├── SimpleBroadphase.java │ ├── SimpleBroadphaseProxy.java │ └── package-info.java ├── dispatch │ ├── CollisionAlgorithmCreateFunc.java │ ├── CollisionConfiguration.java │ ├── CollisionDispatcher.java │ ├── CollisionFlags.java │ ├── CollisionObject.java │ ├── CollisionObjectType.java │ ├── CollisionWorld.java │ ├── CompoundCollisionAlgorithm.java │ ├── ConvexConcaveCollisionAlgorithm.java │ ├── ConvexConvexAlgorithm.java │ ├── ConvexPlaneCollisionAlgorithm.java │ ├── ConvexTriangleCallback.java │ ├── DefaultCollisionConfiguration.java │ ├── DefaultNearCallback.java │ ├── EmptyAlgorithm.java │ ├── GhostObject.java │ ├── GhostPairCallback.java │ ├── ManifoldResult.java │ ├── NearCallback.java │ ├── PairCachingGhostObject.java │ ├── SimulationIslandManager.java │ ├── SphereSphereCollisionAlgorithm.java │ ├── UnionFind.java │ └── package-info.java ├── narrowphase │ ├── ConvexCast.java │ ├── ConvexPenetrationDepthSolver.java │ ├── DiscreteCollisionDetectorInterface.java │ ├── GjkConvexCast.java │ ├── GjkEpaPenetrationDepthSolver.java │ ├── GjkEpaSolver.java │ ├── GjkPairDetector.java │ ├── ManifoldPoint.java │ ├── PersistentManifold.java │ ├── PointCollector.java │ ├── SimplexSolverInterface.java │ ├── SubsimplexConvexCast.java │ ├── TriangleConvexcastCallback.java │ ├── TriangleRaycastCallback.java │ ├── VoronoiSimplexSolver.java │ └── package-info.java └── shapes │ ├── BU_Simplex1to4.java │ ├── BoxShape.java │ ├── BvhSubtreeInfo.java │ ├── BvhTriangleMeshShape.java │ ├── ByteBufferVertexData.java │ ├── CapsuleShape.java │ ├── CapsuleShapeX.java │ ├── CapsuleShapeZ.java │ ├── CollisionShape.java │ ├── CompoundShape.java │ ├── CompoundShapeChild.java │ ├── ConcaveShape.java │ ├── ConeShape.java │ ├── ConeShapeX.java │ ├── ConeShapeZ.java │ ├── ConvexHullShape.java │ ├── ConvexInternalShape.java │ ├── ConvexShape.java │ ├── CylinderShape.java │ ├── CylinderShapeX.java │ ├── CylinderShapeZ.java │ ├── IndexedMesh.java │ ├── InternalTriangleIndexCallback.java │ ├── MinkowskiSumShape.java │ ├── NodeOverlapCallback.java │ ├── OptimizedBvh.java │ ├── OptimizedBvhNode.java │ ├── PolyhedralConvexShape.java │ ├── QuantizedBvhNodes.java │ ├── ScalarType.java │ ├── ScaledBvhTriangleMeshShape.java │ ├── ShapeHull.java │ ├── SphereShape.java │ ├── StaticPlaneShape.java │ ├── StridingMeshInterface.java │ ├── TraversalMode.java │ ├── TriangleCallback.java │ ├── TriangleIndexVertexArray.java │ ├── TriangleMeshShape.java │ ├── TriangleShape.java │ ├── UniformScalingShape.java │ ├── VertexData.java │ └── package-info.java ├── demos ├── applet │ ├── Cylinder.java │ ├── DemoPanel.java │ ├── Disk.java │ ├── Graphics3D.java │ ├── JBulletApplet.form │ ├── JBulletApplet.java │ ├── Light.java │ ├── LookUtil.java │ ├── Quadric.java │ ├── Rasterizer.java │ ├── SoftwareGL.java │ ├── Span.java │ ├── Sphere.java │ └── Utils.java ├── basic │ └── BasicDemo.java ├── bsp │ ├── BspConverter.java │ ├── BspDemo.java │ ├── exported.bsp.txt │ └── exporter.diff ├── character │ └── CharacterDemo.java ├── concave │ └── ConcaveDemo.java ├── concaveconvexcast │ ├── ConcaveConvexcastDemo.java │ └── ConvexcastBatch.java ├── dynamiccontrol │ ├── DynamicControlDemo.java │ └── TestRig.java ├── forklift │ └── ForkLiftDemo.java ├── genericjoint │ ├── GenericJointDemo.java │ └── RagDoll.java ├── helloworld │ └── HelloWorld.java ├── movingconcave │ ├── Bunny.java │ └── MovingConcaveDemo.java ├── opengl │ ├── DejaVu_Sans_11.fnt │ ├── DemoApplication.java │ ├── FastFormat.java │ ├── FontRender.java │ ├── GLDebugDrawer.java │ ├── GLShapeDrawer.java │ ├── IGL.java │ ├── LWJGL.java │ └── LwjglGL.java └── vehicle │ └── VehicleDemo.java ├── dynamics ├── ActionInterface.java ├── DiscreteDynamicsWorld.java ├── DynamicsWorld.java ├── DynamicsWorldType.java ├── InternalTickCallback.java ├── RigidBody.java ├── RigidBodyConstructionInfo.java ├── SimpleDynamicsWorld.java ├── character │ └── KinematicCharacterController.java ├── constraintsolver │ ├── ConeTwistConstraint.java │ ├── ConstraintPersistentData.java │ ├── ConstraintSolver.java │ ├── ContactConstraint.java │ ├── ContactConstraintEnum.java │ ├── ContactSolverFunc.java │ ├── ContactSolverInfo.java │ ├── Generic6DofConstraint.java │ ├── HingeConstraint.java │ ├── JacobianEntry.java │ ├── Point2PointConstraint.java │ ├── RotationalLimitMotor.java │ ├── SequentialImpulseConstraintSolver.java │ ├── SliderConstraint.java │ ├── SolverBody.java │ ├── SolverConstraint.java │ ├── SolverConstraintType.java │ ├── SolverMode.java │ ├── TranslationalLimitMotor.java │ ├── TypedConstraint.java │ ├── TypedConstraintType.java │ └── package-info.java ├── package-info.java └── vehicle │ ├── DefaultVehicleRaycaster.java │ ├── RaycastVehicle.java │ ├── VehicleRaycaster.java │ ├── VehicleRaycasterResult.java │ ├── VehicleTuning.java │ ├── WheelInfo.java │ └── WheelInfoConstructionInfo.java ├── extras └── gimpact │ ├── BoxCollision.java │ ├── BvhDataArray.java │ ├── BvhTree.java │ ├── BvhTreeNodeArray.java │ ├── ClipPolygon.java │ ├── GIM_ShapeRetriever.java │ ├── GImpactBvh.java │ ├── GImpactCollisionAlgorithm.java │ ├── GImpactMassUtil.java │ ├── GImpactMeshShape.java │ ├── GImpactMeshShapePart.java │ ├── GImpactShapeInterface.java │ ├── GImpactTriangleCallback.java │ ├── GeometryOperations.java │ ├── Pair.java │ ├── PairSet.java │ ├── PlaneIntersectionType.java │ ├── PlaneShape.java │ ├── PrimitiveManagerBase.java │ ├── PrimitiveTriangle.java │ ├── Quantization.java │ ├── ShapeType.java │ ├── TetrahedronShapeEx.java │ ├── TriangleContact.java │ ├── TriangleShapeEx.java │ ├── TrimeshPrimitiveManager.java │ └── package-info.java ├── linearmath ├── AabbUtil2.java ├── CProfileIterator.java ├── CProfileManager.java ├── CProfileNode.java ├── Clock.java ├── DebugDrawModes.java ├── DefaultMotionState.java ├── GeometryUtil.java ├── IDebugDraw.java ├── MatrixUtil.java ├── MiscUtil.java ├── MotionState.java ├── QuaternionUtil.java ├── ScalarUtil.java ├── Transform.java ├── TransformUtil.java ├── VectorUtil.java ├── convexhull │ ├── HullDesc.java │ ├── HullFlags.java │ ├── HullLibrary.java │ ├── HullResult.java │ ├── Int3.java │ ├── Int4.java │ ├── IntRef.java │ ├── PHullResult.java │ ├── Tri.java │ └── package-info.java └── package-info.java ├── package-info.java └── util ├── ArrayPool.java ├── FloatArrayList.java ├── IntArrayList.java ├── ObjectArrayList.java ├── ObjectPool.java ├── ObjectStackList.java ├── StackList.java └── package-info.java /README: -------------------------------------------------------------------------------- 1 | This Git version is just a copy of the JBullet project. 2 | I downloaded the source from JBullet homepage and then upload it here (to check the changes). 3 | I just use it for my own (of course you guys can use it ^^). -------------------------------------------------------------------------------- /dist/javadoc/com/bulletphysics/dynamics/character/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.bulletphysics.dynamics.character (JBullet) 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | com.bulletphysics.dynamics.character 20 | 21 | 22 | 27 | 28 |
23 | Classes  24 | 25 |
26 | KinematicCharacterController
29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /dist/javadoc/com/bulletphysics/dynamics/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.bulletphysics.dynamics (JBullet) 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | com.bulletphysics.dynamics 20 | 21 | 22 | 39 | 40 |
23 | Classes  24 | 25 |
26 | ActionInterface 27 |
28 | DiscreteDynamicsWorld 29 |
30 | DynamicsWorld 31 |
32 | InternalTickCallback 33 |
34 | RigidBody 35 |
36 | RigidBodyConstructionInfo 37 |
38 | SimpleDynamicsWorld
41 | 42 | 43 | 44 | 45 | 50 | 51 |
46 | Enums  47 | 48 |
49 | DynamicsWorldType
52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /dist/javadoc/com/bulletphysics/dynamics/vehicle/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.bulletphysics.dynamics.vehicle (JBullet) 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | com.bulletphysics.dynamics.vehicle 20 | 21 | 22 | 41 | 42 |
23 | Classes  24 | 25 |
26 | DefaultVehicleRaycaster 27 |
28 | RaycastVehicle 29 |
30 | VehicleRaycaster 31 |
32 | VehicleRaycasterResult 33 |
34 | VehicleTuning 35 |
36 | WheelInfo 37 |
38 | WheelInfo.RaycastInfo 39 |
40 | WheelInfoConstructionInfo
43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /dist/javadoc/com/bulletphysics/extras/gimpact/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.bulletphysics.extras.gimpact (JBullet) 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | com.bulletphysics.extras.gimpact 20 | 21 | 22 | 41 | 42 |
23 | Classes  24 | 25 |
26 | GImpactCollisionAlgorithm 27 |
28 | GImpactCollisionAlgorithm.CreateFunc 29 |
30 | GImpactMeshShape 31 |
32 | GImpactMeshShapePart 33 |
34 | GImpactShapeInterface 35 |
36 | PrimitiveTriangle 37 |
38 | TriangleContact 39 |
40 | TriangleShapeEx
43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /dist/javadoc/com/bulletphysics/linearmath/convexhull/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.bulletphysics.linearmath.convexhull (JBullet) 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | com.bulletphysics.linearmath.convexhull 20 | 21 | 22 | 33 | 34 |
23 | Classes  24 | 25 |
26 | HullDesc 27 |
28 | HullFlags 29 |
30 | HullLibrary 31 |
32 | HullResult
35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /dist/javadoc/com/bulletphysics/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.bulletphysics (JBullet) 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | com.bulletphysics 20 | 21 | 22 | 35 | 36 |
23 | Classes  24 | 25 |
26 | BulletGlobals 27 |
28 | BulletStats 29 |
30 | ContactAddedCallback 31 |
32 | ContactDestroyedCallback 33 |
34 | ContactProcessedCallback
37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /dist/javadoc/com/bulletphysics/util/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.bulletphysics.util (JBullet) 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | com.bulletphysics.util 20 | 21 | 22 | 39 | 40 |
23 | Classes  24 | 25 |
26 | ArrayPool 27 |
28 | FloatArrayList 29 |
30 | IntArrayList 31 |
32 | ObjectArrayList 33 |
34 | ObjectPool 35 |
36 | ObjectStackList 37 |
38 | StackList
41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /dist/javadoc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | JBullet 8 | 9 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | <H2> 31 | Frame Alert</H2> 32 | 33 | <P> 34 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. 35 | <BR> 36 | Link to<A HREF="overview-summary.html">Non-frame version.</A> 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /dist/javadoc/package-list: -------------------------------------------------------------------------------- 1 | com.bulletphysics 2 | com.bulletphysics.collision.broadphase 3 | com.bulletphysics.collision.dispatch 4 | com.bulletphysics.collision.narrowphase 5 | com.bulletphysics.collision.shapes 6 | com.bulletphysics.dynamics 7 | com.bulletphysics.dynamics.character 8 | com.bulletphysics.dynamics.constraintsolver 9 | com.bulletphysics.dynamics.vehicle 10 | com.bulletphysics.extras.gimpact 11 | com.bulletphysics.linearmath 12 | com.bulletphysics.linearmath.convexhull 13 | com.bulletphysics.util 14 | -------------------------------------------------------------------------------- /dist/javadoc/resources/inherit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/dist/javadoc/resources/inherit.gif -------------------------------------------------------------------------------- /dist/javadoc/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* Javadoc style sheet */ 2 | 3 | /* Define colors, fonts and other style attributes here to override the defaults */ 4 | 5 | /* Page background color */ 6 | body { background-color: #FFFFFF; color:#000000 } 7 | 8 | /* Headings */ 9 | h1 { font-size: 145% } 10 | 11 | /* Table colors */ 12 | .TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */ 13 | .TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */ 14 | .TableRowColor { background: #FFFFFF; color:#000000 } /* White */ 15 | 16 | /* Font used in left-hand frame lists */ 17 | .FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 } 18 | .FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } 19 | .FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } 20 | 21 | /* Navigation bar fonts and colors */ 22 | .NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */ 23 | .NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */ 24 | .NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;} 25 | .NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;} 26 | 27 | .NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} 28 | .NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} 29 | 30 | -------------------------------------------------------------------------------- /dist/jbullet-demos.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/dist/jbullet-demos.jar -------------------------------------------------------------------------------- /dist/jbullet.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/dist/jbullet.jar -------------------------------------------------------------------------------- /lib/ASM3.1/asm-all-3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/ASM3.1/asm-all-3.1.jar -------------------------------------------------------------------------------- /lib/ASM3.1/src.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/ASM3.1/src.zip -------------------------------------------------------------------------------- /lib/javadoc/vecmath/package-list: -------------------------------------------------------------------------------- 1 | javax.vecmath 2 | -------------------------------------------------------------------------------- /lib/jstackalloc/jstackalloc-20080716.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/jstackalloc/jstackalloc-20080716.zip -------------------------------------------------------------------------------- /lib/jstackalloc/stack-alloc-javadoc.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/jstackalloc/stack-alloc-javadoc.zip -------------------------------------------------------------------------------- /lib/jstackalloc/stack-alloc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/jstackalloc/stack-alloc.jar -------------------------------------------------------------------------------- /lib/lwjgl/jinput.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/jinput.jar -------------------------------------------------------------------------------- /lib/lwjgl/linux/libjinput-linux.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/linux/libjinput-linux.so -------------------------------------------------------------------------------- /lib/lwjgl/linux/libjinput-linux64.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/linux/libjinput-linux64.so -------------------------------------------------------------------------------- /lib/lwjgl/linux/liblwjgl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/linux/liblwjgl.so -------------------------------------------------------------------------------- /lib/lwjgl/linux/liblwjgl64.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/linux/liblwjgl64.so -------------------------------------------------------------------------------- /lib/lwjgl/linux/libopenal.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/linux/libopenal.so -------------------------------------------------------------------------------- /lib/lwjgl/lwjgl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/lwjgl.jar -------------------------------------------------------------------------------- /lib/lwjgl/lwjgl_util.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/lwjgl_util.jar -------------------------------------------------------------------------------- /lib/lwjgl/macosx/libjinput-osx.jnilib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/macosx/libjinput-osx.jnilib -------------------------------------------------------------------------------- /lib/lwjgl/macosx/liblwjgl.jnilib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/macosx/liblwjgl.jnilib -------------------------------------------------------------------------------- /lib/lwjgl/macosx/openal.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/macosx/openal.dylib -------------------------------------------------------------------------------- /lib/lwjgl/win32/OpenAL32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/win32/OpenAL32.dll -------------------------------------------------------------------------------- /lib/lwjgl/win32/jinput-dx8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/win32/jinput-dx8.dll -------------------------------------------------------------------------------- /lib/lwjgl/win32/jinput-raw.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/win32/jinput-raw.dll -------------------------------------------------------------------------------- /lib/lwjgl/win32/lwjgl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/lwjgl/win32/lwjgl.dll -------------------------------------------------------------------------------- /lib/nblibraries.properties: -------------------------------------------------------------------------------- 1 | libs.swing-layout.classpath=\ 2 | ${base}/swing-layout/swing-layout-1.0.3.jar 3 | libs.lwjgl.classpath=\ 4 | ${base}/lwjgl/jinput.jar:\ 5 | ${base}/lwjgl/lwjgl.jar:\ 6 | ${base}/lwjgl/lwjgl_util.jar 7 | libs.vecmath.classpath=\ 8 | ${base}/vecmath/vecmath.jar 9 | libs.ASM3.1.classpath=\ 10 | ${base}/ASM3.1/asm-all-3.1.jar 11 | libs.ASM3.1.src=\ 12 | ${base}/ASM3.1/src.zip 13 | libs.jstackalloc.classpath=\ 14 | ${base}/jstackalloc/stack-alloc.jar 15 | libs.jstackalloc.javadoc=\ 16 | ${base}/jstackalloc/stack-alloc-javadoc.zip 17 | -------------------------------------------------------------------------------- /lib/swing-layout/swing-layout-1.0.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/swing-layout/swing-layout-1.0.3.jar -------------------------------------------------------------------------------- /lib/vecmath/vecmath.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/lib/vecmath/vecmath.jar -------------------------------------------------------------------------------- /nbproject/configs/AppletDemo.properties: -------------------------------------------------------------------------------- 1 | main.class=com.bulletphysics.demos.applet.JBulletApplet 2 | -------------------------------------------------------------------------------- /nbproject/configs/BasicDemo.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CasperPas/JBullet/9bce4ed55c6eb19717c374cb791f3d0ce0dcdfab/nbproject/configs/BasicDemo.properties -------------------------------------------------------------------------------- /nbproject/configs/BspDemo.properties: -------------------------------------------------------------------------------- 1 | main.class=com.bulletphysics.demos.bsp.BspDemo 2 | -------------------------------------------------------------------------------- /nbproject/configs/CharacterDemo.properties: -------------------------------------------------------------------------------- 1 | main.class=com.bulletphysics.demos.character.CharacterDemo 2 | -------------------------------------------------------------------------------- /nbproject/configs/ConcaveConvexcastDemo.properties: -------------------------------------------------------------------------------- 1 | main.class=com.bulletphysics.demos.concaveconvexcast.ConcaveConvexcastDemo 2 | -------------------------------------------------------------------------------- /nbproject/configs/ConcaveDemo.properties: -------------------------------------------------------------------------------- 1 | main.class=com.bulletphysics.demos.concave.ConcaveDemo 2 | -------------------------------------------------------------------------------- /nbproject/configs/DynamicControlDemo.properties: -------------------------------------------------------------------------------- 1 | main.class=com.bulletphysics.demos.dynamiccontrol.DynamicControlDemo 2 | -------------------------------------------------------------------------------- /nbproject/configs/ForkLiftDemo.properties: -------------------------------------------------------------------------------- 1 | main.class=com.bulletphysics.demos.forklift.ForkLiftDemo 2 | -------------------------------------------------------------------------------- /nbproject/configs/GenericJointDemo.properties: -------------------------------------------------------------------------------- 1 | main.class=com.bulletphysics.demos.genericjoint.GenericJointDemo 2 | -------------------------------------------------------------------------------- /nbproject/configs/HelloWorldDemo.properties: -------------------------------------------------------------------------------- 1 | main.class=com.bulletphysics.demos.helloworld.HelloWorld 2 | -------------------------------------------------------------------------------- /nbproject/configs/MovingConcaveDemo.properties: -------------------------------------------------------------------------------- 1 | main.class=com.bulletphysics.demos.movingconcave.MovingConcaveDemo 2 | -------------------------------------------------------------------------------- /nbproject/configs/VehicleDemo.properties: -------------------------------------------------------------------------------- 1 | main.class=com.bulletphysics.demos.vehicle.VehicleDemo 2 | -------------------------------------------------------------------------------- /nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=ff8e82d1 2 | build.xml.script.CRC32=26cff537 3 | build.xml.stylesheet.CRC32=be360661 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=aa374877 7 | nbproject/build-impl.xml.script.CRC32=95a8866c 8 | nbproject/build-impl.xml.stylesheet.CRC32=f33e10ff@1.38.2.45 9 | nbproject/profiler-build-impl.xml.data.CRC32=ff8e82d1 10 | nbproject/profiler-build-impl.xml.script.CRC32=abda56ed 11 | nbproject/profiler-build-impl.xml.stylesheet.CRC32=42cb6bcf 12 | -------------------------------------------------------------------------------- /nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | jbullet 7 | 1.6.5 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | lib/nblibraries.properties 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /porting_status.txt: -------------------------------------------------------------------------------- 1 | This file describes the porting status of various parts of JBullet. 2 | 3 | Base code is based on Bullet 2.72. 4 | 5 | List of exceptions: 6 | 7 | 2.74: 8 | - CCD motion clamping fix 9 | 10 | 2.70: 11 | - demos 12 | - AxisSweep3 13 | - DBVT 14 | - SimpleBroadphase 15 | - CompoundCollisionAlgorithm 16 | - CompoundShape 17 | - ConvexShape 18 | - BvhTriangleMeshShape 19 | - StridingMeshInterface 20 | - TriangleIndexVertexArray 21 | - TriangleMesh 22 | - TriangleMeshShape 23 | - GjkPairDetector (non-virtual methods) 24 | - MinkowskiPenetrationDepthSolver (non-virtual methods) 25 | - HingeConstraint (probably newer patch applied) 26 | 27 | 2.70-beta1: 28 | - graphics part of DemoApplication 29 | 30 | 2.66: 31 | - OptimizedBVH 32 | 33 | KinematicCharacterController: 34 | - jump/gravity patch 35 | -------------------------------------------------------------------------------- /src/com/bulletphysics/ContactAddedCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics; 25 | 26 | import com.bulletphysics.collision.dispatch.CollisionFlags; 27 | import com.bulletphysics.collision.dispatch.CollisionObject; 28 | import com.bulletphysics.collision.narrowphase.ManifoldPoint; 29 | 30 | /** 31 | * Called when contact has been created between two collision objects. At least 32 | * one of object must have {@link CollisionFlags#CUSTOM_MATERIAL_CALLBACK} flag set. 33 | * 34 | * @see BulletGlobals#setContactAddedCallback 35 | * @author jezek2 36 | */ 37 | public abstract class ContactAddedCallback { 38 | 39 | public abstract boolean contactAdded(ManifoldPoint cp, CollisionObject colObj0, int partId0, int index0, CollisionObject colObj1, int partId1, int index1); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/com/bulletphysics/ContactDestroyedCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics; 25 | 26 | /** 27 | * Called when contact has been destroyed between two collision objects. 28 | * 29 | * @see BulletGlobals#setContactDestroyedCallback 30 | * @author jezek2 31 | */ 32 | public abstract class ContactDestroyedCallback { 33 | 34 | public abstract boolean contactDestroyed(Object userPersistentData); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/com/bulletphysics/ContactProcessedCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics; 25 | 26 | import com.bulletphysics.collision.narrowphase.ManifoldPoint; 27 | 28 | /** 29 | * Called when existing contact between two collision objects has been processed. 30 | * 31 | * @see BulletGlobals#setContactProcessedCallback 32 | * @author jezek2 33 | */ 34 | public abstract class ContactProcessedCallback { 35 | 36 | public abstract boolean contactProcessed(ManifoldPoint cp, Object body0, Object body1); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/BroadphaseInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.broadphase; 25 | 26 | import javax.vecmath.Vector3f; 27 | 28 | /** 29 | * BroadphaseInterface for AABB overlapping object pairs. 30 | * 31 | * @author jezek2 32 | */ 33 | public abstract class BroadphaseInterface { 34 | 35 | public abstract BroadphaseProxy createProxy(Vector3f aabbMin, Vector3f aabbMax, BroadphaseNativeType shapeType, Object userPtr, short collisionFilterGroup, short collisionFilterMask, Dispatcher dispatcher, Object multiSapProxy); 36 | 37 | public abstract void destroyProxy(BroadphaseProxy proxy, Dispatcher dispatcher); 38 | 39 | public abstract void setAabb(BroadphaseProxy proxy, Vector3f aabbMin, Vector3f aabbMax, Dispatcher dispatcher); 40 | 41 | ///calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb 42 | public abstract void calculateOverlappingPairs(Dispatcher dispatcher); 43 | 44 | public abstract OverlappingPairCache getOverlappingPairCache(); 45 | 46 | ///getAabb returns the axis aligned bounding box in the 'global' coordinate frame 47 | ///will add some transform later 48 | public abstract void getBroadphaseAabb(Vector3f aabbMin, Vector3f aabbMax); 49 | 50 | public abstract void printStats(); 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/BroadphaseProxy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.broadphase; 25 | 26 | import com.bulletphysics.collision.dispatch.CollisionObject; 27 | import com.bulletphysics.dynamics.RigidBody; 28 | 29 | /** 30 | * BroadphaseProxy is the main class that can be used with the Bullet broadphases. 31 | * It stores collision shape type information, collision filter information and 32 | * a client object, typically a {@link CollisionObject} or {@link RigidBody}. 33 | * 34 | * @author jezek2 35 | */ 36 | public class BroadphaseProxy { 37 | 38 | // Usually the client CollisionObject or Rigidbody class 39 | public Object clientObject; 40 | 41 | // TODO: mask 42 | public short collisionFilterGroup; 43 | public short collisionFilterMask; 44 | 45 | public Object multiSapParentProxy; 46 | 47 | public int uniqueId; // uniqueId is introduced for paircache. could get rid of this, by calculating the address offset etc. 48 | 49 | public BroadphaseProxy() { 50 | } 51 | 52 | public BroadphaseProxy(Object userPtr, short collisionFilterGroup, short collisionFilterMask) { 53 | this(userPtr, collisionFilterGroup, collisionFilterMask, null); 54 | } 55 | 56 | public BroadphaseProxy(Object userPtr, short collisionFilterGroup, short collisionFilterMask, Object multiSapParentProxy) { 57 | this.clientObject = userPtr; 58 | this.collisionFilterGroup = collisionFilterGroup; 59 | this.collisionFilterMask = collisionFilterMask; 60 | this.multiSapParentProxy = multiSapParentProxy; 61 | } 62 | 63 | public int getUid() { 64 | return uniqueId; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/CollisionAlgorithmConstructionInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.broadphase; 25 | 26 | import com.bulletphysics.collision.narrowphase.PersistentManifold; 27 | 28 | /** 29 | * Construction information for collision algorithms. 30 | * 31 | * @author jezek2 32 | */ 33 | public class CollisionAlgorithmConstructionInfo { 34 | 35 | public Dispatcher dispatcher1; 36 | public PersistentManifold manifold; 37 | 38 | //public int getDispatcherId(); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/CollisionFilterGroups.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.broadphase; 25 | 26 | /** 27 | * Common collision filter groups. 28 | * 29 | * @author jezek2 30 | */ 31 | public class CollisionFilterGroups { 32 | 33 | public static final short DEFAULT_FILTER = 1; 34 | public static final short STATIC_FILTER = 2; 35 | public static final short KINEMATIC_FILTER = 4; 36 | public static final short DEBRIS_FILTER = 8; 37 | public static final short SENSOR_TRIGGER = 16; 38 | public static final short CHARACTER_FILTER = 32; 39 | public static final short ALL_FILTER = -1; // all bits sets: DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorTrigger 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/DbvtLeafCollider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | // Dbvt implementation by Nathanael Presson 25 | 26 | package com.bulletphysics.collision.broadphase; 27 | 28 | /** 29 | * 30 | * @author jezek2 31 | */ 32 | public class DbvtLeafCollider extends Dbvt.ICollide { 33 | 34 | public DbvtBroadphase pbp; 35 | public DbvtProxy ppx; 36 | 37 | public DbvtLeafCollider(DbvtBroadphase p, DbvtProxy px) { 38 | this.pbp = p; 39 | this.ppx = px; 40 | } 41 | 42 | @Override 43 | public void Process(Dbvt.Node na) { 44 | Dbvt.Node nb = ppx.leaf; 45 | if (nb != na) { 46 | DbvtProxy pa = (DbvtProxy) na.data; 47 | DbvtProxy pb = (DbvtProxy) nb.data; 48 | 49 | //#if DBVT_BP_DISCRETPAIRS 50 | if (DbvtAabbMm.Intersect(pa.aabb, pb.aabb)) 51 | //#endif 52 | { 53 | //if(pa>pb) btSwap(pa,pb); 54 | if (pa.hashCode() > pb.hashCode()) { 55 | DbvtProxy tmp = pa; 56 | pa = pb; 57 | pb = tmp; 58 | } 59 | pbp.paircache.addOverlappingPair(pa, pb); 60 | } 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/DbvtProxy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | // Dbvt implementation by Nathanael Presson 25 | 26 | package com.bulletphysics.collision.broadphase; 27 | 28 | /** 29 | * 30 | * @author jezek2 31 | */ 32 | public class DbvtProxy extends BroadphaseProxy { 33 | 34 | public final DbvtAabbMm aabb = new DbvtAabbMm(); 35 | public Dbvt.Node leaf; 36 | public final DbvtProxy[] links = new DbvtProxy[2]; 37 | public int stage; 38 | 39 | public DbvtProxy(Object userPtr, short collisionFilterGroup, short collisionFilterMask) { 40 | super(userPtr, collisionFilterGroup, collisionFilterMask); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/DbvtTreeCollider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | // Dbvt implementation by Nathanael Presson 25 | 26 | package com.bulletphysics.collision.broadphase; 27 | 28 | /** 29 | * 30 | * @author jezek2 31 | */ 32 | public class DbvtTreeCollider extends Dbvt.ICollide { 33 | 34 | public DbvtBroadphase pbp; 35 | 36 | public DbvtTreeCollider(DbvtBroadphase p) { 37 | this.pbp = p; 38 | } 39 | 40 | @Override 41 | public void Process(Dbvt.Node na, Dbvt.Node nb) { 42 | DbvtProxy pa = (DbvtProxy) na.data; 43 | DbvtProxy pb = (DbvtProxy) nb.data; 44 | //#if DBVT_BP_DISCRETPAIRS 45 | if (DbvtAabbMm.Intersect(pa.aabb, pb.aabb)) 46 | //#endif 47 | { 48 | //if(pa>pb) btSwap(pa,pb); 49 | if (pa.hashCode() > pb.hashCode()) { 50 | DbvtProxy tmp = pa; 51 | pa = pb; 52 | pb = tmp; 53 | } 54 | pbp.paircache.addOverlappingPair(pa, pb); 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/DispatchFunc.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.broadphase; 25 | 26 | /** 27 | * 28 | * @author jezek2 29 | */ 30 | public enum DispatchFunc { 31 | 32 | DISPATCH_DISCRETE(1), 33 | DISPATCH_CONTINUOUS(2); 34 | 35 | private int value; 36 | 37 | private DispatchFunc(int value) { 38 | this.value = value; 39 | } 40 | 41 | public int getValue() { 42 | return value; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/DispatcherInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.broadphase; 25 | 26 | import com.bulletphysics.linearmath.IDebugDraw; 27 | 28 | /** 29 | * Current state of {@link Dispatcher}. 30 | * 31 | * @author jezek2 32 | */ 33 | public class DispatcherInfo { 34 | 35 | public float timeStep; 36 | public int stepCount; 37 | public DispatchFunc dispatchFunc; 38 | public float timeOfImpact; 39 | public boolean useContinuous; 40 | public IDebugDraw debugDraw; 41 | public boolean enableSatConvex; 42 | public boolean enableSPU = true; 43 | public boolean useEpa = true; 44 | public float allowedCcdPenetration = 0.04f; 45 | //btStackAlloc* m_stackAllocator; 46 | 47 | public DispatcherInfo() { 48 | dispatchFunc = DispatchFunc.DISPATCH_DISCRETE; 49 | timeOfImpact = 1f; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/OverlapCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.broadphase; 25 | 26 | /** 27 | * OverlapCallback is used when processing all overlapping pairs in broadphase. 28 | * 29 | * @see OverlappingPairCache#processAllOverlappingPairs 30 | * @author jezek2 31 | */ 32 | public abstract class OverlapCallback { 33 | 34 | //return true for deletion of the pair 35 | public abstract boolean processOverlap(BroadphasePair pair); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/OverlapFilterCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.broadphase; 25 | 26 | /** 27 | * Callback for filtering broadphase collisions. 28 | * 29 | * @see OverlappingPairCache#setOverlapFilterCallback 30 | * @author jezek2 31 | */ 32 | public abstract class OverlapFilterCallback { 33 | 34 | /** 35 | * Checks if given pair of collision objects needs collision. 36 | * 37 | * @param proxy0 first object 38 | * @param proxy1 second object 39 | * @return true when pairs need collision 40 | */ 41 | public abstract boolean needBroadphaseCollision(BroadphaseProxy proxy0, BroadphaseProxy proxy1); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/OverlappingPairCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.broadphase; 25 | 26 | import com.bulletphysics.util.ObjectArrayList; 27 | 28 | /** 29 | * OverlappingPairCache provides an interface for overlapping pair management (add, 30 | * remove, storage), used by the {@link BroadphaseInterface} broadphases. 31 | * 32 | * @author jezek2 33 | */ 34 | public abstract class OverlappingPairCache extends OverlappingPairCallback { 35 | 36 | public abstract ObjectArrayList getOverlappingPairArray(); 37 | 38 | public abstract void cleanOverlappingPair(BroadphasePair pair, Dispatcher dispatcher); 39 | 40 | public abstract int getNumOverlappingPairs(); 41 | 42 | public abstract void cleanProxyFromPairs(BroadphaseProxy proxy, Dispatcher dispatcher); 43 | 44 | public abstract void setOverlapFilterCallback(OverlapFilterCallback overlapFilterCallback); 45 | 46 | public abstract void processAllOverlappingPairs(OverlapCallback callback, Dispatcher dispatcher); 47 | 48 | public abstract BroadphasePair findPair(BroadphaseProxy proxy0, BroadphaseProxy proxy1); 49 | 50 | public abstract boolean hasDeferredRemoval(); 51 | 52 | public abstract void setInternalGhostPairCallback(OverlappingPairCallback ghostPairCallback); 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/OverlappingPairCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.broadphase; 25 | 26 | /** 27 | * OverlappingPairCallback class is an additional optional broadphase user callback 28 | * for adding/removing overlapping pairs, similar interface to {@link OverlappingPairCache}. 29 | * 30 | * @author jezek2 31 | */ 32 | public abstract class OverlappingPairCallback { 33 | 34 | public abstract BroadphasePair addOverlappingPair(BroadphaseProxy proxy0, BroadphaseProxy proxy1); 35 | 36 | public abstract Object removeOverlappingPair(BroadphaseProxy proxy0, BroadphaseProxy proxy1, Dispatcher dispatcher); 37 | 38 | public abstract void removeOverlappingPairsContainingProxy(BroadphaseProxy proxy0, Dispatcher dispatcher); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/SimpleBroadphaseProxy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.broadphase; 25 | 26 | import javax.vecmath.Vector3f; 27 | 28 | /** 29 | * 30 | * @author jezek2 31 | */ 32 | class SimpleBroadphaseProxy extends BroadphaseProxy { 33 | 34 | protected final Vector3f min = new Vector3f(); 35 | protected final Vector3f max = new Vector3f(); 36 | 37 | public SimpleBroadphaseProxy() { 38 | } 39 | 40 | public SimpleBroadphaseProxy(Vector3f minpt, Vector3f maxpt, BroadphaseNativeType shapeType, Object userPtr, short collisionFilterGroup, short collisionFilterMask, Object multiSapProxy) { 41 | super(userPtr, collisionFilterGroup, collisionFilterMask, multiSapProxy); 42 | this.min.set(minpt); 43 | this.max.set(maxpt); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/broadphase/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | /** 25 | * Broadphase collision code for fast determining of overlapping pairs. 26 | */ 27 | package com.bulletphysics.collision.broadphase; 28 | 29 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/dispatch/CollisionAlgorithmCreateFunc.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.dispatch; 25 | 26 | import com.bulletphysics.collision.broadphase.CollisionAlgorithm; 27 | import com.bulletphysics.collision.broadphase.CollisionAlgorithmConstructionInfo; 28 | 29 | /** 30 | * Used by the CollisionDispatcher to register and create instances for CollisionAlgorithm. 31 | * 32 | * @author jezek2 33 | */ 34 | public abstract class CollisionAlgorithmCreateFunc { 35 | 36 | public boolean swapped; 37 | 38 | public abstract CollisionAlgorithm createCollisionAlgorithm(CollisionAlgorithmConstructionInfo ci, CollisionObject body0, CollisionObject body1); 39 | 40 | // JAVA NOTE: added 41 | public abstract void releaseCollisionAlgorithm(CollisionAlgorithm algo); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/dispatch/CollisionConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.dispatch; 25 | 26 | import com.bulletphysics.collision.broadphase.BroadphaseNativeType; 27 | 28 | /** 29 | * CollisionConfiguration allows to configure Bullet default collision algorithms. 30 | * 31 | * @author jezek2 32 | */ 33 | public abstract class CollisionConfiguration { 34 | 35 | /* 36 | ///memory pools 37 | virtual btPoolAllocator* getPersistentManifoldPool() = 0; 38 | virtual btPoolAllocator* getCollisionAlgorithmPool() = 0; 39 | virtual btStackAlloc* getStackAllocator() = 0; 40 | */ 41 | 42 | public abstract CollisionAlgorithmCreateFunc getCollisionAlgorithmCreateFunc(BroadphaseNativeType proxyType0, BroadphaseNativeType proxyType1); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/dispatch/CollisionFlags.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.dispatch; 25 | 26 | import com.bulletphysics.ContactAddedCallback; 27 | 28 | /** 29 | * Flags for collision objects. 30 | * 31 | * @author jezek2 32 | */ 33 | public class CollisionFlags { 34 | 35 | /** Sets this collision object as static. */ 36 | public static final int STATIC_OBJECT = 1; 37 | 38 | /** Sets this collision object as kinematic. */ 39 | public static final int KINEMATIC_OBJECT = 2; 40 | 41 | /** Disables contact response. */ 42 | public static final int NO_CONTACT_RESPONSE = 4; 43 | 44 | /** 45 | * Enables calling {@link ContactAddedCallback} for collision objects. This 46 | * allows per-triangle material (friction/restitution). 47 | */ 48 | public static final int CUSTOM_MATERIAL_CALLBACK = 8; 49 | 50 | public static final int CHARACTER_OBJECT = 16; 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/dispatch/CollisionObjectType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.dispatch; 25 | 26 | /** 27 | * Collision object type. 28 | * 29 | * @author jezek2 30 | */ 31 | public enum CollisionObjectType { 32 | COLLISION_OBJECT, // =1 33 | RIGID_BODY, 34 | // CO_GHOST_OBJECT keeps track of all objects overlapping its AABB and that pass its collision filter 35 | // It is useful for collision sensors, explosion objects, character controller etc. 36 | GHOST_OBJECT, 37 | SOFT_BODY 38 | } 39 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/dispatch/NearCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.dispatch; 25 | 26 | import com.bulletphysics.collision.broadphase.BroadphasePair; 27 | import com.bulletphysics.collision.broadphase.DispatcherInfo; 28 | 29 | /** 30 | * Callback for overriding collision filtering and more fine-grained control over 31 | * collision detection. 32 | * 33 | * @see CollisionDispatcher#setNearCallback 34 | * @see CollisionDispatcher#getNearCallback 35 | * @author jezek2 36 | */ 37 | public abstract class NearCallback { 38 | 39 | public abstract void handleCollision(BroadphasePair collisionPair, CollisionDispatcher dispatcher, DispatcherInfo dispatchInfo); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/dispatch/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | /** 25 | * Dispatching code for collisions between various shapes. 26 | */ 27 | package com.bulletphysics.collision.dispatch; 28 | 29 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/narrowphase/ConvexCast.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.narrowphase; 25 | 26 | import com.bulletphysics.linearmath.IDebugDraw; 27 | import com.bulletphysics.linearmath.Transform; 28 | import javax.vecmath.Vector3f; 29 | 30 | /** 31 | * ConvexCast is an interface for casting. 32 | * 33 | * @author jezek2 34 | */ 35 | public abstract class ConvexCast { 36 | 37 | /** 38 | * Cast a convex against another convex object. 39 | */ 40 | public abstract boolean calcTimeOfImpact(Transform fromA, Transform toA, Transform fromB, Transform toB, CastResult result); 41 | 42 | //////////////////////////////////////////////////////////////////////////// 43 | 44 | /** 45 | * RayResult stores the closest result. Alternatively, add a callback method 46 | * to decide about closest/all results. 47 | */ 48 | public static class CastResult { 49 | public final Transform hitTransformA = new Transform(); 50 | public final Transform hitTransformB = new Transform(); 51 | 52 | public final Vector3f normal = new Vector3f(); 53 | public final Vector3f hitPoint = new Vector3f(); 54 | public float fraction = 1e30f; // input and output 55 | public float allowedPenetration = 0f; 56 | 57 | public IDebugDraw debugDrawer; 58 | 59 | public void debugDraw(float fraction) {} 60 | public void drawCoordSystem(Transform trans) {} 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/narrowphase/ConvexPenetrationDepthSolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.narrowphase; 25 | 26 | import com.bulletphysics.collision.shapes.ConvexShape; 27 | import com.bulletphysics.linearmath.IDebugDraw; 28 | import com.bulletphysics.linearmath.Transform; 29 | import javax.vecmath.Vector3f; 30 | 31 | /** 32 | * ConvexPenetrationDepthSolver provides an interface for penetration depth calculation. 33 | * 34 | * @author jezek2 35 | */ 36 | public abstract class ConvexPenetrationDepthSolver { 37 | 38 | public abstract boolean calcPenDepth(SimplexSolverInterface simplexSolver, 39 | ConvexShape convexA, ConvexShape convexB, 40 | Transform transA, Transform transB, 41 | Vector3f v, Vector3f pa, Vector3f pb, 42 | IDebugDraw debugDraw/*, btStackAlloc* stackAlloc*/); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/narrowphase/PointCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.narrowphase; 25 | 26 | import javax.vecmath.Vector3f; 27 | 28 | /** 29 | * 30 | * @author jezek2 31 | */ 32 | public class PointCollector extends DiscreteCollisionDetectorInterface.Result { 33 | 34 | public final Vector3f normalOnBInWorld = new Vector3f(); 35 | public final Vector3f pointInWorld = new Vector3f(); 36 | public float distance = 1e30f; // negative means penetration 37 | 38 | public boolean hasResult = false; 39 | 40 | public void setShapeIdentifiers(int partId0, int index0, int partId1, int index1) { 41 | // ?? 42 | } 43 | 44 | public void addContactPoint(Vector3f normalOnBInWorld, Vector3f pointInWorld, float depth) { 45 | if (depth < distance) { 46 | hasResult = true; 47 | this.normalOnBInWorld.set(normalOnBInWorld); 48 | this.pointInWorld.set(pointInWorld); 49 | // negative means penetration 50 | distance = depth; 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/narrowphase/SimplexSolverInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.narrowphase; 25 | 26 | import javax.vecmath.Vector3f; 27 | 28 | /** 29 | * SimplexSolverInterface can incrementally calculate distance between origin and 30 | * up to 4 vertices. Used by GJK or Linear Casting. Can be implemented by the 31 | * Johnson-algorithm or alternative approaches based on voronoi regions or barycentric 32 | * coordinates. 33 | * 34 | * @author jezek2 35 | */ 36 | public abstract class SimplexSolverInterface { 37 | 38 | public abstract void reset(); 39 | 40 | public abstract void addVertex(Vector3f w, Vector3f p, Vector3f q); 41 | 42 | public abstract boolean closest(Vector3f v); 43 | 44 | public abstract float maxVertex(); 45 | 46 | public abstract boolean fullSimplex(); 47 | 48 | public abstract int getSimplex(Vector3f[] pBuf, Vector3f[] qBuf, Vector3f[] yBuf); 49 | 50 | public abstract boolean inSimplex(Vector3f w); 51 | 52 | public abstract void backup_closest(Vector3f v); 53 | 54 | public abstract boolean emptySimplex(); 55 | 56 | public abstract void compute_points(Vector3f p1, Vector3f p2); 57 | 58 | public abstract int numVertices(); 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/narrowphase/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | /** 25 | * Narrow-phase collision. 26 | */ 27 | package com.bulletphysics.collision.narrowphase; 28 | 29 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/BvhSubtreeInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | import java.io.Serializable; 27 | 28 | /** 29 | * BvhSubtreeInfo provides info to gather a subtree of limited size. 30 | * 31 | * @author jezek2 32 | */ 33 | public class BvhSubtreeInfo implements Serializable { 34 | 35 | private static final long serialVersionUID = 1L; 36 | 37 | public final /*unsigned*/ short[] quantizedAabbMin = new short[3]; 38 | public final /*unsigned*/ short[] quantizedAabbMax = new short[3]; 39 | // points to the root of the subtree 40 | public int rootNodeIndex; 41 | public int subtreeSize; 42 | 43 | public void setAabbFromQuantizeNode(QuantizedBvhNodes quantizedNodes, int nodeId) { 44 | quantizedAabbMin[0] = (short)quantizedNodes.getQuantizedAabbMin(nodeId, 0); 45 | quantizedAabbMin[1] = (short)quantizedNodes.getQuantizedAabbMin(nodeId, 1); 46 | quantizedAabbMin[2] = (short)quantizedNodes.getQuantizedAabbMin(nodeId, 2); 47 | quantizedAabbMax[0] = (short)quantizedNodes.getQuantizedAabbMax(nodeId, 0); 48 | quantizedAabbMax[1] = (short)quantizedNodes.getQuantizedAabbMax(nodeId, 1); 49 | quantizedAabbMax[2] = (short)quantizedNodes.getQuantizedAabbMax(nodeId, 2); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/ByteBufferVertexData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | import java.nio.ByteBuffer; 27 | import javax.vecmath.Tuple3f; 28 | 29 | /** 30 | * 31 | * @author jezek2 32 | */ 33 | public class ByteBufferVertexData extends VertexData { 34 | 35 | public ByteBuffer vertexData; 36 | public int vertexCount; 37 | public int vertexStride; 38 | public ScalarType vertexType; 39 | 40 | public ByteBuffer indexData; 41 | public int indexCount; 42 | public int indexStride; 43 | public ScalarType indexType; 44 | 45 | @Override 46 | public int getVertexCount() { 47 | return vertexCount; 48 | } 49 | 50 | @Override 51 | public int getIndexCount() { 52 | return indexCount; 53 | } 54 | 55 | @Override 56 | public T getVertex(int idx, T out) { 57 | int off = idx*vertexStride; 58 | out.x = vertexData.getFloat(off+4*0); 59 | out.y = vertexData.getFloat(off+4*1); 60 | out.z = vertexData.getFloat(off+4*2); 61 | return out; 62 | } 63 | 64 | @Override 65 | public void setVertex(int idx, float x, float y, float z) { 66 | int off = idx*vertexStride; 67 | vertexData.putFloat(off+4*0, x); 68 | vertexData.putFloat(off+4*1, y); 69 | vertexData.putFloat(off+4*2, z); 70 | } 71 | 72 | @Override 73 | public int getIndex(int idx) { 74 | if (indexType == ScalarType.SHORT) { 75 | return indexData.getShort(idx*indexStride) & 0xFFFF; 76 | } 77 | else if (indexType == ScalarType.INTEGER) { 78 | return indexData.getInt(idx*indexStride); 79 | } 80 | else { 81 | throw new IllegalStateException("indicies type must be short or integer"); 82 | } 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/CapsuleShapeX.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | /** 27 | * CapsuleShapeX represents a capsule around the X axis.

28 | * 29 | * The total height is height+2*radius, so the height is just the 30 | * height between the center of each "sphere" of the capsule caps. 31 | * 32 | * @author jezek2 33 | */ 34 | public class CapsuleShapeX extends CapsuleShape { 35 | 36 | public CapsuleShapeX(float radius, float height) { 37 | upAxis = 0; 38 | implicitShapeDimensions.set(0.5f * height, radius, radius); 39 | } 40 | 41 | @Override 42 | public String getName() { 43 | return "CapsuleX"; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/CapsuleShapeZ.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | /** 27 | * CapsuleShapeZ represents a capsule around the Z axis.

28 | * 29 | * The total height is height+2*radius, so the height is just the 30 | * height between the center of each "sphere" of the capsule caps. 31 | * 32 | * @author jezek2 33 | */ 34 | public class CapsuleShapeZ extends CapsuleShape { 35 | 36 | public CapsuleShapeZ(float radius, float height) { 37 | upAxis = 2; 38 | implicitShapeDimensions.set(radius, radius, 0.5f * height); 39 | } 40 | 41 | @Override 42 | public String getName() { 43 | return "CapsuleZ"; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/CompoundShapeChild.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | import com.bulletphysics.collision.broadphase.BroadphaseNativeType; 27 | import com.bulletphysics.linearmath.Transform; 28 | 29 | /** 30 | * Compound shape child. 31 | * 32 | * @author jezek2 33 | */ 34 | public class CompoundShapeChild { 35 | 36 | public final Transform transform = new Transform(); 37 | public CollisionShape childShape; 38 | public BroadphaseNativeType childShapeType; 39 | public float childMargin; 40 | 41 | @Override 42 | public boolean equals(Object obj) { 43 | if (obj == null || !(obj instanceof CompoundShapeChild)) return false; 44 | CompoundShapeChild child = (CompoundShapeChild)obj; 45 | return transform.equals(child.transform) && 46 | childShape == child.childShape && 47 | childShapeType == child.childShapeType && 48 | childMargin == child.childMargin; 49 | } 50 | 51 | @Override 52 | public int hashCode() { 53 | int hash = 7; 54 | hash = 19 * hash + transform.hashCode(); 55 | hash = 19 * hash + childShape.hashCode(); 56 | hash = 19 * hash + childShapeType.hashCode(); 57 | hash = 19 * hash + Float.floatToIntBits(childMargin); 58 | return hash; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/ConcaveShape.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | import javax.vecmath.Vector3f; 27 | 28 | /** 29 | * ConcaveShape class provides an interface for non-moving (static) concave shapes. 30 | * 31 | * @author jezek2 32 | */ 33 | public abstract class ConcaveShape extends CollisionShape { 34 | 35 | protected float collisionMargin = 0f; 36 | 37 | public abstract void processAllTriangles(TriangleCallback callback, Vector3f aabbMin, Vector3f aabbMax); 38 | 39 | public float getMargin() { 40 | return collisionMargin; 41 | } 42 | 43 | public void setMargin(float margin) { 44 | this.collisionMargin = margin; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/ConeShapeX.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | /** 27 | * ConeShape implements a cone shape, around the X axis. 28 | * 29 | * @author jezek2 30 | */ 31 | public class ConeShapeX extends ConeShape { 32 | 33 | public ConeShapeX(float radius, float height) { 34 | super(radius, height); 35 | setConeUpIndex(0); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/ConeShapeZ.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | /** 27 | * ConeShape implements a cone shape, around the Z axis. 28 | * 29 | * @author jezek2 30 | */ 31 | public class ConeShapeZ extends ConeShape { 32 | 33 | public ConeShapeZ(float radius, float height) { 34 | super(radius, height); 35 | setConeUpIndex(2); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/ConvexShape.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | import com.bulletphysics.linearmath.Transform; 27 | import javax.vecmath.Vector3f; 28 | 29 | /** 30 | * ConvexShape is an abstract shape class. It describes general convex shapes 31 | * using the {@link #localGetSupportingVertex localGetSupportingVertex} interface 32 | * used in combination with GJK or ConvexCast. 33 | * 34 | * @author jezek2 35 | */ 36 | public abstract class ConvexShape extends CollisionShape { 37 | 38 | public static final int MAX_PREFERRED_PENETRATION_DIRECTIONS = 10; 39 | 40 | public abstract Vector3f localGetSupportingVertex(Vector3f vec, Vector3f out); 41 | 42 | //#ifndef __SPU__ 43 | public abstract Vector3f localGetSupportingVertexWithoutMargin(Vector3f vec, Vector3f out); 44 | 45 | //notice that the vectors should be unit length 46 | public abstract void batchedUnitVectorGetSupportingVertexWithoutMargin(Vector3f[] vectors, Vector3f[] supportVerticesOut, int numVectors); 47 | //#endif 48 | 49 | public abstract void getAabbSlow(Transform t, Vector3f aabbMin, Vector3f aabbMax); 50 | 51 | public abstract void setLocalScaling(Vector3f scaling); 52 | 53 | public abstract Vector3f getLocalScaling(Vector3f out); 54 | 55 | public abstract void setMargin(float margin); 56 | 57 | public abstract float getMargin(); 58 | 59 | public abstract int getNumPreferredPenetrationDirections(); 60 | 61 | public abstract void getPreferredPenetrationDirection(int index, Vector3f penetrationVector); 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/CylinderShapeX.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | import cz.advel.stack.Stack; 27 | import javax.vecmath.Vector3f; 28 | 29 | /** 30 | * Cylinder shape around the X axis. 31 | * 32 | * @author jezek2 33 | */ 34 | public class CylinderShapeX extends CylinderShape { 35 | 36 | public CylinderShapeX(Vector3f halfExtents) { 37 | super(halfExtents, false); 38 | upAxis = 0; 39 | recalcLocalAabb(); 40 | } 41 | 42 | @Override 43 | public Vector3f localGetSupportingVertexWithoutMargin(Vector3f vec, Vector3f out) { 44 | return cylinderLocalSupportX(getHalfExtentsWithoutMargin(Stack.alloc(Vector3f.class)), vec, out); 45 | } 46 | 47 | @Override 48 | public void batchedUnitVectorGetSupportingVertexWithoutMargin(Vector3f[] vectors, Vector3f[] supportVerticesOut, int numVectors) { 49 | for (int i = 0; i < numVectors; i++) { 50 | cylinderLocalSupportX(getHalfExtentsWithoutMargin(Stack.alloc(Vector3f.class)), vectors[i], supportVerticesOut[i]); 51 | } 52 | } 53 | 54 | @Override 55 | public float getRadius() { 56 | return getHalfExtentsWithMargin(Stack.alloc(Vector3f.class)).y; 57 | } 58 | 59 | @Override 60 | public String getName() { 61 | return "CylinderX"; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/CylinderShapeZ.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | import cz.advel.stack.Stack; 27 | import javax.vecmath.Vector3f; 28 | 29 | /** 30 | * Cylinder shape around the Z axis. 31 | * 32 | * @author jezek2 33 | */ 34 | public class CylinderShapeZ extends CylinderShape { 35 | 36 | public CylinderShapeZ(Vector3f halfExtents) { 37 | super(halfExtents, false); 38 | upAxis = 2; 39 | recalcLocalAabb(); 40 | } 41 | 42 | @Override 43 | public Vector3f localGetSupportingVertexWithoutMargin(Vector3f vec, Vector3f out) { 44 | return cylinderLocalSupportZ(getHalfExtentsWithoutMargin(Stack.alloc(Vector3f.class)), vec, out); 45 | } 46 | 47 | @Override 48 | public void batchedUnitVectorGetSupportingVertexWithoutMargin(Vector3f[] vectors, Vector3f[] supportVerticesOut, int numVectors) { 49 | for (int i = 0; i < numVectors; i++) { 50 | cylinderLocalSupportZ(getHalfExtentsWithoutMargin(Stack.alloc(Vector3f.class)), vectors[i], supportVerticesOut[i]); 51 | } 52 | } 53 | 54 | @Override 55 | public float getRadius() { 56 | return getHalfExtentsWithMargin(Stack.alloc(Vector3f.class)).x; 57 | } 58 | 59 | @Override 60 | public String getName() { 61 | return "CylinderZ"; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/IndexedMesh.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | import java.nio.ByteBuffer; 27 | 28 | /** 29 | * IndexedMesh indexes into existing vertex and index arrays, in a similar way to 30 | * OpenGL's glDrawElements. Instead of the number of indices, we pass the number 31 | * of triangles. 32 | * 33 | * @author jezek2 34 | */ 35 | public class IndexedMesh { 36 | 37 | public int numTriangles; 38 | public ByteBuffer triangleIndexBase; 39 | public int triangleIndexStride; 40 | public int numVertices; 41 | public ByteBuffer vertexBase; 42 | public int vertexStride; 43 | // The index type is set when adding an indexed mesh to the 44 | // TriangleIndexVertexArray, do not set it manually 45 | public ScalarType indexType; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/InternalTriangleIndexCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | import javax.vecmath.Vector3f; 27 | 28 | /** 29 | * Callback for internal processing of triangles. 30 | * 31 | * @see StridingMeshInterface#internalProcessAllTriangles 32 | * @author jezek2 33 | */ 34 | public abstract class InternalTriangleIndexCallback { 35 | 36 | public abstract void internalProcessTriangleIndex(Vector3f[] triangle, int partId, int triangleIndex); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/NodeOverlapCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | /** 27 | * Callback for operating with {@link OptimizedBvh}. 28 | * 29 | * @author jezek2 30 | */ 31 | public abstract class NodeOverlapCallback { 32 | 33 | public abstract void processNode(int subPart, int triangleIndex); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/OptimizedBvhNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | import java.io.Serializable; 27 | import javax.vecmath.Vector3f; 28 | 29 | /** 30 | * OptimizedBvhNode contains both internal and leaf node information. 31 | * 32 | * @author jezek2 33 | */ 34 | public class OptimizedBvhNode implements Serializable { 35 | 36 | private static final long serialVersionUID = 1L; 37 | 38 | public final Vector3f aabbMinOrg = new Vector3f(); 39 | public final Vector3f aabbMaxOrg = new Vector3f(); 40 | 41 | public int escapeIndex; 42 | 43 | // for child nodes 44 | public int subPart; 45 | public int triangleIndex; 46 | 47 | public void set(OptimizedBvhNode n) { 48 | aabbMinOrg.set(n.aabbMinOrg); 49 | aabbMaxOrg.set(n.aabbMaxOrg); 50 | escapeIndex = n.escapeIndex; 51 | subPart = n.subPart; 52 | triangleIndex = n.triangleIndex; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/ScalarType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | /** 27 | * Scalar type, used when accessing triangle mesh data. 28 | * 29 | * @author jezek2 30 | */ 31 | public enum ScalarType { 32 | FLOAT, 33 | DOUBLE, 34 | INTEGER, 35 | SHORT, 36 | FIXEDPOINT88 37 | } 38 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/TraversalMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | /** 27 | * Traversal mode for {@link OptimizedBvh}. 28 | * 29 | * @author jezek2 30 | */ 31 | public enum TraversalMode { 32 | STACKLESS, 33 | STACKLESS_CACHE_FRIENDLY, 34 | RECURSIVE 35 | } 36 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/TriangleCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | import javax.vecmath.Vector3f; 27 | 28 | /** 29 | * TriangleCallback provides a callback for each overlapping triangle when calling 30 | * processAllTriangles.

31 | * 32 | * This callback is called by processAllTriangles for all {@link ConcaveShape} derived 33 | * classes, such as {@link BvhTriangleMeshShape}, {@link StaticPlaneShape} and 34 | * {@link HeightfieldTerrainShape}. 35 | * 36 | * @author jezek2 37 | */ 38 | public abstract class TriangleCallback { 39 | 40 | public abstract void processTriangle(Vector3f[] triangle, int partId, int triangleIndex); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/VertexData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.collision.shapes; 25 | 26 | import com.bulletphysics.linearmath.VectorUtil; 27 | import javax.vecmath.Tuple3f; 28 | import javax.vecmath.Vector3f; 29 | 30 | /** 31 | * Allows accessing vertex data. 32 | * 33 | * @author jezek2 34 | */ 35 | public abstract class VertexData { 36 | 37 | public abstract int getVertexCount(); 38 | 39 | public abstract int getIndexCount(); 40 | 41 | public abstract T getVertex(int idx, T out); 42 | 43 | public abstract void setVertex(int idx, float x, float y, float z); 44 | 45 | public void setVertex(int idx, Tuple3f t) { 46 | setVertex(idx, t.x, t.y, t.z); 47 | } 48 | 49 | public abstract int getIndex(int idx); 50 | 51 | public void getTriangle(int firstIndex, Vector3f scale, Vector3f[] triangle) { 52 | for (int i=0; i<3; i++) { 53 | getVertex(getIndex(firstIndex+i), triangle[i]); 54 | VectorUtil.mul(triangle[i], triangle[i], scale); 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/com/bulletphysics/collision/shapes/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | /** 25 | * Collision shapes. 26 | */ 27 | package com.bulletphysics.collision.shapes; 28 | 29 | -------------------------------------------------------------------------------- /src/com/bulletphysics/demos/applet/Light.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Software OpenGL-like 3D renderer (c) 2008 Martin Dvorak 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 6 | * the use of this software. 7 | * 8 | * Permission is granted to anyone to use this software for any purpose, 9 | * including commercial applications, and to alter it and redistribute it 10 | * freely, subject to the following restrictions: 11 | * 12 | * 1. The origin of this software must not be misrepresented; you must not 13 | * claim that you wrote the original software. If you use this software 14 | * in a product, an acknowledgment in the product documentation would be 15 | * appreciated but is not required. 16 | * 2. Altered source versions must be plainly marked as such, and must not be 17 | * misrepresented as being the original software. 18 | * 3. This notice may not be removed or altered from any source distribution. 19 | */ 20 | 21 | package com.bulletphysics.demos.applet; 22 | 23 | import javax.vecmath.Vector4f; 24 | 25 | /** 26 | * 27 | * @author jezek2 28 | */ 29 | public class Light { 30 | 31 | public boolean enabled = false; 32 | public final Vector4f ambient = new Vector4f(0f, 0f, 0f, 1f); 33 | public final Vector4f diffuse = new Vector4f(1f, 1f, 1f, 1f); 34 | public final Vector4f specular = new Vector4f(1f, 1f, 1f, 1f); 35 | public final Vector4f position = new Vector4f(0f, 0f, 1f, 0f); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/com/bulletphysics/demos/applet/LookUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 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 6 | * the use of this software. 7 | * 8 | * Permission is granted to anyone to use this software for any purpose, 9 | * including commercial applications, and to alter it and redistribute it 10 | * freely, subject to the following restrictions: 11 | * 12 | * 1. The origin of this software must not be misrepresented; you must not 13 | * claim that you wrote the original software. If you use this software 14 | * in a product, an acknowledgment in the product documentation would be 15 | * appreciated but is not required. 16 | * 2. Altered source versions must be plainly marked as such, and must not be 17 | * misrepresented as being the original software. 18 | * 3. This notice may not be removed or altered from any source distribution. 19 | */ 20 | 21 | package com.bulletphysics.demos.applet; 22 | 23 | import java.awt.Graphics2D; 24 | import java.awt.RenderingHints; 25 | import java.awt.Toolkit; 26 | import javax.swing.UIManager; 27 | 28 | /** 29 | * 30 | * @author jezek2 31 | */ 32 | public class LookUtil { 33 | 34 | private static Object oldAA = null; 35 | 36 | public static void pushAntialias(Graphics2D g2) { 37 | oldAA = g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING); 38 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 39 | } 40 | 41 | public static void popAntialias(Graphics2D g2) { 42 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAA); 43 | oldAA = null; 44 | } 45 | 46 | public static boolean isXP() { 47 | if (isWindows()) { 48 | Boolean b = (Boolean)Toolkit.getDefaultToolkit().getDesktopProperty("win.xpstyle.themeActive"); 49 | if (b != null && b) return true; 50 | } 51 | 52 | return false; 53 | } 54 | 55 | public static boolean isWindows() { 56 | Object laf = UIManager.getLookAndFeel(); 57 | if (laf.getClass().getName().equals("com.sun.java.swing.plaf.windows.WindowsLookAndFeel")) { 58 | return true; 59 | } 60 | return false; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/com/bulletphysics/demos/applet/Span.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Software OpenGL-like 3D renderer (c) 2008 Martin Dvorak 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 6 | * the use of this software. 7 | * 8 | * Permission is granted to anyone to use this software for any purpose, 9 | * including commercial applications, and to alter it and redistribute it 10 | * freely, subject to the following restrictions: 11 | * 12 | * 1. The origin of this software must not be misrepresented; you must not 13 | * claim that you wrote the original software. If you use this software 14 | * in a product, an acknowledgment in the product documentation would be 15 | * appreciated but is not required. 16 | * 2. Altered source versions must be plainly marked as such, and must not be 17 | * misrepresented as being the original software. 18 | * 3. This notice may not be removed or altered from any source distribution. 19 | */ 20 | 21 | package com.bulletphysics.demos.applet; 22 | 23 | /** 24 | * 25 | * @author jezek2 26 | */ 27 | class Span { 28 | 29 | public int x1, x2; 30 | public float z1, z2; 31 | public short c1r, c1g, c1b; 32 | public short c2r, c2g, c2b; 33 | 34 | public Span prev, next; 35 | 36 | public void set(Span s) { 37 | x1 = s.x1; 38 | x2 = s.x2; 39 | z1 = s.z1; 40 | z2 = s.z2; 41 | c1r = s.c1r; 42 | c1g = s.c1g; 43 | c1b = s.c1b; 44 | c2r = s.c2r; 45 | c2g = s.c2g; 46 | c2b = s.c2b; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/com/bulletphysics/demos/bsp/BspConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.demos.bsp; 25 | 26 | import com.bulletphysics.util.ObjectArrayList; 27 | import java.io.BufferedReader; 28 | import java.io.IOException; 29 | import java.io.InputStream; 30 | import java.io.InputStreamReader; 31 | import javax.vecmath.Vector3f; 32 | 33 | /** 34 | * 35 | * @author jezek2 36 | */ 37 | public abstract class BspConverter { 38 | 39 | public void convertBsp(InputStream in) throws IOException { 40 | BufferedReader r = new BufferedReader(new InputStreamReader(in, "UTF-8")); 41 | String s; 42 | 43 | ObjectArrayList vertices = new ObjectArrayList(); 44 | while ((s = r.readLine()) != null) { 45 | int count = Integer.parseInt(s); 46 | vertices.clear(); 47 | for (int i=0; i vertices); 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/com/bulletphysics/demos/bsp/exporter.diff: -------------------------------------------------------------------------------- 1 | --- BspDemo.cpp.orig 2007-12-10 03:18:38.000000000 +0100 2 | +++ BspDemo.cpp 2008-01-26 10:53:19.497747800 +0100 3 | @@ -48,16 +48,26 @@ 4 | class BspToBulletConverter : public BspConverter 5 | { 6 | BspDemo* m_demoApp; 7 | + FILE *f; 8 | 9 | public: 10 | 11 | BspToBulletConverter(BspDemo* demoApp) 12 | :m_demoApp(demoApp) 13 | { 14 | + f = fopen("_export_bsp_", "wb"); 15 | } 16 | 17 | + virtual ~BspToBulletConverter() { 18 | + fclose(f); 19 | + } 20 | + 21 | virtual void addConvexVerticesCollider(btAlignedObjectArray& vertices, bool isEntity, const btVector3& entityTargetLocation) 22 | { 23 | + fprintf(f, "%d\n", vertices.size()); 24 | + for (int i=0; i 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.demos.opengl; 25 | 26 | /** 27 | * 28 | * @author jezek2 29 | */ 30 | public class FastFormat { 31 | 32 | private static final char[] DIGITS = "0123456789".toCharArray(); 33 | 34 | public static void append(StringBuilder b, int i) { 35 | if (i < 0) { 36 | b.append('-'); 37 | i = Math.abs(i); 38 | } 39 | 40 | int digit = 1000000000; 41 | boolean first = true; 42 | while (digit >= 1) { 43 | int v = (i/digit); 44 | if (v != 0 || !first) { 45 | b.append(DIGITS[v]); 46 | first = false; 47 | } 48 | i -= v*digit; 49 | digit /= 10; 50 | } 51 | 52 | if (first) b.append('0'); 53 | } 54 | 55 | public static void append(StringBuilder b, float f) { 56 | append(b, f, 2); 57 | } 58 | 59 | public static void append(StringBuilder b, float f, int fracDigits) { 60 | int mult = 10*fracDigits; 61 | int val = Math.round(f*mult); 62 | append(b, val / mult); 63 | b.append('.'); 64 | append(b, Math.abs(val % mult)); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/ActionInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics; 25 | 26 | import com.bulletphysics.collision.dispatch.CollisionWorld; 27 | import com.bulletphysics.linearmath.IDebugDraw; 28 | 29 | /** 30 | * Basic interface to allow actions such as vehicles and characters to be 31 | * updated inside a {@link DynamicsWorld}. 32 | * 33 | * @author tomrbryn 34 | */ 35 | public abstract class ActionInterface { 36 | 37 | public abstract void updateAction(CollisionWorld collisionWorld, float deltaTimeStep); 38 | 39 | public abstract void debugDraw(IDebugDraw debugDrawer); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/DynamicsWorldType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics; 25 | 26 | /** 27 | * Dynamics world type. 28 | * 29 | * @author jezek2 30 | */ 31 | public enum DynamicsWorldType { 32 | SIMPLE_DYNAMICS_WORLD, 33 | DISCRETE_DYNAMICS_WORLD, 34 | CONTINUOUS_DYNAMICS_WORLD 35 | } 36 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/InternalTickCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics; 25 | 26 | /** 27 | * Callback called for each internal tick. 28 | * 29 | * @see DynamicsWorld#setInternalTickCallback 30 | * @author jezek2 31 | */ 32 | public abstract class InternalTickCallback { 33 | 34 | public abstract void internalTick(DynamicsWorld world, float timeStep); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/constraintsolver/ConstraintSolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics.constraintsolver; 25 | 26 | import com.bulletphysics.collision.broadphase.Dispatcher; 27 | import com.bulletphysics.collision.dispatch.CollisionObject; 28 | import com.bulletphysics.collision.narrowphase.PersistentManifold; 29 | import com.bulletphysics.linearmath.IDebugDraw; 30 | import com.bulletphysics.util.ObjectArrayList; 31 | 32 | /** 33 | * Abstract class for constraint solvers. 34 | * 35 | * @author jezek2 36 | */ 37 | public abstract class ConstraintSolver { 38 | 39 | //protected final BulletStack stack = BulletStack.get(); 40 | 41 | public void prepareSolve (int numBodies, int numManifolds) {} 42 | 43 | /** 44 | * Solve a group of constraints. 45 | */ 46 | public abstract float solveGroup(ObjectArrayList bodies, int numBodies, ObjectArrayList manifold, int manifold_offset, int numManifolds, ObjectArrayList constraints, int constraints_offset, int numConstraints, ContactSolverInfo info, IDebugDraw debugDrawer/*, btStackAlloc* stackAlloc*/, Dispatcher dispatcher); 47 | 48 | public void allSolved(ContactSolverInfo info, IDebugDraw debugDrawer/*, btStackAlloc* stackAlloc*/) {} 49 | 50 | /** 51 | * Clear internal cached data and reset random seed. 52 | */ 53 | public abstract void reset(); 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/constraintsolver/ContactConstraintEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics.constraintsolver; 25 | 26 | /** 27 | * TODO: name 28 | * 29 | * @author jezek2 30 | */ 31 | enum ContactConstraintEnum { 32 | DEFAULT_CONTACT_SOLVER_TYPE, 33 | CONTACT_SOLVER_TYPE1, 34 | CONTACT_SOLVER_TYPE2, 35 | USER_CONTACT_SOLVER_TYPE1, 36 | MAX_CONTACT_SOLVER_TYPES 37 | } 38 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/constraintsolver/ContactSolverFunc.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics.constraintsolver; 25 | 26 | import com.bulletphysics.collision.narrowphase.ManifoldPoint; 27 | import com.bulletphysics.dynamics.RigidBody; 28 | 29 | /** 30 | * Contact solving function. 31 | * 32 | * @author jezek2 33 | */ 34 | public abstract class ContactSolverFunc { 35 | 36 | public abstract float resolveContact(RigidBody body1, RigidBody body2, ManifoldPoint contactPoint, ContactSolverInfo info); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/constraintsolver/ContactSolverInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics.constraintsolver; 25 | 26 | /** 27 | * Current state of contact solver. 28 | * 29 | * @author jezek2 30 | */ 31 | public class ContactSolverInfo { 32 | 33 | public float tau = 0.6f; 34 | public float damping = 1f; 35 | public float friction = 0.3f; 36 | public float timeStep; 37 | public float restitution = 0f; 38 | public int numIterations = 10; 39 | public float maxErrorReduction = 20f; 40 | public float sor = 1.3f; 41 | public float erp = 0.2f; // used as Baumgarte factor 42 | public float erp2 = 0.1f; // used in Split Impulse 43 | public boolean splitImpulse = false; 44 | public float splitImpulsePenetrationThreshold = -0.02f; 45 | public float linearSlop = 0f; 46 | public float warmstartingFactor = 0.85f; 47 | 48 | public int solverMode = SolverMode.SOLVER_RANDMIZE_ORDER | SolverMode.SOLVER_CACHE_FRIENDLY | SolverMode.SOLVER_USE_WARMSTARTING; 49 | 50 | public ContactSolverInfo() { 51 | } 52 | 53 | public ContactSolverInfo(ContactSolverInfo g) { 54 | tau = g.tau; 55 | damping = g.damping; 56 | friction = g.friction; 57 | timeStep = g.timeStep; 58 | restitution = g.restitution; 59 | numIterations = g.numIterations; 60 | maxErrorReduction = g.maxErrorReduction; 61 | sor = g.sor; 62 | erp = g.erp; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/constraintsolver/SolverConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics.constraintsolver; 25 | 26 | import javax.vecmath.Vector3f; 27 | 28 | /** 29 | * 1D constraint along a normal axis between bodyA and bodyB. It can be combined 30 | * to solve contact and friction constraints. 31 | * 32 | * @author jezek2 33 | */ 34 | public class SolverConstraint { 35 | 36 | public final Vector3f relpos1CrossNormal = new Vector3f(); 37 | public final Vector3f contactNormal = new Vector3f(); 38 | 39 | public final Vector3f relpos2CrossNormal = new Vector3f(); 40 | public final Vector3f angularComponentA = new Vector3f(); 41 | 42 | public final Vector3f angularComponentB = new Vector3f(); 43 | 44 | public float appliedPushImpulse; 45 | 46 | public float appliedImpulse; 47 | public int solverBodyIdA; 48 | public int solverBodyIdB; 49 | 50 | public float friction; 51 | public float restitution; 52 | public float jacDiagABInv; 53 | public float penetration; 54 | 55 | public SolverConstraintType constraintType; 56 | public int frictionIndex; 57 | public Object originalContactPoint; 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/constraintsolver/SolverConstraintType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics.constraintsolver; 25 | 26 | /** 27 | * Solver constraint type. 28 | * 29 | * @author jezek2 30 | */ 31 | public enum SolverConstraintType { 32 | SOLVER_CONTACT_1D, 33 | SOLVER_FRICTION_1D 34 | } 35 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/constraintsolver/SolverMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics.constraintsolver; 25 | 26 | /** 27 | * Solver flags. 28 | * 29 | * @author jezek2 30 | */ 31 | public class SolverMode { 32 | 33 | public static final int SOLVER_RANDMIZE_ORDER = 1; 34 | public static final int SOLVER_FRICTION_SEPARATE = 2; 35 | public static final int SOLVER_USE_WARMSTARTING = 4; 36 | public static final int SOLVER_CACHE_FRIENDLY = 8; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/constraintsolver/TypedConstraintType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics.constraintsolver; 25 | 26 | /** 27 | * Typed constraint type. 28 | * 29 | * @author jezek2 30 | */ 31 | public enum TypedConstraintType { 32 | POINT2POINT_CONSTRAINT_TYPE, 33 | HINGE_CONSTRAINT_TYPE, 34 | CONETWIST_CONSTRAINT_TYPE, 35 | D6_CONSTRAINT_TYPE, 36 | VEHICLE_CONSTRAINT_TYPE, 37 | SLIDER_CONSTRAINT_TYPE 38 | } 39 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/constraintsolver/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | /** 25 | * Constraints and solvers. 26 | */ 27 | package com.bulletphysics.dynamics.constraintsolver; 28 | 29 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | /** 25 | * DynamicsWorld and RigidBody. 26 | */ 27 | package com.bulletphysics.dynamics; 28 | 29 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/vehicle/DefaultVehicleRaycaster.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics.vehicle; 25 | 26 | import com.bulletphysics.collision.dispatch.CollisionWorld.ClosestRayResultCallback; 27 | import com.bulletphysics.dynamics.DynamicsWorld; 28 | import com.bulletphysics.dynamics.RigidBody; 29 | import javax.vecmath.Vector3f; 30 | 31 | /** 32 | * Default implementation of {@link VehicleRaycaster}. 33 | * 34 | * @author jezek2 35 | */ 36 | public class DefaultVehicleRaycaster extends VehicleRaycaster { 37 | 38 | protected DynamicsWorld dynamicsWorld; 39 | 40 | public DefaultVehicleRaycaster(DynamicsWorld world) { 41 | this.dynamicsWorld = world; 42 | } 43 | 44 | public Object castRay(Vector3f from, Vector3f to, VehicleRaycasterResult result) { 45 | //RayResultCallback& resultCallback; 46 | 47 | ClosestRayResultCallback rayCallback = new ClosestRayResultCallback(from, to); 48 | 49 | dynamicsWorld.rayTest(from, to, rayCallback); 50 | 51 | if (rayCallback.hasHit()) { 52 | RigidBody body = RigidBody.upcast(rayCallback.collisionObject); 53 | if (body != null && body.hasContactResponse()) { 54 | result.hitPointInWorld.set(rayCallback.hitPointWorld); 55 | result.hitNormalInWorld.set(rayCallback.hitNormalWorld); 56 | result.hitNormalInWorld.normalize(); 57 | result.distFraction = rayCallback.closestHitFraction; 58 | return body; 59 | } 60 | } 61 | return null; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/vehicle/VehicleRaycaster.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics.vehicle; 25 | 26 | import javax.vecmath.Vector3f; 27 | 28 | /** 29 | * VehicleRaycaster is provides interface for between vehicle simulation and raycasting. 30 | * 31 | * @author jezek2 32 | */ 33 | public abstract class VehicleRaycaster { 34 | 35 | public abstract Object castRay(Vector3f from, Vector3f to, VehicleRaycasterResult result); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/vehicle/VehicleRaycasterResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics.vehicle; 25 | 26 | import javax.vecmath.Vector3f; 27 | 28 | /** 29 | * Vehicle raycaster result. 30 | * 31 | * @author jezek2 32 | */ 33 | public class VehicleRaycasterResult { 34 | 35 | public final Vector3f hitPointInWorld = new Vector3f(); 36 | public final Vector3f hitNormalInWorld = new Vector3f(); 37 | public float distFraction = -1f; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/vehicle/VehicleTuning.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics.vehicle; 25 | 26 | /** 27 | * Vehicle tuning parameters. 28 | * 29 | * @author jezek2 30 | */ 31 | public class VehicleTuning { 32 | 33 | public float suspensionStiffness = 5.88f; 34 | public float suspensionCompression = 0.83f; 35 | public float suspensionDamping = 0.88f; 36 | public float maxSuspensionTravelCm = 500f; 37 | public float frictionSlip = 10.5f; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/com/bulletphysics/dynamics/vehicle/WheelInfoConstructionInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.dynamics.vehicle; 25 | 26 | import javax.vecmath.Vector3f; 27 | 28 | /** 29 | * 30 | * @author jezek2 31 | */ 32 | public class WheelInfoConstructionInfo { 33 | 34 | public final Vector3f chassisConnectionCS = new Vector3f(); 35 | public final Vector3f wheelDirectionCS = new Vector3f(); 36 | public final Vector3f wheelAxleCS = new Vector3f(); 37 | public float suspensionRestLength; 38 | public float maxSuspensionTravelCm; 39 | public float wheelRadius; 40 | 41 | public float suspensionStiffness; 42 | public float wheelsDampingCompression; 43 | public float wheelsDampingRelaxation; 44 | public float frictionSlip; 45 | public boolean bIsFrontWheel; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/com/bulletphysics/extras/gimpact/GImpactMassUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * This source file is part of GIMPACT Library. 5 | * 6 | * For the latest info, see http://gimpact.sourceforge.net/ 7 | * 8 | * Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. 9 | * email: projectileman@yahoo.com 10 | * 11 | * This software is provided 'as-is', without any express or implied warranty. 12 | * In no event will the authors be held liable for any damages arising from 13 | * the use of this software. 14 | * 15 | * Permission is granted to anyone to use this software for any purpose, 16 | * including commercial applications, and to alter it and redistribute it 17 | * freely, subject to the following restrictions: 18 | * 19 | * 1. The origin of this software must not be misrepresented; you must not 20 | * claim that you wrote the original software. If you use this software 21 | * in a product, an acknowledgment in the product documentation would be 22 | * appreciated but is not required. 23 | * 2. Altered source versions must be plainly marked as such, and must not be 24 | * misrepresented as being the original software. 25 | * 3. This notice may not be removed or altered from any source distribution. 26 | */ 27 | 28 | package com.bulletphysics.extras.gimpact; 29 | 30 | import javax.vecmath.Vector3f; 31 | 32 | /** 33 | * 34 | * @author jezek2 35 | */ 36 | class GImpactMassUtil { 37 | 38 | public static Vector3f get_point_inertia(Vector3f point, float mass, Vector3f out) { 39 | float x2 = point.x * point.x; 40 | float y2 = point.y * point.y; 41 | float z2 = point.z * point.z; 42 | out.set(mass * (y2 + z2), mass * (x2 + z2), mass * (x2 + y2)); 43 | return out; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/com/bulletphysics/extras/gimpact/GImpactTriangleCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * This source file is part of GIMPACT Library. 5 | * 6 | * For the latest info, see http://gimpact.sourceforge.net/ 7 | * 8 | * Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. 9 | * email: projectileman@yahoo.com 10 | * 11 | * This software is provided 'as-is', without any express or implied warranty. 12 | * In no event will the authors be held liable for any damages arising from 13 | * the use of this software. 14 | * 15 | * Permission is granted to anyone to use this software for any purpose, 16 | * including commercial applications, and to alter it and redistribute it 17 | * freely, subject to the following restrictions: 18 | * 19 | * 1. The origin of this software must not be misrepresented; you must not 20 | * claim that you wrote the original software. If you use this software 21 | * in a product, an acknowledgment in the product documentation would be 22 | * appreciated but is not required. 23 | * 2. Altered source versions must be plainly marked as such, and must not be 24 | * misrepresented as being the original software. 25 | * 3. This notice may not be removed or altered from any source distribution. 26 | */ 27 | 28 | package com.bulletphysics.extras.gimpact; 29 | 30 | import com.bulletphysics.collision.dispatch.CollisionObject; 31 | import com.bulletphysics.collision.shapes.TriangleCallback; 32 | import javax.vecmath.Vector3f; 33 | 34 | /** 35 | * 36 | * @author jezek2 37 | */ 38 | class GImpactTriangleCallback extends TriangleCallback { 39 | 40 | public GImpactCollisionAlgorithm algorithm; 41 | public CollisionObject body0; 42 | public CollisionObject body1; 43 | public GImpactShapeInterface gimpactshape0; 44 | public boolean swapped; 45 | public float margin; 46 | 47 | public void processTriangle(Vector3f[] triangle, int partId, int triangleIndex) { 48 | TriangleShapeEx tri1 = new TriangleShapeEx(triangle[0], triangle[1], triangle[2]); 49 | tri1.setMargin(margin); 50 | if (swapped) { 51 | algorithm.setPart0(partId); 52 | algorithm.setFace0(triangleIndex); 53 | } 54 | else { 55 | algorithm.setPart1(partId); 56 | algorithm.setFace1(triangleIndex); 57 | } 58 | algorithm.gimpact_vs_shape(body0, body1, gimpactshape0, tri1, swapped); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/com/bulletphysics/extras/gimpact/Pair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * This source file is part of GIMPACT Library. 5 | * 6 | * For the latest info, see http://gimpact.sourceforge.net/ 7 | * 8 | * Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. 9 | * email: projectileman@yahoo.com 10 | * 11 | * This software is provided 'as-is', without any express or implied warranty. 12 | * In no event will the authors be held liable for any damages arising from 13 | * the use of this software. 14 | * 15 | * Permission is granted to anyone to use this software for any purpose, 16 | * including commercial applications, and to alter it and redistribute it 17 | * freely, subject to the following restrictions: 18 | * 19 | * 1. The origin of this software must not be misrepresented; you must not 20 | * claim that you wrote the original software. If you use this software 21 | * in a product, an acknowledgment in the product documentation would be 22 | * appreciated but is not required. 23 | * 2. Altered source versions must be plainly marked as such, and must not be 24 | * misrepresented as being the original software. 25 | * 3. This notice may not be removed or altered from any source distribution. 26 | */ 27 | 28 | package com.bulletphysics.extras.gimpact; 29 | 30 | /** 31 | * Overlapping pair. 32 | * 33 | * @author jezek2 34 | */ 35 | class Pair { 36 | 37 | public int index1; 38 | public int index2; 39 | 40 | public Pair() { 41 | } 42 | 43 | public Pair(int index1, int index2) { 44 | this.index1 = index1; 45 | this.index2 = index2; 46 | } 47 | 48 | public Pair(Pair p) { 49 | index1 = p.index1; 50 | index2 = p.index2; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/com/bulletphysics/extras/gimpact/PairSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * This source file is part of GIMPACT Library. 5 | * 6 | * For the latest info, see http://gimpact.sourceforge.net/ 7 | * 8 | * Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. 9 | * email: projectileman@yahoo.com 10 | * 11 | * This software is provided 'as-is', without any express or implied warranty. 12 | * In no event will the authors be held liable for any damages arising from 13 | * the use of this software. 14 | * 15 | * Permission is granted to anyone to use this software for any purpose, 16 | * including commercial applications, and to alter it and redistribute it 17 | * freely, subject to the following restrictions: 18 | * 19 | * 1. The origin of this software must not be misrepresented; you must not 20 | * claim that you wrote the original software. If you use this software 21 | * in a product, an acknowledgment in the product documentation would be 22 | * appreciated but is not required. 23 | * 2. Altered source versions must be plainly marked as such, and must not be 24 | * misrepresented as being the original software. 25 | * 3. This notice may not be removed or altered from any source distribution. 26 | */ 27 | 28 | package com.bulletphysics.extras.gimpact; 29 | 30 | /** 31 | * 32 | * @author jezek2 33 | */ 34 | class PairSet { 35 | 36 | private Pair[] array; 37 | private int size = 0; 38 | 39 | public PairSet() { 40 | array = new Pair[32]; 41 | for (int i=0; i= size) throw new IndexOutOfBoundsException(); 56 | return array[index]; 57 | } 58 | 59 | @SuppressWarnings("unchecked") 60 | private void expand() { 61 | Pair[] newArray = new Pair[array.length << 1]; 62 | for (int i=array.length; i 3 | * 4 | * This source file is part of GIMPACT Library. 5 | * 6 | * For the latest info, see http://gimpact.sourceforge.net/ 7 | * 8 | * Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. 9 | * email: projectileman@yahoo.com 10 | * 11 | * This software is provided 'as-is', without any express or implied warranty. 12 | * In no event will the authors be held liable for any damages arising from 13 | * the use of this software. 14 | * 15 | * Permission is granted to anyone to use this software for any purpose, 16 | * including commercial applications, and to alter it and redistribute it 17 | * freely, subject to the following restrictions: 18 | * 19 | * 1. The origin of this software must not be misrepresented; you must not 20 | * claim that you wrote the original software. If you use this software 21 | * in a product, an acknowledgment in the product documentation would be 22 | * appreciated but is not required. 23 | * 2. Altered source versions must be plainly marked as such, and must not be 24 | * misrepresented as being the original software. 25 | * 3. This notice may not be removed or altered from any source distribution. 26 | */ 27 | 28 | package com.bulletphysics.extras.gimpact; 29 | 30 | /** 31 | * 32 | * @author jezek2 33 | */ 34 | enum PlaneIntersectionType { 35 | BACK_PLANE, 36 | COLLIDE_PLANE, 37 | FRONT_PLANE 38 | } 39 | -------------------------------------------------------------------------------- /src/com/bulletphysics/extras/gimpact/PlaneShape.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * This source file is part of GIMPACT Library. 5 | * 6 | * For the latest info, see http://gimpact.sourceforge.net/ 7 | * 8 | * Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. 9 | * email: projectileman@yahoo.com 10 | * 11 | * This software is provided 'as-is', without any express or implied warranty. 12 | * In no event will the authors be held liable for any damages arising from 13 | * the use of this software. 14 | * 15 | * Permission is granted to anyone to use this software for any purpose, 16 | * including commercial applications, and to alter it and redistribute it 17 | * freely, subject to the following restrictions: 18 | * 19 | * 1. The origin of this software must not be misrepresented; you must not 20 | * claim that you wrote the original software. If you use this software 21 | * in a product, an acknowledgment in the product documentation would be 22 | * appreciated but is not required. 23 | * 2. Altered source versions must be plainly marked as such, and must not be 24 | * misrepresented as being the original software. 25 | * 3. This notice may not be removed or altered from any source distribution. 26 | */ 27 | 28 | package com.bulletphysics.extras.gimpact; 29 | 30 | import com.bulletphysics.collision.shapes.StaticPlaneShape; 31 | import com.bulletphysics.linearmath.Transform; 32 | import com.bulletphysics.linearmath.VectorUtil; 33 | import cz.advel.stack.Stack; 34 | import javax.vecmath.Vector3f; 35 | import javax.vecmath.Vector4f; 36 | 37 | /** 38 | * 39 | * @author jezek2 40 | */ 41 | class PlaneShape { 42 | 43 | public static void get_plane_equation(StaticPlaneShape shape, Vector4f equation) { 44 | Vector3f tmp = Stack.alloc(Vector3f.class); 45 | equation.set(shape.getPlaneNormal(tmp)); 46 | equation.w = shape.getPlaneConstant(); 47 | } 48 | 49 | public static void get_plane_equation_transformed(StaticPlaneShape shape, Transform trans, Vector4f equation) { 50 | get_plane_equation(shape, equation); 51 | 52 | Vector3f tmp = Stack.alloc(Vector3f.class); 53 | 54 | trans.basis.getRow(0, tmp); 55 | float x = VectorUtil.dot3(tmp, equation); 56 | trans.basis.getRow(1, tmp); 57 | float y = VectorUtil.dot3(tmp, equation); 58 | trans.basis.getRow(2, tmp); 59 | float z = VectorUtil.dot3(tmp, equation); 60 | 61 | float w = VectorUtil.dot3(trans.origin, equation) + equation.w; 62 | 63 | equation.set(x, y, z, w); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/com/bulletphysics/extras/gimpact/PrimitiveManagerBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * This source file is part of GIMPACT Library. 5 | * 6 | * For the latest info, see http://gimpact.sourceforge.net/ 7 | * 8 | * Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. 9 | * email: projectileman@yahoo.com 10 | * 11 | * This software is provided 'as-is', without any express or implied warranty. 12 | * In no event will the authors be held liable for any damages arising from 13 | * the use of this software. 14 | * 15 | * Permission is granted to anyone to use this software for any purpose, 16 | * including commercial applications, and to alter it and redistribute it 17 | * freely, subject to the following restrictions: 18 | * 19 | * 1. The origin of this software must not be misrepresented; you must not 20 | * claim that you wrote the original software. If you use this software 21 | * in a product, an acknowledgment in the product documentation would be 22 | * appreciated but is not required. 23 | * 2. Altered source versions must be plainly marked as such, and must not be 24 | * misrepresented as being the original software. 25 | * 3. This notice may not be removed or altered from any source distribution. 26 | */ 27 | 28 | package com.bulletphysics.extras.gimpact; 29 | 30 | import com.bulletphysics.extras.gimpact.BoxCollision.AABB; 31 | 32 | /** 33 | * Prototype Base class for primitive classification.

34 | * 35 | * This class is a wrapper for primitive collections.

36 | * 37 | * This tells relevant info for the Bounding Box set classes, which take care of space classification.

38 | * 39 | * This class can manage Compound shapes and trimeshes, and if it is managing trimesh then the 40 | * Hierarchy Bounding Box classes will take advantage of primitive Vs Box overlapping tests for 41 | * getting optimal results and less Per Box compairisons. 42 | * 43 | * @author jezek2 44 | */ 45 | abstract class PrimitiveManagerBase { 46 | 47 | /** 48 | * Determines if this manager consist on only triangles, which special case will be optimized. 49 | */ 50 | public abstract boolean is_trimesh(); 51 | 52 | public abstract int get_primitive_count(); 53 | 54 | public abstract void get_primitive_box(int prim_index, AABB primbox); 55 | 56 | /** 57 | * Retrieves only the points of the triangle, and the collision margin. 58 | */ 59 | public abstract void get_primitive_triangle(int prim_index, PrimitiveTriangle triangle); 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/com/bulletphysics/extras/gimpact/ShapeType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * This source file is part of GIMPACT Library. 5 | * 6 | * For the latest info, see http://gimpact.sourceforge.net/ 7 | * 8 | * Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. 9 | * email: projectileman@yahoo.com 10 | * 11 | * This software is provided 'as-is', without any express or implied warranty. 12 | * In no event will the authors be held liable for any damages arising from 13 | * the use of this software. 14 | * 15 | * Permission is granted to anyone to use this software for any purpose, 16 | * including commercial applications, and to alter it and redistribute it 17 | * freely, subject to the following restrictions: 18 | * 19 | * 1. The origin of this software must not be misrepresented; you must not 20 | * claim that you wrote the original software. If you use this software 21 | * in a product, an acknowledgment in the product documentation would be 22 | * appreciated but is not required. 23 | * 2. Altered source versions must be plainly marked as such, and must not be 24 | * misrepresented as being the original software. 25 | * 3. This notice may not be removed or altered from any source distribution. 26 | */ 27 | 28 | package com.bulletphysics.extras.gimpact; 29 | 30 | /** 31 | * 32 | * @author jezek2 33 | */ 34 | enum ShapeType { 35 | COMPOUND_SHAPE, 36 | TRIMESH_SHAPE_PART, 37 | TRIMESH_SHAPE 38 | } 39 | -------------------------------------------------------------------------------- /src/com/bulletphysics/extras/gimpact/TetrahedronShapeEx.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * This source file is part of GIMPACT Library. 5 | * 6 | * For the latest info, see http://gimpact.sourceforge.net/ 7 | * 8 | * Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. 9 | * email: projectileman@yahoo.com 10 | * 11 | * This software is provided 'as-is', without any express or implied warranty. 12 | * In no event will the authors be held liable for any damages arising from 13 | * the use of this software. 14 | * 15 | * Permission is granted to anyone to use this software for any purpose, 16 | * including commercial applications, and to alter it and redistribute it 17 | * freely, subject to the following restrictions: 18 | * 19 | * 1. The origin of this software must not be misrepresented; you must not 20 | * claim that you wrote the original software. If you use this software 21 | * in a product, an acknowledgment in the product documentation would be 22 | * appreciated but is not required. 23 | * 2. Altered source versions must be plainly marked as such, and must not be 24 | * misrepresented as being the original software. 25 | * 3. This notice may not be removed or altered from any source distribution. 26 | */ 27 | 28 | package com.bulletphysics.extras.gimpact; 29 | 30 | import com.bulletphysics.collision.shapes.BU_Simplex1to4; 31 | import javax.vecmath.Vector3f; 32 | 33 | /** 34 | * Helper class for tetrahedrons. 35 | * 36 | * @author jezek2 37 | */ 38 | class TetrahedronShapeEx extends BU_Simplex1to4 { 39 | 40 | public TetrahedronShapeEx() { 41 | numVertices = 4; 42 | for (int i = 0; i < numVertices; i++) { 43 | vertices[i] = new Vector3f(); 44 | } 45 | } 46 | 47 | public void setVertices(Vector3f v0, Vector3f v1, Vector3f v2, Vector3f v3) { 48 | vertices[0].set(v0); 49 | vertices[1].set(v1); 50 | vertices[2].set(v2); 51 | vertices[3].set(v3); 52 | recalcLocalAabb(); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/com/bulletphysics/extras/gimpact/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | /** 25 | * Provides support for moving concave triangle meshes. 26 | */ 27 | package com.bulletphysics.extras.gimpact; 28 | 29 | -------------------------------------------------------------------------------- /src/com/bulletphysics/linearmath/Clock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.linearmath; 25 | 26 | /** 27 | * Clock is a portable basic clock that measures accurate time in seconds, use for profiling. 28 | * 29 | * @author jezek2 30 | */ 31 | public class Clock { 32 | 33 | private long startTime; 34 | 35 | /** 36 | * Creates a new clock and resets it. 37 | */ 38 | public Clock() { 39 | reset(); 40 | } 41 | 42 | /** 43 | * Resets clock by setting start time to current. 44 | */ 45 | public void reset() { 46 | startTime = System.nanoTime(); 47 | } 48 | 49 | /** 50 | * Returns the time in milliseconds since the last call to reset or since the Clock was created. 51 | */ 52 | public long getTimeMilliseconds() { 53 | return (System.nanoTime() - startTime) / 1000000L; 54 | } 55 | 56 | /** 57 | * Returns the time in microseconds since the last call to reset or since the Clock was created. 58 | */ 59 | public long getTimeMicroseconds() { 60 | return (System.nanoTime() - startTime) / 1000L; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/com/bulletphysics/linearmath/DebugDrawModes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.linearmath; 25 | 26 | /** 27 | * Debug draw modes, used by demo framework. 28 | * 29 | * @author jezek2 30 | */ 31 | public class DebugDrawModes { 32 | 33 | public static final int NO_DEBUG = 0; 34 | public static final int DRAW_WIREFRAME = 1; 35 | public static final int DRAW_AABB = 2; 36 | public static final int DRAW_FEATURES_TEXT = 4; 37 | public static final int DRAW_CONTACT_POINTS = 8; 38 | public static final int NO_DEACTIVATION = 16; 39 | public static final int NO_HELP_TEXT = 32; 40 | public static final int DRAW_TEXT = 64; 41 | public static final int PROFILE_TIMINGS = 128; 42 | public static final int ENABLE_SAT_COMPARISON = 256; 43 | public static final int DISABLE_BULLET_LCP = 512; 44 | public static final int ENABLE_CCD = 1024; 45 | public static final int MAX_DEBUG_DRAW_MODE = 1025; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/com/bulletphysics/linearmath/MotionState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.linearmath; 25 | 26 | /** 27 | * MotionState allows the dynamics world to synchronize the updated world transforms 28 | * with graphics. For optimizations, potentially only moving objects get synchronized 29 | * (using {@link #setWorldTransform setWorldTransform} method). 30 | * 31 | * @author jezek2 32 | */ 33 | public abstract class MotionState { 34 | 35 | /** 36 | * Returns world transform. 37 | */ 38 | public abstract Transform getWorldTransform(Transform out); 39 | 40 | /** 41 | * Sets world transform. This method is called by JBullet whenever an active 42 | * object represented by this MotionState is moved or rotated. 43 | */ 44 | public abstract void setWorldTransform(Transform worldTrans); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/com/bulletphysics/linearmath/ScalarUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.linearmath; 25 | 26 | import com.bulletphysics.BulletGlobals; 27 | 28 | /** 29 | * Utility functions for scalars (floats). 30 | * 31 | * @author jezek2 32 | */ 33 | public class ScalarUtil { 34 | 35 | public static float fsel(float a, float b, float c) { 36 | return a >= 0 ? b : c; 37 | } 38 | 39 | public static boolean fuzzyZero(float x) { 40 | return Math.abs(x) < BulletGlobals.FLT_EPSILON; 41 | } 42 | 43 | public static float atan2Fast(float y, float x) { 44 | float coeff_1 = BulletGlobals.SIMD_PI / 4.0f; 45 | float coeff_2 = 3.0f * coeff_1; 46 | float abs_y = Math.abs(y); 47 | float angle; 48 | if (x >= 0.0f) { 49 | float r = (x - abs_y) / (x + abs_y); 50 | angle = coeff_1 - coeff_1 * r; 51 | } 52 | else { 53 | float r = (x + abs_y) / (abs_y - x); 54 | angle = coeff_2 - coeff_1 * r; 55 | } 56 | return (y < 0.0f) ? -angle : angle; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/com/bulletphysics/linearmath/convexhull/HullFlags.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Stan Melax Convex Hull Computation 5 | * Copyright (c) 2008 Stan Melax http://www.melax.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.linearmath.convexhull; 25 | 26 | /** 27 | * Flags that affects convex hull generation, used in {@link HullDesc#flags}. 28 | * 29 | * @author jezek2 30 | */ 31 | public class HullFlags { 32 | 33 | public static int TRIANGLES = 1 << 0; // report results as triangles, not polygons. 34 | public static int REVERSE_ORDER = 1 << 1; // reverse order of the triangle indices. 35 | public static int DEFAULT = TRIANGLES; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/com/bulletphysics/linearmath/convexhull/HullResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Stan Melax Convex Hull Computation 5 | * Copyright (c) 2008 Stan Melax http://www.melax.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.linearmath.convexhull; 25 | 26 | import com.bulletphysics.util.IntArrayList; 27 | import com.bulletphysics.util.ObjectArrayList; 28 | import javax.vecmath.Vector3f; 29 | 30 | /** 31 | * Contains resulting polygonal representation.

32 | * 33 | * Depending on the {@link #polygons} flag, array of indices consists of:
34 | * for triangles: indices are array indexes into the vertex list
35 | * for polygons: indices are in the form (number of points in face) (p1, p2, p3, ...) 36 | * 37 | * @author jezek2 38 | */ 39 | public class HullResult { 40 | 41 | /** True if indices represents polygons, false indices are triangles. */ 42 | public boolean polygons = true; 43 | 44 | /** Number of vertices in the output hull. */ 45 | public int numOutputVertices = 0; 46 | 47 | /** Array of vertices. */ 48 | public final ObjectArrayList outputVertices = new ObjectArrayList(); 49 | 50 | /** Number of faces produced. */ 51 | public int numFaces = 0; 52 | 53 | /** Total number of indices. */ 54 | public int numIndices = 0; 55 | 56 | /** Array of indices. */ 57 | public final IntArrayList indices = new IntArrayList(); 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/com/bulletphysics/linearmath/convexhull/Int3.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Stan Melax Convex Hull Computation 5 | * Copyright (c) 2008 Stan Melax http://www.melax.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.linearmath.convexhull; 25 | 26 | /** 27 | * 28 | * @author jezek2 29 | */ 30 | class Int3 { 31 | 32 | public int x, y, z; 33 | 34 | public Int3() { 35 | } 36 | 37 | public Int3(int x, int y, int z) { 38 | this.x = x; 39 | this.y = y; 40 | this.z = z; 41 | } 42 | 43 | public Int3(Int3 i) { 44 | x = i.x; 45 | y = i.y; 46 | z = i.z; 47 | } 48 | 49 | public void set(int x, int y, int z) { 50 | this.x = x; 51 | this.y = y; 52 | this.z = z; 53 | } 54 | 55 | public void set(Int3 i) { 56 | x = i.x; 57 | y = i.y; 58 | z = i.z; 59 | } 60 | 61 | public int getCoord(int coord) { 62 | switch (coord) { 63 | case 0: return x; 64 | case 1: return y; 65 | default: return z; 66 | } 67 | } 68 | 69 | public void setCoord(int coord, int value) { 70 | switch (coord) { 71 | case 0: x = value; break; 72 | case 1: y = value; break; 73 | case 2: z = value; break; 74 | } 75 | } 76 | 77 | public boolean equals(Int3 i) { 78 | return (x == i.x && y == i.y && z == i.z); 79 | } 80 | 81 | public IntRef getRef(final int coord) { 82 | return new IntRef() { 83 | @Override 84 | public int get() { 85 | return getCoord(coord); 86 | } 87 | 88 | @Override 89 | public void set(int value) { 90 | setCoord(coord, value); 91 | } 92 | }; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/com/bulletphysics/linearmath/convexhull/Int4.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Stan Melax Convex Hull Computation 5 | * Copyright (c) 2008 Stan Melax http://www.melax.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.linearmath.convexhull; 25 | 26 | /** 27 | * 28 | * @author jezek2 29 | */ 30 | class Int4 { 31 | 32 | public int x, y, z, w; 33 | 34 | public Int4() { 35 | } 36 | 37 | public Int4(int x, int y, int z, int w) { 38 | this.x = x; 39 | this.y = y; 40 | this.z = z; 41 | this.w = w; 42 | } 43 | 44 | public void set(int x, int y, int z, int w) { 45 | this.x = x; 46 | this.y = y; 47 | this.z = z; 48 | this.w = w; 49 | } 50 | 51 | public int getCoord(int coord) { 52 | switch (coord) { 53 | case 0: return x; 54 | case 1: return y; 55 | case 2: return z; 56 | default: return w; 57 | } 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/com/bulletphysics/linearmath/convexhull/IntRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.linearmath.convexhull; 25 | 26 | /** 27 | * 28 | * @author jezek2 29 | */ 30 | abstract class IntRef { 31 | 32 | public abstract int get(); 33 | 34 | public abstract void set(int value); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/com/bulletphysics/linearmath/convexhull/PHullResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Stan Melax Convex Hull Computation 5 | * Copyright (c) 2008 Stan Melax http://www.melax.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.linearmath.convexhull; 25 | 26 | import com.bulletphysics.util.IntArrayList; 27 | import com.bulletphysics.util.ObjectArrayList; 28 | import javax.vecmath.Vector3f; 29 | 30 | /** 31 | * 32 | * @author jezek2 33 | */ 34 | class PHullResult { 35 | 36 | public int vcount = 0; 37 | public int indexCount = 0; 38 | public int faceCount = 0; 39 | public ObjectArrayList vertices = null; 40 | public IntArrayList indices = new IntArrayList(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/com/bulletphysics/linearmath/convexhull/Tri.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Stan Melax Convex Hull Computation 5 | * Copyright (c) 2008 Stan Melax http://www.melax.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.linearmath.convexhull; 25 | 26 | /** 27 | * 28 | * @author jezek2 29 | */ 30 | class Tri extends Int3 { 31 | 32 | public Int3 n = new Int3(); 33 | public int id; 34 | public int vmax; 35 | public float rise; 36 | 37 | public Tri(int a, int b, int c) { 38 | super(a, b, c); 39 | n.set(-1, -1, -1); 40 | vmax = -1; 41 | rise = 0f; 42 | } 43 | 44 | private static int er = -1; 45 | 46 | private static IntRef erRef = new IntRef() { 47 | @Override 48 | public int get() { 49 | return er; 50 | } 51 | 52 | @Override 53 | public void set(int value) { 54 | er = value; 55 | } 56 | }; 57 | 58 | public IntRef neib(int a, int b) { 59 | for (int i = 0; i < 3; i++) { 60 | int i1 = (i + 1) % 3; 61 | int i2 = (i + 2) % 3; 62 | 63 | if (getCoord(i) == a && getCoord(i1) == b) { 64 | return n.getRef(i2); 65 | } 66 | if (getCoord(i) == b && getCoord(i1) == a) { 67 | return n.getRef(i2); 68 | } 69 | } 70 | assert (false); 71 | return erRef; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/com/bulletphysics/linearmath/convexhull/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Stan Melax Convex Hull Computation 5 | * Copyright (c) 2008 Stan Melax http://www.melax.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | /** 25 | * Convex Hull library for converting point clouds to polygonal representation. 26 | */ 27 | package com.bulletphysics.linearmath.convexhull; 28 | 29 | -------------------------------------------------------------------------------- /src/com/bulletphysics/linearmath/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | /** 25 | * Vector math library. 26 | */ 27 | package com.bulletphysics.linearmath; 28 | 29 | -------------------------------------------------------------------------------- /src/com/bulletphysics/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | /** 25 | * Contains global variables and callbacks. 26 | */ 27 | package com.bulletphysics; 28 | 29 | -------------------------------------------------------------------------------- /src/com/bulletphysics/util/FloatArrayList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.util; 25 | 26 | /** 27 | * 28 | * @author jezek2 29 | */ 30 | public class FloatArrayList { 31 | 32 | private float[] array = new float[16]; 33 | private int size; 34 | 35 | public void add(float value) { 36 | if (size == array.length) { 37 | expand(); 38 | } 39 | 40 | array[size++] = value; 41 | } 42 | 43 | private void expand() { 44 | float[] newArray = new float[array.length << 1]; 45 | System.arraycopy(array, 0, newArray, 0, array.length); 46 | array = newArray; 47 | } 48 | 49 | public float remove(int index) { 50 | if (index >= size) throw new IndexOutOfBoundsException(); 51 | float old = array[index]; 52 | System.arraycopy(array, index+1, array, index, size - index - 1); 53 | size--; 54 | return old; 55 | } 56 | 57 | public float get(int index) { 58 | if (index >= size) throw new IndexOutOfBoundsException(); 59 | return array[index]; 60 | } 61 | 62 | public void set(int index, float value) { 63 | if (index >= size) throw new IndexOutOfBoundsException(); 64 | array[index] = value; 65 | } 66 | 67 | public int size() { 68 | return size; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/com/bulletphysics/util/IntArrayList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.util; 25 | 26 | /** 27 | * 28 | * @author jezek2 29 | */ 30 | public class IntArrayList { 31 | 32 | private int[] array = new int[16]; 33 | private int size; 34 | 35 | public void add(int value) { 36 | if (size == array.length) { 37 | expand(); 38 | } 39 | 40 | array[size++] = value; 41 | } 42 | 43 | private void expand() { 44 | int[] newArray = new int[array.length << 1]; 45 | System.arraycopy(array, 0, newArray, 0, array.length); 46 | array = newArray; 47 | } 48 | 49 | public int remove(int index) { 50 | if (index >= size) throw new IndexOutOfBoundsException(); 51 | int old = array[index]; 52 | System.arraycopy(array, index+1, array, index, size - index - 1); 53 | size--; 54 | return old; 55 | } 56 | 57 | public int get(int index) { 58 | if (index >= size) throw new IndexOutOfBoundsException(); 59 | return array[index]; 60 | } 61 | 62 | public void set(int index, int value) { 63 | if (index >= size) throw new IndexOutOfBoundsException(); 64 | array[index] = value; 65 | } 66 | 67 | public int size() { 68 | return size; 69 | } 70 | 71 | public void clear() { 72 | size = 0; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/com/bulletphysics/util/ObjectStackList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | package com.bulletphysics.util; 25 | 26 | /** 27 | * Stack-based object pool for arbitrary objects, returning not supported. 28 | * 29 | * @author jezek2 30 | */ 31 | public class ObjectStackList extends StackList { 32 | 33 | private Class cls; 34 | 35 | public ObjectStackList(Class cls) { 36 | super(false); 37 | this.cls = cls; 38 | } 39 | 40 | @Override 41 | protected T create() { 42 | try { 43 | return cls.newInstance(); 44 | } 45 | catch (InstantiationException e) { 46 | throw new IllegalStateException(e); 47 | } 48 | catch (IllegalAccessException e) { 49 | throw new IllegalStateException(e); 50 | } 51 | } 52 | 53 | @Override 54 | protected void copy(T dest, T src) { 55 | throw new UnsupportedOperationException(); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/com/bulletphysics/util/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Java port of Bullet (c) 2008 Martin Dvorak 3 | * 4 | * Bullet Continuous Collision Detection and Physics Library 5 | * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ 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 9 | * the use of this software. 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. If you use this software 17 | * in a product, an acknowledgment in the product documentation would be 18 | * appreciated but is not required. 19 | * 2. Altered source versions must be plainly marked as such, and must not be 20 | * misrepresented as being the original software. 21 | * 3. This notice may not be removed or altered from any source distribution. 22 | */ 23 | 24 | /** 25 | * Java-specific utility classes. 26 | */ 27 | package com.bulletphysics.util; 28 | 29 | --------------------------------------------------------------------------------