@onerjs/core 8.25.4 → 8.25.6

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 (117) hide show
  1. package/Audio/audioEngine.js +5 -0
  2. package/Audio/audioEngine.js.map +1 -1
  3. package/Engines/Extensions/engine.rawTexture.d.ts +2 -2
  4. package/Engines/Extensions/engine.rawTexture.js +9 -5
  5. package/Engines/Extensions/engine.rawTexture.js.map +1 -1
  6. package/Engines/WebGL/webGLHardwareTexture.d.ts +1 -0
  7. package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
  8. package/Engines/WebGPU/Extensions/engine.rawTexture.d.ts +2 -2
  9. package/Engines/WebGPU/Extensions/engine.rawTexture.js +9 -5
  10. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  11. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  12. package/Engines/abstractEngine.js +2 -2
  13. package/Engines/abstractEngine.js.map +1 -1
  14. package/Engines/constants.d.ts +6 -6
  15. package/Engines/constants.js +6 -6
  16. package/Engines/constants.js.map +1 -1
  17. package/Engines/thinEngine.js +11 -1
  18. package/Engines/thinEngine.js.map +1 -1
  19. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +1 -0
  20. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  21. package/Gizmos/boundingBoxGizmo.js +20 -26
  22. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  23. package/Loading/Plugins/babylonFileLoader.d.ts +11 -0
  24. package/Loading/Plugins/babylonFileLoader.js +25 -12
  25. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  26. package/Materials/Node/nodeMaterial.d.ts +2 -0
  27. package/Materials/Node/nodeMaterial.js +4 -0
  28. package/Materials/Node/nodeMaterial.js.map +1 -1
  29. package/Materials/Textures/envCubeTexture.d.ts +125 -0
  30. package/Materials/Textures/envCubeTexture.js +351 -0
  31. package/Materials/Textures/envCubeTexture.js.map +1 -0
  32. package/Materials/Textures/exrCubeTexture.d.ts +55 -0
  33. package/Materials/Textures/exrCubeTexture.js +83 -0
  34. package/Materials/Textures/exrCubeTexture.js.map +1 -0
  35. package/Materials/Textures/hdrCubeTexture.d.ts +14 -73
  36. package/Materials/Textures/hdrCubeTexture.js +25 -308
  37. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  38. package/Materials/Textures/index.d.ts +2 -0
  39. package/Materials/Textures/index.js +2 -0
  40. package/Materials/Textures/index.js.map +1 -1
  41. package/Materials/effectRenderer.d.ts +3 -1
  42. package/Materials/effectRenderer.js +5 -3
  43. package/Materials/effectRenderer.js.map +1 -1
  44. package/Materials/materialPluginBase.d.ts +1 -0
  45. package/Materials/materialPluginBase.js.map +1 -1
  46. package/Materials/materialPluginManager.js +5 -0
  47. package/Materials/materialPluginManager.js.map +1 -1
  48. package/Materials/uniformBuffer.d.ts +7 -1
  49. package/Materials/uniformBuffer.js +15 -6
  50. package/Materials/uniformBuffer.js.map +1 -1
  51. package/Maths/index.d.ts +1 -0
  52. package/Maths/index.js +1 -0
  53. package/Maths/index.js.map +1 -1
  54. package/Maths/math.vector.functions.d.ts +15 -7
  55. package/Maths/math.vector.functions.js +13 -4
  56. package/Maths/math.vector.functions.js.map +1 -1
  57. package/Meshes/Builders/tiledBoxBuilder.d.ts +1 -1
  58. package/Meshes/Builders/tiledBoxBuilder.js +36 -60
  59. package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
  60. package/Meshes/GreasedLine/greasedLineMesh.js +19 -9
  61. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  62. package/Meshes/linesMesh.js +1 -0
  63. package/Meshes/linesMesh.js.map +1 -1
  64. package/Meshes/mesh.js +8 -7
  65. package/Meshes/mesh.js.map +1 -1
  66. package/Misc/HighDynamicRange/panoramaToCubemap.d.ts +2 -1
  67. package/Misc/HighDynamicRange/panoramaToCubemap.js +26 -16
  68. package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
  69. package/Misc/environmentTextureTools.js.map +1 -1
  70. package/Misc/greasedLineTools.d.ts +3 -2
  71. package/Misc/greasedLineTools.js +4 -3
  72. package/Misc/greasedLineTools.js.map +1 -1
  73. package/Misc/khronosTextureContainer2.js +2 -2
  74. package/Misc/khronosTextureContainer2.js.map +1 -1
  75. package/Misc/rgbdTextureTools.js.map +1 -1
  76. package/Misc/screenshotTools.d.ts +9 -2
  77. package/Misc/screenshotTools.js +14 -3
  78. package/Misc/screenshotTools.js.map +1 -1
  79. package/Misc/textureTools.js.map +1 -1
  80. package/Misc/tools.js +1 -1
  81. package/Misc/tools.js.map +1 -1
  82. package/Particles/thinParticleSystem.js +2 -2
  83. package/Particles/thinParticleSystem.js.map +1 -1
  84. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  85. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.d.ts +1 -0
  86. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +2 -0
  87. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
  88. package/Rendering/depthRenderer.d.ts +2 -1
  89. package/Rendering/depthRenderer.js +5 -2
  90. package/Rendering/depthRenderer.js.map +1 -1
  91. package/Rendering/depthRendererSceneComponent.d.ts +3 -1
  92. package/Rendering/depthRendererSceneComponent.js +2 -2
  93. package/Rendering/depthRendererSceneComponent.js.map +1 -1
  94. package/Rendering/objectRenderer.d.ts +6 -0
  95. package/Rendering/objectRenderer.js +14 -1
  96. package/Rendering/objectRenderer.js.map +1 -1
  97. package/Rendering/renderingGroup.d.ts +2 -0
  98. package/Rendering/renderingGroup.js +9 -7
  99. package/Rendering/renderingGroup.js.map +1 -1
  100. package/Rendering/renderingManager.d.ts +6 -0
  101. package/Rendering/renderingManager.js +14 -0
  102. package/Rendering/renderingManager.js.map +1 -1
  103. package/Shaders/particles.vertex.js +2 -2
  104. package/Shaders/particles.vertex.js.map +1 -1
  105. package/ShadersWGSL/particles.vertex.js +7 -7
  106. package/ShadersWGSL/particles.vertex.js.map +1 -1
  107. package/XR/webXRCamera.js +1 -0
  108. package/XR/webXRCamera.js.map +1 -1
  109. package/assets/Draco/draco_decoder.js +1 -1
  110. package/assets/Draco/draco_decoder_gltf.js +1 -1
  111. package/assets/Draco/draco_encoder.js +2 -0
  112. package/assets/Draco/draco_encoder_wasm_wrapper.js +1 -1
  113. package/assets/Draco/draco_wasm_wrapper.js +1 -1
  114. package/assets/Draco/draco_wasm_wrapper_gltf.js +1 -1
  115. package/package.json +1 -1
  116. package/scene.js +1 -1
  117. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"renderingManager.js","sourceRoot":"","sources":["../../../../dev/core/src/Rendering/renderingManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA2BlD;;GAEG;AACH,MAAM,OAAO,kBAAkB;CAoB9B;AAED;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAgCzB;;;;;OAKG;IACH,IAAW,0BAA0B;QACjC,OAAO,IAAI,CAAC,2BAA2B,CAAC;IAC5C,CAAC;IAED,IAAW,0BAA0B,CAAC,KAAc;QAChD,IAAI,KAAK,KAAK,IAAI,CAAC,2BAA2B,EAAE,CAAC;YAC7C,OAAO;QACX,CAAC;QAED,IAAI,CAAC,2BAA2B,GAAG,KAAK,CAAC;QACzC,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC;YACpC,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACjC,CAAC;IACL,CAAC;IAED;;OAEG;IACI,qBAAqB;QACxB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACpC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACjB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;oBACnC,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC;gBACnC,CAAC;YAC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C9C,CAAC;;AAhVD;;GAEG;AACW,oCAAmB,GAAG,CAAC,AAAJ,CAAK;AAEtC;;GAEG;AACW,oCAAmB,GAAG,CAAC,AAAJ,CAAK;AAEtC;;GAEG;AACW,0BAAS,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { SmartArray } from \"../Misc/smartArray\";\r\nimport type { ISpriteManager } from \"../Sprites/spriteManager\";\r\nimport type { IParticleSystem } from \"../Particles/IParticleSystem\";\r\nimport { RenderingGroup } from \"./renderingGroup\";\r\n\r\nimport type { Scene } from \"../scene\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Material } from \"../Materials/material\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\n\r\n/**\r\n * Interface describing the different options available in the rendering manager\r\n * regarding Auto Clear between groups.\r\n */\r\nexport interface IRenderingManagerAutoClearSetup {\r\n /**\r\n * Defines whether or not autoclear is enable.\r\n */\r\n autoClear: boolean;\r\n /**\r\n * Defines whether or not to autoclear the depth buffer.\r\n */\r\n depth: boolean;\r\n /**\r\n * Defines whether or not to autoclear the stencil buffer.\r\n */\r\n stencil: boolean;\r\n}\r\n\r\n/**\r\n * This class is used by the onRenderingGroupObservable\r\n */\r\nexport class RenderingGroupInfo {\r\n /**\r\n * The Scene that being rendered\r\n */\r\n scene: Scene;\r\n\r\n /**\r\n * The camera currently used for the rendering pass\r\n */\r\n camera: Nullable<Camera>;\r\n\r\n /**\r\n * The ID of the renderingGroup being processed\r\n */\r\n renderingGroupId: number;\r\n\r\n /**\r\n * The rendering manager\r\n */\r\n renderingManager: RenderingManager;\r\n}\r\n\r\n/**\r\n * This is the manager responsible of all the rendering for meshes sprites and particles.\r\n * It is enable to manage the different groups as well as the different necessary sort functions.\r\n * This should not be used directly aside of the few static configurations\r\n */\r\nexport class RenderingManager {\r\n /**\r\n * The max id used for rendering groups (not included)\r\n */\r\n public static MAX_RENDERINGGROUPS = 4;\r\n\r\n /**\r\n * The min id used for rendering groups (included)\r\n */\r\n public static MIN_RENDERINGGROUPS = 0;\r\n\r\n /**\r\n * Used to globally prevent autoclearing scenes.\r\n */\r\n public static AUTOCLEAR = true;\r\n\r\n /**\r\n * @internal\r\n */\r\n public _useSceneAutoClearSetup = false;\r\n\r\n private _scene: Scene;\r\n private _renderingGroups = new Array<RenderingGroup>();\r\n private _depthStencilBufferAlreadyCleaned: boolean;\r\n\r\n private _autoClearDepthStencil: { [id: number]: IRenderingManagerAutoClearSetup } = {};\r\n private _customOpaqueSortCompareFn: { [id: number]: Nullable<(a: SubMesh, b: SubMesh) => number> } = {};\r\n private _customAlphaTestSortCompareFn: { [id: number]: Nullable<(a: SubMesh, b: SubMesh) => number> } = {};\r\n private _customTransparentSortCompareFn: { [id: number]: Nullable<(a: SubMesh, b: SubMesh) => number> } = {};\r\n private _renderingGroupInfo: Nullable<RenderingGroupInfo> = new RenderingGroupInfo();\r\n\r\n private _maintainStateBetweenFrames = false;\r\n /**\r\n * Gets or sets a boolean indicating that the manager will not reset between frames.\r\n * This means that if a mesh becomes invisible or transparent it will not be visible until this boolean is set to false again.\r\n * By default, the rendering manager will dispatch all active meshes per frame (moving them to the transparent, opaque or alpha testing lists).\r\n * By turning this property on, you will accelerate the rendering by keeping all these lists unchanged between frames.\r\n */\r\n public get maintainStateBetweenFrames() {\r\n return this._maintainStateBetweenFrames;\r\n }\r\n\r\n public set maintainStateBetweenFrames(value: boolean) {\r\n if (value === this._maintainStateBetweenFrames) {\r\n return;\r\n }\r\n\r\n this._maintainStateBetweenFrames = value;\r\n if (!this._maintainStateBetweenFrames) {\r\n this.restoreDispachedFlags();\r\n }\r\n }\r\n\r\n /**\r\n * Restore wasDispatched flags on the lists of elements to render.\r\n */\r\n public restoreDispachedFlags() {\r\n for (const mesh of this._scene.meshes) {\r\n if (mesh.subMeshes) {\r\n for (const subMesh of mesh.subMeshes) {\r\n subMesh._wasDispatched = false;\r\n }\r\n }\r\n }\r\n\r\n if (this._scene.spriteManagers) {\r\n for (const spriteManager of this._scene.spriteManagers) {\r\n spriteManager._wasDispatched = false;\r\n }\r\n }\r\n\r\n for (const particleSystem of this._scene.particleSystems) {\r\n particleSystem._wasDispatched = false;\r\n }\r\n }\r\n\r\n /**\r\n * Instantiates a new rendering group for a particular scene\r\n * @param scene Defines the scene the groups belongs to\r\n */\r\n constructor(scene: Scene) {\r\n this._scene = scene;\r\n\r\n for (let i = RenderingManager.MIN_RENDERINGGROUPS; i < RenderingManager.MAX_RENDERINGGROUPS; i++) {\r\n this._autoClearDepthStencil[i] = { autoClear: true, depth: true, stencil: true };\r\n }\r\n }\r\n\r\n /**\r\n * @returns the rendering group with the specified id.\r\n * @param id the id of the rendering group (0 by default)\r\n */\r\n public getRenderingGroup(id: number): RenderingGroup {\r\n const renderingGroupId = id || 0;\r\n\r\n this._prepareRenderingGroup(renderingGroupId);\r\n\r\n return this._renderingGroups[renderingGroupId];\r\n }\r\n\r\n private _clearDepthStencilBuffer(depth = true, stencil = true): void {\r\n if (this._depthStencilBufferAlreadyCleaned) {\r\n return;\r\n }\r\n\r\n this._scene.getEngine().clear(null, false, depth, stencil);\r\n this._depthStencilBufferAlreadyCleaned = true;\r\n }\r\n\r\n /**\r\n * Renders the entire managed groups. This is used by the scene or the different render targets.\r\n * @internal\r\n */\r\n public render(\r\n customRenderFunction: Nullable<\r\n (\r\n opaqueSubMeshes: SmartArray<SubMesh>,\r\n transparentSubMeshes: SmartArray<SubMesh>,\r\n alphaTestSubMeshes: SmartArray<SubMesh>,\r\n depthOnlySubMeshes: SmartArray<SubMesh>\r\n ) => void\r\n >,\r\n activeMeshes: Nullable<AbstractMesh[]>,\r\n renderParticles: boolean,\r\n renderSprites: boolean\r\n ): void {\r\n // Update the observable context (not null as it only goes away on dispose)\r\n const info = this._renderingGroupInfo!;\r\n info.scene = this._scene;\r\n info.camera = this._scene.activeCamera;\r\n info.renderingManager = this;\r\n\r\n // Dispatch sprites\r\n if (this._scene.spriteManagers && renderSprites) {\r\n for (let index = 0; index < this._scene.spriteManagers.length; index++) {\r\n const manager = this._scene.spriteManagers[index];\r\n this.dispatchSprites(manager);\r\n }\r\n }\r\n\r\n // Render\r\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n this._depthStencilBufferAlreadyCleaned = index === RenderingManager.MIN_RENDERINGGROUPS;\r\n const renderingGroup = this._renderingGroups[index];\r\n if (!renderingGroup || renderingGroup._empty) {\r\n continue;\r\n }\r\n\r\n const renderingGroupMask = 1 << index;\r\n info.renderingGroupId = index;\r\n\r\n // Before Observable\r\n this._scene.onBeforeRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\r\n\r\n // Clear depth/stencil if needed\r\n if (RenderingManager.AUTOCLEAR) {\r\n const autoClear = this._useSceneAutoClearSetup ? this._scene.getAutoClearDepthStencilSetup(index) : this._autoClearDepthStencil[index];\r\n\r\n if (autoClear && autoClear.autoClear) {\r\n this._clearDepthStencilBuffer(autoClear.depth, autoClear.stencil);\r\n }\r\n }\r\n\r\n // Render\r\n for (const step of this._scene._beforeRenderingGroupDrawStage) {\r\n step.action(index);\r\n }\r\n renderingGroup.render(customRenderFunction, renderSprites, renderParticles, activeMeshes);\r\n for (const step of this._scene._afterRenderingGroupDrawStage) {\r\n step.action(index);\r\n }\r\n\r\n // After Observable\r\n this._scene.onAfterRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\r\n }\r\n }\r\n\r\n /**\r\n * Resets the different information of the group to prepare a new frame\r\n * @internal\r\n */\r\n public reset(): void {\r\n if (this.maintainStateBetweenFrames) {\r\n return;\r\n }\r\n\r\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n const renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.prepare();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Resets the sprites information of the group to prepare a new frame\r\n * @internal\r\n */\r\n public resetSprites(): void {\r\n if (this.maintainStateBetweenFrames) {\r\n return;\r\n }\r\n\r\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n const renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.prepareSprites();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Dispose and release the group and its associated resources.\r\n * @internal\r\n */\r\n public dispose(): void {\r\n this.freeRenderingGroups();\r\n this._renderingGroups.length = 0;\r\n this._renderingGroupInfo = null;\r\n }\r\n\r\n /**\r\n * Clear the info related to rendering groups preventing retention points during dispose.\r\n */\r\n public freeRenderingGroups(): void {\r\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n const renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.dispose();\r\n }\r\n }\r\n }\r\n\r\n private _prepareRenderingGroup(renderingGroupId: number): void {\r\n if (this._renderingGroups[renderingGroupId] === undefined) {\r\n this._renderingGroups[renderingGroupId] = new RenderingGroup(\r\n renderingGroupId,\r\n this._scene,\r\n this._customOpaqueSortCompareFn[renderingGroupId],\r\n this._customAlphaTestSortCompareFn[renderingGroupId],\r\n this._customTransparentSortCompareFn[renderingGroupId]\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Add a sprite manager to the rendering manager in order to render it this frame.\r\n * @param spriteManager Define the sprite manager to render\r\n */\r\n public dispatchSprites(spriteManager: ISpriteManager) {\r\n if (this.maintainStateBetweenFrames && spriteManager._wasDispatched) {\r\n return;\r\n }\r\n spriteManager._wasDispatched = true;\r\n this.getRenderingGroup(spriteManager.renderingGroupId).dispatchSprites(spriteManager);\r\n }\r\n\r\n /**\r\n * Add a particle system to the rendering manager in order to render it this frame.\r\n * @param particleSystem Define the particle system to render\r\n */\r\n public dispatchParticles(particleSystem: IParticleSystem) {\r\n if (this.maintainStateBetweenFrames && particleSystem._wasDispatched) {\r\n return;\r\n }\r\n particleSystem._wasDispatched = true;\r\n this.getRenderingGroup(particleSystem.renderingGroupId).dispatchParticles(particleSystem);\r\n }\r\n\r\n /**\r\n * Add a submesh to the manager in order to render it this frame\r\n * @param subMesh The submesh to dispatch\r\n * @param mesh Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.\r\n * @param material Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.\r\n */\r\n public dispatch(subMesh: SubMesh, mesh?: AbstractMesh, material?: Nullable<Material>): void {\r\n if (mesh === undefined) {\r\n mesh = subMesh.getMesh();\r\n }\r\n if (this.maintainStateBetweenFrames && subMesh._wasDispatched) {\r\n return;\r\n }\r\n subMesh._wasDispatched = true;\r\n this.getRenderingGroup(mesh.renderingGroupId).dispatch(subMesh, mesh, material);\r\n }\r\n\r\n /**\r\n * Overrides the default sort function applied in the rendering group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversely depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n public setRenderingOrder(\r\n renderingGroupId: number,\r\n opaqueSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null,\r\n alphaTestSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null,\r\n transparentSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null\r\n ) {\r\n this._customOpaqueSortCompareFn[renderingGroupId] = opaqueSortCompareFn;\r\n this._customAlphaTestSortCompareFn[renderingGroupId] = alphaTestSortCompareFn;\r\n this._customTransparentSortCompareFn[renderingGroupId] = transparentSortCompareFn;\r\n\r\n if (this._renderingGroups[renderingGroupId]) {\r\n const group = this._renderingGroups[renderingGroupId];\r\n group.opaqueSortCompareFn = this._customOpaqueSortCompareFn[renderingGroupId];\r\n group.alphaTestSortCompareFn = this._customAlphaTestSortCompareFn[renderingGroupId];\r\n group.transparentSortCompareFn = this._customTransparentSortCompareFn[renderingGroupId];\r\n }\r\n }\r\n\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n * @param depth Automatically clears depth between groups if true and autoClear is true.\r\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\r\n */\r\n public setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean, depth = true, stencil = true): void {\r\n this._autoClearDepthStencil[renderingGroupId] = {\r\n autoClear: autoClearDepthStencil,\r\n depth: depth,\r\n stencil: stencil,\r\n };\r\n }\r\n\r\n /**\r\n * Gets the current auto clear configuration for one rendering group of the rendering\r\n * manager.\r\n * @param index the rendering group index to get the information for\r\n * @returns The auto clear setup for the requested rendering group\r\n */\r\n public getAutoClearDepthStencilSetup(index: number): IRenderingManagerAutoClearSetup {\r\n return this._autoClearDepthStencil[index];\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"renderingManager.js","sourceRoot":"","sources":["../../../../dev/core/src/Rendering/renderingManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA2BlD;;GAEG;AACH,MAAM,OAAO,kBAAkB;CAoB9B;AAED;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAsBzB;;OAEG;IACH,IAAW,mBAAmB;QAC1B,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAED,IAAW,mBAAmB,CAAC,KAAc;QACzC,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;QAClC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxC,KAAK,CAAC,mBAAmB,GAAG,KAAK,CAAC;QACtC,CAAC;IACL,CAAC;IA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AAC,gBAAgB,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;YACtD,KAAK,CAAC,mBAAmB,GAAG,IAAI,CAAC,0BAA0B,CAAC,gBAAgB,CAAC,CAAC;YAC9E,KAAK,CAAC,sBAAsB,GAAG,IAAI,CAAC,6BAA6B,CAAC,gBAAgB,CAAC,CAAC;YACpF,KAAK,CAAC,wBAAwB,GAAG,IAAI,CAAC,+BAA+B,CAAC,gBAAgB,CAAC,CAAC;QAC5F,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACI,iCAAiC,CAAC,gBAAwB,EAAE,qBAA8B,EAAE,KAAK,GAAG,IAAI,EAAE,OAAO,GAAG,IAAI;QAC3H,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,GAAG;YAC5C,SAAS,EAAE,qBAAqB;YAChC,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,OAAO;SACnB,CAAC;IACN,CAAC;IAED;;;;;OAKG;IACI,6BAA6B,CAAC,KAAa;QAC9C,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;;AAhWD;;GAEG;AACW,oCAAmB,GAAG,CAAC,AAAJ,CAAK;AAEtC;;GAEG;AACW,oCAAmB,GAAG,CAAC,AAAJ,CAAK;AAEtC;;GAEG;AACW,0BAAS,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { SmartArray } from \"../Misc/smartArray\";\r\nimport type { ISpriteManager } from \"../Sprites/spriteManager\";\r\nimport type { IParticleSystem } from \"../Particles/IParticleSystem\";\r\nimport { RenderingGroup } from \"./renderingGroup\";\r\n\r\nimport type { Scene } from \"../scene\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Material } from \"../Materials/material\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\n\r\n/**\r\n * Interface describing the different options available in the rendering manager\r\n * regarding Auto Clear between groups.\r\n */\r\nexport interface IRenderingManagerAutoClearSetup {\r\n /**\r\n * Defines whether or not autoclear is enable.\r\n */\r\n autoClear: boolean;\r\n /**\r\n * Defines whether or not to autoclear the depth buffer.\r\n */\r\n depth: boolean;\r\n /**\r\n * Defines whether or not to autoclear the stencil buffer.\r\n */\r\n stencil: boolean;\r\n}\r\n\r\n/**\r\n * This class is used by the onRenderingGroupObservable\r\n */\r\nexport class RenderingGroupInfo {\r\n /**\r\n * The Scene that being rendered\r\n */\r\n scene: Scene;\r\n\r\n /**\r\n * The camera currently used for the rendering pass\r\n */\r\n camera: Nullable<Camera>;\r\n\r\n /**\r\n * The ID of the renderingGroup being processed\r\n */\r\n renderingGroupId: number;\r\n\r\n /**\r\n * The rendering manager\r\n */\r\n renderingManager: RenderingManager;\r\n}\r\n\r\n/**\r\n * This is the manager responsible of all the rendering for meshes sprites and particles.\r\n * It is enable to manage the different groups as well as the different necessary sort functions.\r\n * This should not be used directly aside of the few static configurations\r\n */\r\nexport class RenderingManager {\r\n /**\r\n * The max id used for rendering groups (not included)\r\n */\r\n public static MAX_RENDERINGGROUPS = 4;\r\n\r\n /**\r\n * The min id used for rendering groups (included)\r\n */\r\n public static MIN_RENDERINGGROUPS = 0;\r\n\r\n /**\r\n * Used to globally prevent autoclearing scenes.\r\n */\r\n public static AUTOCLEAR = true;\r\n\r\n /**\r\n * @internal\r\n */\r\n public _useSceneAutoClearSetup = false;\r\n\r\n private _disableDepthPrePass = false;\r\n /**\r\n * Specifies to disable depth pre-pass if true (default: false)\r\n */\r\n public get disableDepthPrePass() {\r\n return this._disableDepthPrePass;\r\n }\r\n\r\n public set disableDepthPrePass(value: boolean) {\r\n this._disableDepthPrePass = value;\r\n for (const group of this._renderingGroups) {\r\n group.disableDepthPrePass = value;\r\n }\r\n }\r\n\r\n private _scene: Scene;\r\n private _renderingGroups = new Array<RenderingGroup>();\r\n private _depthStencilBufferAlreadyCleaned: boolean;\r\n\r\n private _autoClearDepthStencil: { [id: number]: IRenderingManagerAutoClearSetup } = {};\r\n private _customOpaqueSortCompareFn: { [id: number]: Nullable<(a: SubMesh, b: SubMesh) => number> } = {};\r\n private _customAlphaTestSortCompareFn: { [id: number]: Nullable<(a: SubMesh, b: SubMesh) => number> } = {};\r\n private _customTransparentSortCompareFn: { [id: number]: Nullable<(a: SubMesh, b: SubMesh) => number> } = {};\r\n private _renderingGroupInfo: Nullable<RenderingGroupInfo> = new RenderingGroupInfo();\r\n\r\n private _maintainStateBetweenFrames = false;\r\n /**\r\n * Gets or sets a boolean indicating that the manager will not reset between frames.\r\n * This means that if a mesh becomes invisible or transparent it will not be visible until this boolean is set to false again.\r\n * By default, the rendering manager will dispatch all active meshes per frame (moving them to the transparent, opaque or alpha testing lists).\r\n * By turning this property on, you will accelerate the rendering by keeping all these lists unchanged between frames.\r\n */\r\n public get maintainStateBetweenFrames() {\r\n return this._maintainStateBetweenFrames;\r\n }\r\n\r\n public set maintainStateBetweenFrames(value: boolean) {\r\n if (value === this._maintainStateBetweenFrames) {\r\n return;\r\n }\r\n\r\n this._maintainStateBetweenFrames = value;\r\n if (!this._maintainStateBetweenFrames) {\r\n this.restoreDispachedFlags();\r\n }\r\n }\r\n\r\n /**\r\n * Restore wasDispatched flags on the lists of elements to render.\r\n */\r\n public restoreDispachedFlags() {\r\n for (const mesh of this._scene.meshes) {\r\n if (mesh.subMeshes) {\r\n for (const subMesh of mesh.subMeshes) {\r\n subMesh._wasDispatched = false;\r\n }\r\n }\r\n }\r\n\r\n if (this._scene.spriteManagers) {\r\n for (const spriteManager of this._scene.spriteManagers) {\r\n spriteManager._wasDispatched = false;\r\n }\r\n }\r\n\r\n for (const particleSystem of this._scene.particleSystems) {\r\n particleSystem._wasDispatched = false;\r\n }\r\n }\r\n\r\n /**\r\n * Instantiates a new rendering group for a particular scene\r\n * @param scene Defines the scene the groups belongs to\r\n */\r\n constructor(scene: Scene) {\r\n this._scene = scene;\r\n\r\n for (let i = RenderingManager.MIN_RENDERINGGROUPS; i < RenderingManager.MAX_RENDERINGGROUPS; i++) {\r\n this._autoClearDepthStencil[i] = { autoClear: true, depth: true, stencil: true };\r\n }\r\n }\r\n\r\n /**\r\n * @returns the rendering group with the specified id.\r\n * @param id the id of the rendering group (0 by default)\r\n */\r\n public getRenderingGroup(id: number): RenderingGroup {\r\n const renderingGroupId = id || 0;\r\n\r\n this._prepareRenderingGroup(renderingGroupId);\r\n\r\n return this._renderingGroups[renderingGroupId];\r\n }\r\n\r\n private _clearDepthStencilBuffer(depth = true, stencil = true): void {\r\n if (this._depthStencilBufferAlreadyCleaned) {\r\n return;\r\n }\r\n\r\n this._scene.getEngine().clear(null, false, depth, stencil);\r\n this._depthStencilBufferAlreadyCleaned = true;\r\n }\r\n\r\n /**\r\n * Renders the entire managed groups. This is used by the scene or the different render targets.\r\n * @internal\r\n */\r\n public render(\r\n customRenderFunction: Nullable<\r\n (\r\n opaqueSubMeshes: SmartArray<SubMesh>,\r\n transparentSubMeshes: SmartArray<SubMesh>,\r\n alphaTestSubMeshes: SmartArray<SubMesh>,\r\n depthOnlySubMeshes: SmartArray<SubMesh>\r\n ) => void\r\n >,\r\n activeMeshes: Nullable<AbstractMesh[]>,\r\n renderParticles: boolean,\r\n renderSprites: boolean\r\n ): void {\r\n // Update the observable context (not null as it only goes away on dispose)\r\n const info = this._renderingGroupInfo!;\r\n info.scene = this._scene;\r\n info.camera = this._scene.activeCamera;\r\n info.renderingManager = this;\r\n\r\n // Dispatch sprites\r\n if (this._scene.spriteManagers && renderSprites) {\r\n for (let index = 0; index < this._scene.spriteManagers.length; index++) {\r\n const manager = this._scene.spriteManagers[index];\r\n this.dispatchSprites(manager);\r\n }\r\n }\r\n\r\n // Render\r\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n this._depthStencilBufferAlreadyCleaned = index === RenderingManager.MIN_RENDERINGGROUPS;\r\n const renderingGroup = this._renderingGroups[index];\r\n if (!renderingGroup || renderingGroup._empty) {\r\n continue;\r\n }\r\n\r\n const renderingGroupMask = 1 << index;\r\n info.renderingGroupId = index;\r\n\r\n // Before Observable\r\n this._scene.onBeforeRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\r\n\r\n // Clear depth/stencil if needed\r\n if (RenderingManager.AUTOCLEAR) {\r\n const autoClear = this._useSceneAutoClearSetup ? this._scene.getAutoClearDepthStencilSetup(index) : this._autoClearDepthStencil[index];\r\n\r\n if (autoClear && autoClear.autoClear) {\r\n this._clearDepthStencilBuffer(autoClear.depth, autoClear.stencil);\r\n }\r\n }\r\n\r\n // Render\r\n for (const step of this._scene._beforeRenderingGroupDrawStage) {\r\n step.action(index);\r\n }\r\n renderingGroup.render(customRenderFunction, renderSprites, renderParticles, activeMeshes);\r\n for (const step of this._scene._afterRenderingGroupDrawStage) {\r\n step.action(index);\r\n }\r\n\r\n // After Observable\r\n this._scene.onAfterRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\r\n }\r\n }\r\n\r\n /**\r\n * Resets the different information of the group to prepare a new frame\r\n * @internal\r\n */\r\n public reset(): void {\r\n if (this.maintainStateBetweenFrames) {\r\n return;\r\n }\r\n\r\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n const renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.prepare();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Resets the sprites information of the group to prepare a new frame\r\n * @internal\r\n */\r\n public resetSprites(): void {\r\n if (this.maintainStateBetweenFrames) {\r\n return;\r\n }\r\n\r\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n const renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.prepareSprites();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Dispose and release the group and its associated resources.\r\n * @internal\r\n */\r\n public dispose(): void {\r\n this.freeRenderingGroups();\r\n this._renderingGroups.length = 0;\r\n this._renderingGroupInfo = null;\r\n }\r\n\r\n /**\r\n * Clear the info related to rendering groups preventing retention points during dispose.\r\n */\r\n public freeRenderingGroups(): void {\r\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n const renderingGroup = this._renderingGroups[index];\r\n if (renderingGroup) {\r\n renderingGroup.dispose();\r\n }\r\n }\r\n }\r\n\r\n private _prepareRenderingGroup(renderingGroupId: number): void {\r\n if (this._renderingGroups[renderingGroupId] === undefined) {\r\n this._renderingGroups[renderingGroupId] = new RenderingGroup(\r\n renderingGroupId,\r\n this._scene,\r\n this._customOpaqueSortCompareFn[renderingGroupId],\r\n this._customAlphaTestSortCompareFn[renderingGroupId],\r\n this._customTransparentSortCompareFn[renderingGroupId]\r\n );\r\n this._renderingGroups[renderingGroupId].disableDepthPrePass = this._disableDepthPrePass;\r\n }\r\n }\r\n\r\n /**\r\n * Add a sprite manager to the rendering manager in order to render it this frame.\r\n * @param spriteManager Define the sprite manager to render\r\n */\r\n public dispatchSprites(spriteManager: ISpriteManager) {\r\n if (this.maintainStateBetweenFrames && spriteManager._wasDispatched) {\r\n return;\r\n }\r\n spriteManager._wasDispatched = true;\r\n this.getRenderingGroup(spriteManager.renderingGroupId).dispatchSprites(spriteManager);\r\n }\r\n\r\n /**\r\n * Add a particle system to the rendering manager in order to render it this frame.\r\n * @param particleSystem Define the particle system to render\r\n */\r\n public dispatchParticles(particleSystem: IParticleSystem) {\r\n if (this.maintainStateBetweenFrames && particleSystem._wasDispatched) {\r\n return;\r\n }\r\n particleSystem._wasDispatched = true;\r\n this.getRenderingGroup(particleSystem.renderingGroupId).dispatchParticles(particleSystem);\r\n }\r\n\r\n /**\r\n * Add a submesh to the manager in order to render it this frame\r\n * @param subMesh The submesh to dispatch\r\n * @param mesh Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.\r\n * @param material Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.\r\n */\r\n public dispatch(subMesh: SubMesh, mesh?: AbstractMesh, material?: Nullable<Material>): void {\r\n if (mesh === undefined) {\r\n mesh = subMesh.getMesh();\r\n }\r\n if (this.maintainStateBetweenFrames && subMesh._wasDispatched) {\r\n return;\r\n }\r\n subMesh._wasDispatched = true;\r\n this.getRenderingGroup(mesh.renderingGroupId).dispatch(subMesh, mesh, material);\r\n }\r\n\r\n /**\r\n * Overrides the default sort function applied in the rendering group to prepare the meshes.\r\n * This allowed control for front to back rendering or reversely depending of the special needs.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\r\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\r\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\r\n */\r\n public setRenderingOrder(\r\n renderingGroupId: number,\r\n opaqueSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null,\r\n alphaTestSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null,\r\n transparentSortCompareFn: Nullable<(a: SubMesh, b: SubMesh) => number> = null\r\n ) {\r\n this._customOpaqueSortCompareFn[renderingGroupId] = opaqueSortCompareFn;\r\n this._customAlphaTestSortCompareFn[renderingGroupId] = alphaTestSortCompareFn;\r\n this._customTransparentSortCompareFn[renderingGroupId] = transparentSortCompareFn;\r\n\r\n if (this._renderingGroups[renderingGroupId]) {\r\n const group = this._renderingGroups[renderingGroupId];\r\n group.opaqueSortCompareFn = this._customOpaqueSortCompareFn[renderingGroupId];\r\n group.alphaTestSortCompareFn = this._customAlphaTestSortCompareFn[renderingGroupId];\r\n group.transparentSortCompareFn = this._customTransparentSortCompareFn[renderingGroupId];\r\n }\r\n }\r\n\r\n /**\r\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\r\n *\r\n * @param renderingGroupId The rendering group id corresponding to its index\r\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\r\n * @param depth Automatically clears depth between groups if true and autoClear is true.\r\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\r\n */\r\n public setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean, depth = true, stencil = true): void {\r\n this._autoClearDepthStencil[renderingGroupId] = {\r\n autoClear: autoClearDepthStencil,\r\n depth: depth,\r\n stencil: stencil,\r\n };\r\n }\r\n\r\n /**\r\n * Gets the current auto clear configuration for one rendering group of the rendering\r\n * manager.\r\n * @param index the rendering group index to get the information for\r\n * @returns The auto clear setup for the requested rendering group\r\n */\r\n public getAutoClearDepthStencilSetup(index: number): IRenderingManagerAutoClearSetup {\r\n return this._autoClearDepthStencil[index];\r\n }\r\n}\r\n"]}
