@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,1305 @@
|
|
|
1
|
+
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
|
|
2
|
+
// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
#include <Jolt/Jolt.h>
|
|
6
|
+
|
|
7
|
+
#include <Jolt/Physics/Collision/Shape/MeshShape.h>
|
|
8
|
+
#include <Jolt/Physics/Collision/Shape/ConvexShape.h>
|
|
9
|
+
#include <Jolt/Physics/Collision/Shape/ScaleHelpers.h>
|
|
10
|
+
#include <Jolt/Physics/Collision/Shape/SphereShape.h>
|
|
11
|
+
#include <Jolt/Physics/Collision/RayCast.h>
|
|
12
|
+
#include <Jolt/Physics/Collision/ShapeCast.h>
|
|
13
|
+
#include <Jolt/Physics/Collision/ShapeFilter.h>
|
|
14
|
+
#include <Jolt/Physics/Collision/CastResult.h>
|
|
15
|
+
#include <Jolt/Physics/Collision/CollideConvexVsTriangles.h>
|
|
16
|
+
#include <Jolt/Physics/Collision/CollideSphereVsTriangles.h>
|
|
17
|
+
#include <Jolt/Physics/Collision/CastConvexVsTriangles.h>
|
|
18
|
+
#include <Jolt/Physics/Collision/CastSphereVsTriangles.h>
|
|
19
|
+
#include <Jolt/Physics/Collision/TransformedShape.h>
|
|
20
|
+
#include <Jolt/Physics/Collision/ActiveEdges.h>
|
|
21
|
+
#include <Jolt/Physics/Collision/CollisionDispatch.h>
|
|
22
|
+
#include <Jolt/Physics/Collision/SortReverseAndStore.h>
|
|
23
|
+
#include <Jolt/Physics/Collision/CollideSoftBodyVerticesVsTriangles.h>
|
|
24
|
+
#include <Jolt/Core/StringTools.h>
|
|
25
|
+
#include <Jolt/Core/StreamIn.h>
|
|
26
|
+
#include <Jolt/Core/StreamOut.h>
|
|
27
|
+
#include <Jolt/Core/Profiler.h>
|
|
28
|
+
#include <Jolt/Core/UnorderedMap.h>
|
|
29
|
+
#include <Jolt/Geometry/AABox4.h>
|
|
30
|
+
#include <Jolt/Geometry/RayAABox.h>
|
|
31
|
+
#include <Jolt/Geometry/Indexify.h>
|
|
32
|
+
#include <Jolt/Geometry/Plane.h>
|
|
33
|
+
#include <Jolt/Geometry/OrientedBox.h>
|
|
34
|
+
#include <Jolt/TriangleSplitter/TriangleSplitterBinning.h>
|
|
35
|
+
#include <Jolt/TriangleSplitter/TriangleSplitterMean.h>
|
|
36
|
+
#include <Jolt/AABBTree/AABBTreeBuilder.h>
|
|
37
|
+
#include <Jolt/AABBTree/AABBTreeToBuffer.h>
|
|
38
|
+
#include <Jolt/AABBTree/TriangleCodec/TriangleCodecIndexed8BitPackSOA4Flags.h>
|
|
39
|
+
#include <Jolt/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h>
|
|
40
|
+
#include <Jolt/ObjectStream/TypeDeclarations.h>
|
|
41
|
+
|
|
42
|
+
JPH_NAMESPACE_BEGIN
|
|
43
|
+
|
|
44
|
+
#ifdef JPH_DEBUG_RENDERER
|
|
45
|
+
bool MeshShape::sDrawTriangleGroups = false;
|
|
46
|
+
bool MeshShape::sDrawTriangleOutlines = false;
|
|
47
|
+
#endif // JPH_DEBUG_RENDERER
|
|
48
|
+
|
|
49
|
+
JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL(MeshShapeSettings)
|
|
50
|
+
{
|
|
51
|
+
JPH_ADD_BASE_CLASS(MeshShapeSettings, ShapeSettings)
|
|
52
|
+
|
|
53
|
+
JPH_ADD_ATTRIBUTE(MeshShapeSettings, mTriangleVertices)
|
|
54
|
+
JPH_ADD_ATTRIBUTE(MeshShapeSettings, mIndexedTriangles)
|
|
55
|
+
JPH_ADD_ATTRIBUTE(MeshShapeSettings, mMaterials)
|
|
56
|
+
JPH_ADD_ATTRIBUTE(MeshShapeSettings, mMaxTrianglesPerLeaf)
|
|
57
|
+
JPH_ADD_ATTRIBUTE(MeshShapeSettings, mActiveEdgeCosThresholdAngle)
|
|
58
|
+
JPH_ADD_ATTRIBUTE(MeshShapeSettings, mPerTriangleUserData)
|
|
59
|
+
JPH_ADD_ENUM_ATTRIBUTE(MeshShapeSettings, mBuildQuality)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Codecs this mesh shape is using
|
|
63
|
+
using TriangleCodec = TriangleCodecIndexed8BitPackSOA4Flags;
|
|
64
|
+
using NodeCodec = NodeCodecQuadTreeHalfFloat;
|
|
65
|
+
|
|
66
|
+
// Get header for tree
|
|
67
|
+
static JPH_INLINE const NodeCodec::Header *sGetNodeHeader(const ByteBuffer &inTree)
|
|
68
|
+
{
|
|
69
|
+
return inTree.Get<NodeCodec::Header>(0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Get header for triangles
|
|
73
|
+
static JPH_INLINE const TriangleCodec::TriangleHeader *sGetTriangleHeader(const ByteBuffer &inTree)
|
|
74
|
+
{
|
|
75
|
+
return inTree.Get<TriangleCodec::TriangleHeader>(NodeCodec::HeaderSize);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
MeshShapeSettings::MeshShapeSettings(const TriangleList &inTriangles, PhysicsMaterialList inMaterials) :
|
|
79
|
+
mMaterials(std::move(inMaterials))
|
|
80
|
+
{
|
|
81
|
+
Indexify(inTriangles, mTriangleVertices, mIndexedTriangles);
|
|
82
|
+
|
|
83
|
+
Sanitize();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
MeshShapeSettings::MeshShapeSettings(VertexList inVertices, IndexedTriangleList inTriangles, PhysicsMaterialList inMaterials) :
|
|
87
|
+
mTriangleVertices(std::move(inVertices)),
|
|
88
|
+
mIndexedTriangles(std::move(inTriangles)),
|
|
89
|
+
mMaterials(std::move(inMaterials))
|
|
90
|
+
{
|
|
91
|
+
Sanitize();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
void MeshShapeSettings::Sanitize()
|
|
95
|
+
{
|
|
96
|
+
// Remove degenerate and duplicate triangles
|
|
97
|
+
UnorderedSet<IndexedTriangle> triangles;
|
|
98
|
+
triangles.reserve(UnorderedSet<IndexedTriangle>::size_type(mIndexedTriangles.size()));
|
|
99
|
+
TriangleCodec::ValidationContext validation_ctx(mIndexedTriangles, mTriangleVertices);
|
|
100
|
+
for (int t = (int)mIndexedTriangles.size() - 1; t >= 0; --t)
|
|
101
|
+
{
|
|
102
|
+
const IndexedTriangle &tri = mIndexedTriangles[t];
|
|
103
|
+
|
|
104
|
+
if (tri.IsDegenerate(mTriangleVertices) // Degenerate triangle
|
|
105
|
+
|| validation_ctx.IsDegenerate(tri) // Triangle is degenerate in the quantized space
|
|
106
|
+
|| !triangles.insert(tri.GetLowestIndexFirst()).second) // Duplicate triangle
|
|
107
|
+
{
|
|
108
|
+
// The order of triangles doesn't matter (gets reordered while building the tree), so we can just swap the last triangle into this slot
|
|
109
|
+
mIndexedTriangles[t] = mIndexedTriangles.back();
|
|
110
|
+
mIndexedTriangles.pop_back();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
ShapeSettings::ShapeResult MeshShapeSettings::Create() const
|
|
116
|
+
{
|
|
117
|
+
if (mCachedResult.IsEmpty())
|
|
118
|
+
Ref<Shape> shape = new MeshShape(*this, mCachedResult);
|
|
119
|
+
return mCachedResult;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
MeshShape::MeshShape(const MeshShapeSettings &inSettings, ShapeResult &outResult) :
|
|
123
|
+
Shape(EShapeType::Mesh, EShapeSubType::Mesh, inSettings, outResult)
|
|
124
|
+
{
|
|
125
|
+
// Check if there are any triangles
|
|
126
|
+
if (inSettings.mIndexedTriangles.empty())
|
|
127
|
+
{
|
|
128
|
+
outResult.SetError("Need triangles to create a mesh shape!");
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Check triangles
|
|
133
|
+
TriangleCodec::ValidationContext validation_ctx(inSettings.mIndexedTriangles, inSettings.mTriangleVertices);
|
|
134
|
+
for (int t = (int)inSettings.mIndexedTriangles.size() - 1; t >= 0; --t)
|
|
135
|
+
{
|
|
136
|
+
const IndexedTriangle &triangle = inSettings.mIndexedTriangles[t];
|
|
137
|
+
if (triangle.IsDegenerate(inSettings.mTriangleVertices)
|
|
138
|
+
|| validation_ctx.IsDegenerate(triangle))
|
|
139
|
+
{
|
|
140
|
+
outResult.SetError(StringFormat("Triangle %d is degenerate!", t));
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
else
|
|
144
|
+
{
|
|
145
|
+
// Check vertex indices
|
|
146
|
+
for (uint32 idx : triangle.mIdx)
|
|
147
|
+
if (idx >= inSettings.mTriangleVertices.size())
|
|
148
|
+
{
|
|
149
|
+
outResult.SetError(StringFormat("Vertex index %u is beyond vertex list (size: %u)", idx, (uint)inSettings.mTriangleVertices.size()));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Copy materials
|
|
156
|
+
mMaterials = inSettings.mMaterials;
|
|
157
|
+
if (!mMaterials.empty())
|
|
158
|
+
{
|
|
159
|
+
// Validate materials
|
|
160
|
+
if (mMaterials.size() > (1 << FLAGS_MATERIAL_BITS))
|
|
161
|
+
{
|
|
162
|
+
outResult.SetError(StringFormat("Supporting max %d materials per mesh", 1 << FLAGS_MATERIAL_BITS));
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
for (const IndexedTriangle &t : inSettings.mIndexedTriangles)
|
|
166
|
+
if (t.mMaterialIndex >= mMaterials.size())
|
|
167
|
+
{
|
|
168
|
+
outResult.SetError(StringFormat("Triangle material %u is beyond material list (size: %u)", t.mMaterialIndex, (uint)mMaterials.size()));
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
else
|
|
173
|
+
{
|
|
174
|
+
// No materials assigned, validate that all triangles use material index 0
|
|
175
|
+
for (const IndexedTriangle &t : inSettings.mIndexedTriangles)
|
|
176
|
+
if (t.mMaterialIndex != 0)
|
|
177
|
+
{
|
|
178
|
+
outResult.SetError("No materials present, all triangles should have material index 0");
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Check max triangles
|
|
184
|
+
if (inSettings.mMaxTrianglesPerLeaf < 1 || inSettings.mMaxTrianglesPerLeaf > MaxTrianglesPerLeaf)
|
|
185
|
+
{
|
|
186
|
+
outResult.SetError("Invalid max triangles per leaf");
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Fill in active edge bits
|
|
191
|
+
IndexedTriangleList indexed_triangles = inSettings.mIndexedTriangles; // Copy indices since we're adding the 'active edge' flag
|
|
192
|
+
sFindActiveEdges(inSettings, indexed_triangles);
|
|
193
|
+
|
|
194
|
+
// Create triangle splitter
|
|
195
|
+
union Storage
|
|
196
|
+
{
|
|
197
|
+
Storage() { }
|
|
198
|
+
~Storage() { }
|
|
199
|
+
|
|
200
|
+
TriangleSplitterBinning mBinning;
|
|
201
|
+
TriangleSplitterMean mMean;
|
|
202
|
+
};
|
|
203
|
+
Storage storage;
|
|
204
|
+
TriangleSplitter *splitter = nullptr;
|
|
205
|
+
switch (inSettings.mBuildQuality)
|
|
206
|
+
{
|
|
207
|
+
case MeshShapeSettings::EBuildQuality::FavorRuntimePerformance:
|
|
208
|
+
splitter = new (&storage.mBinning) TriangleSplitterBinning(inSettings.mTriangleVertices, indexed_triangles);
|
|
209
|
+
break;
|
|
210
|
+
|
|
211
|
+
case MeshShapeSettings::EBuildQuality::FavorBuildSpeed:
|
|
212
|
+
splitter = new (&storage.mMean) TriangleSplitterMean(inSettings.mTriangleVertices, indexed_triangles);
|
|
213
|
+
break;
|
|
214
|
+
|
|
215
|
+
default:
|
|
216
|
+
JPH_ASSERT(false);
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Build tree
|
|
221
|
+
AABBTreeBuilder builder(*splitter, inSettings.mMaxTrianglesPerLeaf);
|
|
222
|
+
AABBTreeBuilderStats builder_stats;
|
|
223
|
+
const AABBTreeBuilder::Node *root = builder.Build(builder_stats);
|
|
224
|
+
splitter->~TriangleSplitter();
|
|
225
|
+
|
|
226
|
+
// Convert to buffer
|
|
227
|
+
AABBTreeToBuffer<TriangleCodec, NodeCodec> buffer;
|
|
228
|
+
const char *error = nullptr;
|
|
229
|
+
if (!buffer.Convert(builder.GetTriangles(), builder.GetNodes(), inSettings.mTriangleVertices, root, inSettings.mPerTriangleUserData, error))
|
|
230
|
+
{
|
|
231
|
+
outResult.SetError(error);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Move data to this class
|
|
236
|
+
mTree.swap(buffer.GetBuffer());
|
|
237
|
+
|
|
238
|
+
// Check if we're not exceeding the amount of sub shape id bits
|
|
239
|
+
if (GetSubShapeIDBitsRecursive() > SubShapeID::MaxBits)
|
|
240
|
+
{
|
|
241
|
+
outResult.SetError("Mesh is too big and exceeds the amount of available sub shape ID bits");
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
outResult.Set(this);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
void MeshShape::sFindActiveEdges(const MeshShapeSettings &inSettings, IndexedTriangleList &ioIndices)
|
|
249
|
+
{
|
|
250
|
+
// Check if we're requested to make all edges active
|
|
251
|
+
if (inSettings.mActiveEdgeCosThresholdAngle < 0.0f)
|
|
252
|
+
{
|
|
253
|
+
for (IndexedTriangle &triangle : ioIndices)
|
|
254
|
+
triangle.mMaterialIndex |= 0b111 << FLAGS_ACTIVE_EGDE_SHIFT;
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// A struct to hold the two vertex indices of an edge
|
|
259
|
+
struct Edge
|
|
260
|
+
{
|
|
261
|
+
Edge(int inIdx1, int inIdx2) : mIdx1(min(inIdx1, inIdx2)), mIdx2(max(inIdx1, inIdx2)) { }
|
|
262
|
+
|
|
263
|
+
uint GetIndexInTriangle(const IndexedTriangle &inTriangle) const
|
|
264
|
+
{
|
|
265
|
+
for (uint edge_idx = 0; edge_idx < 3; ++edge_idx)
|
|
266
|
+
{
|
|
267
|
+
Edge edge(inTriangle.mIdx[edge_idx], inTriangle.mIdx[(edge_idx + 1) % 3]);
|
|
268
|
+
if (*this == edge)
|
|
269
|
+
return edge_idx;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
JPH_ASSERT(false);
|
|
273
|
+
return ~uint(0);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
bool operator == (const Edge &inRHS) const
|
|
277
|
+
{
|
|
278
|
+
return mIdx1 == inRHS.mIdx1 && mIdx2 == inRHS.mIdx2;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
uint64 GetHash() const
|
|
282
|
+
{
|
|
283
|
+
static_assert(sizeof(*this) == 2 * sizeof(int), "No padding expected");
|
|
284
|
+
return HashBytes(this, sizeof(*this));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
int mIdx1;
|
|
288
|
+
int mIdx2;
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// A struct to hold the triangles that are connected to an edge
|
|
292
|
+
struct TriangleIndices
|
|
293
|
+
{
|
|
294
|
+
uint mNumTriangles = 0;
|
|
295
|
+
uint mTriangleIndices[2];
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
// Build a list of edge to triangles
|
|
299
|
+
using EdgeToTriangle = UnorderedMap<Edge, TriangleIndices>;
|
|
300
|
+
EdgeToTriangle edge_to_triangle;
|
|
301
|
+
edge_to_triangle.reserve(EdgeToTriangle::size_type(ioIndices.size() * 3));
|
|
302
|
+
for (uint triangle_idx = 0; triangle_idx < ioIndices.size(); ++triangle_idx)
|
|
303
|
+
{
|
|
304
|
+
IndexedTriangle &triangle = ioIndices[triangle_idx];
|
|
305
|
+
for (uint edge_idx = 0; edge_idx < 3; ++edge_idx)
|
|
306
|
+
{
|
|
307
|
+
Edge edge(triangle.mIdx[edge_idx], triangle.mIdx[(edge_idx + 1) % 3]);
|
|
308
|
+
EdgeToTriangle::iterator edge_to_triangle_it = edge_to_triangle.try_emplace(edge, TriangleIndices()).first;
|
|
309
|
+
TriangleIndices &indices = edge_to_triangle_it->second;
|
|
310
|
+
if (indices.mNumTriangles < 2)
|
|
311
|
+
{
|
|
312
|
+
// Store index of triangle that connects to this edge
|
|
313
|
+
indices.mTriangleIndices[indices.mNumTriangles] = triangle_idx;
|
|
314
|
+
indices.mNumTriangles++;
|
|
315
|
+
}
|
|
316
|
+
else
|
|
317
|
+
{
|
|
318
|
+
// 3 or more triangles share an edge, mark this edge as active
|
|
319
|
+
uint32 mask = 1 << (edge_idx + FLAGS_ACTIVE_EGDE_SHIFT);
|
|
320
|
+
JPH_ASSERT((triangle.mMaterialIndex & mask) == 0);
|
|
321
|
+
triangle.mMaterialIndex |= mask;
|
|
322
|
+
indices.mNumTriangles = 3; // Indicate that we have 3 or more triangles
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// Walk over all edges and determine which ones are active
|
|
328
|
+
for (const EdgeToTriangle::value_type &edge : edge_to_triangle)
|
|
329
|
+
{
|
|
330
|
+
uint num_active = 0;
|
|
331
|
+
if (edge.second.mNumTriangles == 1)
|
|
332
|
+
{
|
|
333
|
+
// Edge is not shared, it is an active edge
|
|
334
|
+
num_active = 1;
|
|
335
|
+
}
|
|
336
|
+
else if (edge.second.mNumTriangles == 2)
|
|
337
|
+
{
|
|
338
|
+
// Simple shared edge, determine if edge is active based on the two adjacent triangles
|
|
339
|
+
const IndexedTriangle &triangle1 = ioIndices[edge.second.mTriangleIndices[0]];
|
|
340
|
+
const IndexedTriangle &triangle2 = ioIndices[edge.second.mTriangleIndices[1]];
|
|
341
|
+
|
|
342
|
+
// Find which edge this is for both triangles
|
|
343
|
+
uint edge_idx1 = edge.first.GetIndexInTriangle(triangle1);
|
|
344
|
+
uint edge_idx2 = edge.first.GetIndexInTriangle(triangle2);
|
|
345
|
+
|
|
346
|
+
// Construct a plane for triangle 1 (e1 = edge vertex 1, e2 = edge vertex 2, op = opposing vertex)
|
|
347
|
+
Vec3 triangle1_e1 = Vec3(inSettings.mTriangleVertices[triangle1.mIdx[edge_idx1]]);
|
|
348
|
+
Vec3 triangle1_e2 = Vec3(inSettings.mTriangleVertices[triangle1.mIdx[(edge_idx1 + 1) % 3]]);
|
|
349
|
+
Vec3 triangle1_op = Vec3(inSettings.mTriangleVertices[triangle1.mIdx[(edge_idx1 + 2) % 3]]);
|
|
350
|
+
Plane triangle1_plane = Plane::sFromPointsCCW(triangle1_e1, triangle1_e2, triangle1_op);
|
|
351
|
+
|
|
352
|
+
// Construct a plane for triangle 2
|
|
353
|
+
Vec3 triangle2_e1 = Vec3(inSettings.mTriangleVertices[triangle2.mIdx[edge_idx2]]);
|
|
354
|
+
Vec3 triangle2_e2 = Vec3(inSettings.mTriangleVertices[triangle2.mIdx[(edge_idx2 + 1) % 3]]);
|
|
355
|
+
Vec3 triangle2_op = Vec3(inSettings.mTriangleVertices[triangle2.mIdx[(edge_idx2 + 2) % 3]]);
|
|
356
|
+
Plane triangle2_plane = Plane::sFromPointsCCW(triangle2_e1, triangle2_e2, triangle2_op);
|
|
357
|
+
|
|
358
|
+
// Determine if the edge is active
|
|
359
|
+
num_active = ActiveEdges::IsEdgeActive(triangle1_plane.GetNormal(), triangle2_plane.GetNormal(), triangle1_e2 - triangle1_e1, inSettings.mActiveEdgeCosThresholdAngle)? 2 : 0;
|
|
360
|
+
}
|
|
361
|
+
else
|
|
362
|
+
{
|
|
363
|
+
// More edges incoming, we've already marked all edges beyond the 2nd as active
|
|
364
|
+
num_active = 2;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// Mark edges of all original triangles active
|
|
368
|
+
for (uint i = 0; i < num_active; ++i)
|
|
369
|
+
{
|
|
370
|
+
uint triangle_idx = edge.second.mTriangleIndices[i];
|
|
371
|
+
IndexedTriangle &triangle = ioIndices[triangle_idx];
|
|
372
|
+
uint edge_idx = edge.first.GetIndexInTriangle(triangle);
|
|
373
|
+
uint32 mask = 1 << (edge_idx + FLAGS_ACTIVE_EGDE_SHIFT);
|
|
374
|
+
JPH_ASSERT((triangle.mMaterialIndex & mask) == 0);
|
|
375
|
+
triangle.mMaterialIndex |= mask;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
MassProperties MeshShape::GetMassProperties() const
|
|
381
|
+
{
|
|
382
|
+
// We cannot calculate the volume for an arbitrary mesh, so we return invalid mass properties.
|
|
383
|
+
// If you want your mesh to be dynamic, then you should provide the mass properties yourself when
|
|
384
|
+
// creating a Body:
|
|
385
|
+
//
|
|
386
|
+
// BodyCreationSettings::mOverrideMassProperties = EOverrideMassProperties::MassAndInertiaProvided;
|
|
387
|
+
// BodyCreationSettings::mMassPropertiesOverride.SetMassAndInertiaOfSolidBox(Vec3::sOne(), 1000.0f);
|
|
388
|
+
//
|
|
389
|
+
// Note that for a mesh shape to simulate properly, it is best if the mesh is manifold
|
|
390
|
+
// (i.e. closed, all edges shared by only two triangles, consistent winding order).
|
|
391
|
+
return MassProperties();
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
void MeshShape::DecodeSubShapeID(const SubShapeID &inSubShapeID, const void *&outTriangleBlock, uint32 &outTriangleIndex) const
|
|
395
|
+
{
|
|
396
|
+
// Get block
|
|
397
|
+
SubShapeID triangle_idx_subshape_id;
|
|
398
|
+
uint32 block_id = inSubShapeID.PopID(NodeCodec::DecodingContext::sTriangleBlockIDBits(sGetNodeHeader(mTree)), triangle_idx_subshape_id);
|
|
399
|
+
outTriangleBlock = NodeCodec::DecodingContext::sGetTriangleBlockStart(&mTree[0], block_id);
|
|
400
|
+
|
|
401
|
+
// Fetch the triangle index
|
|
402
|
+
SubShapeID remainder;
|
|
403
|
+
outTriangleIndex = triangle_idx_subshape_id.PopID(NumTriangleBits, remainder);
|
|
404
|
+
JPH_ASSERT(remainder.IsEmpty(), "Invalid subshape ID");
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
uint MeshShape::GetMaterialIndex(const SubShapeID &inSubShapeID) const
|
|
408
|
+
{
|
|
409
|
+
// Decode ID
|
|
410
|
+
const void *block_start;
|
|
411
|
+
uint32 triangle_idx;
|
|
412
|
+
DecodeSubShapeID(inSubShapeID, block_start, triangle_idx);
|
|
413
|
+
|
|
414
|
+
// Fetch the flags
|
|
415
|
+
uint8 flags = TriangleCodec::DecodingContext::sGetFlags(block_start, triangle_idx);
|
|
416
|
+
return flags & FLAGS_MATERIAL_MASK;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const PhysicsMaterial *MeshShape::GetMaterial(const SubShapeID &inSubShapeID) const
|
|
420
|
+
{
|
|
421
|
+
// Return the default material if there are no materials on this shape
|
|
422
|
+
if (mMaterials.empty())
|
|
423
|
+
return PhysicsMaterial::sDefault;
|
|
424
|
+
|
|
425
|
+
return mMaterials[GetMaterialIndex(inSubShapeID)];
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
Vec3 MeshShape::GetSurfaceNormal(const SubShapeID &inSubShapeID, Vec3Arg inLocalSurfacePosition) const
|
|
429
|
+
{
|
|
430
|
+
// Decode ID
|
|
431
|
+
const void *block_start;
|
|
432
|
+
uint32 triangle_idx;
|
|
433
|
+
DecodeSubShapeID(inSubShapeID, block_start, triangle_idx);
|
|
434
|
+
|
|
435
|
+
// Decode triangle
|
|
436
|
+
Vec3 v1, v2, v3;
|
|
437
|
+
const TriangleCodec::DecodingContext triangle_ctx(sGetTriangleHeader(mTree));
|
|
438
|
+
triangle_ctx.GetTriangle(block_start, triangle_idx, v1, v2, v3);
|
|
439
|
+
|
|
440
|
+
// Calculate normal
|
|
441
|
+
return (v3 - v2).Cross(v1 - v2).Normalized();
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
void MeshShape::GetSupportingFace(const SubShapeID &inSubShapeID, Vec3Arg inDirection, Vec3Arg inScale, Mat44Arg inCenterOfMassTransform, SupportingFace &outVertices) const
|
|
445
|
+
{
|
|
446
|
+
// Decode ID
|
|
447
|
+
const void *block_start;
|
|
448
|
+
uint32 triangle_idx;
|
|
449
|
+
DecodeSubShapeID(inSubShapeID, block_start, triangle_idx);
|
|
450
|
+
|
|
451
|
+
// Decode triangle
|
|
452
|
+
const TriangleCodec::DecodingContext triangle_ctx(sGetTriangleHeader(mTree));
|
|
453
|
+
outVertices.resize(3);
|
|
454
|
+
triangle_ctx.GetTriangle(block_start, triangle_idx, outVertices[0], outVertices[1], outVertices[2]);
|
|
455
|
+
|
|
456
|
+
// Flip triangle if scaled inside out
|
|
457
|
+
if (ScaleHelpers::IsInsideOut(inScale))
|
|
458
|
+
std::swap(outVertices[1], outVertices[2]);
|
|
459
|
+
|
|
460
|
+
// Calculate transform with scale
|
|
461
|
+
Mat44 transform = inCenterOfMassTransform.PreScaled(inScale);
|
|
462
|
+
|
|
463
|
+
// Transform to world space
|
|
464
|
+
for (Vec3 &v : outVertices)
|
|
465
|
+
v = transform * v;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
AABox MeshShape::GetLocalBounds() const
|
|
469
|
+
{
|
|
470
|
+
const NodeCodec::Header *header = sGetNodeHeader(mTree);
|
|
471
|
+
return AABox(Vec3::sLoadFloat3Unsafe(header->mRootBoundsMin), Vec3::sLoadFloat3Unsafe(header->mRootBoundsMax));
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
uint MeshShape::GetSubShapeIDBitsRecursive() const
|
|
475
|
+
{
|
|
476
|
+
return NodeCodec::DecodingContext::sTriangleBlockIDBits(sGetNodeHeader(mTree)) + NumTriangleBits;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
template <class Visitor>
|
|
480
|
+
JPH_INLINE void MeshShape::WalkTree(Visitor &ioVisitor) const
|
|
481
|
+
{
|
|
482
|
+
const NodeCodec::Header *header = sGetNodeHeader(mTree);
|
|
483
|
+
NodeCodec::DecodingContext node_ctx(header);
|
|
484
|
+
|
|
485
|
+
const TriangleCodec::DecodingContext triangle_ctx(sGetTriangleHeader(mTree));
|
|
486
|
+
const uint8 *buffer_start = &mTree[0];
|
|
487
|
+
node_ctx.WalkTree(buffer_start, triangle_ctx, ioVisitor);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
template <class Visitor>
|
|
491
|
+
JPH_INLINE void MeshShape::WalkTreePerTriangle(const SubShapeIDCreator &inSubShapeIDCreator2, Visitor &ioVisitor) const
|
|
492
|
+
{
|
|
493
|
+
struct ChainedVisitor
|
|
494
|
+
{
|
|
495
|
+
JPH_INLINE ChainedVisitor(Visitor &ioVisitor, const SubShapeIDCreator &inSubShapeIDCreator2, uint inTriangleBlockIDBits) :
|
|
496
|
+
mVisitor(ioVisitor),
|
|
497
|
+
mSubShapeIDCreator2(inSubShapeIDCreator2),
|
|
498
|
+
mTriangleBlockIDBits(inTriangleBlockIDBits)
|
|
499
|
+
{
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
JPH_INLINE bool ShouldAbort() const
|
|
503
|
+
{
|
|
504
|
+
return mVisitor.ShouldAbort();
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
JPH_INLINE bool ShouldVisitNode(int inStackTop) const
|
|
508
|
+
{
|
|
509
|
+
return mVisitor.ShouldVisitNode(inStackTop);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
|
|
513
|
+
{
|
|
514
|
+
return mVisitor.VisitNodes(inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, ioProperties, inStackTop);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
JPH_INLINE void VisitTriangles(const TriangleCodec::DecodingContext &ioContext, const void *inTriangles, int inNumTriangles, uint32 inTriangleBlockID)
|
|
518
|
+
{
|
|
519
|
+
// Create ID for triangle block
|
|
520
|
+
SubShapeIDCreator block_sub_shape_id = mSubShapeIDCreator2.PushID(inTriangleBlockID, mTriangleBlockIDBits);
|
|
521
|
+
|
|
522
|
+
// Decode vertices and flags
|
|
523
|
+
JPH_ASSERT(inNumTriangles <= MaxTrianglesPerLeaf);
|
|
524
|
+
Vec3 vertices[MaxTrianglesPerLeaf * 3];
|
|
525
|
+
uint8 flags[MaxTrianglesPerLeaf];
|
|
526
|
+
ioContext.Unpack(inTriangles, inNumTriangles, vertices, flags);
|
|
527
|
+
|
|
528
|
+
int triangle_idx = 0;
|
|
529
|
+
for (const Vec3 *v = vertices, *v_end = vertices + inNumTriangles * 3; v < v_end; v += 3, triangle_idx++)
|
|
530
|
+
{
|
|
531
|
+
// Determine active edges
|
|
532
|
+
uint8 active_edges = (flags[triangle_idx] >> FLAGS_ACTIVE_EGDE_SHIFT) & FLAGS_ACTIVE_EDGE_MASK;
|
|
533
|
+
|
|
534
|
+
// Create ID for triangle
|
|
535
|
+
SubShapeIDCreator triangle_sub_shape_id = block_sub_shape_id.PushID(triangle_idx, NumTriangleBits);
|
|
536
|
+
|
|
537
|
+
mVisitor.VisitTriangle(v[0], v[1], v[2], active_edges, triangle_sub_shape_id.GetID());
|
|
538
|
+
|
|
539
|
+
// Check if we should early out now
|
|
540
|
+
if (mVisitor.ShouldAbort())
|
|
541
|
+
break;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
Visitor & mVisitor;
|
|
546
|
+
SubShapeIDCreator mSubShapeIDCreator2;
|
|
547
|
+
uint mTriangleBlockIDBits;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
ChainedVisitor visitor(ioVisitor, inSubShapeIDCreator2, NodeCodec::DecodingContext::sTriangleBlockIDBits(sGetNodeHeader(mTree)));
|
|
551
|
+
WalkTree(visitor);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
#ifdef JPH_DEBUG_RENDERER
|
|
555
|
+
void MeshShape::Draw(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, Vec3Arg inScale, ColorArg inColor, bool inUseMaterialColors, bool inDrawWireframe) const
|
|
556
|
+
{
|
|
557
|
+
// Reset the batch if we switch coloring mode
|
|
558
|
+
if (mCachedTrianglesColoredPerGroup != sDrawTriangleGroups || mCachedUseMaterialColors != inUseMaterialColors)
|
|
559
|
+
{
|
|
560
|
+
mGeometry = nullptr;
|
|
561
|
+
mCachedTrianglesColoredPerGroup = sDrawTriangleGroups;
|
|
562
|
+
mCachedUseMaterialColors = inUseMaterialColors;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
if (mGeometry == nullptr)
|
|
566
|
+
{
|
|
567
|
+
struct Visitor
|
|
568
|
+
{
|
|
569
|
+
JPH_INLINE bool ShouldAbort() const
|
|
570
|
+
{
|
|
571
|
+
return false;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
JPH_INLINE bool ShouldVisitNode(int inStackTop) const
|
|
575
|
+
{
|
|
576
|
+
return true;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
|
|
580
|
+
{
|
|
581
|
+
UVec4 valid = UVec4::sOr(UVec4::sOr(Vec4::sLess(inBoundsMinX, inBoundsMaxX), Vec4::sLess(inBoundsMinY, inBoundsMaxY)), Vec4::sLess(inBoundsMinZ, inBoundsMaxZ));
|
|
582
|
+
return CountAndSortTrues(valid, ioProperties);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
JPH_INLINE void VisitTriangles(const TriangleCodec::DecodingContext &ioContext, const void *inTriangles, int inNumTriangles, [[maybe_unused]] uint32 inTriangleBlockID)
|
|
586
|
+
{
|
|
587
|
+
JPH_ASSERT(inNumTriangles <= MaxTrianglesPerLeaf);
|
|
588
|
+
Vec3 vertices[MaxTrianglesPerLeaf * 3];
|
|
589
|
+
ioContext.Unpack(inTriangles, inNumTriangles, vertices);
|
|
590
|
+
|
|
591
|
+
if (mDrawTriangleGroups || !mUseMaterialColors || mMaterials.empty())
|
|
592
|
+
{
|
|
593
|
+
// Single color for mesh
|
|
594
|
+
Color color = mDrawTriangleGroups? Color::sGetDistinctColor(mColorIdx++) : (mUseMaterialColors? PhysicsMaterial::sDefault->GetDebugColor() : Color::sWhite);
|
|
595
|
+
for (const Vec3 *v = vertices, *v_end = vertices + inNumTriangles * 3; v < v_end; v += 3)
|
|
596
|
+
mTriangles.push_back({ v[0], v[1], v[2], color });
|
|
597
|
+
}
|
|
598
|
+
else
|
|
599
|
+
{
|
|
600
|
+
// Per triangle color
|
|
601
|
+
uint8 flags[MaxTrianglesPerLeaf];
|
|
602
|
+
TriangleCodec::DecodingContext::sGetFlags(inTriangles, inNumTriangles, flags);
|
|
603
|
+
|
|
604
|
+
const uint8 *f = flags;
|
|
605
|
+
for (const Vec3 *v = vertices, *v_end = vertices + inNumTriangles * 3; v < v_end; v += 3, f++)
|
|
606
|
+
mTriangles.push_back({ v[0], v[1], v[2], mMaterials[*f & FLAGS_MATERIAL_MASK]->GetDebugColor() });
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
Array<DebugRenderer::Triangle> & mTriangles;
|
|
611
|
+
const PhysicsMaterialList & mMaterials;
|
|
612
|
+
bool mUseMaterialColors;
|
|
613
|
+
bool mDrawTriangleGroups;
|
|
614
|
+
int mColorIdx = 0;
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
Array<DebugRenderer::Triangle> triangles;
|
|
618
|
+
Visitor visitor { triangles, mMaterials, mCachedUseMaterialColors, mCachedTrianglesColoredPerGroup };
|
|
619
|
+
WalkTree(visitor);
|
|
620
|
+
mGeometry = new DebugRenderer::Geometry(inRenderer->CreateTriangleBatch(triangles), GetLocalBounds());
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// Test if the shape is scaled inside out
|
|
624
|
+
DebugRenderer::ECullMode cull_mode = ScaleHelpers::IsInsideOut(inScale)? DebugRenderer::ECullMode::CullFrontFace : DebugRenderer::ECullMode::CullBackFace;
|
|
625
|
+
|
|
626
|
+
// Determine the draw mode
|
|
627
|
+
DebugRenderer::EDrawMode draw_mode = inDrawWireframe? DebugRenderer::EDrawMode::Wireframe : DebugRenderer::EDrawMode::Solid;
|
|
628
|
+
|
|
629
|
+
// Draw the geometry
|
|
630
|
+
inRenderer->DrawGeometry(inCenterOfMassTransform * Mat44::sScale(inScale), inColor, mGeometry, cull_mode, DebugRenderer::ECastShadow::On, draw_mode);
|
|
631
|
+
|
|
632
|
+
if (sDrawTriangleOutlines)
|
|
633
|
+
{
|
|
634
|
+
struct Visitor
|
|
635
|
+
{
|
|
636
|
+
JPH_INLINE Visitor(DebugRenderer *inRenderer, RMat44Arg inTransform) :
|
|
637
|
+
mRenderer(inRenderer),
|
|
638
|
+
mTransform(inTransform)
|
|
639
|
+
{
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
JPH_INLINE bool ShouldAbort() const
|
|
643
|
+
{
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
JPH_INLINE bool ShouldVisitNode(int inStackTop) const
|
|
648
|
+
{
|
|
649
|
+
return true;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
|
|
653
|
+
{
|
|
654
|
+
UVec4 valid = UVec4::sOr(UVec4::sOr(Vec4::sLess(inBoundsMinX, inBoundsMaxX), Vec4::sLess(inBoundsMinY, inBoundsMaxY)), Vec4::sLess(inBoundsMinZ, inBoundsMaxZ));
|
|
655
|
+
return CountAndSortTrues(valid, ioProperties);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
JPH_INLINE void VisitTriangles(const TriangleCodec::DecodingContext &ioContext, const void *inTriangles, int inNumTriangles, uint32 inTriangleBlockID)
|
|
659
|
+
{
|
|
660
|
+
// Decode vertices and flags
|
|
661
|
+
JPH_ASSERT(inNumTriangles <= MaxTrianglesPerLeaf);
|
|
662
|
+
Vec3 vertices[MaxTrianglesPerLeaf * 3];
|
|
663
|
+
uint8 flags[MaxTrianglesPerLeaf];
|
|
664
|
+
ioContext.Unpack(inTriangles, inNumTriangles, vertices, flags);
|
|
665
|
+
|
|
666
|
+
// Loop through triangles
|
|
667
|
+
const uint8 *f = flags;
|
|
668
|
+
for (Vec3 *v = vertices, *v_end = vertices + inNumTriangles * 3; v < v_end; v += 3, ++f)
|
|
669
|
+
{
|
|
670
|
+
// Loop through edges
|
|
671
|
+
for (uint edge_idx = 0; edge_idx < 3; ++edge_idx)
|
|
672
|
+
{
|
|
673
|
+
RVec3 v1 = mTransform * v[edge_idx];
|
|
674
|
+
RVec3 v2 = mTransform * v[(edge_idx + 1) % 3];
|
|
675
|
+
|
|
676
|
+
// Draw active edge as a green arrow, other edges as grey
|
|
677
|
+
if (*f & (1 << (edge_idx + FLAGS_ACTIVE_EGDE_SHIFT)))
|
|
678
|
+
mRenderer->DrawArrow(v1, v2, Color::sGreen, 0.01f);
|
|
679
|
+
else
|
|
680
|
+
mRenderer->DrawLine(v1, v2, Color::sGrey);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
DebugRenderer * mRenderer;
|
|
686
|
+
RMat44 mTransform;
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
Visitor visitor { inRenderer, inCenterOfMassTransform.PreScaled(inScale) };
|
|
690
|
+
WalkTree(visitor);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
#endif // JPH_DEBUG_RENDERER
|
|
694
|
+
|
|
695
|
+
bool MeshShape::CastRay(const RayCast &inRay, const SubShapeIDCreator &inSubShapeIDCreator, RayCastResult &ioHit) const
|
|
696
|
+
{
|
|
697
|
+
JPH_PROFILE_FUNCTION();
|
|
698
|
+
|
|
699
|
+
struct Visitor
|
|
700
|
+
{
|
|
701
|
+
JPH_INLINE explicit Visitor(RayCastResult &ioHit) :
|
|
702
|
+
mHit(ioHit)
|
|
703
|
+
{
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
JPH_INLINE bool ShouldAbort() const
|
|
707
|
+
{
|
|
708
|
+
return mHit.mFraction <= 0.0f;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
JPH_INLINE bool ShouldVisitNode(int inStackTop) const
|
|
712
|
+
{
|
|
713
|
+
return mDistanceStack[inStackTop] < mHit.mFraction;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
|
|
717
|
+
{
|
|
718
|
+
// Test bounds of 4 children
|
|
719
|
+
Vec4 distance = RayAABox4(mRayOrigin, mRayInvDirection, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ);
|
|
720
|
+
|
|
721
|
+
// Sort so that highest values are first (we want to first process closer hits and we process stack top to bottom)
|
|
722
|
+
return SortReverseAndStore(distance, mHit.mFraction, ioProperties, &mDistanceStack[inStackTop]);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
JPH_INLINE void VisitTriangles(const TriangleCodec::DecodingContext &ioContext, const void *inTriangles, int inNumTriangles, uint32 inTriangleBlockID)
|
|
726
|
+
{
|
|
727
|
+
// Test against triangles
|
|
728
|
+
uint32 triangle_idx;
|
|
729
|
+
float fraction = ioContext.TestRay(mRayOrigin, mRayDirection, inTriangles, inNumTriangles, mHit.mFraction, triangle_idx);
|
|
730
|
+
if (fraction < mHit.mFraction)
|
|
731
|
+
{
|
|
732
|
+
mHit.mFraction = fraction;
|
|
733
|
+
mHit.mSubShapeID2 = mSubShapeIDCreator.PushID(inTriangleBlockID, mTriangleBlockIDBits).PushID(triangle_idx, NumTriangleBits).GetID();
|
|
734
|
+
mReturnValue = true;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
RayCastResult & mHit;
|
|
739
|
+
Vec3 mRayOrigin;
|
|
740
|
+
Vec3 mRayDirection;
|
|
741
|
+
RayInvDirection mRayInvDirection;
|
|
742
|
+
uint mTriangleBlockIDBits;
|
|
743
|
+
SubShapeIDCreator mSubShapeIDCreator;
|
|
744
|
+
bool mReturnValue = false;
|
|
745
|
+
float mDistanceStack[NodeCodec::StackSize];
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
Visitor visitor(ioHit);
|
|
749
|
+
visitor.mRayOrigin = inRay.mOrigin;
|
|
750
|
+
visitor.mRayDirection = inRay.mDirection;
|
|
751
|
+
visitor.mRayInvDirection.Set(inRay.mDirection);
|
|
752
|
+
visitor.mTriangleBlockIDBits = NodeCodec::DecodingContext::sTriangleBlockIDBits(sGetNodeHeader(mTree));
|
|
753
|
+
visitor.mSubShapeIDCreator = inSubShapeIDCreator;
|
|
754
|
+
WalkTree(visitor);
|
|
755
|
+
|
|
756
|
+
return visitor.mReturnValue;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
void MeshShape::CastRay(const RayCast &inRay, const RayCastSettings &inRayCastSettings, const SubShapeIDCreator &inSubShapeIDCreator, CastRayCollector &ioCollector, const ShapeFilter &inShapeFilter) const
|
|
760
|
+
{
|
|
761
|
+
JPH_PROFILE_FUNCTION();
|
|
762
|
+
|
|
763
|
+
// Test shape filter
|
|
764
|
+
if (!inShapeFilter.ShouldCollide(this, inSubShapeIDCreator.GetID()))
|
|
765
|
+
return;
|
|
766
|
+
|
|
767
|
+
struct Visitor
|
|
768
|
+
{
|
|
769
|
+
JPH_INLINE explicit Visitor(CastRayCollector &ioCollector) :
|
|
770
|
+
mCollector(ioCollector)
|
|
771
|
+
{
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
JPH_INLINE bool ShouldAbort() const
|
|
775
|
+
{
|
|
776
|
+
return mCollector.ShouldEarlyOut();
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
JPH_INLINE bool ShouldVisitNode(int inStackTop) const
|
|
780
|
+
{
|
|
781
|
+
return mDistanceStack[inStackTop] < mCollector.GetEarlyOutFraction();
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
|
|
785
|
+
{
|
|
786
|
+
// Test bounds of 4 children
|
|
787
|
+
Vec4 distance = RayAABox4(mRayOrigin, mRayInvDirection, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ);
|
|
788
|
+
|
|
789
|
+
// Sort so that highest values are first (we want to first process closer hits and we process stack top to bottom)
|
|
790
|
+
return SortReverseAndStore(distance, mCollector.GetEarlyOutFraction(), ioProperties, &mDistanceStack[inStackTop]);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
JPH_INLINE void VisitTriangle(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, [[maybe_unused]] uint8 inActiveEdges, SubShapeID inSubShapeID2)
|
|
794
|
+
{
|
|
795
|
+
// Back facing check
|
|
796
|
+
if (mBackFaceMode == EBackFaceMode::IgnoreBackFaces && (inV2 - inV0).Cross(inV1 - inV0).Dot(mRayDirection) < 0)
|
|
797
|
+
return;
|
|
798
|
+
|
|
799
|
+
// Check the triangle
|
|
800
|
+
float fraction = RayTriangle(mRayOrigin, mRayDirection, inV0, inV1, inV2);
|
|
801
|
+
if (fraction < mCollector.GetEarlyOutFraction())
|
|
802
|
+
{
|
|
803
|
+
RayCastResult hit;
|
|
804
|
+
hit.mBodyID = TransformedShape::sGetBodyID(mCollector.GetContext());
|
|
805
|
+
hit.mFraction = fraction;
|
|
806
|
+
hit.mSubShapeID2 = inSubShapeID2;
|
|
807
|
+
mCollector.AddHit(hit);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
CastRayCollector & mCollector;
|
|
812
|
+
Vec3 mRayOrigin;
|
|
813
|
+
Vec3 mRayDirection;
|
|
814
|
+
RayInvDirection mRayInvDirection;
|
|
815
|
+
EBackFaceMode mBackFaceMode;
|
|
816
|
+
float mDistanceStack[NodeCodec::StackSize];
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
Visitor visitor(ioCollector);
|
|
820
|
+
visitor.mBackFaceMode = inRayCastSettings.mBackFaceModeTriangles;
|
|
821
|
+
visitor.mRayOrigin = inRay.mOrigin;
|
|
822
|
+
visitor.mRayDirection = inRay.mDirection;
|
|
823
|
+
visitor.mRayInvDirection.Set(inRay.mDirection);
|
|
824
|
+
WalkTreePerTriangle(inSubShapeIDCreator, visitor);
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
void MeshShape::CollidePoint(Vec3Arg inPoint, const SubShapeIDCreator &inSubShapeIDCreator, CollidePointCollector &ioCollector, const ShapeFilter &inShapeFilter) const
|
|
828
|
+
{
|
|
829
|
+
sCollidePointUsingRayCast(*this, inPoint, inSubShapeIDCreator, ioCollector, inShapeFilter);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
void MeshShape::CollideSoftBodyVertices(Mat44Arg inCenterOfMassTransform, Vec3Arg inScale, const CollideSoftBodyVertexIterator &inVertices, uint inNumVertices, int inCollidingShapeIndex) const
|
|
833
|
+
{
|
|
834
|
+
JPH_PROFILE_FUNCTION();
|
|
835
|
+
|
|
836
|
+
struct Visitor : public CollideSoftBodyVerticesVsTriangles
|
|
837
|
+
{
|
|
838
|
+
using CollideSoftBodyVerticesVsTriangles::CollideSoftBodyVerticesVsTriangles;
|
|
839
|
+
|
|
840
|
+
JPH_INLINE bool ShouldAbort() const
|
|
841
|
+
{
|
|
842
|
+
return false;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
JPH_INLINE bool ShouldVisitNode([[maybe_unused]] int inStackTop) const
|
|
846
|
+
{
|
|
847
|
+
return mDistanceStack[inStackTop] < mClosestDistanceSq;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
|
|
851
|
+
{
|
|
852
|
+
// Scale the bounding boxes of this node
|
|
853
|
+
Vec4 bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z;
|
|
854
|
+
AABox4Scale(mScale, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
855
|
+
|
|
856
|
+
// Get distance to vertex
|
|
857
|
+
Vec4 dist_sq = AABox4DistanceSqToPoint(mLocalPosition, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
858
|
+
|
|
859
|
+
// Sort so that highest values are first (we want to first process closer hits and we process stack top to bottom)
|
|
860
|
+
return SortReverseAndStore(dist_sq, mClosestDistanceSq, ioProperties, &mDistanceStack[inStackTop]);
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
JPH_INLINE void VisitTriangle(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, [[maybe_unused]] uint8 inActiveEdges, [[maybe_unused]] SubShapeID inSubShapeID2)
|
|
864
|
+
{
|
|
865
|
+
ProcessTriangle(inV0, inV1, inV2);
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
float mDistanceStack[NodeCodec::StackSize];
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
Visitor visitor(inCenterOfMassTransform, inScale);
|
|
872
|
+
|
|
873
|
+
for (CollideSoftBodyVertexIterator v = inVertices, sbv_end = inVertices + inNumVertices; v != sbv_end; ++v)
|
|
874
|
+
if (v.GetInvMass() > 0.0f)
|
|
875
|
+
{
|
|
876
|
+
visitor.StartVertex(v);
|
|
877
|
+
WalkTreePerTriangle(SubShapeIDCreator(), visitor);
|
|
878
|
+
visitor.FinishVertex(v, inCollidingShapeIndex);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
void MeshShape::sCastConvexVsMesh(const ShapeCast &inShapeCast, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, [[maybe_unused]] const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)
|
|
883
|
+
{
|
|
884
|
+
JPH_PROFILE_FUNCTION();
|
|
885
|
+
|
|
886
|
+
struct Visitor : public CastConvexVsTriangles
|
|
887
|
+
{
|
|
888
|
+
using CastConvexVsTriangles::CastConvexVsTriangles;
|
|
889
|
+
|
|
890
|
+
JPH_INLINE bool ShouldAbort() const
|
|
891
|
+
{
|
|
892
|
+
return mCollector.ShouldEarlyOut();
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
JPH_INLINE bool ShouldVisitNode(int inStackTop) const
|
|
896
|
+
{
|
|
897
|
+
return mDistanceStack[inStackTop] < mCollector.GetPositiveEarlyOutFraction();
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
|
|
901
|
+
{
|
|
902
|
+
// Scale the bounding boxes of this node
|
|
903
|
+
Vec4 bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z;
|
|
904
|
+
AABox4Scale(mScale, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
905
|
+
|
|
906
|
+
// Enlarge them by the casted shape's box extents
|
|
907
|
+
AABox4EnlargeWithExtent(mBoxExtent, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
908
|
+
|
|
909
|
+
// Test bounds of 4 children
|
|
910
|
+
Vec4 distance = RayAABox4(mBoxCenter, mInvDirection, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
911
|
+
|
|
912
|
+
// Sort so that highest values are first (we want to first process closer hits and we process stack top to bottom)
|
|
913
|
+
return SortReverseAndStore(distance, mCollector.GetPositiveEarlyOutFraction(), ioProperties, &mDistanceStack[inStackTop]);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
JPH_INLINE void VisitTriangle(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, uint8 inActiveEdges, SubShapeID inSubShapeID2)
|
|
917
|
+
{
|
|
918
|
+
Cast(inV0, inV1, inV2, inActiveEdges, inSubShapeID2);
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
RayInvDirection mInvDirection;
|
|
922
|
+
Vec3 mBoxCenter;
|
|
923
|
+
Vec3 mBoxExtent;
|
|
924
|
+
float mDistanceStack[NodeCodec::StackSize];
|
|
925
|
+
};
|
|
926
|
+
|
|
927
|
+
JPH_ASSERT(inShape->GetSubType() == EShapeSubType::Mesh);
|
|
928
|
+
const MeshShape *shape = static_cast<const MeshShape *>(inShape);
|
|
929
|
+
|
|
930
|
+
Visitor visitor(inShapeCast, inShapeCastSettings, inScale, inCenterOfMassTransform2, inSubShapeIDCreator1, ioCollector);
|
|
931
|
+
visitor.mInvDirection.Set(inShapeCast.mDirection);
|
|
932
|
+
visitor.mBoxCenter = inShapeCast.mShapeWorldBounds.GetCenter();
|
|
933
|
+
visitor.mBoxExtent = inShapeCast.mShapeWorldBounds.GetExtent();
|
|
934
|
+
shape->WalkTreePerTriangle(inSubShapeIDCreator2, visitor);
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
void MeshShape::sCastSphereVsMesh(const ShapeCast &inShapeCast, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, [[maybe_unused]] const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)
|
|
938
|
+
{
|
|
939
|
+
JPH_PROFILE_FUNCTION();
|
|
940
|
+
|
|
941
|
+
struct Visitor : public CastSphereVsTriangles
|
|
942
|
+
{
|
|
943
|
+
using CastSphereVsTriangles::CastSphereVsTriangles;
|
|
944
|
+
|
|
945
|
+
JPH_INLINE bool ShouldAbort() const
|
|
946
|
+
{
|
|
947
|
+
return mCollector.ShouldEarlyOut();
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
JPH_INLINE bool ShouldVisitNode(int inStackTop) const
|
|
951
|
+
{
|
|
952
|
+
return mDistanceStack[inStackTop] < mCollector.GetPositiveEarlyOutFraction();
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
|
|
956
|
+
{
|
|
957
|
+
// Scale the bounding boxes of this node
|
|
958
|
+
Vec4 bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z;
|
|
959
|
+
AABox4Scale(mScale, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
960
|
+
|
|
961
|
+
// Enlarge them by the radius of the sphere
|
|
962
|
+
AABox4EnlargeWithExtent(Vec3::sReplicate(mRadius), bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
963
|
+
|
|
964
|
+
// Test bounds of 4 children
|
|
965
|
+
Vec4 distance = RayAABox4(mStart, mInvDirection, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
966
|
+
|
|
967
|
+
// Sort so that highest values are first (we want to first process closer hits and we process stack top to bottom)
|
|
968
|
+
return SortReverseAndStore(distance, mCollector.GetPositiveEarlyOutFraction(), ioProperties, &mDistanceStack[inStackTop]);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
JPH_INLINE void VisitTriangle(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, uint8 inActiveEdges, SubShapeID inSubShapeID2)
|
|
972
|
+
{
|
|
973
|
+
Cast(inV0, inV1, inV2, inActiveEdges, inSubShapeID2);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
RayInvDirection mInvDirection;
|
|
977
|
+
float mDistanceStack[NodeCodec::StackSize];
|
|
978
|
+
};
|
|
979
|
+
|
|
980
|
+
JPH_ASSERT(inShape->GetSubType() == EShapeSubType::Mesh);
|
|
981
|
+
const MeshShape *shape = static_cast<const MeshShape *>(inShape);
|
|
982
|
+
|
|
983
|
+
Visitor visitor(inShapeCast, inShapeCastSettings, inScale, inCenterOfMassTransform2, inSubShapeIDCreator1, ioCollector);
|
|
984
|
+
visitor.mInvDirection.Set(inShapeCast.mDirection);
|
|
985
|
+
shape->WalkTreePerTriangle(inSubShapeIDCreator2, visitor);
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
struct MeshShape::MSGetTrianglesContext
|
|
989
|
+
{
|
|
990
|
+
JPH_INLINE MSGetTrianglesContext(const MeshShape *inShape, const AABox &inBox, Vec3Arg inPositionCOM, QuatArg inRotation, Vec3Arg inScale) :
|
|
991
|
+
mDecodeCtx(sGetNodeHeader(inShape->mTree)),
|
|
992
|
+
mShape(inShape),
|
|
993
|
+
mLocalBox(Mat44::sInverseRotationTranslation(inRotation, inPositionCOM), inBox),
|
|
994
|
+
mMeshScale(inScale),
|
|
995
|
+
mLocalToWorld(Mat44::sRotationTranslation(inRotation, inPositionCOM) * Mat44::sScale(inScale)),
|
|
996
|
+
mIsInsideOut(ScaleHelpers::IsInsideOut(inScale))
|
|
997
|
+
{
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
JPH_INLINE bool ShouldAbort() const
|
|
1001
|
+
{
|
|
1002
|
+
return mShouldAbort;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
JPH_INLINE bool ShouldVisitNode([[maybe_unused]] int inStackTop) const
|
|
1006
|
+
{
|
|
1007
|
+
return true;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, [[maybe_unused]] int inStackTop) const
|
|
1011
|
+
{
|
|
1012
|
+
// Scale the bounding boxes of this node
|
|
1013
|
+
Vec4 bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z;
|
|
1014
|
+
AABox4Scale(mMeshScale, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
1015
|
+
|
|
1016
|
+
// Test which nodes collide
|
|
1017
|
+
UVec4 collides = AABox4VsBox(mLocalBox, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
1018
|
+
return CountAndSortTrues(collides, ioProperties);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
JPH_INLINE void VisitTriangles(const TriangleCodec::DecodingContext &ioContext, const void *inTriangles, int inNumTriangles, [[maybe_unused]] uint32 inTriangleBlockID)
|
|
1022
|
+
{
|
|
1023
|
+
// When the buffer is full and we cannot process the triangles, abort the tree walk. The next time GetTrianglesNext is called we will continue here.
|
|
1024
|
+
if (mNumTrianglesFound + inNumTriangles > mMaxTrianglesRequested)
|
|
1025
|
+
{
|
|
1026
|
+
mShouldAbort = true;
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
// Decode vertices
|
|
1031
|
+
JPH_ASSERT(inNumTriangles <= MaxTrianglesPerLeaf);
|
|
1032
|
+
Vec3 vertices[MaxTrianglesPerLeaf * 3];
|
|
1033
|
+
ioContext.Unpack(inTriangles, inNumTriangles, vertices);
|
|
1034
|
+
|
|
1035
|
+
// Store vertices as Float3
|
|
1036
|
+
if (mIsInsideOut)
|
|
1037
|
+
{
|
|
1038
|
+
// Scaled inside out, flip the triangles
|
|
1039
|
+
for (const Vec3 *v = vertices, *v_end = v + 3 * inNumTriangles; v < v_end; v += 3)
|
|
1040
|
+
{
|
|
1041
|
+
(mLocalToWorld * v[0]).StoreFloat3(mTriangleVertices++);
|
|
1042
|
+
(mLocalToWorld * v[2]).StoreFloat3(mTriangleVertices++);
|
|
1043
|
+
(mLocalToWorld * v[1]).StoreFloat3(mTriangleVertices++);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
else
|
|
1047
|
+
{
|
|
1048
|
+
// Normal scale
|
|
1049
|
+
for (const Vec3 *v = vertices, *v_end = v + 3 * inNumTriangles; v < v_end; ++v)
|
|
1050
|
+
(mLocalToWorld * *v).StoreFloat3(mTriangleVertices++);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
if (mMaterials != nullptr)
|
|
1054
|
+
{
|
|
1055
|
+
if (mShape->mMaterials.empty())
|
|
1056
|
+
{
|
|
1057
|
+
// No materials, output default
|
|
1058
|
+
const PhysicsMaterial *default_material = PhysicsMaterial::sDefault;
|
|
1059
|
+
for (int m = 0; m < inNumTriangles; ++m)
|
|
1060
|
+
*mMaterials++ = default_material;
|
|
1061
|
+
}
|
|
1062
|
+
else
|
|
1063
|
+
{
|
|
1064
|
+
// Decode triangle flags
|
|
1065
|
+
uint8 flags[MaxTrianglesPerLeaf];
|
|
1066
|
+
TriangleCodec::DecodingContext::sGetFlags(inTriangles, inNumTriangles, flags);
|
|
1067
|
+
|
|
1068
|
+
// Store materials
|
|
1069
|
+
for (const uint8 *f = flags, *f_end = f + inNumTriangles; f < f_end; ++f)
|
|
1070
|
+
*mMaterials++ = mShape->mMaterials[*f & FLAGS_MATERIAL_MASK].GetPtr();
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
// Accumulate triangles found
|
|
1075
|
+
mNumTrianglesFound += inNumTriangles;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
NodeCodec::DecodingContext mDecodeCtx;
|
|
1079
|
+
const MeshShape * mShape;
|
|
1080
|
+
OrientedBox mLocalBox;
|
|
1081
|
+
Vec3 mMeshScale;
|
|
1082
|
+
Mat44 mLocalToWorld;
|
|
1083
|
+
int mMaxTrianglesRequested;
|
|
1084
|
+
Float3 * mTriangleVertices;
|
|
1085
|
+
int mNumTrianglesFound;
|
|
1086
|
+
const PhysicsMaterial ** mMaterials;
|
|
1087
|
+
bool mShouldAbort;
|
|
1088
|
+
bool mIsInsideOut;
|
|
1089
|
+
};
|
|
1090
|
+
|
|
1091
|
+
void MeshShape::GetTrianglesStart(GetTrianglesContext &ioContext, const AABox &inBox, Vec3Arg inPositionCOM, QuatArg inRotation, Vec3Arg inScale) const
|
|
1092
|
+
{
|
|
1093
|
+
static_assert(sizeof(MSGetTrianglesContext) <= sizeof(GetTrianglesContext), "GetTrianglesContext too small");
|
|
1094
|
+
JPH_ASSERT(IsAligned(&ioContext, alignof(MSGetTrianglesContext)));
|
|
1095
|
+
|
|
1096
|
+
new (&ioContext) MSGetTrianglesContext(this, inBox, inPositionCOM, inRotation, inScale);
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
int MeshShape::GetTrianglesNext(GetTrianglesContext &ioContext, int inMaxTrianglesRequested, Float3 *outTriangleVertices, const PhysicsMaterial **outMaterials) const
|
|
1100
|
+
{
|
|
1101
|
+
static_assert(cGetTrianglesMinTrianglesRequested >= MaxTrianglesPerLeaf, "cGetTrianglesMinTrianglesRequested is too small");
|
|
1102
|
+
JPH_ASSERT(inMaxTrianglesRequested >= cGetTrianglesMinTrianglesRequested);
|
|
1103
|
+
|
|
1104
|
+
// Check if we're done
|
|
1105
|
+
MSGetTrianglesContext &context = (MSGetTrianglesContext &)ioContext;
|
|
1106
|
+
if (context.mDecodeCtx.IsDoneWalking())
|
|
1107
|
+
return 0;
|
|
1108
|
+
|
|
1109
|
+
// Store parameters on context
|
|
1110
|
+
context.mMaxTrianglesRequested = inMaxTrianglesRequested;
|
|
1111
|
+
context.mTriangleVertices = outTriangleVertices;
|
|
1112
|
+
context.mMaterials = outMaterials;
|
|
1113
|
+
context.mShouldAbort = false; // Reset the abort flag
|
|
1114
|
+
context.mNumTrianglesFound = 0;
|
|
1115
|
+
|
|
1116
|
+
// Continue (or start) walking the tree
|
|
1117
|
+
const TriangleCodec::DecodingContext triangle_ctx(sGetTriangleHeader(mTree));
|
|
1118
|
+
const uint8 *buffer_start = &mTree[0];
|
|
1119
|
+
context.mDecodeCtx.WalkTree(buffer_start, triangle_ctx, context);
|
|
1120
|
+
return context.mNumTrianglesFound;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
void MeshShape::sCollideConvexVsMesh(const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, [[maybe_unused]] const ShapeFilter &inShapeFilter)
|
|
1124
|
+
{
|
|
1125
|
+
JPH_PROFILE_FUNCTION();
|
|
1126
|
+
|
|
1127
|
+
// Get the shapes
|
|
1128
|
+
JPH_ASSERT(inShape1->GetType() == EShapeType::Convex);
|
|
1129
|
+
JPH_ASSERT(inShape2->GetType() == EShapeType::Mesh);
|
|
1130
|
+
const ConvexShape *shape1 = static_cast<const ConvexShape *>(inShape1);
|
|
1131
|
+
const MeshShape *shape2 = static_cast<const MeshShape *>(inShape2);
|
|
1132
|
+
|
|
1133
|
+
struct Visitor : public CollideConvexVsTriangles
|
|
1134
|
+
{
|
|
1135
|
+
using CollideConvexVsTriangles::CollideConvexVsTriangles;
|
|
1136
|
+
|
|
1137
|
+
JPH_INLINE bool ShouldAbort() const
|
|
1138
|
+
{
|
|
1139
|
+
return mCollector.ShouldEarlyOut();
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
JPH_INLINE bool ShouldVisitNode([[maybe_unused]] int inStackTop) const
|
|
1143
|
+
{
|
|
1144
|
+
return true;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, [[maybe_unused]] int inStackTop) const
|
|
1148
|
+
{
|
|
1149
|
+
// Scale the bounding boxes of this node
|
|
1150
|
+
Vec4 bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z;
|
|
1151
|
+
AABox4Scale(mScale2, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
1152
|
+
|
|
1153
|
+
// Test which nodes collide
|
|
1154
|
+
UVec4 collides = AABox4VsBox(mBoundsOf1InSpaceOf2, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
1155
|
+
return CountAndSortTrues(collides, ioProperties);
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
JPH_INLINE void VisitTriangle(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, uint8 inActiveEdges, SubShapeID inSubShapeID2)
|
|
1159
|
+
{
|
|
1160
|
+
Collide(inV0, inV1, inV2, inActiveEdges, inSubShapeID2);
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
Visitor visitor(shape1, inScale1, inScale2, inCenterOfMassTransform1, inCenterOfMassTransform2, inSubShapeIDCreator1.GetID(), inCollideShapeSettings, ioCollector);
|
|
1165
|
+
shape2->WalkTreePerTriangle(inSubShapeIDCreator2, visitor);
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
void MeshShape::sCollideSphereVsMesh(const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, [[maybe_unused]] const ShapeFilter &inShapeFilter)
|
|
1169
|
+
{
|
|
1170
|
+
JPH_PROFILE_FUNCTION();
|
|
1171
|
+
|
|
1172
|
+
// Get the shapes
|
|
1173
|
+
JPH_ASSERT(inShape1->GetSubType() == EShapeSubType::Sphere);
|
|
1174
|
+
JPH_ASSERT(inShape2->GetType() == EShapeType::Mesh);
|
|
1175
|
+
const SphereShape *shape1 = static_cast<const SphereShape *>(inShape1);
|
|
1176
|
+
const MeshShape *shape2 = static_cast<const MeshShape *>(inShape2);
|
|
1177
|
+
|
|
1178
|
+
struct Visitor : public CollideSphereVsTriangles
|
|
1179
|
+
{
|
|
1180
|
+
using CollideSphereVsTriangles::CollideSphereVsTriangles;
|
|
1181
|
+
|
|
1182
|
+
JPH_INLINE bool ShouldAbort() const
|
|
1183
|
+
{
|
|
1184
|
+
return mCollector.ShouldEarlyOut();
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
JPH_INLINE bool ShouldVisitNode([[maybe_unused]] int inStackTop) const
|
|
1188
|
+
{
|
|
1189
|
+
return true;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, [[maybe_unused]] int inStackTop) const
|
|
1193
|
+
{
|
|
1194
|
+
// Scale the bounding boxes of this node
|
|
1195
|
+
Vec4 bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z;
|
|
1196
|
+
AABox4Scale(mScale2, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
1197
|
+
|
|
1198
|
+
// Test which nodes collide
|
|
1199
|
+
UVec4 collides = AABox4VsSphere(mSphereCenterIn2, mRadiusPlusMaxSeparationSq, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
|
|
1200
|
+
return CountAndSortTrues(collides, ioProperties);
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
JPH_INLINE void VisitTriangle(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, uint8 inActiveEdges, SubShapeID inSubShapeID2)
|
|
1204
|
+
{
|
|
1205
|
+
Collide(inV0, inV1, inV2, inActiveEdges, inSubShapeID2);
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1209
|
+
Visitor visitor(shape1, inScale1, inScale2, inCenterOfMassTransform1, inCenterOfMassTransform2, inSubShapeIDCreator1.GetID(), inCollideShapeSettings, ioCollector);
|
|
1210
|
+
shape2->WalkTreePerTriangle(inSubShapeIDCreator2, visitor);
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
void MeshShape::SaveBinaryState(StreamOut &inStream) const
|
|
1214
|
+
{
|
|
1215
|
+
Shape::SaveBinaryState(inStream);
|
|
1216
|
+
|
|
1217
|
+
inStream.Write(static_cast<const ByteBufferVector &>(mTree)); // Make sure we use the Array<> overload
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
void MeshShape::RestoreBinaryState(StreamIn &inStream)
|
|
1221
|
+
{
|
|
1222
|
+
Shape::RestoreBinaryState(inStream);
|
|
1223
|
+
|
|
1224
|
+
inStream.Read(static_cast<ByteBufferVector &>(mTree)); // Make sure we use the Array<> overload
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
void MeshShape::SaveMaterialState(PhysicsMaterialList &outMaterials) const
|
|
1228
|
+
{
|
|
1229
|
+
outMaterials = mMaterials;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
void MeshShape::RestoreMaterialState(const PhysicsMaterialRefC *inMaterials, uint inNumMaterials)
|
|
1233
|
+
{
|
|
1234
|
+
mMaterials.assign(inMaterials, inMaterials + inNumMaterials);
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
Shape::Stats MeshShape::GetStats() const
|
|
1238
|
+
{
|
|
1239
|
+
// Walk the tree to count the triangles
|
|
1240
|
+
struct Visitor
|
|
1241
|
+
{
|
|
1242
|
+
JPH_INLINE bool ShouldAbort() const
|
|
1243
|
+
{
|
|
1244
|
+
return false;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
JPH_INLINE bool ShouldVisitNode([[maybe_unused]] int inStackTop) const
|
|
1248
|
+
{
|
|
1249
|
+
return true;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, [[maybe_unused]] int inStackTop) const
|
|
1253
|
+
{
|
|
1254
|
+
// Visit all valid children
|
|
1255
|
+
UVec4 valid = UVec4::sOr(UVec4::sOr(Vec4::sLess(inBoundsMinX, inBoundsMaxX), Vec4::sLess(inBoundsMinY, inBoundsMaxY)), Vec4::sLess(inBoundsMinZ, inBoundsMaxZ));
|
|
1256
|
+
return CountAndSortTrues(valid, ioProperties);
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
JPH_INLINE void VisitTriangles([[maybe_unused]] const TriangleCodec::DecodingContext &ioContext, [[maybe_unused]] const void *inTriangles, int inNumTriangles, [[maybe_unused]] uint32 inTriangleBlockID)
|
|
1260
|
+
{
|
|
1261
|
+
mNumTriangles += inNumTriangles;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
uint mNumTriangles = 0;
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1267
|
+
Visitor visitor;
|
|
1268
|
+
WalkTree(visitor);
|
|
1269
|
+
|
|
1270
|
+
return Stats(sizeof(*this) + mMaterials.size() * sizeof(Ref<PhysicsMaterial>) + mTree.size() * sizeof(uint8), visitor.mNumTriangles);
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
uint32 MeshShape::GetTriangleUserData(const SubShapeID &inSubShapeID) const
|
|
1274
|
+
{
|
|
1275
|
+
// Decode ID
|
|
1276
|
+
const void *block_start;
|
|
1277
|
+
uint32 triangle_idx;
|
|
1278
|
+
DecodeSubShapeID(inSubShapeID, block_start, triangle_idx);
|
|
1279
|
+
|
|
1280
|
+
// Decode triangle
|
|
1281
|
+
const TriangleCodec::DecodingContext triangle_ctx(sGetTriangleHeader(mTree));
|
|
1282
|
+
return triangle_ctx.GetUserData(block_start, triangle_idx);
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
void MeshShape::sRegister()
|
|
1286
|
+
{
|
|
1287
|
+
ShapeFunctions &f = ShapeFunctions::sGet(EShapeSubType::Mesh);
|
|
1288
|
+
f.mConstruct = []() -> Shape * { return new MeshShape; };
|
|
1289
|
+
f.mColor = Color::sRed;
|
|
1290
|
+
|
|
1291
|
+
for (EShapeSubType s : sConvexSubShapeTypes)
|
|
1292
|
+
{
|
|
1293
|
+
CollisionDispatch::sRegisterCollideShape(s, EShapeSubType::Mesh, sCollideConvexVsMesh);
|
|
1294
|
+
CollisionDispatch::sRegisterCastShape(s, EShapeSubType::Mesh, sCastConvexVsMesh);
|
|
1295
|
+
|
|
1296
|
+
CollisionDispatch::sRegisterCastShape(EShapeSubType::Mesh, s, CollisionDispatch::sReversedCastShape);
|
|
1297
|
+
CollisionDispatch::sRegisterCollideShape(EShapeSubType::Mesh, s, CollisionDispatch::sReversedCollideShape);
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
// Specialized collision functions
|
|
1301
|
+
CollisionDispatch::sRegisterCollideShape(EShapeSubType::Sphere, EShapeSubType::Mesh, sCollideSphereVsMesh);
|
|
1302
|
+
CollisionDispatch::sRegisterCastShape(EShapeSubType::Sphere, EShapeSubType::Mesh, sCastSphereVsMesh);
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
JPH_NAMESPACE_END
|