ruby-bullet 0.1.0-x86-linux → 0.1.1-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +3 -0
- data/Rakefile +14 -2
- data/bindings/bullet/interface/BulletCollision/CollisionDispatch/btCollisionWorld.i +2 -2
- data/bindings/bullet/interface/bullet_wrap.cpp +17548 -6035
- data/bindings/bullet/interface/bullet_wrap.h +7 -7
- data/bindings/bullet/interface/bullet_wrap.o +0 -0
- data/lib/bullet.so +0 -0
- data/lib/ruby-bullet/version.rb +1 -1
- data/ruby-bullet.gemspec +0 -3
- metadata +169 -444
- data/deps/include/bullet/Bullet-C-Api.h +0 -176
- data/deps/include/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.h +0 -1051
- data/deps/include/bullet/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h +0 -82
- data/deps/include/bullet/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h +0 -270
- data/deps/include/bullet/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h +0 -80
- data/deps/include/bullet/BulletCollision/BroadphaseCollision/btDbvt.h +0 -1257
- data/deps/include/bullet/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h +0 -146
- data/deps/include/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h +0 -110
- data/deps/include/bullet/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h +0 -151
- data/deps/include/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h +0 -469
- data/deps/include/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h +0 -40
- data/deps/include/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.h +0 -579
- data/deps/include/bullet/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h +0 -171
- data/deps/include/bullet/BulletCollision/CollisionDispatch/SphereTriangleDetector.h +0 -51
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h +0 -36
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h +0 -66
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.h +0 -66
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btBoxBoxDetector.h +0 -44
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btCollisionConfiguration.h +0 -48
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h +0 -45
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcher.h +0 -172
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btCollisionObject.h +0 -524
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h +0 -509
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h +0 -86
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h +0 -95
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h +0 -116
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h +0 -109
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h +0 -84
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h +0 -137
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h +0 -54
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btGhostObject.h +0 -175
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btInternalEdgeUtility.h +0 -46
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btManifoldResult.h +0 -128
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.h +0 -81
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.h +0 -75
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h +0 -66
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h +0 -69
- data/deps/include/bullet/BulletCollision/CollisionDispatch/btUnionFind.h +0 -129
- data/deps/include/bullet/BulletCollision/CollisionShapes/btBox2dShape.h +0 -369
- data/deps/include/bullet/BulletCollision/CollisionShapes/btBoxShape.h +0 -312
- data/deps/include/bullet/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h +0 -139
- data/deps/include/bullet/BulletCollision/CollisionShapes/btCapsuleShape.h +0 -173
- data/deps/include/bullet/BulletCollision/CollisionShapes/btCollisionMargin.h +0 -27
- data/deps/include/bullet/BulletCollision/CollisionShapes/btCollisionShape.h +0 -150
- data/deps/include/bullet/BulletCollision/CollisionShapes/btCompoundShape.h +0 -212
- data/deps/include/bullet/BulletCollision/CollisionShapes/btConcaveShape.h +0 -60
- data/deps/include/bullet/BulletCollision/CollisionShapes/btConeShape.h +0 -103
- data/deps/include/bullet/BulletCollision/CollisionShapes/btConvex2dShape.h +0 -80
- data/deps/include/bullet/BulletCollision/CollisionShapes/btConvexHullShape.h +0 -122
- data/deps/include/bullet/BulletCollision/CollisionShapes/btConvexInternalShape.h +0 -224
- data/deps/include/bullet/BulletCollision/CollisionShapes/btConvexPointCloudShape.h +0 -105
- data/deps/include/bullet/BulletCollision/CollisionShapes/btConvexPolyhedron.h +0 -62
- data/deps/include/bullet/BulletCollision/CollisionShapes/btConvexShape.h +0 -84
- data/deps/include/bullet/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h +0 -75
- data/deps/include/bullet/BulletCollision/CollisionShapes/btCylinderShape.h +0 -200
- data/deps/include/bullet/BulletCollision/CollisionShapes/btEmptyShape.h +0 -70
- data/deps/include/bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h +0 -161
- data/deps/include/bullet/BulletCollision/CollisionShapes/btMaterial.h +0 -35
- data/deps/include/bullet/BulletCollision/CollisionShapes/btMinkowskiSumShape.h +0 -60
- data/deps/include/bullet/BulletCollision/CollisionShapes/btMultiSphereShape.h +0 -99
- data/deps/include/bullet/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.h +0 -120
- data/deps/include/bullet/BulletCollision/CollisionShapes/btOptimizedBvh.h +0 -65
- data/deps/include/bullet/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h +0 -112
- data/deps/include/bullet/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h +0 -93
- data/deps/include/bullet/BulletCollision/CollisionShapes/btShapeHull.h +0 -59
- data/deps/include/bullet/BulletCollision/CollisionShapes/btSphereShape.h +0 -73
- data/deps/include/bullet/BulletCollision/CollisionShapes/btStaticPlaneShape.h +0 -103
- data/deps/include/bullet/BulletCollision/CollisionShapes/btStridingMeshInterface.h +0 -162
- data/deps/include/bullet/BulletCollision/CollisionShapes/btTetrahedronShape.h +0 -74
- data/deps/include/bullet/BulletCollision/CollisionShapes/btTriangleBuffer.h +0 -69
- data/deps/include/bullet/BulletCollision/CollisionShapes/btTriangleCallback.h +0 -42
- data/deps/include/bullet/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h +0 -133
- data/deps/include/bullet/BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.h +0 -84
- data/deps/include/bullet/BulletCollision/CollisionShapes/btTriangleInfoMap.h +0 -241
- data/deps/include/bullet/BulletCollision/CollisionShapes/btTriangleMesh.h +0 -69
- data/deps/include/bullet/BulletCollision/CollisionShapes/btTriangleMeshShape.h +0 -89
- data/deps/include/bullet/BulletCollision/CollisionShapes/btTriangleShape.h +0 -182
- data/deps/include/bullet/BulletCollision/CollisionShapes/btUniformScalingShape.h +0 -87
- data/deps/include/bullet/BulletCollision/Gimpact/btBoxCollision.h +0 -647
- data/deps/include/bullet/BulletCollision/Gimpact/btClipPolygon.h +0 -182
- data/deps/include/bullet/BulletCollision/Gimpact/btContactProcessing.h +0 -145
- data/deps/include/bullet/BulletCollision/Gimpact/btGImpactBvh.h +0 -396
- data/deps/include/bullet/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h +0 -306
- data/deps/include/bullet/BulletCollision/Gimpact/btGImpactMassUtil.h +0 -60
- data/deps/include/bullet/BulletCollision/Gimpact/btGImpactQuantizedBvh.h +0 -372
- data/deps/include/bullet/BulletCollision/Gimpact/btGImpactShape.h +0 -1171
- data/deps/include/bullet/BulletCollision/Gimpact/btGenericPoolAllocator.h +0 -163
- data/deps/include/bullet/BulletCollision/Gimpact/btGeometryOperations.h +0 -212
- data/deps/include/bullet/BulletCollision/Gimpact/btQuantization.h +0 -88
- data/deps/include/bullet/BulletCollision/Gimpact/btTriangleShapeEx.h +0 -180
- data/deps/include/bullet/BulletCollision/Gimpact/gim_array.h +0 -326
- data/deps/include/bullet/BulletCollision/Gimpact/gim_basic_geometry_operations.h +0 -543
- data/deps/include/bullet/BulletCollision/Gimpact/gim_bitset.h +0 -123
- data/deps/include/bullet/BulletCollision/Gimpact/gim_box_collision.h +0 -590
- data/deps/include/bullet/BulletCollision/Gimpact/gim_box_set.h +0 -674
- data/deps/include/bullet/BulletCollision/Gimpact/gim_clip_polygon.h +0 -210
- data/deps/include/bullet/BulletCollision/Gimpact/gim_contact.h +0 -164
- data/deps/include/bullet/BulletCollision/Gimpact/gim_geom_types.h +0 -97
- data/deps/include/bullet/BulletCollision/Gimpact/gim_geometry.h +0 -42
- data/deps/include/bullet/BulletCollision/Gimpact/gim_hash_table.h +0 -902
- data/deps/include/bullet/BulletCollision/Gimpact/gim_linear_math.h +0 -1573
- data/deps/include/bullet/BulletCollision/Gimpact/gim_math.h +0 -157
- data/deps/include/bullet/BulletCollision/Gimpact/gim_memory.h +0 -190
- data/deps/include/bullet/BulletCollision/Gimpact/gim_radixsort.h +0 -406
- data/deps/include/bullet/BulletCollision/Gimpact/gim_tri_collision.h +0 -379
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.h +0 -59
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btConvexCast.h +0 -73
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h +0 -42
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h +0 -91
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h +0 -50
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btGjkEpa2.h +0 -75
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h +0 -43
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h +0 -103
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h +0 -158
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h +0 -40
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h +0 -228
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btPointCollector.h +0 -64
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.h +0 -46
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btRaycastCallback.h +0 -72
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h +0 -63
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h +0 -50
- data/deps/include/bullet/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h +0 -179
- data/deps/include/bullet/BulletCollision/btBulletCollisionCommon.h +0 -69
- data/deps/include/bullet/BulletDynamics/Character/btCharacterControllerInterface.h +0 -46
- data/deps/include/bullet/BulletDynamics/Character/btKinematicCharacterController.h +0 -163
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h +0 -346
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btConstraintSolver.h +0 -52
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.h +0 -71
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btContactSolverInfo.h +0 -87
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h +0 -614
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.h +0 -99
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btHinge2Constraint.h +0 -58
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.h +0 -381
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btJacobianEntry.h +0 -156
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h +0 -161
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h +0 -130
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btSliderConstraint.h +0 -333
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.h +0 -107
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h +0 -191
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btSolverConstraint.h +0 -98
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.h +0 -452
- data/deps/include/bullet/BulletDynamics/ConstraintSolver/btUniversalConstraint.h +0 -62
- data/deps/include/bullet/BulletDynamics/Dynamics/btActionInterface.h +0 -46
- data/deps/include/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h +0 -203
- data/deps/include/bullet/BulletDynamics/Dynamics/btDynamicsWorld.h +0 -151
- data/deps/include/bullet/BulletDynamics/Dynamics/btRigidBody.h +0 -691
- data/deps/include/bullet/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h +0 -89
- data/deps/include/bullet/BulletDynamics/Vehicle/btRaycastVehicle.h +0 -236
- data/deps/include/bullet/BulletDynamics/Vehicle/btVehicleRaycaster.h +0 -35
- data/deps/include/bullet/BulletDynamics/Vehicle/btWheelInfo.h +0 -119
- data/deps/include/bullet/BulletDynamics/btBulletDynamicsCommon.h +0 -48
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolverBuffer_DX11.h +0 -323
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolverLinkData_DX11.h +0 -103
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolverLinkData_DX11SIMDAware.h +0 -173
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolverTriangleData_DX11.h +0 -96
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolverVertexBuffer_DX11.h +0 -107
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolverVertexData_DX11.h +0 -63
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11.h +0 -691
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11SIMDAware.h +0 -81
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolverBuffer_OpenCL.h +0 -209
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolverLinkData_OpenCL.h +0 -99
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolverLinkData_OpenCLSIMDAware.h +0 -169
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolverOutputCLtoGL.h +0 -62
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolverTriangleData_OpenCL.h +0 -84
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolverVertexBuffer_OpenGL.h +0 -166
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolverVertexData_OpenCL.h +0 -52
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolver_OpenCL.h +0 -527
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/btSoftBodySolver_OpenCLSIMDAware.h +0 -81
- data/deps/include/bullet/BulletMultiThreaded/GpuSoftBodySolvers/Shared/btSoftBodySolverData.h +0 -748
- data/deps/include/bullet/BulletMultiThreaded/HeapManager.h +0 -117
- data/deps/include/bullet/BulletMultiThreaded/PlatformDefinitions.h +0 -99
- data/deps/include/bullet/BulletMultiThreaded/PosixThreadSupport.h +0 -142
- data/deps/include/bullet/BulletMultiThreaded/PpuAddressSpace.h +0 -37
- data/deps/include/bullet/BulletMultiThreaded/SequentialThreadSupport.h +0 -96
- data/deps/include/bullet/BulletMultiThreaded/SpuCollisionObjectWrapper.h +0 -40
- data/deps/include/bullet/BulletMultiThreaded/SpuCollisionTaskProcess.h +0 -163
- data/deps/include/bullet/BulletMultiThreaded/SpuContactManifoldCollisionAlgorithm.h +0 -120
- data/deps/include/bullet/BulletMultiThreaded/SpuDoubleBuffer.h +0 -126
- data/deps/include/bullet/BulletMultiThreaded/SpuFakeDma.h +0 -135
- data/deps/include/bullet/BulletMultiThreaded/SpuGatheringCollisionDispatcher.h +0 -72
- data/deps/include/bullet/BulletMultiThreaded/SpuLibspe2Support.h +0 -180
- data/deps/include/bullet/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/Box.h +0 -167
- data/deps/include/bullet/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuCollisionShapes.h +0 -128
- data/deps/include/bullet/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.h +0 -106
- data/deps/include/bullet/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuConvexPenetrationDepthSolver.h +0 -51
- data/deps/include/bullet/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h +0 -140
- data/deps/include/bullet/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuLocalSupport.h +0 -19
- data/deps/include/bullet/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.h +0 -48
- data/deps/include/bullet/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuPreferredPenetrationDirections.h +0 -70
- data/deps/include/bullet/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/boxBoxDistance.h +0 -65
- data/deps/include/bullet/BulletMultiThreaded/SpuSampleTask/SpuSampleTask.h +0 -54
- data/deps/include/bullet/BulletMultiThreaded/SpuSampleTaskProcess.h +0 -153
- data/deps/include/bullet/BulletMultiThreaded/SpuSync.h +0 -149
- data/deps/include/bullet/BulletMultiThreaded/TrbDynBody.h +0 -79
- data/deps/include/bullet/BulletMultiThreaded/TrbStateVec.h +0 -339
- data/deps/include/bullet/BulletMultiThreaded/Win32ThreadSupport.h +0 -138
- data/deps/include/bullet/BulletMultiThreaded/btGpu3DGridBroadphase.h +0 -138
- data/deps/include/bullet/BulletMultiThreaded/btGpu3DGridBroadphaseSharedCode.h +0 -430
- data/deps/include/bullet/BulletMultiThreaded/btGpu3DGridBroadphaseSharedDefs.h +0 -61
- data/deps/include/bullet/BulletMultiThreaded/btGpu3DGridBroadphaseSharedTypes.h +0 -67
- data/deps/include/bullet/BulletMultiThreaded/btGpuDefines.h +0 -211
- data/deps/include/bullet/BulletMultiThreaded/btGpuUtilsSharedCode.h +0 -55
- data/deps/include/bullet/BulletMultiThreaded/btGpuUtilsSharedDefs.h +0 -52
- data/deps/include/bullet/BulletMultiThreaded/btParallelConstraintSolver.h +0 -285
- data/deps/include/bullet/BulletMultiThreaded/btThreadSupportInterface.h +0 -85
- data/deps/include/bullet/BulletMultiThreaded/vectormath2bullet.h +0 -73
- data/deps/include/bullet/BulletSoftBody/btDefaultSoftBodySolver.h +0 -63
- data/deps/include/bullet/BulletSoftBody/btSoftBody.h +0 -987
- data/deps/include/bullet/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h +0 -153
- data/deps/include/bullet/BulletSoftBody/btSoftBodyData.h +0 -217
- data/deps/include/bullet/BulletSoftBody/btSoftBodyHelpers.h +0 -143
- data/deps/include/bullet/BulletSoftBody/btSoftBodyInternals.h +0 -930
- data/deps/include/bullet/BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.h +0 -48
- data/deps/include/bullet/BulletSoftBody/btSoftBodySolverVertexBuffer.h +0 -165
- data/deps/include/bullet/BulletSoftBody/btSoftBodySolvers.h +0 -154
- data/deps/include/bullet/BulletSoftBody/btSoftRigidCollisionAlgorithm.h +0 -75
- data/deps/include/bullet/BulletSoftBody/btSoftRigidDynamicsWorld.h +0 -107
- data/deps/include/bullet/BulletSoftBody/btSoftSoftCollisionAlgorithm.h +0 -69
- data/deps/include/bullet/BulletSoftBody/btSparseSDF.h +0 -306
- data/deps/include/bullet/LinearMath/btAabbUtil2.h +0 -236
- data/deps/include/bullet/LinearMath/btAlignedAllocator.h +0 -107
- data/deps/include/bullet/LinearMath/btAlignedObjectArray.h +0 -494
- data/deps/include/bullet/LinearMath/btConvexHull.h +0 -241
- data/deps/include/bullet/LinearMath/btConvexHullComputer.h +0 -103
- data/deps/include/bullet/LinearMath/btDefaultMotionState.h +0 -40
- data/deps/include/bullet/LinearMath/btGeometryUtil.h +0 -42
- data/deps/include/bullet/LinearMath/btGrahamScan2dConvexHull.h +0 -110
- data/deps/include/bullet/LinearMath/btHashMap.h +0 -450
- data/deps/include/bullet/LinearMath/btIDebugDraw.h +0 -418
- data/deps/include/bullet/LinearMath/btList.h +0 -73
- data/deps/include/bullet/LinearMath/btMatrix3x3.h +0 -771
- data/deps/include/bullet/LinearMath/btMinMax.h +0 -71
- data/deps/include/bullet/LinearMath/btMotionState.h +0 -40
- data/deps/include/bullet/LinearMath/btPoolAllocator.h +0 -121
- data/deps/include/bullet/LinearMath/btQuadWord.h +0 -180
- data/deps/include/bullet/LinearMath/btQuaternion.h +0 -430
- data/deps/include/bullet/LinearMath/btQuickprof.h +0 -203
- data/deps/include/bullet/LinearMath/btRandom.h +0 -42
- data/deps/include/bullet/LinearMath/btScalar.h +0 -539
- data/deps/include/bullet/LinearMath/btSerializer.h +0 -639
- data/deps/include/bullet/LinearMath/btStackAlloc.h +0 -116
- data/deps/include/bullet/LinearMath/btTransform.h +0 -307
- data/deps/include/bullet/LinearMath/btTransformUtil.h +0 -228
- data/deps/include/bullet/LinearMath/btVector3.h +0 -766
- data/deps/include/bullet/MiniCL/MiniCLTask/MiniCLTask.h +0 -62
- data/deps/include/bullet/MiniCL/MiniCLTaskScheduler.h +0 -194
- data/deps/include/bullet/MiniCL/cl.h +0 -867
- data/deps/include/bullet/MiniCL/cl_MiniCL_Defs.h +0 -439
- data/deps/include/bullet/MiniCL/cl_gl.h +0 -113
- data/deps/include/bullet/MiniCL/cl_platform.h +0 -254
- data/deps/include/bullet/btBulletCollisionCommon.h +0 -69
- data/deps/include/bullet/btBulletDynamicsCommon.h +0 -48
- data/deps/include/bullet/vectormath/scalar/boolInVec.h +0 -225
- data/deps/include/bullet/vectormath/scalar/floatInVec.h +0 -343
- data/deps/include/bullet/vectormath/scalar/mat_aos.h +0 -1630
- data/deps/include/bullet/vectormath/scalar/quat_aos.h +0 -433
- data/deps/include/bullet/vectormath/scalar/vec_aos.h +0 -1426
- data/deps/include/bullet/vectormath/scalar/vectormath_aos.h +0 -1872
- data/deps/include/bullet/vectormath/sse/boolInVec.h +0 -247
- data/deps/include/bullet/vectormath/sse/floatInVec.h +0 -340
- data/deps/include/bullet/vectormath/sse/mat_aos.h +0 -2190
- data/deps/include/bullet/vectormath/sse/quat_aos.h +0 -579
- data/deps/include/bullet/vectormath/sse/vec_aos.h +0 -1455
- data/deps/include/bullet/vectormath/sse/vecidx_aos.h +0 -80
- data/deps/include/bullet/vectormath/sse/vectormath_aos.h +0 -2547
- data/deps/include/bullet/vectormath/vmInclude.h +0 -27
- data/deps/lib/libBulletCollision.a +0 -0
- data/deps/lib/libBulletDynamics.a +0 -0
- data/deps/lib/libBulletMultiThreaded.a +0 -0
- data/deps/lib/libBulletSoftBody.a +0 -0
- data/deps/lib/libBulletSoftBodySolvers_OpenCL_Mini.a +0 -0
- data/deps/lib/libLinearMath.a +0 -0
- data/deps/lib/libMiniCL.a +0 -0
@@ -1,1426 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (C) 2009 Sony Computer Entertainment Inc.
|
3
|
-
All rights reserved.
|
4
|
-
|
5
|
-
This software is provided 'as-is', without any express or implied warranty.
|
6
|
-
In no event will the authors be held liable for any damages arising from the use of this software.
|
7
|
-
Permission is granted to anyone to use this software for any purpose,
|
8
|
-
including commercial applications, and to alter it and redistribute it freely,
|
9
|
-
subject to the following restrictions:
|
10
|
-
|
11
|
-
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
12
|
-
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
13
|
-
3. This notice may not be removed or altered from any source distribution.
|
14
|
-
|
15
|
-
*/
|
16
|
-
|
17
|
-
#ifndef _VECTORMATH_VEC_AOS_CPP_H
|
18
|
-
#define _VECTORMATH_VEC_AOS_CPP_H
|
19
|
-
|
20
|
-
//-----------------------------------------------------------------------------
|
21
|
-
// Constants
|
22
|
-
|
23
|
-
#define _VECTORMATH_SLERP_TOL 0.999f
|
24
|
-
|
25
|
-
//-----------------------------------------------------------------------------
|
26
|
-
// Definitions
|
27
|
-
|
28
|
-
#ifndef _VECTORMATH_INTERNAL_FUNCTIONS
|
29
|
-
#define _VECTORMATH_INTERNAL_FUNCTIONS
|
30
|
-
|
31
|
-
#endif
|
32
|
-
|
33
|
-
namespace Vectormath {
|
34
|
-
namespace Aos {
|
35
|
-
|
36
|
-
inline Vector3::Vector3( const Vector3 & vec )
|
37
|
-
{
|
38
|
-
mX = vec.mX;
|
39
|
-
mY = vec.mY;
|
40
|
-
mZ = vec.mZ;
|
41
|
-
}
|
42
|
-
|
43
|
-
inline Vector3::Vector3( float _x, float _y, float _z )
|
44
|
-
{
|
45
|
-
mX = _x;
|
46
|
-
mY = _y;
|
47
|
-
mZ = _z;
|
48
|
-
}
|
49
|
-
|
50
|
-
inline Vector3::Vector3( const Point3 & pnt )
|
51
|
-
{
|
52
|
-
mX = pnt.getX();
|
53
|
-
mY = pnt.getY();
|
54
|
-
mZ = pnt.getZ();
|
55
|
-
}
|
56
|
-
|
57
|
-
inline Vector3::Vector3( float scalar )
|
58
|
-
{
|
59
|
-
mX = scalar;
|
60
|
-
mY = scalar;
|
61
|
-
mZ = scalar;
|
62
|
-
}
|
63
|
-
|
64
|
-
inline const Vector3 Vector3::xAxis( )
|
65
|
-
{
|
66
|
-
return Vector3( 1.0f, 0.0f, 0.0f );
|
67
|
-
}
|
68
|
-
|
69
|
-
inline const Vector3 Vector3::yAxis( )
|
70
|
-
{
|
71
|
-
return Vector3( 0.0f, 1.0f, 0.0f );
|
72
|
-
}
|
73
|
-
|
74
|
-
inline const Vector3 Vector3::zAxis( )
|
75
|
-
{
|
76
|
-
return Vector3( 0.0f, 0.0f, 1.0f );
|
77
|
-
}
|
78
|
-
|
79
|
-
inline const Vector3 lerp( float t, const Vector3 & vec0, const Vector3 & vec1 )
|
80
|
-
{
|
81
|
-
return ( vec0 + ( ( vec1 - vec0 ) * t ) );
|
82
|
-
}
|
83
|
-
|
84
|
-
inline const Vector3 slerp( float t, const Vector3 & unitVec0, const Vector3 & unitVec1 )
|
85
|
-
{
|
86
|
-
float recipSinAngle, scale0, scale1, cosAngle, angle;
|
87
|
-
cosAngle = dot( unitVec0, unitVec1 );
|
88
|
-
if ( cosAngle < _VECTORMATH_SLERP_TOL ) {
|
89
|
-
angle = acosf( cosAngle );
|
90
|
-
recipSinAngle = ( 1.0f / sinf( angle ) );
|
91
|
-
scale0 = ( sinf( ( ( 1.0f - t ) * angle ) ) * recipSinAngle );
|
92
|
-
scale1 = ( sinf( ( t * angle ) ) * recipSinAngle );
|
93
|
-
} else {
|
94
|
-
scale0 = ( 1.0f - t );
|
95
|
-
scale1 = t;
|
96
|
-
}
|
97
|
-
return ( ( unitVec0 * scale0 ) + ( unitVec1 * scale1 ) );
|
98
|
-
}
|
99
|
-
|
100
|
-
inline void loadXYZ( Vector3 & vec, const float * fptr )
|
101
|
-
{
|
102
|
-
vec = Vector3( fptr[0], fptr[1], fptr[2] );
|
103
|
-
}
|
104
|
-
|
105
|
-
inline void storeXYZ( const Vector3 & vec, float * fptr )
|
106
|
-
{
|
107
|
-
fptr[0] = vec.getX();
|
108
|
-
fptr[1] = vec.getY();
|
109
|
-
fptr[2] = vec.getZ();
|
110
|
-
}
|
111
|
-
|
112
|
-
inline void loadHalfFloats( Vector3 & vec, const unsigned short * hfptr )
|
113
|
-
{
|
114
|
-
union Data32 {
|
115
|
-
unsigned int u32;
|
116
|
-
float f32;
|
117
|
-
};
|
118
|
-
|
119
|
-
for (int i = 0; i < 3; i++) {
|
120
|
-
unsigned short fp16 = hfptr[i];
|
121
|
-
unsigned int sign = fp16 >> 15;
|
122
|
-
unsigned int exponent = (fp16 >> 10) & ((1 << 5) - 1);
|
123
|
-
unsigned int mantissa = fp16 & ((1 << 10) - 1);
|
124
|
-
|
125
|
-
if (exponent == 0) {
|
126
|
-
// zero
|
127
|
-
mantissa = 0;
|
128
|
-
|
129
|
-
} else if (exponent == 31) {
|
130
|
-
// infinity or nan -> infinity
|
131
|
-
exponent = 255;
|
132
|
-
mantissa = 0;
|
133
|
-
|
134
|
-
} else {
|
135
|
-
exponent += 127 - 15;
|
136
|
-
mantissa <<= 13;
|
137
|
-
}
|
138
|
-
|
139
|
-
Data32 d;
|
140
|
-
d.u32 = (sign << 31) | (exponent << 23) | mantissa;
|
141
|
-
vec[i] = d.f32;
|
142
|
-
}
|
143
|
-
}
|
144
|
-
|
145
|
-
inline void storeHalfFloats( const Vector3 & vec, unsigned short * hfptr )
|
146
|
-
{
|
147
|
-
union Data32 {
|
148
|
-
unsigned int u32;
|
149
|
-
float f32;
|
150
|
-
};
|
151
|
-
|
152
|
-
for (int i = 0; i < 3; i++) {
|
153
|
-
Data32 d;
|
154
|
-
d.f32 = vec[i];
|
155
|
-
|
156
|
-
unsigned int sign = d.u32 >> 31;
|
157
|
-
unsigned int exponent = (d.u32 >> 23) & ((1 << 8) - 1);
|
158
|
-
unsigned int mantissa = d.u32 & ((1 << 23) - 1);;
|
159
|
-
|
160
|
-
if (exponent == 0) {
|
161
|
-
// zero or denorm -> zero
|
162
|
-
mantissa = 0;
|
163
|
-
|
164
|
-
} else if (exponent == 255 && mantissa != 0) {
|
165
|
-
// nan -> infinity
|
166
|
-
exponent = 31;
|
167
|
-
mantissa = 0;
|
168
|
-
|
169
|
-
} else if (exponent >= 127 - 15 + 31) {
|
170
|
-
// overflow or infinity -> infinity
|
171
|
-
exponent = 31;
|
172
|
-
mantissa = 0;
|
173
|
-
|
174
|
-
} else if (exponent <= 127 - 15) {
|
175
|
-
// underflow -> zero
|
176
|
-
exponent = 0;
|
177
|
-
mantissa = 0;
|
178
|
-
|
179
|
-
} else {
|
180
|
-
exponent -= 127 - 15;
|
181
|
-
mantissa >>= 13;
|
182
|
-
}
|
183
|
-
|
184
|
-
hfptr[i] = (unsigned short)((sign << 15) | (exponent << 10) | mantissa);
|
185
|
-
}
|
186
|
-
}
|
187
|
-
|
188
|
-
inline Vector3 & Vector3::operator =( const Vector3 & vec )
|
189
|
-
{
|
190
|
-
mX = vec.mX;
|
191
|
-
mY = vec.mY;
|
192
|
-
mZ = vec.mZ;
|
193
|
-
return *this;
|
194
|
-
}
|
195
|
-
|
196
|
-
inline Vector3 & Vector3::setX( float _x )
|
197
|
-
{
|
198
|
-
mX = _x;
|
199
|
-
return *this;
|
200
|
-
}
|
201
|
-
|
202
|
-
inline float Vector3::getX( ) const
|
203
|
-
{
|
204
|
-
return mX;
|
205
|
-
}
|
206
|
-
|
207
|
-
inline Vector3 & Vector3::setY( float _y )
|
208
|
-
{
|
209
|
-
mY = _y;
|
210
|
-
return *this;
|
211
|
-
}
|
212
|
-
|
213
|
-
inline float Vector3::getY( ) const
|
214
|
-
{
|
215
|
-
return mY;
|
216
|
-
}
|
217
|
-
|
218
|
-
inline Vector3 & Vector3::setZ( float _z )
|
219
|
-
{
|
220
|
-
mZ = _z;
|
221
|
-
return *this;
|
222
|
-
}
|
223
|
-
|
224
|
-
inline float Vector3::getZ( ) const
|
225
|
-
{
|
226
|
-
return mZ;
|
227
|
-
}
|
228
|
-
|
229
|
-
inline Vector3 & Vector3::setElem( int idx, float value )
|
230
|
-
{
|
231
|
-
*(&mX + idx) = value;
|
232
|
-
return *this;
|
233
|
-
}
|
234
|
-
|
235
|
-
inline float Vector3::getElem( int idx ) const
|
236
|
-
{
|
237
|
-
return *(&mX + idx);
|
238
|
-
}
|
239
|
-
|
240
|
-
inline float & Vector3::operator []( int idx )
|
241
|
-
{
|
242
|
-
return *(&mX + idx);
|
243
|
-
}
|
244
|
-
|
245
|
-
inline float Vector3::operator []( int idx ) const
|
246
|
-
{
|
247
|
-
return *(&mX + idx);
|
248
|
-
}
|
249
|
-
|
250
|
-
inline const Vector3 Vector3::operator +( const Vector3 & vec ) const
|
251
|
-
{
|
252
|
-
return Vector3(
|
253
|
-
( mX + vec.mX ),
|
254
|
-
( mY + vec.mY ),
|
255
|
-
( mZ + vec.mZ )
|
256
|
-
);
|
257
|
-
}
|
258
|
-
|
259
|
-
inline const Vector3 Vector3::operator -( const Vector3 & vec ) const
|
260
|
-
{
|
261
|
-
return Vector3(
|
262
|
-
( mX - vec.mX ),
|
263
|
-
( mY - vec.mY ),
|
264
|
-
( mZ - vec.mZ )
|
265
|
-
);
|
266
|
-
}
|
267
|
-
|
268
|
-
inline const Point3 Vector3::operator +( const Point3 & pnt ) const
|
269
|
-
{
|
270
|
-
return Point3(
|
271
|
-
( mX + pnt.getX() ),
|
272
|
-
( mY + pnt.getY() ),
|
273
|
-
( mZ + pnt.getZ() )
|
274
|
-
);
|
275
|
-
}
|
276
|
-
|
277
|
-
inline const Vector3 Vector3::operator *( float scalar ) const
|
278
|
-
{
|
279
|
-
return Vector3(
|
280
|
-
( mX * scalar ),
|
281
|
-
( mY * scalar ),
|
282
|
-
( mZ * scalar )
|
283
|
-
);
|
284
|
-
}
|
285
|
-
|
286
|
-
inline Vector3 & Vector3::operator +=( const Vector3 & vec )
|
287
|
-
{
|
288
|
-
*this = *this + vec;
|
289
|
-
return *this;
|
290
|
-
}
|
291
|
-
|
292
|
-
inline Vector3 & Vector3::operator -=( const Vector3 & vec )
|
293
|
-
{
|
294
|
-
*this = *this - vec;
|
295
|
-
return *this;
|
296
|
-
}
|
297
|
-
|
298
|
-
inline Vector3 & Vector3::operator *=( float scalar )
|
299
|
-
{
|
300
|
-
*this = *this * scalar;
|
301
|
-
return *this;
|
302
|
-
}
|
303
|
-
|
304
|
-
inline const Vector3 Vector3::operator /( float scalar ) const
|
305
|
-
{
|
306
|
-
return Vector3(
|
307
|
-
( mX / scalar ),
|
308
|
-
( mY / scalar ),
|
309
|
-
( mZ / scalar )
|
310
|
-
);
|
311
|
-
}
|
312
|
-
|
313
|
-
inline Vector3 & Vector3::operator /=( float scalar )
|
314
|
-
{
|
315
|
-
*this = *this / scalar;
|
316
|
-
return *this;
|
317
|
-
}
|
318
|
-
|
319
|
-
inline const Vector3 Vector3::operator -( ) const
|
320
|
-
{
|
321
|
-
return Vector3(
|
322
|
-
-mX,
|
323
|
-
-mY,
|
324
|
-
-mZ
|
325
|
-
);
|
326
|
-
}
|
327
|
-
|
328
|
-
inline const Vector3 operator *( float scalar, const Vector3 & vec )
|
329
|
-
{
|
330
|
-
return vec * scalar;
|
331
|
-
}
|
332
|
-
|
333
|
-
inline const Vector3 mulPerElem( const Vector3 & vec0, const Vector3 & vec1 )
|
334
|
-
{
|
335
|
-
return Vector3(
|
336
|
-
( vec0.getX() * vec1.getX() ),
|
337
|
-
( vec0.getY() * vec1.getY() ),
|
338
|
-
( vec0.getZ() * vec1.getZ() )
|
339
|
-
);
|
340
|
-
}
|
341
|
-
|
342
|
-
inline const Vector3 divPerElem( const Vector3 & vec0, const Vector3 & vec1 )
|
343
|
-
{
|
344
|
-
return Vector3(
|
345
|
-
( vec0.getX() / vec1.getX() ),
|
346
|
-
( vec0.getY() / vec1.getY() ),
|
347
|
-
( vec0.getZ() / vec1.getZ() )
|
348
|
-
);
|
349
|
-
}
|
350
|
-
|
351
|
-
inline const Vector3 recipPerElem( const Vector3 & vec )
|
352
|
-
{
|
353
|
-
return Vector3(
|
354
|
-
( 1.0f / vec.getX() ),
|
355
|
-
( 1.0f / vec.getY() ),
|
356
|
-
( 1.0f / vec.getZ() )
|
357
|
-
);
|
358
|
-
}
|
359
|
-
|
360
|
-
inline const Vector3 sqrtPerElem( const Vector3 & vec )
|
361
|
-
{
|
362
|
-
return Vector3(
|
363
|
-
sqrtf( vec.getX() ),
|
364
|
-
sqrtf( vec.getY() ),
|
365
|
-
sqrtf( vec.getZ() )
|
366
|
-
);
|
367
|
-
}
|
368
|
-
|
369
|
-
inline const Vector3 rsqrtPerElem( const Vector3 & vec )
|
370
|
-
{
|
371
|
-
return Vector3(
|
372
|
-
( 1.0f / sqrtf( vec.getX() ) ),
|
373
|
-
( 1.0f / sqrtf( vec.getY() ) ),
|
374
|
-
( 1.0f / sqrtf( vec.getZ() ) )
|
375
|
-
);
|
376
|
-
}
|
377
|
-
|
378
|
-
inline const Vector3 absPerElem( const Vector3 & vec )
|
379
|
-
{
|
380
|
-
return Vector3(
|
381
|
-
fabsf( vec.getX() ),
|
382
|
-
fabsf( vec.getY() ),
|
383
|
-
fabsf( vec.getZ() )
|
384
|
-
);
|
385
|
-
}
|
386
|
-
|
387
|
-
inline const Vector3 copySignPerElem( const Vector3 & vec0, const Vector3 & vec1 )
|
388
|
-
{
|
389
|
-
return Vector3(
|
390
|
-
( vec1.getX() < 0.0f )? -fabsf( vec0.getX() ) : fabsf( vec0.getX() ),
|
391
|
-
( vec1.getY() < 0.0f )? -fabsf( vec0.getY() ) : fabsf( vec0.getY() ),
|
392
|
-
( vec1.getZ() < 0.0f )? -fabsf( vec0.getZ() ) : fabsf( vec0.getZ() )
|
393
|
-
);
|
394
|
-
}
|
395
|
-
|
396
|
-
inline const Vector3 maxPerElem( const Vector3 & vec0, const Vector3 & vec1 )
|
397
|
-
{
|
398
|
-
return Vector3(
|
399
|
-
(vec0.getX() > vec1.getX())? vec0.getX() : vec1.getX(),
|
400
|
-
(vec0.getY() > vec1.getY())? vec0.getY() : vec1.getY(),
|
401
|
-
(vec0.getZ() > vec1.getZ())? vec0.getZ() : vec1.getZ()
|
402
|
-
);
|
403
|
-
}
|
404
|
-
|
405
|
-
inline float maxElem( const Vector3 & vec )
|
406
|
-
{
|
407
|
-
float result;
|
408
|
-
result = (vec.getX() > vec.getY())? vec.getX() : vec.getY();
|
409
|
-
result = (vec.getZ() > result)? vec.getZ() : result;
|
410
|
-
return result;
|
411
|
-
}
|
412
|
-
|
413
|
-
inline const Vector3 minPerElem( const Vector3 & vec0, const Vector3 & vec1 )
|
414
|
-
{
|
415
|
-
return Vector3(
|
416
|
-
(vec0.getX() < vec1.getX())? vec0.getX() : vec1.getX(),
|
417
|
-
(vec0.getY() < vec1.getY())? vec0.getY() : vec1.getY(),
|
418
|
-
(vec0.getZ() < vec1.getZ())? vec0.getZ() : vec1.getZ()
|
419
|
-
);
|
420
|
-
}
|
421
|
-
|
422
|
-
inline float minElem( const Vector3 & vec )
|
423
|
-
{
|
424
|
-
float result;
|
425
|
-
result = (vec.getX() < vec.getY())? vec.getX() : vec.getY();
|
426
|
-
result = (vec.getZ() < result)? vec.getZ() : result;
|
427
|
-
return result;
|
428
|
-
}
|
429
|
-
|
430
|
-
inline float sum( const Vector3 & vec )
|
431
|
-
{
|
432
|
-
float result;
|
433
|
-
result = ( vec.getX() + vec.getY() );
|
434
|
-
result = ( result + vec.getZ() );
|
435
|
-
return result;
|
436
|
-
}
|
437
|
-
|
438
|
-
inline float dot( const Vector3 & vec0, const Vector3 & vec1 )
|
439
|
-
{
|
440
|
-
float result;
|
441
|
-
result = ( vec0.getX() * vec1.getX() );
|
442
|
-
result = ( result + ( vec0.getY() * vec1.getY() ) );
|
443
|
-
result = ( result + ( vec0.getZ() * vec1.getZ() ) );
|
444
|
-
return result;
|
445
|
-
}
|
446
|
-
|
447
|
-
inline float lengthSqr( const Vector3 & vec )
|
448
|
-
{
|
449
|
-
float result;
|
450
|
-
result = ( vec.getX() * vec.getX() );
|
451
|
-
result = ( result + ( vec.getY() * vec.getY() ) );
|
452
|
-
result = ( result + ( vec.getZ() * vec.getZ() ) );
|
453
|
-
return result;
|
454
|
-
}
|
455
|
-
|
456
|
-
inline float length( const Vector3 & vec )
|
457
|
-
{
|
458
|
-
return ::sqrtf( lengthSqr( vec ) );
|
459
|
-
}
|
460
|
-
|
461
|
-
inline const Vector3 normalize( const Vector3 & vec )
|
462
|
-
{
|
463
|
-
float lenSqr, lenInv;
|
464
|
-
lenSqr = lengthSqr( vec );
|
465
|
-
lenInv = ( 1.0f / sqrtf( lenSqr ) );
|
466
|
-
return Vector3(
|
467
|
-
( vec.getX() * lenInv ),
|
468
|
-
( vec.getY() * lenInv ),
|
469
|
-
( vec.getZ() * lenInv )
|
470
|
-
);
|
471
|
-
}
|
472
|
-
|
473
|
-
inline const Vector3 cross( const Vector3 & vec0, const Vector3 & vec1 )
|
474
|
-
{
|
475
|
-
return Vector3(
|
476
|
-
( ( vec0.getY() * vec1.getZ() ) - ( vec0.getZ() * vec1.getY() ) ),
|
477
|
-
( ( vec0.getZ() * vec1.getX() ) - ( vec0.getX() * vec1.getZ() ) ),
|
478
|
-
( ( vec0.getX() * vec1.getY() ) - ( vec0.getY() * vec1.getX() ) )
|
479
|
-
);
|
480
|
-
}
|
481
|
-
|
482
|
-
inline const Vector3 select( const Vector3 & vec0, const Vector3 & vec1, bool select1 )
|
483
|
-
{
|
484
|
-
return Vector3(
|
485
|
-
( select1 )? vec1.getX() : vec0.getX(),
|
486
|
-
( select1 )? vec1.getY() : vec0.getY(),
|
487
|
-
( select1 )? vec1.getZ() : vec0.getZ()
|
488
|
-
);
|
489
|
-
}
|
490
|
-
|
491
|
-
#ifdef _VECTORMATH_DEBUG
|
492
|
-
|
493
|
-
inline void print( const Vector3 & vec )
|
494
|
-
{
|
495
|
-
printf( "( %f %f %f )\n", vec.getX(), vec.getY(), vec.getZ() );
|
496
|
-
}
|
497
|
-
|
498
|
-
inline void print( const Vector3 & vec, const char * name )
|
499
|
-
{
|
500
|
-
printf( "%s: ( %f %f %f )\n", name, vec.getX(), vec.getY(), vec.getZ() );
|
501
|
-
}
|
502
|
-
|
503
|
-
#endif
|
504
|
-
|
505
|
-
inline Vector4::Vector4( const Vector4 & vec )
|
506
|
-
{
|
507
|
-
mX = vec.mX;
|
508
|
-
mY = vec.mY;
|
509
|
-
mZ = vec.mZ;
|
510
|
-
mW = vec.mW;
|
511
|
-
}
|
512
|
-
|
513
|
-
inline Vector4::Vector4( float _x, float _y, float _z, float _w )
|
514
|
-
{
|
515
|
-
mX = _x;
|
516
|
-
mY = _y;
|
517
|
-
mZ = _z;
|
518
|
-
mW = _w;
|
519
|
-
}
|
520
|
-
|
521
|
-
inline Vector4::Vector4( const Vector3 & xyz, float _w )
|
522
|
-
{
|
523
|
-
this->setXYZ( xyz );
|
524
|
-
this->setW( _w );
|
525
|
-
}
|
526
|
-
|
527
|
-
inline Vector4::Vector4( const Vector3 & vec )
|
528
|
-
{
|
529
|
-
mX = vec.getX();
|
530
|
-
mY = vec.getY();
|
531
|
-
mZ = vec.getZ();
|
532
|
-
mW = 0.0f;
|
533
|
-
}
|
534
|
-
|
535
|
-
inline Vector4::Vector4( const Point3 & pnt )
|
536
|
-
{
|
537
|
-
mX = pnt.getX();
|
538
|
-
mY = pnt.getY();
|
539
|
-
mZ = pnt.getZ();
|
540
|
-
mW = 1.0f;
|
541
|
-
}
|
542
|
-
|
543
|
-
inline Vector4::Vector4( const Quat & quat )
|
544
|
-
{
|
545
|
-
mX = quat.getX();
|
546
|
-
mY = quat.getY();
|
547
|
-
mZ = quat.getZ();
|
548
|
-
mW = quat.getW();
|
549
|
-
}
|
550
|
-
|
551
|
-
inline Vector4::Vector4( float scalar )
|
552
|
-
{
|
553
|
-
mX = scalar;
|
554
|
-
mY = scalar;
|
555
|
-
mZ = scalar;
|
556
|
-
mW = scalar;
|
557
|
-
}
|
558
|
-
|
559
|
-
inline const Vector4 Vector4::xAxis( )
|
560
|
-
{
|
561
|
-
return Vector4( 1.0f, 0.0f, 0.0f, 0.0f );
|
562
|
-
}
|
563
|
-
|
564
|
-
inline const Vector4 Vector4::yAxis( )
|
565
|
-
{
|
566
|
-
return Vector4( 0.0f, 1.0f, 0.0f, 0.0f );
|
567
|
-
}
|
568
|
-
|
569
|
-
inline const Vector4 Vector4::zAxis( )
|
570
|
-
{
|
571
|
-
return Vector4( 0.0f, 0.0f, 1.0f, 0.0f );
|
572
|
-
}
|
573
|
-
|
574
|
-
inline const Vector4 Vector4::wAxis( )
|
575
|
-
{
|
576
|
-
return Vector4( 0.0f, 0.0f, 0.0f, 1.0f );
|
577
|
-
}
|
578
|
-
|
579
|
-
inline const Vector4 lerp( float t, const Vector4 & vec0, const Vector4 & vec1 )
|
580
|
-
{
|
581
|
-
return ( vec0 + ( ( vec1 - vec0 ) * t ) );
|
582
|
-
}
|
583
|
-
|
584
|
-
inline const Vector4 slerp( float t, const Vector4 & unitVec0, const Vector4 & unitVec1 )
|
585
|
-
{
|
586
|
-
float recipSinAngle, scale0, scale1, cosAngle, angle;
|
587
|
-
cosAngle = dot( unitVec0, unitVec1 );
|
588
|
-
if ( cosAngle < _VECTORMATH_SLERP_TOL ) {
|
589
|
-
angle = acosf( cosAngle );
|
590
|
-
recipSinAngle = ( 1.0f / sinf( angle ) );
|
591
|
-
scale0 = ( sinf( ( ( 1.0f - t ) * angle ) ) * recipSinAngle );
|
592
|
-
scale1 = ( sinf( ( t * angle ) ) * recipSinAngle );
|
593
|
-
} else {
|
594
|
-
scale0 = ( 1.0f - t );
|
595
|
-
scale1 = t;
|
596
|
-
}
|
597
|
-
return ( ( unitVec0 * scale0 ) + ( unitVec1 * scale1 ) );
|
598
|
-
}
|
599
|
-
|
600
|
-
inline void loadXYZW( Vector4 & vec, const float * fptr )
|
601
|
-
{
|
602
|
-
vec = Vector4( fptr[0], fptr[1], fptr[2], fptr[3] );
|
603
|
-
}
|
604
|
-
|
605
|
-
inline void storeXYZW( const Vector4 & vec, float * fptr )
|
606
|
-
{
|
607
|
-
fptr[0] = vec.getX();
|
608
|
-
fptr[1] = vec.getY();
|
609
|
-
fptr[2] = vec.getZ();
|
610
|
-
fptr[3] = vec.getW();
|
611
|
-
}
|
612
|
-
|
613
|
-
inline void loadHalfFloats( Vector4 & vec, const unsigned short * hfptr )
|
614
|
-
{
|
615
|
-
union Data32 {
|
616
|
-
unsigned int u32;
|
617
|
-
float f32;
|
618
|
-
};
|
619
|
-
|
620
|
-
for (int i = 0; i < 4; i++) {
|
621
|
-
unsigned short fp16 = hfptr[i];
|
622
|
-
unsigned int sign = fp16 >> 15;
|
623
|
-
unsigned int exponent = (fp16 >> 10) & ((1 << 5) - 1);
|
624
|
-
unsigned int mantissa = fp16 & ((1 << 10) - 1);
|
625
|
-
|
626
|
-
if (exponent == 0) {
|
627
|
-
// zero
|
628
|
-
mantissa = 0;
|
629
|
-
|
630
|
-
} else if (exponent == 31) {
|
631
|
-
// infinity or nan -> infinity
|
632
|
-
exponent = 255;
|
633
|
-
mantissa = 0;
|
634
|
-
|
635
|
-
} else {
|
636
|
-
exponent += 127 - 15;
|
637
|
-
mantissa <<= 13;
|
638
|
-
}
|
639
|
-
|
640
|
-
Data32 d;
|
641
|
-
d.u32 = (sign << 31) | (exponent << 23) | mantissa;
|
642
|
-
vec[i] = d.f32;
|
643
|
-
}
|
644
|
-
}
|
645
|
-
|
646
|
-
inline void storeHalfFloats( const Vector4 & vec, unsigned short * hfptr )
|
647
|
-
{
|
648
|
-
union Data32 {
|
649
|
-
unsigned int u32;
|
650
|
-
float f32;
|
651
|
-
};
|
652
|
-
|
653
|
-
for (int i = 0; i < 4; i++) {
|
654
|
-
Data32 d;
|
655
|
-
d.f32 = vec[i];
|
656
|
-
|
657
|
-
unsigned int sign = d.u32 >> 31;
|
658
|
-
unsigned int exponent = (d.u32 >> 23) & ((1 << 8) - 1);
|
659
|
-
unsigned int mantissa = d.u32 & ((1 << 23) - 1);;
|
660
|
-
|
661
|
-
if (exponent == 0) {
|
662
|
-
// zero or denorm -> zero
|
663
|
-
mantissa = 0;
|
664
|
-
|
665
|
-
} else if (exponent == 255 && mantissa != 0) {
|
666
|
-
// nan -> infinity
|
667
|
-
exponent = 31;
|
668
|
-
mantissa = 0;
|
669
|
-
|
670
|
-
} else if (exponent >= 127 - 15 + 31) {
|
671
|
-
// overflow or infinity -> infinity
|
672
|
-
exponent = 31;
|
673
|
-
mantissa = 0;
|
674
|
-
|
675
|
-
} else if (exponent <= 127 - 15) {
|
676
|
-
// underflow -> zero
|
677
|
-
exponent = 0;
|
678
|
-
mantissa = 0;
|
679
|
-
|
680
|
-
} else {
|
681
|
-
exponent -= 127 - 15;
|
682
|
-
mantissa >>= 13;
|
683
|
-
}
|
684
|
-
|
685
|
-
hfptr[i] = (unsigned short)((sign << 15) | (exponent << 10) | mantissa);
|
686
|
-
}
|
687
|
-
}
|
688
|
-
|
689
|
-
inline Vector4 & Vector4::operator =( const Vector4 & vec )
|
690
|
-
{
|
691
|
-
mX = vec.mX;
|
692
|
-
mY = vec.mY;
|
693
|
-
mZ = vec.mZ;
|
694
|
-
mW = vec.mW;
|
695
|
-
return *this;
|
696
|
-
}
|
697
|
-
|
698
|
-
inline Vector4 & Vector4::setXYZ( const Vector3 & vec )
|
699
|
-
{
|
700
|
-
mX = vec.getX();
|
701
|
-
mY = vec.getY();
|
702
|
-
mZ = vec.getZ();
|
703
|
-
return *this;
|
704
|
-
}
|
705
|
-
|
706
|
-
inline const Vector3 Vector4::getXYZ( ) const
|
707
|
-
{
|
708
|
-
return Vector3( mX, mY, mZ );
|
709
|
-
}
|
710
|
-
|
711
|
-
inline Vector4 & Vector4::setX( float _x )
|
712
|
-
{
|
713
|
-
mX = _x;
|
714
|
-
return *this;
|
715
|
-
}
|
716
|
-
|
717
|
-
inline float Vector4::getX( ) const
|
718
|
-
{
|
719
|
-
return mX;
|
720
|
-
}
|
721
|
-
|
722
|
-
inline Vector4 & Vector4::setY( float _y )
|
723
|
-
{
|
724
|
-
mY = _y;
|
725
|
-
return *this;
|
726
|
-
}
|
727
|
-
|
728
|
-
inline float Vector4::getY( ) const
|
729
|
-
{
|
730
|
-
return mY;
|
731
|
-
}
|
732
|
-
|
733
|
-
inline Vector4 & Vector4::setZ( float _z )
|
734
|
-
{
|
735
|
-
mZ = _z;
|
736
|
-
return *this;
|
737
|
-
}
|
738
|
-
|
739
|
-
inline float Vector4::getZ( ) const
|
740
|
-
{
|
741
|
-
return mZ;
|
742
|
-
}
|
743
|
-
|
744
|
-
inline Vector4 & Vector4::setW( float _w )
|
745
|
-
{
|
746
|
-
mW = _w;
|
747
|
-
return *this;
|
748
|
-
}
|
749
|
-
|
750
|
-
inline float Vector4::getW( ) const
|
751
|
-
{
|
752
|
-
return mW;
|
753
|
-
}
|
754
|
-
|
755
|
-
inline Vector4 & Vector4::setElem( int idx, float value )
|
756
|
-
{
|
757
|
-
*(&mX + idx) = value;
|
758
|
-
return *this;
|
759
|
-
}
|
760
|
-
|
761
|
-
inline float Vector4::getElem( int idx ) const
|
762
|
-
{
|
763
|
-
return *(&mX + idx);
|
764
|
-
}
|
765
|
-
|
766
|
-
inline float & Vector4::operator []( int idx )
|
767
|
-
{
|
768
|
-
return *(&mX + idx);
|
769
|
-
}
|
770
|
-
|
771
|
-
inline float Vector4::operator []( int idx ) const
|
772
|
-
{
|
773
|
-
return *(&mX + idx);
|
774
|
-
}
|
775
|
-
|
776
|
-
inline const Vector4 Vector4::operator +( const Vector4 & vec ) const
|
777
|
-
{
|
778
|
-
return Vector4(
|
779
|
-
( mX + vec.mX ),
|
780
|
-
( mY + vec.mY ),
|
781
|
-
( mZ + vec.mZ ),
|
782
|
-
( mW + vec.mW )
|
783
|
-
);
|
784
|
-
}
|
785
|
-
|
786
|
-
inline const Vector4 Vector4::operator -( const Vector4 & vec ) const
|
787
|
-
{
|
788
|
-
return Vector4(
|
789
|
-
( mX - vec.mX ),
|
790
|
-
( mY - vec.mY ),
|
791
|
-
( mZ - vec.mZ ),
|
792
|
-
( mW - vec.mW )
|
793
|
-
);
|
794
|
-
}
|
795
|
-
|
796
|
-
inline const Vector4 Vector4::operator *( float scalar ) const
|
797
|
-
{
|
798
|
-
return Vector4(
|
799
|
-
( mX * scalar ),
|
800
|
-
( mY * scalar ),
|
801
|
-
( mZ * scalar ),
|
802
|
-
( mW * scalar )
|
803
|
-
);
|
804
|
-
}
|
805
|
-
|
806
|
-
inline Vector4 & Vector4::operator +=( const Vector4 & vec )
|
807
|
-
{
|
808
|
-
*this = *this + vec;
|
809
|
-
return *this;
|
810
|
-
}
|
811
|
-
|
812
|
-
inline Vector4 & Vector4::operator -=( const Vector4 & vec )
|
813
|
-
{
|
814
|
-
*this = *this - vec;
|
815
|
-
return *this;
|
816
|
-
}
|
817
|
-
|
818
|
-
inline Vector4 & Vector4::operator *=( float scalar )
|
819
|
-
{
|
820
|
-
*this = *this * scalar;
|
821
|
-
return *this;
|
822
|
-
}
|
823
|
-
|
824
|
-
inline const Vector4 Vector4::operator /( float scalar ) const
|
825
|
-
{
|
826
|
-
return Vector4(
|
827
|
-
( mX / scalar ),
|
828
|
-
( mY / scalar ),
|
829
|
-
( mZ / scalar ),
|
830
|
-
( mW / scalar )
|
831
|
-
);
|
832
|
-
}
|
833
|
-
|
834
|
-
inline Vector4 & Vector4::operator /=( float scalar )
|
835
|
-
{
|
836
|
-
*this = *this / scalar;
|
837
|
-
return *this;
|
838
|
-
}
|
839
|
-
|
840
|
-
inline const Vector4 Vector4::operator -( ) const
|
841
|
-
{
|
842
|
-
return Vector4(
|
843
|
-
-mX,
|
844
|
-
-mY,
|
845
|
-
-mZ,
|
846
|
-
-mW
|
847
|
-
);
|
848
|
-
}
|
849
|
-
|
850
|
-
inline const Vector4 operator *( float scalar, const Vector4 & vec )
|
851
|
-
{
|
852
|
-
return vec * scalar;
|
853
|
-
}
|
854
|
-
|
855
|
-
inline const Vector4 mulPerElem( const Vector4 & vec0, const Vector4 & vec1 )
|
856
|
-
{
|
857
|
-
return Vector4(
|
858
|
-
( vec0.getX() * vec1.getX() ),
|
859
|
-
( vec0.getY() * vec1.getY() ),
|
860
|
-
( vec0.getZ() * vec1.getZ() ),
|
861
|
-
( vec0.getW() * vec1.getW() )
|
862
|
-
);
|
863
|
-
}
|
864
|
-
|
865
|
-
inline const Vector4 divPerElem( const Vector4 & vec0, const Vector4 & vec1 )
|
866
|
-
{
|
867
|
-
return Vector4(
|
868
|
-
( vec0.getX() / vec1.getX() ),
|
869
|
-
( vec0.getY() / vec1.getY() ),
|
870
|
-
( vec0.getZ() / vec1.getZ() ),
|
871
|
-
( vec0.getW() / vec1.getW() )
|
872
|
-
);
|
873
|
-
}
|
874
|
-
|
875
|
-
inline const Vector4 recipPerElem( const Vector4 & vec )
|
876
|
-
{
|
877
|
-
return Vector4(
|
878
|
-
( 1.0f / vec.getX() ),
|
879
|
-
( 1.0f / vec.getY() ),
|
880
|
-
( 1.0f / vec.getZ() ),
|
881
|
-
( 1.0f / vec.getW() )
|
882
|
-
);
|
883
|
-
}
|
884
|
-
|
885
|
-
inline const Vector4 sqrtPerElem( const Vector4 & vec )
|
886
|
-
{
|
887
|
-
return Vector4(
|
888
|
-
sqrtf( vec.getX() ),
|
889
|
-
sqrtf( vec.getY() ),
|
890
|
-
sqrtf( vec.getZ() ),
|
891
|
-
sqrtf( vec.getW() )
|
892
|
-
);
|
893
|
-
}
|
894
|
-
|
895
|
-
inline const Vector4 rsqrtPerElem( const Vector4 & vec )
|
896
|
-
{
|
897
|
-
return Vector4(
|
898
|
-
( 1.0f / sqrtf( vec.getX() ) ),
|
899
|
-
( 1.0f / sqrtf( vec.getY() ) ),
|
900
|
-
( 1.0f / sqrtf( vec.getZ() ) ),
|
901
|
-
( 1.0f / sqrtf( vec.getW() ) )
|
902
|
-
);
|
903
|
-
}
|
904
|
-
|
905
|
-
inline const Vector4 absPerElem( const Vector4 & vec )
|
906
|
-
{
|
907
|
-
return Vector4(
|
908
|
-
fabsf( vec.getX() ),
|
909
|
-
fabsf( vec.getY() ),
|
910
|
-
fabsf( vec.getZ() ),
|
911
|
-
fabsf( vec.getW() )
|
912
|
-
);
|
913
|
-
}
|
914
|
-
|
915
|
-
inline const Vector4 copySignPerElem( const Vector4 & vec0, const Vector4 & vec1 )
|
916
|
-
{
|
917
|
-
return Vector4(
|
918
|
-
( vec1.getX() < 0.0f )? -fabsf( vec0.getX() ) : fabsf( vec0.getX() ),
|
919
|
-
( vec1.getY() < 0.0f )? -fabsf( vec0.getY() ) : fabsf( vec0.getY() ),
|
920
|
-
( vec1.getZ() < 0.0f )? -fabsf( vec0.getZ() ) : fabsf( vec0.getZ() ),
|
921
|
-
( vec1.getW() < 0.0f )? -fabsf( vec0.getW() ) : fabsf( vec0.getW() )
|
922
|
-
);
|
923
|
-
}
|
924
|
-
|
925
|
-
inline const Vector4 maxPerElem( const Vector4 & vec0, const Vector4 & vec1 )
|
926
|
-
{
|
927
|
-
return Vector4(
|
928
|
-
(vec0.getX() > vec1.getX())? vec0.getX() : vec1.getX(),
|
929
|
-
(vec0.getY() > vec1.getY())? vec0.getY() : vec1.getY(),
|
930
|
-
(vec0.getZ() > vec1.getZ())? vec0.getZ() : vec1.getZ(),
|
931
|
-
(vec0.getW() > vec1.getW())? vec0.getW() : vec1.getW()
|
932
|
-
);
|
933
|
-
}
|
934
|
-
|
935
|
-
inline float maxElem( const Vector4 & vec )
|
936
|
-
{
|
937
|
-
float result;
|
938
|
-
result = (vec.getX() > vec.getY())? vec.getX() : vec.getY();
|
939
|
-
result = (vec.getZ() > result)? vec.getZ() : result;
|
940
|
-
result = (vec.getW() > result)? vec.getW() : result;
|
941
|
-
return result;
|
942
|
-
}
|
943
|
-
|
944
|
-
inline const Vector4 minPerElem( const Vector4 & vec0, const Vector4 & vec1 )
|
945
|
-
{
|
946
|
-
return Vector4(
|
947
|
-
(vec0.getX() < vec1.getX())? vec0.getX() : vec1.getX(),
|
948
|
-
(vec0.getY() < vec1.getY())? vec0.getY() : vec1.getY(),
|
949
|
-
(vec0.getZ() < vec1.getZ())? vec0.getZ() : vec1.getZ(),
|
950
|
-
(vec0.getW() < vec1.getW())? vec0.getW() : vec1.getW()
|
951
|
-
);
|
952
|
-
}
|
953
|
-
|
954
|
-
inline float minElem( const Vector4 & vec )
|
955
|
-
{
|
956
|
-
float result;
|
957
|
-
result = (vec.getX() < vec.getY())? vec.getX() : vec.getY();
|
958
|
-
result = (vec.getZ() < result)? vec.getZ() : result;
|
959
|
-
result = (vec.getW() < result)? vec.getW() : result;
|
960
|
-
return result;
|
961
|
-
}
|
962
|
-
|
963
|
-
inline float sum( const Vector4 & vec )
|
964
|
-
{
|
965
|
-
float result;
|
966
|
-
result = ( vec.getX() + vec.getY() );
|
967
|
-
result = ( result + vec.getZ() );
|
968
|
-
result = ( result + vec.getW() );
|
969
|
-
return result;
|
970
|
-
}
|
971
|
-
|
972
|
-
inline float dot( const Vector4 & vec0, const Vector4 & vec1 )
|
973
|
-
{
|
974
|
-
float result;
|
975
|
-
result = ( vec0.getX() * vec1.getX() );
|
976
|
-
result = ( result + ( vec0.getY() * vec1.getY() ) );
|
977
|
-
result = ( result + ( vec0.getZ() * vec1.getZ() ) );
|
978
|
-
result = ( result + ( vec0.getW() * vec1.getW() ) );
|
979
|
-
return result;
|
980
|
-
}
|
981
|
-
|
982
|
-
inline float lengthSqr( const Vector4 & vec )
|
983
|
-
{
|
984
|
-
float result;
|
985
|
-
result = ( vec.getX() * vec.getX() );
|
986
|
-
result = ( result + ( vec.getY() * vec.getY() ) );
|
987
|
-
result = ( result + ( vec.getZ() * vec.getZ() ) );
|
988
|
-
result = ( result + ( vec.getW() * vec.getW() ) );
|
989
|
-
return result;
|
990
|
-
}
|
991
|
-
|
992
|
-
inline float length( const Vector4 & vec )
|
993
|
-
{
|
994
|
-
return ::sqrtf( lengthSqr( vec ) );
|
995
|
-
}
|
996
|
-
|
997
|
-
inline const Vector4 normalize( const Vector4 & vec )
|
998
|
-
{
|
999
|
-
float lenSqr, lenInv;
|
1000
|
-
lenSqr = lengthSqr( vec );
|
1001
|
-
lenInv = ( 1.0f / sqrtf( lenSqr ) );
|
1002
|
-
return Vector4(
|
1003
|
-
( vec.getX() * lenInv ),
|
1004
|
-
( vec.getY() * lenInv ),
|
1005
|
-
( vec.getZ() * lenInv ),
|
1006
|
-
( vec.getW() * lenInv )
|
1007
|
-
);
|
1008
|
-
}
|
1009
|
-
|
1010
|
-
inline const Vector4 select( const Vector4 & vec0, const Vector4 & vec1, bool select1 )
|
1011
|
-
{
|
1012
|
-
return Vector4(
|
1013
|
-
( select1 )? vec1.getX() : vec0.getX(),
|
1014
|
-
( select1 )? vec1.getY() : vec0.getY(),
|
1015
|
-
( select1 )? vec1.getZ() : vec0.getZ(),
|
1016
|
-
( select1 )? vec1.getW() : vec0.getW()
|
1017
|
-
);
|
1018
|
-
}
|
1019
|
-
|
1020
|
-
#ifdef _VECTORMATH_DEBUG
|
1021
|
-
|
1022
|
-
inline void print( const Vector4 & vec )
|
1023
|
-
{
|
1024
|
-
printf( "( %f %f %f %f )\n", vec.getX(), vec.getY(), vec.getZ(), vec.getW() );
|
1025
|
-
}
|
1026
|
-
|
1027
|
-
inline void print( const Vector4 & vec, const char * name )
|
1028
|
-
{
|
1029
|
-
printf( "%s: ( %f %f %f %f )\n", name, vec.getX(), vec.getY(), vec.getZ(), vec.getW() );
|
1030
|
-
}
|
1031
|
-
|
1032
|
-
#endif
|
1033
|
-
|
1034
|
-
inline Point3::Point3( const Point3 & pnt )
|
1035
|
-
{
|
1036
|
-
mX = pnt.mX;
|
1037
|
-
mY = pnt.mY;
|
1038
|
-
mZ = pnt.mZ;
|
1039
|
-
}
|
1040
|
-
|
1041
|
-
inline Point3::Point3( float _x, float _y, float _z )
|
1042
|
-
{
|
1043
|
-
mX = _x;
|
1044
|
-
mY = _y;
|
1045
|
-
mZ = _z;
|
1046
|
-
}
|
1047
|
-
|
1048
|
-
inline Point3::Point3( const Vector3 & vec )
|
1049
|
-
{
|
1050
|
-
mX = vec.getX();
|
1051
|
-
mY = vec.getY();
|
1052
|
-
mZ = vec.getZ();
|
1053
|
-
}
|
1054
|
-
|
1055
|
-
inline Point3::Point3( float scalar )
|
1056
|
-
{
|
1057
|
-
mX = scalar;
|
1058
|
-
mY = scalar;
|
1059
|
-
mZ = scalar;
|
1060
|
-
}
|
1061
|
-
|
1062
|
-
inline const Point3 lerp( float t, const Point3 & pnt0, const Point3 & pnt1 )
|
1063
|
-
{
|
1064
|
-
return ( pnt0 + ( ( pnt1 - pnt0 ) * t ) );
|
1065
|
-
}
|
1066
|
-
|
1067
|
-
inline void loadXYZ( Point3 & pnt, const float * fptr )
|
1068
|
-
{
|
1069
|
-
pnt = Point3( fptr[0], fptr[1], fptr[2] );
|
1070
|
-
}
|
1071
|
-
|
1072
|
-
inline void storeXYZ( const Point3 & pnt, float * fptr )
|
1073
|
-
{
|
1074
|
-
fptr[0] = pnt.getX();
|
1075
|
-
fptr[1] = pnt.getY();
|
1076
|
-
fptr[2] = pnt.getZ();
|
1077
|
-
}
|
1078
|
-
|
1079
|
-
inline void loadHalfFloats( Point3 & vec, const unsigned short * hfptr )
|
1080
|
-
{
|
1081
|
-
union Data32 {
|
1082
|
-
unsigned int u32;
|
1083
|
-
float f32;
|
1084
|
-
};
|
1085
|
-
|
1086
|
-
for (int i = 0; i < 3; i++) {
|
1087
|
-
unsigned short fp16 = hfptr[i];
|
1088
|
-
unsigned int sign = fp16 >> 15;
|
1089
|
-
unsigned int exponent = (fp16 >> 10) & ((1 << 5) - 1);
|
1090
|
-
unsigned int mantissa = fp16 & ((1 << 10) - 1);
|
1091
|
-
|
1092
|
-
if (exponent == 0) {
|
1093
|
-
// zero
|
1094
|
-
mantissa = 0;
|
1095
|
-
|
1096
|
-
} else if (exponent == 31) {
|
1097
|
-
// infinity or nan -> infinity
|
1098
|
-
exponent = 255;
|
1099
|
-
mantissa = 0;
|
1100
|
-
|
1101
|
-
} else {
|
1102
|
-
exponent += 127 - 15;
|
1103
|
-
mantissa <<= 13;
|
1104
|
-
}
|
1105
|
-
|
1106
|
-
Data32 d;
|
1107
|
-
d.u32 = (sign << 31) | (exponent << 23) | mantissa;
|
1108
|
-
vec[i] = d.f32;
|
1109
|
-
}
|
1110
|
-
}
|
1111
|
-
|
1112
|
-
inline void storeHalfFloats( const Point3 & vec, unsigned short * hfptr )
|
1113
|
-
{
|
1114
|
-
union Data32 {
|
1115
|
-
unsigned int u32;
|
1116
|
-
float f32;
|
1117
|
-
};
|
1118
|
-
|
1119
|
-
for (int i = 0; i < 3; i++) {
|
1120
|
-
Data32 d;
|
1121
|
-
d.f32 = vec[i];
|
1122
|
-
|
1123
|
-
unsigned int sign = d.u32 >> 31;
|
1124
|
-
unsigned int exponent = (d.u32 >> 23) & ((1 << 8) - 1);
|
1125
|
-
unsigned int mantissa = d.u32 & ((1 << 23) - 1);;
|
1126
|
-
|
1127
|
-
if (exponent == 0) {
|
1128
|
-
// zero or denorm -> zero
|
1129
|
-
mantissa = 0;
|
1130
|
-
|
1131
|
-
} else if (exponent == 255 && mantissa != 0) {
|
1132
|
-
// nan -> infinity
|
1133
|
-
exponent = 31;
|
1134
|
-
mantissa = 0;
|
1135
|
-
|
1136
|
-
} else if (exponent >= 127 - 15 + 31) {
|
1137
|
-
// overflow or infinity -> infinity
|
1138
|
-
exponent = 31;
|
1139
|
-
mantissa = 0;
|
1140
|
-
|
1141
|
-
} else if (exponent <= 127 - 15) {
|
1142
|
-
// underflow -> zero
|
1143
|
-
exponent = 0;
|
1144
|
-
mantissa = 0;
|
1145
|
-
|
1146
|
-
} else {
|
1147
|
-
exponent -= 127 - 15;
|
1148
|
-
mantissa >>= 13;
|
1149
|
-
}
|
1150
|
-
|
1151
|
-
hfptr[i] = (unsigned short)((sign << 15) | (exponent << 10) | mantissa);
|
1152
|
-
}
|
1153
|
-
}
|
1154
|
-
|
1155
|
-
inline Point3 & Point3::operator =( const Point3 & pnt )
|
1156
|
-
{
|
1157
|
-
mX = pnt.mX;
|
1158
|
-
mY = pnt.mY;
|
1159
|
-
mZ = pnt.mZ;
|
1160
|
-
return *this;
|
1161
|
-
}
|
1162
|
-
|
1163
|
-
inline Point3 & Point3::setX( float _x )
|
1164
|
-
{
|
1165
|
-
mX = _x;
|
1166
|
-
return *this;
|
1167
|
-
}
|
1168
|
-
|
1169
|
-
inline float Point3::getX( ) const
|
1170
|
-
{
|
1171
|
-
return mX;
|
1172
|
-
}
|
1173
|
-
|
1174
|
-
inline Point3 & Point3::setY( float _y )
|
1175
|
-
{
|
1176
|
-
mY = _y;
|
1177
|
-
return *this;
|
1178
|
-
}
|
1179
|
-
|
1180
|
-
inline float Point3::getY( ) const
|
1181
|
-
{
|
1182
|
-
return mY;
|
1183
|
-
}
|
1184
|
-
|
1185
|
-
inline Point3 & Point3::setZ( float _z )
|
1186
|
-
{
|
1187
|
-
mZ = _z;
|
1188
|
-
return *this;
|
1189
|
-
}
|
1190
|
-
|
1191
|
-
inline float Point3::getZ( ) const
|
1192
|
-
{
|
1193
|
-
return mZ;
|
1194
|
-
}
|
1195
|
-
|
1196
|
-
inline Point3 & Point3::setElem( int idx, float value )
|
1197
|
-
{
|
1198
|
-
*(&mX + idx) = value;
|
1199
|
-
return *this;
|
1200
|
-
}
|
1201
|
-
|
1202
|
-
inline float Point3::getElem( int idx ) const
|
1203
|
-
{
|
1204
|
-
return *(&mX + idx);
|
1205
|
-
}
|
1206
|
-
|
1207
|
-
inline float & Point3::operator []( int idx )
|
1208
|
-
{
|
1209
|
-
return *(&mX + idx);
|
1210
|
-
}
|
1211
|
-
|
1212
|
-
inline float Point3::operator []( int idx ) const
|
1213
|
-
{
|
1214
|
-
return *(&mX + idx);
|
1215
|
-
}
|
1216
|
-
|
1217
|
-
inline const Vector3 Point3::operator -( const Point3 & pnt ) const
|
1218
|
-
{
|
1219
|
-
return Vector3(
|
1220
|
-
( mX - pnt.mX ),
|
1221
|
-
( mY - pnt.mY ),
|
1222
|
-
( mZ - pnt.mZ )
|
1223
|
-
);
|
1224
|
-
}
|
1225
|
-
|
1226
|
-
inline const Point3 Point3::operator +( const Vector3 & vec ) const
|
1227
|
-
{
|
1228
|
-
return Point3(
|
1229
|
-
( mX + vec.getX() ),
|
1230
|
-
( mY + vec.getY() ),
|
1231
|
-
( mZ + vec.getZ() )
|
1232
|
-
);
|
1233
|
-
}
|
1234
|
-
|
1235
|
-
inline const Point3 Point3::operator -( const Vector3 & vec ) const
|
1236
|
-
{
|
1237
|
-
return Point3(
|
1238
|
-
( mX - vec.getX() ),
|
1239
|
-
( mY - vec.getY() ),
|
1240
|
-
( mZ - vec.getZ() )
|
1241
|
-
);
|
1242
|
-
}
|
1243
|
-
|
1244
|
-
inline Point3 & Point3::operator +=( const Vector3 & vec )
|
1245
|
-
{
|
1246
|
-
*this = *this + vec;
|
1247
|
-
return *this;
|
1248
|
-
}
|
1249
|
-
|
1250
|
-
inline Point3 & Point3::operator -=( const Vector3 & vec )
|
1251
|
-
{
|
1252
|
-
*this = *this - vec;
|
1253
|
-
return *this;
|
1254
|
-
}
|
1255
|
-
|
1256
|
-
inline const Point3 mulPerElem( const Point3 & pnt0, const Point3 & pnt1 )
|
1257
|
-
{
|
1258
|
-
return Point3(
|
1259
|
-
( pnt0.getX() * pnt1.getX() ),
|
1260
|
-
( pnt0.getY() * pnt1.getY() ),
|
1261
|
-
( pnt0.getZ() * pnt1.getZ() )
|
1262
|
-
);
|
1263
|
-
}
|
1264
|
-
|
1265
|
-
inline const Point3 divPerElem( const Point3 & pnt0, const Point3 & pnt1 )
|
1266
|
-
{
|
1267
|
-
return Point3(
|
1268
|
-
( pnt0.getX() / pnt1.getX() ),
|
1269
|
-
( pnt0.getY() / pnt1.getY() ),
|
1270
|
-
( pnt0.getZ() / pnt1.getZ() )
|
1271
|
-
);
|
1272
|
-
}
|
1273
|
-
|
1274
|
-
inline const Point3 recipPerElem( const Point3 & pnt )
|
1275
|
-
{
|
1276
|
-
return Point3(
|
1277
|
-
( 1.0f / pnt.getX() ),
|
1278
|
-
( 1.0f / pnt.getY() ),
|
1279
|
-
( 1.0f / pnt.getZ() )
|
1280
|
-
);
|
1281
|
-
}
|
1282
|
-
|
1283
|
-
inline const Point3 sqrtPerElem( const Point3 & pnt )
|
1284
|
-
{
|
1285
|
-
return Point3(
|
1286
|
-
sqrtf( pnt.getX() ),
|
1287
|
-
sqrtf( pnt.getY() ),
|
1288
|
-
sqrtf( pnt.getZ() )
|
1289
|
-
);
|
1290
|
-
}
|
1291
|
-
|
1292
|
-
inline const Point3 rsqrtPerElem( const Point3 & pnt )
|
1293
|
-
{
|
1294
|
-
return Point3(
|
1295
|
-
( 1.0f / sqrtf( pnt.getX() ) ),
|
1296
|
-
( 1.0f / sqrtf( pnt.getY() ) ),
|
1297
|
-
( 1.0f / sqrtf( pnt.getZ() ) )
|
1298
|
-
);
|
1299
|
-
}
|
1300
|
-
|
1301
|
-
inline const Point3 absPerElem( const Point3 & pnt )
|
1302
|
-
{
|
1303
|
-
return Point3(
|
1304
|
-
fabsf( pnt.getX() ),
|
1305
|
-
fabsf( pnt.getY() ),
|
1306
|
-
fabsf( pnt.getZ() )
|
1307
|
-
);
|
1308
|
-
}
|
1309
|
-
|
1310
|
-
inline const Point3 copySignPerElem( const Point3 & pnt0, const Point3 & pnt1 )
|
1311
|
-
{
|
1312
|
-
return Point3(
|
1313
|
-
( pnt1.getX() < 0.0f )? -fabsf( pnt0.getX() ) : fabsf( pnt0.getX() ),
|
1314
|
-
( pnt1.getY() < 0.0f )? -fabsf( pnt0.getY() ) : fabsf( pnt0.getY() ),
|
1315
|
-
( pnt1.getZ() < 0.0f )? -fabsf( pnt0.getZ() ) : fabsf( pnt0.getZ() )
|
1316
|
-
);
|
1317
|
-
}
|
1318
|
-
|
1319
|
-
inline const Point3 maxPerElem( const Point3 & pnt0, const Point3 & pnt1 )
|
1320
|
-
{
|
1321
|
-
return Point3(
|
1322
|
-
(pnt0.getX() > pnt1.getX())? pnt0.getX() : pnt1.getX(),
|
1323
|
-
(pnt0.getY() > pnt1.getY())? pnt0.getY() : pnt1.getY(),
|
1324
|
-
(pnt0.getZ() > pnt1.getZ())? pnt0.getZ() : pnt1.getZ()
|
1325
|
-
);
|
1326
|
-
}
|
1327
|
-
|
1328
|
-
inline float maxElem( const Point3 & pnt )
|
1329
|
-
{
|
1330
|
-
float result;
|
1331
|
-
result = (pnt.getX() > pnt.getY())? pnt.getX() : pnt.getY();
|
1332
|
-
result = (pnt.getZ() > result)? pnt.getZ() : result;
|
1333
|
-
return result;
|
1334
|
-
}
|
1335
|
-
|
1336
|
-
inline const Point3 minPerElem( const Point3 & pnt0, const Point3 & pnt1 )
|
1337
|
-
{
|
1338
|
-
return Point3(
|
1339
|
-
(pnt0.getX() < pnt1.getX())? pnt0.getX() : pnt1.getX(),
|
1340
|
-
(pnt0.getY() < pnt1.getY())? pnt0.getY() : pnt1.getY(),
|
1341
|
-
(pnt0.getZ() < pnt1.getZ())? pnt0.getZ() : pnt1.getZ()
|
1342
|
-
);
|
1343
|
-
}
|
1344
|
-
|
1345
|
-
inline float minElem( const Point3 & pnt )
|
1346
|
-
{
|
1347
|
-
float result;
|
1348
|
-
result = (pnt.getX() < pnt.getY())? pnt.getX() : pnt.getY();
|
1349
|
-
result = (pnt.getZ() < result)? pnt.getZ() : result;
|
1350
|
-
return result;
|
1351
|
-
}
|
1352
|
-
|
1353
|
-
inline float sum( const Point3 & pnt )
|
1354
|
-
{
|
1355
|
-
float result;
|
1356
|
-
result = ( pnt.getX() + pnt.getY() );
|
1357
|
-
result = ( result + pnt.getZ() );
|
1358
|
-
return result;
|
1359
|
-
}
|
1360
|
-
|
1361
|
-
inline const Point3 scale( const Point3 & pnt, float scaleVal )
|
1362
|
-
{
|
1363
|
-
return mulPerElem( pnt, Point3( scaleVal ) );
|
1364
|
-
}
|
1365
|
-
|
1366
|
-
inline const Point3 scale( const Point3 & pnt, const Vector3 & scaleVec )
|
1367
|
-
{
|
1368
|
-
return mulPerElem( pnt, Point3( scaleVec ) );
|
1369
|
-
}
|
1370
|
-
|
1371
|
-
inline float projection( const Point3 & pnt, const Vector3 & unitVec )
|
1372
|
-
{
|
1373
|
-
float result;
|
1374
|
-
result = ( pnt.getX() * unitVec.getX() );
|
1375
|
-
result = ( result + ( pnt.getY() * unitVec.getY() ) );
|
1376
|
-
result = ( result + ( pnt.getZ() * unitVec.getZ() ) );
|
1377
|
-
return result;
|
1378
|
-
}
|
1379
|
-
|
1380
|
-
inline float distSqrFromOrigin( const Point3 & pnt )
|
1381
|
-
{
|
1382
|
-
return lengthSqr( Vector3( pnt ) );
|
1383
|
-
}
|
1384
|
-
|
1385
|
-
inline float distFromOrigin( const Point3 & pnt )
|
1386
|
-
{
|
1387
|
-
return length( Vector3( pnt ) );
|
1388
|
-
}
|
1389
|
-
|
1390
|
-
inline float distSqr( const Point3 & pnt0, const Point3 & pnt1 )
|
1391
|
-
{
|
1392
|
-
return lengthSqr( ( pnt1 - pnt0 ) );
|
1393
|
-
}
|
1394
|
-
|
1395
|
-
inline float dist( const Point3 & pnt0, const Point3 & pnt1 )
|
1396
|
-
{
|
1397
|
-
return length( ( pnt1 - pnt0 ) );
|
1398
|
-
}
|
1399
|
-
|
1400
|
-
inline const Point3 select( const Point3 & pnt0, const Point3 & pnt1, bool select1 )
|
1401
|
-
{
|
1402
|
-
return Point3(
|
1403
|
-
( select1 )? pnt1.getX() : pnt0.getX(),
|
1404
|
-
( select1 )? pnt1.getY() : pnt0.getY(),
|
1405
|
-
( select1 )? pnt1.getZ() : pnt0.getZ()
|
1406
|
-
);
|
1407
|
-
}
|
1408
|
-
|
1409
|
-
#ifdef _VECTORMATH_DEBUG
|
1410
|
-
|
1411
|
-
inline void print( const Point3 & pnt )
|
1412
|
-
{
|
1413
|
-
printf( "( %f %f %f )\n", pnt.getX(), pnt.getY(), pnt.getZ() );
|
1414
|
-
}
|
1415
|
-
|
1416
|
-
inline void print( const Point3 & pnt, const char * name )
|
1417
|
-
{
|
1418
|
-
printf( "%s: ( %f %f %f )\n", name, pnt.getX(), pnt.getY(), pnt.getZ() );
|
1419
|
-
}
|
1420
|
-
|
1421
|
-
#endif
|
1422
|
-
|
1423
|
-
} // namespace Aos
|
1424
|
-
} // namespace Vectormath
|
1425
|
-
|
1426
|
-
#endif
|