@@ -24,7 +24,7 @@ attribute vec2 offset;uniform mat4 view;uniform mat4 projection;uniform vec2 tra
24
24
  #ifdef ANIMATESHEET
25
25
  uniform vec3 particlesInfos;
26
26
  #endif
27
- varying vec2 vUV;varying vec4 vColor;varying vec3 vPositionW;
27
+ varying vec2 vUV;varying vec4 vColor;
28
28
  #ifdef RAMPGRADIENT
29
29
  varying vec4 remapRanges;
30
30
  #endif
@@ -50,7 +50,7 @@ mat3 rotMatrix= mat3(row0,row1,row2);vec3 alignedCorner=rotMatrix*rotatedCorner;
50
50
  #define CUSTOM_VERTEX_DEFINITIONS
51
51
  void main(void) {
52
52
  #define CUSTOM_VERTEX_MAIN_BEGIN
53
- vec2 cornerPos;cornerPos=(vec2(offset.x-0.5,offset.y -0.5)-translationPivot)*size;
53
+ vec2 cornerPos;vec3 vPositionW;cornerPos=(vec2(offset.x-0.5,offset.y -0.5)-translationPivot)*size;
54
54
  #ifdef BILLBOARD
55
55
  vec3 rotatedCorner;
56
56
  #ifdef BILLBOARDY
@@ -1 +1 @@
1
- {"version":3,"file":"particles.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/particles.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACrC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyEb,CAAC;AACH,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"particlesVertexShader\";\nconst shader = `attribute vec3 position;attribute vec4 color;attribute float angle;attribute vec2 size;\n#ifdef ANIMATESHEET\nattribute float cellIndex;\n#endif\n#ifndef BILLBOARD\nattribute vec3 direction;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute vec3 direction;\n#endif\n#ifdef RAMPGRADIENT\nattribute vec4 remapData;\n#endif\nattribute vec2 offset;uniform mat4 view;uniform mat4 projection;uniform vec2 translationPivot;\n#ifdef ANIMATESHEET\nuniform vec3 particlesInfos; \n#endif\nvarying vec2 vUV;varying vec4 vColor;varying vec3 vPositionW;\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\n#endif\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform mat4 invView;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {vec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));vec3 zaxis=normalize(cross(yaxis,xaxis));vec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);vec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);vec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);mat3 rotMatrix= mat3(row0,row1,row2);vec3 alignedCorner=rotMatrix*rotatedCorner;return position+alignedCorner;}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {vec3 normalizedToCamera=normalize(toCamera);vec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));vec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);vec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\n#ifdef BILLBOARDSTRETCHED_LOCAL\nvec3 row1=direction;\n#else\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));vec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\n#endif\nmat3 rotMatrix= mat3(row0,row1,row2);vec3 alignedCorner=rotMatrix*rotatedCorner;return position+alignedCorner;}\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec2 cornerPos;cornerPos=(vec2(offset.x-0.5,offset.y -0.5)-translationPivot)*size;\n#ifdef BILLBOARD\nvec3 rotatedCorner;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.y=0.;rotatedCorner.xz+=translationPivot;vec3 yaxis=position-eyePosition;yaxis.y=0.;vPositionW=rotate(normalize(yaxis),rotatedCorner);vec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.z=0.;rotatedCorner.xy+=translationPivot;vec3 toCamera=position-eyePosition;vPositionW=rotateAlign(toCamera,rotatedCorner);vec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;\n#else\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.z=0.;rotatedCorner.xy+=translationPivot;vec3 viewPos=(view*vec4(position,1.0)).xyz+rotatedCorner;vPositionW=(invView*vec4(viewPos,1)).xyz;\n#endif\n#ifdef RAMPGRADIENT\nremapRanges=remapData;\n#endif\ngl_Position=projection*vec4(viewPos,1.0);\n#else\nvec3 rotatedCorner;rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.y=0.;rotatedCorner.xz+=translationPivot;vec3 yaxis=normalize(direction);vPositionW=rotate(yaxis,rotatedCorner);gl_Position=projection*view*vec4(vPositionW,1.0);\n#endif\nvColor=color;\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex*particlesInfos.z);float columnOffset=cellIndex-rowOffset/particlesInfos.z;vec2 uvScale=particlesInfos.xy;vec2 uvOffset=vec2(offset.x ,1.0-offset.y);vUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=offset;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6) || defined(FOG)\nvec4 worldPos=vec4(vPositionW,1.0);\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const particlesVertexShader = { name, shader };\n"]}
1
+ {"version":3,"file":"particles.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/particles.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACrC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyEb,CAAC;AACH,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"particlesVertexShader\";\nconst shader = `attribute vec3 position;attribute vec4 color;attribute float angle;attribute vec2 size;\n#ifdef ANIMATESHEET\nattribute float cellIndex;\n#endif\n#ifndef BILLBOARD\nattribute vec3 direction;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute vec3 direction;\n#endif\n#ifdef RAMPGRADIENT\nattribute vec4 remapData;\n#endif\nattribute vec2 offset;uniform mat4 view;uniform mat4 projection;uniform vec2 translationPivot;\n#ifdef ANIMATESHEET\nuniform vec3 particlesInfos; \n#endif\nvarying vec2 vUV;varying vec4 vColor;\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\n#endif\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform mat4 invView;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {vec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));vec3 zaxis=normalize(cross(yaxis,xaxis));vec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);vec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);vec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);mat3 rotMatrix= mat3(row0,row1,row2);vec3 alignedCorner=rotMatrix*rotatedCorner;return position+alignedCorner;}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {vec3 normalizedToCamera=normalize(toCamera);vec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));vec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);vec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\n#ifdef BILLBOARDSTRETCHED_LOCAL\nvec3 row1=direction;\n#else\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));vec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\n#endif\nmat3 rotMatrix= mat3(row0,row1,row2);vec3 alignedCorner=rotMatrix*rotatedCorner;return position+alignedCorner;}\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec2 cornerPos;vec3 vPositionW;cornerPos=(vec2(offset.x-0.5,offset.y -0.5)-translationPivot)*size;\n#ifdef BILLBOARD\nvec3 rotatedCorner;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.y=0.;rotatedCorner.xz+=translationPivot;vec3 yaxis=position-eyePosition;yaxis.y=0.;vPositionW=rotate(normalize(yaxis),rotatedCorner);vec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.z=0.;rotatedCorner.xy+=translationPivot;vec3 toCamera=position-eyePosition;vPositionW=rotateAlign(toCamera,rotatedCorner);vec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;\n#else\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.z=0.;rotatedCorner.xy+=translationPivot;vec3 viewPos=(view*vec4(position,1.0)).xyz+rotatedCorner;vPositionW=(invView*vec4(viewPos,1)).xyz;\n#endif\n#ifdef RAMPGRADIENT\nremapRanges=remapData;\n#endif\ngl_Position=projection*vec4(viewPos,1.0);\n#else\nvec3 rotatedCorner;rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);rotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);rotatedCorner.y=0.;rotatedCorner.xz+=translationPivot;vec3 yaxis=normalize(direction);vPositionW=rotate(yaxis,rotatedCorner);gl_Position=projection*view*vec4(vPositionW,1.0);\n#endif\nvColor=color;\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex*particlesInfos.z);float columnOffset=cellIndex-rowOffset/particlesInfos.z;vec2 uvScale=particlesInfos.xy;vec2 uvOffset=vec2(offset.x ,1.0-offset.y);vUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=offset;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6) || defined(FOG)\nvec4 worldPos=vec4(vPositionW,1.0);\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const particlesVertexShader = { name, shader };\n"]}
@@ -24,7 +24,7 @@ attribute offset: vec2f;uniform view: mat4x4f;uniform projection: mat4x4f;unifor
24
24
  #ifdef ANIMATESHEET
