@babylonjs/react-native 2.0.0 → 2.0.1-preview

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.
Files changed (599) hide show
  1. package/package.json +1 -1
  2. package/react-native-babylon.podspec +2 -0
  3. package/shared/BabylonNative/CMakeLists.txt +2 -0
  4. package/shared/BabylonNative/Repo/CMakeLists.txt +16 -12
  5. package/shared/BabylonNative/Repo/Core/Graphics/CMakeLists.txt +41 -21
  6. package/shared/BabylonNative/Repo/Core/Graphics/Include/Platform/iOS/Babylon/Graphics/Platform.h +2 -2
  7. package/shared/BabylonNative/Repo/Core/Graphics/Include/Platform/macOS/Babylon/Graphics/Platform.h +2 -2
  8. package/shared/BabylonNative/Repo/Core/Graphics/Include/Platform/visionOS/Babylon/Graphics/Platform.h +2 -2
  9. package/shared/BabylonNative/Repo/Core/Graphics/Include/RendererType/Metal/Babylon/Graphics/RendererType.h +6 -6
  10. package/shared/BabylonNative/Repo/Core/Graphics/InternalInclude/Babylon/Graphics/BgfxCallback.h +1 -1
  11. package/shared/BabylonNative/Repo/Core/Graphics/Source/BgfxCallback.cpp +32 -9
  12. package/shared/BabylonNative/Repo/Core/Graphics/Source/DeviceImpl.cpp +7 -5
  13. package/shared/BabylonNative/Repo/Core/Graphics/Source/{DeviceImpl_Metal.cpp → DeviceImpl_Metal.mm} +4 -3
  14. package/shared/BabylonNative/Repo/Core/Graphics/Source/DeviceImpl_iOS.mm +5 -3
  15. package/shared/BabylonNative/Repo/Core/Graphics/Source/DeviceImpl_macOS.mm +10 -1
  16. package/shared/BabylonNative/Repo/Core/Graphics/Source/DeviceImpl_visionOS.mm +2 -4
  17. package/shared/BabylonNative/Repo/Dependencies/CMakeLists.txt +77 -12
  18. package/shared/BabylonNative/Repo/Dependencies/xr/CMakeLists.txt +1 -3
  19. package/shared/BabylonNative/Repo/Plugins/ExternalTexture/CMakeLists.txt +1 -6
  20. package/shared/BabylonNative/Repo/Plugins/ExternalTexture/Source/ExternalTexture_D3D11.cpp +4 -0
  21. package/shared/BabylonNative/Repo/Plugins/ExternalTexture/Source/ExternalTexture_D3D12.cpp +4 -0
  22. package/shared/BabylonNative/Repo/Plugins/ExternalTexture/Source/{ExternalTexture_Metal.mm → ExternalTexture_Metal.cpp} +128 -120
  23. package/shared/BabylonNative/Repo/Plugins/NativeCamera/CMakeLists.txt +2 -2
  24. package/shared/BabylonNative/Repo/Plugins/NativeCamera/Source/Apple/CameraDevice.mm +5 -5
  25. package/shared/BabylonNative/Repo/Plugins/NativeEngine/CMakeLists.txt +2 -1
  26. package/shared/BabylonNative/Repo/Plugins/NativeEngine/Source/NativeEngine.cpp +2 -1
  27. package/shared/BabylonNative/Repo/Plugins/NativeEngine/Source/ShaderProvider.cpp +6 -6
  28. package/shared/BabylonNative/Repo/Plugins/NativeOptimizations/CMakeLists.txt +1 -2
  29. package/shared/BabylonNative/Repo/Plugins/NativeTracing/CMakeLists.txt +1 -2
  30. package/shared/BabylonNative/Repo/Plugins/NativeXr/Source/NativeXrImpl.cpp +1 -0
  31. package/shared/BabylonNative/Repo/Plugins/ShaderCache/CMakeLists.txt +0 -2
  32. package/shared/BabylonNative/Repo/Plugins/ShaderCache/Include/Babylon/Plugins/ShaderCache.h +2 -2
  33. package/shared/BabylonNative/Repo/Plugins/ShaderCache/Source/ShaderCache.cpp +2 -2
  34. package/shared/BabylonNative/Repo/Plugins/ShaderCache/Source/ShaderCacheImpl.cpp +4 -4
  35. package/shared/BabylonNative/Repo/Plugins/ShaderCache/Source/ShaderCacheImpl.h +2 -2
  36. package/shared/BabylonNative/Repo/Plugins/ShaderCompiler/Source/ShaderCompilerCommon.cpp +2 -0
  37. package/shared/BabylonNative/Repo/Plugins/ShaderCompiler/Source/ShaderCompilerTraversers.cpp +4 -0
  38. package/shared/BabylonNative/Repo/Plugins/TestUtils/CMakeLists.txt +6 -8
  39. package/shared/BabylonNative/Repo/Plugins/TestUtils/Include/Babylon/Plugins/TestUtils.h +0 -1
  40. package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/TestUtils.cpp +20 -6
  41. package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/TestUtils.h +13 -13
  42. package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/{Android/TestUtilsImpl.cpp → TestUtils_Android.cpp} +1 -10
  43. package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/{Unix/TestUtilsImpl.cpp → TestUtils_Unix.cpp} +10 -20
  44. package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/{Win32/TestUtilsImpl.cpp → TestUtils_Win32.cpp} +10 -20
  45. package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/{WinRT/TestUtilsImpl.cpp → TestUtils_WinRT.cpp} +9 -13
  46. package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/TestUtils_iOS.mm +25 -0
  47. package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/TestUtils_macOS.mm +50 -0
  48. package/shared/BabylonNative/Repo/Polyfills/Canvas/Source/Shaders/dx11/fs_boxblur.h +1 -1
  49. package/shared/BabylonNative/Repo/Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h +1 -1
  50. package/shared/BabylonNative/Repo/Polyfills/Canvas/Source/Shaders/dx11/fs_nanovg_fill.h +1 -1
  51. package/shared/BabylonNative/Repo/Polyfills/Canvas/Source/Shaders/dx11/vs_fspass.h +1 -1
  52. package/shared/BabylonNative/Repo/Polyfills/Canvas/Source/Shaders/dx11/vs_nanovg_fill.h +1 -1
  53. package/shared/BabylonNative/Repo/Polyfills/Canvas/shaderc.cmake +2 -2
  54. package/shared/BabylonNative/Repo/azure-pipelines.yml +36 -24
  55. package/shared/BabylonNative/deps/arcana.cpp-src/CMakeLists.txt +17 -1
  56. package/shared/BabylonNative/deps/arcana.cpp-src/README.md +1 -1
  57. package/shared/BabylonNative/deps/arcana.cpp-src/Source/Shared/arcana/string.h +0 -12
  58. package/shared/BabylonNative/deps/arcana.cpp-src/Source/Shared/arcana/threading/cancellation.h +25 -12
  59. package/shared/BabylonNative/deps/arcana.cpp-src/Source/Windows.Test/Threading/CancellationMemoryLeakTest.cpp +37 -0
  60. package/shared/BabylonNative/deps/bgfx.cmake-src/CMakeLists.txt +3 -3
  61. package/shared/BabylonNative/deps/bgfx.cmake-src/README.md +5 -5
  62. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/LICENSE +1 -1
  63. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/README.md +31 -14
  64. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/args.h +5 -1
  65. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/aviwriter.h +1 -1
  66. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/bgfx_utils.cpp +4 -3
  67. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/bgfx_utils.h +1 -1
  68. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/common.h +43 -1
  69. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/common.sh +1 -1
  70. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/debugdraw.cpp +1 -1
  71. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/debugdraw.h +1 -1
  72. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_fill.bin.h +180 -29
  73. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_fill.sc +1 -1
  74. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.bin.h +305 -92
  75. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.sc +1 -1
  76. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.bin.h +328 -26
  77. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.sc +1 -1
  78. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_lines.bin.h +227 -13
  79. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_lines.sc +1 -1
  80. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.bin.h +290 -38
  81. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.sc +1 -1
  82. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/makefile +1 -1
  83. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill.bin.h +319 -95
  84. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill.sc +2 -1
  85. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.bin.h +410 -133
  86. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.sc +2 -1
  87. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.bin.h +378 -120
  88. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.sc +1 -1
  89. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.bin.h +290 -85
  90. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.sc +1 -1
  91. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.bin.h +259 -18
  92. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.sc +1 -1
  93. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_lines.bin.h +228 -14
  94. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_lines.sc +1 -1
  95. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.bin.h +255 -16
  96. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.sc +1 -1
  97. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/cmd.cpp +1 -1
  98. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/cmd.h +1 -1
  99. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/dbg.h +1 -1
  100. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/dialog.cpp +1 -1
  101. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/dialog.h +1 -1
  102. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry.cpp +1 -1
  103. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry.h +1 -1
  104. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_android.cpp +1 -1
  105. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_glfw.cpp +1 -1
  106. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_html5.cpp +1 -1
  107. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_ios.mm +1 -1
  108. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_noop.cpp +1 -1
  109. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_osx.mm +2 -2
  110. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_p.h +1 -1
  111. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_sdl.cpp +1 -1
  112. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_windows.cpp +3 -3
  113. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_x11.cpp +2 -2
  114. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/input.cpp +2 -2
  115. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/input.h +1 -1
  116. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/example-glue.cpp +21 -9
  117. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_basic.bin.h +391 -75
  118. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field.bin.h +382 -119
  119. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field_drop_shadow.bin.h +587 -227
  120. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field_drop_shadow_image.bin.h +655 -265
  121. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field_outline.bin.h +452 -164
  122. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field_outline_drop_shadow_image.bin.h +719 -307
  123. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field_outline_image.bin.h +535 -208
  124. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h +495 -125
  125. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/makefile +1 -1
  126. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_basic.bin.h +254 -16
  127. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field.bin.h +254 -16
  128. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field_drop_shadow.bin.h +340 -15
  129. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field_drop_shadow_image.bin.h +340 -15
  130. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field_outline.bin.h +310 -15
  131. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field_outline_drop_shadow_image.bin.h +340 -15
  132. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field_outline_image.bin.h +310 -15
  133. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h +254 -16
  134. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_image.bin.h +277 -59
  135. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h +324 -25
  136. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/imgui.cpp +9 -9
  137. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/imgui.h +1 -1
  138. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/makefile +1 -1
  139. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_image.bin.h +219 -15
  140. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h +239 -7
  141. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h +925 -472
  142. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/nanovg/makefile +1 -1
  143. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/nanovg/nanovg_bgfx.cpp +1 -1
  144. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/nanovg/nanovg_bgfx.h +1 -1
  145. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h +223 -7
  146. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/packrect.h +1 -1
  147. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/fs_particle.bin.h +382 -70
  148. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/fs_particle.sc +1 -1
  149. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/makefile +1 -1
  150. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/particle_system.cpp +1 -1
  151. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/particle_system.h +1 -1
  152. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/vs_particle.bin.h +263 -18
  153. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/vs_particle.sc +1 -1
  154. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/shaderlib.sh +10 -7
  155. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/include/bgfx/bgfx.h +149 -7
  156. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/include/bgfx/c99/bgfx.h +225 -101
  157. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/include/bgfx/defines.h +30 -21
  158. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/include/bgfx/embedded_shader.h +110 -60
  159. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/include/bgfx/platform.h +1 -1
  160. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/makefile +1 -1
  161. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/bgfx.idl +189 -70
  162. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/bgfx.lua +1 -1
  163. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/bindings-bf.lua +1 -1
  164. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/bindings-c3.lua +1 -1
  165. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/bindings-cs.lua +2 -2
  166. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/bindings-zig.lua +1 -1
  167. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/example-common.lua +1 -1
  168. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/genie.lua +3 -3
  169. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/geometryc.lua +1 -1
  170. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/geometryv.lua +1 -1
  171. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/shader-embeded.mk +18 -4
  172. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/shader.mk +21 -6
  173. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/shaderc.lua +139 -2
  174. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/temp.bgfx.h +2 -2
  175. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/temp.bgfx.hpp +2 -0
  176. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/temp.bgfx.idl.inl +1 -1
  177. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/temp.defines.h +1 -1
  178. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/texturec.lua +1 -1
  179. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/texturev.lua +1 -1
  180. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/tools.mk +1 -1
  181. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/amalgamated.cpp +2 -1
  182. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/amalgamated.mm +1 -1
  183. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/bgfx.cpp +406 -164
  184. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/bgfx.idl.inl +37 -9
  185. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/bgfx_compute.sh +40 -43
  186. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/bgfx_p.h +795 -170
  187. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/bgfx_shader.sh +205 -73
  188. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/charset.h +1 -1
  189. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/config.h +18 -4
  190. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/debug_renderdoc.cpp +8 -1
  191. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/debug_renderdoc.h +1 -1
  192. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/dxgi.cpp +1 -1
  193. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/dxgi.h +1 -1
  194. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/emscripten.h +1 -1
  195. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear0.bin.h +190 -36
  196. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear0.sc +1 -1
  197. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear1.bin.h +223 -46
  198. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear1.sc +1 -1
  199. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear2.bin.h +253 -55
  200. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear2.sc +1 -1
  201. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear3.bin.h +283 -65
  202. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear3.sc +1 -1
  203. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear4.bin.h +314 -75
  204. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear4.sc +1 -1
  205. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear5.bin.h +343 -85
  206. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear5.sc +1 -1
  207. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear6.bin.h +373 -94
  208. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear6.sc +1 -1
  209. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear7.bin.h +404 -105
  210. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear7.sc +1 -1
  211. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_debugfont.bin.h +401 -67
  212. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_debugfont.sc +1 -1
  213. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glcontext_egl.cpp +114 -36
  214. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glcontext_egl.h +5 -1
  215. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glcontext_html5.cpp +1 -1
  216. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glcontext_html5.h +1 -1
  217. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glcontext_wgl.cpp +1 -1
  218. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glcontext_wgl.h +1 -1
  219. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glimports.h +1 -1
  220. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/makefile +17 -13
  221. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/nvapi.cpp +1 -1
  222. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/nvapi.h +1 -1
  223. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer.h +50 -29
  224. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_agc.cpp +1 -1
  225. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_d3d.h +7 -1
  226. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_d3d11.cpp +291 -180
  227. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_d3d11.h +5 -2
  228. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_d3d12.cpp +635 -218
  229. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_d3d12.h +78 -10
  230. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_gl.cpp +65 -45
  231. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_gl.h +24 -3
  232. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_gnm.cpp +1 -1
  233. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_mtl.h +50 -24
  234. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_mtl.mm +158 -56
  235. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_noop.cpp +8 -12
  236. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_nvn.cpp +1 -1
  237. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_vk.cpp +810 -445
  238. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_vk.h +194 -133
  239. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_webgpu.cpp +6239 -0
  240. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_webgpu.h +897 -0
  241. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/shader.cpp +1 -1
  242. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/shader.h +1 -1
  243. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/shader_dxbc.cpp +1 -1
  244. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/shader_dxbc.h +1 -1
  245. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/shader_spirv.cpp +1 -1
  246. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/shader_spirv.h +1 -1
  247. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/topology.cpp +1 -1
  248. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/topology.h +1 -1
  249. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/version.h +3 -3
  250. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/vertexlayout.cpp +2 -1
  251. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/vertexlayout.h +1 -1
  252. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/vs_clear.bin.h +186 -24
  253. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/vs_clear.sc +1 -1
  254. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/vs_debugfont.bin.h +314 -44
  255. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/vs_debugfont.sc +1 -1
  256. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/3rdparty/nvtt/bc7/avpcl_mode4.cpp +2 -0
  257. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/3rdparty/nvtt/nvcore/debug.h +1 -1
  258. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/3rdparty/nvtt/nvtt.cpp +1 -1
  259. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/LICENSE +1 -1
  260. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/README.md +2 -1
  261. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/include/bimg/bimg.h +5 -1
  262. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/include/bimg/decode.h +1 -1
  263. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/include/bimg/encode.h +1 -1
  264. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/makefile +183 -0
  265. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/scripts/bimg.lua +1 -1
  266. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/scripts/bimg_decode.lua +2 -2
  267. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/scripts/bimg_encode.lua +1 -1
  268. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/scripts/genie.lua +1 -1
  269. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/scripts/texturec.lua +1 -1
  270. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/bimg_p.h +1 -1
  271. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/config.h +52 -40
  272. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/image.cpp +136 -120
  273. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/image_cubemap_filter.cpp +1 -1
  274. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/image_decode.cpp +17 -5
  275. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/image_encode.cpp +1 -1
  276. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/image_gnf.cpp +1 -1
  277. package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/tools/texturec/texturec.cpp +3 -3
  278. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/LICENSE +1 -1
  279. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/README.md +1 -1
  280. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/allocator.h +1 -1
  281. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/bounds.h +1 -1
  282. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/bx.h +43 -1
  283. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/commandline.h +1 -1
  284. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/config.h +1 -1
  285. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/constants.h +1 -1
  286. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/cpu.h +1 -1
  287. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/debug.h +15 -5
  288. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/easing.h +1 -1
  289. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/endian.h +1 -1
  290. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/error.h +1 -1
  291. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/file.h +1 -1
  292. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/filepath.h +5 -1
  293. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/float4x4_t.h +1 -1
  294. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/handlealloc.h +1 -1
  295. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/hash.h +31 -1
  296. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/allocator.inl +1 -1
  297. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/bounds.inl +1 -1
  298. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/bx.inl +141 -3
  299. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/cpu.inl +1 -1
  300. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/easing.inl +1 -1
  301. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/endian.inl +1 -1
  302. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/error.inl +1 -1
  303. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/float4x4_t.inl +1 -1
  304. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/handlealloc.inl +1 -1
  305. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/hash.inl +28 -1
  306. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/math.inl +1 -1
  307. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/mpscqueue.inl +1 -1
  308. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/mutex.inl +1 -1
  309. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/os.inl +1 -1
  310. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/pixelformat.inl +1 -1
  311. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/readerwriter.inl +1 -1
  312. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/ringbuffer.inl +76 -8
  313. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/rng.inl +1 -1
  314. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd128_langext.inl +1 -1
  315. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd128_neon.inl +1 -1
  316. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd128_ref.inl +1 -1
  317. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd128_sse.inl +1 -1
  318. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd256_avx.inl +1 -1
  319. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd256_ref.inl +1 -1
  320. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd_ni.inl +1 -1
  321. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/sort.inl +1 -1
  322. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/spscqueue.inl +1 -1
  323. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/string.inl +237 -48
  324. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/timer.inl +67 -0
  325. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/typetraits.inl +1 -1
  326. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/uint32_t.inl +1 -1
  327. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/macros.h +6 -6
  328. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/math.h +1 -1
  329. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/mpscqueue.h +1 -1
  330. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/mutex.h +1 -1
  331. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/os.h +1 -1
  332. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/pixelformat.h +1 -1
  333. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/platform.h +3 -3
  334. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/process.h +1 -1
  335. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/readerwriter.h +9 -1
  336. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/ringbuffer.h +145 -14
  337. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/rng.h +1 -1
  338. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/semaphore.h +1 -1
  339. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/settings.h +1 -1
  340. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/simd_t.h +1 -1
  341. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/sort.h +1 -1
  342. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/spscqueue.h +1 -1
  343. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/string.h +111 -42
  344. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/thread.h +5 -5
  345. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/timer.h +59 -1
  346. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/typetraits.h +1 -1
  347. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/uint32_t.h +1 -1
  348. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/url.h +1 -1
  349. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/scripts/bin2c.lua +1 -1
  350. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/scripts/bx.lua +1 -1
  351. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/scripts/genie.lua +1 -1
  352. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/scripts/toolchain.lua +36 -18
  353. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/allocator.cpp +1 -1
  354. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/amalgamated.cpp +1 -1
  355. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/bounds.cpp +10 -10
  356. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/bx.cpp +3 -3
  357. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/commandline.cpp +1 -1
  358. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/crtnone.cpp +1 -1
  359. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/debug.cpp +866 -64
  360. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/dtoa.cpp +3 -9
  361. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/easing.cpp +1 -1
  362. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/file.cpp +1 -1
  363. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/filepath.cpp +7 -1
  364. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/hash.cpp +195 -37
  365. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/math.cpp +1 -1
  366. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/mutex.cpp +1 -1
  367. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/os.cpp +1 -1
  368. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/process.cpp +1 -1
  369. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/semaphore.cpp +27 -6
  370. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/settings.cpp +1 -1
  371. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/sort.cpp +1 -1
  372. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/string.cpp +206 -49
  373. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/thread.cpp +35 -38
  374. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/timer.cpp +5 -1
  375. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/url.cpp +1 -1
  376. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/allocator_test.cpp +1 -1
  377. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/atomic_test.cpp +1 -1
  378. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/cast_test.cpp +99 -1
  379. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/crt_test.cpp +1 -1
  380. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/dbg.h +1 -1
  381. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/easing_test.cpp +1 -1
  382. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/filepath_test.cpp +1 -1
  383. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/handle_bench.cpp +1 -1
  384. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/handle_test.cpp +6 -6
  385. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/hash_test.cpp +37 -8
  386. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/macros_test.cpp +1 -1
  387. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/main_test.cpp +1 -1
  388. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/math_bench.cpp +1 -1
  389. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/math_test.cpp +1 -1
  390. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/os_test.cpp +1 -1
  391. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/pixelformat_test.cpp +1 -1
  392. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/queue_test.cpp +1 -1
  393. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/readerwriter_test.cpp +1 -1
  394. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/ringbuffer_test.cpp +112 -7
  395. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/rng_test.cpp +1 -1
  396. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/run_test.cpp +6 -4
  397. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/settings_test.cpp +1 -1
  398. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/simd_bench.cpp +1 -1
  399. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/simd_test.cpp +1 -1
  400. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/sort_test.cpp +1 -1
  401. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/string_test.cpp +92 -39
  402. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/test.h +1 -1
  403. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/thread_test.cpp +1 -1
  404. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/tokenizecmd_test.cpp +1 -1
  405. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/typetraits_test.cpp +1 -1
  406. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/uint32_test.cpp +1 -1
  407. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/url_test.cpp +1 -1
  408. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/vsnprintf_test.cpp +365 -77
  409. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tools/bin/darwin/genie +0 -0
  410. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tools/bin/linux/genie +0 -0
  411. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tools/bin/windows/genie.exe +0 -0
  412. package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tools/bin2c/bin2c.cpp +2 -2
  413. package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/3rdparty/glslang.cmake +6 -5
  414. package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/3rdparty/spirv-opt.cmake +5 -0
  415. package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/3rdparty/tint.cmake +98 -0
  416. package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/CMakeLists.txt +1 -0
  417. package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/bgfx.cmake +11 -9
  418. package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/examples.cmake +16 -4
  419. package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/shaderc.cmake +21 -10
  420. package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bx/bx.cmake +5 -0
  421. package/shared/BabylonNative/deps/cmakeextensions-src/CMakeLists.txt +31 -5
  422. package/shared/BabylonNative/deps/cmakeextensions-src/README.md +6 -1
  423. package/shared/BabylonNative/deps/jsruntimehost-src/CMakeLists.txt +6 -5
  424. package/shared/BabylonNative/deps/jsruntimehost-src/Core/Node-API/Source/js_native_api_javascriptcore.cc +58 -4
  425. package/shared/BabylonNative/deps/jsruntimehost-src/Polyfills/CMakeLists.txt +4 -0
  426. package/shared/BabylonNative/deps/jsruntimehost-src/Polyfills/TextDecoder/CMakeLists.txt +15 -0
  427. package/shared/BabylonNative/deps/jsruntimehost-src/Polyfills/TextDecoder/Include/Babylon/Polyfills/TextDecoder.h +9 -0
  428. package/shared/BabylonNative/deps/jsruntimehost-src/Polyfills/TextDecoder/README.md +39 -0
  429. package/shared/BabylonNative/deps/jsruntimehost-src/Polyfills/TextDecoder/Source/TextDecoder.cpp +91 -0
  430. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/Foundation.hpp +47 -0
  431. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSArray.hpp +124 -0
  432. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSAutoreleasePool.hpp +83 -0
  433. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSBundle.hpp +374 -0
  434. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSData.hpp +54 -0
  435. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSDate.hpp +53 -0
  436. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSDefines.hpp +45 -0
  437. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSDictionary.hpp +128 -0
  438. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSEnumerator.hpp +78 -0
  439. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSError.hpp +173 -0
  440. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSLock.hpp +118 -0
  441. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSNotification.hpp +110 -0
  442. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSNumber.hpp +501 -0
  443. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSObjCRuntime.hpp +43 -0
  444. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSObject.hpp +302 -0
  445. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSPrivate.hpp +531 -0
  446. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSProcessInfo.hpp +386 -0
  447. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSRange.hpp +83 -0
  448. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSSet.hpp +87 -0
  449. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSSharedPtr.hpp +310 -0
  450. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSString.hpp +255 -0
  451. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSTypes.hpp +51 -0
  452. package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSURL.hpp +90 -0
  453. package/shared/BabylonNative/deps/metal-cpp-src/LICENSE.txt +202 -0
  454. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4AccelerationStructure.hpp +1395 -0
  455. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4Archive.hpp +93 -0
  456. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4ArgumentTable.hpp +187 -0
  457. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4BinaryFunction.hpp +50 -0
  458. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4BinaryFunctionDescriptor.hpp +97 -0
  459. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4CommandAllocator.hpp +100 -0
  460. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4CommandBuffer.hpp +193 -0
  461. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4CommandEncoder.hpp +134 -0
  462. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4CommandQueue.hpp +283 -0
  463. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4CommitFeedback.hpp +62 -0
  464. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4Compiler.hpp +345 -0
  465. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4CompilerTask.hpp +63 -0
  466. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4ComputeCommandEncoder.hpp +300 -0
  467. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4ComputePipeline.hpp +158 -0
  468. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4Counters.hpp +138 -0
  469. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4FunctionDescriptor.hpp +49 -0
  470. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4LibraryDescriptor.hpp +98 -0
  471. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4LibraryFunctionDescriptor.hpp +86 -0
  472. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4LinkingDescriptor.hpp +204 -0
  473. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4MachineLearningCommandEncoder.hpp +66 -0
  474. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4MachineLearningPipeline.hpp +172 -0
  475. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4MeshRenderPipeline.hpp +413 -0
  476. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4PipelineDataSetSerializer.hpp +85 -0
  477. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4PipelineState.hpp +150 -0
  478. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4RenderCommandEncoder.hpp +340 -0
  479. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4RenderPass.hpp +280 -0
  480. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4RenderPipeline.hpp +587 -0
  481. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4SpecializedFunctionDescriptor.hpp +100 -0
  482. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4StitchedFunctionDescriptor.hpp +86 -0
  483. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4TileRenderPipeline.hpp +173 -0
  484. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLAccelerationStructure.hpp +1887 -0
  485. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLAccelerationStructureCommandEncoder.hpp +260 -0
  486. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLAccelerationStructureTypes.hpp +292 -0
  487. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLAllocation.hpp +40 -0
  488. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLArgument.hpp +787 -0
  489. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLArgumentEncoder.hpp +235 -0
  490. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLBinaryArchive.hpp +152 -0
  491. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLBlitCommandEncoder.hpp +226 -0
  492. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLBlitPass.hpp +154 -0
  493. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLBuffer.hpp +119 -0
  494. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLCaptureManager.hpp +217 -0
  495. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLCaptureScope.hpp +91 -0
  496. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLCommandBuffer.hpp +464 -0
  497. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLCommandEncoder.hpp +117 -0
  498. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLCommandQueue.hpp +158 -0
  499. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLComputeCommandEncoder.hpp +324 -0
  500. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLComputePass.hpp +169 -0
  501. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLComputePipeline.hpp +439 -0
  502. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLCounters.hpp +243 -0
  503. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLDataType.hpp +129 -0
  504. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLDefines.hpp +41 -0
  505. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLDepthStencil.hpp +277 -0
  506. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLDevice.hpp +1493 -0
  507. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLDrawable.hpp +90 -0
  508. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLDynamicLibrary.hpp +78 -0
  509. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLEvent.hpp +170 -0
  510. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLFence.hpp +55 -0
  511. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLFunctionConstantValues.hpp +76 -0
  512. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLFunctionDescriptor.hpp +153 -0
  513. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLFunctionHandle.hpp +65 -0
  514. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLFunctionLog.hpp +101 -0
  515. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLFunctionStitching.hpp +319 -0
  516. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLGPUAddress.hpp +36 -0
  517. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLHeaderBridge.hpp +3120 -0
  518. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLHeap.hpp +318 -0
  519. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLIOCommandBuffer.hpp +182 -0
  520. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLIOCommandQueue.hpp +211 -0
  521. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLIOCompressor.hpp +94 -0
  522. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLIndirectCommandBuffer.hpp +376 -0
  523. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLIndirectCommandEncoder.hpp +272 -0
  524. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLIntersectionFunctionTable.hpp +173 -0
  525. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLLibrary.hpp +786 -0
  526. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLLinkedFunctions.hpp +110 -0
  527. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLLogState.hpp +111 -0
  528. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLParallelRenderCommandEncoder.hpp +83 -0
  529. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLPipeline.hpp +104 -0
  530. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLPixelFormat.hpp +173 -0
  531. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLPrivate.hpp +156 -0
  532. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLRasterizationRate.hpp +337 -0
  533. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLRenderCommandEncoder.hpp +1019 -0
  534. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLRenderPass.hpp +792 -0
  535. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLRenderPipeline.hpp +1876 -0
  536. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLResidencySet.hpp +178 -0
  537. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLResource.hpp +190 -0
  538. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLResourceStateCommandEncoder.hpp +98 -0
  539. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLResourceStatePass.hpp +154 -0
  540. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLResourceViewPool.hpp +118 -0
  541. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLSampler.hpp +345 -0
  542. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLStageInputOutputDescriptor.hpp +356 -0
  543. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLTensor.hpp +297 -0
  544. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLTexture.hpp +803 -0
  545. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLTextureViewPool.hpp +59 -0
  546. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLTypes.hpp +164 -0
  547. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLVersion.hpp +32 -0
  548. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLVertexDescriptor.hpp +326 -0
  549. package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLVisibleFunctionTable.hpp +96 -0
  550. package/shared/BabylonNative/deps/metal-cpp-src/Metal/Metal.hpp +120 -0
  551. package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTL4FXFrameInterpolator.hpp +47 -0
  552. package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTL4FXSpatialScaler.hpp +49 -0
  553. package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTL4FXTemporalDenoisedScaler.hpp +49 -0
  554. package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTL4FXTemporalScaler.hpp +49 -0
  555. package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTLFXDefines.hpp +41 -0
  556. package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTLFXFrameInterpolator.hpp +719 -0
  557. package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTLFXPrivate.hpp +482 -0
  558. package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTLFXSpatialScaler.hpp +397 -0
  559. package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTLFXTemporalDenoisedScaler.hpp +1208 -0
  560. package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTLFXTemporalScaler.hpp +803 -0
  561. package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MetalFX.hpp +35 -0
  562. package/shared/BabylonNative/deps/metal-cpp-src/QuartzCore/CADefines.hpp +41 -0
  563. package/shared/BabylonNative/deps/metal-cpp-src/QuartzCore/CAMetalDrawable.hpp +57 -0
  564. package/shared/BabylonNative/deps/metal-cpp-src/QuartzCore/CAMetalLayer.hpp +216 -0
  565. package/shared/BabylonNative/deps/metal-cpp-src/QuartzCore/CAPrivate.hpp +150 -0
  566. package/shared/BabylonNative/deps/metal-cpp-src/QuartzCore/QuartzCore.hpp +28 -0
  567. package/shared/BabylonNative/deps/metal-cpp-src/README.md +313 -0
  568. package/shared/BabylonNative/deps/metal-cpp-src/SingleHeader/MakeSingleHeader.py +271 -0
  569. package/shared/BabylonNative/deps/metal-cpp-src/SingleHeader/Metal.hpp +28735 -0
  570. package/shared/BabylonNative/deps/spirv-cross-src/spirv_hlsl.cpp +173 -222
  571. package/shared/BabylonNative/deps/urllib-src/CMakeLists.txt +6 -7
  572. package/shared/BabylonNative/deps/urllib-src/Source/UrlRequest_Unix.cpp +1 -1
  573. package/shared/BabylonNative.cpp +4 -0
  574. package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/Apple/TestUtilsImpl.mm +0 -57
  575. package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/TestUtilsImplData.h +0 -18
  576. package/shared/BabylonNative/deps/arcana.cpp-src/Source/Android/Arcana.Android.vcxproj +0 -186
  577. package/shared/BabylonNative/deps/arcana.cpp-src/Source/Shared/Arcana.vcxitems +0 -47
  578. package/shared/BabylonNative/deps/arcana.cpp-src/Source/Windows/Arcana.Windows.Reference.vcxitems +0 -30
  579. package/shared/BabylonNative/deps/arcana.cpp-src/Source/Windows/Arcana.Windows.vcxproj +0 -218
  580. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/bounds.cpp +0 -2178
  581. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/bounds.h +0 -448
  582. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_color.bin.h +0 -100
  583. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_color.sc +0 -13
  584. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h +0 -223
  585. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_cubemap.sc +0 -21
  586. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h +0 -256
  587. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_image_swizz.sc +0 -22
  588. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h +0 -308
  589. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_latlong.sc +0 -38
  590. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_texture.bin.h +0 -180
  591. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_texture.sc +0 -16
  592. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_color.bin.h +0 -195
  593. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_color.sc +0 -15
  594. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h +0 -203
  595. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_cubemap.sc +0 -15
  596. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h +0 -205
  597. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_latlong.sc +0 -15
  598. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_texture.bin.h +0 -233
  599. package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_texture.sc +0 -16
