@babylonjs/core 6.47.0 → 6.48.0

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 (67) hide show
  1. package/Buffers/buffer.align.d.ts +3 -3
  2. package/Buffers/buffer.align.js +1 -1
  3. package/Buffers/buffer.align.js.map +1 -1
  4. package/Engines/Native/nativeInterfaces.d.ts +1 -0
  5. package/Engines/Native/nativeInterfaces.js.map +1 -1
  6. package/Engines/engine.js +9 -9
  7. package/Engines/engine.js.map +1 -1
  8. package/Engines/engineFeatures.d.ts +2 -2
  9. package/Engines/engineFeatures.js.map +1 -1
  10. package/Engines/nativeEngine.d.ts +1 -0
  11. package/Engines/nativeEngine.js +21 -1
  12. package/Engines/nativeEngine.js.map +1 -1
  13. package/Engines/nullEngine.js +1 -1
  14. package/Engines/nullEngine.js.map +1 -1
  15. package/Engines/thinEngine.d.ts +5 -3
  16. package/Engines/thinEngine.js +53 -43
  17. package/Engines/thinEngine.js.map +1 -1
  18. package/Engines/webgpuEngine.js +1 -1
  19. package/Engines/webgpuEngine.js.map +1 -1
  20. package/Loading/sceneLoader.js +2 -1
  21. package/Loading/sceneLoader.js.map +1 -1
  22. package/Materials/Node/Blocks/posterizeBlock.js +1 -0
  23. package/Materials/Node/Blocks/posterizeBlock.js.map +1 -1
  24. package/Maths/index.d.ts +1 -0
  25. package/Maths/index.js +1 -0
  26. package/Maths/index.js.map +1 -1
  27. package/Maths/math.vector.functions.d.ts +22 -0
  28. package/Maths/math.vector.functions.js +28 -0
  29. package/Maths/math.vector.functions.js.map +1 -0
  30. package/Meshes/Node/Blocks/debugBlock.d.ts +1 -1
  31. package/Meshes/Node/Blocks/debugBlock.js +16 -2
  32. package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
  33. package/Meshes/Node/Blocks/geometryPosterizeBlock.js +26 -1
  34. package/Meshes/Node/Blocks/geometryPosterizeBlock.js.map +1 -1
  35. package/Meshes/mesh.js +12 -0
  36. package/Meshes/mesh.js.map +1 -1
  37. package/Misc/khronosTextureContainer2Worker.js +1 -1
  38. package/Misc/khronosTextureContainer2Worker.js.map +1 -1
  39. package/NOTICE.md +10 -0
  40. package/Particles/IParticleSystem.d.ts +3 -1
  41. package/Particles/IParticleSystem.js.map +1 -1
  42. package/Particles/particleSystem.d.ts +1 -1
  43. package/Particles/particleSystem.js +17 -1
  44. package/Particles/particleSystem.js.map +1 -1
  45. package/Particles/thinParticleSystem.d.ts +5 -3
  46. package/Particles/thinParticleSystem.js +6 -4
  47. package/Particles/thinParticleSystem.js.map +1 -1
  48. package/Physics/v2/Plugins/havokPlugin.js +3 -1
  49. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  50. package/Physics/v2/physicsBody.d.ts +6 -1
  51. package/Physics/v2/physicsBody.js +7 -0
  52. package/Physics/v2/physicsBody.js.map +1 -1
  53. package/XR/features/WebXRAbstractFeature.d.ts +2 -1
  54. package/XR/features/WebXRAbstractFeature.js +3 -2
  55. package/XR/features/WebXRAbstractFeature.js.map +1 -1
  56. package/XR/features/WebXRControllerPointerSelection.d.ts +10 -0
  57. package/XR/features/WebXRControllerPointerSelection.js +41 -20
  58. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  59. package/XR/features/WebXRControllerTeleportation.d.ts +1 -0
  60. package/XR/features/WebXRControllerTeleportation.js +7 -2
  61. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  62. package/assetContainer.js +1 -1
  63. package/assetContainer.js.map +1 -1
  64. package/assets/Basis/basis_transcoder.js +24 -0
  65. package/assets/Draco/draco_decoder_gltf.js +35 -0
  66. package/assets/Draco/draco_wasm_wrapper_gltf.js +116 -0
  67. package/package.json +3 -3