25
25
  uniform particlesInfos: vec3f;
26
26
  #endif
27
- varying vUV: vec2f;varying vColor: vec4f;varying vPositionW: vec3f;
27
+ varying vUV: vec2f;varying vColor: vec4f;
28
28
  #ifdef RAMPGRADIENT
29
29
  varying remapRanges: vec4f;
30
30
  #endif
@@ -51,22 +51,22 @@ var rotMatrix: mat3x3f= mat3x3f(row0,row1,row2);var alignedCorner: vec3f=rotMatr
51
51
  @vertex
52
52
  fn main(input : VertexInputs)->FragmentInputs {
53
53
  #define CUSTOM_VERTEX_MAIN_BEGIN
54
- var cornerPos: vec2f;cornerPos=( vec2f(input.offset.x-0.5,input.offset.y -0.5)-uniforms.translationPivot)*input.size;
54
+ var cornerPos: vec2f;var vPositionW: vec3f;cornerPos=( vec2f(input.offset.x-0.5,input.offset.y -0.5)-uniforms.translationPivot)*input.size;
55
55
  #ifdef BILLBOARD
56
56
  var rotatedCorner: vec3f;
57
57
  #ifdef BILLBOARDY
58
- rotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.z=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.y=0.;var yaxis: vec3f=input.position-uniforms.eyePosition;yaxis.y=0.;vertexOutputs.vPositionW=rotate(normalize(yaxis),rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vertexOutputs.vPositionW,1.0)).xyz;
58
+ rotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.z=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.y=0.;var yaxis: vec3f=input.position-uniforms.eyePosition;yaxis.y=0.;vPositionW=rotate(normalize(yaxis),rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vPositionW,1.0)).xyz;
59
59
  #elif defined(BILLBOARDSTRETCHED)
