@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,1152 @@
|
|
|
1
|
+
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
|
|
2
|
+
// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
#include <Jolt/Math/Trigonometry.h>
|
|
6
|
+
#include <Jolt/Math/Vec3.h>
|
|
7
|
+
#include <Jolt/Math/UVec4.h>
|
|
8
|
+
|
|
9
|
+
JPH_NAMESPACE_BEGIN
|
|
10
|
+
|
|
11
|
+
// Constructor
|
|
12
|
+
Vec4::Vec4(Vec3Arg inRHS) :
|
|
13
|
+
mValue(inRHS.mValue)
|
|
14
|
+
{
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Vec4::Vec4(Vec3Arg inRHS, float inW)
|
|
18
|
+
{
|
|
19
|
+
#if defined(JPH_USE_SSE4_1)
|
|
20
|
+
mValue = _mm_blend_ps(inRHS.mValue, _mm_set1_ps(inW), 8);
|
|
21
|
+
#elif defined(JPH_USE_NEON)
|
|
22
|
+
mValue = vsetq_lane_f32(inW, inRHS.mValue, 3);
|
|
23
|
+
#else
|
|
24
|
+
for (int i = 0; i < 3; i++)
|
|
25
|
+
mF32[i] = inRHS.mF32[i];
|
|
26
|
+
mF32[3] = inW;
|
|
27
|
+
#endif
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
Vec4::Vec4(float inX, float inY, float inZ, float inW)
|
|
31
|
+
{
|
|
32
|
+
#if defined(JPH_USE_SSE)
|
|
33
|
+
mValue = _mm_set_ps(inW, inZ, inY, inX);
|
|
34
|
+
#elif defined(JPH_USE_NEON)
|
|
35
|
+
uint32x2_t xy = vcreate_u32(static_cast<uint64>(BitCast<uint32>(inX)) | (static_cast<uint64>(BitCast<uint32>(inY)) << 32));
|
|
36
|
+
uint32x2_t zw = vcreate_u32(static_cast<uint64>(BitCast<uint32>(inZ)) | (static_cast<uint64>(BitCast<uint32>(inW)) << 32));
|
|
37
|
+
mValue = vreinterpretq_f32_u32(vcombine_u32(xy, zw));
|
|
38
|
+
#else
|
|
39
|
+
mF32[0] = inX;
|
|
40
|
+
mF32[1] = inY;
|
|
41
|
+
mF32[2] = inZ;
|
|
42
|
+
mF32[3] = inW;
|
|
43
|
+
#endif
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
template<uint32 SwizzleX, uint32 SwizzleY, uint32 SwizzleZ, uint32 SwizzleW>
|
|
47
|
+
Vec4 Vec4::Swizzle() const
|
|
48
|
+
{
|
|
49
|
+
static_assert(SwizzleX <= 3, "SwizzleX template parameter out of range");
|
|
50
|
+
static_assert(SwizzleY <= 3, "SwizzleY template parameter out of range");
|
|
51
|
+
static_assert(SwizzleZ <= 3, "SwizzleZ template parameter out of range");
|
|
52
|
+
static_assert(SwizzleW <= 3, "SwizzleW template parameter out of range");
|
|
53
|
+
|
|
54
|
+
#if defined(JPH_USE_SSE)
|
|
55
|
+
return _mm_shuffle_ps(mValue, mValue, _MM_SHUFFLE(SwizzleW, SwizzleZ, SwizzleY, SwizzleX));
|
|
56
|
+
#elif defined(JPH_USE_NEON)
|
|
57
|
+
return JPH_NEON_SHUFFLE_F32x4(mValue, mValue, SwizzleX, SwizzleY, SwizzleZ, SwizzleW);
|
|
58
|
+
#else
|
|
59
|
+
return Vec4(mF32[SwizzleX], mF32[SwizzleY], mF32[SwizzleZ], mF32[SwizzleW]);
|
|
60
|
+
#endif
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
Vec4 Vec4::sZero()
|
|
64
|
+
{
|
|
65
|
+
#if defined(JPH_USE_SSE)
|
|
66
|
+
return _mm_setzero_ps();
|
|
67
|
+
#elif defined(JPH_USE_NEON)
|
|
68
|
+
return vdupq_n_f32(0);
|
|
69
|
+
#else
|
|
70
|
+
return Vec4(0, 0, 0, 0);
|
|
71
|
+
#endif
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
Vec4 Vec4::sReplicate(float inV)
|
|
75
|
+
{
|
|
76
|
+
#if defined(JPH_USE_SSE)
|
|
77
|
+
return _mm_set1_ps(inV);
|
|
78
|
+
#elif defined(JPH_USE_NEON)
|
|
79
|
+
return vdupq_n_f32(inV);
|
|
80
|
+
#else
|
|
81
|
+
return Vec4(inV, inV, inV, inV);
|
|
82
|
+
#endif
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
Vec4 Vec4::sOne()
|
|
86
|
+
{
|
|
87
|
+
return sReplicate(1.0f);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
Vec4 Vec4::sNaN()
|
|
91
|
+
{
|
|
92
|
+
return sReplicate(numeric_limits<float>::quiet_NaN());
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
Vec4 Vec4::sLoadFloat4(const Float4 *inV)
|
|
96
|
+
{
|
|
97
|
+
#if defined(JPH_USE_SSE)
|
|
98
|
+
return _mm_loadu_ps(&inV->x);
|
|
99
|
+
#elif defined(JPH_USE_NEON)
|
|
100
|
+
return vld1q_f32(&inV->x);
|
|
101
|
+
#else
|
|
102
|
+
return Vec4(inV->x, inV->y, inV->z, inV->w);
|
|
103
|
+
#endif
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
Vec4 Vec4::sLoadFloat4Aligned(const Float4 *inV)
|
|
107
|
+
{
|
|
108
|
+
#if defined(JPH_USE_SSE)
|
|
109
|
+
return _mm_load_ps(&inV->x);
|
|
110
|
+
#elif defined(JPH_USE_NEON)
|
|
111
|
+
return vld1q_f32(&inV->x);
|
|
112
|
+
#else
|
|
113
|
+
return Vec4(inV->x, inV->y, inV->z, inV->w);
|
|
114
|
+
#endif
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
template <const int Scale>
|
|
118
|
+
Vec4 Vec4::sGatherFloat4(const float *inBase, UVec4Arg inOffsets)
|
|
119
|
+
{
|
|
120
|
+
#if defined(JPH_USE_SSE)
|
|
121
|
+
#ifdef JPH_USE_AVX2
|
|
122
|
+
return _mm_i32gather_ps(inBase, inOffsets.mValue, Scale);
|
|
123
|
+
#else
|
|
124
|
+
const uint8 *base = reinterpret_cast<const uint8 *>(inBase);
|
|
125
|
+
Type x = _mm_load_ss(reinterpret_cast<const float *>(base + inOffsets.GetX() * Scale));
|
|
126
|
+
Type y = _mm_load_ss(reinterpret_cast<const float *>(base + inOffsets.GetY() * Scale));
|
|
127
|
+
Type xy = _mm_unpacklo_ps(x, y);
|
|
128
|
+
Type z = _mm_load_ss(reinterpret_cast<const float *>(base + inOffsets.GetZ() * Scale));
|
|
129
|
+
Type w = _mm_load_ss(reinterpret_cast<const float *>(base + inOffsets.GetW() * Scale));
|
|
130
|
+
Type zw = _mm_unpacklo_ps(z, w);
|
|
131
|
+
return _mm_movelh_ps(xy, zw);
|
|
132
|
+
#endif
|
|
133
|
+
#else
|
|
134
|
+
const uint8 *base = reinterpret_cast<const uint8 *>(inBase);
|
|
135
|
+
float x = *reinterpret_cast<const float *>(base + inOffsets.GetX() * Scale);
|
|
136
|
+
float y = *reinterpret_cast<const float *>(base + inOffsets.GetY() * Scale);
|
|
137
|
+
float z = *reinterpret_cast<const float *>(base + inOffsets.GetZ() * Scale);
|
|
138
|
+
float w = *reinterpret_cast<const float *>(base + inOffsets.GetW() * Scale);
|
|
139
|
+
return Vec4(x, y, z, w);
|
|
140
|
+
#endif
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
Vec4 Vec4::sMin(Vec4Arg inV1, Vec4Arg inV2)
|
|
144
|
+
{
|
|
145
|
+
#if defined(JPH_USE_SSE)
|
|
146
|
+
return _mm_min_ps(inV1.mValue, inV2.mValue);
|
|
147
|
+
#elif defined(JPH_USE_NEON)
|
|
148
|
+
return vminq_f32(inV1.mValue, inV2.mValue);
|
|
149
|
+
#else
|
|
150
|
+
return Vec4(min(inV1.mF32[0], inV2.mF32[0]),
|
|
151
|
+
min(inV1.mF32[1], inV2.mF32[1]),
|
|
152
|
+
min(inV1.mF32[2], inV2.mF32[2]),
|
|
153
|
+
min(inV1.mF32[3], inV2.mF32[3]));
|
|
154
|
+
#endif
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
Vec4 Vec4::sMax(Vec4Arg inV1, Vec4Arg inV2)
|
|
158
|
+
{
|
|
159
|
+
#if defined(JPH_USE_SSE)
|
|
160
|
+
return _mm_max_ps(inV1.mValue, inV2.mValue);
|
|
161
|
+
#elif defined(JPH_USE_NEON)
|
|
162
|
+
return vmaxq_f32(inV1.mValue, inV2.mValue);
|
|
163
|
+
#else
|
|
164
|
+
return Vec4(max(inV1.mF32[0], inV2.mF32[0]),
|
|
165
|
+
max(inV1.mF32[1], inV2.mF32[1]),
|
|
166
|
+
max(inV1.mF32[2], inV2.mF32[2]),
|
|
167
|
+
max(inV1.mF32[3], inV2.mF32[3]));
|
|
168
|
+
#endif
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
Vec4 Vec4::sClamp(Vec4Arg inV, Vec4Arg inMin, Vec4Arg inMax)
|
|
172
|
+
{
|
|
173
|
+
return sMax(sMin(inV, inMax), inMin);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
UVec4 Vec4::sEquals(Vec4Arg inV1, Vec4Arg inV2)
|
|
177
|
+
{
|
|
178
|
+
#if defined(JPH_USE_SSE)
|
|
179
|
+
return _mm_castps_si128(_mm_cmpeq_ps(inV1.mValue, inV2.mValue));
|
|
180
|
+
#elif defined(JPH_USE_NEON)
|
|
181
|
+
return vceqq_f32(inV1.mValue, inV2.mValue);
|
|
182
|
+
#else
|
|
183
|
+
return UVec4(inV1.mF32[0] == inV2.mF32[0]? 0xffffffffu : 0,
|
|
184
|
+
inV1.mF32[1] == inV2.mF32[1]? 0xffffffffu : 0,
|
|
185
|
+
inV1.mF32[2] == inV2.mF32[2]? 0xffffffffu : 0,
|
|
186
|
+
inV1.mF32[3] == inV2.mF32[3]? 0xffffffffu : 0);
|
|
187
|
+
#endif
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
UVec4 Vec4::sLess(Vec4Arg inV1, Vec4Arg inV2)
|
|
191
|
+
{
|
|
192
|
+
#if defined(JPH_USE_SSE)
|
|
193
|
+
return _mm_castps_si128(_mm_cmplt_ps(inV1.mValue, inV2.mValue));
|
|
194
|
+
#elif defined(JPH_USE_NEON)
|
|
195
|
+
return vcltq_f32(inV1.mValue, inV2.mValue);
|
|
196
|
+
#else
|
|
197
|
+
return UVec4(inV1.mF32[0] < inV2.mF32[0]? 0xffffffffu : 0,
|
|
198
|
+
inV1.mF32[1] < inV2.mF32[1]? 0xffffffffu : 0,
|
|
199
|
+
inV1.mF32[2] < inV2.mF32[2]? 0xffffffffu : 0,
|
|
200
|
+
inV1.mF32[3] < inV2.mF32[3]? 0xffffffffu : 0);
|
|
201
|
+
#endif
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
UVec4 Vec4::sLessOrEqual(Vec4Arg inV1, Vec4Arg inV2)
|
|
205
|
+
{
|
|
206
|
+
#if defined(JPH_USE_SSE)
|
|
207
|
+
return _mm_castps_si128(_mm_cmple_ps(inV1.mValue, inV2.mValue));
|
|
208
|
+
#elif defined(JPH_USE_NEON)
|
|
209
|
+
return vcleq_f32(inV1.mValue, inV2.mValue);
|
|
210
|
+
#else
|
|
211
|
+
return UVec4(inV1.mF32[0] <= inV2.mF32[0]? 0xffffffffu : 0,
|
|
212
|
+
inV1.mF32[1] <= inV2.mF32[1]? 0xffffffffu : 0,
|
|
213
|
+
inV1.mF32[2] <= inV2.mF32[2]? 0xffffffffu : 0,
|
|
214
|
+
inV1.mF32[3] <= inV2.mF32[3]? 0xffffffffu : 0);
|
|
215
|
+
#endif
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
UVec4 Vec4::sGreater(Vec4Arg inV1, Vec4Arg inV2)
|
|
219
|
+
{
|
|
220
|
+
#if defined(JPH_USE_SSE)
|
|
221
|
+
return _mm_castps_si128(_mm_cmpgt_ps(inV1.mValue, inV2.mValue));
|
|
222
|
+
#elif defined(JPH_USE_NEON)
|
|
223
|
+
return vcgtq_f32(inV1.mValue, inV2.mValue);
|
|
224
|
+
#else
|
|
225
|
+
return UVec4(inV1.mF32[0] > inV2.mF32[0]? 0xffffffffu : 0,
|
|
226
|
+
inV1.mF32[1] > inV2.mF32[1]? 0xffffffffu : 0,
|
|
227
|
+
inV1.mF32[2] > inV2.mF32[2]? 0xffffffffu : 0,
|
|
228
|
+
inV1.mF32[3] > inV2.mF32[3]? 0xffffffffu : 0);
|
|
229
|
+
#endif
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
UVec4 Vec4::sGreaterOrEqual(Vec4Arg inV1, Vec4Arg inV2)
|
|
233
|
+
{
|
|
234
|
+
#if defined(JPH_USE_SSE)
|
|
235
|
+
return _mm_castps_si128(_mm_cmpge_ps(inV1.mValue, inV2.mValue));
|
|
236
|
+
#elif defined(JPH_USE_NEON)
|
|
237
|
+
return vcgeq_f32(inV1.mValue, inV2.mValue);
|
|
238
|
+
#else
|
|
239
|
+
return UVec4(inV1.mF32[0] >= inV2.mF32[0]? 0xffffffffu : 0,
|
|
240
|
+
inV1.mF32[1] >= inV2.mF32[1]? 0xffffffffu : 0,
|
|
241
|
+
inV1.mF32[2] >= inV2.mF32[2]? 0xffffffffu : 0,
|
|
242
|
+
inV1.mF32[3] >= inV2.mF32[3]? 0xffffffffu : 0);
|
|
243
|
+
#endif
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
Vec4 Vec4::sFusedMultiplyAdd(Vec4Arg inMul1, Vec4Arg inMul2, Vec4Arg inAdd)
|
|
247
|
+
{
|
|
248
|
+
#if defined(JPH_USE_SSE)
|
|
249
|
+
#ifdef JPH_USE_FMADD
|
|
250
|
+
return _mm_fmadd_ps(inMul1.mValue, inMul2.mValue, inAdd.mValue);
|
|
251
|
+
#else
|
|
252
|
+
return _mm_add_ps(_mm_mul_ps(inMul1.mValue, inMul2.mValue), inAdd.mValue);
|
|
253
|
+
#endif
|
|
254
|
+
#elif defined(JPH_USE_NEON)
|
|
255
|
+
return vmlaq_f32(inAdd.mValue, inMul1.mValue, inMul2.mValue);
|
|
256
|
+
#else
|
|
257
|
+
return Vec4(inMul1.mF32[0] * inMul2.mF32[0] + inAdd.mF32[0],
|
|
258
|
+
inMul1.mF32[1] * inMul2.mF32[1] + inAdd.mF32[1],
|
|
259
|
+
inMul1.mF32[2] * inMul2.mF32[2] + inAdd.mF32[2],
|
|
260
|
+
inMul1.mF32[3] * inMul2.mF32[3] + inAdd.mF32[3]);
|
|
261
|
+
#endif
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
Vec4 Vec4::sSelect(Vec4Arg inNotSet, Vec4Arg inSet, UVec4Arg inControl)
|
|
265
|
+
{
|
|
266
|
+
#if defined(JPH_USE_SSE4_1) && !defined(JPH_PLATFORM_WASM) // _mm_blendv_ps has problems on FireFox
|
|
267
|
+
return _mm_blendv_ps(inNotSet.mValue, inSet.mValue, _mm_castsi128_ps(inControl.mValue));
|
|
268
|
+
#elif defined(JPH_USE_SSE)
|
|
269
|
+
__m128 is_set = _mm_castsi128_ps(_mm_srai_epi32(inControl.mValue, 31));
|
|
270
|
+
return _mm_or_ps(_mm_and_ps(is_set, inSet.mValue), _mm_andnot_ps(is_set, inNotSet.mValue));
|
|
271
|
+
#elif defined(JPH_USE_NEON)
|
|
272
|
+
return vbslq_f32(vreinterpretq_u32_s32(vshrq_n_s32(vreinterpretq_s32_u32(inControl.mValue), 31)), inSet.mValue, inNotSet.mValue);
|
|
273
|
+
#else
|
|
274
|
+
Vec4 result;
|
|
275
|
+
for (int i = 0; i < 4; i++)
|
|
276
|
+
result.mF32[i] = (inControl.mU32[i] & 0x80000000u) ? inSet.mF32[i] : inNotSet.mF32[i];
|
|
277
|
+
return result;
|
|
278
|
+
#endif
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
Vec4 Vec4::sOr(Vec4Arg inV1, Vec4Arg inV2)
|
|
282
|
+
{
|
|
283
|
+
#if defined(JPH_USE_SSE)
|
|
284
|
+
return _mm_or_ps(inV1.mValue, inV2.mValue);
|
|
285
|
+
#elif defined(JPH_USE_NEON)
|
|
286
|
+
return vreinterpretq_f32_u32(vorrq_u32(vreinterpretq_u32_f32(inV1.mValue), vreinterpretq_u32_f32(inV2.mValue)));
|
|
287
|
+
#else
|
|
288
|
+
return UVec4::sOr(inV1.ReinterpretAsInt(), inV2.ReinterpretAsInt()).ReinterpretAsFloat();
|
|
289
|
+
#endif
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
Vec4 Vec4::sXor(Vec4Arg inV1, Vec4Arg inV2)
|
|
293
|
+
{
|
|
294
|
+
#if defined(JPH_USE_SSE)
|
|
295
|
+
return _mm_xor_ps(inV1.mValue, inV2.mValue);
|
|
296
|
+
#elif defined(JPH_USE_NEON)
|
|
297
|
+
return vreinterpretq_f32_u32(veorq_u32(vreinterpretq_u32_f32(inV1.mValue), vreinterpretq_u32_f32(inV2.mValue)));
|
|
298
|
+
#else
|
|
299
|
+
return UVec4::sXor(inV1.ReinterpretAsInt(), inV2.ReinterpretAsInt()).ReinterpretAsFloat();
|
|
300
|
+
#endif
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
Vec4 Vec4::sAnd(Vec4Arg inV1, Vec4Arg inV2)
|
|
304
|
+
{
|
|
305
|
+
#if defined(JPH_USE_SSE)
|
|
306
|
+
return _mm_and_ps(inV1.mValue, inV2.mValue);
|
|
307
|
+
#elif defined(JPH_USE_NEON)
|
|
308
|
+
return vreinterpretq_f32_u32(vandq_u32(vreinterpretq_u32_f32(inV1.mValue), vreinterpretq_u32_f32(inV2.mValue)));
|
|
309
|
+
#else
|
|
310
|
+
return UVec4::sAnd(inV1.ReinterpretAsInt(), inV2.ReinterpretAsInt()).ReinterpretAsFloat();
|
|
311
|
+
#endif
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
void Vec4::sSort4(Vec4 &ioValue, UVec4 &ioIndex)
|
|
315
|
+
{
|
|
316
|
+
// Pass 1, test 1st vs 3rd, 2nd vs 4th
|
|
317
|
+
Vec4 v1 = ioValue.Swizzle<SWIZZLE_Z, SWIZZLE_W, SWIZZLE_X, SWIZZLE_Y>();
|
|
318
|
+
UVec4 i1 = ioIndex.Swizzle<SWIZZLE_Z, SWIZZLE_W, SWIZZLE_X, SWIZZLE_Y>();
|
|
319
|
+
UVec4 c1 = sLess(ioValue, v1).Swizzle<SWIZZLE_Z, SWIZZLE_W, SWIZZLE_Z, SWIZZLE_W>();
|
|
320
|
+
ioValue = sSelect(ioValue, v1, c1);
|
|
321
|
+
ioIndex = UVec4::sSelect(ioIndex, i1, c1);
|
|
322
|
+
|
|
323
|
+
// Pass 2, test 1st vs 2nd, 3rd vs 4th
|
|
324
|
+
Vec4 v2 = ioValue.Swizzle<SWIZZLE_Y, SWIZZLE_X, SWIZZLE_W, SWIZZLE_Z>();
|
|
325
|
+
UVec4 i2 = ioIndex.Swizzle<SWIZZLE_Y, SWIZZLE_X, SWIZZLE_W, SWIZZLE_Z>();
|
|
326
|
+
UVec4 c2 = sLess(ioValue, v2).Swizzle<SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_W, SWIZZLE_W>();
|
|
327
|
+
ioValue = sSelect(ioValue, v2, c2);
|
|
328
|
+
ioIndex = UVec4::sSelect(ioIndex, i2, c2);
|
|
329
|
+
|
|
330
|
+
// Pass 3, test 2nd vs 3rd component
|
|
331
|
+
Vec4 v3 = ioValue.Swizzle<SWIZZLE_X, SWIZZLE_Z, SWIZZLE_Y, SWIZZLE_W>();
|
|
332
|
+
UVec4 i3 = ioIndex.Swizzle<SWIZZLE_X, SWIZZLE_Z, SWIZZLE_Y, SWIZZLE_W>();
|
|
333
|
+
UVec4 c3 = sLess(ioValue, v3).Swizzle<SWIZZLE_X, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_W>();
|
|
334
|
+
ioValue = sSelect(ioValue, v3, c3);
|
|
335
|
+
ioIndex = UVec4::sSelect(ioIndex, i3, c3);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
void Vec4::sSort4Reverse(Vec4 &ioValue, UVec4 &ioIndex)
|
|
339
|
+
{
|
|
340
|
+
// Pass 1, test 1st vs 3rd, 2nd vs 4th
|
|
341
|
+
Vec4 v1 = ioValue.Swizzle<SWIZZLE_Z, SWIZZLE_W, SWIZZLE_X, SWIZZLE_Y>();
|
|
342
|
+
UVec4 i1 = ioIndex.Swizzle<SWIZZLE_Z, SWIZZLE_W, SWIZZLE_X, SWIZZLE_Y>();
|
|
343
|
+
UVec4 c1 = sGreater(ioValue, v1).Swizzle<SWIZZLE_Z, SWIZZLE_W, SWIZZLE_Z, SWIZZLE_W>();
|
|
344
|
+
ioValue = sSelect(ioValue, v1, c1);
|
|
345
|
+
ioIndex = UVec4::sSelect(ioIndex, i1, c1);
|
|
346
|
+
|
|
347
|
+
// Pass 2, test 1st vs 2nd, 3rd vs 4th
|
|
348
|
+
Vec4 v2 = ioValue.Swizzle<SWIZZLE_Y, SWIZZLE_X, SWIZZLE_W, SWIZZLE_Z>();
|
|
349
|
+
UVec4 i2 = ioIndex.Swizzle<SWIZZLE_Y, SWIZZLE_X, SWIZZLE_W, SWIZZLE_Z>();
|
|
350
|
+
UVec4 c2 = sGreater(ioValue, v2).Swizzle<SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_W, SWIZZLE_W>();
|
|
351
|
+
ioValue = sSelect(ioValue, v2, c2);
|
|
352
|
+
ioIndex = UVec4::sSelect(ioIndex, i2, c2);
|
|
353
|
+
|
|
354
|
+
// Pass 3, test 2nd vs 3rd component
|
|
355
|
+
Vec4 v3 = ioValue.Swizzle<SWIZZLE_X, SWIZZLE_Z, SWIZZLE_Y, SWIZZLE_W>();
|
|
356
|
+
UVec4 i3 = ioIndex.Swizzle<SWIZZLE_X, SWIZZLE_Z, SWIZZLE_Y, SWIZZLE_W>();
|
|
357
|
+
UVec4 c3 = sGreater(ioValue, v3).Swizzle<SWIZZLE_X, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_W>();
|
|
358
|
+
ioValue = sSelect(ioValue, v3, c3);
|
|
359
|
+
ioIndex = UVec4::sSelect(ioIndex, i3, c3);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
bool Vec4::operator == (Vec4Arg inV2) const
|
|
363
|
+
{
|
|
364
|
+
return sEquals(*this, inV2).TestAllTrue();
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
bool Vec4::IsClose(Vec4Arg inV2, float inMaxDistSq) const
|
|
368
|
+
{
|
|
369
|
+
return (inV2 - *this).LengthSq() <= inMaxDistSq;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
bool Vec4::IsNearZero(float inMaxDistSq) const
|
|
373
|
+
{
|
|
374
|
+
return LengthSq() <= inMaxDistSq;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
bool Vec4::IsNormalized(float inTolerance) const
|
|
378
|
+
{
|
|
379
|
+
return abs(LengthSq() - 1.0f) <= inTolerance;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
bool Vec4::IsNaN() const
|
|
383
|
+
{
|
|
384
|
+
#if defined(JPH_USE_AVX512)
|
|
385
|
+
return _mm_fpclass_ps_mask(mValue, 0b10000001) != 0;
|
|
386
|
+
#elif defined(JPH_USE_SSE)
|
|
387
|
+
return _mm_movemask_ps(_mm_cmpunord_ps(mValue, mValue)) != 0;
|
|
388
|
+
#elif defined(JPH_USE_NEON)
|
|
389
|
+
uint32x4_t is_equal = vceqq_f32(mValue, mValue); // If a number is not equal to itself it's a NaN
|
|
390
|
+
return vaddvq_u32(vshrq_n_u32(is_equal, 31)) != 4;
|
|
391
|
+
#else
|
|
392
|
+
return isnan(mF32[0]) || isnan(mF32[1]) || isnan(mF32[2]) || isnan(mF32[3]);
|
|
393
|
+
#endif
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
Vec4 Vec4::operator * (Vec4Arg inV2) const
|
|
397
|
+
{
|
|
398
|
+
#if defined(JPH_USE_SSE)
|
|
399
|
+
return _mm_mul_ps(mValue, inV2.mValue);
|
|
400
|
+
#elif defined(JPH_USE_NEON)
|
|
401
|
+
return vmulq_f32(mValue, inV2.mValue);
|
|
402
|
+
#else
|
|
403
|
+
return Vec4(mF32[0] * inV2.mF32[0],
|
|
404
|
+
mF32[1] * inV2.mF32[1],
|
|
405
|
+
mF32[2] * inV2.mF32[2],
|
|
406
|
+
mF32[3] * inV2.mF32[3]);
|
|
407
|
+
#endif
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
Vec4 Vec4::operator * (float inV2) const
|
|
411
|
+
{
|
|
412
|
+
#if defined(JPH_USE_SSE)
|
|
413
|
+
return _mm_mul_ps(mValue, _mm_set1_ps(inV2));
|
|
414
|
+
#elif defined(JPH_USE_NEON)
|
|
415
|
+
return vmulq_n_f32(mValue, inV2);
|
|
416
|
+
#else
|
|
417
|
+
return Vec4(mF32[0] * inV2, mF32[1] * inV2, mF32[2] * inV2, mF32[3] * inV2);
|
|
418
|
+
#endif
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/// Multiply vector with float
|
|
422
|
+
Vec4 operator * (float inV1, Vec4Arg inV2)
|
|
423
|
+
{
|
|
424
|
+
#if defined(JPH_USE_SSE)
|
|
425
|
+
return _mm_mul_ps(_mm_set1_ps(inV1), inV2.mValue);
|
|
426
|
+
#elif defined(JPH_USE_NEON)
|
|
427
|
+
return vmulq_n_f32(inV2.mValue, inV1);
|
|
428
|
+
#else
|
|
429
|
+
return Vec4(inV1 * inV2.mF32[0],
|
|
430
|
+
inV1 * inV2.mF32[1],
|
|
431
|
+
inV1 * inV2.mF32[2],
|
|
432
|
+
inV1 * inV2.mF32[3]);
|
|
433
|
+
#endif
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
Vec4 Vec4::operator / (float inV2) const
|
|
437
|
+
{
|
|
438
|
+
#if defined(JPH_USE_SSE)
|
|
439
|
+
return _mm_div_ps(mValue, _mm_set1_ps(inV2));
|
|
440
|
+
#elif defined(JPH_USE_NEON)
|
|
441
|
+
return vdivq_f32(mValue, vdupq_n_f32(inV2));
|
|
442
|
+
#else
|
|
443
|
+
return Vec4(mF32[0] / inV2, mF32[1] / inV2, mF32[2] / inV2, mF32[3] / inV2);
|
|
444
|
+
#endif
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
Vec4 &Vec4::operator *= (float inV2)
|
|
448
|
+
{
|
|
449
|
+
#if defined(JPH_USE_SSE)
|
|
450
|
+
mValue = _mm_mul_ps(mValue, _mm_set1_ps(inV2));
|
|
451
|
+
#elif defined(JPH_USE_NEON)
|
|
452
|
+
mValue = vmulq_n_f32(mValue, inV2);
|
|
453
|
+
#else
|
|
454
|
+
for (int i = 0; i < 4; ++i)
|
|
455
|
+
mF32[i] *= inV2;
|
|
456
|
+
#endif
|
|
457
|
+
return *this;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
Vec4 &Vec4::operator *= (Vec4Arg inV2)
|
|
461
|
+
{
|
|
462
|
+
#if defined(JPH_USE_SSE)
|
|
463
|
+
mValue = _mm_mul_ps(mValue, inV2.mValue);
|
|
464
|
+
#elif defined(JPH_USE_NEON)
|
|
465
|
+
mValue = vmulq_f32(mValue, inV2.mValue);
|
|
466
|
+
#else
|
|
467
|
+
for (int i = 0; i < 4; ++i)
|
|
468
|
+
mF32[i] *= inV2.mF32[i];
|
|
469
|
+
#endif
|
|
470
|
+
return *this;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
Vec4 &Vec4::operator /= (float inV2)
|
|
474
|
+
{
|
|
475
|
+
#if defined(JPH_USE_SSE)
|
|
476
|
+
mValue = _mm_div_ps(mValue, _mm_set1_ps(inV2));
|
|
477
|
+
#elif defined(JPH_USE_NEON)
|
|
478
|
+
mValue = vdivq_f32(mValue, vdupq_n_f32(inV2));
|
|
479
|
+
#else
|
|
480
|
+
for (int i = 0; i < 4; ++i)
|
|
481
|
+
mF32[i] /= inV2;
|
|
482
|
+
#endif
|
|
483
|
+
return *this;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
Vec4 Vec4::operator + (Vec4Arg inV2) const
|
|
487
|
+
{
|
|
488
|
+
#if defined(JPH_USE_SSE)
|
|
489
|
+
return _mm_add_ps(mValue, inV2.mValue);
|
|
490
|
+
#elif defined(JPH_USE_NEON)
|
|
491
|
+
return vaddq_f32(mValue, inV2.mValue);
|
|
492
|
+
#else
|
|
493
|
+
return Vec4(mF32[0] + inV2.mF32[0],
|
|
494
|
+
mF32[1] + inV2.mF32[1],
|
|
495
|
+
mF32[2] + inV2.mF32[2],
|
|
496
|
+
mF32[3] + inV2.mF32[3]);
|
|
497
|
+
#endif
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
Vec4 &Vec4::operator += (Vec4Arg inV2)
|
|
501
|
+
{
|
|
502
|
+
#if defined(JPH_USE_SSE)
|
|
503
|
+
mValue = _mm_add_ps(mValue, inV2.mValue);
|
|
504
|
+
#elif defined(JPH_USE_NEON)
|
|
505
|
+
mValue = vaddq_f32(mValue, inV2.mValue);
|
|
506
|
+
#else
|
|
507
|
+
for (int i = 0; i < 4; ++i)
|
|
508
|
+
mF32[i] += inV2.mF32[i];
|
|
509
|
+
#endif
|
|
510
|
+
return *this;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
Vec4 Vec4::operator - () const
|
|
514
|
+
{
|
|
515
|
+
#if defined(JPH_USE_SSE)
|
|
516
|
+
return _mm_sub_ps(_mm_setzero_ps(), mValue);
|
|
517
|
+
#elif defined(JPH_USE_NEON)
|
|
518
|
+
#ifdef JPH_CROSS_PLATFORM_DETERMINISTIC
|
|
519
|
+
return vsubq_f32(vdupq_n_f32(0), mValue);
|
|
520
|
+
#else
|
|
521
|
+
return vnegq_f32(mValue);
|
|
522
|
+
#endif
|
|
523
|
+
#else
|
|
524
|
+
#ifdef JPH_CROSS_PLATFORM_DETERMINISTIC
|
|
525
|
+
return Vec4(0.0f - mF32[0], 0.0f - mF32[1], 0.0f - mF32[2], 0.0f - mF32[3]);
|
|
526
|
+
#else
|
|
527
|
+
return Vec4(-mF32[0], -mF32[1], -mF32[2], -mF32[3]);
|
|
528
|
+
#endif
|
|
529
|
+
#endif
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
Vec4 Vec4::operator - (Vec4Arg inV2) const
|
|
533
|
+
{
|
|
534
|
+
#if defined(JPH_USE_SSE)
|
|
535
|
+
return _mm_sub_ps(mValue, inV2.mValue);
|
|
536
|
+
#elif defined(JPH_USE_NEON)
|
|
537
|
+
return vsubq_f32(mValue, inV2.mValue);
|
|
538
|
+
#else
|
|
539
|
+
return Vec4(mF32[0] - inV2.mF32[0],
|
|
540
|
+
mF32[1] - inV2.mF32[1],
|
|
541
|
+
mF32[2] - inV2.mF32[2],
|
|
542
|
+
mF32[3] - inV2.mF32[3]);
|
|
543
|
+
#endif
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
Vec4 &Vec4::operator -= (Vec4Arg inV2)
|
|
547
|
+
{
|
|
548
|
+
#if defined(JPH_USE_SSE)
|
|
549
|
+
mValue = _mm_sub_ps(mValue, inV2.mValue);
|
|
550
|
+
#elif defined(JPH_USE_NEON)
|
|
551
|
+
mValue = vsubq_f32(mValue, inV2.mValue);
|
|
552
|
+
#else
|
|
553
|
+
for (int i = 0; i < 4; ++i)
|
|
554
|
+
mF32[i] -= inV2.mF32[i];
|
|
555
|
+
#endif
|
|
556
|
+
return *this;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
Vec4 Vec4::operator / (Vec4Arg inV2) const
|
|
560
|
+
{
|
|
561
|
+
#if defined(JPH_USE_SSE)
|
|
562
|
+
return _mm_div_ps(mValue, inV2.mValue);
|
|
563
|
+
#elif defined(JPH_USE_NEON)
|
|
564
|
+
return vdivq_f32(mValue, inV2.mValue);
|
|
565
|
+
#else
|
|
566
|
+
return Vec4(mF32[0] / inV2.mF32[0],
|
|
567
|
+
mF32[1] / inV2.mF32[1],
|
|
568
|
+
mF32[2] / inV2.mF32[2],
|
|
569
|
+
mF32[3] / inV2.mF32[3]);
|
|
570
|
+
#endif
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
Vec4 Vec4::SplatX() const
|
|
574
|
+
{
|
|
575
|
+
#if defined(JPH_USE_SSE)
|
|
576
|
+
return _mm_shuffle_ps(mValue, mValue, _MM_SHUFFLE(0, 0, 0, 0));
|
|
577
|
+
#elif defined(JPH_USE_NEON)
|
|
578
|
+
return vdupq_laneq_f32(mValue, 0);
|
|
579
|
+
#else
|
|
580
|
+
return Vec4(mF32[0], mF32[0], mF32[0], mF32[0]);
|
|
581
|
+
#endif
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
Vec4 Vec4::SplatY() const
|
|
585
|
+
{
|
|
586
|
+
#if defined(JPH_USE_SSE)
|
|
587
|
+
return _mm_shuffle_ps(mValue, mValue, _MM_SHUFFLE(1, 1, 1, 1));
|
|
588
|
+
#elif defined(JPH_USE_NEON)
|
|
589
|
+
return vdupq_laneq_f32(mValue, 1);
|
|
590
|
+
#else
|
|
591
|
+
return Vec4(mF32[1], mF32[1], mF32[1], mF32[1]);
|
|
592
|
+
#endif
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
Vec4 Vec4::SplatZ() const
|
|
596
|
+
{
|
|
597
|
+
#if defined(JPH_USE_SSE)
|
|
598
|
+
return _mm_shuffle_ps(mValue, mValue, _MM_SHUFFLE(2, 2, 2, 2));
|
|
599
|
+
#elif defined(JPH_USE_NEON)
|
|
600
|
+
return vdupq_laneq_f32(mValue, 2);
|
|
601
|
+
#else
|
|
602
|
+
return Vec4(mF32[2], mF32[2], mF32[2], mF32[2]);
|
|
603
|
+
#endif
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
Vec4 Vec4::SplatW() const
|
|
607
|
+
{
|
|
608
|
+
#if defined(JPH_USE_SSE)
|
|
609
|
+
return _mm_shuffle_ps(mValue, mValue, _MM_SHUFFLE(3, 3, 3, 3));
|
|
610
|
+
#elif defined(JPH_USE_NEON)
|
|
611
|
+
return vdupq_laneq_f32(mValue, 3);
|
|
612
|
+
#else
|
|
613
|
+
return Vec4(mF32[3], mF32[3], mF32[3], mF32[3]);
|
|
614
|
+
#endif
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
Vec3 Vec4::SplatX3() const
|
|
618
|
+
{
|
|
619
|
+
#if defined(JPH_USE_SSE)
|
|
620
|
+
return _mm_shuffle_ps(mValue, mValue, _MM_SHUFFLE(0, 0, 0, 0));
|
|
621
|
+
#elif defined(JPH_USE_NEON)
|
|
622
|
+
return vdupq_laneq_f32(mValue, 0);
|
|
623
|
+
#else
|
|
624
|
+
return Vec3(mF32[0], mF32[0], mF32[0]);
|
|
625
|
+
#endif
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
Vec3 Vec4::SplatY3() const
|
|
629
|
+
{
|
|
630
|
+
#if defined(JPH_USE_SSE)
|
|
631
|
+
return _mm_shuffle_ps(mValue, mValue, _MM_SHUFFLE(1, 1, 1, 1));
|
|
632
|
+
#elif defined(JPH_USE_NEON)
|
|
633
|
+
return vdupq_laneq_f32(mValue, 1);
|
|
634
|
+
#else
|
|
635
|
+
return Vec3(mF32[1], mF32[1], mF32[1]);
|
|
636
|
+
#endif
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
Vec3 Vec4::SplatZ3() const
|
|
640
|
+
{
|
|
641
|
+
#if defined(JPH_USE_SSE)
|
|
642
|
+
return _mm_shuffle_ps(mValue, mValue, _MM_SHUFFLE(2, 2, 2, 2));
|
|
643
|
+
#elif defined(JPH_USE_NEON)
|
|
644
|
+
return vdupq_laneq_f32(mValue, 2);
|
|
645
|
+
#else
|
|
646
|
+
return Vec3(mF32[2], mF32[2], mF32[2]);
|
|
647
|
+
#endif
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
Vec3 Vec4::SplatW3() const
|
|
651
|
+
{
|
|
652
|
+
#if defined(JPH_USE_SSE)
|
|
653
|
+
return _mm_shuffle_ps(mValue, mValue, _MM_SHUFFLE(3, 3, 3, 3));
|
|
654
|
+
#elif defined(JPH_USE_NEON)
|
|
655
|
+
return vdupq_laneq_f32(mValue, 3);
|
|
656
|
+
#else
|
|
657
|
+
return Vec3(mF32[3], mF32[3], mF32[3]);
|
|
658
|
+
#endif
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
int Vec4::GetLowestComponentIndex() const
|
|
662
|
+
{
|
|
663
|
+
// Get the minimum value in all 4 components
|
|
664
|
+
Vec4 value = Vec4::sMin(*this, Swizzle<SWIZZLE_Y, SWIZZLE_X, SWIZZLE_W, SWIZZLE_Z>());
|
|
665
|
+
value = Vec4::sMin(value, value.Swizzle<SWIZZLE_Z, SWIZZLE_W, SWIZZLE_X, SWIZZLE_Y>());
|
|
666
|
+
|
|
667
|
+
// Compare with the original vector to find which component is equal to the minimum value
|
|
668
|
+
return CountTrailingZeros(Vec4::sEquals(*this, value).GetTrues());
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
int Vec4::GetHighestComponentIndex() const
|
|
672
|
+
{
|
|
673
|
+
// Get the maximum value in all 4 components
|
|
674
|
+
Vec4 value = Vec4::sMax(*this, Swizzle<SWIZZLE_Y, SWIZZLE_X, SWIZZLE_W, SWIZZLE_Z>());
|
|
675
|
+
value = Vec4::sMax(value, value.Swizzle<SWIZZLE_Z, SWIZZLE_W, SWIZZLE_X, SWIZZLE_Y>());
|
|
676
|
+
|
|
677
|
+
// Compare with the original vector to find which component is equal to the maximum value
|
|
678
|
+
return CountTrailingZeros(Vec4::sEquals(*this, value).GetTrues());
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
Vec4 Vec4::Abs() const
|
|
682
|
+
{
|
|
683
|
+
#if defined(JPH_USE_AVX512)
|
|
684
|
+
return _mm_range_ps(mValue, mValue, 0b1000);
|
|
685
|
+
#elif defined(JPH_USE_SSE)
|
|
686
|
+
return _mm_max_ps(_mm_sub_ps(_mm_setzero_ps(), mValue), mValue);
|
|
687
|
+
#elif defined(JPH_USE_NEON)
|
|
688
|
+
return vabsq_f32(mValue);
|
|
689
|
+
#else
|
|
690
|
+
return Vec4(abs(mF32[0]), abs(mF32[1]), abs(mF32[2]), abs(mF32[3]));
|
|
691
|
+
#endif
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
Vec4 Vec4::Reciprocal() const
|
|
695
|
+
{
|
|
696
|
+
return sOne() / mValue;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
Vec4 Vec4::DotV(Vec4Arg inV2) const
|
|
700
|
+
{
|
|
701
|
+
#if defined(JPH_USE_SSE4_1)
|
|
702
|
+
return _mm_dp_ps(mValue, inV2.mValue, 0xff);
|
|
703
|
+
#elif defined(JPH_USE_NEON)
|
|
704
|
+
float32x4_t mul = vmulq_f32(mValue, inV2.mValue);
|
|
705
|
+
return vdupq_n_f32(vaddvq_f32(mul));
|
|
706
|
+
#else
|
|
707
|
+
// Brackets placed so that the order is consistent with the vectorized version
|
|
708
|
+
return Vec4::sReplicate((mF32[0] * inV2.mF32[0] + mF32[1] * inV2.mF32[1]) + (mF32[2] * inV2.mF32[2] + mF32[3] * inV2.mF32[3]));
|
|
709
|
+
#endif
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
float Vec4::Dot(Vec4Arg inV2) const
|
|
713
|
+
{
|
|
714
|
+
#if defined(JPH_USE_SSE4_1)
|
|
715
|
+
return _mm_cvtss_f32(_mm_dp_ps(mValue, inV2.mValue, 0xff));
|
|
716
|
+
#elif defined(JPH_USE_NEON)
|
|
717
|
+
float32x4_t mul = vmulq_f32(mValue, inV2.mValue);
|
|
718
|
+
return vaddvq_f32(mul);
|
|
719
|
+
#else
|
|
720
|
+
// Brackets placed so that the order is consistent with the vectorized version
|
|
721
|
+
return (mF32[0] * inV2.mF32[0] + mF32[1] * inV2.mF32[1]) + (mF32[2] * inV2.mF32[2] + mF32[3] * inV2.mF32[3]);
|
|
722
|
+
#endif
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
float Vec4::LengthSq() const
|
|
726
|
+
{
|
|
727
|
+
#if defined(JPH_USE_SSE4_1)
|
|
728
|
+
return _mm_cvtss_f32(_mm_dp_ps(mValue, mValue, 0xff));
|
|
729
|
+
#elif defined(JPH_USE_NEON)
|
|
730
|
+
float32x4_t mul = vmulq_f32(mValue, mValue);
|
|
731
|
+
return vaddvq_f32(mul);
|
|
732
|
+
#else
|
|
733
|
+
// Brackets placed so that the order is consistent with the vectorized version
|
|
734
|
+
return (mF32[0] * mF32[0] + mF32[1] * mF32[1]) + (mF32[2] * mF32[2] + mF32[3] * mF32[3]);
|
|
735
|
+
#endif
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
float Vec4::Length() const
|
|
739
|
+
{
|
|
740
|
+
#if defined(JPH_USE_SSE4_1)
|
|
741
|
+
return _mm_cvtss_f32(_mm_sqrt_ss(_mm_dp_ps(mValue, mValue, 0xff)));
|
|
742
|
+
#elif defined(JPH_USE_NEON)
|
|
743
|
+
float32x4_t mul = vmulq_f32(mValue, mValue);
|
|
744
|
+
float32x2_t sum = vdup_n_f32(vaddvq_f32(mul));
|
|
745
|
+
return vget_lane_f32(vsqrt_f32(sum), 0);
|
|
746
|
+
#else
|
|
747
|
+
// Brackets placed so that the order is consistent with the vectorized version
|
|
748
|
+
return sqrt((mF32[0] * mF32[0] + mF32[1] * mF32[1]) + (mF32[2] * mF32[2] + mF32[3] * mF32[3]));
|
|
749
|
+
#endif
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
Vec4 Vec4::Sqrt() const
|
|
753
|
+
{
|
|
754
|
+
#if defined(JPH_USE_SSE)
|
|
755
|
+
return _mm_sqrt_ps(mValue);
|
|
756
|
+
#elif defined(JPH_USE_NEON)
|
|
757
|
+
return vsqrtq_f32(mValue);
|
|
758
|
+
#else
|
|
759
|
+
return Vec4(sqrt(mF32[0]), sqrt(mF32[1]), sqrt(mF32[2]), sqrt(mF32[3]));
|
|
760
|
+
#endif
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
Vec4 Vec4::GetSign() const
|
|
765
|
+
{
|
|
766
|
+
#if defined(JPH_USE_AVX512)
|
|
767
|
+
return _mm_fixupimm_ps(mValue, mValue, _mm_set1_epi32(0xA9A90A00), 0);
|
|
768
|
+
#elif defined(JPH_USE_SSE)
|
|
769
|
+
Type minus_one = _mm_set1_ps(-1.0f);
|
|
770
|
+
Type one = _mm_set1_ps(1.0f);
|
|
771
|
+
return _mm_or_ps(_mm_and_ps(mValue, minus_one), one);
|
|
772
|
+
#elif defined(JPH_USE_NEON)
|
|
773
|
+
Type minus_one = vdupq_n_f32(-1.0f);
|
|
774
|
+
Type one = vdupq_n_f32(1.0f);
|
|
775
|
+
return vreinterpretq_f32_u32(vorrq_u32(vandq_u32(vreinterpretq_u32_f32(mValue), vreinterpretq_u32_f32(minus_one)), vreinterpretq_u32_f32(one)));
|
|
776
|
+
#else
|
|
777
|
+
return Vec4(std::signbit(mF32[0])? -1.0f : 1.0f,
|
|
778
|
+
std::signbit(mF32[1])? -1.0f : 1.0f,
|
|
779
|
+
std::signbit(mF32[2])? -1.0f : 1.0f,
|
|
780
|
+
std::signbit(mF32[3])? -1.0f : 1.0f);
|
|
781
|
+
#endif
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
template <int X, int Y, int Z, int W>
|
|
785
|
+
JPH_INLINE Vec4 Vec4::FlipSign() const
|
|
786
|
+
{
|
|
787
|
+
static_assert(X == 1 || X == -1, "X must be 1 or -1");
|
|
788
|
+
static_assert(Y == 1 || Y == -1, "Y must be 1 or -1");
|
|
789
|
+
static_assert(Z == 1 || Z == -1, "Z must be 1 or -1");
|
|
790
|
+
static_assert(W == 1 || W == -1, "W must be 1 or -1");
|
|
791
|
+
return Vec4::sXor(*this, Vec4(X > 0? 0.0f : -0.0f, Y > 0? 0.0f : -0.0f, Z > 0? 0.0f : -0.0f, W > 0? 0.0f : -0.0f));
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
Vec4 Vec4::Normalized() const
|
|
795
|
+
{
|
|
796
|
+
#if defined(JPH_USE_SSE4_1)
|
|
797
|
+
return _mm_div_ps(mValue, _mm_sqrt_ps(_mm_dp_ps(mValue, mValue, 0xff)));
|
|
798
|
+
#elif defined(JPH_USE_NEON)
|
|
799
|
+
float32x4_t mul = vmulq_f32(mValue, mValue);
|
|
800
|
+
float32x4_t sum = vdupq_n_f32(vaddvq_f32(mul));
|
|
801
|
+
return vdivq_f32(mValue, vsqrtq_f32(sum));
|
|
802
|
+
#else
|
|
803
|
+
return *this / Length();
|
|
804
|
+
#endif
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
void Vec4::StoreFloat4(Float4 *outV) const
|
|
808
|
+
{
|
|
809
|
+
#if defined(JPH_USE_SSE)
|
|
810
|
+
_mm_storeu_ps(&outV->x, mValue);
|
|
811
|
+
#elif defined(JPH_USE_NEON)
|
|
812
|
+
vst1q_f32(&outV->x, mValue);
|
|
813
|
+
#else
|
|
814
|
+
for (int i = 0; i < 4; ++i)
|
|
815
|
+
(&outV->x)[i] = mF32[i];
|
|
816
|
+
#endif
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
UVec4 Vec4::ToInt() const
|
|
820
|
+
{
|
|
821
|
+
#if defined(JPH_USE_SSE)
|
|
822
|
+
return _mm_cvttps_epi32(mValue);
|
|
823
|
+
#elif defined(JPH_USE_NEON)
|
|
824
|
+
return vcvtq_u32_f32(mValue);
|
|
825
|
+
#else
|
|
826
|
+
return UVec4(uint32(mF32[0]), uint32(mF32[1]), uint32(mF32[2]), uint32(mF32[3]));
|
|
827
|
+
#endif
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
UVec4 Vec4::ReinterpretAsInt() const
|
|
831
|
+
{
|
|
832
|
+
#if defined(JPH_USE_SSE)
|
|
833
|
+
return UVec4(_mm_castps_si128(mValue));
|
|
834
|
+
#elif defined(JPH_USE_NEON)
|
|
835
|
+
return vreinterpretq_u32_f32(mValue);
|
|
836
|
+
#else
|
|
837
|
+
return *reinterpret_cast<const UVec4 *>(this);
|
|
838
|
+
#endif
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
int Vec4::GetSignBits() const
|
|
842
|
+
{
|
|
843
|
+
#if defined(JPH_USE_SSE)
|
|
844
|
+
return _mm_movemask_ps(mValue);
|
|
845
|
+
#elif defined(JPH_USE_NEON)
|
|
846
|
+
int32x4_t shift = JPH_NEON_INT32x4(0, 1, 2, 3);
|
|
847
|
+
return vaddvq_u32(vshlq_u32(vshrq_n_u32(vreinterpretq_u32_f32(mValue), 31), shift));
|
|
848
|
+
#else
|
|
849
|
+
return (std::signbit(mF32[0])? 1 : 0) | (std::signbit(mF32[1])? 2 : 0) | (std::signbit(mF32[2])? 4 : 0) | (std::signbit(mF32[3])? 8 : 0);
|
|
850
|
+
#endif
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
float Vec4::ReduceMin() const
|
|
854
|
+
{
|
|
855
|
+
Vec4 v = sMin(mValue, Swizzle<SWIZZLE_Y, SWIZZLE_UNUSED, SWIZZLE_W, SWIZZLE_UNUSED>());
|
|
856
|
+
v = sMin(v, v.Swizzle<SWIZZLE_Z, SWIZZLE_UNUSED, SWIZZLE_UNUSED, SWIZZLE_UNUSED>());
|
|
857
|
+
return v.GetX();
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
float Vec4::ReduceMax() const
|
|
861
|
+
{
|
|
862
|
+
Vec4 v = sMax(mValue, Swizzle<SWIZZLE_Y, SWIZZLE_UNUSED, SWIZZLE_W, SWIZZLE_UNUSED>());
|
|
863
|
+
v = sMax(v, v.Swizzle<SWIZZLE_Z, SWIZZLE_UNUSED, SWIZZLE_UNUSED, SWIZZLE_UNUSED>());
|
|
864
|
+
return v.GetX();
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
void Vec4::SinCos(Vec4 &outSin, Vec4 &outCos) const
|
|
868
|
+
{
|
|
869
|
+
// Implementation based on sinf.c from the cephes library, combines sinf and cosf in a single function, changes octants to quadrants and vectorizes it
|
|
870
|
+
// Original implementation by Stephen L. Moshier (See: http://www.moshier.net/)
|
|
871
|
+
|
|
872
|
+
// Make argument positive and remember sign for sin only since cos is symmetric around x (highest bit of a float is the sign bit)
|
|
873
|
+
UVec4 sin_sign = UVec4::sAnd(ReinterpretAsInt(), UVec4::sReplicate(0x80000000U));
|
|
874
|
+
Vec4 x = Vec4::sXor(*this, sin_sign.ReinterpretAsFloat());
|
|
875
|
+
|
|
876
|
+
// x / (PI / 2) rounded to nearest int gives us the quadrant closest to x
|
|
877
|
+
UVec4 quadrant = (0.6366197723675814f * x + Vec4::sReplicate(0.5f)).ToInt();
|
|
878
|
+
|
|
879
|
+
// Make x relative to the closest quadrant.
|
|
880
|
+
// This does x = x - quadrant * PI / 2 using a two step Cody-Waite argument reduction.
|
|
881
|
+
// This improves the accuracy of the result by avoiding loss of significant bits in the subtraction.
|
|
882
|
+
// We start with x = x - quadrant * PI / 2, PI / 2 in hexadecimal notation is 0x3fc90fdb, we remove the lowest 16 bits to
|
|
883
|
+
// get 0x3fc90000 (= 1.5703125) this means we can now multiply with a number of up to 2^16 without losing any bits.
|
|
884
|
+
// This leaves us with: x = (x - quadrant * 1.5703125) - quadrant * (PI / 2 - 1.5703125).
|
|
885
|
+
// PI / 2 - 1.5703125 in hexadecimal is 0x39fdaa22, stripping the lowest 12 bits we get 0x39fda000 (= 0.0004837512969970703125)
|
|
886
|
+
// This leaves uw with: x = ((x - quadrant * 1.5703125) - quadrant * 0.0004837512969970703125) - quadrant * (PI / 2 - 1.5703125 - 0.0004837512969970703125)
|
|
887
|
+
// See: https://stackoverflow.com/questions/42455143/sine-cosine-modular-extended-precision-arithmetic
|
|
888
|
+
// After this we have x in the range [-PI / 4, PI / 4].
|
|
889
|
+
Vec4 float_quadrant = quadrant.ToFloat();
|
|
890
|
+
x = ((x - float_quadrant * 1.5703125f) - float_quadrant * 0.0004837512969970703125f) - float_quadrant * 7.549789948768648e-8f;
|
|
891
|
+
|
|
892
|
+
// Calculate x2 = x^2
|
|
893
|
+
Vec4 x2 = x * x;
|
|
894
|
+
|
|
895
|
+
// Taylor expansion:
|
|
896
|
+
// Cos(x) = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8! + ... = (((x2/8!- 1/6!) * x2 + 1/4!) * x2 - 1/2!) * x2 + 1
|
|
897
|
+
Vec4 taylor_cos = ((2.443315711809948e-5f * x2 - Vec4::sReplicate(1.388731625493765e-3f)) * x2 + Vec4::sReplicate(4.166664568298827e-2f)) * x2 * x2 - 0.5f * x2 + Vec4::sOne();
|
|
898
|
+
// Sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ... = ((-x2/7! + 1/5!) * x2 - 1/3!) * x2 * x + x
|
|
899
|
+
Vec4 taylor_sin = ((-1.9515295891e-4f * x2 + Vec4::sReplicate(8.3321608736e-3f)) * x2 - Vec4::sReplicate(1.6666654611e-1f)) * x2 * x + x;
|
|
900
|
+
|
|
901
|
+
// The lowest 2 bits of quadrant indicate the quadrant that we are in.
|
|
902
|
+
// Let x be the original input value and x' our value that has been mapped to the range [-PI / 4, PI / 4].
|
|
903
|
+
// since cos(x) = sin(x - PI / 2) and since we want to use the Taylor expansion as close as possible to 0,
|
|
904
|
+
// we can alternate between using the Taylor expansion for sin and cos according to the following table:
|
|
905
|
+
//
|
|
906
|
+
// quadrant sin(x) cos(x)
|
|
907
|
+
// XXX00b sin(x') cos(x')
|
|
908
|
+
// XXX01b cos(x') -sin(x')
|
|
909
|
+
// XXX10b -sin(x') -cos(x')
|
|
910
|
+
// XXX11b -cos(x') sin(x')
|
|
911
|
+
//
|
|
912
|
+
// So: sin_sign = bit2, cos_sign = bit1 ^ bit2, bit1 determines if we use sin or cos Taylor expansion
|
|
913
|
+
UVec4 bit1 = quadrant.LogicalShiftLeft<31>();
|
|
914
|
+
UVec4 bit2 = UVec4::sAnd(quadrant.LogicalShiftLeft<30>(), UVec4::sReplicate(0x80000000U));
|
|
915
|
+
|
|
916
|
+
// Select which one of the results is sin and which one is cos
|
|
917
|
+
Vec4 s = Vec4::sSelect(taylor_sin, taylor_cos, bit1);
|
|
918
|
+
Vec4 c = Vec4::sSelect(taylor_cos, taylor_sin, bit1);
|
|
919
|
+
|
|
920
|
+
// Update the signs
|
|
921
|
+
sin_sign = UVec4::sXor(sin_sign, bit2);
|
|
922
|
+
UVec4 cos_sign = UVec4::sXor(bit1, bit2);
|
|
923
|
+
|
|
924
|
+
// Correct the signs
|
|
925
|
+
outSin = Vec4::sXor(s, sin_sign.ReinterpretAsFloat());
|
|
926
|
+
outCos = Vec4::sXor(c, cos_sign.ReinterpretAsFloat());
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
Vec4 Vec4::Tan() const
|
|
930
|
+
{
|
|
931
|
+
// Implementation based on tanf.c from the cephes library, see Vec4::SinCos for further details
|
|
932
|
+
// Original implementation by Stephen L. Moshier (See: http://www.moshier.net/)
|
|
933
|
+
|
|
934
|
+
// Make argument positive
|
|
935
|
+
UVec4 tan_sign = UVec4::sAnd(ReinterpretAsInt(), UVec4::sReplicate(0x80000000U));
|
|
936
|
+
Vec4 x = Vec4::sXor(*this, tan_sign.ReinterpretAsFloat());
|
|
937
|
+
|
|
938
|
+
// x / (PI / 2) rounded to nearest int gives us the quadrant closest to x
|
|
939
|
+
UVec4 quadrant = (0.6366197723675814f * x + Vec4::sReplicate(0.5f)).ToInt();
|
|
940
|
+
|
|
941
|
+
// Remap x to range [-PI / 4, PI / 4], see Vec4::SinCos
|
|
942
|
+
Vec4 float_quadrant = quadrant.ToFloat();
|
|
943
|
+
x = ((x - float_quadrant * 1.5703125f) - float_quadrant * 0.0004837512969970703125f) - float_quadrant * 7.549789948768648e-8f;
|
|
944
|
+
|
|
945
|
+
// Calculate x2 = x^2
|
|
946
|
+
Vec4 x2 = x * x;
|
|
947
|
+
|
|
948
|
+
// Roughly equivalent to the Taylor expansion:
|
|
949
|
+
// Tan(x) = x + x^3/3 + 2*x^5/15 + 17*x^7/315 + 62*x^9/2835 + ...
|
|
950
|
+
Vec4 tan =
|
|
951
|
+
(((((9.38540185543e-3f * x2 + Vec4::sReplicate(3.11992232697e-3f)) * x2 + Vec4::sReplicate(2.44301354525e-2f)) * x2
|
|
952
|
+
+ Vec4::sReplicate(5.34112807005e-2f)) * x2 + Vec4::sReplicate(1.33387994085e-1f)) * x2 + Vec4::sReplicate(3.33331568548e-1f)) * x2 * x + x;
|
|
953
|
+
|
|
954
|
+
// For the 2nd and 4th quadrant we need to invert the value
|
|
955
|
+
UVec4 bit1 = quadrant.LogicalShiftLeft<31>();
|
|
956
|
+
tan = Vec4::sSelect(tan, Vec4::sReplicate(-1.0f) / (tan JPH_IF_FLOATING_POINT_EXCEPTIONS_ENABLED(+ Vec4::sReplicate(FLT_MIN))), bit1); // Add small epsilon to prevent div by zero, works because tan is always positive
|
|
957
|
+
|
|
958
|
+
// Put the sign back
|
|
959
|
+
return Vec4::sXor(tan, tan_sign.ReinterpretAsFloat());
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
Vec4 Vec4::ASin() const
|
|
963
|
+
{
|
|
964
|
+
// Implementation based on asinf.c from the cephes library
|
|
965
|
+
// Original implementation by Stephen L. Moshier (See: http://www.moshier.net/)
|
|
966
|
+
|
|
967
|
+
// Make argument positive
|
|
968
|
+
UVec4 asin_sign = UVec4::sAnd(ReinterpretAsInt(), UVec4::sReplicate(0x80000000U));
|
|
969
|
+
Vec4 a = Vec4::sXor(*this, asin_sign.ReinterpretAsFloat());
|
|
970
|
+
|
|
971
|
+
// ASin is not defined outside the range [-1, 1] but it often happens that a value is slightly above 1 so we just clamp here
|
|
972
|
+
a = Vec4::sMin(a, Vec4::sOne());
|
|
973
|
+
|
|
974
|
+
// When |x| <= 0.5 we use the asin approximation as is
|
|
975
|
+
Vec4 z1 = a * a;
|
|
976
|
+
Vec4 x1 = a;
|
|
977
|
+
|
|
978
|
+
// When |x| > 0.5 we use the identity asin(x) = PI / 2 - 2 * asin(sqrt((1 - x) / 2))
|
|
979
|
+
Vec4 z2 = 0.5f * (Vec4::sOne() - a);
|
|
980
|
+
Vec4 x2 = z2.Sqrt();
|
|
981
|
+
|
|
982
|
+
// Select which of the two situations we have
|
|
983
|
+
UVec4 greater = Vec4::sGreater(a, Vec4::sReplicate(0.5f));
|
|
984
|
+
Vec4 z = Vec4::sSelect(z1, z2, greater);
|
|
985
|
+
Vec4 x = Vec4::sSelect(x1, x2, greater);
|
|
986
|
+
|
|
987
|
+
// Polynomial approximation of asin
|
|
988
|
+
z = ((((4.2163199048e-2f * z + Vec4::sReplicate(2.4181311049e-2f)) * z + Vec4::sReplicate(4.5470025998e-2f)) * z + Vec4::sReplicate(7.4953002686e-2f)) * z + Vec4::sReplicate(1.6666752422e-1f)) * z * x + x;
|
|
989
|
+
|
|
990
|
+
// If |x| > 0.5 we need to apply the remainder of the identity above
|
|
991
|
+
z = Vec4::sSelect(z, Vec4::sReplicate(0.5f * JPH_PI) - (z + z), greater);
|
|
992
|
+
|
|
993
|
+
// Put the sign back
|
|
994
|
+
return Vec4::sXor(z, asin_sign.ReinterpretAsFloat());
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
Vec4 Vec4::ACos() const
|
|
998
|
+
{
|
|
999
|
+
// Not the most accurate, but simple
|
|
1000
|
+
return Vec4::sReplicate(0.5f * JPH_PI) - ASin();
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
Vec4 Vec4::ATan() const
|
|
1004
|
+
{
|
|
1005
|
+
// Implementation based on atanf.c from the cephes library
|
|
1006
|
+
// Original implementation by Stephen L. Moshier (See: http://www.moshier.net/)
|
|
1007
|
+
|
|
1008
|
+
// Make argument positive
|
|
1009
|
+
UVec4 atan_sign = UVec4::sAnd(ReinterpretAsInt(), UVec4::sReplicate(0x80000000U));
|
|
1010
|
+
Vec4 x = Vec4::sXor(*this, atan_sign.ReinterpretAsFloat());
|
|
1011
|
+
Vec4 y = Vec4::sZero();
|
|
1012
|
+
|
|
1013
|
+
// If x > Tan(PI / 8)
|
|
1014
|
+
UVec4 greater1 = Vec4::sGreater(x, Vec4::sReplicate(0.4142135623730950f));
|
|
1015
|
+
Vec4 x1 = (x - Vec4::sOne()) / (x + Vec4::sOne());
|
|
1016
|
+
|
|
1017
|
+
// If x > Tan(3 * PI / 8)
|
|
1018
|
+
UVec4 greater2 = Vec4::sGreater(x, Vec4::sReplicate(2.414213562373095f));
|
|
1019
|
+
Vec4 x2 = Vec4::sReplicate(-1.0f) / (x JPH_IF_FLOATING_POINT_EXCEPTIONS_ENABLED(+ Vec4::sReplicate(FLT_MIN))); // Add small epsilon to prevent div by zero, works because x is always positive
|
|
1020
|
+
|
|
1021
|
+
// Apply first if
|
|
1022
|
+
x = Vec4::sSelect(x, x1, greater1);
|
|
1023
|
+
y = Vec4::sSelect(y, Vec4::sReplicate(0.25f * JPH_PI), greater1);
|
|
1024
|
+
|
|
1025
|
+
// Apply second if
|
|
1026
|
+
x = Vec4::sSelect(x, x2, greater2);
|
|
1027
|
+
y = Vec4::sSelect(y, Vec4::sReplicate(0.5f * JPH_PI), greater2);
|
|
1028
|
+
|
|
1029
|
+
// Polynomial approximation
|
|
1030
|
+
Vec4 z = x * x;
|
|
1031
|
+
y += (((8.05374449538e-2f * z - Vec4::sReplicate(1.38776856032e-1f)) * z + Vec4::sReplicate(1.99777106478e-1f)) * z - Vec4::sReplicate(3.33329491539e-1f)) * z * x + x;
|
|
1032
|
+
|
|
1033
|
+
// Put the sign back
|
|
1034
|
+
return Vec4::sXor(y, atan_sign.ReinterpretAsFloat());
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
Vec4 Vec4::sATan2(Vec4Arg inY, Vec4Arg inX)
|
|
1038
|
+
{
|
|
1039
|
+
UVec4 sign_mask = UVec4::sReplicate(0x80000000U);
|
|
1040
|
+
|
|
1041
|
+
// Determine absolute value and sign of y
|
|
1042
|
+
UVec4 y_sign = UVec4::sAnd(inY.ReinterpretAsInt(), sign_mask);
|
|
1043
|
+
Vec4 y_abs = Vec4::sXor(inY, y_sign.ReinterpretAsFloat());
|
|
1044
|
+
|
|
1045
|
+
// Determine absolute value and sign of x
|
|
1046
|
+
UVec4 x_sign = UVec4::sAnd(inX.ReinterpretAsInt(), sign_mask);
|
|
1047
|
+
Vec4 x_abs = Vec4::sXor(inX, x_sign.ReinterpretAsFloat());
|
|
1048
|
+
|
|
1049
|
+
// Always divide smallest / largest to avoid dividing by zero
|
|
1050
|
+
UVec4 x_is_numerator = Vec4::sLess(x_abs, y_abs);
|
|
1051
|
+
Vec4 numerator = Vec4::sSelect(y_abs, x_abs, x_is_numerator);
|
|
1052
|
+
Vec4 denominator = Vec4::sSelect(x_abs, y_abs, x_is_numerator);
|
|
1053
|
+
Vec4 atan = (numerator / denominator).ATan();
|
|
1054
|
+
|
|
1055
|
+
// If we calculated x / y instead of y / x the result is PI / 2 - result (note that this is true because we know the result is positive because the input was positive)
|
|
1056
|
+
atan = Vec4::sSelect(atan, Vec4::sReplicate(0.5f * JPH_PI) - atan, x_is_numerator);
|
|
1057
|
+
|
|
1058
|
+
// Now we need to map to the correct quadrant
|
|
1059
|
+
// x_sign y_sign result
|
|
1060
|
+
// +1 +1 atan
|
|
1061
|
+
// -1 +1 -atan + PI
|
|
1062
|
+
// -1 -1 atan - PI
|
|
1063
|
+
// +1 -1 -atan
|
|
1064
|
+
// This can be written as: x_sign * y_sign * (atan - (x_sign < 0? PI : 0))
|
|
1065
|
+
atan -= Vec4::sAnd(x_sign.ArithmeticShiftRight<31>().ReinterpretAsFloat(), Vec4::sReplicate(JPH_PI));
|
|
1066
|
+
atan = Vec4::sXor(atan, UVec4::sXor(x_sign, y_sign).ReinterpretAsFloat());
|
|
1067
|
+
return atan;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
uint32 Vec4::CompressUnitVector() const
|
|
1071
|
+
{
|
|
1072
|
+
constexpr float cOneOverSqrt2 = 0.70710678f;
|
|
1073
|
+
constexpr uint cNumBits = 9;
|
|
1074
|
+
constexpr uint cMask = (1 << cNumBits) - 1;
|
|
1075
|
+
constexpr uint cMaxValue = cMask - 1; // Need odd number of buckets to quantize to or else we can't encode 0
|
|
1076
|
+
constexpr float cScale = float(cMaxValue) / (2.0f * cOneOverSqrt2);
|
|
1077
|
+
|
|
1078
|
+
// Store sign bit
|
|
1079
|
+
Vec4 v = *this;
|
|
1080
|
+
uint32 max_element = v.Abs().GetHighestComponentIndex();
|
|
1081
|
+
uint32 value = 0;
|
|
1082
|
+
if (v[max_element] < 0.0f)
|
|
1083
|
+
{
|
|
1084
|
+
value = 0x80000000u;
|
|
1085
|
+
v = -v;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
// Store highest component
|
|
1089
|
+
value |= max_element << 29;
|
|
1090
|
+
|
|
1091
|
+
// Store the other three components in a compressed format
|
|
1092
|
+
UVec4 compressed = Vec4::sClamp((v + Vec4::sReplicate(cOneOverSqrt2)) * cScale + Vec4::sReplicate(0.5f), Vec4::sZero(), Vec4::sReplicate(cMaxValue)).ToInt();
|
|
1093
|
+
switch (max_element)
|
|
1094
|
+
{
|
|
1095
|
+
case 0:
|
|
1096
|
+
compressed = compressed.Swizzle<SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, SWIZZLE_UNUSED>();
|
|
1097
|
+
break;
|
|
1098
|
+
|
|
1099
|
+
case 1:
|
|
1100
|
+
compressed = compressed.Swizzle<SWIZZLE_X, SWIZZLE_Z, SWIZZLE_W, SWIZZLE_UNUSED>();
|
|
1101
|
+
break;
|
|
1102
|
+
|
|
1103
|
+
case 2:
|
|
1104
|
+
compressed = compressed.Swizzle<SWIZZLE_X, SWIZZLE_Y, SWIZZLE_W, SWIZZLE_UNUSED>();
|
|
1105
|
+
break;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
value |= compressed.GetX();
|
|
1109
|
+
value |= compressed.GetY() << cNumBits;
|
|
1110
|
+
value |= compressed.GetZ() << 2 * cNumBits;
|
|
1111
|
+
return value;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
Vec4 Vec4::sDecompressUnitVector(uint32 inValue)
|
|
1115
|
+
{
|
|
1116
|
+
constexpr float cOneOverSqrt2 = 0.70710678f;
|
|
1117
|
+
constexpr uint cNumBits = 9;
|
|
1118
|
+
constexpr uint cMask = (1u << cNumBits) - 1;
|
|
1119
|
+
constexpr uint cMaxValue = cMask - 1; // Need odd number of buckets to quantize to or else we can't encode 0
|
|
1120
|
+
constexpr float cScale = 2.0f * cOneOverSqrt2 / float(cMaxValue);
|
|
1121
|
+
|
|
1122
|
+
// Restore three components
|
|
1123
|
+
Vec4 v = Vec4(UVec4(inValue & cMask, (inValue >> cNumBits) & cMask, (inValue >> (2 * cNumBits)) & cMask, 0).ToFloat()) * cScale - Vec4(cOneOverSqrt2, cOneOverSqrt2, cOneOverSqrt2, 0.0f);
|
|
1124
|
+
JPH_ASSERT(v.GetW() == 0.0f);
|
|
1125
|
+
|
|
1126
|
+
// Restore the highest component
|
|
1127
|
+
v.SetW(sqrt(max(1.0f - v.LengthSq(), 0.0f)));
|
|
1128
|
+
|
|
1129
|
+
// Extract sign
|
|
1130
|
+
if ((inValue & 0x80000000u) != 0)
|
|
1131
|
+
v = -v;
|
|
1132
|
+
|
|
1133
|
+
// Swizzle the components in place
|
|
1134
|
+
switch ((inValue >> 29) & 3)
|
|
1135
|
+
{
|
|
1136
|
+
case 0:
|
|
1137
|
+
v = v.Swizzle<SWIZZLE_W, SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z>();
|
|
1138
|
+
break;
|
|
1139
|
+
|
|
1140
|
+
case 1:
|
|
1141
|
+
v = v.Swizzle<SWIZZLE_X, SWIZZLE_W, SWIZZLE_Y, SWIZZLE_Z>();
|
|
1142
|
+
break;
|
|
1143
|
+
|
|
1144
|
+
case 2:
|
|
1145
|
+
v = v.Swizzle<SWIZZLE_X, SWIZZLE_Y, SWIZZLE_W, SWIZZLE_Z>();
|
|
1146
|
+
break;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
return v;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
JPH_NAMESPACE_END
|