@@ -1,2178 +0,0 @@
1
- /*
2
- * Copyright 2011-2020 Branimir Karadzic. All rights reserved.
3
- * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
4
- */
5
-
6
- #include <bx/rng.h>
7
- #include <bx/math.h>
8
- #include "bounds.h"
9
-
10
- using namespace bx;
11
-
12
- Vec3 getCenter(const Aabb& _aabb)
13
- {
14
- return mul(add(_aabb.min, _aabb.max), 0.5f);
15
- }
16
-
17
- Vec3 getExtents(const Aabb& _aabb)
18
- {
19
- return mul(sub(_aabb.max, _aabb.min), 0.5f);
20
- }
21
-
22
- Vec3 getCenter(const Triangle& _triangle)
23
- {
24
- return mul(add(add(_triangle.v0, _triangle.v1), _triangle.v2), 1.0f/3.0f);
25
- }
26
-
27
- void toAabb(Aabb& _outAabb, const Vec3& _extents)
28
- {
29
- _outAabb.min = neg(_extents);
30
- _outAabb.max = _extents;
31
- }
32
-
33
- void toAabb(Aabb& _outAabb, const Vec3& _center, const Vec3& _extents)
34
- {
35
- _outAabb.min = sub(_center, _extents);
36
- _outAabb.max = add(_center, _extents);
37
- }
38
-
39
- void toAabb(Aabb& _outAabb, const Cylinder& _cylinder)
40
- {
41
- // Reference(s):
42
- // - https://web.archive.org/web/20181113055756/http://iquilezles.org/www/articles/diskbbox/diskbbox.htm
43
- //
44
- const Vec3 axis = sub(_cylinder.end, _cylinder.pos);
45
- const Vec3 asq = mul(axis, axis);
46
- const Vec3 nsq = mul(asq, 1.0f/dot(axis, axis) );
47
- const Vec3 tmp = sub(Vec3(1.0f), nsq);
48
-
49
- const float inv = 1.0f/(tmp.x*tmp.y*tmp.z);
50
-
51
- const Vec3 extent =
52
- {
53
- _cylinder.radius * tmp.x * bx::sqrt( (nsq.x + nsq.y * nsq.z) * inv),
54
- _cylinder.radius * tmp.y * bx::sqrt( (nsq.y + nsq.z * nsq.x) * inv),
55
- _cylinder.radius * tmp.z * bx::sqrt( (nsq.z + nsq.x * nsq.y) * inv),
56
- };
57
-
58
- const Vec3 minP = sub(_cylinder.pos, extent);
59
- const Vec3 minE = sub(_cylinder.end, extent);
60
- const Vec3 maxP = add(_cylinder.pos, extent);
61
- const Vec3 maxE = add(_cylinder.end, extent);
62
-
63
- _outAabb.min = min(minP, minE);
64
- _outAabb.max = max(maxP, maxE);
65
- }
66
-
67
- void toAabb(Aabb& _outAabb, const Disk& _disk)
68
- {
69
- // Reference(s):
70
- // - https://web.archive.org/web/20181113055756/http://iquilezles.org/www/articles/diskbbox/diskbbox.htm
71
- //
72
- const Vec3 nsq = mul(_disk.normal, _disk.normal);
73
- const Vec3 one = { 1.0f, 1.0f, 1.0f };
74
- const Vec3 tmp = sub(one, nsq);
75
- const float inv = 1.0f / (tmp.x*tmp.y*tmp.z);
76
-
77
- const Vec3 extent =
78
- {
79
- _disk.radius * tmp.x * bx::sqrt( (nsq.x + nsq.y * nsq.z) * inv),
80
- _disk.radius * tmp.y * bx::sqrt( (nsq.y + nsq.z * nsq.x) * inv),
81
- _disk.radius * tmp.z * bx::sqrt( (nsq.z + nsq.x * nsq.y) * inv),
82
- };
83
-
84
- _outAabb.min = sub(_disk.center, extent);
85
- _outAabb.max = add(_disk.center, extent);
86
- }
87
-
88
- void toAabb(Aabb& _outAabb, const Obb& _obb)
89
- {
90
- Vec3 xyz = { 1.0f, 1.0f, 1.0f };
91
- Vec3 tmp = mul(xyz, _obb.mtx);
92
-
93
- _outAabb.min = tmp;
94
- _outAabb.max = tmp;
95
-
96
- for (uint32_t ii = 1; ii < 8; ++ii)
97
- {
98
- xyz.x = ii & 1 ? -1.0f : 1.0f;
99
- xyz.y = ii & 2 ? -1.0f : 1.0f;
100
- xyz.z = ii & 4 ? -1.0f : 1.0f;
101
- tmp = mul(xyz, _obb.mtx);
102
-
103
- _outAabb.min = min(_outAabb.min, tmp);
104
- _outAabb.max = max(_outAabb.max, tmp);
105
- }
106
- }
107
-
108
- void toAabb(Aabb& _outAabb, const Sphere& _sphere)
109
- {
110
- const float radius = _sphere.radius;
111
- _outAabb.min = sub(_sphere.center, radius);
112
- _outAabb.max = add(_sphere.center, radius);
113
- }
114
-
115
- void toAabb(Aabb& _outAabb, const Triangle& _triangle)
116
- {
117
- _outAabb.min = min(_triangle.v0, _triangle.v1, _triangle.v2);
118
- _outAabb.max = max(_triangle.v0, _triangle.v1, _triangle.v2);
119
- }
120
-
121
- void aabbTransformToObb(Obb& _obb, const Aabb& _aabb, const float* _mtx)
122
- {
123
- toObb(_obb, _aabb);
124
- float result[16];
125
- mtxMul(result, _obb.mtx, _mtx);
126
- memCopy(_obb.mtx, result, sizeof(result) );
127
- }
128
-
129
- void toAabb(Aabb& _outAabb, const void* _vertices, uint32_t _numVertices, uint32_t _stride)
130
- {
131
- Vec3 mn, mx;
132
- uint8_t* vertex = (uint8_t*)_vertices;
133
-
134
- mn = mx = load<Vec3>(vertex);
135
- vertex += _stride;
136
-
137
- for (uint32_t ii = 1; ii < _numVertices; ++ii)
138
- {
139
- const Vec3 pos = load<Vec3>(vertex);
140
- vertex += _stride;
141
-
142
- mn = min(pos, mn);
143
- mx = max(pos, mx);
144
- }
145
-
146
- _outAabb.min = mn;
147
- _outAabb.max = mx;
148
- }
149
-
150
- void toAabb(Aabb& _outAabb, const float* _mtx, const void* _vertices, uint32_t _numVertices, uint32_t _stride)
151
- {
152
- Vec3 mn, mx;
153
- uint8_t* vertex = (uint8_t*)_vertices;
154
- mn = mx = mul(load<Vec3>(vertex), _mtx);
155
-
156
- vertex += _stride;
157
-
158
- for (uint32_t ii = 1; ii < _numVertices; ++ii)
159
- {
160
- Vec3 pos = mul(load<Vec3>(vertex), _mtx);
161
- vertex += _stride;
162
-
163
- mn = min(pos, mn);
164
- mx = max(pos, mx);
165
- }
166
-
167
- _outAabb.min = mn;
168
- _outAabb.max = mx;
169
- }
170
-
171
- float calcAreaAabb(const Aabb& _aabb)
172
- {
173
- const float ww = _aabb.max.x - _aabb.min.x;
174
- const float hh = _aabb.max.y - _aabb.min.y;
175
- const float dd = _aabb.max.z - _aabb.min.z;
176
- return 2.0f * (ww*hh + ww*dd + hh*dd);
177
- }
178
-
179
- void aabbExpand(Aabb& _outAabb, float _factor)
180
- {
181
- _outAabb.min.x -= _factor;
182
- _outAabb.min.y -= _factor;
183
- _outAabb.min.z -= _factor;
184
- _outAabb.max.x += _factor;
185
- _outAabb.max.y += _factor;
186
- _outAabb.max.z += _factor;
187
- }
188
-
189
- void aabbExpand(Aabb& _outAabb, const Vec3& _pos)
190
- {
191
- _outAabb.min = min(_outAabb.min, _pos);
192
- _outAabb.max = max(_outAabb.max, _pos);
193
- }
194
-
195
- void toObb(Obb& _outObb, const Aabb& _aabb)
196
- {
197
- memSet(_outObb.mtx, 0, sizeof(_outObb.mtx) );
198
- _outObb.mtx[ 0] = (_aabb.max.x - _aabb.min.x) * 0.5f;
199
- _outObb.mtx[ 5] = (_aabb.max.y - _aabb.min.y) * 0.5f;
200
- _outObb.mtx[10] = (_aabb.max.z - _aabb.min.z) * 0.5f;
201
- _outObb.mtx[12] = (_aabb.min.x + _aabb.max.x) * 0.5f;
202
- _outObb.mtx[13] = (_aabb.min.y + _aabb.max.y) * 0.5f;
203
- _outObb.mtx[14] = (_aabb.min.z + _aabb.max.z) * 0.5f;
204
- _outObb.mtx[15] = 1.0f;
205
- }
206
-
207
- void calcObb(Obb& _outObb, const void* _vertices, uint32_t _numVertices, uint32_t _stride, uint32_t _steps)
208
- {
209
- Aabb aabb;
210
- toAabb(aabb, _vertices, _numVertices, _stride);
211
- float minArea = calcAreaAabb(aabb);
212
-
213
- Obb best;
214
- toObb(best, aabb);
215
-
216
- float angleStep = float(kPiHalf/_steps);
217
- float ax = 0.0f;
218
- float mtx[16];
219
-
220
- for (uint32_t ii = 0; ii < _steps; ++ii)
221
- {
222
- float ay = 0.0f;
223
-
224
- for (uint32_t jj = 0; jj < _steps; ++jj)
225
- {
226
- float az = 0.0f;
227
-
228
- for (uint32_t kk = 0; kk < _steps; ++kk)
229
- {
230
- mtxRotateXYZ(mtx, ax, ay, az);
231
-
232
- float mtxT[16];
233
- mtxTranspose(mtxT, mtx);
234
- toAabb(aabb, mtxT, _vertices, _numVertices, _stride);
235
-
236
- float area = calcAreaAabb(aabb);
237
- if (area < minArea)
238
- {
239
- minArea = area;
240
- aabbTransformToObb(best, aabb, mtx);
241
- }
242
-
243
- az += angleStep;
244
- }
245
-
246
- ay += angleStep;
247
- }
248
-
249
- ax += angleStep;
250
- }
251
-
252
- memCopy(&_outObb, &best, sizeof(Obb) );
253
- }
254
-
255
- void calcMaxBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _numVertices, uint32_t _stride)
256
- {
257
- Aabb aabb;
258
- toAabb(aabb, _vertices, _numVertices, _stride);
259
-
260
- Vec3 center = getCenter(aabb);
261
-
262
- float maxDistSq = 0.0f;
263
- uint8_t* vertex = (uint8_t*)_vertices;
264
-
265
- for (uint32_t ii = 0; ii < _numVertices; ++ii)
266
- {
267
- const Vec3& pos = load<Vec3>(vertex);
268
- vertex += _stride;
269
-
270
- const Vec3 tmp = sub(pos, center);
271
- const float distSq = dot(tmp, tmp);
272
- maxDistSq = max(distSq, maxDistSq);
273
- }
274
-
275
- _sphere.center = center;
276
- _sphere.radius = bx::sqrt(maxDistSq);
277
- }
278
-
279
- void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _numVertices, uint32_t _stride, float _step)
280
- {
281
- RngMwc rng;
282
-
283
- uint8_t* vertex = (uint8_t*)_vertices;
284
-
285
- Vec3 center;
286
- float* position = (float*)&vertex[0];
287
- center.x = position[0];
288
- center.y = position[1];
289
- center.z = position[2];
290
-
291
- position = (float*)&vertex[1*_stride];
292
- center.x += position[0];
293
- center.y += position[1];
294
- center.z += position[2];
295
-
296
- center.x *= 0.5f;
297
- center.y *= 0.5f;
298
- center.z *= 0.5f;
299
-
300
- float xx = position[0] - center.x;
301
- float yy = position[1] - center.y;
302
- float zz = position[2] - center.z;
303
- float maxDistSq = xx*xx + yy*yy + zz*zz;
304
-
305
- float radiusStep = _step * 0.37f;
306
-
307
- bool done;
308
- do
309
- {
310
- done = true;
311
- for (uint32_t ii = 0, index = rng.gen()%_numVertices; ii < _numVertices; ++ii, index = (index + 1)%_numVertices)
312
- {
313
- position = (float*)&vertex[index*_stride];
314
-
315
- xx = position[0] - center.x;
316
- yy = position[1] - center.y;
317
- zz = position[2] - center.z;
318
- float distSq = xx*xx + yy*yy + zz*zz;
319
-
320
- if (distSq > maxDistSq)
321
- {
322
- done = false;
323
-
324
- center.x += xx * radiusStep;
325
- center.y += yy * radiusStep;
326
- center.z += zz * radiusStep;
327
- maxDistSq = lerp(maxDistSq, distSq, _step);
328
-
329
- break;
330
- }
331
- }
332
-
333
- } while (!done);
334
-
335
- _sphere.center = center;
336
- _sphere.radius = bx::sqrt(maxDistSq);
337
- }
338
-
339
- void buildFrustumPlanes(Plane* _result, const float* _viewProj)
340
- {
341
- const float xw = _viewProj[ 3];
342
- const float yw = _viewProj[ 7];
343
- const float zw = _viewProj[11];
344
- const float ww = _viewProj[15];
345
-
346
- const float xz = _viewProj[ 2];
347
- const float yz = _viewProj[ 6];
348
- const float zz = _viewProj[10];
349
- const float wz = _viewProj[14];
350
-
351
- Plane& near = _result[0];
352
- Plane& far = _result[1];
353
- Plane& left = _result[2];
354
- Plane& right = _result[3];
355
- Plane& top = _result[4];
356
- Plane& bottom = _result[5];
357
-
358
- near.normal.x = xw - xz;
359
- near.normal.y = yw - yz;
360
- near.normal.z = zw - zz;
361
- near.dist = ww - wz;
362
-
363
- far.normal.x = xw + xz;
364
- far.normal.y = yw + yz;
365
- far.normal.z = zw + zz;
366
- far.dist = ww + wz;
367
-
368
- const float xx = _viewProj[ 0];
369
- const float yx = _viewProj[ 4];
370
- const float zx = _viewProj[ 8];
371
- const float wx = _viewProj[12];
372
-
373
- left.normal.x = xw - xx;
374
- left.normal.y = yw - yx;
375
- left.normal.z = zw - zx;
376
- left.dist = ww - wx;
377
-
378
- right.normal.x = xw + xx;
379
- right.normal.y = yw + yx;
380
- right.normal.z = zw + zx;
381
- right.dist = ww + wx;
382
-
383
- const float xy = _viewProj[ 1];
384
- const float yy = _viewProj[ 5];
385
- const float zy = _viewProj[ 9];
386
- const float wy = _viewProj[13];
387
-
388
- top.normal.x = xw + xy;
389
- top.normal.y = yw + yy;
390
- top.normal.z = zw + zy;
391
- top.dist = ww + wy;
392
-
393
- bottom.normal.x = xw - xy;
394
- bottom.normal.y = yw - yy;
395
- bottom.normal.z = zw - zy;
396
- bottom.dist = ww - wy;
397
-
398
- Plane* plane = _result;
399
- for (uint32_t ii = 0; ii < 6; ++ii)
400
- {
401
- const float invLen = 1.0f/length(plane->normal);
402
- plane->normal = normalize(plane->normal);
403
- plane->dist *= invLen;
404
- ++plane;
405
- }
406
- }
407
-
408
- Ray makeRay(float _x, float _y, const float* _invVp)
409
- {
410
- Ray ray;
411
-
412
- const Vec3 near = { _x, _y, 0.0f };
413
- ray.pos = mulH(near, _invVp);
414
-
415
- const Vec3 far = { _x, _y, 1.0f };
416
- Vec3 tmp = mulH(far, _invVp);
417
-
418
- const Vec3 dir = sub(tmp, ray.pos);
419
- ray.dir = normalize(dir);
420
-
421
- return ray;
422
- }
423
-
424
- inline Vec3 getPointAt(const Ray& _ray, float _t)
425
- {
426
- return mad(_ray.dir, _t, _ray.pos);
427
- }
428
-
429
- bool intersect(const Ray& _ray, const Aabb& _aabb, Hit* _hit)
430
- {
431
- const Vec3 invDir = rcp(_ray.dir);
432
- const Vec3 tmp0 = sub(_aabb.min, _ray.pos);
433
- const Vec3 t0 = mul(tmp0, invDir);
434
- const Vec3 tmp1 = sub(_aabb.max, _ray.pos);
435
- const Vec3 t1 = mul(tmp1, invDir);
436
-
437
- const Vec3 mn = min(t0, t1);
438
- const Vec3 mx = max(t0, t1);
439
-
440
- const float tmin = max(mn.x, mn.y, mn.z);
441
- const float tmax = min(mx.x, mx.y, mx.z);
442
-
443
- if (0.0f > tmax
444
- || tmin > tmax)
445
- {
446
- return false;
447
- }
448
-
449
- if (NULL != _hit)
450
- {
451
- _hit->plane.normal.x = float( (t1.x == tmin) - (t0.x == tmin) );
452
- _hit->plane.normal.y = float( (t1.y == tmin) - (t0.y == tmin) );
453
- _hit->plane.normal.z = float( (t1.z == tmin) - (t0.z == tmin) );
454
-
455
- _hit->plane.dist = tmin;
456
- _hit->pos = getPointAt(_ray, tmin);
457
- }
458
-
459
- return true;
460
- }
461
-
462
- static constexpr Aabb kUnitAabb =
463
- {
464
- { -1.0f, -1.0f, -1.0f },
465
- { 1.0f, 1.0f, 1.0f },
466
- };
467
-
468
- bool intersect(const Ray& _ray, const Obb& _obb, Hit* _hit)
469
- {
470
- Aabb aabb;
471
- toAabb(aabb, _obb);
472
-
473
- if (!intersect(_ray, aabb) )
474
- {
475
- return false;
476
- }
477
-
478
- float mtxInv[16];
479
- mtxInverse(mtxInv, _obb.mtx);
480
-
481
- Ray obbRay;
482
- obbRay.pos = mul(_ray.pos, mtxInv);
483
- obbRay.dir = mulXyz0(_ray.dir, mtxInv);
484
-
485
- if (intersect(obbRay, kUnitAabb, _hit) )
486
- {
487
- if (NULL != _hit)
488
- {
489
- _hit->pos = mul(_hit->pos, _obb.mtx);
490
-
491
- const Vec3 tmp = mulXyz0(_hit->plane.normal, _obb.mtx);
492
- _hit->plane.normal = normalize(tmp);
493
- }
494
-
495
- return true;
496
- }
497
-
498
- return false;
499
- }
500
-
501
- bool intersect(const Ray& _ray, const Disk& _disk, Hit* _hit)
502
- {
503
- Plane plane;
504
- plane.normal = _disk.normal;
505
- plane.dist = -dot(_disk.center, _disk.normal);
506
-
507
- Hit tmpHit;
508
- _hit = NULL != _hit ? _hit : &tmpHit;
509
-
510
- if (intersect(_ray, plane, _hit) )
511
- {
512
- const Vec3 tmp = sub(_disk.center, _hit->pos);
513
- return dot(tmp, tmp) <= square(_disk.radius);
514
- }
515
-
516
- return false;
517
- }
518
-
519
- static bool intersect(const Ray& _ray, const Cylinder& _cylinder, bool _capsule, Hit* _hit)
520
- {
521
- Vec3 axis = sub(_cylinder.end, _cylinder.pos);
522
- const Vec3 rc = sub(_ray.pos, _cylinder.pos);
523
- const Vec3 dxa = cross(_ray.dir, axis);
524
-
525
- const float len = length(dxa);
526
- const Vec3 normal = normalize(dxa);
527
- const float dist = bx::abs(dot(rc, normal) );
528
-
529
- if (dist > _cylinder.radius)
530
- {
531
- return false;
532
- }
533
-
534
- Vec3 vo = cross(rc, axis);
535
- const float t0 = -dot(vo, normal) / len;
536
-
537
- vo = normalize(cross(normal, axis) );
538
-
539
- const float rsq = square(_cylinder.radius);
540
- const float ddoto = dot(_ray.dir, vo);
541
- const float ss = t0 - bx::abs(bx::sqrt(rsq - square(dist) ) / ddoto);
542
-
543
- if (0.0f > ss)
544
- {
545
- return false;
546
- }
547
-
548
- const Vec3 point = getPointAt(_ray, ss);
549
-
550
- const float axisLen = length(axis);
551
- axis = normalize(axis);
552
- const float pdota = dot(_cylinder.pos, axis);
553
- const float height = dot(point, axis) - pdota;
554
-
555
- if (0.0f < height
556
- && axisLen > height)
557
- {
558
- if (NULL != _hit)
559
- {
560
- const float t1 = height / axisLen;
561
- const Vec3 pointOnAxis = lerp(_cylinder.pos, _cylinder.end, t1);
562
-
563
- _hit->pos = point;
564
-
565
- const Vec3 tmp = sub(point, pointOnAxis);
566
- _hit->plane.normal = normalize(tmp);
567
-
568
- _hit->plane.dist = ss;
569
- }
570
-
571
- return true;
572
- }
573
-
574
- if (_capsule)
575
- {
576
- const float rdota = dot(_ray.pos, axis);
577
- const float pp = rdota - pdota;
578
- const float t1 = pp / axisLen;
579
-
580
- const Vec3 pointOnAxis = lerp(_cylinder.pos, _cylinder.end, t1);
581
- const Vec3 axisToRay = sub(_ray.pos, pointOnAxis);
582
-
583
- if (_cylinder.radius < length(axisToRay)
584
- && 0.0f > ss)
585
- {
586
- return false;
587
- }
588
-
589
- Sphere sphere;
590
- sphere.radius = _cylinder.radius;
591
-
592
- sphere.center = 0.0f >= height
593
- ? _cylinder.pos
594
- : _cylinder.end
595
- ;
596
-
597
- return intersect(_ray, sphere, _hit);
598
- }
599
-
600
- Plane plane;
601
- Vec3 pos;
602
-
603
- if (0.0f >= height)
604
- {
605
- plane.normal = neg(axis);
606
- pos = _cylinder.pos;
607
- }
608
- else
609
- {
610
- plane.normal = axis;
611
- pos = _cylinder.end;
612
- }
613
-
614
- plane.dist = -dot(pos, plane.normal);
615
-
616
- Hit tmpHit;
617
- _hit = NULL != _hit ? _hit : &tmpHit;
618
-
619
- if (intersect(_ray, plane, _hit) )
620
- {
621
- const Vec3 tmp = sub(pos, _hit->pos);
622
- return dot(tmp, tmp) <= rsq;
623
- }
624
-
625
- return false;
626
- }
627
-
628
- bool intersect(const Ray& _ray, const Cylinder& _cylinder, Hit* _hit)
629
- {
630
- return intersect(_ray, _cylinder, false, _hit);
631
- }
632
-
633
- bool intersect(const Ray& _ray, const Capsule& _capsule, Hit* _hit)
634
- {
635
- BX_STATIC_ASSERT(sizeof(Capsule) == sizeof(Cylinder) );
636
- return intersect(_ray, *( (const Cylinder*)&_capsule), true, _hit);
637
- }
638
-
639
- bool intersect(const Ray& _ray, const Cone& _cone, Hit* _hit)
640
- {
641
- const Vec3 axis = sub(_cone.pos, _cone.end);
642
-
643
- const float len = length(axis);
644
- const Vec3 normal = normalize(axis);
645
-
646
- Disk disk;
647
- disk.center = _cone.pos;
648
- disk.normal = normal;
649
- disk.radius = _cone.radius;
650
-
651
- Hit tmpInt;
652
- Hit* out = NULL != _hit ? _hit : &tmpInt;
653
- bool hit = intersect(_ray, disk, out);
654
-
655
- const Vec3 ro = sub(_ray.pos, _cone.end);
656
-
657
- const float hyp = bx::sqrt(square(_cone.radius) + square(len) );
658
- const float cosaSq = square(len/hyp);
659
- const float ndoto = dot(normal, ro);
660
- const float ndotd = dot(normal, _ray.dir);
661
-
662
- const float aa = square(ndotd) - cosaSq;
663
- const float bb = 2.0f * (ndotd*ndoto - dot(_ray.dir, ro)*cosaSq);
664
- const float cc = square(ndoto) - dot(ro, ro)*cosaSq;
665
-
666
- float det = bb*bb - 4.0f*aa*cc;
667
-
668
- if (0.0f > det)
669
- {
670
- return hit;
671
- }
672
-
673
- det = bx::sqrt(det);
674
- const float invA2 = 1.0f / (2.0f*aa);
675
- const float t1 = (-bb - det) * invA2;
676
- const float t2 = (-bb + det) * invA2;
677
-
678
- float tt = t1;
679
- if (0.0f > t1
680
- || (0.0f < t2 && t2 < t1) )
681
- {
682
- tt = t2;
683
- }
684
-
685
- if (0.0f > tt)
686
- {
687
- return hit;
688
- }
689
-
690
- const Vec3 hitPos = getPointAt(_ray, tt);
691
- const Vec3 point = sub(hitPos, _cone.end);
692
-
693
- const float hh = dot(normal, point);
694
-
695
- if (0.0f > hh
696
- || len < hh)
697
- {
698
- return hit;
699
- }
700
-
701
- if (NULL != _hit)
702
- {
703
- if (!hit
704
- || tt < _hit->plane.dist)
705
- {
706
- _hit->plane.dist = tt;
707
- _hit->pos = hitPos;
708
-
709
- const float scale = hh / dot(point, point);
710
- const Vec3 pointScaled = mul(point, scale);
711
-
712
- const Vec3 tmp = sub(pointScaled, normal);
713
- _hit->plane.normal = normalize(tmp);
714
- }
715
- }
716
-
717
- return true;
718
- }
719
-
720
- bool intersect(const Ray& _ray, const Plane& _plane, Hit* _hit)
721
- {
722
- const float dist = distance(_plane, _ray.pos);
723
- if (0.0f > dist)
724
- {
725
- return false;
726
- }
727
-
728
- const float ndotd = dot(_ray.dir, _plane.normal);
729
- if (0.0f < ndotd)
730
- {
731
- return false;
732
- }
733
-
734
- if (NULL != _hit)
735
- {
736
- _hit->plane.normal = _plane.normal;
737
-
738
- float tt = -dist/ndotd;
739
- _hit->plane.dist = tt;
740
- _hit->pos = getPointAt(_ray, tt);
741
- }
742
-
743
- return true;
744
- }
745
-
746
- bool intersect(const Ray& _ray, const Sphere& _sphere, Hit* _hit)
747
- {
748
- const Vec3 rs = sub(_ray.pos, _sphere.center);
749
-
750
- const float bb = dot(rs, _ray.dir);
751
- if (0.0f < bb)
752
- {
753
- return false;
754
- }
755
-
756
- const float aa = dot(_ray.dir, _ray.dir);
757
- const float cc = dot(rs, rs) - square(_sphere.radius);
758
-
759
- const float discriminant = bb*bb - aa*cc;
760
-
761
- if (0.0f >= discriminant)
762
- {
763
- return false;
764
- }
765
-
766
- const float sqrtDiscriminant = bx::sqrt(discriminant);
767
- const float invA = 1.0f / aa;
768
- const float tt = -(bb + sqrtDiscriminant)*invA;
769
-
770
- if (0.0f >= tt)
771
- {
772
- return false;
773
- }
774
-
775
- if (NULL != _hit)
776
- {
777
- _hit->plane.dist = tt;
778
-
779
- const Vec3 point = getPointAt(_ray, tt);
780
- _hit->pos = point;
781
-
782
- const Vec3 tmp = sub(point, _sphere.center);
783
- _hit->plane.normal = normalize(tmp);
784
- }
785
-
786
- return true;
787
- }
788
-
789
- bool intersect(const Ray& _ray, const Triangle& _triangle, Hit* _hit)
790
- {
791
- const Vec3 edge10 = sub(_triangle.v1, _triangle.v0);
792
- const Vec3 edge02 = sub(_triangle.v0, _triangle.v2);
793
- const Vec3 normal = cross(edge02, edge10);
794
- const Vec3 vo = sub(_triangle.v0, _ray.pos);
795
- const Vec3 dxo = cross(_ray.dir, vo);
796
- const float det = dot(normal, _ray.dir);
797
-
798
- if (0.0f < det)
799
- {
800
- return false;
801
- }
802
-
803
- const float invDet = 1.0f/det;
804
- const float bz = dot(dxo, edge02) * invDet;
805
- const float by = dot(dxo, edge10) * invDet;
806
- const float bx = 1.0f - by - bz;
807
-
808
- if (0.0f > bx
809
- || 0.0f > by
810
- || 0.0f > bz)
811
- {
812
- return false;
813
- }
814
-
815
- if (NULL != _hit)
816
- {
817
- _hit->plane.normal = normalize(normal);
818
-
819
- const float tt = dot(normal, vo) * invDet;
820
- _hit->plane.dist = tt;
821
- _hit->pos = getPointAt(_ray, tt);
822
- }
823
-
824
- return true;
825
- }
826
-
827
- Vec3 barycentric(const Triangle& _triangle, const Vec3& _pos)
828
- {
829
- const Vec3 v0 = sub(_triangle.v1, _triangle.v0);
830
- const Vec3 v1 = sub(_triangle.v2, _triangle.v0);
831
- const Vec3 v2 = sub(_pos, _triangle.v0);
832
-
833
- const float dot00 = dot(v0, v0);
834
- const float dot01 = dot(v0, v1);
835
- const float dot02 = dot(v0, v2);
836
- const float dot11 = dot(v1, v1);
837
- const float dot12 = dot(v1, v2);
838
-
839
- const float invDenom = 1.0f/(dot00*dot11 - square(dot01) );
840
-
841
- const float vv = (dot11*dot02 - dot01*dot12)*invDenom;
842
- const float ww = (dot00*dot12 - dot01*dot02)*invDenom;
843
- const float uu = 1.0f - vv - ww;
844
-
845
- return { uu, vv, ww };
846
- }
847
-
848
- Vec3 cartesian(const Triangle& _triangle, const Vec3& _uvw)
849
- {
850
- const Vec3 b0 = mul(_triangle.v0, _uvw.x);
851
- const Vec3 b1 = mul(_triangle.v1, _uvw.y);
852
- const Vec3 b2 = mul(_triangle.v2, _uvw.z);
853
-
854
- return add(add(b0, b1), b2);
855
- }
856
-
857
- void calcPlane(Plane& _outPlane, const Disk& _disk)
858
- {
859
- calcPlane(_outPlane, _disk.normal, _disk.center);
860
- }
861
-
862
- void calcPlane(Plane& _outPlane, const Triangle& _triangle)
863
- {
864
- calcPlane(_outPlane, _triangle.v0, _triangle.v1, _triangle.v2);
865
- }
866
-
867
- struct Interval
868
- {
869
- float start;
870
- float end;
871
- };
872
-
873
- bool overlap(const Interval& _a, const Interval& _b)
874
- {
875
- return _a.end > _b.start
876
- && _b.end > _a.start
877
- ;
878
- }
879
-
880
- float projectToAxis(const Vec3& _axis, const Vec3& _point)
881
- {
882
- return dot(_axis, _point);
883
- }
884
-
885
- Interval projectToAxis(const Vec3& _axis, const Aabb& _aabb)
886
- {
887
- const float extent = bx::abs(dot(abs(_axis), getExtents(_aabb) ) );
888
- const float center = dot( _axis , getCenter (_aabb) );
889
- return
890
- {
891
- center - extent,
892
- center + extent,
893
- };
894
- }
895
-
896
- Interval projectToAxis(const Vec3& _axis, const Triangle& _triangle)
897
- {
898
- const float a0 = dot(_axis, _triangle.v0);
899
- const float a1 = dot(_axis, _triangle.v1);
900
- const float a2 = dot(_axis, _triangle.v2);
901
- return
902
- {
903
- min(a0, a1, a2),
904
- max(a0, a1, a2),
905
- };
906
- }
907
-
908
- struct Srt
909
- {
910
- Quaternion rotation;
911
- Vec3 translation;
912
- Vec3 scale;
913
- };
914
-
915
- Srt toSrt(const void* _mtx)
916
- {
917
- Srt result;
918
-
919
- const float* mtx = (const float*)_mtx;
920
-
921
- result.translation = { mtx[12], mtx[13], mtx[14] };
922
-
923
- float xx = mtx[ 0];
924
- float xy = mtx[ 1];
925
- float xz = mtx[ 2];
926
- float yx = mtx[ 4];
927
- float yy = mtx[ 5];
928
- float yz = mtx[ 6];
929
- float zx = mtx[ 8];
930
- float zy = mtx[ 9];
931
- float zz = mtx[10];
932
-
933
- result.scale =
934
- {
935
- bx::sqrt(xx*xx + xy*xy + xz*xz),
936
- bx::sqrt(yx*yx + yy*yy + yz*yz),
937
- bx::sqrt(zx*zx + zy*zy + zz*zz),
938
- };
939
-
940
- const Vec3 invScale = rcp(result.scale);
941
-
942
- xx *= invScale.x;
943
- xy *= invScale.x;
944
- xz *= invScale.x;
945
- yx *= invScale.y;
946
- yy *= invScale.y;
947
- yz *= invScale.y;
948
- zx *= invScale.z;
949
- zy *= invScale.z;
950
- zz *= invScale.z;
951
-
952
- const float trace = xx + yy + zz;
953
-
954
- if (0.0f < trace)
955
- {
956
- const float invS = 0.5f * rsqrt(trace + 1.0f);
957
- result.rotation =
958
- {
959
- (yz - zy) * invS,
960
- (zx - xz) * invS,
961
- (xy - yx) * invS,
962
- 0.25f / invS,
963
- };
964
- }
965
- else
966
- {
967
- if (xx > yy
968
- && xx > zz)
969
- {
970
- const float invS = 0.5f * bx::sqrt(max(1.0f + xx - yy - zz, 1e-8f) );
971
- result.rotation =
972
- {
973
- 0.25f / invS,
974
- (xy + yx) * invS,
975
- (xz + zx) * invS,
976
- (yz - zy) * invS,
977
- };
978
- }
979
- else if (yy > zz)
980
- {
981
- const float invS = 0.5f * bx::sqrt(max(1.0f + yy - xx - zz, 1e-8f) );
982
- result.rotation =
983
- {
984
- (xy + yx) * invS,
985
- 0.25f / invS,
986
- (yz + zy) * invS,
987
- (zx - xz) * invS,
988
- };
989
- }
990
- else
991
- {
992
- const float invS = 0.5f * bx::sqrt(max(1.0f + zz - xx - yy, 1e-8f) );
993
- result.rotation =
994
- {
995
- (xz + zx) * invS,
996
- (yz + zy) * invS,
997
- 0.25f / invS,
998
- (xy - yx) * invS,
999
- };
1000
- }
1001
- }
1002
-
1003
- return result;
1004
- }
1005
-
1006
- void mtxFromSrt(float* _outMtx, const Srt& _srt)
1007
- {
1008
- mtxQuat(_outMtx, _srt.rotation);
1009
-
1010
- store<Vec3>(&_outMtx[0], mul(load<Vec3>(&_outMtx[0]), _srt.scale.x) );
1011
- store<Vec3>(&_outMtx[4], mul(load<Vec3>(&_outMtx[4]), _srt.scale.y) );
1012
- store<Vec3>(&_outMtx[8], mul(load<Vec3>(&_outMtx[8]), _srt.scale.z) );
1013
-
1014
- store<Vec3>(&_outMtx[12], _srt.translation);
1015
- }
1016
-
1017
- bool isNearZero(float _v)
1018
- {
1019
- return equal(_v, 0.0f, 0.00001f);
1020
- }
1021
-
1022
- bool isNearZero(const Vec3& _v)
1023
- {
1024
- return isNearZero(dot(_v, _v) );
1025
- }
1026
-
1027
- struct Line
1028
- {
1029
- Vec3 pos;
1030
- Vec3 dir;
1031
- };
1032
-
1033
- inline Vec3 getPointAt(const Line& _line, float _t)
1034
- {
1035
- return mad(_line.dir, _t, _line.pos);
1036
- }
1037
-
1038
- bool intersect(Line& _outLine, const Plane& _planeA, const Plane& _planeB)
1039
- {
1040
- const Vec3 axb = cross(_planeA.normal, _planeB.normal);
1041
- const float denom = dot(axb, axb);
1042
-
1043
- if (isNearZero(denom) )
1044
- {
1045
- return false;
1046
- }
1047
-
1048
- const Vec3 bxaxb = cross(_planeB.normal, axb);
1049
- const Vec3 axbxa = cross(axb, _planeA.normal);
1050
- const Vec3 tmp0 = mul(bxaxb, _planeA.dist);
1051
- const Vec3 tmp1 = mul(axbxa, _planeB.dist);
1052
- const Vec3 tmp2 = add(tmp0, tmp1);
1053
-
1054
- _outLine.pos = mul(tmp2, -1.0f/denom);
1055
- _outLine.dir = normalize(axb);
1056
-
1057
- return true;
1058
- }
1059
-
1060
- Vec3 intersectPlanes(const Plane& _pa, const Plane& _pb, const Plane& _pc)
1061
- {
1062
- const Vec3 axb = cross(_pa.normal, _pb.normal);
1063
- const Vec3 bxc = cross(_pb.normal, _pc.normal);
1064
- const Vec3 cxa = cross(_pc.normal, _pa.normal);
1065
- const Vec3 tmp0 = mul(bxc, _pa.dist);
1066
- const Vec3 tmp1 = mul(cxa, _pb.dist);
1067
- const Vec3 tmp2 = mul(axb, _pc.dist);
1068
- const Vec3 tmp3 = add(tmp0, tmp1);
1069
- const Vec3 tmp4 = add(tmp3, tmp2);
1070
-
1071
- const float denom = dot(_pa.normal, bxc);
1072
- const Vec3 result = mul(tmp4, -1.0f/denom);
1073
-
1074
- return result;
1075
- }
1076
-
1077
- struct LineSegment
1078
- {
1079
- Vec3 pos;
1080
- Vec3 end;
1081
- };
1082
-
1083
- inline Vec3 getPointAt(const LineSegment& _line, float _t)
1084
- {
1085
- return lerp(_line.pos, _line.end, _t);
1086
- }
1087
-
1088
- bool intersect(float& _outTa, float& _outTb, const LineSegment& _a, const LineSegment& _b)
1089
- {
1090
- // Reference(s):
1091
- //
1092
- // - The shortest line between two lines in 3D
1093
- // https://web.archive.org/web/20120309093234/http://paulbourke.net/geometry/lineline3d/
1094
-
1095
- const Vec3 bd = sub(_b.end, _b.pos);
1096
- if (isNearZero(bd) )
1097
- {
1098
- return false;
1099
- }
1100
-
1101
- const Vec3 ad = sub(_a.end, _a.pos);
1102
- if (isNearZero(ad) )
1103
- {
1104
- return false;
1105
- }
1106
-
1107
- const Vec3 ab = sub(_a.pos, _b.pos);
1108
-
1109
- const float d0 = projectToAxis(ab, bd);
1110
- const float d1 = projectToAxis(ad, bd);
1111
- const float d2 = projectToAxis(ab, ad);
1112
- const float d3 = projectToAxis(bd, bd);
1113
- const float d4 = projectToAxis(ad, ad);
1114
-
1115
- const float denom = d4*d3 - square(d1);
1116
-
1117
- float ta = 0.0f;
1118
-
1119
- if (!isNearZero(denom) )
1120
- {
1121
- ta = (d0*d1 - d2*d3)/denom;
1122
- }
1123
-
1124
- _outTa = ta;
1125
- _outTb = (d0+d1*ta)/d3;
1126
-
1127
- return true;
1128
- }
1129
-
1130
- bool intersect(const LineSegment& _a, const LineSegment& _b)
1131
- {
1132
- float ta, tb;
1133
- if (!intersect(ta, tb, _a, _b) )
1134
- {
1135
- return false;
1136
- }
1137
-
1138
- return 0.0f >= ta
1139
- && 1.0f <= ta
1140
- && 0.0f >= tb
1141
- && 1.0f <= tb
1142
- ;
1143
- }
1144
-
1145
- bool intersect(const LineSegment& _line, const Plane& _plane, Hit* _hit)
1146
- {
1147
- const float dist = distance(_plane, _line.pos);
1148
- const float flip = sign(dist);
1149
- const Vec3 dir = normalize(sub(_line.end, _line.pos) );
1150
- const float ndotd = dot(dir, _plane.normal);
1151
- const float tt = -dist/ndotd;
1152
- const float len = length(sub(_line.end, _line.pos) );
1153
-
1154
- if (tt < 0.0f || tt > len)
1155
- {
1156
- return false;
1157
- }
1158
-
1159
- if (NULL != _hit)
1160
- {
1161
- _hit->pos = mad(dir, tt, _line.pos);
1162
-
1163
- _hit->plane.normal = mul(_plane.normal, flip);
1164
- _hit->plane.dist = -dot(_hit->plane.normal, _hit->pos);
1165
- }
1166
-
1167
- return true;
1168
- }
1169
-
1170
- float distance(const Plane& _plane, const LineSegment& _line)
1171
- {
1172
- const float pd = distance(_plane, _line.pos);
1173
- const float ed = distance(_plane, _line.end);
1174
- return min(max(pd*ed, 0.0f), bx::abs(pd), bx::abs(ed) );
1175
- }
1176
-
1177
- Vec3 closestPoint(const Line& _line, const Vec3& _point)
1178
- {
1179
- const float tt = projectToAxis(_line.dir, sub(_point, _line.pos) );
1180
- return getPointAt(_line, tt);
1181
- }
1182
-
1183
- Vec3 closestPoint(const LineSegment& _line, const Vec3& _point, float& _outT)
1184
- {
1185
- const Vec3 axis = sub(_line.end, _line.pos);
1186
- const float lengthSq = dot(axis, axis);
1187
- const float tt = clamp(projectToAxis(axis, sub(_point, _line.pos) ) / lengthSq, 0.0f, 1.0f);
1188
- _outT = tt;
1189
- return mad(axis, tt, _line.pos);
1190
- }
1191
-
1192
- Vec3 closestPoint(const LineSegment& _line, const Vec3& _point)
1193
- {
1194
- float ignored;
1195
- return closestPoint(_line, _point, ignored);
1196
- }
1197
-
1198
- Vec3 closestPoint(const Plane& _plane, const Vec3& _point)
1199
- {
1200
- const float dist = distance(_plane, _point);
1201
- return sub(_point, mul(_plane.normal, dist) );
1202
- }
1203
-
1204
- Vec3 closestPoint(const Aabb& _aabb, const Vec3& _point)
1205
- {
1206
- return clamp(_point, _aabb.min, _aabb.max);
1207
- }
1208
-
1209
- Vec3 closestPoint(const Obb& _obb, const Vec3& _point)
1210
- {
1211
- Srt srt = toSrt(_obb.mtx);
1212
-
1213
- Aabb aabb;
1214
- toAabb(aabb, srt.scale);
1215
-
1216
- const Quaternion invRotation = invert(srt.rotation);
1217
- const Vec3 obbSpacePos = mul(sub(_point, srt.translation), srt.rotation);
1218
- const Vec3 pos = closestPoint(aabb, obbSpacePos);
1219
-
1220
- return add(mul(pos, invRotation), srt.translation);
1221
- }
1222
-
1223
- Vec3 closestPoint(const Triangle& _triangle, const Vec3& _point)
1224
- {
1225
- Plane plane;
1226
- calcPlane(plane, _triangle);
1227
-
1228
- const Vec3 pos = closestPoint(plane, _point);
1229
- const Vec3 uvw = barycentric(_triangle, pos);
1230
-
1231
- return cartesian(_triangle, clamp<Vec3>(uvw, Vec3(0.0f), Vec3(1.0f) ) );
1232
- }
1233
-
1234
- bool overlap(const Aabb& _aabb, const Vec3& _pos)
1235
- {
1236
- const Vec3 ac = getCenter(_aabb);
1237
- const Vec3 ae = getExtents(_aabb);
1238
- const Vec3 abc = bx::abs(sub(ac, _pos) );
1239
-
1240
- return abc.x <= ae.x
1241
- && abc.y <= ae.y
1242
- && abc.z <= ae.z
1243
- ;
1244
- }
1245
-
1246
- bool overlap(const Aabb& _aabb, const Sphere& _sphere)
1247
- {
1248
- return overlap(_sphere, _aabb);
1249
- }
1250
-
1251
- bool overlap(const Aabb& _aabbA, const Aabb& _aabbB)
1252
- {
1253
- return true
1254
- && _aabbA.max.x > _aabbB.min.x
1255
- && _aabbB.max.x > _aabbA.min.x
1256
- && _aabbA.max.y > _aabbB.min.y
1257
- && _aabbB.max.y > _aabbA.min.y
1258
- && _aabbA.max.z > _aabbB.min.z
1259
- && _aabbB.max.z > _aabbA.min.z
1260
- ;
1261
- }
1262
-
1263
- bool overlap(const Aabb& _aabb, const Plane& _plane)
1264
- {
1265
- const Vec3 center = getCenter(_aabb);
1266
- const float dist = distance(_plane, center);
1267
-
1268
- const Vec3 extents = getExtents(_aabb);
1269
- const Vec3 normal = bx::abs(_plane.normal);
1270
- const float radius = dot(extents, normal);
1271
-
1272
- return bx::abs(dist) <= radius;
1273
- }
1274
-
1275
- static constexpr Vec3 kAxis[] =
1276
- {
1277
- { 1.0f, 0.0f, 0.0f },
1278
- { 0.0f, 1.0f, 0.0f },
1279
- { 0.0f, 0.0f, 1.0f },
1280
- };
1281
-
1282
- bool overlap(const Aabb& _aabb, const Triangle& _triangle)
1283
- {
1284
- Aabb triAabb;
1285
- toAabb(triAabb, _triangle);
1286
-
1287
- if (!overlap(_aabb, triAabb) )
1288
- {
1289
- return false;
1290
- }
1291
-
1292
- Plane plane;
1293
- calcPlane(plane, _triangle);
1294
-
1295
- if (!overlap(_aabb, plane) )
1296
- {
1297
- return false;
1298
- }
1299
-
1300
- const Vec3 center = getCenter(_aabb);
1301
- const Vec3 v0 = sub(_triangle.v0, center);
1302
- const Vec3 v1 = sub(_triangle.v1, center);
1303
- const Vec3 v2 = sub(_triangle.v2, center);
1304
-
1305
- const Vec3 edge[] =
1306
- {
1307
- sub(v1, v0),
1308
- sub(v2, v1),
1309
- sub(v0, v2),
1310
- };
1311
-
1312
- for (uint32_t ii = 0; ii < 3; ++ii)
1313
- {
1314
- for (uint32_t jj = 0; jj < 3; ++jj)
1315
- {
1316
- const Vec3 axis = cross(kAxis[ii], edge[jj]);
1317
-
1318
- const Interval aabbR = projectToAxis(axis, _aabb);
1319
- const Interval triR = projectToAxis(axis, _triangle);
1320
-
1321
- if (!overlap(aabbR, triR) )
1322
- {
1323
- return false;
1324
- }
1325
- }
1326
- }
1327
-
1328
- return true;
1329
- }
1330
-
1331
- bool overlap(const Aabb& _aabb, const Cylinder& _cylinder)
1332
- {
1333
- return overlap(_cylinder, _aabb);
1334
- }
1335
-
1336
- bool overlap(const Aabb& _aabb, const Capsule& _capsule)
1337
- {
1338
- const Vec3 pos = closestPoint(LineSegment{_capsule.pos, _capsule.end}, getCenter(_aabb) );
1339
- return overlap(_aabb, Sphere{pos, _capsule.radius});
1340
- }
1341
-
1342
- bool overlap(const Aabb& _aabb, const Cone& _cone)
1343
- {
1344
- float tt;
1345
- const Vec3 pos = closestPoint(LineSegment{_cone.pos, _cone.end}, getCenter(_aabb), tt);
1346
- return overlap(_aabb, Sphere{pos, lerp(_cone.radius, 0.0f, tt)});
1347
- }
1348
-
1349
- bool overlap(const Aabb& _aabb, const Disk& _disk)
1350
- {
1351
- if (!overlap(_aabb, Sphere{_disk.center, _disk.radius}) )
1352
- {
1353
- return false;
1354
- }
1355
-
1356
- Plane plane;
1357
- calcPlane(plane, _disk.normal, _disk.center);
1358
-
1359
- return overlap(_aabb, plane);
1360
- }
1361
-
1362
- bool overlap(const Aabb& _aabb, const Obb& _obb)
1363
- {
1364
- BX_UNUSED(_aabb, _obb);
1365
- return false;
1366
- }
1367
-
1368
- bool overlap(const Capsule& _capsule, const Vec3& _pos)
1369
- {
1370
- const Vec3 pos = closestPoint(LineSegment{_capsule.pos, _capsule.end}, _pos);
1371
- return overlap(Sphere{pos, _capsule.radius}, _pos);
1372
- }
1373
-
1374
- bool overlap(const Capsule& _capsule, const Sphere& _sphere)
1375
- {
1376
- return overlap(_sphere, _capsule);
1377
- }
1378
-
1379
- bool overlap(const Capsule& _capsule, const Aabb& _aabb)
1380
- {
1381
- return overlap(_aabb, _capsule);
1382
- }
1383
-
1384
- bool overlap(const Capsule& _capsule, const Plane& _plane)
1385
- {
1386
- return distance(_plane, LineSegment{_capsule.pos, _capsule.end}) <= _capsule.radius;
1387
- }
1388
-
1389
- bool overlap(const Capsule& _capsule, const Triangle& _triangle)
1390
- {
1391
- return overlap(_triangle, _capsule);
1392
- }
1393
-
1394
- bool overlap(const Capsule& _capsule, const Cylinder& _cylinder)
1395
- {
1396
- return overlap(_cylinder, _capsule);
1397
- }
1398
-
1399
- bool overlap(const Capsule& _capsuleA, const Capsule& _capsuleB)
1400
- {
1401
- float ta, tb;
1402
- if (!intersect(ta, tb, {_capsuleA.pos, _capsuleA.end}, {_capsuleB.pos, _capsuleB.end}) )
1403
- {
1404
- return false;
1405
- }
1406
-
1407
- if (0.0f <= ta
1408
- && 1.0f >= ta
1409
- && 0.0f <= tb
1410
- && 1.0f >= tb)
1411
- {
1412
- const Vec3 ad = sub(_capsuleA.end, _capsuleA.pos);
1413
- const Vec3 bd = sub(_capsuleB.end, _capsuleB.pos);
1414
-
1415
- return overlap(
1416
- Sphere{mad(ad, ta, _capsuleA.pos), _capsuleA.radius}
1417
- , Sphere{mad(bd, tb, _capsuleB.pos), _capsuleB.radius}
1418
- );
1419
- }
1420
-
1421
- if (0.0f <= ta
1422
- && 1.0f >= ta)
1423
- {
1424
- return overlap(_capsuleA, Sphere{0.0f >= tb ? _capsuleB.pos : _capsuleB.end, _capsuleB.radius});
1425
- }
1426
-
1427
- if (0.0f <= tb
1428
- && 1.0f >= tb)
1429
- {
1430
- return overlap(_capsuleB, Sphere{0.0f >= ta ? _capsuleA.pos : _capsuleA.end, _capsuleA.radius});
1431
- }
1432
-
1433
- const Vec3 pa = 0.0f > ta ? _capsuleA.pos : _capsuleA.end;
1434
- const Vec3 pb = 0.0f > tb ? _capsuleB.pos : _capsuleB.end;
1435
- const Vec3 closestA = closestPoint(LineSegment{_capsuleA.pos, _capsuleA.end}, pb);
1436
- const Vec3 closestB = closestPoint(LineSegment{_capsuleB.pos, _capsuleB.end}, pa);
1437
-
1438
- if (dot(closestA, pb) <= dot(closestB, pa) )
1439
- {
1440
- return overlap(_capsuleA, Sphere{closestB, _capsuleB.radius});
1441
- }
1442
-
1443
- return overlap(_capsuleB, Sphere{closestA, _capsuleA.radius});
1444
- }
1445
-
1446
- bool overlap(const Capsule& _capsule, const Cone& _cone)
1447
- {
1448
- BX_UNUSED(_capsule, _cone);
1449
- return false;
1450
- }
1451
-
1452
- bool overlap(const Capsule& _capsule, const Disk& _disk)
1453
- {
1454
- return overlap(_disk, _capsule);
1455
- }
1456
-
1457
- bool overlap(const Capsule& _capsule, const Obb& _obb)
1458
- {
1459
- return overlap(_obb, _capsule);
1460
- }
1461
-
1462
- bool overlap(const Cone& _cone, const Vec3& _pos)
1463
- {
1464
- float tt;
1465
- const Vec3 pos = closestPoint(LineSegment{_cone.pos, _cone.end}, _pos, tt);
1466
- return overlap(Disk{pos, normalize(sub(_cone.end, _cone.pos) ), lerp(_cone.radius, 0.0f, tt)}, _pos);
1467
- }
1468
-
1469
- bool overlap(const Cone& _cone, const Sphere& _sphere)
1470
- {
1471
- return overlap(_sphere, _cone);
1472
- }
1473
-
1474
- bool overlap(const Cone& _cone, const Aabb& _aabb)
1475
- {
1476
- return overlap(_aabb, _cone);
1477
- }
1478
-
1479
- bool overlap(const Cone& _cone, const Plane& _plane)
1480
- {
1481
- return overlap(_plane, _cone);
1482
- }
1483
-
1484
- bool overlap(const Cone& _cone, const Triangle& _triangle)
1485
- {
1486
- return overlap(_triangle, _cone);
1487
- }
1488
-
1489
- bool overlap(const Cone& _cone, const Cylinder& _cylinder)
1490
- {
1491
- BX_UNUSED(_cone, _cylinder);
1492
- return false;
1493
- }
1494
-
1495
- bool overlap(const Cone& _cone, const Capsule& _capsule)
1496
- {
1497
- BX_UNUSED(_cone, _capsule);
1498
- return false;
1499
- }
1500
-
1501
- bool overlap(const Cone& _coneA, const Cone& _coneB)
1502
- {
1503
- BX_UNUSED(_coneA, _coneB);
1504
- return false;
1505
- }
1506
-
1507
- bool overlap(const Cone& _cone, const Disk& _disk)
1508
- {
1509
- BX_UNUSED(_cone, _disk);
1510
- return false;
1511
- }
1512
-
1513
- bool overlap(const Cone& _cone, const Obb& _obb)
1514
- {
1515
- BX_UNUSED(_cone, _obb);
1516
- return false;
1517
- }
1518
-
1519
- bool overlap(const Cylinder& _cylinder, const Vec3& _pos)
1520
- {
1521
- const Vec3 pos = closestPoint(LineSegment{_cylinder.pos, _cylinder.end}, _pos);
1522
- return overlap(Disk{pos, normalize(sub(_cylinder.end, _cylinder.pos) ), _cylinder.radius}, _pos);
1523
- }
1524
-
1525
- bool overlap(const Cylinder& _cylinder, const Sphere& _sphere)
1526
- {
1527
- const Vec3 pos = closestPoint(LineSegment{_cylinder.pos, _cylinder.end}, _sphere.center);
1528
- return overlap(Disk{pos, normalize(sub(_cylinder.end, _cylinder.pos) ), _cylinder.radius}, _sphere);
1529
- }
1530
-
1531
- bool overlap(const Cylinder& _cylinder, const Aabb& _aabb)
1532
- {
1533
- const Vec3 pos = closestPoint(LineSegment{_cylinder.pos, _cylinder.end}, getCenter(_aabb) );
1534
- return overlap(Disk{pos, normalize(sub(_cylinder.end, _cylinder.pos) ), _cylinder.radius}, _aabb);
1535
- }
1536
-
1537
- bool overlap(const Cylinder& _cylinder, const Plane& _plane)
1538
- {
1539
- BX_UNUSED(_cylinder, _plane);
1540
- return false;
1541
- }
1542
-
1543
- bool overlap(const Cylinder& _cylinder, const Triangle& _triangle)
1544
- {
1545
- return overlap(_triangle, _cylinder);
1546
- }
1547
-
1548
- bool overlap(const Cylinder& _cylinderA, const Cylinder& _cylinderB)
1549
- {
1550
- BX_UNUSED(_cylinderA, _cylinderB);
1551
- return false;
1552
- }
1553
-
1554
- bool overlap(const Cylinder& _cylinder, const Capsule& _capsule)
1555
- {
1556
- BX_UNUSED(_cylinder, _capsule);
1557
- return false;
1558
- }
1559
-
1560
- bool overlap(const Cylinder& _cylinder, const Cone& _cone)
1561
- {
1562
- BX_UNUSED(_cylinder, _cone);
1563
- return false;
1564
- }
1565
-
1566
- bool overlap(const Cylinder& _cylinder, const Disk& _disk)
1567
- {
1568
- BX_UNUSED(_cylinder, _disk);
1569
- return false;
1570
- }
1571
-
1572
- bool overlap(const Cylinder& _cylinder, const Obb& _obb)
1573
- {
1574
- BX_UNUSED(_cylinder, _obb);
1575
- return false;
1576
- }
1577
-
1578
- bool overlap(const Disk& _disk, const Vec3& _pos)
1579
- {
1580
- Plane plane;
1581
- calcPlane(plane, _disk.normal, _disk.center);
1582
-
1583
- if (!isNearZero(distance(plane, _pos) ) )
1584
- {
1585
- return false;
1586
- }
1587
-
1588
- return distanceSq(_disk.center, _pos) <= square(_disk.radius);
1589
- }
1590
-
1591
- bool overlap(const Disk& _disk, const Sphere& _sphere)
1592
- {
1593
- return overlap(_sphere, _disk);
1594
- }
1595
-
1596
- bool overlap(const Disk& _disk, const Aabb& _aabb)
1597
- {
1598
- return overlap(_aabb, _disk);
1599
- }
1600
-
1601
- bool overlap(const Disk& _disk, const Plane& _plane)
1602
- {
1603
- Plane plane;
1604
- calcPlane(plane, _disk.normal, _disk.center);
1605
-
1606
- if (!overlap(plane, _plane) )
1607
- {
1608
- return false;
1609
- }
1610
-
1611
- return overlap(_plane, Sphere{_disk.center, _disk.radius});
1612
- }
1613
-
1614
- bool overlap(const Disk& _disk, const Triangle& _triangle)
1615
- {
1616
- return overlap(_triangle, _disk);
1617
- }
1618
-
1619
- bool overlap(const Disk& _disk, const Cylinder& _cylinder)
1620
- {
1621
- return overlap(_cylinder, _disk);
1622
- }
1623
-
1624
- bool overlap(const Disk& _disk, const Capsule& _capsule)
1625
- {
1626
- if (!overlap(_capsule, Sphere{_disk.center, _disk.radius}) )
1627
- {
1628
- return false;
1629
- }
1630
-
1631
- Plane plane;
1632
- calcPlane(plane, _disk.normal, _disk.center);
1633
-
1634
- return overlap(_capsule, plane);
1635
- }
1636
-
1637
- bool overlap(const Disk& _disk, const Cone& _cone)
1638
- {
1639
- BX_UNUSED(_disk, _cone);
1640
- return false;
1641
- }
1642
-
1643
- bool overlap(const Disk& _diskA, const Disk& _diskB)
1644
- {
1645
- Plane planeA;
1646
- calcPlane(planeA, _diskA.normal, _diskA.center);
1647
-
1648
- Plane planeB;
1649
- calcPlane(planeB, _diskB);
1650
-
1651
- Line line;
1652
-
1653
- if (!intersect(line, planeA, planeB) )
1654
- {
1655
- return false;
1656
- }
1657
-
1658
- const Vec3 pa = closestPoint(line, _diskA.center);
1659
- const Vec3 pb = closestPoint(line, _diskB.center);
1660
-
1661
- const float lenA = distance(pa, _diskA.center);
1662
- const float lenB = distance(pb, _diskB.center);
1663
-
1664
- return bx::sqrt(square(_diskA.radius) - square(lenA) )
1665
- + bx::sqrt(square(_diskB.radius) - square(lenB) )
1666
- >= distance(pa, pb)
1667
- ;
1668
- }
1669
-
1670
- bool overlap(const Disk& _disk, const Obb& _obb)
1671
- {
1672
- if (!overlap(_obb, Sphere{_disk.center, _disk.radius}) )
1673
- {
1674
- return false;
1675
- }
1676
-
1677
- Plane plane;
1678
- calcPlane(plane, _disk.normal, _disk.center);
1679
-
1680
- return overlap(_obb, plane);
1681
- }
1682
-
1683
- bool overlap(const Obb& _obb, const Vec3& _pos)
1684
- {
1685
- Srt srt = toSrt(_obb.mtx);
1686
-
1687
- Aabb aabb;
1688
- toAabb(aabb, srt.scale);
1689
-
1690
- const Quaternion invRotation = invert(srt.rotation);
1691
- const Vec3 pos = mul(sub(_pos, srt.translation), invRotation);
1692
-
1693
- return overlap(aabb, pos);
1694
- }
1695
-
1696
- bool overlap(const Obb& _obb, const Sphere& _sphere)
1697
- {
1698
- return overlap(_sphere, _obb);
1699
- }
1700
-
1701
- bool overlap(const Obb& _obb, const Aabb& _aabb)
1702
- {
1703
- return overlap(_aabb, _obb);
1704
- }
1705
-
1706
- bool overlap(const Obb& _obb, const Plane& _plane)
1707
- {
1708
- Srt srt = toSrt(_obb.mtx);
1709
-
1710
- const Quaternion invRotation = invert(srt.rotation);
1711
- const Vec3 axis =
1712
- {
1713
- projectToAxis(_plane.normal, mul(Vec3{1.0f, 0.0f, 0.0f}, invRotation) ),
1714
- projectToAxis(_plane.normal, mul(Vec3{0.0f, 1.0f, 0.0f}, invRotation) ),
1715
- projectToAxis(_plane.normal, mul(Vec3{0.0f, 0.0f, 1.0f}, invRotation) ),
1716
- };
1717
-
1718
- const float dist = bx::abs(distance(_plane, srt.translation) );
1719
- const float radius = dot(srt.scale, bx::abs(axis) );
1720
-
1721
- return dist <= radius;
1722
- }
1723
-
1724
- bool overlap(const Obb& _obb, const Triangle& _triangle)
1725
- {
1726
- return overlap(_triangle, _obb);
1727
- }
1728
-
1729
- bool overlap(const Obb& _obb, const Cylinder& _cylinder)
1730
- {
1731
- BX_UNUSED(_obb, _cylinder);
1732
- return false;
1733
- }
1734
-
1735
- bool overlap(const Obb& _obb, const Capsule& _capsule)
1736
- {
1737
- Srt srt = toSrt(_obb.mtx);
1738
-
1739
- Aabb aabb;
1740
- toAabb(aabb, srt.scale);
1741
-
1742
- const Quaternion invRotation = invert(srt.rotation);
1743
-
1744
- const Capsule capsule =
1745
- {
1746
- mul(sub(_capsule.pos, srt.translation), invRotation),
1747
- mul(sub(_capsule.end, srt.translation), invRotation),
1748
- _capsule.radius,
1749
- };
1750
-
1751
- return overlap(aabb, capsule);
1752
- }
1753
-
1754
- bool overlap(const Obb& _obb, const Cone& _cone)
1755
- {
1756
- BX_UNUSED(_obb, _cone);
1757
- return false;
1758
- }
1759
-
1760
- bool overlap(const Obb& _obb, const Disk& _disk)
1761
- {
1762
- return overlap(_disk, _obb);
1763
- }
1764
-
1765
- bool overlap(const Obb& _obbA, const Obb& _obbB)
1766
- {
1767
- BX_UNUSED(_obbA, _obbB);
1768
- return false;
1769
- }
1770
-
1771
- bool overlap(const Plane& _plane, const LineSegment& _line)
1772
- {
1773
- return isNearZero(distance(_plane, _line) );
1774
- }
1775
-
1776
- bool overlap(const Plane& _plane, const Vec3& _pos)
1777
- {
1778
- return isNearZero(distance(_plane, _pos) );
1779
- }
1780
-
1781
- bool overlap(const Plane& _plane, const Sphere& _sphere)
1782
- {
1783
- return overlap(_sphere, _plane);
1784
- }
1785
-
1786
- bool overlap(const Plane& _plane, const Aabb& _aabb)
1787
- {
1788
- return overlap(_aabb, _plane);
1789
- }
1790
-
1791
- bool overlap(const Plane& _planeA, const Plane& _planeB)
1792
- {
1793
- const Vec3 dir = cross(_planeA.normal, _planeB.normal);
1794
- const float len = length(dir);
1795
-
1796
- return !isNearZero(len);
1797
- }
1798
-
1799
- bool overlap(const Plane& _plane, const Triangle& _triangle)
1800
- {
1801
- return overlap(_triangle, _plane);
1802
- }
1803
-
1804
- bool overlap(const Plane& _plane, const Cylinder& _cylinder)
1805
- {
1806
- return overlap(_cylinder, _plane);
1807
- }
1808
-
1809
- bool overlap(const Plane& _plane, const Capsule& _capsule)
1810
- {
1811
- return overlap(_capsule, _plane);
1812
- }
1813
-
1814
- bool overlap(const Plane& _plane, const Cone& _cone)
1815
- {
1816
- const Vec3 axis = sub(_cone.pos, _cone.end);
1817
- const float len = length(axis);
1818
- const Vec3 dir = normalize(axis);
1819
-
1820
- const Vec3 v1 = cross(_plane.normal, dir);
1821
- const Vec3 v2 = cross(v1, dir);
1822
-
1823
- const float bb = len;
1824
- const float aa = _cone.radius;
1825
- const float cc = bx::sqrt(square(aa) + square(bb) );
1826
-
1827
- const Vec3 pos = add(add(_cone.end
1828
- , mul(dir, len * bb/cc) )
1829
- , mul(v2, len * aa/cc)
1830
- );
1831
-
1832
- return overlap(_plane, LineSegment{pos, _cone.end});
1833
- }
1834
-
1835
- bool overlap(const Plane& _plane, const Disk& _disk)
1836
- {
1837
- return overlap(_disk, _plane);
1838
- }
1839
-
1840
- bool overlap(const Plane& _plane, const Obb& _obb)
1841
- {
1842
- return overlap(_obb, _plane);
1843
- }
1844
-
1845
- bool overlap(const Sphere& _sphere, const Vec3& _pos)
1846
- {
1847
- const float distSq = distanceSq(_sphere.center, _pos);
1848
- const float radiusSq = square(_sphere.radius);
1849
- return distSq <= radiusSq;
1850
- }
1851
-
1852
- bool overlap(const Sphere& _sphereA, const Sphere& _sphereB)
1853
- {
1854
- const float distSq = distanceSq(_sphereA.center, _sphereB.center);
1855
- const float radiusSq = square(_sphereA.radius + _sphereB.radius);
1856
- return distSq <= radiusSq;
1857
- }
1858
-
1859
- bool overlap(const Sphere& _sphere, const Aabb& _aabb)
1860
- {
1861
- const Vec3 pos = closestPoint(_aabb, _sphere.center);
1862
- return overlap(_sphere, pos);
1863
- }
1864
-
1865
- bool overlap(const Sphere& _sphere, const Plane& _plane)
1866
- {
1867
- return bx::abs(distance(_plane, _sphere.center) ) <= _sphere.radius;
1868
- }
1869
-
1870
- bool overlap(const Sphere& _sphere, const Triangle& _triangle)
1871
- {
1872
- Plane plane;
1873
- calcPlane(plane, _triangle);
1874
-
1875
- if (!overlap(_sphere, plane) )
1876
- {
1877
- return false;
1878
- }
1879
-
1880
- const Vec3 pos = closestPoint(plane, _sphere.center);
1881
- const Vec3 uvw = barycentric(_triangle, pos);
1882
- const float nr = -_sphere.radius;
1883
-
1884
- return uvw.x >= nr
1885
- && uvw.y >= nr
1886
- && uvw.z >= nr
1887
- ;
1888
- }
1889
-
1890
- bool overlap(const Sphere& _sphere, const Cylinder& _cylinder)
1891
- {
1892
- return overlap(_cylinder, _sphere);
1893
- }
1894
-
1895
- bool overlap(const Sphere& _sphere, const Capsule& _capsule)
1896
- {
1897
- const Vec3 pos = closestPoint(LineSegment{_capsule.pos, _capsule.end}, _sphere.center);
1898
- return overlap(_sphere, Sphere{pos, _capsule.radius});
1899
- }
1900
-
1901
- bool overlap(const Sphere& _sphere, const Cone& _cone)
1902
- {
1903
- float tt;
1904
- const Vec3 pos = closestPoint(LineSegment{_cone.pos, _cone.end}, _sphere.center, tt);
1905
- return overlap(_sphere, Sphere{pos, lerp(_cone.radius, 0.0f, tt)});
1906
- }
1907
-
1908
- bool overlap(const Sphere& _sphere, const Disk& _disk)
1909
- {
1910
- if (!overlap(_sphere, Sphere{_disk.center, _disk.radius}) )
1911
- {
1912
- return false;
1913
- }
1914
-
1915
- Plane plane;
1916
- calcPlane(plane, _disk.normal, _disk.center);
1917
-
1918
- return overlap(_sphere, plane);
1919
- }
1920
-
1921
- bool overlap(const Sphere& _sphere, const Obb& _obb)
1922
- {
1923
- const Vec3 pos = closestPoint(_obb, _sphere.center);
1924
- return overlap(_sphere, pos);
1925
- }
1926
-
1927
- bool overlap(const Triangle& _triangle, const Vec3& _pos)
1928
- {
1929
- const Vec3 uvw = barycentric(_triangle, _pos);
1930
-
1931
- return uvw.x >= 0.0f
1932
- && uvw.y >= 0.0f
1933
- && uvw.z >= 0.0f
1934
- ;
1935
- }
1936
-
1937
- bool overlap(const Triangle& _triangle, const Sphere& _sphere)
1938
- {
1939
- return overlap(_sphere, _triangle);
1940
- }
1941
-
1942
- bool overlap(const Triangle& _triangle, const Aabb& _aabb)
1943
- {
1944
- return overlap(_aabb, _triangle);
1945
- }
1946
-
1947
- bool overlap(const Triangle& _triangle, const Plane& _plane)
1948
- {
1949
- const float dist0 = distance(_plane, _triangle.v0);
1950
- const float dist1 = distance(_plane, _triangle.v1);
1951
- const float dist2 = distance(_plane, _triangle.v2);
1952
-
1953
- const float minDist = min(dist0, dist1, dist2);
1954
- const float maxDist = max(dist0, dist1, dist2);
1955
-
1956
- return 0.0f > minDist
1957
- && 0.0f < maxDist
1958
- ;
1959
- }
1960
-
1961
- inline bool overlap(const Triangle& _triangleA, const Triangle& _triangleB, const Vec3& _axis)
1962
- {
1963
- const Interval ia = projectToAxis(_axis, _triangleA);
1964
- const Interval ib = projectToAxis(_axis, _triangleB);
1965
- return overlap(ia, ib);
1966
- }
1967
-
1968
- bool overlap(const Triangle& _triangleA, const Triangle& _triangleB)
1969
- {
1970
- const Vec3 baA = sub(_triangleA.v1, _triangleA.v0);
1971
- const Vec3 cbA = sub(_triangleA.v2, _triangleA.v1);
1972
- const Vec3 acA = sub(_triangleA.v0, _triangleA.v2);
1973
-
1974
- const Vec3 baB = sub(_triangleB.v1, _triangleB.v0);
1975
- const Vec3 cbB = sub(_triangleB.v2, _triangleB.v1);
1976
- const Vec3 acB = sub(_triangleB.v0, _triangleB.v2);
1977
-
1978
- return overlap(_triangleA, _triangleB, cross(baA, cbA) )
1979
- && overlap(_triangleA, _triangleB, cross(baB, cbB) )
1980
- && overlap(_triangleA, _triangleB, cross(baB, baA) )
1981
- && overlap(_triangleA, _triangleB, cross(baB, cbA) )
1982
- && overlap(_triangleA, _triangleB, cross(baB, acA) )
1983
- && overlap(_triangleA, _triangleB, cross(cbB, baA) )
1984
- && overlap(_triangleA, _triangleB, cross(cbB, cbA) )
1985
- && overlap(_triangleA, _triangleB, cross(cbB, acA) )
1986
- && overlap(_triangleA, _triangleB, cross(acB, baA) )
1987
- && overlap(_triangleA, _triangleB, cross(acB, cbA) )
1988
- && overlap(_triangleA, _triangleB, cross(acB, acA) )
1989
- ;
1990
- }
1991
-
1992
- template<typename Ty>
1993
- bool overlap(const Triangle& _triangle, const Ty& _ty)
1994
- {
1995
- Plane plane;
1996
- calcPlane(plane, _triangle);
1997
-
1998
- plane.normal = neg(plane.normal);
1999
- plane.dist = -plane.dist;
2000
-
2001
- const LineSegment line =
2002
- {
2003
- _ty.pos,
2004
- _ty.end,
2005
- };
2006
-
2007
- Hit hit;
2008
- if (intersect(line, plane, &hit) )
2009
- {
2010
- return true;
2011
- }
2012
-
2013
- const Vec3 pos = closestPoint(plane, hit.pos);
2014
- const Vec3 uvw = barycentric(_triangle, pos);
2015
-
2016
- const float nr = -_ty.radius;
2017
-
2018
- if (uvw.x >= nr
2019
- && uvw.y >= nr
2020
- && uvw.z >= nr)
2021
- {
2022
- return true;
2023
- }
2024
-
2025
- const LineSegment ab = LineSegment{_triangle.v0, _triangle.v1};
2026
- const LineSegment bc = LineSegment{_triangle.v1, _triangle.v2};
2027
- const LineSegment ca = LineSegment{_triangle.v2, _triangle.v0};
2028
-
2029
- float ta0 = 0.0f, tb0 = 0.0f;
2030
- const bool i0 = intersect(ta0, tb0, ab, line);
2031
-
2032
- float ta1, tb1;
2033
- const bool i1 = intersect(ta1, tb1, bc, line);
2034
-
2035
- float ta2, tb2;
2036
- const bool i2 = intersect(ta2, tb2, ca, line);
2037
-
2038
- if (!i0
2039
- || !i1
2040
- || !i2)
2041
- {
2042
- return false;
2043
- }
2044
-
2045
- ta0 = clamp(ta0, 0.0f, 1.0f);
2046
- ta1 = clamp(ta1, 0.0f, 1.0f);
2047
- ta2 = clamp(ta2, 0.0f, 1.0f);
2048
- tb0 = clamp(tb0, 0.0f, 1.0f);
2049
- tb1 = clamp(tb1, 0.0f, 1.0f);
2050
- tb2 = clamp(tb2, 0.0f, 1.0f);
2051
-
2052
- const Vec3 pa0 = getPointAt(ab, ta0);
2053
- const Vec3 pa1 = getPointAt(bc, ta1);
2054
- const Vec3 pa2 = getPointAt(ca, ta2);
2055
-
2056
- const Vec3 pb0 = getPointAt(line, tb0);
2057
- const Vec3 pb1 = getPointAt(line, tb1);
2058
- const Vec3 pb2 = getPointAt(line, tb2);
2059
-
2060
- const float d0 = distanceSq(pa0, pb0);
2061
- const float d1 = distanceSq(pa1, pb1);
2062
- const float d2 = distanceSq(pa2, pb2);
2063
-
2064
- if (d0 <= d1
2065
- && d0 <= d2)
2066
- {
2067
- return overlap(_ty, pa0);
2068
- }
2069
- else if (d1 <= d2)
2070
- {
2071
- return overlap(_ty, pa1);
2072
- }
2073
-
2074
- return overlap(_ty, pa2);
2075
- }
2076
-
2077
- bool overlap(const Triangle& _triangle, const Cylinder& _cylinder)
2078
- {
2079
- return overlap<Cylinder>(_triangle, _cylinder);
2080
- }
2081
-
2082
- bool overlap(const Triangle& _triangle, const Capsule& _capsule)
2083
- {
2084
- return overlap<Capsule>(_triangle, _capsule);
2085
- }
2086
-
2087
- bool overlap(const Triangle& _triangle, const Cone& _cone)
2088
- {
2089
- const LineSegment ab = LineSegment{_triangle.v0, _triangle.v1};
2090
- const LineSegment bc = LineSegment{_triangle.v1, _triangle.v2};
2091
- const LineSegment ca = LineSegment{_triangle.v2, _triangle.v0};
2092
-
2093
- const LineSegment line =
2094
- {
2095
- _cone.pos,
2096
- _cone.end,
2097
- };
2098
-
2099
- float ta0 = 0.0f, tb0 = 0.0f;
2100
- const bool i0 = intersect(ta0, tb0, ab, line);
2101
-
2102
- float ta1, tb1;
2103
- const bool i1 = intersect(ta1, tb1, bc, line);
2104
-
2105
- float ta2, tb2;
2106
- const bool i2 = intersect(ta2, tb2, ca, line);
2107
-
2108
- if (!i0
2109
- || !i1
2110
- || !i2)
2111
- {
2112
- return false;
2113
- }
2114
-
2115
- ta0 = clamp(ta0, 0.0f, 1.0f);
2116
- ta1 = clamp(ta1, 0.0f, 1.0f);
2117
- ta2 = clamp(ta2, 0.0f, 1.0f);
2118
- tb0 = clamp(tb0, 0.0f, 1.0f);
2119
- tb1 = clamp(tb1, 0.0f, 1.0f);
2120
- tb2 = clamp(tb2, 0.0f, 1.0f);
2121
-
2122
- const Vec3 pa0 = getPointAt(ab, ta0);
2123
- const Vec3 pa1 = getPointAt(bc, ta1);
2124
- const Vec3 pa2 = getPointAt(ca, ta2);
2125
-
2126
- const Vec3 pb0 = getPointAt(line, tb0);
2127
- const Vec3 pb1 = getPointAt(line, tb1);
2128
- const Vec3 pb2 = getPointAt(line, tb2);
2129
-
2130
- const float d0 = distanceSq(pa0, pb0);
2131
- const float d1 = distanceSq(pa1, pb1);
2132
- const float d2 = distanceSq(pa2, pb2);
2133
-
2134
- if (d0 <= d1
2135
- && d0 <= d2)
2136
- {
2137
- return overlap(_cone, pa0);
2138
- }
2139
- else if (d1 <= d2)
2140
- {
2141
- return overlap(_cone, pa1);
2142
- }
2143
-
2144
- return overlap(_cone, pa2);
2145
- }
2146
-
2147
- bool overlap(const Triangle& _triangle, const Disk& _disk)
2148
- {
2149
- if (!overlap(_triangle, Sphere{_disk.center, _disk.radius}) )
2150
- {
2151
- return false;
2152
- }
2153
-
2154
- Plane plane;
2155
- calcPlane(plane, _disk.normal, _disk.center);
2156
-
2157
- return overlap(_triangle, plane);
2158
- }
2159
-
2160
- bool overlap(const Triangle& _triangle, const Obb& _obb)
2161
- {
2162
- Srt srt = toSrt(_obb.mtx);
2163
-
2164
- Aabb aabb;
2165
- toAabb(aabb, srt.scale);
2166
-
2167
- const Quaternion invRotation = invert(srt.rotation);
2168
-
2169
- const Triangle triangle =
2170
- {
2171
- mul(sub(_triangle.v0, srt.translation), invRotation),
2172
- mul(sub(_triangle.v1, srt.translation), invRotation),
2173
- mul(sub(_triangle.v2, srt.translation), invRotation),
2174
- };
2175
-
2176
- return overlap(triangle, aabb);
2177
- }
2178
-