60
- rotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.y=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.z=0.;var toCamera: vec3f=input.position-uniforms.eyePosition;vertexOutputs.vPositionW=rotateAlign(toCamera,rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vertexOutputs.vPositionW,1.0)).xyz;
60
+ rotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.y=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.z=0.;var toCamera: vec3f=input.position-uniforms.eyePosition;vPositionW=rotateAlign(toCamera,rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vPositionW,1.0)).xyz;
61
61
  #else
62
- rotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.y=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.z=0.;var viewPos: vec3f=(uniforms.view* vec4f(input.position,1.0)).xyz+rotatedCorner;vertexOutputs.vPositionW=(uniforms.invView* vec4f(viewPos,1)).xyz;
62
+ rotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.y=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.z=0.;var viewPos: vec3f=(uniforms.view* vec4f(input.position,1.0)).xyz+rotatedCorner;vPositionW=(uniforms.invView* vec4f(viewPos,1)).xyz;
63
63
  #endif
64
64
  #ifdef RAMPGRADIENT
65
65
  vertexOutputs.remapRanges=input.remapData;
66
66
  #endif
67
67
  vertexOutputs.position=uniforms.projection* vec4f(viewPos,1.0);
68
68
  #else
69
- var rotatedCorner: vec3f;rotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.z=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.y=0.;var yaxis: vec3f=normalize(vertexInputs.direction);vertexOutputs.vPositionW=rotate(yaxis,rotatedCorner);vertexOutputs.position=uniforms.projection*uniforms.view* vec4f(vertexOutputs.vPositionW,1.0);
69
+ var rotatedCorner: vec3f;rotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.z=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.y=0.;var yaxis: vec3f=normalize(vertexInputs.direction);vPositionW=rotate(yaxis,rotatedCorner);vertexOutputs.position=uniforms.projection*uniforms.view* vec4f(vPositionW,1.0);
70
70
  #endif
71
71
  vertexOutputs.vColor=input.color;
72
72
  #ifdef ANIMATESHEET
@@ -75,7 +75,7 @@ var rowOffset: f32=floor(input.cellIndex*uniforms.particlesInfos.z);var columnOf
75
75
  vertexOutputs.vUV=input.offset;
76
76
  #endif
77
77
  #if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6) || defined(FOG)
78
- var worldPos: vec4f= vec4f(vertexOutputs.vPositionW,1.0);
78
+ var worldPos: vec4f= vec4f(vPositionW,1.0);
79
79
  #endif
80
80
  #include<clipPlaneVertex>
81
81
  #include<fogVertex>
