@bloomengine/engine 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +169 -0
- package/native/android/Cargo.lock +1848 -0
- package/native/android/Cargo.toml +20 -0
- package/native/android/src/lib.rs +1747 -0
- package/native/ios/Cargo.lock +1688 -0
- package/native/ios/Cargo.toml +19 -0
- package/native/ios/src/lib.rs +2258 -0
- package/native/linux/Cargo.lock +1719 -0
- package/native/linux/Cargo.toml +22 -0
- package/native/linux/src/lib.rs +2236 -0
- package/native/macos/Cargo.lock +3310 -0
- package/native/macos/Cargo.toml +29 -0
- package/native/macos/src/lib.rs +3444 -0
- package/native/shared/Cargo.lock +1898 -0
- package/native/shared/Cargo.toml +42 -0
- package/native/shared/assets/default_font.ttf +0 -0
- package/native/shared/build.rs +77 -0
- package/native/shared/shaders/common/fog.wgsl +16 -0
- package/native/shared/shaders/common/imposter.wgsl +112 -0
- package/native/shared/shaders/common/pbr.wgsl +186 -0
- package/native/shared/shaders/common/shadows.wgsl +77 -0
- package/native/shared/shaders/common/sky.wgsl +8 -0
- package/native/shared/shaders/common/tonemap.wgsl +25 -0
- package/native/shared/shaders/impulse_field.wgsl +53 -0
- package/native/shared/shaders/material_abi.wgsl +360 -0
- package/native/shared/shaders/materials/test_minimal.wgsl +42 -0
- package/native/shared/src/audio.rs +363 -0
- package/native/shared/src/custom_shaders.rs +104 -0
- package/native/shared/src/drs.rs +211 -0
- package/native/shared/src/engine.rs +186 -0
- package/native/shared/src/frame_callbacks.rs +88 -0
- package/native/shared/src/geometry.rs +236 -0
- package/native/shared/src/handles.rs +76 -0
- package/native/shared/src/input.rs +273 -0
- package/native/shared/src/jolt_sys.rs +822 -0
- package/native/shared/src/lib.rs +43 -0
- package/native/shared/src/models.rs +1941 -0
- package/native/shared/src/physics_jolt.rs +1528 -0
- package/native/shared/src/picking.rs +298 -0
- package/native/shared/src/postfx.rs +339 -0
- package/native/shared/src/profiler.rs +416 -0
- package/native/shared/src/renderer/atmosphere_lut.rs +573 -0
- package/native/shared/src/renderer/brdf_lut.rs +154 -0
- package/native/shared/src/renderer/formats.rs +778 -0
- package/native/shared/src/renderer/graph.rs +465 -0
- package/native/shared/src/renderer/hot_reload.rs +390 -0
- package/native/shared/src/renderer/impulse_field.rs +455 -0
- package/native/shared/src/renderer/material_pipeline.rs +604 -0
- package/native/shared/src/renderer/material_system.rs +2106 -0
- package/native/shared/src/renderer/mod.rs +13923 -0
- package/native/shared/src/renderer/planar_reflection.rs +458 -0
- package/native/shared/src/renderer/post_pass.rs +249 -0
- package/native/shared/src/renderer/shader_include.rs +205 -0
- package/native/shared/src/renderer/shader_library.rs +134 -0
- package/native/shared/src/renderer/shaders.rs +5855 -0
- package/native/shared/src/renderer/transient.rs +576 -0
- package/native/shared/src/renderer/types.rs +259 -0
- package/native/shared/src/renderer/util.rs +151 -0
- package/native/shared/src/scene.rs +1066 -0
- package/native/shared/src/sdf_cache.rs +274 -0
- package/native/shared/src/shadows.rs +551 -0
- package/native/shared/src/staging.rs +90 -0
- package/native/shared/src/string_header.rs +35 -0
- package/native/shared/src/text_renderer.rs +456 -0
- package/native/shared/src/textures.rs +154 -0
- package/native/third_party/JoltPhysics/Jolt/AABBTree/AABBTreeBuilder.cpp +242 -0
- package/native/third_party/JoltPhysics/Jolt/AABBTree/AABBTreeBuilder.h +121 -0
- package/native/third_party/JoltPhysics/Jolt/AABBTree/AABBTreeToBuffer.h +296 -0
- package/native/third_party/JoltPhysics/Jolt/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h +323 -0
- package/native/third_party/JoltPhysics/Jolt/AABBTree/TriangleCodec/TriangleCodecIndexed8BitPackSOA4Flags.h +555 -0
- package/native/third_party/JoltPhysics/Jolt/ConfigurationString.h +112 -0
- package/native/third_party/JoltPhysics/Jolt/Core/ARMNeon.h +94 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Array.h +713 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Atomics.h +44 -0
- package/native/third_party/JoltPhysics/Jolt/Core/BinaryHeap.h +96 -0
- package/native/third_party/JoltPhysics/Jolt/Core/ByteBuffer.h +74 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Color.cpp +38 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Color.h +98 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Core.h +652 -0
- package/native/third_party/JoltPhysics/Jolt/Core/FPControlWord.h +143 -0
- package/native/third_party/JoltPhysics/Jolt/Core/FPException.h +96 -0
- package/native/third_party/JoltPhysics/Jolt/Core/FPFlushDenormals.h +43 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Factory.cpp +92 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Factory.h +54 -0
- package/native/third_party/JoltPhysics/Jolt/Core/FixedSizeFreeList.h +122 -0
- package/native/third_party/JoltPhysics/Jolt/Core/FixedSizeFreeList.inl +215 -0
- package/native/third_party/JoltPhysics/Jolt/Core/HashCombine.h +234 -0
- package/native/third_party/JoltPhysics/Jolt/Core/HashTable.h +876 -0
- package/native/third_party/JoltPhysics/Jolt/Core/InsertionSort.h +58 -0
- package/native/third_party/JoltPhysics/Jolt/Core/IssueReporting.cpp +27 -0
- package/native/third_party/JoltPhysics/Jolt/Core/IssueReporting.h +38 -0
- package/native/third_party/JoltPhysics/Jolt/Core/JobSystem.h +311 -0
- package/native/third_party/JoltPhysics/Jolt/Core/JobSystem.inl +56 -0
- package/native/third_party/JoltPhysics/Jolt/Core/JobSystemSingleThreaded.cpp +65 -0
- package/native/third_party/JoltPhysics/Jolt/Core/JobSystemSingleThreaded.h +62 -0
- package/native/third_party/JoltPhysics/Jolt/Core/JobSystemThreadPool.cpp +364 -0
- package/native/third_party/JoltPhysics/Jolt/Core/JobSystemThreadPool.h +101 -0
- package/native/third_party/JoltPhysics/Jolt/Core/JobSystemWithBarrier.cpp +230 -0
- package/native/third_party/JoltPhysics/Jolt/Core/JobSystemWithBarrier.h +85 -0
- package/native/third_party/JoltPhysics/Jolt/Core/LinearCurve.cpp +51 -0
- package/native/third_party/JoltPhysics/Jolt/Core/LinearCurve.h +67 -0
- package/native/third_party/JoltPhysics/Jolt/Core/LockFreeHashMap.h +182 -0
- package/native/third_party/JoltPhysics/Jolt/Core/LockFreeHashMap.inl +351 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Memory.cpp +85 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Memory.h +85 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Mutex.h +223 -0
- package/native/third_party/JoltPhysics/Jolt/Core/MutexArray.h +98 -0
- package/native/third_party/JoltPhysics/Jolt/Core/NonCopyable.h +18 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Profiler.cpp +677 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Profiler.h +301 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Profiler.inl +90 -0
- package/native/third_party/JoltPhysics/Jolt/Core/QuickSort.h +137 -0
- package/native/third_party/JoltPhysics/Jolt/Core/RTTI.cpp +149 -0
- package/native/third_party/JoltPhysics/Jolt/Core/RTTI.h +436 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Reference.h +244 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Result.h +174 -0
- package/native/third_party/JoltPhysics/Jolt/Core/STLAlignedAllocator.h +72 -0
- package/native/third_party/JoltPhysics/Jolt/Core/STLAllocator.h +127 -0
- package/native/third_party/JoltPhysics/Jolt/Core/STLLocalAllocator.h +170 -0
- package/native/third_party/JoltPhysics/Jolt/Core/STLTempAllocator.h +80 -0
- package/native/third_party/JoltPhysics/Jolt/Core/ScopeExit.h +49 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Semaphore.cpp +135 -0
- package/native/third_party/JoltPhysics/Jolt/Core/Semaphore.h +68 -0
- package/native/third_party/JoltPhysics/Jolt/Core/StaticArray.h +329 -0
- package/native/third_party/JoltPhysics/Jolt/Core/StreamIn.h +120 -0
- package/native/third_party/JoltPhysics/Jolt/Core/StreamOut.h +97 -0
- package/native/third_party/JoltPhysics/Jolt/Core/StreamUtils.h +168 -0
- package/native/third_party/JoltPhysics/Jolt/Core/StreamWrapper.h +53 -0
- package/native/third_party/JoltPhysics/Jolt/Core/StridedPtr.h +63 -0
- package/native/third_party/JoltPhysics/Jolt/Core/StringTools.cpp +101 -0
- package/native/third_party/JoltPhysics/Jolt/Core/StringTools.h +38 -0
- package/native/third_party/JoltPhysics/Jolt/Core/TempAllocator.h +209 -0
- package/native/third_party/JoltPhysics/Jolt/Core/TickCounter.cpp +37 -0
- package/native/third_party/JoltPhysics/Jolt/Core/TickCounter.h +58 -0
- package/native/third_party/JoltPhysics/Jolt/Core/UnorderedMap.h +80 -0
- package/native/third_party/JoltPhysics/Jolt/Core/UnorderedSet.h +32 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/AABox.h +313 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/AABox4.h +224 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/ClipPoly.h +200 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/ClosestPoint.h +498 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder.cpp +1467 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder.h +276 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder2D.cpp +335 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder2D.h +105 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexSupport.h +188 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/EPAConvexHullBuilder.h +845 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/EPAPenetrationDepth.h +557 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/Ellipse.h +77 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/GJKClosestPoint.h +945 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/IndexedTriangle.h +130 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/Indexify.cpp +222 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/Indexify.h +19 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/MortonCode.h +40 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/OrientedBox.cpp +178 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/OrientedBox.h +39 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/Plane.h +104 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/RayAABox.h +241 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/RayCapsule.h +37 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/RayCylinder.h +101 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/RaySphere.h +96 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/RayTriangle.h +158 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/Sphere.h +72 -0
- package/native/third_party/JoltPhysics/Jolt/Geometry/Triangle.h +34 -0
- package/native/third_party/JoltPhysics/Jolt/Jolt.cmake +703 -0
- package/native/third_party/JoltPhysics/Jolt/Jolt.h +16 -0
- package/native/third_party/JoltPhysics/Jolt/Jolt.natvis +116 -0
- package/native/third_party/JoltPhysics/Jolt/Math/BVec16.h +99 -0
- package/native/third_party/JoltPhysics/Jolt/Math/BVec16.inl +177 -0
- package/native/third_party/JoltPhysics/Jolt/Math/DMat44.h +158 -0
- package/native/third_party/JoltPhysics/Jolt/Math/DMat44.inl +310 -0
- package/native/third_party/JoltPhysics/Jolt/Math/DVec3.h +291 -0
- package/native/third_party/JoltPhysics/Jolt/Math/DVec3.inl +941 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Double3.h +48 -0
- package/native/third_party/JoltPhysics/Jolt/Math/DynMatrix.h +31 -0
- package/native/third_party/JoltPhysics/Jolt/Math/EigenValueSymmetric.h +177 -0
- package/native/third_party/JoltPhysics/Jolt/Math/FindRoot.h +42 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Float2.h +36 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Float3.h +50 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Float4.h +44 -0
- package/native/third_party/JoltPhysics/Jolt/Math/GaussianElimination.h +102 -0
- package/native/third_party/JoltPhysics/Jolt/Math/HalfFloat.h +208 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Mat44.h +243 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Mat44.inl +952 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Math.h +208 -0
- package/native/third_party/JoltPhysics/Jolt/Math/MathTypes.h +32 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Matrix.h +259 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Quat.h +268 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Quat.inl +406 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Real.h +44 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Swizzle.h +19 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Trigonometry.h +79 -0
- package/native/third_party/JoltPhysics/Jolt/Math/UVec4.h +232 -0
- package/native/third_party/JoltPhysics/Jolt/Math/UVec4.inl +636 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Vec3.cpp +71 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Vec3.h +308 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Vec3.inl +942 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Vec4.h +320 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Vec4.inl +1152 -0
- package/native/third_party/JoltPhysics/Jolt/Math/Vector.h +211 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/GetPrimitiveTypeOfType.h +54 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStream.cpp +38 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStream.h +337 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryIn.cpp +252 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryIn.h +57 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryOut.cpp +165 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryOut.h +57 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamIn.cpp +635 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamIn.h +148 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamOut.cpp +166 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamOut.h +101 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextIn.cpp +418 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextIn.h +55 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextOut.cpp +255 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextOut.h +62 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTypes.h +26 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableAttribute.h +111 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableAttributeEnum.h +67 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableAttributeTyped.h +60 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableObject.cpp +15 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableObject.h +170 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/TypeDeclarations.cpp +70 -0
- package/native/third_party/JoltPhysics/Jolt/ObjectStream/TypeDeclarations.h +45 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/AllowedDOFs.h +68 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/Body.cpp +426 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/Body.h +452 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/Body.inl +197 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyAccess.h +68 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyActivationListener.h +28 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyCreationSettings.cpp +234 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyCreationSettings.h +124 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyFilter.h +130 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyID.h +101 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyInterface.cpp +1099 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyInterface.h +324 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyLock.h +111 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyLockInterface.h +134 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyLockMulti.h +120 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyManager.cpp +1220 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyManager.h +403 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyPair.h +36 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyType.h +19 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/MassProperties.cpp +185 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/MassProperties.h +58 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionProperties.cpp +92 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionProperties.h +308 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionProperties.inl +178 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionQuality.h +31 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionType.h +17 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Character/Character.cpp +354 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Character/Character.h +159 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterBase.cpp +59 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterBase.h +157 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterID.h +98 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterVirtual.cpp +1933 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterVirtual.h +752 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/AABoxCast.h +20 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ActiveEdgeMode.h +17 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ActiveEdges.h +114 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BackFaceMode.h +16 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhase.cpp +16 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhase.h +109 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.cpp +313 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.h +38 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseLayer.h +148 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseLayerInterfaceMask.h +92 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseLayerInterfaceTable.h +64 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.cpp +629 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h +108 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h +56 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/ObjectVsBroadPhaseLayerFilterMask.h +35 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/ObjectVsBroadPhaseLayerFilterTable.h +66 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/QuadTree.cpp +1768 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/QuadTree.h +389 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp +107 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastConvexVsTriangles.h +46 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastResult.h +37 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastSphereVsTriangles.cpp +223 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastSphereVsTriangles.h +49 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollectFacesMode.h +16 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp +155 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideConvexVsTriangles.h +56 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollidePointResult.h +25 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideShape.h +106 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideShapeVsShapePerLeaf.h +94 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSoftBodyVertexIterator.h +110 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSoftBodyVerticesVsTriangles.h +102 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp +121 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSphereVsTriangles.h +50 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionCollector.h +109 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionCollectorImpl.h +219 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionDispatch.cpp +107 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionDispatch.h +97 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionGroup.cpp +35 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionGroup.h +97 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ContactListener.h +143 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/EstimateCollisionResponse.cpp +213 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/EstimateCollisionResponse.h +48 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilter.cpp +32 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilter.h +46 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilterTable.cpp +38 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilterTable.h +130 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h +279 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ManifoldBetweenTwoFaces.cpp +271 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ManifoldBetweenTwoFaces.h +44 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseQuery.cpp +448 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseQuery.h +77 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseStats.cpp +62 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseStats.h +110 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ObjectLayer.h +111 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ObjectLayerPairFilterMask.h +52 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ObjectLayerPairFilterTable.h +78 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterial.cpp +35 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterial.h +57 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterialSimple.cpp +38 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterialSimple.h +37 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/RayCast.h +87 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/BoxShape.cpp +318 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/BoxShape.h +115 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CapsuleShape.cpp +438 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CapsuleShape.h +129 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CompoundShape.cpp +433 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CompoundShape.h +354 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CompoundShapeVisitors.h +461 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexHullShape.cpp +1311 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexHullShape.h +202 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexShape.cpp +566 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexShape.h +150 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CylinderShape.cpp +418 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CylinderShape.h +126 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/DecoratedShape.cpp +87 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/DecoratedShape.h +80 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/EmptyShape.cpp +64 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/EmptyShape.h +75 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/GetTrianglesContext.h +248 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/HeightFieldShape.cpp +2754 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/HeightFieldShape.h +380 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MeshShape.cpp +1305 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MeshShape.h +228 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MutableCompoundShape.cpp +596 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MutableCompoundShape.h +176 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.cpp +217 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.h +140 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/PlaneShape.cpp +541 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/PlaneShape.h +147 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/PolyhedronSubmergedVolumeCalculator.h +319 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/RotatedTranslatedShape.cpp +333 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h +161 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ScaleHelpers.h +83 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ScaledShape.cpp +238 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ScaledShape.h +145 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/Shape.cpp +325 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/Shape.h +466 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SphereShape.cpp +347 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SphereShape.h +125 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/StaticCompoundShape.cpp +674 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/StaticCompoundShape.h +139 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SubShapeID.h +138 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SubShapeIDPair.h +65 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.cpp +453 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.gliffy +1 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.h +135 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCylinderShape.cpp +691 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCylinderShape.h +132 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TriangleShape.cpp +430 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TriangleShape.h +143 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ShapeCast.h +173 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ShapeFilter.h +73 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/SimShapeFilter.h +40 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/SimShapeFilterWrapper.h +58 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/SortReverseAndStore.h +48 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/TransformedShape.cpp +180 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Collision/TransformedShape.h +194 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/CalculateSolverSteps.h +70 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConeConstraint.cpp +246 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConeConstraint.h +133 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/Constraint.cpp +73 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/Constraint.h +243 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintManager.cpp +289 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintManager.h +100 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h +257 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h +682 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/DualAxisConstraintPart.h +276 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/GearConstraintPart.h +195 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/HingeRotationConstraintPart.h +222 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/IndependentAxisConstraintPart.h +246 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h +239 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/RackAndPinionConstraintPart.h +196 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h +283 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/RotationQuatConstraintPart.h +246 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/SpringPart.h +169 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h +597 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ContactConstraintManager.cpp +1804 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ContactConstraintManager.h +524 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/DistanceConstraint.cpp +266 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/DistanceConstraint.h +120 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/FixedConstraint.cpp +215 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/FixedConstraint.h +96 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/GearConstraint.cpp +188 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/GearConstraint.h +116 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/HingeConstraint.cpp +443 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/HingeConstraint.h +205 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/MotorSettings.cpp +43 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/MotorSettings.h +66 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraint.cpp +458 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraint.h +191 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPath.cpp +85 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPath.h +76 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPathHermite.cpp +308 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPathHermite.h +54 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PointConstraint.cpp +157 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PointConstraint.h +94 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PulleyConstraint.cpp +253 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PulleyConstraint.h +137 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/RackAndPinionConstraint.cpp +189 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/RackAndPinionConstraint.h +118 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SixDOFConstraint.cpp +900 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SixDOFConstraint.h +289 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SliderConstraint.cpp +501 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SliderConstraint.h +198 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SpringSettings.cpp +35 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SpringSettings.h +70 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SwingTwistConstraint.cpp +524 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SwingTwistConstraint.h +197 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/TwoBodyConstraint.cpp +56 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/TwoBodyConstraint.h +65 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/DeterminismLog.cpp +17 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/DeterminismLog.h +159 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/EActivation.h +16 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/EPhysicsUpdateError.h +37 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/IslandBuilder.cpp +492 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/IslandBuilder.h +144 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/LargeIslandSplitter.cpp +582 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/LargeIslandSplitter.h +187 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsLock.h +169 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsScene.cpp +261 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsScene.h +104 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsSettings.h +125 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsStepListener.h +37 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsSystem.cpp +2915 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsSystem.h +391 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsUpdateContext.cpp +25 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsUpdateContext.h +176 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Ragdoll/Ragdoll.cpp +744 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Ragdoll/Ragdoll.h +245 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyContactListener.h +55 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyCreationSettings.cpp +128 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyCreationSettings.h +75 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyManifold.h +74 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyMotionProperties.cpp +1501 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyMotionProperties.h +333 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyShape.cpp +354 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyShape.h +73 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodySharedSettings.cpp +1487 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodySharedSettings.h +390 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyUpdateContext.h +63 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyVertex.h +36 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/StateRecorder.h +136 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/StateRecorderImpl.cpp +90 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/StateRecorderImpl.h +50 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/MotorcycleController.cpp +306 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/MotorcycleController.h +119 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/TrackedVehicleController.cpp +547 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/TrackedVehicleController.h +169 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleAntiRollBar.cpp +33 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleAntiRollBar.h +33 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleCollisionTester.cpp +376 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleCollisionTester.h +146 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleConstraint.cpp +703 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleConstraint.h +252 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleController.cpp +17 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleController.h +87 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleDifferential.cpp +81 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleDifferential.h +39 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleEngine.cpp +122 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleEngine.h +93 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTrack.cpp +52 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTrack.h +56 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTransmission.cpp +159 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTransmission.h +87 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/Wheel.cpp +93 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/Wheel.h +148 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/WheeledVehicleController.cpp +866 -0
- package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/WheeledVehicleController.h +205 -0
- package/native/third_party/JoltPhysics/Jolt/RegisterTypes.cpp +204 -0
- package/native/third_party/JoltPhysics/Jolt/RegisterTypes.h +29 -0
- package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRenderer.cpp +1107 -0
- package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRenderer.h +383 -0
- package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererPlayback.cpp +168 -0
- package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererPlayback.h +48 -0
- package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererRecorder.cpp +158 -0
- package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererRecorder.h +130 -0
- package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererSimple.cpp +80 -0
- package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererSimple.h +88 -0
- package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletalAnimation.cpp +165 -0
- package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletalAnimation.h +91 -0
- package/native/third_party/JoltPhysics/Jolt/Skeleton/Skeleton.cpp +82 -0
- package/native/third_party/JoltPhysics/Jolt/Skeleton/Skeleton.h +72 -0
- package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonMapper.cpp +237 -0
- package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonMapper.h +145 -0
- package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonPose.cpp +87 -0
- package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonPose.h +82 -0
- package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitter.cpp +73 -0
- package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitter.h +84 -0
- package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterBinning.cpp +139 -0
- package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterBinning.h +52 -0
- package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterMean.cpp +43 -0
- package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterMean.h +28 -0
- package/native/third_party/JoltPhysics/LICENSE +7 -0
- package/native/third_party/JoltPhysics/README.md +173 -0
- package/native/third_party/bloom_jolt/CMakeLists.txt +78 -0
- package/native/third_party/bloom_jolt/include/bloom_jolt.h +519 -0
- package/native/third_party/bloom_jolt/src/bloom_jolt.cpp +1780 -0
- package/native/tvos/Cargo.lock +1692 -0
- package/native/tvos/Cargo.toml +22 -0
- package/native/tvos/src/lib.rs +3179 -0
- package/native/watchos/Cargo.lock +16 -0
- package/native/watchos/Cargo.toml +19 -0
- package/native/watchos/shaders/bloom_postfx.metal +99 -0
- package/native/watchos/src/BloomWatchApp.swift +1236 -0
- package/native/watchos/src/BloomWatchAudio.swift +179 -0
- package/native/watchos/src/audio.rs +55 -0
- package/native/watchos/src/draw_list.rs +223 -0
- package/native/watchos/src/ffi_stubs.rs +454 -0
- package/native/watchos/src/lib.rs +1013 -0
- package/native/watchos/src/models.rs +746 -0
- package/native/watchos/src/postfx.rs +91 -0
- package/native/watchos/src/scene.rs +534 -0
- package/native/watchos/src/textures.rs +184 -0
- package/native/web/Cargo.lock +1656 -0
- package/native/web/Cargo.toml +38 -0
- package/native/web/bloom_glue.js +218 -0
- package/native/web/build.sh +101 -0
- package/native/web/index.html +390 -0
- package/native/web/jolt_bridge.js +1311 -0
- package/native/web/src/lib.rs +2739 -0
- package/native/windows/Cargo.lock +1813 -0
- package/native/windows/Cargo.toml +31 -0
- package/native/windows/src/lib.rs +1933 -0
- package/package.json +558 -0
- package/src/audio/index.ts +151 -0
- package/src/core/colors.ts +56 -0
- package/src/core/index.ts +903 -0
- package/src/core/keys.ts +63 -0
- package/src/core/types.ts +102 -0
- package/src/index.ts +158 -0
- package/src/math/index.ts +502 -0
- package/src/mobile/index.ts +294 -0
- package/src/models/index.ts +859 -0
- package/src/physics/index.ts +1072 -0
- package/src/scene/index.ts +570 -0
- package/src/shapes/index.ts +120 -0
- package/src/text/index.ts +48 -0
- package/src/textures/index.ts +173 -0
- package/src/world/index.ts +22 -0
- package/src/world/loader.ts +385 -0
- package/src/world/prefab.ts +205 -0
- package/src/world/saver.ts +61 -0
- package/src/world/terrain.ts +254 -0
- package/src/world/types.ts +136 -0
- package/src/world/validate.ts +202 -0
- package/src/world/version.ts +47 -0
|
@@ -0,0 +1,952 @@
|
|
|
1
|
+
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
|
|
2
|
+
// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include <Jolt/Math/Vec3.h>
|
|
8
|
+
#include <Jolt/Math/Vec4.h>
|
|
9
|
+
#include <Jolt/Math/Quat.h>
|
|
10
|
+
|
|
11
|
+
JPH_NAMESPACE_BEGIN
|
|
12
|
+
|
|
13
|
+
#define JPH_EL(r, c) mCol[c].mF32[r]
|
|
14
|
+
|
|
15
|
+
Mat44::Mat44(Vec4Arg inC1, Vec4Arg inC2, Vec4Arg inC3, Vec4Arg inC4) :
|
|
16
|
+
mCol { inC1, inC2, inC3, inC4 }
|
|
17
|
+
{
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
Mat44::Mat44(Vec4Arg inC1, Vec4Arg inC2, Vec4Arg inC3, Vec3Arg inC4) :
|
|
21
|
+
mCol { inC1, inC2, inC3, Vec4(inC4, 1.0f) }
|
|
22
|
+
{
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Mat44::Mat44(Type inC1, Type inC2, Type inC3, Type inC4) :
|
|
26
|
+
mCol { inC1, inC2, inC3, inC4 }
|
|
27
|
+
{
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
Mat44 Mat44::sZero()
|
|
31
|
+
{
|
|
32
|
+
return Mat44(Vec4::sZero(), Vec4::sZero(), Vec4::sZero(), Vec4::sZero());
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Mat44 Mat44::sIdentity()
|
|
36
|
+
{
|
|
37
|
+
return Mat44(Vec4(1, 0, 0, 0), Vec4(0, 1, 0, 0), Vec4(0, 0, 1, 0), Vec4(0, 0, 0, 1));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
Mat44 Mat44::sNaN()
|
|
41
|
+
{
|
|
42
|
+
return Mat44(Vec4::sNaN(), Vec4::sNaN(), Vec4::sNaN(), Vec4::sNaN());
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
Mat44 Mat44::sLoadFloat4x4(const Float4 *inV)
|
|
46
|
+
{
|
|
47
|
+
Mat44 result;
|
|
48
|
+
for (int c = 0; c < 4; ++c)
|
|
49
|
+
result.mCol[c] = Vec4::sLoadFloat4(inV + c);
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
Mat44 Mat44::sLoadFloat4x4Aligned(const Float4 *inV)
|
|
54
|
+
{
|
|
55
|
+
Mat44 result;
|
|
56
|
+
for (int c = 0; c < 4; ++c)
|
|
57
|
+
result.mCol[c] = Vec4::sLoadFloat4Aligned(inV + c);
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Mat44 Mat44::sRotationX(float inX)
|
|
62
|
+
{
|
|
63
|
+
Vec4 sv, cv;
|
|
64
|
+
Vec4::sReplicate(inX).SinCos(sv, cv);
|
|
65
|
+
float s = sv.GetX(), c = cv.GetX();
|
|
66
|
+
return Mat44(Vec4(1, 0, 0, 0), Vec4(0, c, s, 0), Vec4(0, -s, c, 0), Vec4(0, 0, 0, 1));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Mat44 Mat44::sRotationY(float inY)
|
|
70
|
+
{
|
|
71
|
+
Vec4 sv, cv;
|
|
72
|
+
Vec4::sReplicate(inY).SinCos(sv, cv);
|
|
73
|
+
float s = sv.GetX(), c = cv.GetX();
|
|
74
|
+
return Mat44(Vec4(c, 0, -s, 0), Vec4(0, 1, 0, 0), Vec4(s, 0, c, 0), Vec4(0, 0, 0, 1));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
Mat44 Mat44::sRotationZ(float inZ)
|
|
78
|
+
{
|
|
79
|
+
Vec4 sv, cv;
|
|
80
|
+
Vec4::sReplicate(inZ).SinCos(sv, cv);
|
|
81
|
+
float s = sv.GetX(), c = cv.GetX();
|
|
82
|
+
return Mat44(Vec4(c, s, 0, 0), Vec4(-s, c, 0, 0), Vec4(0, 0, 1, 0), Vec4(0, 0, 0, 1));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
Mat44 Mat44::sRotation(QuatArg inQuat)
|
|
86
|
+
{
|
|
87
|
+
JPH_ASSERT(inQuat.IsNormalized());
|
|
88
|
+
|
|
89
|
+
// See: https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation section 'Quaternion-derived rotation matrix'
|
|
90
|
+
#ifdef JPH_USE_SSE4_1
|
|
91
|
+
__m128 xyzw = inQuat.mValue.mValue;
|
|
92
|
+
__m128 two_xyzw = _mm_add_ps(xyzw, xyzw);
|
|
93
|
+
__m128 yzxw = _mm_shuffle_ps(xyzw, xyzw, _MM_SHUFFLE(3, 0, 2, 1));
|
|
94
|
+
__m128 two_yzxw = _mm_add_ps(yzxw, yzxw);
|
|
95
|
+
__m128 zxyw = _mm_shuffle_ps(xyzw, xyzw, _MM_SHUFFLE(3, 1, 0, 2));
|
|
96
|
+
__m128 two_zxyw = _mm_add_ps(zxyw, zxyw);
|
|
97
|
+
__m128 wwww = _mm_shuffle_ps(xyzw, xyzw, _MM_SHUFFLE(3, 3, 3, 3));
|
|
98
|
+
__m128 diagonal = _mm_sub_ps(_mm_sub_ps(_mm_set1_ps(1.0f), _mm_mul_ps(two_yzxw, yzxw)), _mm_mul_ps(two_zxyw, zxyw)); // (1 - 2 y^2 - 2 z^2, 1 - 2 x^2 - 2 z^2, 1 - 2 x^2 - 2 y^2, 1 - 4 w^2)
|
|
99
|
+
__m128 plus = _mm_add_ps(_mm_mul_ps(two_xyzw, zxyw), _mm_mul_ps(two_yzxw, wwww)); // 2 * (xz + yw, xy + zw, yz + xw, ww)
|
|
100
|
+
__m128 minus = _mm_sub_ps(_mm_mul_ps(two_yzxw, xyzw), _mm_mul_ps(two_zxyw, wwww)); // 2 * (xy - zw, yz - xw, xz - yw, 0)
|
|
101
|
+
|
|
102
|
+
// Workaround for compiler changing _mm_sub_ps(_mm_mul_ps(...), ...) into a fused multiply sub instruction, resulting in w not being 0
|
|
103
|
+
// There doesn't appear to be a reliable way to turn this off in Clang
|
|
104
|
+
minus = _mm_insert_ps(minus, minus, 0b1000);
|
|
105
|
+
|
|
106
|
+
__m128 col0 = _mm_blend_ps(_mm_blend_ps(plus, diagonal, 0b0001), minus, 0b1100); // (1 - 2 y^2 - 2 z^2, 2 xy + 2 zw, 2 xz - 2 yw, 0)
|
|
107
|
+
__m128 col1 = _mm_blend_ps(_mm_blend_ps(diagonal, minus, 0b1001), plus, 0b0100); // (2 xy - 2 zw, 1 - 2 x^2 - 2 z^2, 2 yz + 2 xw, 0)
|
|
108
|
+
__m128 col2 = _mm_blend_ps(_mm_blend_ps(minus, plus, 0b0001), diagonal, 0b0100); // (2 xz + 2 yw, 2 yz - 2 xw, 1 - 2 x^2 - 2 y^2, 0)
|
|
109
|
+
__m128 col3 = _mm_set_ps(1, 0, 0, 0);
|
|
110
|
+
|
|
111
|
+
return Mat44(col0, col1, col2, col3);
|
|
112
|
+
#else
|
|
113
|
+
float x = inQuat.GetX();
|
|
114
|
+
float y = inQuat.GetY();
|
|
115
|
+
float z = inQuat.GetZ();
|
|
116
|
+
float w = inQuat.GetW();
|
|
117
|
+
|
|
118
|
+
float tx = x + x; // Note: Using x + x instead of 2.0f * x to force this function to return the same value as the SSE4.1 version across platforms.
|
|
119
|
+
float ty = y + y;
|
|
120
|
+
float tz = z + z;
|
|
121
|
+
|
|
122
|
+
float xx = tx * x;
|
|
123
|
+
float yy = ty * y;
|
|
124
|
+
float zz = tz * z;
|
|
125
|
+
float xy = tx * y;
|
|
126
|
+
float xz = tx * z;
|
|
127
|
+
float xw = tx * w;
|
|
128
|
+
float yz = ty * z;
|
|
129
|
+
float yw = ty * w;
|
|
130
|
+
float zw = tz * w;
|
|
131
|
+
|
|
132
|
+
return Mat44(Vec4((1.0f - yy) - zz, xy + zw, xz - yw, 0.0f), // Note: Added extra brackets to force this function to return the same value as the SSE4.1 version across platforms.
|
|
133
|
+
Vec4(xy - zw, (1.0f - zz) - xx, yz + xw, 0.0f),
|
|
134
|
+
Vec4(xz + yw, yz - xw, (1.0f - xx) - yy, 0.0f),
|
|
135
|
+
Vec4(0.0f, 0.0f, 0.0f, 1.0f));
|
|
136
|
+
#endif
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
Mat44 Mat44::sRotation(Vec3Arg inAxis, float inAngle)
|
|
140
|
+
{
|
|
141
|
+
return sRotation(Quat::sRotation(inAxis, inAngle));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
Mat44 Mat44::sTranslation(Vec3Arg inV)
|
|
145
|
+
{
|
|
146
|
+
return Mat44(Vec4(1, 0, 0, 0), Vec4(0, 1, 0, 0), Vec4(0, 0, 1, 0), Vec4(inV, 1));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
Mat44 Mat44::sRotationTranslation(QuatArg inR, Vec3Arg inT)
|
|
150
|
+
{
|
|
151
|
+
Mat44 m = sRotation(inR);
|
|
152
|
+
m.SetTranslation(inT);
|
|
153
|
+
return m;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
Mat44 Mat44::sInverseRotationTranslation(QuatArg inR, Vec3Arg inT)
|
|
157
|
+
{
|
|
158
|
+
Mat44 m = sRotation(inR.Conjugated());
|
|
159
|
+
m.SetTranslation(-m.Multiply3x3(inT));
|
|
160
|
+
return m;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
Mat44 Mat44::sScale(float inScale)
|
|
164
|
+
{
|
|
165
|
+
return Mat44(Vec4(inScale, 0, 0, 0), Vec4(0, inScale, 0, 0), Vec4(0, 0, inScale, 0), Vec4(0, 0, 0, 1));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
Mat44 Mat44::sScale(Vec3Arg inV)
|
|
169
|
+
{
|
|
170
|
+
return Mat44(Vec4(inV.GetX(), 0, 0, 0), Vec4(0, inV.GetY(), 0, 0), Vec4(0, 0, inV.GetZ(), 0), Vec4(0, 0, 0, 1));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
Mat44 Mat44::sOuterProduct(Vec3Arg inV1, Vec3Arg inV2)
|
|
174
|
+
{
|
|
175
|
+
Vec4 v1(inV1, 0);
|
|
176
|
+
return Mat44(v1 * inV2.SplatX(), v1 * inV2.SplatY(), v1 * inV2.SplatZ(), Vec4(0, 0, 0, 1));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
Mat44 Mat44::sCrossProduct(Vec3Arg inV)
|
|
180
|
+
{
|
|
181
|
+
#ifdef JPH_USE_SSE4_1
|
|
182
|
+
// Zero out the W component
|
|
183
|
+
__m128 zero = _mm_setzero_ps();
|
|
184
|
+
__m128 v = _mm_blend_ps(inV.mValue, zero, 0b1000);
|
|
185
|
+
|
|
186
|
+
// Negate
|
|
187
|
+
__m128 min_v = _mm_sub_ps(zero, v);
|
|
188
|
+
|
|
189
|
+
return Mat44(
|
|
190
|
+
_mm_shuffle_ps(v, min_v, _MM_SHUFFLE(3, 1, 2, 3)), // [0, z, -y, 0]
|
|
191
|
+
_mm_shuffle_ps(min_v, v, _MM_SHUFFLE(3, 0, 3, 2)), // [-z, 0, x, 0]
|
|
192
|
+
_mm_blend_ps(_mm_shuffle_ps(v, v, _MM_SHUFFLE(3, 3, 3, 1)), _mm_shuffle_ps(min_v, min_v, _MM_SHUFFLE(3, 3, 0, 3)), 0b0010), // [y, -x, 0, 0]
|
|
193
|
+
Vec4(0, 0, 0, 1));
|
|
194
|
+
#else
|
|
195
|
+
float x = inV.GetX();
|
|
196
|
+
float y = inV.GetY();
|
|
197
|
+
float z = inV.GetZ();
|
|
198
|
+
|
|
199
|
+
return Mat44(
|
|
200
|
+
Vec4(0, z, -y, 0),
|
|
201
|
+
Vec4(-z, 0, x, 0),
|
|
202
|
+
Vec4(y, -x, 0, 0),
|
|
203
|
+
Vec4(0, 0, 0, 1));
|
|
204
|
+
#endif
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
Mat44 Mat44::sLookAt(Vec3Arg inPos, Vec3Arg inTarget, Vec3Arg inUp)
|
|
208
|
+
{
|
|
209
|
+
Vec3 direction = (inTarget - inPos).NormalizedOr(-Vec3::sAxisZ());
|
|
210
|
+
Vec3 right = direction.Cross(inUp).NormalizedOr(Vec3::sAxisX());
|
|
211
|
+
Vec3 up = right.Cross(direction);
|
|
212
|
+
|
|
213
|
+
return Mat44(Vec4(right, 0), Vec4(up, 0), Vec4(-direction, 0), Vec4(inPos, 1)).InversedRotationTranslation();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
Mat44 Mat44::sPerspective(float inFovY, float inAspect, float inNear, float inFar)
|
|
217
|
+
{
|
|
218
|
+
float height = 1.0f / Tan(0.5f * inFovY);
|
|
219
|
+
float width = height / inAspect;
|
|
220
|
+
float range = inFar / (inNear - inFar);
|
|
221
|
+
|
|
222
|
+
return Mat44(Vec4(width, 0.0f, 0.0f, 0.0f), Vec4(0.0f, height, 0.0f, 0.0f), Vec4(0.0f, 0.0f, range, -1.0f), Vec4(0.0f, 0.0f, range * inNear, 0.0f));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
bool Mat44::operator == (Mat44Arg inM2) const
|
|
226
|
+
{
|
|
227
|
+
return UVec4::sAnd(
|
|
228
|
+
UVec4::sAnd(Vec4::sEquals(mCol[0], inM2.mCol[0]), Vec4::sEquals(mCol[1], inM2.mCol[1])),
|
|
229
|
+
UVec4::sAnd(Vec4::sEquals(mCol[2], inM2.mCol[2]), Vec4::sEquals(mCol[3], inM2.mCol[3]))
|
|
230
|
+
).TestAllTrue();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
bool Mat44::IsClose(Mat44Arg inM2, float inMaxDistSq) const
|
|
234
|
+
{
|
|
235
|
+
for (int i = 0; i < 4; ++i)
|
|
236
|
+
if (!mCol[i].IsClose(inM2.mCol[i], inMaxDistSq))
|
|
237
|
+
return false;
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
Mat44 Mat44::operator * (Mat44Arg inM) const
|
|
242
|
+
{
|
|
243
|
+
Mat44 result;
|
|
244
|
+
#if defined(JPH_USE_SSE)
|
|
245
|
+
for (int i = 0; i < 4; ++i)
|
|
246
|
+
{
|
|
247
|
+
__m128 c = inM.mCol[i].mValue;
|
|
248
|
+
__m128 t = _mm_mul_ps(mCol[0].mValue, _mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)));
|
|
249
|
+
t = _mm_add_ps(t, _mm_mul_ps(mCol[1].mValue, _mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1))));
|
|
250
|
+
t = _mm_add_ps(t, _mm_mul_ps(mCol[2].mValue, _mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2))));
|
|
251
|
+
t = _mm_add_ps(t, _mm_mul_ps(mCol[3].mValue, _mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3))));
|
|
252
|
+
result.mCol[i].mValue = t;
|
|
253
|
+
}
|
|
254
|
+
#elif defined(JPH_USE_NEON)
|
|
255
|
+
for (int i = 0; i < 4; ++i)
|
|
256
|
+
{
|
|
257
|
+
Type c = inM.mCol[i].mValue;
|
|
258
|
+
Type t = vmulq_f32(mCol[0].mValue, vdupq_laneq_f32(c, 0));
|
|
259
|
+
t = vmlaq_f32(t, mCol[1].mValue, vdupq_laneq_f32(c, 1));
|
|
260
|
+
t = vmlaq_f32(t, mCol[2].mValue, vdupq_laneq_f32(c, 2));
|
|
261
|
+
t = vmlaq_f32(t, mCol[3].mValue, vdupq_laneq_f32(c, 3));
|
|
262
|
+
result.mCol[i].mValue = t;
|
|
263
|
+
}
|
|
264
|
+
#else
|
|
265
|
+
for (int i = 0; i < 4; ++i)
|
|
266
|
+
result.mCol[i] = mCol[0] * inM.mCol[i].mF32[0] + mCol[1] * inM.mCol[i].mF32[1] + mCol[2] * inM.mCol[i].mF32[2] + mCol[3] * inM.mCol[i].mF32[3];
|
|
267
|
+
#endif
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
Vec3 Mat44::operator * (Vec3Arg inV) const
|
|
272
|
+
{
|
|
273
|
+
#if defined(JPH_USE_SSE)
|
|
274
|
+
__m128 t = _mm_mul_ps(mCol[0].mValue, _mm_shuffle_ps(inV.mValue, inV.mValue, _MM_SHUFFLE(0, 0, 0, 0)));
|
|
275
|
+
t = _mm_add_ps(t, _mm_mul_ps(mCol[1].mValue, _mm_shuffle_ps(inV.mValue, inV.mValue, _MM_SHUFFLE(1, 1, 1, 1))));
|
|
276
|
+
t = _mm_add_ps(t, _mm_mul_ps(mCol[2].mValue, _mm_shuffle_ps(inV.mValue, inV.mValue, _MM_SHUFFLE(2, 2, 2, 2))));
|
|
277
|
+
t = _mm_add_ps(t, mCol[3].mValue);
|
|
278
|
+
return Vec3::sFixW(t);
|
|
279
|
+
#elif defined(JPH_USE_NEON)
|
|
280
|
+
Type t = vmulq_f32(mCol[0].mValue, vdupq_laneq_f32(inV.mValue, 0));
|
|
281
|
+
t = vmlaq_f32(t, mCol[1].mValue, vdupq_laneq_f32(inV.mValue, 1));
|
|
282
|
+
t = vmlaq_f32(t, mCol[2].mValue, vdupq_laneq_f32(inV.mValue, 2));
|
|
283
|
+
t = vaddq_f32(t, mCol[3].mValue); // Don't combine this with the first mul into a fused multiply add, causes precision issues
|
|
284
|
+
return Vec3::sFixW(t);
|
|
285
|
+
#else
|
|
286
|
+
return Vec3(
|
|
287
|
+
mCol[0].mF32[0] * inV.mF32[0] + mCol[1].mF32[0] * inV.mF32[1] + mCol[2].mF32[0] * inV.mF32[2] + mCol[3].mF32[0],
|
|
288
|
+
mCol[0].mF32[1] * inV.mF32[0] + mCol[1].mF32[1] * inV.mF32[1] + mCol[2].mF32[1] * inV.mF32[2] + mCol[3].mF32[1],
|
|
289
|
+
mCol[0].mF32[2] * inV.mF32[0] + mCol[1].mF32[2] * inV.mF32[1] + mCol[2].mF32[2] * inV.mF32[2] + mCol[3].mF32[2]);
|
|
290
|
+
#endif
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
Vec4 Mat44::operator * (Vec4Arg inV) const
|
|
294
|
+
{
|
|
295
|
+
#if defined(JPH_USE_SSE)
|
|
296
|
+
__m128 t = _mm_mul_ps(mCol[0].mValue, _mm_shuffle_ps(inV.mValue, inV.mValue, _MM_SHUFFLE(0, 0, 0, 0)));
|
|
297
|
+
t = _mm_add_ps(t, _mm_mul_ps(mCol[1].mValue, _mm_shuffle_ps(inV.mValue, inV.mValue, _MM_SHUFFLE(1, 1, 1, 1))));
|
|
298
|
+
t = _mm_add_ps(t, _mm_mul_ps(mCol[2].mValue, _mm_shuffle_ps(inV.mValue, inV.mValue, _MM_SHUFFLE(2, 2, 2, 2))));
|
|
299
|
+
t = _mm_add_ps(t, _mm_mul_ps(mCol[3].mValue, _mm_shuffle_ps(inV.mValue, inV.mValue, _MM_SHUFFLE(3, 3, 3, 3))));
|
|
300
|
+
return t;
|
|
301
|
+
#elif defined(JPH_USE_NEON)
|
|
302
|
+
Type t = vmulq_f32(mCol[0].mValue, vdupq_laneq_f32(inV.mValue, 0));
|
|
303
|
+
t = vmlaq_f32(t, mCol[1].mValue, vdupq_laneq_f32(inV.mValue, 1));
|
|
304
|
+
t = vmlaq_f32(t, mCol[2].mValue, vdupq_laneq_f32(inV.mValue, 2));
|
|
305
|
+
t = vmlaq_f32(t, mCol[3].mValue, vdupq_laneq_f32(inV.mValue, 3));
|
|
306
|
+
return t;
|
|
307
|
+
#else
|
|
308
|
+
return Vec4(
|
|
309
|
+
mCol[0].mF32[0] * inV.mF32[0] + mCol[1].mF32[0] * inV.mF32[1] + mCol[2].mF32[0] * inV.mF32[2] + mCol[3].mF32[0] * inV.mF32[3],
|
|
310
|
+
mCol[0].mF32[1] * inV.mF32[0] + mCol[1].mF32[1] * inV.mF32[1] + mCol[2].mF32[1] * inV.mF32[2] + mCol[3].mF32[1] * inV.mF32[3],
|
|
311
|
+
mCol[0].mF32[2] * inV.mF32[0] + mCol[1].mF32[2] * inV.mF32[1] + mCol[2].mF32[2] * inV.mF32[2] + mCol[3].mF32[2] * inV.mF32[3],
|
|
312
|
+
mCol[0].mF32[3] * inV.mF32[0] + mCol[1].mF32[3] * inV.mF32[1] + mCol[2].mF32[3] * inV.mF32[2] + mCol[3].mF32[3] * inV.mF32[3]);
|
|
313
|
+
#endif
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
Vec3 Mat44::Multiply3x3(Vec3Arg inV) const
|
|
317
|
+
{
|
|
318
|
+
#if defined(JPH_USE_SSE)
|
|
319
|
+
__m128 t = _mm_mul_ps(mCol[0].mValue, _mm_shuffle_ps(inV.mValue, inV.mValue, _MM_SHUFFLE(0, 0, 0, 0)));
|
|
320
|
+
t = _mm_add_ps(t, _mm_mul_ps(mCol[1].mValue, _mm_shuffle_ps(inV.mValue, inV.mValue, _MM_SHUFFLE(1, 1, 1, 1))));
|
|
321
|
+
t = _mm_add_ps(t, _mm_mul_ps(mCol[2].mValue, _mm_shuffle_ps(inV.mValue, inV.mValue, _MM_SHUFFLE(2, 2, 2, 2))));
|
|
322
|
+
return Vec3::sFixW(t);
|
|
323
|
+
#elif defined(JPH_USE_NEON)
|
|
324
|
+
Type t = vmulq_f32(mCol[0].mValue, vdupq_laneq_f32(inV.mValue, 0));
|
|
325
|
+
t = vmlaq_f32(t, mCol[1].mValue, vdupq_laneq_f32(inV.mValue, 1));
|
|
326
|
+
t = vmlaq_f32(t, mCol[2].mValue, vdupq_laneq_f32(inV.mValue, 2));
|
|
327
|
+
return Vec3::sFixW(t);
|
|
328
|
+
#else
|
|
329
|
+
return Vec3(
|
|
330
|
+
mCol[0].mF32[0] * inV.mF32[0] + mCol[1].mF32[0] * inV.mF32[1] + mCol[2].mF32[0] * inV.mF32[2],
|
|
331
|
+
mCol[0].mF32[1] * inV.mF32[0] + mCol[1].mF32[1] * inV.mF32[1] + mCol[2].mF32[1] * inV.mF32[2],
|
|
332
|
+
mCol[0].mF32[2] * inV.mF32[0] + mCol[1].mF32[2] * inV.mF32[1] + mCol[2].mF32[2] * inV.mF32[2]);
|
|
333
|
+
#endif
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
Vec3 Mat44::Multiply3x3Transposed(Vec3Arg inV) const
|
|
337
|
+
{
|
|
338
|
+
#if defined(JPH_USE_SSE4_1)
|
|
339
|
+
__m128 x = _mm_dp_ps(mCol[0].mValue, inV.mValue, 0x7f);
|
|
340
|
+
__m128 y = _mm_dp_ps(mCol[1].mValue, inV.mValue, 0x7f);
|
|
341
|
+
__m128 xy = _mm_blend_ps(x, y, 0b0010);
|
|
342
|
+
__m128 z = _mm_dp_ps(mCol[2].mValue, inV.mValue, 0x7f);
|
|
343
|
+
__m128 xyzz = _mm_blend_ps(xy, z, 0b1100);
|
|
344
|
+
return xyzz;
|
|
345
|
+
#else
|
|
346
|
+
return Transposed3x3().Multiply3x3(inV);
|
|
347
|
+
#endif
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
Mat44 Mat44::Multiply3x3(Mat44Arg inM) const
|
|
351
|
+
{
|
|
352
|
+
JPH_ASSERT(mCol[0][3] == 0.0f);
|
|
353
|
+
JPH_ASSERT(mCol[1][3] == 0.0f);
|
|
354
|
+
JPH_ASSERT(mCol[2][3] == 0.0f);
|
|
355
|
+
|
|
356
|
+
Mat44 result;
|
|
357
|
+
#if defined(JPH_USE_SSE)
|
|
358
|
+
for (int i = 0; i < 3; ++i)
|
|
359
|
+
{
|
|
360
|
+
__m128 c = inM.mCol[i].mValue;
|
|
361
|
+
__m128 t = _mm_mul_ps(mCol[0].mValue, _mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)));
|
|
362
|
+
t = _mm_add_ps(t, _mm_mul_ps(mCol[1].mValue, _mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1))));
|
|
363
|
+
t = _mm_add_ps(t, _mm_mul_ps(mCol[2].mValue, _mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2))));
|
|
364
|
+
result.mCol[i].mValue = t;
|
|
365
|
+
}
|
|
366
|
+
#elif defined(JPH_USE_NEON)
|
|
367
|
+
for (int i = 0; i < 3; ++i)
|
|
368
|
+
{
|
|
369
|
+
Type c = inM.mCol[i].mValue;
|
|
370
|
+
Type t = vmulq_f32(mCol[0].mValue, vdupq_laneq_f32(c, 0));
|
|
371
|
+
t = vmlaq_f32(t, mCol[1].mValue, vdupq_laneq_f32(c, 1));
|
|
372
|
+
t = vmlaq_f32(t, mCol[2].mValue, vdupq_laneq_f32(c, 2));
|
|
373
|
+
result.mCol[i].mValue = t;
|
|
374
|
+
}
|
|
375
|
+
#else
|
|
376
|
+
for (int i = 0; i < 3; ++i)
|
|
377
|
+
result.mCol[i] = mCol[0] * inM.mCol[i].mF32[0] + mCol[1] * inM.mCol[i].mF32[1] + mCol[2] * inM.mCol[i].mF32[2];
|
|
378
|
+
#endif
|
|
379
|
+
result.mCol[3] = Vec4(0, 0, 0, 1);
|
|
380
|
+
return result;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
Mat44 Mat44::Multiply3x3LeftTransposed(Mat44Arg inM) const
|
|
384
|
+
{
|
|
385
|
+
// Transpose left hand side
|
|
386
|
+
Mat44 trans = Transposed3x3();
|
|
387
|
+
|
|
388
|
+
// Do 3x3 matrix multiply
|
|
389
|
+
Mat44 result;
|
|
390
|
+
result.mCol[0] = trans.mCol[0] * inM.mCol[0].SplatX() + trans.mCol[1] * inM.mCol[0].SplatY() + trans.mCol[2] * inM.mCol[0].SplatZ();
|
|
391
|
+
result.mCol[1] = trans.mCol[0] * inM.mCol[1].SplatX() + trans.mCol[1] * inM.mCol[1].SplatY() + trans.mCol[2] * inM.mCol[1].SplatZ();
|
|
392
|
+
result.mCol[2] = trans.mCol[0] * inM.mCol[2].SplatX() + trans.mCol[1] * inM.mCol[2].SplatY() + trans.mCol[2] * inM.mCol[2].SplatZ();
|
|
393
|
+
result.mCol[3] = Vec4(0, 0, 0, 1);
|
|
394
|
+
return result;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
Mat44 Mat44::Multiply3x3RightTransposed(Mat44Arg inM) const
|
|
398
|
+
{
|
|
399
|
+
JPH_ASSERT(mCol[0][3] == 0.0f);
|
|
400
|
+
JPH_ASSERT(mCol[1][3] == 0.0f);
|
|
401
|
+
JPH_ASSERT(mCol[2][3] == 0.0f);
|
|
402
|
+
|
|
403
|
+
Mat44 result;
|
|
404
|
+
result.mCol[0] = mCol[0] * inM.mCol[0].SplatX() + mCol[1] * inM.mCol[1].SplatX() + mCol[2] * inM.mCol[2].SplatX();
|
|
405
|
+
result.mCol[1] = mCol[0] * inM.mCol[0].SplatY() + mCol[1] * inM.mCol[1].SplatY() + mCol[2] * inM.mCol[2].SplatY();
|
|
406
|
+
result.mCol[2] = mCol[0] * inM.mCol[0].SplatZ() + mCol[1] * inM.mCol[1].SplatZ() + mCol[2] * inM.mCol[2].SplatZ();
|
|
407
|
+
result.mCol[3] = Vec4(0, 0, 0, 1);
|
|
408
|
+
return result;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
Mat44 Mat44::operator * (float inV) const
|
|
412
|
+
{
|
|
413
|
+
Vec4 multiplier = Vec4::sReplicate(inV);
|
|
414
|
+
|
|
415
|
+
Mat44 result;
|
|
416
|
+
for (int c = 0; c < 4; ++c)
|
|
417
|
+
result.mCol[c] = mCol[c] * multiplier;
|
|
418
|
+
return result;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
Mat44 &Mat44::operator *= (float inV)
|
|
422
|
+
{
|
|
423
|
+
for (int c = 0; c < 4; ++c)
|
|
424
|
+
mCol[c] *= inV;
|
|
425
|
+
|
|
426
|
+
return *this;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
Mat44 Mat44::operator + (Mat44Arg inM) const
|
|
430
|
+
{
|
|
431
|
+
Mat44 result;
|
|
432
|
+
for (int i = 0; i < 4; ++i)
|
|
433
|
+
result.mCol[i] = mCol[i] + inM.mCol[i];
|
|
434
|
+
return result;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
Mat44 Mat44::operator - () const
|
|
438
|
+
{
|
|
439
|
+
Mat44 result;
|
|
440
|
+
for (int i = 0; i < 4; ++i)
|
|
441
|
+
result.mCol[i] = -mCol[i];
|
|
442
|
+
return result;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
Mat44 Mat44::operator - (Mat44Arg inM) const
|
|
446
|
+
{
|
|
447
|
+
Mat44 result;
|
|
448
|
+
for (int i = 0; i < 4; ++i)
|
|
449
|
+
result.mCol[i] = mCol[i] - inM.mCol[i];
|
|
450
|
+
return result;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
Mat44 &Mat44::operator += (Mat44Arg inM)
|
|
454
|
+
{
|
|
455
|
+
for (int c = 0; c < 4; ++c)
|
|
456
|
+
mCol[c] += inM.mCol[c];
|
|
457
|
+
|
|
458
|
+
return *this;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
void Mat44::StoreFloat4x4(Float4 *outV) const
|
|
462
|
+
{
|
|
463
|
+
for (int c = 0; c < 4; ++c)
|
|
464
|
+
mCol[c].StoreFloat4(outV + c);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
Mat44 Mat44::Transposed() const
|
|
468
|
+
{
|
|
469
|
+
#if defined(JPH_USE_SSE)
|
|
470
|
+
__m128 tmp1 = _mm_shuffle_ps(mCol[0].mValue, mCol[1].mValue, _MM_SHUFFLE(1, 0, 1, 0));
|
|
471
|
+
__m128 tmp3 = _mm_shuffle_ps(mCol[0].mValue, mCol[1].mValue, _MM_SHUFFLE(3, 2, 3, 2));
|
|
472
|
+
__m128 tmp2 = _mm_shuffle_ps(mCol[2].mValue, mCol[3].mValue, _MM_SHUFFLE(1, 0, 1, 0));
|
|
473
|
+
__m128 tmp4 = _mm_shuffle_ps(mCol[2].mValue, mCol[3].mValue, _MM_SHUFFLE(3, 2, 3, 2));
|
|
474
|
+
|
|
475
|
+
Mat44 result;
|
|
476
|
+
result.mCol[0].mValue = _mm_shuffle_ps(tmp1, tmp2, _MM_SHUFFLE(2, 0, 2, 0));
|
|
477
|
+
result.mCol[1].mValue = _mm_shuffle_ps(tmp1, tmp2, _MM_SHUFFLE(3, 1, 3, 1));
|
|
478
|
+
result.mCol[2].mValue = _mm_shuffle_ps(tmp3, tmp4, _MM_SHUFFLE(2, 0, 2, 0));
|
|
479
|
+
result.mCol[3].mValue = _mm_shuffle_ps(tmp3, tmp4, _MM_SHUFFLE(3, 1, 3, 1));
|
|
480
|
+
return result;
|
|
481
|
+
#elif defined(JPH_USE_NEON)
|
|
482
|
+
float32x4x2_t tmp1 = vzipq_f32(mCol[0].mValue, mCol[2].mValue);
|
|
483
|
+
float32x4x2_t tmp2 = vzipq_f32(mCol[1].mValue, mCol[3].mValue);
|
|
484
|
+
float32x4x2_t tmp3 = vzipq_f32(tmp1.val[0], tmp2.val[0]);
|
|
485
|
+
float32x4x2_t tmp4 = vzipq_f32(tmp1.val[1], tmp2.val[1]);
|
|
486
|
+
|
|
487
|
+
Mat44 result;
|
|
488
|
+
result.mCol[0].mValue = tmp3.val[0];
|
|
489
|
+
result.mCol[1].mValue = tmp3.val[1];
|
|
490
|
+
result.mCol[2].mValue = tmp4.val[0];
|
|
491
|
+
result.mCol[3].mValue = tmp4.val[1];
|
|
492
|
+
return result;
|
|
493
|
+
#else
|
|
494
|
+
Mat44 result;
|
|
495
|
+
for (int c = 0; c < 4; ++c)
|
|
496
|
+
for (int r = 0; r < 4; ++r)
|
|
497
|
+
result.mCol[r].mF32[c] = mCol[c].mF32[r];
|
|
498
|
+
return result;
|
|
499
|
+
#endif
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
Mat44 Mat44::Transposed3x3() const
|
|
503
|
+
{
|
|
504
|
+
#if defined(JPH_USE_SSE)
|
|
505
|
+
__m128 zero = _mm_setzero_ps();
|
|
506
|
+
__m128 tmp1 = _mm_shuffle_ps(mCol[0].mValue, mCol[1].mValue, _MM_SHUFFLE(1, 0, 1, 0));
|
|
507
|
+
__m128 tmp3 = _mm_shuffle_ps(mCol[0].mValue, mCol[1].mValue, _MM_SHUFFLE(3, 2, 3, 2));
|
|
508
|
+
__m128 tmp2 = _mm_shuffle_ps(mCol[2].mValue, zero, _MM_SHUFFLE(1, 0, 1, 0));
|
|
509
|
+
__m128 tmp4 = _mm_shuffle_ps(mCol[2].mValue, zero, _MM_SHUFFLE(3, 2, 3, 2));
|
|
510
|
+
|
|
511
|
+
Mat44 result;
|
|
512
|
+
result.mCol[0].mValue = _mm_shuffle_ps(tmp1, tmp2, _MM_SHUFFLE(2, 0, 2, 0));
|
|
513
|
+
result.mCol[1].mValue = _mm_shuffle_ps(tmp1, tmp2, _MM_SHUFFLE(3, 1, 3, 1));
|
|
514
|
+
result.mCol[2].mValue = _mm_shuffle_ps(tmp3, tmp4, _MM_SHUFFLE(2, 0, 2, 0));
|
|
515
|
+
#elif defined(JPH_USE_NEON)
|
|
516
|
+
float32x4x2_t tmp1 = vzipq_f32(mCol[0].mValue, mCol[2].mValue);
|
|
517
|
+
float32x4x2_t tmp2 = vzipq_f32(mCol[1].mValue, vdupq_n_f32(0));
|
|
518
|
+
float32x4x2_t tmp3 = vzipq_f32(tmp1.val[0], tmp2.val[0]);
|
|
519
|
+
float32x4x2_t tmp4 = vzipq_f32(tmp1.val[1], tmp2.val[1]);
|
|
520
|
+
|
|
521
|
+
Mat44 result;
|
|
522
|
+
result.mCol[0].mValue = tmp3.val[0];
|
|
523
|
+
result.mCol[1].mValue = tmp3.val[1];
|
|
524
|
+
result.mCol[2].mValue = tmp4.val[0];
|
|
525
|
+
#else
|
|
526
|
+
Mat44 result;
|
|
527
|
+
for (int c = 0; c < 3; ++c)
|
|
528
|
+
{
|
|
529
|
+
for (int r = 0; r < 3; ++r)
|
|
530
|
+
result.mCol[c].mF32[r] = mCol[r].mF32[c];
|
|
531
|
+
result.mCol[c].mF32[3] = 0;
|
|
532
|
+
}
|
|
533
|
+
#endif
|
|
534
|
+
result.mCol[3] = Vec4(0, 0, 0, 1);
|
|
535
|
+
return result;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
Mat44 Mat44::Inversed() const
|
|
539
|
+
{
|
|
540
|
+
#if defined(JPH_USE_SSE)
|
|
541
|
+
// Algorithm from: http://download.intel.com/design/PentiumIII/sml/24504301.pdf
|
|
542
|
+
// Streaming SIMD Extensions - Inverse of 4x4 Matrix
|
|
543
|
+
// Adapted to load data using _mm_shuffle_ps instead of loading from memory
|
|
544
|
+
// Replaced _mm_rcp_ps with _mm_div_ps for better accuracy
|
|
545
|
+
|
|
546
|
+
__m128 tmp1 = _mm_shuffle_ps(mCol[0].mValue, mCol[1].mValue, _MM_SHUFFLE(1, 0, 1, 0));
|
|
547
|
+
__m128 row1 = _mm_shuffle_ps(mCol[2].mValue, mCol[3].mValue, _MM_SHUFFLE(1, 0, 1, 0));
|
|
548
|
+
__m128 row0 = _mm_shuffle_ps(tmp1, row1, _MM_SHUFFLE(2, 0, 2, 0));
|
|
549
|
+
row1 = _mm_shuffle_ps(row1, tmp1, _MM_SHUFFLE(3, 1, 3, 1));
|
|
550
|
+
tmp1 = _mm_shuffle_ps(mCol[0].mValue, mCol[1].mValue, _MM_SHUFFLE(3, 2, 3, 2));
|
|
551
|
+
__m128 row3 = _mm_shuffle_ps(mCol[2].mValue, mCol[3].mValue, _MM_SHUFFLE(3, 2, 3, 2));
|
|
552
|
+
__m128 row2 = _mm_shuffle_ps(tmp1, row3, _MM_SHUFFLE(2, 0, 2, 0));
|
|
553
|
+
row3 = _mm_shuffle_ps(row3, tmp1, _MM_SHUFFLE(3, 1, 3, 1));
|
|
554
|
+
|
|
555
|
+
tmp1 = _mm_mul_ps(row2, row3);
|
|
556
|
+
tmp1 = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(2, 3, 0, 1));
|
|
557
|
+
__m128 minor0 = _mm_mul_ps(row1, tmp1);
|
|
558
|
+
__m128 minor1 = _mm_mul_ps(row0, tmp1);
|
|
559
|
+
tmp1 = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(1, 0, 3, 2));
|
|
560
|
+
minor0 = _mm_sub_ps(_mm_mul_ps(row1, tmp1), minor0);
|
|
561
|
+
minor1 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor1);
|
|
562
|
+
minor1 = _mm_shuffle_ps(minor1, minor1, _MM_SHUFFLE(1, 0, 3, 2));
|
|
563
|
+
|
|
564
|
+
tmp1 = _mm_mul_ps(row1, row2);
|
|
565
|
+
tmp1 = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(2, 3, 0, 1));
|
|
566
|
+
minor0 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor0);
|
|
567
|
+
__m128 minor3 = _mm_mul_ps(row0, tmp1);
|
|
568
|
+
tmp1 = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(1, 0, 3, 2));
|
|
569
|
+
minor0 = _mm_sub_ps(minor0, _mm_mul_ps(row3, tmp1));
|
|
570
|
+
minor3 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor3);
|
|
571
|
+
minor3 = _mm_shuffle_ps(minor3, minor3, _MM_SHUFFLE(1, 0, 3, 2));
|
|
572
|
+
|
|
573
|
+
tmp1 = _mm_mul_ps(_mm_shuffle_ps(row1, row1, _MM_SHUFFLE(1, 0, 3, 2)), row3);
|
|
574
|
+
tmp1 = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(2, 3, 0, 1));
|
|
575
|
+
row2 = _mm_shuffle_ps(row2, row2, _MM_SHUFFLE(1, 0, 3, 2));
|
|
576
|
+
minor0 = _mm_add_ps(_mm_mul_ps(row2, tmp1), minor0);
|
|
577
|
+
__m128 minor2 = _mm_mul_ps(row0, tmp1);
|
|
578
|
+
tmp1 = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(1, 0, 3, 2));
|
|
579
|
+
minor0 = _mm_sub_ps(minor0, _mm_mul_ps(row2, tmp1));
|
|
580
|
+
minor2 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor2);
|
|
581
|
+
minor2 = _mm_shuffle_ps(minor2, minor2, _MM_SHUFFLE(1, 0, 3, 2));
|
|
582
|
+
|
|
583
|
+
tmp1 = _mm_mul_ps(row0, row1);
|
|
584
|
+
tmp1 = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(2, 3, 0, 1));
|
|
585
|
+
minor2 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor2);
|
|
586
|
+
minor3 = _mm_sub_ps(_mm_mul_ps(row2, tmp1), minor3);
|
|
587
|
+
tmp1 = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(1, 0, 3, 2));
|
|
588
|
+
minor2 = _mm_sub_ps(_mm_mul_ps(row3, tmp1), minor2);
|
|
589
|
+
minor3 = _mm_sub_ps(minor3, _mm_mul_ps(row2, tmp1));
|
|
590
|
+
|
|
591
|
+
tmp1 = _mm_mul_ps(row0, row3);
|
|
592
|
+
tmp1 = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(2, 3, 0, 1));
|
|
593
|
+
minor1 = _mm_sub_ps(minor1, _mm_mul_ps(row2, tmp1));
|
|
594
|
+
minor2 = _mm_add_ps(_mm_mul_ps(row1, tmp1), minor2);
|
|
595
|
+
tmp1 = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(1, 0, 3, 2));
|
|
596
|
+
minor1 = _mm_add_ps(_mm_mul_ps(row2, tmp1), minor1);
|
|
597
|
+
minor2 = _mm_sub_ps(minor2, _mm_mul_ps(row1, tmp1));
|
|
598
|
+
|
|
599
|
+
tmp1 = _mm_mul_ps(row0, row2);
|
|
600
|
+
tmp1 = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(2, 3, 0, 1));
|
|
601
|
+
minor1 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor1);
|
|
602
|
+
minor3 = _mm_sub_ps(minor3, _mm_mul_ps(row1, tmp1));
|
|
603
|
+
tmp1 = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(1, 0, 3, 2));
|
|
604
|
+
minor1 = _mm_sub_ps(minor1, _mm_mul_ps(row3, tmp1));
|
|
605
|
+
minor3 = _mm_add_ps(_mm_mul_ps(row1, tmp1), minor3);
|
|
606
|
+
|
|
607
|
+
__m128 det = _mm_mul_ps(row0, minor0);
|
|
608
|
+
det = _mm_add_ps(_mm_shuffle_ps(det, det, _MM_SHUFFLE(2, 3, 0, 1)), det); // Original code did (x + z) + (y + w), changed to (x + y) + (z + w) to match the ARM code below and make the result cross platform deterministic
|
|
609
|
+
det = _mm_add_ss(_mm_shuffle_ps(det, det, _MM_SHUFFLE(1, 0, 3, 2)), det);
|
|
610
|
+
det = _mm_div_ss(_mm_set_ss(1.0f), det);
|
|
611
|
+
det = _mm_shuffle_ps(det, det, _MM_SHUFFLE(0, 0, 0, 0));
|
|
612
|
+
|
|
613
|
+
Mat44 result;
|
|
614
|
+
result.mCol[0].mValue = _mm_mul_ps(det, minor0);
|
|
615
|
+
result.mCol[1].mValue = _mm_mul_ps(det, minor1);
|
|
616
|
+
result.mCol[2].mValue = _mm_mul_ps(det, minor2);
|
|
617
|
+
result.mCol[3].mValue = _mm_mul_ps(det, minor3);
|
|
618
|
+
return result;
|
|
619
|
+
#elif defined(JPH_USE_NEON)
|
|
620
|
+
// Adapted from the SSE version, there's surprising few articles about efficient ways of calculating an inverse for ARM on the internet
|
|
621
|
+
Type tmp1 = JPH_NEON_SHUFFLE_F32x4(mCol[0].mValue, mCol[1].mValue, 0, 1, 4, 5);
|
|
622
|
+
Type row1 = JPH_NEON_SHUFFLE_F32x4(mCol[2].mValue, mCol[3].mValue, 0, 1, 4, 5);
|
|
623
|
+
Type row0 = JPH_NEON_SHUFFLE_F32x4(tmp1, row1, 0, 2, 4, 6);
|
|
624
|
+
row1 = JPH_NEON_SHUFFLE_F32x4(row1, tmp1, 1, 3, 5, 7);
|
|
625
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(mCol[0].mValue, mCol[1].mValue, 2, 3, 6, 7);
|
|
626
|
+
Type row3 = JPH_NEON_SHUFFLE_F32x4(mCol[2].mValue, mCol[3].mValue, 2, 3, 6, 7);
|
|
627
|
+
Type row2 = JPH_NEON_SHUFFLE_F32x4(tmp1, row3, 0, 2, 4, 6);
|
|
628
|
+
row3 = JPH_NEON_SHUFFLE_F32x4(row3, tmp1, 1, 3, 5, 7);
|
|
629
|
+
|
|
630
|
+
tmp1 = vmulq_f32(row2, row3);
|
|
631
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(tmp1, tmp1, 1, 0, 3, 2);
|
|
632
|
+
Type minor0 = vmulq_f32(row1, tmp1);
|
|
633
|
+
Type minor1 = vmulq_f32(row0, tmp1);
|
|
634
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(tmp1, tmp1, 2, 3, 0, 1);
|
|
635
|
+
minor0 = vsubq_f32(vmulq_f32(row1, tmp1), minor0);
|
|
636
|
+
minor1 = vsubq_f32(vmulq_f32(row0, tmp1), minor1);
|
|
637
|
+
minor1 = JPH_NEON_SHUFFLE_F32x4(minor1, minor1, 2, 3, 0, 1);
|
|
638
|
+
|
|
639
|
+
tmp1 = vmulq_f32(row1, row2);
|
|
640
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(tmp1, tmp1, 1, 0, 3, 2);
|
|
641
|
+
minor0 = vaddq_f32(vmulq_f32(row3, tmp1), minor0);
|
|
642
|
+
Type minor3 = vmulq_f32(row0, tmp1);
|
|
643
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(tmp1, tmp1, 2, 3, 0, 1);
|
|
644
|
+
minor0 = vsubq_f32(minor0, vmulq_f32(row3, tmp1));
|
|
645
|
+
minor3 = vsubq_f32(vmulq_f32(row0, tmp1), minor3);
|
|
646
|
+
minor3 = JPH_NEON_SHUFFLE_F32x4(minor3, minor3, 2, 3, 0, 1);
|
|
647
|
+
|
|
648
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(row1, row1, 2, 3, 0, 1);
|
|
649
|
+
tmp1 = vmulq_f32(tmp1, row3);
|
|
650
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(tmp1, tmp1, 1, 0, 3, 2);
|
|
651
|
+
row2 = JPH_NEON_SHUFFLE_F32x4(row2, row2, 2, 3, 0, 1);
|
|
652
|
+
minor0 = vaddq_f32(vmulq_f32(row2, tmp1), minor0);
|
|
653
|
+
Type minor2 = vmulq_f32(row0, tmp1);
|
|
654
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(tmp1, tmp1, 2, 3, 0, 1);
|
|
655
|
+
minor0 = vsubq_f32(minor0, vmulq_f32(row2, tmp1));
|
|
656
|
+
minor2 = vsubq_f32(vmulq_f32(row0, tmp1), minor2);
|
|
657
|
+
minor2 = JPH_NEON_SHUFFLE_F32x4(minor2, minor2, 2, 3, 0, 1);
|
|
658
|
+
|
|
659
|
+
tmp1 = vmulq_f32(row0, row1);
|
|
660
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(tmp1, tmp1, 1, 0, 3, 2);
|
|
661
|
+
minor2 = vaddq_f32(vmulq_f32(row3, tmp1), minor2);
|
|
662
|
+
minor3 = vsubq_f32(vmulq_f32(row2, tmp1), minor3);
|
|
663
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(tmp1, tmp1, 2, 3, 0, 1);
|
|
664
|
+
minor2 = vsubq_f32(vmulq_f32(row3, tmp1), minor2);
|
|
665
|
+
minor3 = vsubq_f32(minor3, vmulq_f32(row2, tmp1));
|
|
666
|
+
|
|
667
|
+
tmp1 = vmulq_f32(row0, row3);
|
|
668
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(tmp1, tmp1, 1, 0, 3, 2);
|
|
669
|
+
minor1 = vsubq_f32(minor1, vmulq_f32(row2, tmp1));
|
|
670
|
+
minor2 = vaddq_f32(vmulq_f32(row1, tmp1), minor2);
|
|
671
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(tmp1, tmp1, 2, 3, 0, 1);
|
|
672
|
+
minor1 = vaddq_f32(vmulq_f32(row2, tmp1), minor1);
|
|
673
|
+
minor2 = vsubq_f32(minor2, vmulq_f32(row1, tmp1));
|
|
674
|
+
|
|
675
|
+
tmp1 = vmulq_f32(row0, row2);
|
|
676
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(tmp1, tmp1, 1, 0, 3, 2);
|
|
677
|
+
minor1 = vaddq_f32(vmulq_f32(row3, tmp1), minor1);
|
|
678
|
+
minor3 = vsubq_f32(minor3, vmulq_f32(row1, tmp1));
|
|
679
|
+
tmp1 = JPH_NEON_SHUFFLE_F32x4(tmp1, tmp1, 2, 3, 0, 1);
|
|
680
|
+
minor1 = vsubq_f32(minor1, vmulq_f32(row3, tmp1));
|
|
681
|
+
minor3 = vaddq_f32(vmulq_f32(row1, tmp1), minor3);
|
|
682
|
+
|
|
683
|
+
Type det = vmulq_f32(row0, minor0);
|
|
684
|
+
det = vdupq_n_f32(vaddvq_f32(det));
|
|
685
|
+
det = vdivq_f32(vdupq_n_f32(1.0f), det);
|
|
686
|
+
|
|
687
|
+
Mat44 result;
|
|
688
|
+
result.mCol[0].mValue = vmulq_f32(det, minor0);
|
|
689
|
+
result.mCol[1].mValue = vmulq_f32(det, minor1);
|
|
690
|
+
result.mCol[2].mValue = vmulq_f32(det, minor2);
|
|
691
|
+
result.mCol[3].mValue = vmulq_f32(det, minor3);
|
|
692
|
+
return result;
|
|
693
|
+
#else
|
|
694
|
+
float m00 = JPH_EL(0, 0), m10 = JPH_EL(1, 0), m20 = JPH_EL(2, 0), m30 = JPH_EL(3, 0);
|
|
695
|
+
float m01 = JPH_EL(0, 1), m11 = JPH_EL(1, 1), m21 = JPH_EL(2, 1), m31 = JPH_EL(3, 1);
|
|
696
|
+
float m02 = JPH_EL(0, 2), m12 = JPH_EL(1, 2), m22 = JPH_EL(2, 2), m32 = JPH_EL(3, 2);
|
|
697
|
+
float m03 = JPH_EL(0, 3), m13 = JPH_EL(1, 3), m23 = JPH_EL(2, 3), m33 = JPH_EL(3, 3);
|
|
698
|
+
|
|
699
|
+
float m10211120 = m10 * m21 - m11 * m20;
|
|
700
|
+
float m10221220 = m10 * m22 - m12 * m20;
|
|
701
|
+
float m10231320 = m10 * m23 - m13 * m20;
|
|
702
|
+
float m10311130 = m10 * m31 - m11 * m30;
|
|
703
|
+
float m10321230 = m10 * m32 - m12 * m30;
|
|
704
|
+
float m10331330 = m10 * m33 - m13 * m30;
|
|
705
|
+
float m11221221 = m11 * m22 - m12 * m21;
|
|
706
|
+
float m11231321 = m11 * m23 - m13 * m21;
|
|
707
|
+
float m11321231 = m11 * m32 - m12 * m31;
|
|
708
|
+
float m11331331 = m11 * m33 - m13 * m31;
|
|
709
|
+
float m12231322 = m12 * m23 - m13 * m22;
|
|
710
|
+
float m12331332 = m12 * m33 - m13 * m32;
|
|
711
|
+
float m20312130 = m20 * m31 - m21 * m30;
|
|
712
|
+
float m20322230 = m20 * m32 - m22 * m30;
|
|
713
|
+
float m20332330 = m20 * m33 - m23 * m30;
|
|
714
|
+
float m21322231 = m21 * m32 - m22 * m31;
|
|
715
|
+
float m21332331 = m21 * m33 - m23 * m31;
|
|
716
|
+
float m22332332 = m22 * m33 - m23 * m32;
|
|
717
|
+
|
|
718
|
+
Vec4 col0(m11 * m22332332 - m12 * m21332331 + m13 * m21322231, -m10 * m22332332 + m12 * m20332330 - m13 * m20322230, m10 * m21332331 - m11 * m20332330 + m13 * m20312130, -m10 * m21322231 + m11 * m20322230 - m12 * m20312130);
|
|
719
|
+
Vec4 col1(-m01 * m22332332 + m02 * m21332331 - m03 * m21322231, m00 * m22332332 - m02 * m20332330 + m03 * m20322230, -m00 * m21332331 + m01 * m20332330 - m03 * m20312130, m00 * m21322231 - m01 * m20322230 + m02 * m20312130);
|
|
720
|
+
Vec4 col2(m01 * m12331332 - m02 * m11331331 + m03 * m11321231, -m00 * m12331332 + m02 * m10331330 - m03 * m10321230, m00 * m11331331 - m01 * m10331330 + m03 * m10311130, -m00 * m11321231 + m01 * m10321230 - m02 * m10311130);
|
|
721
|
+
Vec4 col3(-m01 * m12231322 + m02 * m11231321 - m03 * m11221221, m00 * m12231322 - m02 * m10231320 + m03 * m10221220, -m00 * m11231321 + m01 * m10231320 - m03 * m10211120, m00 * m11221221 - m01 * m10221220 + m02 * m10211120);
|
|
722
|
+
|
|
723
|
+
float det = m00 * col0.mF32[0] + m01 * col0.mF32[1] + m02 * col0.mF32[2] + m03 * col0.mF32[3];
|
|
724
|
+
|
|
725
|
+
return Mat44(col0 / det, col1 / det, col2 / det, col3 / det);
|
|
726
|
+
#endif
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
Mat44 Mat44::InversedRotationTranslation() const
|
|
730
|
+
{
|
|
731
|
+
Mat44 m = Transposed3x3();
|
|
732
|
+
m.SetTranslation(-m.Multiply3x3(GetTranslation()));
|
|
733
|
+
return m;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
float Mat44::GetDeterminant3x3() const
|
|
737
|
+
{
|
|
738
|
+
return GetAxisX().Dot(GetAxisY().Cross(GetAxisZ()));
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
Mat44 Mat44::Adjointed3x3() const
|
|
742
|
+
{
|
|
743
|
+
return Mat44(
|
|
744
|
+
Vec4(JPH_EL(1, 1), JPH_EL(1, 2), JPH_EL(1, 0), 0) * Vec4(JPH_EL(2, 2), JPH_EL(2, 0), JPH_EL(2, 1), 0)
|
|
745
|
+
- Vec4(JPH_EL(1, 2), JPH_EL(1, 0), JPH_EL(1, 1), 0) * Vec4(JPH_EL(2, 1), JPH_EL(2, 2), JPH_EL(2, 0), 0),
|
|
746
|
+
Vec4(JPH_EL(0, 2), JPH_EL(0, 0), JPH_EL(0, 1), 0) * Vec4(JPH_EL(2, 1), JPH_EL(2, 2), JPH_EL(2, 0), 0)
|
|
747
|
+
- Vec4(JPH_EL(0, 1), JPH_EL(0, 2), JPH_EL(0, 0), 0) * Vec4(JPH_EL(2, 2), JPH_EL(2, 0), JPH_EL(2, 1), 0),
|
|
748
|
+
Vec4(JPH_EL(0, 1), JPH_EL(0, 2), JPH_EL(0, 0), 0) * Vec4(JPH_EL(1, 2), JPH_EL(1, 0), JPH_EL(1, 1), 0)
|
|
749
|
+
- Vec4(JPH_EL(0, 2), JPH_EL(0, 0), JPH_EL(0, 1), 0) * Vec4(JPH_EL(1, 1), JPH_EL(1, 2), JPH_EL(1, 0), 0),
|
|
750
|
+
Vec4(0, 0, 0, 1));
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
Mat44 Mat44::Inversed3x3() const
|
|
754
|
+
{
|
|
755
|
+
float det = GetDeterminant3x3();
|
|
756
|
+
|
|
757
|
+
return Mat44(
|
|
758
|
+
(Vec4(JPH_EL(1, 1), JPH_EL(1, 2), JPH_EL(1, 0), 0) * Vec4(JPH_EL(2, 2), JPH_EL(2, 0), JPH_EL(2, 1), 0)
|
|
759
|
+
- Vec4(JPH_EL(1, 2), JPH_EL(1, 0), JPH_EL(1, 1), 0) * Vec4(JPH_EL(2, 1), JPH_EL(2, 2), JPH_EL(2, 0), 0)) / det,
|
|
760
|
+
(Vec4(JPH_EL(0, 2), JPH_EL(0, 0), JPH_EL(0, 1), 0) * Vec4(JPH_EL(2, 1), JPH_EL(2, 2), JPH_EL(2, 0), 0)
|
|
761
|
+
- Vec4(JPH_EL(0, 1), JPH_EL(0, 2), JPH_EL(0, 0), 0) * Vec4(JPH_EL(2, 2), JPH_EL(2, 0), JPH_EL(2, 1), 0)) / det,
|
|
762
|
+
(Vec4(JPH_EL(0, 1), JPH_EL(0, 2), JPH_EL(0, 0), 0) * Vec4(JPH_EL(1, 2), JPH_EL(1, 0), JPH_EL(1, 1), 0)
|
|
763
|
+
- Vec4(JPH_EL(0, 2), JPH_EL(0, 0), JPH_EL(0, 1), 0) * Vec4(JPH_EL(1, 1), JPH_EL(1, 2), JPH_EL(1, 0), 0)) / det,
|
|
764
|
+
Vec4(0, 0, 0, 1));
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
bool Mat44::SetInversed3x3(Mat44Arg inM)
|
|
768
|
+
{
|
|
769
|
+
float det = inM.GetDeterminant3x3();
|
|
770
|
+
|
|
771
|
+
// If the determinant is zero the matrix is singular and we return false
|
|
772
|
+
if (det == 0.0f)
|
|
773
|
+
return false;
|
|
774
|
+
|
|
775
|
+
// Finish calculating the inverse
|
|
776
|
+
*this = inM.Adjointed3x3();
|
|
777
|
+
mCol[0] /= det;
|
|
778
|
+
mCol[1] /= det;
|
|
779
|
+
mCol[2] /= det;
|
|
780
|
+
return true;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
Quat Mat44::GetQuaternion() const
|
|
784
|
+
{
|
|
785
|
+
float tr = mCol[0].mF32[0] + mCol[1].mF32[1] + mCol[2].mF32[2];
|
|
786
|
+
|
|
787
|
+
if (tr >= 0.0f)
|
|
788
|
+
{
|
|
789
|
+
float s = sqrt(tr + 1.0f);
|
|
790
|
+
float is = 0.5f / s;
|
|
791
|
+
return Quat(
|
|
792
|
+
(mCol[1].mF32[2] - mCol[2].mF32[1]) * is,
|
|
793
|
+
(mCol[2].mF32[0] - mCol[0].mF32[2]) * is,
|
|
794
|
+
(mCol[0].mF32[1] - mCol[1].mF32[0]) * is,
|
|
795
|
+
0.5f * s);
|
|
796
|
+
}
|
|
797
|
+
else
|
|
798
|
+
{
|
|
799
|
+
int i = 0;
|
|
800
|
+
if (mCol[1].mF32[1] > mCol[0].mF32[0]) i = 1;
|
|
801
|
+
if (mCol[2].mF32[2] > mCol[i].mF32[i]) i = 2;
|
|
802
|
+
|
|
803
|
+
if (i == 0)
|
|
804
|
+
{
|
|
805
|
+
float s = sqrt(mCol[0].mF32[0] - (mCol[1].mF32[1] + mCol[2].mF32[2]) + 1);
|
|
806
|
+
float is = 0.5f / s;
|
|
807
|
+
return Quat(
|
|
808
|
+
0.5f * s,
|
|
809
|
+
(mCol[1].mF32[0] + mCol[0].mF32[1]) * is,
|
|
810
|
+
(mCol[0].mF32[2] + mCol[2].mF32[0]) * is,
|
|
811
|
+
(mCol[1].mF32[2] - mCol[2].mF32[1]) * is);
|
|
812
|
+
}
|
|
813
|
+
else if (i == 1)
|
|
814
|
+
{
|
|
815
|
+
float s = sqrt(mCol[1].mF32[1] - (mCol[2].mF32[2] + mCol[0].mF32[0]) + 1);
|
|
816
|
+
float is = 0.5f / s;
|
|
817
|
+
return Quat(
|
|
818
|
+
(mCol[1].mF32[0] + mCol[0].mF32[1]) * is,
|
|
819
|
+
0.5f * s,
|
|
820
|
+
(mCol[2].mF32[1] + mCol[1].mF32[2]) * is,
|
|
821
|
+
(mCol[2].mF32[0] - mCol[0].mF32[2]) * is);
|
|
822
|
+
}
|
|
823
|
+
else
|
|
824
|
+
{
|
|
825
|
+
JPH_ASSERT(i == 2);
|
|
826
|
+
|
|
827
|
+
float s = sqrt(mCol[2].mF32[2] - (mCol[0].mF32[0] + mCol[1].mF32[1]) + 1);
|
|
828
|
+
float is = 0.5f / s;
|
|
829
|
+
return Quat(
|
|
830
|
+
(mCol[0].mF32[2] + mCol[2].mF32[0]) * is,
|
|
831
|
+
(mCol[2].mF32[1] + mCol[1].mF32[2]) * is,
|
|
832
|
+
0.5f * s,
|
|
833
|
+
(mCol[0].mF32[1] - mCol[1].mF32[0]) * is);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
Mat44 Mat44::sQuatLeftMultiply(QuatArg inQ)
|
|
839
|
+
{
|
|
840
|
+
return Mat44(
|
|
841
|
+
inQ.mValue.Swizzle<SWIZZLE_W, SWIZZLE_Z, SWIZZLE_Y, SWIZZLE_X>().FlipSign<1, 1, -1, -1>(),
|
|
842
|
+
inQ.mValue.Swizzle<SWIZZLE_Z, SWIZZLE_W, SWIZZLE_X, SWIZZLE_Y>().FlipSign<-1, 1, 1, -1>(),
|
|
843
|
+
inQ.mValue.Swizzle<SWIZZLE_Y, SWIZZLE_X, SWIZZLE_W, SWIZZLE_Z>().FlipSign<1, -1, 1, -1>(),
|
|
844
|
+
inQ.mValue);
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
Mat44 Mat44::sQuatRightMultiply(QuatArg inQ)
|
|
848
|
+
{
|
|
849
|
+
return Mat44(
|
|
850
|
+
inQ.mValue.Swizzle<SWIZZLE_W, SWIZZLE_Z, SWIZZLE_Y, SWIZZLE_X>().FlipSign<1, -1, 1, -1>(),
|
|
851
|
+
inQ.mValue.Swizzle<SWIZZLE_Z, SWIZZLE_W, SWIZZLE_X, SWIZZLE_Y>().FlipSign<1, 1, -1, -1>(),
|
|
852
|
+
inQ.mValue.Swizzle<SWIZZLE_Y, SWIZZLE_X, SWIZZLE_W, SWIZZLE_Z>().FlipSign<-1, 1, 1, -1>(),
|
|
853
|
+
inQ.mValue);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
Mat44 Mat44::GetRotation() const
|
|
857
|
+
{
|
|
858
|
+
JPH_ASSERT(mCol[0][3] == 0.0f);
|
|
859
|
+
JPH_ASSERT(mCol[1][3] == 0.0f);
|
|
860
|
+
JPH_ASSERT(mCol[2][3] == 0.0f);
|
|
861
|
+
|
|
862
|
+
return Mat44(mCol[0], mCol[1], mCol[2], Vec4(0, 0, 0, 1));
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
Mat44 Mat44::GetRotationSafe() const
|
|
866
|
+
{
|
|
867
|
+
#if defined(JPH_USE_AVX512)
|
|
868
|
+
return Mat44(_mm_maskz_mov_ps(0b0111, mCol[0].mValue),
|
|
869
|
+
_mm_maskz_mov_ps(0b0111, mCol[1].mValue),
|
|
870
|
+
_mm_maskz_mov_ps(0b0111, mCol[2].mValue),
|
|
871
|
+
Vec4(0, 0, 0, 1));
|
|
872
|
+
#elif defined(JPH_USE_SSE4_1)
|
|
873
|
+
__m128 zero = _mm_setzero_ps();
|
|
874
|
+
return Mat44(_mm_blend_ps(mCol[0].mValue, zero, 8),
|
|
875
|
+
_mm_blend_ps(mCol[1].mValue, zero, 8),
|
|
876
|
+
_mm_blend_ps(mCol[2].mValue, zero, 8),
|
|
877
|
+
Vec4(0, 0, 0, 1));
|
|
878
|
+
#elif defined(JPH_USE_NEON)
|
|
879
|
+
return Mat44(vsetq_lane_f32(0, mCol[0].mValue, 3),
|
|
880
|
+
vsetq_lane_f32(0, mCol[1].mValue, 3),
|
|
881
|
+
vsetq_lane_f32(0, mCol[2].mValue, 3),
|
|
882
|
+
Vec4(0, 0, 0, 1));
|
|
883
|
+
#else
|
|
884
|
+
return Mat44(Vec4(mCol[0].mF32[0], mCol[0].mF32[1], mCol[0].mF32[2], 0),
|
|
885
|
+
Vec4(mCol[1].mF32[0], mCol[1].mF32[1], mCol[1].mF32[2], 0),
|
|
886
|
+
Vec4(mCol[2].mF32[0], mCol[2].mF32[1], mCol[2].mF32[2], 0),
|
|
887
|
+
Vec4(0, 0, 0, 1));
|
|
888
|
+
#endif
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
void Mat44::SetRotation(Mat44Arg inRotation)
|
|
892
|
+
{
|
|
893
|
+
mCol[0] = inRotation.mCol[0];
|
|
894
|
+
mCol[1] = inRotation.mCol[1];
|
|
895
|
+
mCol[2] = inRotation.mCol[2];
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
Mat44 Mat44::PreTranslated(Vec3Arg inTranslation) const
|
|
899
|
+
{
|
|
900
|
+
return Mat44(mCol[0], mCol[1], mCol[2], Vec4(GetTranslation() + Multiply3x3(inTranslation), 1));
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
Mat44 Mat44::PostTranslated(Vec3Arg inTranslation) const
|
|
904
|
+
{
|
|
905
|
+
return Mat44(mCol[0], mCol[1], mCol[2], Vec4(GetTranslation() + inTranslation, 1));
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
Mat44 Mat44::PreScaled(Vec3Arg inScale) const
|
|
909
|
+
{
|
|
910
|
+
return Mat44(inScale.GetX() * mCol[0], inScale.GetY() * mCol[1], inScale.GetZ() * mCol[2], mCol[3]);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
Mat44 Mat44::PostScaled(Vec3Arg inScale) const
|
|
914
|
+
{
|
|
915
|
+
Vec4 scale(inScale, 1);
|
|
916
|
+
return Mat44(scale * mCol[0], scale * mCol[1], scale * mCol[2], scale * mCol[3]);
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
Mat44 Mat44::Decompose(Vec3 &outScale) const
|
|
920
|
+
{
|
|
921
|
+
// Start the modified Gram-Schmidt algorithm
|
|
922
|
+
// X axis will just be normalized
|
|
923
|
+
Vec3 x = GetAxisX();
|
|
924
|
+
|
|
925
|
+
// Make Y axis perpendicular to X
|
|
926
|
+
Vec3 y = GetAxisY();
|
|
927
|
+
float x_dot_x = x.LengthSq();
|
|
928
|
+
y -= (x.Dot(y) / x_dot_x) * x;
|
|
929
|
+
|
|
930
|
+
// Make Z axis perpendicular to X
|
|
931
|
+
Vec3 z = GetAxisZ();
|
|
932
|
+
z -= (x.Dot(z) / x_dot_x) * x;
|
|
933
|
+
|
|
934
|
+
// Make Z axis perpendicular to Y
|
|
935
|
+
float y_dot_y = y.LengthSq();
|
|
936
|
+
z -= (y.Dot(z) / y_dot_y) * y;
|
|
937
|
+
|
|
938
|
+
// Determine the scale
|
|
939
|
+
float z_dot_z = z.LengthSq();
|
|
940
|
+
outScale = Vec3(x_dot_x, y_dot_y, z_dot_z).Sqrt();
|
|
941
|
+
|
|
942
|
+
// If the resulting x, y and z vectors don't form a right handed matrix, flip the z axis.
|
|
943
|
+
if (x.Cross(y).Dot(z) < 0.0f)
|
|
944
|
+
outScale.SetZ(-outScale.GetZ());
|
|
945
|
+
|
|
946
|
+
// Determine the rotation and translation
|
|
947
|
+
return Mat44(Vec4(x / outScale.GetX(), 0), Vec4(y / outScale.GetY(), 0), Vec4(z / outScale.GetZ(), 0), GetColumn4(3));
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
#undef JPH_EL
|
|
951
|
+
|
|
952
|
+
JPH_NAMESPACE_END
|