@@ -46,8 +46,8 @@ export interface EngineFeatures {
46
46
  supportRenderPasses: boolean;
47
47
  /** Indicates that the engine supports sprite instancing */
48
48
  supportSpriteInstancing: boolean;
49
- /** Indicates that the stride of a vertex buffer must always be a multiple of 4 bytes */
50
- forceVertexBufferStrideMultiple4Bytes: boolean;
49
+ /** Indicates that the stride and (byte) offset of a vertex buffer must always be a multiple of 4 bytes */
50
+ forceVertexBufferStrideAndOffsetMultiple4Bytes: boolean;
51
51
  /** @internal */
52
52
  _collectUbosUpdatedInFrame: boolean;
53
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"engineFeatures.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/engineFeatures.ts"],"names":[],"mappings":"","sourcesContent":["/** @internal */\r\nexport interface EngineFeatures {\r\n /** Force using Bitmap when Bitmap or HTMLImageElement can be used */\r\n forceBitmapOverHTMLImageElement: boolean;\r\n\r\n /** Indicates that the engine support rendering to as well as copying to lod float textures */\r\n supportRenderAndCopyToLodForFloatTextures: boolean;\r\n\r\n /** Indicates that the engine support handling depth/stencil textures */\r\n supportDepthStencilTexture: boolean;\r\n\r\n /** Indicates that the engine support shadow samplers */\r\n supportShadowSamplers: boolean;\r\n\r\n /** Indicates to check the matrix bytes per bytes to know if it has changed or not. If false, only the updateFlag of the matrix is checked */\r\n uniformBufferHardCheckMatrix: boolean;\r\n\r\n /** Indicates that prefiltered mipmaps can be generated in some processes (for eg when loading an HDR cube texture) */\r\n allowTexturePrefiltering: boolean;\r\n\r\n /** Indicates to track the usage of ubos and to create new ones as necessary during a frame duration */\r\n trackUbosInFrame: boolean;\r\n\r\n /** Indicates that the current content of a ubo should be compared to the content of the corresponding GPU buffer and the GPU buffer updated only if different. Requires trackUbosInFrame to be true */\r\n checkUbosContentBeforeUpload: boolean;\r\n\r\n /** Indicates that the Cascaded Shadow Map technic is supported */\r\n supportCSM: boolean;\r\n\r\n /** Indicates that the textures transcoded by the basis transcoder must have power of 2 width and height */\r\n basisNeedsPOT: boolean;\r\n\r\n /** Indicates that the engine supports 3D textures */\r\n support3DTextures: boolean;\r\n\r\n /** Indicates that constants need a type suffix in shaders (used by realtime filtering...) */\r\n needTypeSuffixInShaderConstants: boolean;\r\n\r\n /** Indicates that MSAA is supported */\r\n supportMSAA: boolean;\r\n\r\n /** Indicates that SSAO2 is supported */\r\n supportSSAO2: boolean;\r\n\r\n /** Indicates that some additional texture formats are supported (like TEXTUREFORMAT_R for eg) */\r\n supportExtendedTextureFormats: boolean;\r\n\r\n /** Indicates that the switch/case construct is supported in shaders */\r\n supportSwitchCaseInShader: boolean;\r\n\r\n /** Indicates that synchronous texture reading is supported */\r\n supportSyncTextureRead: boolean;\r\n\r\n /** Indicates that y should be inverted when dealing with bitmaps (notably in environment tools) */\r\n needsInvertingBitmap: boolean;\r\n\r\n /** Indicates that the engine should cache the bound UBO */\r\n useUBOBindingCache: boolean;\r\n\r\n /** Indicates that the inliner should be run over every shader code */\r\n needShaderCodeInlining: boolean;\r\n\r\n /** Indicates that even if we don't have to update the properties of a uniform buffer (because of some optimzations in the material) we still need to bind the uniform buffer themselves */\r\n needToAlwaysBindUniformBuffers: boolean;\r\n\r\n /** Indicates that the engine supports render passes */\r\n supportRenderPasses: boolean;\r\n\r\n /** Indicates that the engine supports sprite instancing */\r\n supportSpriteInstancing: boolean;\r\n\r\n /** Indicates that the stride of a vertex buffer must always be a multiple of 4 bytes */\r\n forceVertexBufferStrideMultiple4Bytes: boolean;\r\n\r\n /** @internal */\r\n _collectUbosUpdatedInFrame: boolean;\r\n}\r\n"]}
1
+ {"version":3,"file":"engineFeatures.js","sourceRoot":"","sources":["../../../../dev/core/src/Engines/engineFeatures.ts"],"names":[],"mappings":"","sourcesContent":["/** @internal */\r\nexport interface EngineFeatures {\r\n /** Force using Bitmap when Bitmap or HTMLImageElement can be used */\r\n forceBitmapOverHTMLImageElement: boolean;\r\n\r\n /** Indicates that the engine support rendering to as well as copying to lod float textures */\r\n supportRenderAndCopyToLodForFloatTextures: boolean;\r\n\r\n /** Indicates that the engine support handling depth/stencil textures */\r\n supportDepthStencilTexture: boolean;\r\n\r\n /** Indicates that the engine support shadow samplers */\r\n supportShadowSamplers: boolean;\r\n\r\n /** Indicates to check the matrix bytes per bytes to know if it has changed or not. If false, only the updateFlag of the matrix is checked */\r\n uniformBufferHardCheckMatrix: boolean;\r\n\r\n /** Indicates that prefiltered mipmaps can be generated in some processes (for eg when loading an HDR cube texture) */\r\n allowTexturePrefiltering: boolean;\r\n\r\n /** Indicates to track the usage of ubos and to create new ones as necessary during a frame duration */\r\n trackUbosInFrame: boolean;\r\n\r\n /** Indicates that the current content of a ubo should be compared to the content of the corresponding GPU buffer and the GPU buffer updated only if different. Requires trackUbosInFrame to be true */\r\n checkUbosContentBeforeUpload: boolean;\r\n\r\n /** Indicates that the Cascaded Shadow Map technic is supported */\r\n supportCSM: boolean;\r\n\r\n /** Indicates that the textures transcoded by the basis transcoder must have power of 2 width and height */\r\n basisNeedsPOT: boolean;\r\n\r\n /** Indicates that the engine supports 3D textures */\r\n support3DTextures: boolean;\r\n\r\n /** Indicates that constants need a type suffix in shaders (used by realtime filtering...) */\r\n needTypeSuffixInShaderConstants: boolean;\r\n\r\n /** Indicates that MSAA is supported */\r\n supportMSAA: boolean;\r\n\r\n /** Indicates that SSAO2 is supported */\r\n supportSSAO2: boolean;\r\n\r\n /** Indicates that some additional texture formats are supported (like TEXTUREFORMAT_R for eg) */\r\n supportExtendedTextureFormats: boolean;\r\n\r\n /** Indicates that the switch/case construct is supported in shaders */\r\n supportSwitchCaseInShader: boolean;\r\n\r\n /** Indicates that synchronous texture reading is supported */\r\n supportSyncTextureRead: boolean;\r\n\r\n /** Indicates that y should be inverted when dealing with bitmaps (notably in environment tools) */\r\n needsInvertingBitmap: boolean;\r\n\r\n /** Indicates that the engine should cache the bound UBO */\r\n useUBOBindingCache: boolean;\r\n\r\n /** Indicates that the inliner should be run over every shader code */\r\n needShaderCodeInlining: boolean;\r\n\r\n /** Indicates that even if we don't have to update the properties of a uniform buffer (because of some optimzations in the material) we still need to bind the uniform buffer themselves */\r\n needToAlwaysBindUniformBuffers: boolean;\r\n\r\n /** Indicates that the engine supports render passes */\r\n supportRenderPasses: boolean;\r\n\r\n /** Indicates that the engine supports sprite instancing */\r\n supportSpriteInstancing: boolean;\r\n\r\n /** Indicates that the stride and (byte) offset of a vertex buffer must always be a multiple of 4 bytes */\r\n forceVertexBufferStrideAndOffsetMultiple4Bytes: boolean;\r\n\r\n /** @internal */\r\n _collectUbosUpdatedInFrame: boolean;\r\n}\r\n"]}
@@ -80,6 +80,7 @@ export declare class NativeEngine extends Engine {
80
80
  * @internal
81
81
  */
82
82
  protected _queueNewFrame(bindedRenderFunction: any, requester?: any): number;
83
+ protected _restoreEngineAfterContextLost(): void;
83
84
  /**
84
85
  * Override default engine behavior.
85
86
  * @param framebuffer
@@ -139,6 +139,13 @@ export class NativeEngine extends Engine {
139
139
  if (_native.Engine.PROTOCOL_VERSION !== NativeEngine.PROTOCOL_VERSION) {
140
140
  throw new Error(`Protocol version mismatch: ${_native.Engine.PROTOCOL_VERSION} (Native) !== ${NativeEngine.PROTOCOL_VERSION} (JS)`);
141
141
  }
142
+ if (this._engine.setDeviceLostCallback) {
143
+ this._engine.setDeviceLostCallback(() => {
144
+ this.onContextLostObservable.notifyObservers(this);
145
+ this._contextWasLost = true;
146
+ this._restoreEngineAfterContextLost();
147
+ });
148
+ }
142
149
  this._webGLVersion = 2;
143
150
  this.disableUniformBuffers = true;
144
151
  this._shaderPlatformName = "NATIVE";
@@ -218,7 +225,7 @@ export class NativeEngine extends Engine {
218
225
  needToAlwaysBindUniformBuffers: false,
219
226
  supportRenderPasses: true,
220
227
  supportSpriteInstancing: false,
221
- forceVertexBufferStrideMultiple4Bytes: false,
228
+ forceVertexBufferStrideAndOffsetMultiple4Bytes: false,
222
229
  _collectUbosUpdatedInFrame: false,
223
230
  };
224
231
  Tools.Log("Babylon Native (v" + Engine.Version + ") launched");
@@ -314,6 +321,19 @@ export class NativeEngine extends Engine {
314
321
  }
315
322
  return 0;
316
323
  }
324
+ _restoreEngineAfterContextLost() {
325
+ this._clearEmptyResources();
326
+ const depthTest = this._depthCullingState.depthTest; // backup those values because the call to initEngine / wipeCaches will reset them
327
+ const depthFunc = this._depthCullingState.depthFunc;
328
+ const depthMask = this._depthCullingState.depthMask;
329
+ const stencilTest = this._stencilState.stencilTest;
330
+ this._rebuildGraphicsResources();
331
+ this._depthCullingState.depthTest = depthTest;
332
+ this._depthCullingState.depthFunc = depthFunc;
333
+ this._depthCullingState.depthMask = depthMask;
334
+ this._stencilState.stencilTest = stencilTest;
335
+ this._flagContextRestored();
336
+ }
317
337
  /**
318
338
  * Override default engine behavior.
319
339
  * @param framebuffer