@@ -1 +1 @@
1
- {"version":3,"file":"particles.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/particles.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACrC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0Eb,CAAC;AACH,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"particlesVertexShader\";\nconst shader = `attribute position: vec3f;attribute color: vec4f;attribute angle: f32;attribute size: vec2f;\n#ifdef ANIMATESHEET\nattribute cellIndex: f32;\n#endif\n#ifndef BILLBOARD\nattribute direction: vec3f;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute direction: vec3f;\n#endif\n#ifdef RAMPGRADIENT\nattribute remapData: vec4f;\n#endif\nattribute offset: vec2f;uniform view: mat4x4f;uniform projection: mat4x4f;uniform translationPivot: vec2f;\n#ifdef ANIMATESHEET\nuniform particlesInfos: vec3f; \n#endif\nvarying vUV: vec2f;varying vColor: vec4f;varying vPositionW: vec3f;\n#ifdef RAMPGRADIENT\nvarying remapRanges: vec4f;\n#endif\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform invView: mat4x4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\n#ifdef BILLBOARD\nuniform eyePosition: vec3f;\n#endif\nfn rotate(yaxis: vec3f,rotatedCorner: vec3f)->vec3f {var xaxis: vec3f=normalize(cross( vec3f(0.,1.0,0.),yaxis));var zaxis: vec3f=normalize(cross(yaxis,xaxis));var row0: vec3f= vec3f(xaxis.x,xaxis.y,xaxis.z);var row1: vec3f= vec3f(yaxis.x,yaxis.y,yaxis.z);var row2: vec3f= vec3f(zaxis.x,zaxis.y,zaxis.z);var rotMatrix: mat3x3f= mat3x3f(row0,row1,row2);var alignedCorner: vec3f=rotMatrix*rotatedCorner;return vertexInputs.position+alignedCorner;}\n#ifdef BILLBOARDSTRETCHED\nfn rotateAlign(toCamera: vec3f,rotatedCorner: vec3f)->vec3f {var normalizedToCamera: vec3f=normalize(toCamera);var normalizedCrossDirToCamera: vec3f=normalize(cross(normalize(vertexInputs.direction),normalizedToCamera));var row0: vec3f= vec3f(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);var row2: vec3f= vec3f(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\n#ifdef BILLBOARDSTRETCHED_LOCAL\nvar row1: vec3f=vertexInputs.direction;\n#else\nvar crossProduct: vec3f=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));var row1: vec3f= vec3f(crossProduct.x,crossProduct.y,crossProduct.z);\n#endif\nvar rotMatrix: mat3x3f= mat3x3f(row0,row1,row2);var alignedCorner: vec3f=rotMatrix*rotatedCorner;return vertexInputs.position+alignedCorner;}\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvar cornerPos: vec2f;cornerPos=( vec2f(input.offset.x-0.5,input.offset.y -0.5)-uniforms.translationPivot)*input.size;\n#ifdef BILLBOARD\nvar rotatedCorner: vec3f;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.z=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.y=0.;var yaxis: vec3f=input.position-uniforms.eyePosition;yaxis.y=0.;vertexOutputs.vPositionW=rotate(normalize(yaxis),rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vertexOutputs.vPositionW,1.0)).xyz;\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.y=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.z=0.;var toCamera: vec3f=input.position-uniforms.eyePosition;vertexOutputs.vPositionW=rotateAlign(toCamera,rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vertexOutputs.vPositionW,1.0)).xyz;\n#else\nrotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.y=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.z=0.;var viewPos: vec3f=(uniforms.view* vec4f(input.position,1.0)).xyz+rotatedCorner;vertexOutputs.vPositionW=(uniforms.invView* vec4f(viewPos,1)).xyz;\n#endif\n#ifdef RAMPGRADIENT\nvertexOutputs.remapRanges=input.remapData;\n#endif\nvertexOutputs.position=uniforms.projection* vec4f(viewPos,1.0);\n#else\nvar rotatedCorner: vec3f;rotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.z=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.y=0.;var yaxis: vec3f=normalize(vertexInputs.direction);vertexOutputs.vPositionW=rotate(yaxis,rotatedCorner);vertexOutputs.position=uniforms.projection*uniforms.view* vec4f(vertexOutputs.vPositionW,1.0);\n#endif\nvertexOutputs.vColor=input.color;\n#ifdef ANIMATESHEET\nvar rowOffset: f32=floor(input.cellIndex*uniforms.particlesInfos.z);var columnOffset: f32=input.cellIndex-rowOffset/uniforms.particlesInfos.z;var uvScale: vec2f=uniforms.particlesInfos.xy;var uvOffset: vec2f= vec2f(input.offset.x ,1.0-input.offset.y);vertexOutputs.vUV=(uvOffset+ vec2f(columnOffset,rowOffset))*uvScale;\n#else\nvertexOutputs.vUV=input.offset;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6) || defined(FOG)\nvar worldPos: vec4f= vec4f(vertexOutputs.vPositionW,1.0);\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const particlesVertexShaderWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"particles.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/particles.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,uBAAuB,CAAC;AACrC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0Eb,CAAC;AACH,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"particlesVertexShader\";\nconst shader = `attribute position: vec3f;attribute color: vec4f;attribute angle: f32;attribute size: vec2f;\n#ifdef ANIMATESHEET\nattribute cellIndex: f32;\n#endif\n#ifndef BILLBOARD\nattribute direction: vec3f;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute direction: vec3f;\n#endif\n#ifdef RAMPGRADIENT\nattribute remapData: vec4f;\n#endif\nattribute offset: vec2f;uniform view: mat4x4f;uniform projection: mat4x4f;uniform translationPivot: vec2f;\n#ifdef ANIMATESHEET\nuniform particlesInfos: vec3f; \n#endif\nvarying vUV: vec2f;varying vColor: vec4f;\n#ifdef RAMPGRADIENT\nvarying remapRanges: vec4f;\n#endif\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform invView: mat4x4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\n#ifdef BILLBOARD\nuniform eyePosition: vec3f;\n#endif\nfn rotate(yaxis: vec3f,rotatedCorner: vec3f)->vec3f {var xaxis: vec3f=normalize(cross( vec3f(0.,1.0,0.),yaxis));var zaxis: vec3f=normalize(cross(yaxis,xaxis));var row0: vec3f= vec3f(xaxis.x,xaxis.y,xaxis.z);var row1: vec3f= vec3f(yaxis.x,yaxis.y,yaxis.z);var row2: vec3f= vec3f(zaxis.x,zaxis.y,zaxis.z);var rotMatrix: mat3x3f= mat3x3f(row0,row1,row2);var alignedCorner: vec3f=rotMatrix*rotatedCorner;return vertexInputs.position+alignedCorner;}\n#ifdef BILLBOARDSTRETCHED\nfn rotateAlign(toCamera: vec3f,rotatedCorner: vec3f)->vec3f {var normalizedToCamera: vec3f=normalize(toCamera);var normalizedCrossDirToCamera: vec3f=normalize(cross(normalize(vertexInputs.direction),normalizedToCamera));var row0: vec3f= vec3f(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);var row2: vec3f= vec3f(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\n#ifdef BILLBOARDSTRETCHED_LOCAL\nvar row1: vec3f=vertexInputs.direction;\n#else\nvar crossProduct: vec3f=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));var row1: vec3f= vec3f(crossProduct.x,crossProduct.y,crossProduct.z);\n#endif\nvar rotMatrix: mat3x3f= mat3x3f(row0,row1,row2);var alignedCorner: vec3f=rotMatrix*rotatedCorner;return vertexInputs.position+alignedCorner;}\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvar cornerPos: vec2f;var vPositionW: vec3f;cornerPos=( vec2f(input.offset.x-0.5,input.offset.y -0.5)-uniforms.translationPivot)*input.size;\n#ifdef BILLBOARD\nvar rotatedCorner: vec3f;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.z=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.y=0.;var yaxis: vec3f=input.position-uniforms.eyePosition;yaxis.y=0.;vPositionW=rotate(normalize(yaxis),rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vPositionW,1.0)).xyz;\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.y=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.z=0.;var toCamera: vec3f=input.position-uniforms.eyePosition;vPositionW=rotateAlign(toCamera,rotatedCorner);var viewPos: vec3f=(uniforms.view* vec4f(vPositionW,1.0)).xyz;\n#else\nrotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.y=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.z=0.;var viewPos: vec3f=(uniforms.view* vec4f(input.position,1.0)).xyz+rotatedCorner;vPositionW=(uniforms.invView* vec4f(viewPos,1)).xyz;\n#endif\n#ifdef RAMPGRADIENT\nvertexOutputs.remapRanges=input.remapData;\n#endif\nvertexOutputs.position=uniforms.projection* vec4f(viewPos,1.0);\n#else\nvar rotatedCorner: vec3f;rotatedCorner.x=cornerPos.x*cos(input.angle)-cornerPos.y*sin(input.angle)+uniforms.translationPivot.x;rotatedCorner.z=cornerPos.x*sin(input.angle)+cornerPos.y*cos(input.angle)+uniforms.translationPivot.y;rotatedCorner.y=0.;var yaxis: vec3f=normalize(vertexInputs.direction);vPositionW=rotate(yaxis,rotatedCorner);vertexOutputs.position=uniforms.projection*uniforms.view* vec4f(vPositionW,1.0);\n#endif\nvertexOutputs.vColor=input.color;\n#ifdef ANIMATESHEET\nvar rowOffset: f32=floor(input.cellIndex*uniforms.particlesInfos.z);var columnOffset: f32=input.cellIndex-rowOffset/uniforms.particlesInfos.z;var uvScale: vec2f=uniforms.particlesInfos.xy;var uvOffset: vec2f= vec2f(input.offset.x ,1.0-input.offset.y);vertexOutputs.vUV=(uvOffset+ vec2f(columnOffset,rowOffset))*uvScale;\n#else\nvertexOutputs.vUV=input.offset;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6) || defined(FOG)\nvar worldPos: vec4f= vec4f(vPositionW,1.0);\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const particlesVertexShaderWGSL = { name, shader };\n"]}
package/XR/webXRCamera.js CHANGED
@@ -332,6 +332,7 @@ export class WebXRCamera extends FreeCamera {
332
332
  x: this._referencedPosition.x / this._xrSessionManager.worldScalingFactor,
333
333
  y: this._referencedPosition.y / this._xrSessionManager.worldScalingFactor,
334
334
  z: this._referencedPosition.z / this._xrSessionManager.worldScalingFactor,
335
+ w: 1,
335
336
  }, {
336
337
  x: this._referenceQuaternion.x,
337
338
  y: this._referenceQuaternion.y,
@@ -1 +1 @@
1
- {"version":3,"file":"webXRCamera.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRCamera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,UAAU;IA4CvC;;;;;OAKG;IACH,YACI,IAAY,EACZ,KAAY,EACJ,iBAAsC;QAE9C,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;QAF3B,sBAAiB,GAAjB,iBAAiB,CAAqB;QAlD1C,gBAAW,GAAG,KAAK,CAAC;QACpB,yBAAoB,GAAe,UAAU,CAAC,QAAQ,EAAE,CAAC;QACzD,wBAAmB,GAAY,IAAI,OAAO,EAAE,CAAC;QAC7C,mBAAc,2CAAuD;QAE7E;;;WAGG;QACI,oCAA+B,GAAG,IAAI,UAAU,EAAe,CAAC;QAEvE;;;WAGG;QACI,2BAAsB,GAAG,IAAI,UAAU,EAAW,CAAC;QAE1D;;;WAGG;Q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YAC5D,YAAY,CAAC,MAAM,EAAE,CAAC;YAEtB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;gBACpC,YAAY,CAAC,4BAA4B,EAAE,CAAC;YAChD,CAAC;YAED,YAAY,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACvF,MAAM,SAAS,GAAG,IAAI,gBAAgB,CAClC;gBACI,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,kBAAkB;gBACzE,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,kBAAkB;gBACzE,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,kBAAkB;aAC5E,EACD;gBACI,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;aACjC,CACJ,CAAC;YACF,IAAI,CAAC,iBAAiB,CAAC,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;QACrH,CAAC;IACL,CAAC;;AAnYc,0BAAc,GAAG,OAAO,CAAC,GAAG,EAAE,AAAhB,CAAiB","sourcesContent":["import { Vector3, Matrix, Quaternion, TmpVectors } from \"../Maths/math.vector\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport { FreeCamera } from \"../Cameras/freeCamera\";\r\nimport { TargetCamera } from \"../Cameras/targetCamera\";\r\nimport type { WebXRSessionManager } from \"./webXRSessionManager\";\r\nimport { Viewport } from \"../Maths/math.viewport\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { WebXRTrackingState } from \"./webXRTypes\";\r\n\r\n/**\r\n * WebXR Camera which holds the views for the xrSession\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRCamera\r\n */\r\nexport class WebXRCamera extends FreeCamera {\r\n private static _ScaleReadOnly = Vector3.One();\r\n\r\n private _firstFrame = false;\r\n private _referenceQuaternion: Quaternion = Quaternion.Identity();\r\n private _referencedPosition: Vector3 = new Vector3();\r\n private _trackingState: WebXRTrackingState = WebXRTrackingState.NOT_TRACKING;\r\n\r\n /**\r\n * This will be triggered after the first XR Frame initialized the camera,\r\n * including the right number of views and their rendering parameters\r\n */\r\n public onXRCameraInitializedObservable = new Observable<WebXRCamera>();\r\n\r\n /**\r\n * Observable raised before camera teleportation\r\n * @deprecated use onBeforeCameraTeleport of the teleportation feature instead\r\n */\r\n public onBeforeCameraTeleport = new Observable<Vector3>();\r\n\r\n /**\r\n * Observable raised after camera teleportation\r\n * @deprecated use onAfterCameraTeleport of the teleportation feature instead\r\n */\r\n public onAfterCameraTeleport = new Observable<Vector3>();\r\n\r\n /**\r\n * Notifies when the camera's tracking state has changed.\r\n * Notice - will also be triggered when tracking has started (at the beginning of the session)\r\n */\r\n public onTrackingStateChanged = new Observable<WebXRTrackingState>();\r\n\r\n /**\r\n * Should position compensation execute on first frame.\r\n * This is used when copying the position from a native (non XR) camera\r\n */\r\n public compensateOnFirstFrame: boolean = true;\r\n\r\n /**\r\n * The last XRViewerPose from the current XRFrame\r\n * @internal\r\n */\r\n public _lastXRViewerPose?: XRViewerPose;\r\n\r\n /**\r\n * Creates a new webXRCamera, this should only be set at the camera after it has been updated by the xrSessionManager\r\n * @param name the name of the camera\r\n * @param scene the scene to add the camera to\r\n * @param _xrSessionManager a constructed xr session manager\r\n */\r\n constructor(\r\n name: string,\r\n scene: Scene,\r\n private _xrSessionManager: WebXRSessionManager\r\n ) {\r\n super(name, Vector3.Zero(), scene);\r\n\r\n // Initial camera configuration\r\n this.minZ = 0.1;\r\n this.rotationQuaternion = new Quaternion();\r\n this.cameraRigMode = Camera.RIG_MODE_CUSTOM;\r\n this.updateUpVectorFromRotation = true;\r\n this._updateNumberOfRigCameras(1);\r\n // freeze projection matrix, which will be copied later\r\n this.freezeProjectionMatrix();\r\n this._deferOnly = true;\r\n\r\n this._xrSessionManager.onXRSessionInit.add(() => {\r\n this._referencedPosition.copyFromFloats(0, 0, 0);\r\n this._referenceQuaternion.copyFromFloats(0, 0, 0, 1);\r\n // first frame - camera's y position should be 0 for the correct offset\r\n this._firstFrame = this.compensateOnFirstFrame;\r\n this._xrSessionManager.onWorldScaleFactorChangedObservable.add(() => {\r\n // only run if in session\r\n if (!this._xrSessionManager.currentFrame) {\r\n return;\r\n }\r\n this._updateDepthNearFar();\r\n });\r\n });\r\n\r\n // Check transformation changes on each frame. Callback is added to be first so that the transformation will be\r\n // applied to the rest of the elements using the referenceSpace object\r\n this._xrSessionManager.onXRFrameObservable.add(\r\n () => {\r\n if (this._firstFrame) {\r\n this._updateFromXRSession();\r\n }\r\n if (this.onXRCameraInitializedObservable.hasObservers()) {\r\n this.onXRCameraInitializedObservable.notifyObservers(this);\r\n this.onXRCameraInitializedObservable.clear();\r\n }\r\n\r\n if (this._deferredUpdated) {\r\n this.position.copyFrom(this._deferredPositionUpdate);\r\n this.rotationQuaternion.copyFrom(this._deferredRotationQuaternionUpdate);\r\n }\r\n\r\n this._updateReferenceSpace();\r\n this._updateFromXRSession();\r\n },\r\n undefined,\r\n true\r\n );\r\n }\r\n\r\n /**\r\n * Get the current XR tracking state of the camera\r\n */\r\n public get trackingState(): WebXRTrackingState {\r\n return this._trackingState;\r\n }\r\n\r\n private _setTrackingState(newState: WebXRTrackingState) {\r\n if (this._trackingState !== newState) {\r\n this._trackingState = newState;\r\n this.onTrackingStateChanged.notifyObservers(newState);\r\n }\r\n }\r\n\r\n /**\r\n * Return the user's height, unrelated to the current ground.\r\n * This will be the y position of this camera, when ground level is 0.\r\n *\r\n * Note - this value is multiplied by the worldScalingFactor (if set), so it will be in the same units as the scene.\r\n */\r\n public get realWorldHeight(): number {\r\n const basePose = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.baseReferenceSpace);\r\n if (basePose && basePose.transform) {\r\n return basePose.transform.position.y * this._xrSessionManager.worldScalingFactor;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _updateForDualEyeDebugging(/*pupilDistance = 0.01*/) {\r\n // Create initial camera rigs\r\n this._updateNumberOfRigCameras(2);\r\n this.rigCameras[0].viewport = new Viewport(0, 0, 0.5, 1.0);\r\n // this.rigCameras[0].position.x = -pupilDistance / 2;\r\n this.rigCameras[0].outputRenderTarget = null;\r\n this.rigCameras[1].viewport = new Viewport(0.5, 0, 0.5, 1.0);\r\n // this.rigCameras[1].position.x = pupilDistance / 2;\r\n this.rigCameras[1].outputRenderTarget = null;\r\n }\r\n\r\n /**\r\n * Sets this camera's transformation based on a non-vr camera\r\n * @param otherCamera the non-vr camera to copy the transformation from\r\n * @param resetToBaseReferenceSpace should XR reset to the base reference space\r\n */\r\n public setTransformationFromNonVRCamera(otherCamera: Camera = this.getScene().activeCamera!, resetToBaseReferenceSpace: boolean = true) {\r\n if (!otherCamera || otherCamera === this) {\r\n return;\r\n }\r\n const mat = otherCamera.computeWorldMatrix();\r\n mat.decompose(undefined, this.rotationQuaternion, this.position);\r\n // set the ground level\r\n this.position.y = 0;\r\n Quaternion.FromEulerAnglesToRef(0, this.rotationQuaternion.toEulerAngles().y, 0, this.rotationQuaternion);\r\n this._firstFrame = true;\r\n if (resetToBaseReferenceSpace) {\r\n this._xrSessionManager.resetReferenceSpace();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current instance class name (\"WebXRCamera\").\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"WebXRCamera\";\r\n }\r\n\r\n /**\r\n * Set the target for the camera to look at.\r\n * Note that this only rotates around the Y axis, as opposed to the default behavior of other cameras\r\n * @param target the target to set the camera to look at\r\n */\r\n public override setTarget(target: Vector3): void {\r\n // only rotate around the y axis!\r\n const tmpVector = TmpVectors.Vector3[1];\r\n target.subtractToRef(this.position, tmpVector);\r\n tmpVector.y = 0;\r\n tmpVector.normalize();\r\n const yRotation = Math.atan2(tmpVector.x, tmpVector.z) + (this._scene.useRightHandedSystem ? Math.PI : 0);\r\n this.rotationQuaternion.toEulerAnglesToRef(tmpVector);\r\n Quaternion.FromEulerAnglesToRef(tmpVector.x, yRotation, tmpVector.z, this.rotationQuaternion);\r\n }\r\n\r\n public override dispose() {\r\n super.dispose();\r\n this._lastXRViewerPose = undefined;\r\n this.onTrackingStateChanged.clear();\r\n }\r\n\r\n private _updateDepthNearFar() {\r\n const far = (this.maxZ || 10000) * this._xrSessionManager.worldScalingFactor;\r\n const xrRenderState: XRRenderStateInit = {\r\n // if maxZ is 0 it should be \"Infinity\", but it doesn't work with the WebXR API. Setting to a large number.\r\n depthFar: far,\r\n depthNear: this.minZ,\r\n };\r\n\r\n this._xrSessionManager.updateRenderState(xrRenderState);\r\n this._cache.minZ = this.minZ;\r\n this._cache.maxZ = far;\r\n }\r\n\r\n private _updateFromXRSession() {\r\n const pose = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.referenceSpace);\r\n this._lastXRViewerPose = pose || undefined;\r\n if (!pose) {\r\n this._setTrackingState(WebXRTrackingState.NOT_TRACKING);\r\n return;\r\n }\r\n\r\n // Set the tracking state. if it didn't change it is a no-op\r\n const trackingState = pose.emulatedPosition ? WebXRTrackingState.TRACKING_LOST : WebXRTrackingState.TRACKING;\r\n this._setTrackingState(trackingState);\r\n\r\n // check min/max Z and update if not the same as in cache\r\n if (this.minZ !== this._cache.minZ || this.maxZ !== this._cache.maxZ) {\r\n this._updateDepthNearFar();\r\n }\r\n\r\n if (pose.transform) {\r\n const orientation = pose.transform.orientation;\r\n if (pose.transform.orientation.x === undefined) {\r\n // Babylon native polyfill can return an undefined orientation value\r\n // When not initialized\r\n return;\r\n }\r\n const pos = pose.transform.position;\r\n this._referencedPosition.set(pos.x, pos.y, pos.z).scaleInPlace(this._xrSessionManager.worldScalingFactor);\r\n\r\n this._referenceQuaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this._referencedPosition.z *= -1;\r\n this._referenceQuaternion.z *= -1;\r\n this._referenceQuaternion.w *= -1;\r\n }\r\n\r\n if (this._firstFrame) {\r\n this._firstFrame = false;\r\n // we have the XR reference, now use this to find the offset to get the camera to be\r\n // in the right position\r\n\r\n // set the height to correlate to the current height\r\n this.position.y += this._referencedPosition.y;\r\n // avoid using the head rotation on the first frame.\r\n this._referenceQuaternion.copyFromFloats(0, 0, 0, 1);\r\n } else {\r\n // update position and rotation as reference\r\n this.rotationQuaternion.copyFrom(this._referenceQuaternion);\r\n this.position.copyFrom(this._referencedPosition);\r\n }\r\n }\r\n\r\n // Update camera rigs\r\n if (this.rigCameras.length !== pose.views.length) {\r\n this._updateNumberOfRigCameras(pose.views.length);\r\n }\r\n\r\n for (let i = 0; i < pose.views.length; i++) {\r\n const view = pose.views[i];\r\n const currentRig = <TargetCamera>this.rigCameras[i];\r\n // update right and left, where applicable\r\n if (!currentRig.isLeftCamera && !currentRig.isRightCamera) {\r\n if (view.eye === \"right\") {\r\n currentRig._isRightCamera = true;\r\n } else if (view.eye === \"left\") {\r\n currentRig._isLeftCamera = true;\r\n }\r\n }\r\n // add any custom render targets to this camera, if available in the scene\r\n const customRenderTargets = this.getScene().customRenderTargets;\r\n // use a for loop\r\n for (let i = 0; i < customRenderTargets.length; i++) {\r\n const rt = customRenderTargets[i];\r\n // make sure we don't add the same render target twice\r\n if (currentRig.customRenderTargets.indexOf(rt) === -1) {\r\n currentRig.customRenderTargets.push(rt);\r\n }\r\n }\r\n // Update view/projection matrix\r\n const pos = view.transform.position;\r\n const orientation = view.transform.orientation;\r\n\r\n currentRig.parent = this.parent;\r\n\r\n currentRig.position.set(pos.x, pos.y, pos.z).scaleInPlace(this._xrSessionManager.worldScalingFactor);\r\n currentRig.rotationQuaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n currentRig.position.z *= -1;\r\n currentRig.rotationQuaternion.z *= -1;\r\n currentRig.rotationQuaternion.w *= -1;\r\n }\r\n Matrix.FromFloat32ArrayToRefScaled(view.projectionMatrix, 0, 1, currentRig._projectionMatrix);\r\n\r\n if (!this._scene.useRightHandedSystem) {\r\n currentRig._projectionMatrix.toggleProjectionMatrixHandInPlace();\r\n }\r\n\r\n // fov\r\n const fov = Math.atan2(1, view.projectionMatrix[5]) * 2;\r\n currentRig.fov = fov;\r\n // first camera?\r\n if (i === 0) {\r\n this.fov = fov;\r\n this._projectionMatrix.copyFrom(currentRig._projectionMatrix);\r\n }\r\n\r\n const renderTargetTexture = this._xrSessionManager.getRenderTargetTextureForView(view);\r\n this._renderingMultiview = renderTargetTexture?._texture?.isMultiview || false;\r\n if (this._renderingMultiview) {\r\n // For multiview, the render target texture is the same per-view (just the slice index is different),\r\n // so we only need to set the output render target once for the rig parent.\r\n if (i == 0) {\r\n this._xrSessionManager.trySetViewportForView(this.viewport, view);\r\n this.outputRenderTarget = renderTargetTexture;\r\n }\r\n } else {\r\n // Update viewport\r\n this._xrSessionManager.trySetViewportForView(currentRig.viewport, view);\r\n\r\n // Set cameras to render to the session's render target\r\n currentRig.outputRenderTarget = renderTargetTexture || this._xrSessionManager.getRenderTargetTextureForView(view);\r\n }\r\n\r\n // Replicate parent rig camera behavior\r\n currentRig.layerMask = this.layerMask;\r\n }\r\n }\r\n\r\n private _updateNumberOfRigCameras(viewCount = 1) {\r\n while (this.rigCameras.length < viewCount) {\r\n const newCamera = new TargetCamera(\"XR-RigCamera: \" + this.rigCameras.length, Vector3.Zero(), this.getScene());\r\n newCamera.minZ = 0.1;\r\n newCamera.rotationQuaternion = new Quaternion();\r\n newCamera.updateUpVectorFromRotation = true;\r\n newCamera.isRigCamera = true;\r\n newCamera.rigParent = this;\r\n // do not compute projection matrix, provided by XR\r\n newCamera.freezeProjectionMatrix();\r\n this.rigCameras.push(newCamera);\r\n }\r\n while (this.rigCameras.length > viewCount) {\r\n const removedCamera = this.rigCameras.pop();\r\n if (removedCamera) {\r\n removedCamera.dispose();\r\n }\r\n }\r\n }\r\n\r\n private _updateReferenceSpace() {\r\n // were position & rotation updated OUTSIDE of the xr update loop\r\n if (!this.position.equals(this._referencedPosition) || !this.rotationQuaternion.equals(this._referenceQuaternion)) {\r\n const referencedMat = TmpVectors.Matrix[0];\r\n const poseMat = TmpVectors.Matrix[1];\r\n const transformMat = TmpVectors.Matrix[2];\r\n\r\n Matrix.ComposeToRef(WebXRCamera._ScaleReadOnly, this._referenceQuaternion, this._referencedPosition, referencedMat);\r\n Matrix.ComposeToRef(WebXRCamera._ScaleReadOnly, this.rotationQuaternion, this.position, poseMat);\r\n referencedMat.invert().multiplyToRef(poseMat, transformMat);\r\n transformMat.invert();\r\n\r\n if (!this._scene.useRightHandedSystem) {\r\n transformMat.toggleModelMatrixHandInPlace();\r\n }\r\n\r\n transformMat.decompose(undefined, this._referenceQuaternion, this._referencedPosition);\r\n const transform = new XRRigidTransform(\r\n {\r\n x: this._referencedPosition.x / this._xrSessionManager.worldScalingFactor,\r\n y: this._referencedPosition.y / this._xrSessionManager.worldScalingFactor,\r\n z: this._referencedPosition.z / this._xrSessionManager.worldScalingFactor,\r\n },\r\n {\r\n x: this._referenceQuaternion.x,\r\n y: this._referenceQuaternion.y,\r\n z: this._referenceQuaternion.z,\r\n w: this._referenceQuaternion.w,\r\n }\r\n );\r\n this._xrSessionManager.referenceSpace = this._xrSessionManager.referenceSpace.getOffsetReferenceSpace(transform);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"webXRCamera.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRCamera.ts"],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AI,CAAC,iBAAiB,CAAC,kBAAkB;gBACzE,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,kBAAkB;gBACzE,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,kBAAkB;gBACzE,CAAC,EAAE,CAAC;aACP,EACD;gBACI,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC9B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;aACjC,CACJ,CAAC;YACF,IAAI,CAAC,iBAAiB,CAAC,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;QACrH,CAAC;IACL,CAAC;;AApYc,0BAAc,GAAG,OAAO,CAAC,GAAG,EAAE,AAAhB,CAAiB","sourcesContent":["import { Vector3, Matrix, Quaternion, TmpVectors } from \"../Maths/math.vector\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport { FreeCamera } from \"../Cameras/freeCamera\";\r\nimport { TargetCamera } from \"../Cameras/targetCamera\";\r\nimport type { WebXRSessionManager } from \"./webXRSessionManager\";\r\nimport { Viewport } from \"../Maths/math.viewport\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { WebXRTrackingState } from \"./webXRTypes\";\r\n\r\n/**\r\n * WebXR Camera which holds the views for the xrSession\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRCamera\r\n */\r\nexport class WebXRCamera extends FreeCamera {\r\n private static _ScaleReadOnly = Vector3.One();\r\n\r\n private _firstFrame = false;\r\n private _referenceQuaternion: Quaternion = Quaternion.Identity();\r\n private _referencedPosition: Vector3 = new Vector3();\r\n private _trackingState: WebXRTrackingState = WebXRTrackingState.NOT_TRACKING;\r\n\r\n /**\r\n * This will be triggered after the first XR Frame initialized the camera,\r\n * including the right number of views and their rendering parameters\r\n */\r\n public onXRCameraInitializedObservable = new Observable<WebXRCamera>();\r\n\r\n /**\r\n * Observable raised before camera teleportation\r\n * @deprecated use onBeforeCameraTeleport of the teleportation feature instead\r\n */\r\n public onBeforeCameraTeleport = new Observable<Vector3>();\r\n\r\n /**\r\n * Observable raised after camera teleportation\r\n * @deprecated use onAfterCameraTeleport of the teleportation feature instead\r\n */\r\n public onAfterCameraTeleport = new Observable<Vector3>();\r\n\r\n /**\r\n * Notifies when the camera's tracking state has changed.\r\n * Notice - will also be triggered when tracking has started (at the beginning of the session)\r\n */\r\n public onTrackingStateChanged = new Observable<WebXRTrackingState>();\r\n\r\n /**\r\n * Should position compensation execute on first frame.\r\n * This is used when copying the position from a native (non XR) camera\r\n */\r\n public compensateOnFirstFrame: boolean = true;\r\n\r\n /**\r\n * The last XRViewerPose from the current XRFrame\r\n * @internal\r\n */\r\n public _lastXRViewerPose?: XRViewerPose;\r\n\r\n /**\r\n * Creates a new webXRCamera, this should only be set at the camera after it has been updated by the xrSessionManager\r\n * @param name the name of the camera\r\n * @param scene the scene to add the camera to\r\n * @param _xrSessionManager a constructed xr session manager\r\n */\r\n constructor(\r\n name: string,\r\n scene: Scene,\r\n private _xrSessionManager: WebXRSessionManager\r\n ) {\r\n super(name, Vector3.Zero(), scene);\r\n\r\n // Initial camera configuration\r\n this.minZ = 0.1;\r\n this.rotationQuaternion = new Quaternion();\r\n this.cameraRigMode = Camera.RIG_MODE_CUSTOM;\r\n this.updateUpVectorFromRotation = true;\r\n this._updateNumberOfRigCameras(1);\r\n // freeze projection matrix, which will be copied later\r\n this.freezeProjectionMatrix();\r\n this._deferOnly = true;\r\n\r\n this._xrSessionManager.onXRSessionInit.add(() => {\r\n this._referencedPosition.copyFromFloats(0, 0, 0);\r\n this._referenceQuaternion.copyFromFloats(0, 0, 0, 1);\r\n // first frame - camera's y position should be 0 for the correct offset\r\n this._firstFrame = this.compensateOnFirstFrame;\r\n this._xrSessionManager.onWorldScaleFactorChangedObservable.add(() => {\r\n // only run if in session\r\n if (!this._xrSessionManager.currentFrame) {\r\n return;\r\n }\r\n this._updateDepthNearFar();\r\n });\r\n });\r\n\r\n // Check transformation changes on each frame. Callback is added to be first so that the transformation will be\r\n // applied to the rest of the elements using the referenceSpace object\r\n this._xrSessionManager.onXRFrameObservable.add(\r\n () => {\r\n if (this._firstFrame) {\r\n this._updateFromXRSession();\r\n }\r\n if (this.onXRCameraInitializedObservable.hasObservers()) {\r\n this.onXRCameraInitializedObservable.notifyObservers(this);\r\n this.onXRCameraInitializedObservable.clear();\r\n }\r\n\r\n if (this._deferredUpdated) {\r\n this.position.copyFrom(this._deferredPositionUpdate);\r\n this.rotationQuaternion.copyFrom(this._deferredRotationQuaternionUpdate);\r\n }\r\n\r\n this._updateReferenceSpace();\r\n this._updateFromXRSession();\r\n },\r\n undefined,\r\n true\r\n );\r\n }\r\n\r\n /**\r\n * Get the current XR tracking state of the camera\r\n */\r\n public get trackingState(): WebXRTrackingState {\r\n return this._trackingState;\r\n }\r\n\r\n private _setTrackingState(newState: WebXRTrackingState) {\r\n if (this._trackingState !== newState) {\r\n this._trackingState = newState;\r\n this.onTrackingStateChanged.notifyObservers(newState);\r\n }\r\n }\r\n\r\n /**\r\n * Return the user's height, unrelated to the current ground.\r\n * This will be the y position of this camera, when ground level is 0.\r\n *\r\n * Note - this value is multiplied by the worldScalingFactor (if set), so it will be in the same units as the scene.\r\n */\r\n public get realWorldHeight(): number {\r\n const basePose = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.baseReferenceSpace);\r\n if (basePose && basePose.transform) {\r\n return basePose.transform.position.y * this._xrSessionManager.worldScalingFactor;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _updateForDualEyeDebugging(/*pupilDistance = 0.01*/) {\r\n // Create initial camera rigs\r\n this._updateNumberOfRigCameras(2);\r\n this.rigCameras[0].viewport = new Viewport(0, 0, 0.5, 1.0);\r\n // this.rigCameras[0].position.x = -pupilDistance / 2;\r\n this.rigCameras[0].outputRenderTarget = null;\r\n this.rigCameras[1].viewport = new Viewport(0.5, 0, 0.5, 1.0);\r\n // this.rigCameras[1].position.x = pupilDistance / 2;\r\n this.rigCameras[1].outputRenderTarget = null;\r\n }\r\n\r\n /**\r\n * Sets this camera's transformation based on a non-vr camera\r\n * @param otherCamera the non-vr camera to copy the transformation from\r\n * @param resetToBaseReferenceSpace should XR reset to the base reference space\r\n */\r\n public setTransformationFromNonVRCamera(otherCamera: Camera = this.getScene().activeCamera!, resetToBaseReferenceSpace: boolean = true) {\r\n if (!otherCamera || otherCamera === this) {\r\n return;\r\n }\r\n const mat = otherCamera.computeWorldMatrix();\r\n mat.decompose(undefined, this.rotationQuaternion, this.position);\r\n // set the ground level\r\n this.position.y = 0;\r\n Quaternion.FromEulerAnglesToRef(0, this.rotationQuaternion.toEulerAngles().y, 0, this.rotationQuaternion);\r\n this._firstFrame = true;\r\n if (resetToBaseReferenceSpace) {\r\n this._xrSessionManager.resetReferenceSpace();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current instance class name (\"WebXRCamera\").\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"WebXRCamera\";\r\n }\r\n\r\n /**\r\n * Set the target for the camera to look at.\r\n * Note that this only rotates around the Y axis, as opposed to the default behavior of other cameras\r\n * @param target the target to set the camera to look at\r\n */\r\n public override setTarget(target: Vector3): void {\r\n // only rotate around the y axis!\r\n const tmpVector = TmpVectors.Vector3[1];\r\n target.subtractToRef(this.position, tmpVector);\r\n tmpVector.y = 0;\r\n tmpVector.normalize();\r\n const yRotation = Math.atan2(tmpVector.x, tmpVector.z) + (this._scene.useRightHandedSystem ? Math.PI : 0);\r\n this.rotationQuaternion.toEulerAnglesToRef(tmpVector);\r\n Quaternion.FromEulerAnglesToRef(tmpVector.x, yRotation, tmpVector.z, this.rotationQuaternion);\r\n }\r\n\r\n public override dispose() {\r\n super.dispose();\r\n this._lastXRViewerPose = undefined;\r\n this.onTrackingStateChanged.clear();\r\n }\r\n\r\n private _updateDepthNearFar() {\r\n const far = (this.maxZ || 10000) * this._xrSessionManager.worldScalingFactor;\r\n const xrRenderState: XRRenderStateInit = {\r\n // if maxZ is 0 it should be \"Infinity\", but it doesn't work with the WebXR API. Setting to a large number.\r\n depthFar: far,\r\n depthNear: this.minZ,\r\n };\r\n\r\n this._xrSessionManager.updateRenderState(xrRenderState);\r\n this._cache.minZ = this.minZ;\r\n this._cache.maxZ = far;\r\n }\r\n\r\n private _updateFromXRSession() {\r\n const pose = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.referenceSpace);\r\n this._lastXRViewerPose = pose || undefined;\r\n if (!pose) {\r\n this._setTrackingState(WebXRTrackingState.NOT_TRACKING);\r\n return;\r\n }\r\n\r\n // Set the tracking state. if it didn't change it is a no-op\r\n const trackingState = pose.emulatedPosition ? WebXRTrackingState.TRACKING_LOST : WebXRTrackingState.TRACKING;\r\n this._setTrackingState(trackingState);\r\n\r\n // check min/max Z and update if not the same as in cache\r\n if (this.minZ !== this._cache.minZ || this.maxZ !== this._cache.maxZ) {\r\n this._updateDepthNearFar();\r\n }\r\n\r\n if (pose.transform) {\r\n const orientation = pose.transform.orientation;\r\n if (pose.transform.orientation.x === undefined) {\r\n // Babylon native polyfill can return an undefined orientation value\r\n // When not initialized\r\n return;\r\n }\r\n const pos = pose.transform.position;\r\n this._referencedPosition.set(pos.x, pos.y, pos.z).scaleInPlace(this._xrSessionManager.worldScalingFactor);\r\n\r\n this._referenceQuaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this._referencedPosition.z *= -1;\r\n this._referenceQuaternion.z *= -1;\r\n this._referenceQuaternion.w *= -1;\r\n }\r\n\r\n if (this._firstFrame) {\r\n this._firstFrame = false;\r\n // we have the XR reference, now use this to find the offset to get the camera to be\r\n // in the right position\r\n\r\n // set the height to correlate to the current height\r\n this.position.y += this._referencedPosition.y;\r\n // avoid using the head rotation on the first frame.\r\n this._referenceQuaternion.copyFromFloats(0, 0, 0, 1);\r\n } else {\r\n // update position and rotation as reference\r\n this.rotationQuaternion.copyFrom(this._referenceQuaternion);\r\n this.position.copyFrom(this._referencedPosition);\r\n }\r\n }\r\n\r\n // Update camera rigs\r\n if (this.rigCameras.length !== pose.views.length) {\r\n this._updateNumberOfRigCameras(pose.views.length);\r\n }\r\n\r\n for (let i = 0; i < pose.views.length; i++) {\r\n const view = pose.views[i];\r\n const currentRig = <TargetCamera>this.rigCameras[i];\r\n // update right and left, where applicable\r\n if (!currentRig.isLeftCamera && !currentRig.isRightCamera) {\r\n if (view.eye === \"right\") {\r\n currentRig._isRightCamera = true;\r\n } else if (view.eye === \"left\") {\r\n currentRig._isLeftCamera = true;\r\n }\r\n }\r\n // add any custom render targets to this camera, if available in the scene\r\n const customRenderTargets = this.getScene().customRenderTargets;\r\n // use a for loop\r\n for (let i = 0; i < customRenderTargets.length; i++) {\r\n const rt = customRenderTargets[i];\r\n // make sure we don't add the same render target twice\r\n if (currentRig.customRenderTargets.indexOf(rt) === -1) {\r\n currentRig.customRenderTargets.push(rt);\r\n }\r\n }\r\n // Update view/projection matrix\r\n const pos = view.transform.position;\r\n const orientation = view.transform.orientation;\r\n\r\n currentRig.parent = this.parent;\r\n\r\n currentRig.position.set(pos.x, pos.y, pos.z).scaleInPlace(this._xrSessionManager.worldScalingFactor);\r\n currentRig.rotationQuaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n currentRig.position.z *= -1;\r\n currentRig.rotationQuaternion.z *= -1;\r\n currentRig.rotationQuaternion.w *= -1;\r\n }\r\n Matrix.FromFloat32ArrayToRefScaled(view.projectionMatrix, 0, 1, currentRig._projectionMatrix);\r\n\r\n if (!this._scene.useRightHandedSystem) {\r\n currentRig._projectionMatrix.toggleProjectionMatrixHandInPlace();\r\n }\r\n\r\n // fov\r\n const fov = Math.atan2(1, view.projectionMatrix[5]) * 2;\r\n currentRig.fov = fov;\r\n // first camera?\r\n if (i === 0) {\r\n this.fov = fov;\r\n this._projectionMatrix.copyFrom(currentRig._projectionMatrix);\r\n }\r\n\r\n const renderTargetTexture = this._xrSessionManager.getRenderTargetTextureForView(view);\r\n this._renderingMultiview = renderTargetTexture?._texture?.isMultiview || false;\r\n if (this._renderingMultiview) {\r\n // For multiview, the render target texture is the same per-view (just the slice index is different),\r\n // so we only need to set the output render target once for the rig parent.\r\n if (i == 0) {\r\n this._xrSessionManager.trySetViewportForView(this.viewport, view);\r\n this.outputRenderTarget = renderTargetTexture;\r\n }\r\n } else {\r\n // Update viewport\r\n this._xrSessionManager.trySetViewportForView(currentRig.viewport, view);\r\n\r\n // Set cameras to render to the session's render target\r\n currentRig.outputRenderTarget = renderTargetTexture || this._xrSessionManager.getRenderTargetTextureForView(view);\r\n }\r\n\r\n // Replicate parent rig camera behavior\r\n currentRig.layerMask = this.layerMask;\r\n }\r\n }\r\n\r\n private _updateNumberOfRigCameras(viewCount = 1) {\r\n while (this.rigCameras.length < viewCount) {\r\n const newCamera = new TargetCamera(\"XR-RigCamera: \" + this.rigCameras.length, Vector3.Zero(), this.getScene());\r\n newCamera.minZ = 0.1;\r\n newCamera.rotationQuaternion = new Quaternion();\r\n newCamera.updateUpVectorFromRotation = true;\r\n newCamera.isRigCamera = true;\r\n newCamera.rigParent = this;\r\n // do not compute projection matrix, provided by XR\r\n newCamera.freezeProjectionMatrix();\r\n this.rigCameras.push(newCamera);\r\n }\r\n while (this.rigCameras.length > viewCount) {\r\n const removedCamera = this.rigCameras.pop();\r\n if (removedCamera) {\r\n removedCamera.dispose();\r\n }\r\n }\r\n }\r\n\r\n private _updateReferenceSpace() {\r\n // were position & rotation updated OUTSIDE of the xr update loop\r\n if (!this.position.equals(this._referencedPosition) || !this.rotationQuaternion.equals(this._referenceQuaternion)) {\r\n const referencedMat = TmpVectors.Matrix[0];\r\n const poseMat = TmpVectors.Matrix[1];\r\n const transformMat = TmpVectors.Matrix[2];\r\n\r\n Matrix.ComposeToRef(WebXRCamera._ScaleReadOnly, this._referenceQuaternion, this._referencedPosition, referencedMat);\r\n Matrix.ComposeToRef(WebXRCamera._ScaleReadOnly, this.rotationQuaternion, this.position, poseMat);\r\n referencedMat.invert().multiplyToRef(poseMat, transformMat);\r\n transformMat.invert();\r\n\r\n if (!this._scene.useRightHandedSystem) {\r\n transformMat.toggleModelMatrixHandInPlace();\r\n }\r\n\r\n transformMat.decompose(undefined, this._referenceQuaternion, this._referencedPosition);\r\n const transform = new XRRigidTransform(\r\n {\r\n x: this._referencedPosition.x / this._xrSessionManager.worldScalingFactor,\r\n y: this._referencedPosition.y / this._xrSessionManager.worldScalingFactor,\r\n z: this._referencedPosition.z / this._xrSessionManager.worldScalingFactor,\r\n w: 1,\r\n },\r\n {\r\n x: this._referenceQuaternion.x,\r\n y: this._referenceQuaternion.y,\r\n z: this._referenceQuaternion.z,\r\n w: this._referenceQuaternion.w,\r\n }\r\n );\r\n this._xrSessionManager.referenceSpace = this._xrSessionManager.referenceSpace.getOffsetReferenceSpace(transform);\r\n }\r\n }\r\n}\r\n"]}
@@ -33,4 +33,4 @@ else if (typeof define === 'function' && define['amd'])
33
33
  else if (typeof exports === 'object')
34
34
  exports["DracoDecoderModule"] = DracoDecoderModule;
35
35
  else
36
- globalThis["DracoDecoderModule"] = DracoDecoderModule;
36
+ (typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this)["DracoDecoderModule"] = DracoDecoderModule;
@@ -32,4 +32,4 @@ else if (typeof define === 'function' && define['amd'])
32
32
  else if (typeof exports === 'object')
33
33
  exports["DracoDecoderModule"] = DracoDecoderModule;
34
34
  else
35
- globalThis["DracoDecoderModule"] = DracoDecoderModule;
35
+ (typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this)["DracoDecoderModule"] = DracoDecoderModule;
@@ -36,3 +36,5 @@ else if (typeof define === 'function' && define['amd'])
36
36
  define([], function() { return DracoEncoderModule; });
37
37
  else if (typeof exports === 'object')
38
38
  exports["DracoEncoderModule"] = DracoEncoderModule;
39
+ else
40
+ (typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this)["DracoEncoderModule"] = DracoEncoderModule;
@@ -93,4 +93,4 @@ function(){return Wb(this.ptr)};x.prototype.__destroy__=x.prototype.__destroy__=
93
93
  typeof c&&(c=c.ptr);Zb(d,b,c)};A.prototype.SetAttributeExplicitQuantization=A.prototype.SetAttributeExplicitQuantization=function(b,c,d,e,g){var t=this.ptr;n.prepare();b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);"object"==typeof e&&(e=Y(e));g&&"object"===typeof g&&(g=g.ptr);$b(t,b,c,d,e,g)};A.prototype.SetSpeedOptions=A.prototype.SetSpeedOptions=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);
94
94
  ac(d,b,c)};A.prototype.SetTrackEncodedProperties=A.prototype.SetTrackEncodedProperties=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);bc(c,b)};A.prototype.EncodeToDracoBuffer=A.prototype.EncodeToDracoBuffer=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return cc(d,b,c)};A.prototype.GetNumberOfEncodedPoints=A.prototype.GetNumberOfEncodedPoints=function(){return dc(this.ptr)};A.prototype.GetNumberOfEncodedFaces=A.prototype.GetNumberOfEncodedFaces=
95
95
  function(){return ec(this.ptr)};A.prototype.__destroy__=A.prototype.__destroy__=function(){fc(this.ptr)};(function(){function b(){a.INVALID=gc();a.POSITION=hc();a.NORMAL=ic();a.COLOR=jc();a.TEX_COORD=kc();a.GENERIC=lc();a.INVALID_GEOMETRY_TYPE=mc();a.POINT_CLOUD=nc();a.TRIANGULAR_MESH=oc();a.MESH_SEQUENTIAL_ENCODING=pc();a.MESH_EDGEBREAKER_ENCODING=qc()}ta?b():ma.unshift(b)})();if("function"===typeof a.onModuleParsed)a.onModuleParsed();return p.ready}}();
96
- "object"===typeof exports&&"object"===typeof module?module.exports=DracoEncoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoEncoderModule}):"object"===typeof exports&&(exports.DracoEncoderModule=DracoEncoderModule);
96
+ "object"===typeof exports&&"object"===typeof module?module.exports=DracoEncoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoEncoderModule}):"object"===typeof exports?(exports.DracoEncoderModule=DracoEncoderModule):("undefined"!==typeof self?self:"undefined"!==typeof global?global:this)["DracoEncoderModule"]=DracoEncoderModule;
@@ -114,4 +114,4 @@ b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"=
114
114
  m.prototype.DecodeBufferToPointCloud=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return D(Mc(d,b,c),B)};m.prototype.DecodeBufferToMesh=m.prototype.DecodeBufferToMesh=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return D(Nc(d,b,c),B)};m.prototype.__destroy__=m.prototype.__destroy__=function(){Oc(this.ptr)};(function(){function b(){a.ATTRIBUTE_INVALID_TRANSFORM=Pc();a.ATTRIBUTE_NO_TRANSFORM=Qc();
115
115
  a.ATTRIBUTE_QUANTIZATION_TRANSFORM=Rc();a.ATTRIBUTE_OCTAHEDRON_TRANSFORM=Sc();a.INVALID=Tc();a.POSITION=Uc();a.NORMAL=Vc();a.COLOR=Wc();a.TEX_COORD=Xc();a.GENERIC=Yc();a.INVALID_GEOMETRY_TYPE=Zc();a.POINT_CLOUD=$c();a.TRIANGULAR_MESH=ad();a.DT_INVALID=bd();a.DT_INT8=cd();a.DT_UINT8=dd();a.DT_INT16=ed();a.DT_UINT16=fd();a.DT_INT32=gd();a.DT_UINT32=hd();a.DT_INT64=id();a.DT_UINT64=jd();a.DT_FLOAT32=kd();a.DT_FLOAT64=ld();a.DT_BOOL=md();a.DT_TYPES_COUNT=nd();a.OK=od();a.DRACO_ERROR=pd();a.IO_ERROR=qd();
116
116
  a.INVALID_PARAMETER=rd();a.UNSUPPORTED_VERSION=sd();a.UNKNOWN_VERSION=td()}za?b():oa.unshift(b)})();if("function"===typeof a.onModuleParsed)a.onModuleParsed();a.Decoder.prototype.GetEncodedGeometryType=function(b){if(b.__class__&&b.__class__===a.DecoderBuffer)return a.Decoder.prototype.GetEncodedGeometryType_Deprecated(b);if(8>b.byteLength)return a.INVALID_GEOMETRY_TYPE;switch(b[7]){case 0:return a.POINT_CLOUD;case 1:return a.TRIANGULAR_MESH;default:return a.INVALID_GEOMETRY_TYPE}};return n.ready}}();
117
- "object"===typeof exports&&"object"===typeof module?module.exports=DracoDecoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoDecoderModule}):"object"===typeof exports?(exports.DracoDecoderModule=DracoDecoderModule):globalThis["DracoDecoderModule"] = DracoDecoderModule;
117
+ "object"===typeof exports&&"object"===typeof module?module.exports=DracoDecoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoDecoderModule}):"object"===typeof exports?(exports.DracoDecoderModule=DracoDecoderModule):("undefined"!==typeof self?self:"undefined"!==typeof global?global:this)["DracoDecoderModule"]=DracoDecoderModule;
@@ -113,4 +113,4 @@ typeof d&&(d=d.ptr);return!!Dc(g,b,c,d)};m.prototype.GetAttributeDataArrayForAll
113
113
  b)};m.prototype.GetEncodedGeometryType_Deprecated=m.prototype.GetEncodedGeometryType_Deprecated=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Gc(c,b)};m.prototype.DecodeBufferToPointCloud=m.prototype.DecodeBufferToPointCloud=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return B(Hc(d,b,c),C)};m.prototype.DecodeBufferToMesh=m.prototype.DecodeBufferToMesh=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===
114
114
  typeof c&&(c=c.ptr);return B(Ic(d,b,c),C)};m.prototype.__destroy__=m.prototype.__destroy__=function(){Jc(this.ptr)};(function(){function b(){a.ATTRIBUTE_INVALID_TRANSFORM=Kc();a.ATTRIBUTE_NO_TRANSFORM=Lc();a.ATTRIBUTE_QUANTIZATION_TRANSFORM=Mc();a.ATTRIBUTE_OCTAHEDRON_TRANSFORM=Nc();a.INVALID=Oc();a.POSITION=Pc();a.NORMAL=Qc();a.COLOR=Rc();a.TEX_COORD=Sc();a.GENERIC=Tc();a.INVALID_GEOMETRY_TYPE=Uc();a.POINT_CLOUD=Vc();a.TRIANGULAR_MESH=Wc();a.DT_INVALID=Xc();a.DT_INT8=Yc();a.DT_UINT8=Zc();a.DT_INT16=
115
115
  $c();a.DT_UINT16=ad();a.DT_INT32=bd();a.DT_UINT32=cd();a.DT_INT64=dd();a.DT_UINT64=ed();a.DT_FLOAT32=fd();a.DT_FLOAT64=gd();a.DT_BOOL=hd();a.DT_TYPES_COUNT=id();a.OK=jd();a.DRACO_ERROR=kd();a.IO_ERROR=ld();a.INVALID_PARAMETER=md();a.UNSUPPORTED_VERSION=nd();a.UNKNOWN_VERSION=od()}va?b():oa.unshift(b)})();if("function"===typeof a.onModuleParsed)a.onModuleParsed();a.Decoder.prototype.GetEncodedGeometryType=function(b){if(b.__class__&&b.__class__===a.DecoderBuffer)return a.Decoder.prototype.GetEncodedGeometryType_Deprecated(b);
116
- if(8>b.byteLength)return a.INVALID_GEOMETRY_TYPE;switch(b[7]){case 0:return a.POINT_CLOUD;case 1:return a.TRIANGULAR_MESH;default:return a.INVALID_GEOMETRY_TYPE}};return n.ready}}();"object"===typeof exports&&"object"===typeof module?module.exports=DracoDecoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoDecoderModule}):"object"===typeof exports?(exports.DracoDecoderModule=DracoDecoderModule):globalThis["DracoDecoderModule"] = DracoDecoderModule;
116
+ if(8>b.byteLength)return a.INVALID_GEOMETRY_TYPE;switch(b[7]){case 0:return a.POINT_CLOUD;case 1:return a.TRIANGULAR_MESH;default:return a.INVALID_GEOMETRY_TYPE}};return n.ready}}();"object"===typeof exports&&"object"===typeof module?module.exports=DracoDecoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoDecoderModule}):"object"===typeof exports?(exports.DracoDecoderModule=DracoDecoderModule):("undefined"!==typeof self?self:"undefined"!==typeof global?global:this)["DracoDecoderModule"]=DracoDecoderModule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onerjs/core",
3
- "version": "8.25.4",
3
+ "version": "8.25.6",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",
package/scene.js CHANGED
@@ -3973,7 +3973,7 @@ export class Scene {
3973
3973
  if (renderTarget._shouldRender()) {
3974
3974
  this._renderId++;
3975
3975
  const hasSpecialRenderTargetCamera = renderTarget.activeCamera && renderTarget.activeCamera !== this.activeCamera;
3976
- if (renderTarget.enableBoundingBoxRendering && boundingBoxRenderer && !currentBoundingBoxMeshList) {
3976
+ if (boundingBoxRenderer && !currentBoundingBoxMeshList) {
3977
3977
  // Saves the current bounding box mesh list (potentially built by the call to _evaluateActiveMeshes above), which will be reset/updated when processing this target
3978
3978
  currentBoundingBoxMeshList = boundingBoxRenderer.renderList.length > 0 ? boundingBoxRenderer.renderList.data.slice() : [];
3979
3979
  currentBoundingBoxMeshList.length = boundingBoxRenderer.renderList.length;