@babylonjs/core 5.12.1 → 5.13.2

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 (74) hide show
  1. package/Bones/skeleton.d.ts +1 -1
  2. package/Bones/skeleton.js +4 -4
  3. package/Bones/skeleton.js.map +1 -1
  4. package/Cameras/camera.js +5 -1
  5. package/Cameras/camera.js.map +1 -1
  6. package/Debug/boneAxesViewer.js +0 -1
  7. package/Debug/boneAxesViewer.js.map +1 -1
  8. package/DeviceInput/InputDevices/webDeviceInputSystem.d.ts +2 -0
  9. package/DeviceInput/InputDevices/webDeviceInputSystem.js +31 -10
  10. package/DeviceInput/InputDevices/webDeviceInputSystem.js.map +1 -1
  11. package/Engines/Extensions/engine.multiRender.js +16 -3
  12. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  13. package/Engines/Extensions/engine.renderTarget.js +64 -8
  14. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  15. package/Engines/engine.d.ts +6 -0
  16. package/Engines/engine.js +11 -0
  17. package/Engines/engine.js.map +1 -1
  18. package/Engines/nativeEngine.d.ts +1 -1
  19. package/Engines/nativeEngine.js.map +1 -1
  20. package/Engines/nullEngine.d.ts +1 -1
  21. package/Engines/nullEngine.js +1 -1
  22. package/Engines/nullEngine.js.map +1 -1
  23. package/Engines/thinEngine.d.ts +2 -2
  24. package/Engines/thinEngine.js +12 -9
  25. package/Engines/thinEngine.js.map +1 -1
  26. package/Engines/webgpuEngine.d.ts +1 -1
  27. package/Engines/webgpuEngine.js.map +1 -1
  28. package/Events/deviceInputEvents.d.ts +1 -1
  29. package/Events/deviceInputEvents.js.map +1 -1
  30. package/Gizmos/boundingBoxGizmo.js +0 -5
  31. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  32. package/Lights/light.js +4 -1
  33. package/Lights/light.js.map +1 -1
  34. package/Loading/Plugins/babylonFileLoader.js +33 -8
  35. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  36. package/Materials/Node/Blocks/Fragment/TBNBlock.d.ts +3 -3
  37. package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
  38. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +1 -1
  39. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  40. package/Materials/Node/Blocks/colorMergerBlock.js +4 -4
  41. package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
  42. package/Materials/PBR/pbrBaseMaterial.js +3 -0
  43. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  44. package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +1 -1
  45. package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
  46. package/Materials/PBR/pbrMetallicRoughnessMaterial.d.ts +1 -1
  47. package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
  48. package/Materials/PBR/pbrSpecularGlossinessMaterial.d.ts +1 -1
  49. package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
  50. package/Materials/Textures/texture.d.ts +1 -1
  51. package/Materials/Textures/texture.js.map +1 -1
  52. package/Materials/standardMaterial.js +2 -0
  53. package/Materials/standardMaterial.js.map +1 -1
  54. package/Maths/math.vector.js +3 -3
  55. package/Maths/math.vector.js.map +1 -1
  56. package/Meshes/instancedMesh.d.ts +5 -0
  57. package/Meshes/instancedMesh.js +9 -0
  58. package/Meshes/instancedMesh.js.map +1 -1
  59. package/Meshes/mesh.js +8 -2
  60. package/Meshes/mesh.js.map +1 -1
  61. package/Meshes/transformNode.js +4 -5
  62. package/Meshes/transformNode.js.map +1 -1
  63. package/Rendering/depthRenderer.js +28 -0
  64. package/Rendering/depthRenderer.js.map +1 -1
  65. package/Shaders/depth.fragment.d.ts +2 -0
  66. package/Shaders/depth.fragment.js +3 -1
  67. package/Shaders/depth.fragment.js.map +1 -1
  68. package/Shaders/depth.vertex.d.ts +2 -0
  69. package/Shaders/depth.vertex.js +3 -1
  70. package/Shaders/depth.vertex.js.map +1 -1
  71. package/node.d.ts +7 -0
  72. package/node.js +9 -0
  73. package/node.js.map +1 -1
  74. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { PointerInput } from "../DeviceInput/InputDevices/deviceEnums";
1
+ import type { PointerInput } from "../DeviceInput/InputDevices/deviceEnums";
2
2
  /**
3
3
  * Event Types
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"deviceInputEvents.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Events/deviceInputEvents.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,oBAQX;AARD,WAAY,oBAAoB;IAC5B,WAAW;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,gBAAgB;IAChB,yEAAS,CAAA;AACb,CAAC,EARW,oBAAoB,KAApB,oBAAoB,QAQ/B;AAwQD;;GAEG;AACH;IAAA;IAeA,CAAC;IAdG;;OAEG;IACW,8BAAe,GAAG,IAAI,CAAC;IAErC;;OAEG;IACW,6BAAc,GAAG,IAAI,CAAC;IAEpC;;OAEG;IACW,6BAAc,GAAG,IAAI,CAAC;IACxC,qBAAC;CAAA,AAfD,IAeC;SAfY,cAAc","sourcesContent":["import { PointerInput } from \"../DeviceInput/InputDevices/deviceEnums\";\r\n\r\n/**\r\n * Event Types\r\n */\r\nexport enum DeviceInputEventType {\r\n // Pointers\r\n /** PointerMove */\r\n PointerMove,\r\n /** PointerDown */\r\n PointerDown,\r\n /** PointerUp */\r\n PointerUp,\r\n}\r\n\r\n/**\r\n * Native friendly interface for Event Object\r\n */\r\nexport interface IUIEvent {\r\n /**\r\n * Input array index\r\n */\r\n inputIndex: number;\r\n\r\n /**\r\n * Current target for an event\r\n */\r\n currentTarget?: any;\r\n\r\n /**\r\n * Alias for target\r\n * @deprecated Use target instead\r\n */\r\n srcElement?: any;\r\n\r\n /**\r\n * Type of event\r\n */\r\n type: string;\r\n\r\n /**\r\n * Reference to object where object was dispatched\r\n */\r\n target: any;\r\n\r\n /**\r\n * Tells user agent what to do when not explicitly handled\r\n */\r\n preventDefault: () => void;\r\n}\r\n\r\n/**\r\n * Native friendly interface for KeyboardEvent Object\r\n */\r\nexport interface IKeyboardEvent extends IUIEvent {\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Unicode value of character pressed\r\n * @deprecated Required for event, use keyCode instead.\r\n */\r\n charCode?: number;\r\n\r\n /**\r\n * Code for key based on layout\r\n */\r\n code: string;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * String representation of key\r\n */\r\n key: string;\r\n /**\r\n * ASCII value of key\r\n * @deprecated Used with DeviceSourceManager\r\n */\r\n keyCode: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n}\r\n\r\n/**\r\n * Native friendly interface for MouseEvent Object\r\n */\r\nexport interface IMouseEvent extends IUIEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical>;\r\n\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Value of single mouse button pressed\r\n */\r\n button: number;\r\n\r\n /**\r\n * Value of all mouse buttons pressed\r\n */\r\n buttons: number;\r\n\r\n /**\r\n * Current X coordinate\r\n */\r\n clientX: number;\r\n\r\n /**\r\n * Current Y coordinate\r\n */\r\n clientY: number;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * Provides current click count\r\n */\r\n detail?: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n movementX: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n movementY: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n mozMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n mozMovementY?: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n msMovementX?: any;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n msMovementY?: any;\r\n\r\n /**\r\n * Current coordinate of X within container\r\n */\r\n offsetX: number;\r\n\r\n /**\r\n * Current coordinate of Y within container\r\n */\r\n offsetY: number;\r\n\r\n /**\r\n * Horizontal coordinate of event\r\n */\r\n pageX: number;\r\n\r\n /**\r\n * Vertical coordinate of event\r\n */\r\n pageY: number;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n webkitMovementX?: any;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n webkitMovementY?: any;\r\n\r\n /**\r\n * Alias of clientX\r\n */\r\n x: number;\r\n\r\n /**\r\n * Alias of clientY\r\n */\r\n y: number;\r\n}\r\n\r\n/**\r\n * Native friendly interface for PointerEvent Object\r\n */\r\nexport interface IPointerEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically and mouse wheel values\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical | PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ>;\r\n\r\n /**\r\n * Pointer Event ID\r\n */\r\n pointerId: number;\r\n\r\n /**\r\n * Type of pointer\r\n */\r\n pointerType: string;\r\n}\r\n\r\n/**\r\n * Native friendly interface for WheelEvent Object\r\n */\r\nexport interface IWheelEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events that can only be used with mouse wheel\r\n */\r\n inputIndex: PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ;\r\n\r\n /**\r\n * Units for delta value\r\n */\r\n deltaMode: number;\r\n\r\n /**\r\n * Horizontal scroll delta\r\n */\r\n deltaX: number;\r\n\r\n /**\r\n * Vertical scroll delta\r\n */\r\n deltaY: number;\r\n\r\n /**\r\n * Z-Axis scroll delta\r\n */\r\n deltaZ: number;\r\n\r\n /**\r\n * WheelDelta (From MouseWheel Event)\r\n */\r\n wheelDelta?: number;\r\n}\r\n\r\n/**\r\n * Constants used for Events\r\n */\r\nexport class EventConstants {\r\n /**\r\n * Pixel delta for Wheel Events (Default)\r\n */\r\n public static DOM_DELTA_PIXEL = 0x00;\r\n\r\n /**\r\n * Line delta for Wheel Events\r\n */\r\n public static DOM_DELTA_LINE = 0x01;\r\n\r\n /**\r\n * Page delta for Wheel Events\r\n */\r\n public static DOM_DELTA_PAGE = 0x02;\r\n}\r\n"]}
1
+ {"version":3,"file":"deviceInputEvents.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Events/deviceInputEvents.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,oBAQX;AARD,WAAY,oBAAoB;IAC5B,WAAW;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,kBAAkB;IAClB,6EAAW,CAAA;IACX,gBAAgB;IAChB,yEAAS,CAAA;AACb,CAAC,EARW,oBAAoB,KAApB,oBAAoB,QAQ/B;AAwQD;;GAEG;AACH;IAAA;IAeA,CAAC;IAdG;;OAEG;IACW,8BAAe,GAAG,IAAI,CAAC;IAErC;;OAEG;IACW,6BAAc,GAAG,IAAI,CAAC;IAEpC;;OAEG;IACW,6BAAc,GAAG,IAAI,CAAC;IACxC,qBAAC;CAAA,AAfD,IAeC;SAfY,cAAc","sourcesContent":["import type { PointerInput } from \"../DeviceInput/InputDevices/deviceEnums\";\r\n\r\n/**\r\n * Event Types\r\n */\r\nexport enum DeviceInputEventType {\r\n // Pointers\r\n /** PointerMove */\r\n PointerMove,\r\n /** PointerDown */\r\n PointerDown,\r\n /** PointerUp */\r\n PointerUp,\r\n}\r\n\r\n/**\r\n * Native friendly interface for Event Object\r\n */\r\nexport interface IUIEvent {\r\n /**\r\n * Input array index\r\n */\r\n inputIndex: number;\r\n\r\n /**\r\n * Current target for an event\r\n */\r\n currentTarget?: any;\r\n\r\n /**\r\n * Alias for target\r\n * @deprecated Use target instead\r\n */\r\n srcElement?: any;\r\n\r\n /**\r\n * Type of event\r\n */\r\n type: string;\r\n\r\n /**\r\n * Reference to object where object was dispatched\r\n */\r\n target: any;\r\n\r\n /**\r\n * Tells user agent what to do when not explicitly handled\r\n */\r\n preventDefault: () => void;\r\n}\r\n\r\n/**\r\n * Native friendly interface for KeyboardEvent Object\r\n */\r\nexport interface IKeyboardEvent extends IUIEvent {\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Unicode value of character pressed\r\n * @deprecated Required for event, use keyCode instead.\r\n */\r\n charCode?: number;\r\n\r\n /**\r\n * Code for key based on layout\r\n */\r\n code: string;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * String representation of key\r\n */\r\n key: string;\r\n /**\r\n * ASCII value of key\r\n * @deprecated Used with DeviceSourceManager\r\n */\r\n keyCode: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n}\r\n\r\n/**\r\n * Native friendly interface for MouseEvent Object\r\n */\r\nexport interface IMouseEvent extends IUIEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical>;\r\n\r\n /**\r\n * Status of Alt key being pressed\r\n */\r\n altKey: boolean;\r\n\r\n /**\r\n * Value of single mouse button pressed\r\n */\r\n button: number;\r\n\r\n /**\r\n * Value of all mouse buttons pressed\r\n */\r\n buttons: number;\r\n\r\n /**\r\n * Current X coordinate\r\n */\r\n clientX: number;\r\n\r\n /**\r\n * Current Y coordinate\r\n */\r\n clientY: number;\r\n\r\n /**\r\n * Status of Ctrl key being pressed\r\n */\r\n ctrlKey: boolean;\r\n\r\n /**\r\n * Provides current click count\r\n */\r\n detail?: number;\r\n\r\n /**\r\n * Status of Meta key (eg. Windows key) being pressed\r\n */\r\n metaKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n movementX: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n movementY: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n mozMovementX?: number;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n mozMovementY?: number;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n msMovementX?: any;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n msMovementY?: any;\r\n\r\n /**\r\n * Current coordinate of X within container\r\n */\r\n offsetX: number;\r\n\r\n /**\r\n * Current coordinate of Y within container\r\n */\r\n offsetY: number;\r\n\r\n /**\r\n * Horizontal coordinate of event\r\n */\r\n pageX: number;\r\n\r\n /**\r\n * Vertical coordinate of event\r\n */\r\n pageY: number;\r\n\r\n /**\r\n * Status of Shift key being pressed\r\n */\r\n shiftKey: boolean;\r\n\r\n /**\r\n * Delta of movement on X axis\r\n */\r\n webkitMovementX?: any;\r\n\r\n /**\r\n * Delta of movement on Y axis\r\n */\r\n webkitMovementY?: any;\r\n\r\n /**\r\n * Alias of clientX\r\n */\r\n x: number;\r\n\r\n /**\r\n * Alias of clientY\r\n */\r\n y: number;\r\n}\r\n\r\n/**\r\n * Native friendly interface for PointerEvent Object\r\n */\r\nexport interface IPointerEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events, excluding ones that CANNOT be in events organically and mouse wheel values\r\n */\r\n inputIndex: Exclude<PointerInput, PointerInput.Horizontal | PointerInput.Vertical | PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ>;\r\n\r\n /**\r\n * Pointer Event ID\r\n */\r\n pointerId: number;\r\n\r\n /**\r\n * Type of pointer\r\n */\r\n pointerType: string;\r\n}\r\n\r\n/**\r\n * Native friendly interface for WheelEvent Object\r\n */\r\nexport interface IWheelEvent extends IMouseEvent {\r\n /**\r\n * Subset of possible PointerInput values for events that can only be used with mouse wheel\r\n */\r\n inputIndex: PointerInput.MouseWheelX | PointerInput.MouseWheelY | PointerInput.MouseWheelZ;\r\n\r\n /**\r\n * Units for delta value\r\n */\r\n deltaMode: number;\r\n\r\n /**\r\n * Horizontal scroll delta\r\n */\r\n deltaX: number;\r\n\r\n /**\r\n * Vertical scroll delta\r\n */\r\n deltaY: number;\r\n\r\n /**\r\n * Z-Axis scroll delta\r\n */\r\n deltaZ: number;\r\n\r\n /**\r\n * WheelDelta (From MouseWheel Event)\r\n */\r\n wheelDelta?: number;\r\n}\r\n\r\n/**\r\n * Constants used for Events\r\n */\r\nexport class EventConstants {\r\n /**\r\n * Pixel delta for Wheel Events (Default)\r\n */\r\n public static DOM_DELTA_PIXEL = 0x00;\r\n\r\n /**\r\n * Line delta for Wheel Events\r\n */\r\n public static DOM_DELTA_LINE = 0x01;\r\n\r\n /**\r\n * Page delta for Wheel Events\r\n */\r\n public static DOM_DELTA_PAGE = 0x02;\r\n}\r\n"]}
@@ -443,11 +443,6 @@ var BoundingBoxGizmo = /** @class */ (function (_super) {
443
443
  _this._updateDummy();
444
444
  });
445
445
  }
446
- // If the attachedMesh property is not set, then the attachedNode constructor was used, which
447
- // the BoundingBoxGizmo doesn't support
448
- if (!this.attachedMesh) {
449
- Logger.Warn("Using the attachedNode attribute in BoundingBoxGizmo is not supported. Please use attachedMesh instead.");
450
- }
451
446
  };
452
447
  BoundingBoxGizmo.prototype._selectNode = function (selectedMesh) {
453
448
  this._rotateSpheresParent
@@ -1 +1 @@
1
- {"version":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C,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAE1K,6BAA6B;QAC7B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE/B,oBAAoB;QACpB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAEtB,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC;QACnB,OAAO,GAAG,CAAC;IACf,CAAC;IACD;;OAEG;IACI,wCAAa,GAApB;QACI,MAAM,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAClE,CAAC;IACL,uBAAC;AAAD,CAAC,AAxxBD,CAAsC,KAAK,GAwxB1C","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Quaternion, Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder\";\r\nimport { CreateLines } from \"../Meshes/Builders/linesBuilder\";\r\nimport { PointerDragBehavior } from \"../Behaviors/Meshes/pointerDragBehavior\";\r\nimport { Gizmo } from \"./gizmo\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport { PivotTools } from \"../Misc/pivotTools\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\n\r\nimport type { LinesMesh } from \"../Meshes/linesMesh\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport type { IPointerEvent } from \"../Events/deviceInputEvents\";\r\n\r\n/**\r\n * Bounding box gizmo\r\n */\r\nexport class BoundingBoxGizmo extends Gizmo {\r\n private _lineBoundingBox: AbstractMesh;\r\n private _rotateSpheresParent: AbstractMesh;\r\n private _scaleBoxesParent: AbstractMesh;\r\n private _boundingDimensions = new Vector3(1, 1, 1);\r\n private _renderObserver: Nullable<Observer<Scene>> = null;\r\n private _pointerObserver: Nullable<Observer<PointerInfo>> = null;\r\n private _scaleDragSpeed = 0.2;\r\n\r\n private _tmpQuaternion = new Quaternion();\r\n private _tmpVector = new Vector3(0, 0, 0);\r\n private _tmpRotationMatrix = new Matrix();\r\n /**\r\n * If child meshes should be ignored when calculating the bounding box. This should be set to true to avoid perf hits with heavily nested meshes (Default: false)\r\n */\r\n public ignoreChildren = false;\r\n /**\r\n * Returns true if a descendant should be included when computing the bounding box. When null, all descendants are included. If ignoreChildren is set this will be ignored. (Default: null)\r\n */\r\n public includeChildPredicate: Nullable<(abstractMesh: AbstractMesh) => boolean> = null;\r\n\r\n /**\r\n * The size of the rotation spheres attached to the bounding box (Default: 0.1)\r\n */\r\n public rotationSphereSize = 0.1;\r\n /**\r\n * The size of the scale boxes attached to the bounding box (Default: 0.1)\r\n */\r\n public scaleBoxSize = 0.1;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the distance away from the camera to have a consistent screen size (Default: false)\r\n * Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true\r\n */\r\n public fixedDragMeshScreenSize = false;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the size of the bounding box\r\n * Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true\r\n */\r\n public fixedDragMeshBoundsSize = false;\r\n /**\r\n * The distance away from the object which the draggable meshes should appear world sized when fixedDragMeshScreenSize is set to true (default: 10)\r\n */\r\n public fixedDragMeshScreenSizeDistanceFactor = 10;\r\n /**\r\n * Fired when a rotation sphere or scale box is dragged\r\n */\r\n public onDragStartObservable = new Observable<{}>();\r\n /**\r\n * Fired when a scale box is dragged\r\n */\r\n public onScaleBoxDragObservable = new Observable<{}>();\r\n /**\r\n * Fired when a scale box drag is ended\r\n */\r\n public onScaleBoxDragEndObservable = new Observable<{}>();\r\n /**\r\n * Fired when a rotation sphere is dragged\r\n */\r\n public onRotationSphereDragObservable = new Observable<{}>();\r\n /**\r\n * Fired when a rotation sphere drag is ended\r\n */\r\n public onRotationSphereDragEndObservable = new Observable<{}>();\r\n /**\r\n * Relative bounding box pivot used when scaling the attached node. When null object with scale from the opposite corner. 0.5,0.5,0.5 for center and 0.5,0,0.5 for bottom (Default: null)\r\n */\r\n public scalePivot: Nullable<Vector3> = null;\r\n /**\r\n * Scale factor used for masking some axis\r\n */\r\n private _axisFactor = new Vector3(1, 1, 1);\r\n\r\n /**\r\n * Sets the axis factor\r\n * @param factor the Vector3 value\r\n */\r\n public set axisFactor(factor: Vector3) {\r\n this._axisFactor = factor;\r\n // update scale cube visibility\r\n const scaleBoxes = this._scaleBoxesParent.getChildMeshes();\r\n let index = 0;\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 3; j++) {\r\n for (let k = 0; k < 3; k++) {\r\n const zeroAxisCount = (i === 1 ? 1 : 0) + (j === 1 ? 1 : 0) + (k === 1 ? 1 : 0);\r\n if (zeroAxisCount === 1 || zeroAxisCount === 3) {\r\n continue;\r\n }\r\n if (scaleBoxes[index]) {\r\n const dragAxis = new Vector3(i - 1, j - 1, k - 1);\r\n dragAxis.multiplyInPlace(this._axisFactor);\r\n scaleBoxes[index].setEnabled(dragAxis.lengthSquared() > Epsilon);\r\n }\r\n index++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets the axis factor\r\n * @returns the Vector3 factor value\r\n */\r\n public get axisFactor(): Vector3 {\r\n return this._axisFactor;\r\n }\r\n\r\n /**\r\n * Sets scale drag speed value\r\n * @param value the new speed value\r\n */\r\n public set scaleDragSpeed(value: number) {\r\n this._scaleDragSpeed = value;\r\n }\r\n\r\n /**\r\n * Gets scale drag speed\r\n * @returns the scale speed number\r\n */\r\n public get scaleDragSpeed(): number {\r\n return this._scaleDragSpeed;\r\n }\r\n\r\n /**\r\n * Mesh used as a pivot to rotate the attached node\r\n */\r\n private _anchorMesh: AbstractMesh;\r\n\r\n private _existingMeshScale = new Vector3();\r\n\r\n // Dragging\r\n private _dragMesh: Nullable<Mesh> = null;\r\n private _pointerDragBehavior = new PointerDragBehavior();\r\n\r\n private _coloredMaterial: StandardMaterial;\r\n private _hoverColoredMaterial: StandardMaterial;\r\n\r\n /**\r\n * Sets the color of the bounding box gizmo\r\n * @param color the color to set\r\n */\r\n public setColor(color: Color3) {\r\n this._coloredMaterial.emissiveColor = color;\r\n this._hoverColoredMaterial.emissiveColor = color.clone().add(new Color3(0.3, 0.3, 0.3));\r\n this._lineBoundingBox.getChildren().forEach((l) => {\r\n if ((l as LinesMesh).color) {\r\n (l as LinesMesh).color = color;\r\n }\r\n });\r\n }\r\n /**\r\n * Creates an BoundingBoxGizmo\r\n * @param color The color of the gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n constructor(color: Color3 = Color3.Gray(), gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultKeepDepthUtilityLayer) {\r\n super(gizmoLayer);\r\n\r\n // Do not update the gizmo's scale so it has a fixed size to the object its attached to\r\n this.updateScale = false;\r\n\r\n this._anchorMesh = new AbstractMesh(\"anchor\", gizmoLayer.utilityLayerScene);\r\n // Create Materials\r\n this._coloredMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._coloredMaterial.disableLighting = true;\r\n this._hoverColoredMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._hoverColoredMaterial.disableLighting = true;\r\n\r\n // Build bounding box out of lines\r\n this._lineBoundingBox = new AbstractMesh(\"\", gizmoLayer.utilityLayerScene);\r\n this._lineBoundingBox.rotationQuaternion = new Quaternion();\r\n const lines = [];\r\n lines.push(CreateLines(\"lines\", { points: [new Vector3(0, 0, 0), new Vector3(this._boundingDimensions.x, 0, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(CreateLines(\"lines\", { points: [new Vector3(0, 0, 0), new Vector3(0, this._boundingDimensions.y, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(CreateLines(\"lines\", { points: [new Vector3(0, 0, 0), new Vector3(0, 0, this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(this._boundingDimensions.x, 0, 0), new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, 0)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(this._boundingDimensions.x, 0, 0), new Vector3(this._boundingDimensions.x, 0, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, this._boundingDimensions.y, 0), new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, 0)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, this._boundingDimensions.y, 0), new Vector3(0, this._boundingDimensions.y, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, 0, this._boundingDimensions.z), new Vector3(this._boundingDimensions.x, 0, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, 0, this._boundingDimensions.z), new Vector3(0, this._boundingDimensions.y, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n {\r\n points: [\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, this._boundingDimensions.z),\r\n new Vector3(0, this._boundingDimensions.y, this._boundingDimensions.z),\r\n ],\r\n },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n {\r\n points: [\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, this._boundingDimensions.z),\r\n new Vector3(this._boundingDimensions.x, 0, this._boundingDimensions.z),\r\n ],\r\n },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n {\r\n points: [\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, this._boundingDimensions.z),\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, 0),\r\n ],\r\n },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.forEach((l) => {\r\n l.color = color;\r\n l.position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n l.isPickable = false;\r\n this._lineBoundingBox.addChild(l);\r\n });\r\n this._rootMesh.addChild(this._lineBoundingBox);\r\n\r\n this.setColor(color);\r\n\r\n // Create rotation spheres\r\n this._rotateSpheresParent = new AbstractMesh(\"\", gizmoLayer.utilityLayerScene);\r\n this._rotateSpheresParent.rotationQuaternion = new Quaternion();\r\n for (let i = 0; i < 12; i++) {\r\n const sphere = CreateSphere(\"\", { diameter: 1 }, gizmoLayer.utilityLayerScene);\r\n sphere.rotationQuaternion = new Quaternion();\r\n sphere.material = this._coloredMaterial;\r\n sphere.isNearGrabbable = true;\r\n\r\n // Drag behavior\r\n const _dragBehavior = new PointerDragBehavior({});\r\n _dragBehavior.moveAttached = false;\r\n _dragBehavior.updateDragPlane = false;\r\n sphere.addBehavior(_dragBehavior);\r\n const startingTurnDirection = new Vector3(1, 0, 0);\r\n let totalTurnAmountOfDrag = 0;\r\n _dragBehavior.onDragStartObservable.add(() => {\r\n startingTurnDirection.copyFrom(sphere.forward);\r\n totalTurnAmountOfDrag = 0;\r\n });\r\n _dragBehavior.onDragObservable.add((event) => {\r\n this.onRotationSphereDragObservable.notifyObservers({});\r\n if (this.attachedMesh) {\r\n const originalParent = this.attachedMesh.parent;\r\n if (originalParent && (originalParent as Mesh).scaling && (originalParent as Mesh).scaling.isNonUniformWithinEpsilon(0.001)) {\r\n Logger.Warn(\"BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling\");\r\n return;\r\n }\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n\r\n const worldDragDirection = startingTurnDirection;\r\n\r\n // Project the world right on to the drag plane\r\n const toSub = event.dragPlaneNormal.scale(Vector3.Dot(event.dragPlaneNormal, worldDragDirection));\r\n const dragAxis = worldDragDirection.subtract(toSub).normalizeToNew();\r\n\r\n // project drag delta on to the resulting drag axis and rotate based on that\r\n let projectDist = Vector3.Dot(dragAxis, event.delta) < 0 ? Math.abs(event.delta.length()) : -Math.abs(event.delta.length());\r\n\r\n // Make rotation relative to size of mesh.\r\n projectDist = (projectDist / this._boundingDimensions.length()) * this._anchorMesh.scaling.length();\r\n\r\n // Rotate based on axis\r\n if (!this.attachedMesh.rotationQuaternion) {\r\n this.attachedMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(\r\n this.attachedMesh.rotation.y,\r\n this.attachedMesh.rotation.x,\r\n this.attachedMesh.rotation.z\r\n );\r\n }\r\n if (!this._anchorMesh.rotationQuaternion) {\r\n this._anchorMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(\r\n this._anchorMesh.rotation.y,\r\n this._anchorMesh.rotation.x,\r\n this._anchorMesh.rotation.z\r\n );\r\n }\r\n\r\n // Do not allow the object to turn more than a full circle\r\n totalTurnAmountOfDrag += projectDist;\r\n if (Math.abs(totalTurnAmountOfDrag) <= 2 * Math.PI) {\r\n if (i >= 8) {\r\n Quaternion.RotationYawPitchRollToRef(0, 0, projectDist, this._tmpQuaternion);\r\n } else if (i >= 4) {\r\n Quaternion.RotationYawPitchRollToRef(projectDist, 0, 0, this._tmpQuaternion);\r\n } else {\r\n Quaternion.RotationYawPitchRollToRef(0, projectDist, 0, this._tmpQuaternion);\r\n }\r\n\r\n // Rotate around center of bounding box\r\n this._anchorMesh.addChild(this.attachedMesh, Gizmo.PreserveScaling);\r\n if (this._anchorMesh.getScene().useRightHandedSystem) {\r\n this._tmpQuaternion.conjugateInPlace();\r\n }\r\n this._anchorMesh.rotationQuaternion!.multiplyToRef(this._tmpQuaternion, this._anchorMesh.rotationQuaternion!);\r\n this._anchorMesh.removeChild(this.attachedMesh, Gizmo.PreserveScaling);\r\n this.attachedMesh.setParent(originalParent, Gizmo.PreserveScaling);\r\n }\r\n this.updateBoundingBox();\r\n\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n }\r\n this._updateDummy();\r\n });\r\n\r\n // Selection/deselection\r\n _dragBehavior.onDragStartObservable.add(() => {\r\n this.onDragStartObservable.notifyObservers({});\r\n this._selectNode(sphere);\r\n });\r\n _dragBehavior.onDragEndObservable.add(() => {\r\n this.onRotationSphereDragEndObservable.notifyObservers({});\r\n this._selectNode(null);\r\n this._updateDummy();\r\n });\r\n\r\n this._rotateSpheresParent.addChild(sphere);\r\n }\r\n this._rootMesh.addChild(this._rotateSpheresParent);\r\n\r\n // Create scale cubes\r\n this._scaleBoxesParent = new AbstractMesh(\"\", gizmoLayer.utilityLayerScene);\r\n this._scaleBoxesParent.rotationQuaternion = new Quaternion();\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 3; j++) {\r\n for (let k = 0; k < 3; k++) {\r\n // create box for relevant axis\r\n const zeroAxisCount = (i === 1 ? 1 : 0) + (j === 1 ? 1 : 0) + (k === 1 ? 1 : 0);\r\n if (zeroAxisCount === 1 || zeroAxisCount === 3) {\r\n continue;\r\n }\r\n\r\n const box = CreateBox(\"\", { size: 1 }, gizmoLayer.utilityLayerScene);\r\n box.material = this._coloredMaterial;\r\n box.metadata = zeroAxisCount === 2; // None homogenous scale handle\r\n box.isNearGrabbable = true;\r\n\r\n // Dragging logic\r\n const dragAxis = new Vector3(i - 1, j - 1, k - 1).normalize();\r\n const _dragBehavior = new PointerDragBehavior({ dragAxis: dragAxis });\r\n _dragBehavior.updateDragPlane = false;\r\n _dragBehavior.moveAttached = false;\r\n box.addBehavior(_dragBehavior);\r\n _dragBehavior.onDragObservable.add((event) => {\r\n this.onScaleBoxDragObservable.notifyObservers({});\r\n if (this.attachedMesh) {\r\n const originalParent = this.attachedMesh.parent;\r\n if (originalParent && (originalParent as Mesh).scaling && (originalParent as Mesh).scaling.isNonUniformWithinEpsilon(0.001)) {\r\n Logger.Warn(\"BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling\");\r\n return;\r\n }\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n const relativeDragDistance = (event.dragDistance / this._boundingDimensions.length()) * this._anchorMesh.scaling.length();\r\n const deltaScale = new Vector3(relativeDragDistance, relativeDragDistance, relativeDragDistance);\r\n if (zeroAxisCount === 2) {\r\n // scale on 1 axis when using the anchor box in the face middle\r\n deltaScale.x *= Math.abs(dragAxis.x);\r\n deltaScale.y *= Math.abs(dragAxis.y);\r\n deltaScale.z *= Math.abs(dragAxis.z);\r\n }\r\n deltaScale.scaleInPlace(this._scaleDragSpeed);\r\n deltaScale.multiplyInPlace(this._axisFactor);\r\n this.updateBoundingBox();\r\n if (this.scalePivot) {\r\n this.attachedMesh.getWorldMatrix().getRotationMatrixToRef(this._tmpRotationMatrix);\r\n // Move anchor to desired pivot point (Bottom left corner + dimension/2)\r\n this._boundingDimensions.scaleToRef(0.5, this._tmpVector);\r\n Vector3.TransformCoordinatesToRef(this._tmpVector, this._tmpRotationMatrix, this._tmpVector);\r\n this._anchorMesh.position.subtractInPlace(this._tmpVector);\r\n this._boundingDimensions.multiplyToRef(this.scalePivot, this._tmpVector);\r\n Vector3.TransformCoordinatesToRef(this._tmpVector, this._tmpRotationMatrix, this._tmpVector);\r\n this._anchorMesh.position.addInPlace(this._tmpVector);\r\n } else {\r\n // Scale from the position of the opposite corner\r\n box.absolutePosition.subtractToRef(this._anchorMesh.position, this._tmpVector);\r\n this._anchorMesh.position.subtractInPlace(this._tmpVector);\r\n }\r\n\r\n this._anchorMesh.addChild(this.attachedMesh, Gizmo.PreserveScaling);\r\n this._anchorMesh.scaling.addInPlace(deltaScale);\r\n if (this._anchorMesh.scaling.x < 0 || this._anchorMesh.scaling.y < 0 || this._anchorMesh.scaling.z < 0) {\r\n this._anchorMesh.scaling.subtractInPlace(deltaScale);\r\n }\r\n this._anchorMesh.removeChild(this.attachedMesh, Gizmo.PreserveScaling);\r\n this.attachedMesh.setParent(originalParent, Gizmo.PreserveScaling);\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n }\r\n this._updateDummy();\r\n });\r\n\r\n // Selection/deselection\r\n _dragBehavior.onDragStartObservable.add(() => {\r\n this.onDragStartObservable.notifyObservers({});\r\n this._selectNode(box);\r\n });\r\n _dragBehavior.onDragEndObservable.add(() => {\r\n this.onScaleBoxDragEndObservable.notifyObservers({});\r\n this._selectNode(null);\r\n this._updateDummy();\r\n });\r\n\r\n this._scaleBoxesParent.addChild(box);\r\n }\r\n }\r\n }\r\n this._rootMesh.addChild(this._scaleBoxesParent);\r\n\r\n // Hover color change\r\n const pointerIds = new Array<AbstractMesh>();\r\n this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (!pointerIds[(<IPointerEvent>pointerInfo.event).pointerId]) {\r\n this._rotateSpheresParent\r\n .getChildMeshes()\r\n .concat(this._scaleBoxesParent.getChildMeshes())\r\n .forEach((mesh) => {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh == mesh) {\r\n pointerIds[(<IPointerEvent>pointerInfo.event).pointerId] = mesh;\r\n mesh.material = this._hoverColoredMaterial;\r\n }\r\n });\r\n } else {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh != pointerIds[(<IPointerEvent>pointerInfo.event).pointerId]) {\r\n pointerIds[(<IPointerEvent>pointerInfo.event).pointerId].material = this._coloredMaterial;\r\n delete pointerIds[(<IPointerEvent>pointerInfo.event).pointerId];\r\n }\r\n }\r\n });\r\n\r\n // Update bounding box positions\r\n this._renderObserver = this.gizmoLayer.originalScene.onBeforeRenderObservable.add(() => {\r\n // Only update the bounding box if scaling has changed\r\n if (this.attachedMesh && !this._existingMeshScale.equals(this.attachedMesh.scaling)) {\r\n this.updateBoundingBox();\r\n } else if (this.fixedDragMeshScreenSize || this.fixedDragMeshBoundsSize) {\r\n this._updateRotationSpheres();\r\n this._updateScaleBoxes();\r\n }\r\n\r\n // If drag mesh is enabled and dragging, update the attached mesh pose to match the drag mesh\r\n if (this._dragMesh && this.attachedMesh && this._pointerDragBehavior.dragging) {\r\n this._lineBoundingBox.position.rotateByQuaternionToRef(this._rootMesh.rotationQuaternion!, this._tmpVector);\r\n this.attachedMesh.setAbsolutePosition(this._dragMesh.position.add(this._tmpVector.scale(-1)));\r\n }\r\n });\r\n this.updateBoundingBox();\r\n }\r\n\r\n protected _attachedNodeChanged(value: Nullable<AbstractMesh>) {\r\n if (value) {\r\n // Reset anchor mesh to match attached mesh's scale\r\n // This is needed to avoid invalid box/sphere position on first drag\r\n this._anchorMesh.scaling.setAll(1);\r\n PivotTools._RemoveAndStorePivotPoint(value);\r\n const originalParent = value.parent;\r\n this._anchorMesh.addChild(value, Gizmo.PreserveScaling);\r\n this._anchorMesh.removeChild(value, Gizmo.PreserveScaling);\r\n value.setParent(originalParent, Gizmo.PreserveScaling);\r\n PivotTools._RestorePivotPoint(value);\r\n this.updateBoundingBox();\r\n value.getChildMeshes(false).forEach((m) => {\r\n m.markAsDirty(\"scaling\");\r\n });\r\n\r\n this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce(() => {\r\n this._updateDummy();\r\n });\r\n }\r\n // If the attachedMesh property is not set, then the attachedNode constructor was used, which\r\n // the BoundingBoxGizmo doesn't support\r\n if (!this.attachedMesh) {\r\n Logger.Warn(\"Using the attachedNode attribute in BoundingBoxGizmo is not supported. Please use attachedMesh instead.\");\r\n }\r\n }\r\n\r\n private _selectNode(selectedMesh: Nullable<Mesh>) {\r\n this._rotateSpheresParent\r\n .getChildMeshes()\r\n .concat(this._scaleBoxesParent.getChildMeshes())\r\n .forEach((m) => {\r\n m.isVisible = !selectedMesh || m == selectedMesh;\r\n });\r\n }\r\n\r\n /**\r\n * Updates the bounding box information for the Gizmo\r\n */\r\n public updateBoundingBox() {\r\n if (this.attachedMesh) {\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n\r\n // Store original parent\r\n const originalParent = this.attachedMesh.parent;\r\n this.attachedMesh.setParent(null, Gizmo.PreserveScaling);\r\n\r\n this._update();\r\n\r\n // Rotate based on axis\r\n if (!this.attachedMesh.rotationQuaternion) {\r\n this.attachedMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.attachedMesh.rotation.y, this.attachedMesh.rotation.x, this.attachedMesh.rotation.z);\r\n }\r\n if (!this._anchorMesh.rotationQuaternion) {\r\n this._anchorMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(this._anchorMesh.rotation.y, this._anchorMesh.rotation.x, this._anchorMesh.rotation.z);\r\n }\r\n this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n\r\n // Store original position and reset mesh to origin before computing the bounding box\r\n this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n this._tmpVector.copyFrom(this.attachedMesh.position);\r\n this.attachedMesh.rotationQuaternion.set(0, 0, 0, 1);\r\n this.attachedMesh.position.set(0, 0, 0);\r\n\r\n // Update bounding dimensions/positions\r\n const boundingMinMax = this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren, this.includeChildPredicate);\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, this._boundingDimensions);\r\n\r\n // Update gizmo to match bounding box scaling and rotation\r\n // The position set here is the offset from the origin for the boundingbox when the attached mesh is at the origin\r\n // The position of the gizmo is then set to the attachedMesh in gizmo._update\r\n this._lineBoundingBox.scaling.copyFrom(this._boundingDimensions);\r\n this._lineBoundingBox.position.set(\r\n (boundingMinMax.max.x + boundingMinMax.min.x) / 2,\r\n (boundingMinMax.max.y + boundingMinMax.min.y) / 2,\r\n (boundingMinMax.max.z + boundingMinMax.min.z) / 2\r\n );\r\n this._rotateSpheresParent.position.copyFrom(this._lineBoundingBox.position);\r\n this._scaleBoxesParent.position.copyFrom(this._lineBoundingBox.position);\r\n this._lineBoundingBox.computeWorldMatrix();\r\n this._anchorMesh.position.copyFrom(this._lineBoundingBox.absolutePosition);\r\n\r\n // Restore position/rotation values\r\n this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion);\r\n this.attachedMesh.position.copyFrom(this._tmpVector);\r\n\r\n // Restore original parent\r\n this.attachedMesh.setParent(originalParent, Gizmo.PreserveScaling);\r\n }\r\n\r\n this._updateRotationSpheres();\r\n this._updateScaleBoxes();\r\n\r\n if (this.attachedMesh) {\r\n this._existingMeshScale.copyFrom(this.attachedMesh.scaling);\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n }\r\n }\r\n\r\n private _updateRotationSpheres() {\r\n const rotateSpheres = this._rotateSpheresParent.getChildMeshes();\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 2; j++) {\r\n for (let k = 0; k < 2; k++) {\r\n const index = i * 4 + j * 2 + k;\r\n if (i == 0) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x / 2, this._boundingDimensions.y * j, this._boundingDimensions.z * k);\r\n rotateSpheres[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(\r\n Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), Vector3.Right()).normalizeToNew().add(rotateSpheres[index].position)\r\n );\r\n }\r\n if (i == 1) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y / 2, this._boundingDimensions.z * k);\r\n rotateSpheres[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(\r\n Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), Vector3.Up()).normalizeToNew().add(rotateSpheres[index].position)\r\n );\r\n }\r\n if (i == 2) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y * k, this._boundingDimensions.z / 2);\r\n rotateSpheres[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(\r\n Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), Vector3.Forward()).normalizeToNew().add(rotateSpheres[index].position)\r\n );\r\n }\r\n if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);\r\n const distanceFromCamera = (this.rotationSphereSize * this._tmpVector.length()) / this.fixedDragMeshScreenSizeDistanceFactor;\r\n rotateSpheres[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n } else if (this.fixedDragMeshBoundsSize) {\r\n rotateSpheres[index].scaling.set(\r\n this.rotationSphereSize * this._boundingDimensions.x,\r\n this.rotationSphereSize * this._boundingDimensions.y,\r\n this.rotationSphereSize * this._boundingDimensions.z\r\n );\r\n } else {\r\n rotateSpheres[index].scaling.set(this.rotationSphereSize, this.rotationSphereSize, this.rotationSphereSize);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _updateScaleBoxes() {\r\n const scaleBoxes = this._scaleBoxesParent.getChildMeshes();\r\n let index = 0;\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 3; j++) {\r\n for (let k = 0; k < 3; k++) {\r\n const zeroAxisCount = (i === 1 ? 1 : 0) + (j === 1 ? 1 : 0) + (k === 1 ? 1 : 0);\r\n if (zeroAxisCount === 1 || zeroAxisCount === 3) {\r\n continue;\r\n }\r\n if (scaleBoxes[index]) {\r\n scaleBoxes[index].position.set(this._boundingDimensions.x * (i / 2), this._boundingDimensions.y * (j / 2), this._boundingDimensions.z * (k / 2));\r\n scaleBoxes[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);\r\n const distanceFromCamera = (this.scaleBoxSize * this._tmpVector.length()) / this.fixedDragMeshScreenSizeDistanceFactor;\r\n scaleBoxes[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n } else if (this.fixedDragMeshBoundsSize) {\r\n scaleBoxes[index].scaling.set(\r\n this.scaleBoxSize * this._boundingDimensions.x,\r\n this.scaleBoxSize * this._boundingDimensions.y,\r\n this.scaleBoxSize * this._boundingDimensions.z\r\n );\r\n } else {\r\n scaleBoxes[index].scaling.set(this.scaleBoxSize, this.scaleBoxSize, this.scaleBoxSize);\r\n }\r\n }\r\n index++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Enables rotation on the specified axis and disables rotation on the others\r\n * @param axis The list of axis that should be enabled (eg. \"xy\" or \"xyz\")\r\n */\r\n public setEnabledRotationAxis(axis: string) {\r\n this._rotateSpheresParent.getChildMeshes().forEach((m, i) => {\r\n if (i < 4) {\r\n m.setEnabled(axis.indexOf(\"x\") != -1);\r\n } else if (i < 8) {\r\n m.setEnabled(axis.indexOf(\"y\") != -1);\r\n } else {\r\n m.setEnabled(axis.indexOf(\"z\") != -1);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Enables/disables scaling\r\n * @param enable if scaling should be enabled\r\n * @param homogeneousScaling defines if scaling should only be homogeneous\r\n */\r\n public setEnabledScaling(enable: boolean, homogeneousScaling = false) {\r\n this._scaleBoxesParent.getChildMeshes().forEach((m) => {\r\n let enableMesh = enable;\r\n // Disable heterogeneous scale handles if requested.\r\n if (homogeneousScaling && m.metadata === true) {\r\n enableMesh = false;\r\n }\r\n m.setEnabled(enableMesh);\r\n });\r\n }\r\n\r\n private _updateDummy() {\r\n if (this._dragMesh) {\r\n this._dragMesh.position.copyFrom(this._lineBoundingBox.getAbsolutePosition());\r\n this._dragMesh.scaling.copyFrom(this._lineBoundingBox.scaling);\r\n this._dragMesh.rotationQuaternion!.copyFrom(this._rootMesh.rotationQuaternion!);\r\n }\r\n }\r\n\r\n /**\r\n * Enables a pointer drag behavior on the bounding box of the gizmo\r\n */\r\n public enableDragBehavior() {\r\n this._dragMesh = CreateBox(\"dummy\", { size: 1 }, this.gizmoLayer.utilityLayerScene);\r\n this._dragMesh.visibility = 0;\r\n this._dragMesh.rotationQuaternion = new Quaternion();\r\n this._pointerDragBehavior.useObjectOrientationForDragging = false;\r\n this._dragMesh.addBehavior(this._pointerDragBehavior);\r\n }\r\n\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n public dispose() {\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver);\r\n this._lineBoundingBox.dispose();\r\n this._rotateSpheresParent.dispose();\r\n this._scaleBoxesParent.dispose();\r\n if (this._dragMesh) {\r\n this._dragMesh.dispose();\r\n }\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Makes a mesh not pickable and wraps the mesh inside of a bounding box mesh that is pickable. (This is useful to avoid picking within complex geometry)\r\n * @param mesh the mesh to wrap in the bounding box mesh and make not pickable\r\n * @returns the bounding box mesh with the passed in mesh as a child\r\n */\r\n public static MakeNotPickableAndWrapInBoundingBox(mesh: Mesh): Mesh {\r\n const makeNotPickable = (root: AbstractMesh) => {\r\n root.isPickable = false;\r\n root.getChildMeshes().forEach((c) => {\r\n makeNotPickable(c);\r\n });\r\n };\r\n makeNotPickable(mesh);\r\n\r\n // Reset position to get bounding box from origin with no rotation\r\n if (!mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(mesh.rotation.y, mesh.rotation.x, mesh.rotation.z);\r\n }\r\n const oldPos = mesh.position.clone();\r\n const oldRot = mesh.rotationQuaternion.clone();\r\n mesh.rotationQuaternion.set(0, 0, 0, 1);\r\n mesh.position.set(0, 0, 0);\r\n\r\n // Update bounding dimensions/positions\r\n const box = CreateBox(\"box\", { size: 1 }, mesh.getScene());\r\n const boundingMinMax = mesh.getHierarchyBoundingVectors();\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, box.scaling);\r\n\r\n // Adjust scale to avoid undefined behavior when adding child\r\n if (box.scaling.y === 0) {\r\n box.scaling.y = Epsilon;\r\n }\r\n if (box.scaling.x === 0) {\r\n box.scaling.x = Epsilon;\r\n }\r\n if (box.scaling.z === 0) {\r\n box.scaling.z = Epsilon;\r\n }\r\n\r\n box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);\r\n\r\n // Restore original positions\r\n mesh.addChild(box);\r\n mesh.rotationQuaternion.copyFrom(oldRot);\r\n mesh.position.copyFrom(oldPos);\r\n\r\n // Reverse parenting\r\n mesh.removeChild(box);\r\n\r\n box.addChild(mesh);\r\n box.visibility = 0;\r\n return box;\r\n }\r\n /**\r\n * CustomMeshes are not supported by this gizmo\r\n */\r\n public setCustomMesh() {\r\n Logger.Error(\"Custom meshes are not supported on this gizmo\");\r\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AG,CAAC,CAAC;QACnB,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE/B,oBAAoB;QACpB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAEtB,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC;QACnB,OAAO,GAAG,CAAC;IACf,CAAC;IACD;;OAEG;IACI,wCAAa,GAApB;QACI,MAAM,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAClE,CAAC;IACL,uBAAC;AAAD,CAAC,AAnxBD,CAAsC,KAAK,GAmxB1C","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Quaternion, Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder\";\r\nimport { CreateLines } from \"../Meshes/Builders/linesBuilder\";\r\nimport { PointerDragBehavior } from \"../Behaviors/Meshes/pointerDragBehavior\";\r\nimport { Gizmo } from \"./gizmo\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport { PivotTools } from \"../Misc/pivotTools\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\n\r\nimport type { LinesMesh } from \"../Meshes/linesMesh\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport type { IPointerEvent } from \"../Events/deviceInputEvents\";\r\n\r\n/**\r\n * Bounding box gizmo\r\n */\r\nexport class BoundingBoxGizmo extends Gizmo {\r\n private _lineBoundingBox: AbstractMesh;\r\n private _rotateSpheresParent: AbstractMesh;\r\n private _scaleBoxesParent: AbstractMesh;\r\n private _boundingDimensions = new Vector3(1, 1, 1);\r\n private _renderObserver: Nullable<Observer<Scene>> = null;\r\n private _pointerObserver: Nullable<Observer<PointerInfo>> = null;\r\n private _scaleDragSpeed = 0.2;\r\n\r\n private _tmpQuaternion = new Quaternion();\r\n private _tmpVector = new Vector3(0, 0, 0);\r\n private _tmpRotationMatrix = new Matrix();\r\n /**\r\n * If child meshes should be ignored when calculating the bounding box. This should be set to true to avoid perf hits with heavily nested meshes (Default: false)\r\n */\r\n public ignoreChildren = false;\r\n /**\r\n * Returns true if a descendant should be included when computing the bounding box. When null, all descendants are included. If ignoreChildren is set this will be ignored. (Default: null)\r\n */\r\n public includeChildPredicate: Nullable<(abstractMesh: AbstractMesh) => boolean> = null;\r\n\r\n /**\r\n * The size of the rotation spheres attached to the bounding box (Default: 0.1)\r\n */\r\n public rotationSphereSize = 0.1;\r\n /**\r\n * The size of the scale boxes attached to the bounding box (Default: 0.1)\r\n */\r\n public scaleBoxSize = 0.1;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the distance away from the camera to have a consistent screen size (Default: false)\r\n * Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true\r\n */\r\n public fixedDragMeshScreenSize = false;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the size of the bounding box\r\n * Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true\r\n */\r\n public fixedDragMeshBoundsSize = false;\r\n /**\r\n * The distance away from the object which the draggable meshes should appear world sized when fixedDragMeshScreenSize is set to true (default: 10)\r\n */\r\n public fixedDragMeshScreenSizeDistanceFactor = 10;\r\n /**\r\n * Fired when a rotation sphere or scale box is dragged\r\n */\r\n public onDragStartObservable = new Observable<{}>();\r\n /**\r\n * Fired when a scale box is dragged\r\n */\r\n public onScaleBoxDragObservable = new Observable<{}>();\r\n /**\r\n * Fired when a scale box drag is ended\r\n */\r\n public onScaleBoxDragEndObservable = new Observable<{}>();\r\n /**\r\n * Fired when a rotation sphere is dragged\r\n */\r\n public onRotationSphereDragObservable = new Observable<{}>();\r\n /**\r\n * Fired when a rotation sphere drag is ended\r\n */\r\n public onRotationSphereDragEndObservable = new Observable<{}>();\r\n /**\r\n * Relative bounding box pivot used when scaling the attached node. When null object with scale from the opposite corner. 0.5,0.5,0.5 for center and 0.5,0,0.5 for bottom (Default: null)\r\n */\r\n public scalePivot: Nullable<Vector3> = null;\r\n /**\r\n * Scale factor used for masking some axis\r\n */\r\n private _axisFactor = new Vector3(1, 1, 1);\r\n\r\n /**\r\n * Sets the axis factor\r\n * @param factor the Vector3 value\r\n */\r\n public set axisFactor(factor: Vector3) {\r\n this._axisFactor = factor;\r\n // update scale cube visibility\r\n const scaleBoxes = this._scaleBoxesParent.getChildMeshes();\r\n let index = 0;\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 3; j++) {\r\n for (let k = 0; k < 3; k++) {\r\n const zeroAxisCount = (i === 1 ? 1 : 0) + (j === 1 ? 1 : 0) + (k === 1 ? 1 : 0);\r\n if (zeroAxisCount === 1 || zeroAxisCount === 3) {\r\n continue;\r\n }\r\n if (scaleBoxes[index]) {\r\n const dragAxis = new Vector3(i - 1, j - 1, k - 1);\r\n dragAxis.multiplyInPlace(this._axisFactor);\r\n scaleBoxes[index].setEnabled(dragAxis.lengthSquared() > Epsilon);\r\n }\r\n index++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets the axis factor\r\n * @returns the Vector3 factor value\r\n */\r\n public get axisFactor(): Vector3 {\r\n return this._axisFactor;\r\n }\r\n\r\n /**\r\n * Sets scale drag speed value\r\n * @param value the new speed value\r\n */\r\n public set scaleDragSpeed(value: number) {\r\n this._scaleDragSpeed = value;\r\n }\r\n\r\n /**\r\n * Gets scale drag speed\r\n * @returns the scale speed number\r\n */\r\n public get scaleDragSpeed(): number {\r\n return this._scaleDragSpeed;\r\n }\r\n\r\n /**\r\n * Mesh used as a pivot to rotate the attached node\r\n */\r\n private _anchorMesh: AbstractMesh;\r\n\r\n private _existingMeshScale = new Vector3();\r\n\r\n // Dragging\r\n private _dragMesh: Nullable<Mesh> = null;\r\n private _pointerDragBehavior = new PointerDragBehavior();\r\n\r\n private _coloredMaterial: StandardMaterial;\r\n private _hoverColoredMaterial: StandardMaterial;\r\n\r\n /**\r\n * Sets the color of the bounding box gizmo\r\n * @param color the color to set\r\n */\r\n public setColor(color: Color3) {\r\n this._coloredMaterial.emissiveColor = color;\r\n this._hoverColoredMaterial.emissiveColor = color.clone().add(new Color3(0.3, 0.3, 0.3));\r\n this._lineBoundingBox.getChildren().forEach((l) => {\r\n if ((l as LinesMesh).color) {\r\n (l as LinesMesh).color = color;\r\n }\r\n });\r\n }\r\n /**\r\n * Creates an BoundingBoxGizmo\r\n * @param color The color of the gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n constructor(color: Color3 = Color3.Gray(), gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultKeepDepthUtilityLayer) {\r\n super(gizmoLayer);\r\n\r\n // Do not update the gizmo's scale so it has a fixed size to the object its attached to\r\n this.updateScale = false;\r\n\r\n this._anchorMesh = new AbstractMesh(\"anchor\", gizmoLayer.utilityLayerScene);\r\n // Create Materials\r\n this._coloredMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._coloredMaterial.disableLighting = true;\r\n this._hoverColoredMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._hoverColoredMaterial.disableLighting = true;\r\n\r\n // Build bounding box out of lines\r\n this._lineBoundingBox = new AbstractMesh(\"\", gizmoLayer.utilityLayerScene);\r\n this._lineBoundingBox.rotationQuaternion = new Quaternion();\r\n const lines = [];\r\n lines.push(CreateLines(\"lines\", { points: [new Vector3(0, 0, 0), new Vector3(this._boundingDimensions.x, 0, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(CreateLines(\"lines\", { points: [new Vector3(0, 0, 0), new Vector3(0, this._boundingDimensions.y, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(CreateLines(\"lines\", { points: [new Vector3(0, 0, 0), new Vector3(0, 0, this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(this._boundingDimensions.x, 0, 0), new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, 0)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(this._boundingDimensions.x, 0, 0), new Vector3(this._boundingDimensions.x, 0, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, this._boundingDimensions.y, 0), new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, 0)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, this._boundingDimensions.y, 0), new Vector3(0, this._boundingDimensions.y, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, 0, this._boundingDimensions.z), new Vector3(this._boundingDimensions.x, 0, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, 0, this._boundingDimensions.z), new Vector3(0, this._boundingDimensions.y, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n {\r\n points: [\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, this._boundingDimensions.z),\r\n new Vector3(0, this._boundingDimensions.y, this._boundingDimensions.z),\r\n ],\r\n },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n {\r\n points: [\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, this._boundingDimensions.z),\r\n new Vector3(this._boundingDimensions.x, 0, this._boundingDimensions.z),\r\n ],\r\n },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n {\r\n points: [\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, this._boundingDimensions.z),\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, 0),\r\n ],\r\n },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.forEach((l) => {\r\n l.color = color;\r\n l.position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n l.isPickable = false;\r\n this._lineBoundingBox.addChild(l);\r\n });\r\n this._rootMesh.addChild(this._lineBoundingBox);\r\n\r\n this.setColor(color);\r\n\r\n // Create rotation spheres\r\n this._rotateSpheresParent = new AbstractMesh(\"\", gizmoLayer.utilityLayerScene);\r\n this._rotateSpheresParent.rotationQuaternion = new Quaternion();\r\n for (let i = 0; i < 12; i++) {\r\n const sphere = CreateSphere(\"\", { diameter: 1 }, gizmoLayer.utilityLayerScene);\r\n sphere.rotationQuaternion = new Quaternion();\r\n sphere.material = this._coloredMaterial;\r\n sphere.isNearGrabbable = true;\r\n\r\n // Drag behavior\r\n const _dragBehavior = new PointerDragBehavior({});\r\n _dragBehavior.moveAttached = false;\r\n _dragBehavior.updateDragPlane = false;\r\n sphere.addBehavior(_dragBehavior);\r\n const startingTurnDirection = new Vector3(1, 0, 0);\r\n let totalTurnAmountOfDrag = 0;\r\n _dragBehavior.onDragStartObservable.add(() => {\r\n startingTurnDirection.copyFrom(sphere.forward);\r\n totalTurnAmountOfDrag = 0;\r\n });\r\n _dragBehavior.onDragObservable.add((event) => {\r\n this.onRotationSphereDragObservable.notifyObservers({});\r\n if (this.attachedMesh) {\r\n const originalParent = this.attachedMesh.parent;\r\n if (originalParent && (originalParent as Mesh).scaling && (originalParent as Mesh).scaling.isNonUniformWithinEpsilon(0.001)) {\r\n Logger.Warn(\"BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling\");\r\n return;\r\n }\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n\r\n const worldDragDirection = startingTurnDirection;\r\n\r\n // Project the world right on to the drag plane\r\n const toSub = event.dragPlaneNormal.scale(Vector3.Dot(event.dragPlaneNormal, worldDragDirection));\r\n const dragAxis = worldDragDirection.subtract(toSub).normalizeToNew();\r\n\r\n // project drag delta on to the resulting drag axis and rotate based on that\r\n let projectDist = Vector3.Dot(dragAxis, event.delta) < 0 ? Math.abs(event.delta.length()) : -Math.abs(event.delta.length());\r\n\r\n // Make rotation relative to size of mesh.\r\n projectDist = (projectDist / this._boundingDimensions.length()) * this._anchorMesh.scaling.length();\r\n\r\n // Rotate based on axis\r\n if (!this.attachedMesh.rotationQuaternion) {\r\n this.attachedMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(\r\n this.attachedMesh.rotation.y,\r\n this.attachedMesh.rotation.x,\r\n this.attachedMesh.rotation.z\r\n );\r\n }\r\n if (!this._anchorMesh.rotationQuaternion) {\r\n this._anchorMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(\r\n this._anchorMesh.rotation.y,\r\n this._anchorMesh.rotation.x,\r\n this._anchorMesh.rotation.z\r\n );\r\n }\r\n\r\n // Do not allow the object to turn more than a full circle\r\n totalTurnAmountOfDrag += projectDist;\r\n if (Math.abs(totalTurnAmountOfDrag) <= 2 * Math.PI) {\r\n if (i >= 8) {\r\n Quaternion.RotationYawPitchRollToRef(0, 0, projectDist, this._tmpQuaternion);\r\n } else if (i >= 4) {\r\n Quaternion.RotationYawPitchRollToRef(projectDist, 0, 0, this._tmpQuaternion);\r\n } else {\r\n Quaternion.RotationYawPitchRollToRef(0, projectDist, 0, this._tmpQuaternion);\r\n }\r\n\r\n // Rotate around center of bounding box\r\n this._anchorMesh.addChild(this.attachedMesh, Gizmo.PreserveScaling);\r\n if (this._anchorMesh.getScene().useRightHandedSystem) {\r\n this._tmpQuaternion.conjugateInPlace();\r\n }\r\n this._anchorMesh.rotationQuaternion!.multiplyToRef(this._tmpQuaternion, this._anchorMesh.rotationQuaternion!);\r\n this._anchorMesh.removeChild(this.attachedMesh, Gizmo.PreserveScaling);\r\n this.attachedMesh.setParent(originalParent, Gizmo.PreserveScaling);\r\n }\r\n this.updateBoundingBox();\r\n\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n }\r\n this._updateDummy();\r\n });\r\n\r\n // Selection/deselection\r\n _dragBehavior.onDragStartObservable.add(() => {\r\n this.onDragStartObservable.notifyObservers({});\r\n this._selectNode(sphere);\r\n });\r\n _dragBehavior.onDragEndObservable.add(() => {\r\n this.onRotationSphereDragEndObservable.notifyObservers({});\r\n this._selectNode(null);\r\n this._updateDummy();\r\n });\r\n\r\n this._rotateSpheresParent.addChild(sphere);\r\n }\r\n this._rootMesh.addChild(this._rotateSpheresParent);\r\n\r\n // Create scale cubes\r\n this._scaleBoxesParent = new AbstractMesh(\"\", gizmoLayer.utilityLayerScene);\r\n this._scaleBoxesParent.rotationQuaternion = new Quaternion();\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 3; j++) {\r\n for (let k = 0; k < 3; k++) {\r\n // create box for relevant axis\r\n const zeroAxisCount = (i === 1 ? 1 : 0) + (j === 1 ? 1 : 0) + (k === 1 ? 1 : 0);\r\n if (zeroAxisCount === 1 || zeroAxisCount === 3) {\r\n continue;\r\n }\r\n\r\n const box = CreateBox(\"\", { size: 1 }, gizmoLayer.utilityLayerScene);\r\n box.material = this._coloredMaterial;\r\n box.metadata = zeroAxisCount === 2; // None homogenous scale handle\r\n box.isNearGrabbable = true;\r\n\r\n // Dragging logic\r\n const dragAxis = new Vector3(i - 1, j - 1, k - 1).normalize();\r\n const _dragBehavior = new PointerDragBehavior({ dragAxis: dragAxis });\r\n _dragBehavior.updateDragPlane = false;\r\n _dragBehavior.moveAttached = false;\r\n box.addBehavior(_dragBehavior);\r\n _dragBehavior.onDragObservable.add((event) => {\r\n this.onScaleBoxDragObservable.notifyObservers({});\r\n if (this.attachedMesh) {\r\n const originalParent = this.attachedMesh.parent;\r\n if (originalParent && (originalParent as Mesh).scaling && (originalParent as Mesh).scaling.isNonUniformWithinEpsilon(0.001)) {\r\n Logger.Warn(\"BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling\");\r\n return;\r\n }\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n const relativeDragDistance = (event.dragDistance / this._boundingDimensions.length()) * this._anchorMesh.scaling.length();\r\n const deltaScale = new Vector3(relativeDragDistance, relativeDragDistance, relativeDragDistance);\r\n if (zeroAxisCount === 2) {\r\n // scale on 1 axis when using the anchor box in the face middle\r\n deltaScale.x *= Math.abs(dragAxis.x);\r\n deltaScale.y *= Math.abs(dragAxis.y);\r\n deltaScale.z *= Math.abs(dragAxis.z);\r\n }\r\n deltaScale.scaleInPlace(this._scaleDragSpeed);\r\n deltaScale.multiplyInPlace(this._axisFactor);\r\n this.updateBoundingBox();\r\n if (this.scalePivot) {\r\n this.attachedMesh.getWorldMatrix().getRotationMatrixToRef(this._tmpRotationMatrix);\r\n // Move anchor to desired pivot point (Bottom left corner + dimension/2)\r\n this._boundingDimensions.scaleToRef(0.5, this._tmpVector);\r\n Vector3.TransformCoordinatesToRef(this._tmpVector, this._tmpRotationMatrix, this._tmpVector);\r\n this._anchorMesh.position.subtractInPlace(this._tmpVector);\r\n this._boundingDimensions.multiplyToRef(this.scalePivot, this._tmpVector);\r\n Vector3.TransformCoordinatesToRef(this._tmpVector, this._tmpRotationMatrix, this._tmpVector);\r\n this._anchorMesh.position.addInPlace(this._tmpVector);\r\n } else {\r\n // Scale from the position of the opposite corner\r\n box.absolutePosition.subtractToRef(this._anchorMesh.position, this._tmpVector);\r\n this._anchorMesh.position.subtractInPlace(this._tmpVector);\r\n }\r\n\r\n this._anchorMesh.addChild(this.attachedMesh, Gizmo.PreserveScaling);\r\n this._anchorMesh.scaling.addInPlace(deltaScale);\r\n if (this._anchorMesh.scaling.x < 0 || this._anchorMesh.scaling.y < 0 || this._anchorMesh.scaling.z < 0) {\r\n this._anchorMesh.scaling.subtractInPlace(deltaScale);\r\n }\r\n this._anchorMesh.removeChild(this.attachedMesh, Gizmo.PreserveScaling);\r\n this.attachedMesh.setParent(originalParent, Gizmo.PreserveScaling);\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n }\r\n this._updateDummy();\r\n });\r\n\r\n // Selection/deselection\r\n _dragBehavior.onDragStartObservable.add(() => {\r\n this.onDragStartObservable.notifyObservers({});\r\n this._selectNode(box);\r\n });\r\n _dragBehavior.onDragEndObservable.add(() => {\r\n this.onScaleBoxDragEndObservable.notifyObservers({});\r\n this._selectNode(null);\r\n this._updateDummy();\r\n });\r\n\r\n this._scaleBoxesParent.addChild(box);\r\n }\r\n }\r\n }\r\n this._rootMesh.addChild(this._scaleBoxesParent);\r\n\r\n // Hover color change\r\n const pointerIds = new Array<AbstractMesh>();\r\n this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (!pointerIds[(<IPointerEvent>pointerInfo.event).pointerId]) {\r\n this._rotateSpheresParent\r\n .getChildMeshes()\r\n .concat(this._scaleBoxesParent.getChildMeshes())\r\n .forEach((mesh) => {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh == mesh) {\r\n pointerIds[(<IPointerEvent>pointerInfo.event).pointerId] = mesh;\r\n mesh.material = this._hoverColoredMaterial;\r\n }\r\n });\r\n } else {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh != pointerIds[(<IPointerEvent>pointerInfo.event).pointerId]) {\r\n pointerIds[(<IPointerEvent>pointerInfo.event).pointerId].material = this._coloredMaterial;\r\n delete pointerIds[(<IPointerEvent>pointerInfo.event).pointerId];\r\n }\r\n }\r\n });\r\n\r\n // Update bounding box positions\r\n this._renderObserver = this.gizmoLayer.originalScene.onBeforeRenderObservable.add(() => {\r\n // Only update the bounding box if scaling has changed\r\n if (this.attachedMesh && !this._existingMeshScale.equals(this.attachedMesh.scaling)) {\r\n this.updateBoundingBox();\r\n } else if (this.fixedDragMeshScreenSize || this.fixedDragMeshBoundsSize) {\r\n this._updateRotationSpheres();\r\n this._updateScaleBoxes();\r\n }\r\n\r\n // If drag mesh is enabled and dragging, update the attached mesh pose to match the drag mesh\r\n if (this._dragMesh && this.attachedMesh && this._pointerDragBehavior.dragging) {\r\n this._lineBoundingBox.position.rotateByQuaternionToRef(this._rootMesh.rotationQuaternion!, this._tmpVector);\r\n this.attachedMesh.setAbsolutePosition(this._dragMesh.position.add(this._tmpVector.scale(-1)));\r\n }\r\n });\r\n this.updateBoundingBox();\r\n }\r\n\r\n protected _attachedNodeChanged(value: Nullable<AbstractMesh>) {\r\n if (value) {\r\n // Reset anchor mesh to match attached mesh's scale\r\n // This is needed to avoid invalid box/sphere position on first drag\r\n this._anchorMesh.scaling.setAll(1);\r\n PivotTools._RemoveAndStorePivotPoint(value);\r\n const originalParent = value.parent;\r\n this._anchorMesh.addChild(value, Gizmo.PreserveScaling);\r\n this._anchorMesh.removeChild(value, Gizmo.PreserveScaling);\r\n value.setParent(originalParent, Gizmo.PreserveScaling);\r\n PivotTools._RestorePivotPoint(value);\r\n this.updateBoundingBox();\r\n value.getChildMeshes(false).forEach((m) => {\r\n m.markAsDirty(\"scaling\");\r\n });\r\n\r\n this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce(() => {\r\n this._updateDummy();\r\n });\r\n }\r\n }\r\n\r\n private _selectNode(selectedMesh: Nullable<Mesh>) {\r\n this._rotateSpheresParent\r\n .getChildMeshes()\r\n .concat(this._scaleBoxesParent.getChildMeshes())\r\n .forEach((m) => {\r\n m.isVisible = !selectedMesh || m == selectedMesh;\r\n });\r\n }\r\n\r\n /**\r\n * Updates the bounding box information for the Gizmo\r\n */\r\n public updateBoundingBox() {\r\n if (this.attachedMesh) {\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n\r\n // Store original parent\r\n const originalParent = this.attachedMesh.parent;\r\n this.attachedMesh.setParent(null, Gizmo.PreserveScaling);\r\n\r\n this._update();\r\n\r\n // Rotate based on axis\r\n if (!this.attachedMesh.rotationQuaternion) {\r\n this.attachedMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.attachedMesh.rotation.y, this.attachedMesh.rotation.x, this.attachedMesh.rotation.z);\r\n }\r\n if (!this._anchorMesh.rotationQuaternion) {\r\n this._anchorMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(this._anchorMesh.rotation.y, this._anchorMesh.rotation.x, this._anchorMesh.rotation.z);\r\n }\r\n this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n\r\n // Store original position and reset mesh to origin before computing the bounding box\r\n this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n this._tmpVector.copyFrom(this.attachedMesh.position);\r\n this.attachedMesh.rotationQuaternion.set(0, 0, 0, 1);\r\n this.attachedMesh.position.set(0, 0, 0);\r\n\r\n // Update bounding dimensions/positions\r\n const boundingMinMax = this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren, this.includeChildPredicate);\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, this._boundingDimensions);\r\n\r\n // Update gizmo to match bounding box scaling and rotation\r\n // The position set here is the offset from the origin for the boundingbox when the attached mesh is at the origin\r\n // The position of the gizmo is then set to the attachedMesh in gizmo._update\r\n this._lineBoundingBox.scaling.copyFrom(this._boundingDimensions);\r\n this._lineBoundingBox.position.set(\r\n (boundingMinMax.max.x + boundingMinMax.min.x) / 2,\r\n (boundingMinMax.max.y + boundingMinMax.min.y) / 2,\r\n (boundingMinMax.max.z + boundingMinMax.min.z) / 2\r\n );\r\n this._rotateSpheresParent.position.copyFrom(this._lineBoundingBox.position);\r\n this._scaleBoxesParent.position.copyFrom(this._lineBoundingBox.position);\r\n this._lineBoundingBox.computeWorldMatrix();\r\n this._anchorMesh.position.copyFrom(this._lineBoundingBox.absolutePosition);\r\n\r\n // Restore position/rotation values\r\n this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion);\r\n this.attachedMesh.position.copyFrom(this._tmpVector);\r\n\r\n // Restore original parent\r\n this.attachedMesh.setParent(originalParent, Gizmo.PreserveScaling);\r\n }\r\n\r\n this._updateRotationSpheres();\r\n this._updateScaleBoxes();\r\n\r\n if (this.attachedMesh) {\r\n this._existingMeshScale.copyFrom(this.attachedMesh.scaling);\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n }\r\n }\r\n\r\n private _updateRotationSpheres() {\r\n const rotateSpheres = this._rotateSpheresParent.getChildMeshes();\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 2; j++) {\r\n for (let k = 0; k < 2; k++) {\r\n const index = i * 4 + j * 2 + k;\r\n if (i == 0) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x / 2, this._boundingDimensions.y * j, this._boundingDimensions.z * k);\r\n rotateSpheres[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(\r\n Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), Vector3.Right()).normalizeToNew().add(rotateSpheres[index].position)\r\n );\r\n }\r\n if (i == 1) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y / 2, this._boundingDimensions.z * k);\r\n rotateSpheres[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(\r\n Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), Vector3.Up()).normalizeToNew().add(rotateSpheres[index].position)\r\n );\r\n }\r\n if (i == 2) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y * k, this._boundingDimensions.z / 2);\r\n rotateSpheres[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(\r\n Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), Vector3.Forward()).normalizeToNew().add(rotateSpheres[index].position)\r\n );\r\n }\r\n if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);\r\n const distanceFromCamera = (this.rotationSphereSize * this._tmpVector.length()) / this.fixedDragMeshScreenSizeDistanceFactor;\r\n rotateSpheres[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n } else if (this.fixedDragMeshBoundsSize) {\r\n rotateSpheres[index].scaling.set(\r\n this.rotationSphereSize * this._boundingDimensions.x,\r\n this.rotationSphereSize * this._boundingDimensions.y,\r\n this.rotationSphereSize * this._boundingDimensions.z\r\n );\r\n } else {\r\n rotateSpheres[index].scaling.set(this.rotationSphereSize, this.rotationSphereSize, this.rotationSphereSize);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _updateScaleBoxes() {\r\n const scaleBoxes = this._scaleBoxesParent.getChildMeshes();\r\n let index = 0;\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 3; j++) {\r\n for (let k = 0; k < 3; k++) {\r\n const zeroAxisCount = (i === 1 ? 1 : 0) + (j === 1 ? 1 : 0) + (k === 1 ? 1 : 0);\r\n if (zeroAxisCount === 1 || zeroAxisCount === 3) {\r\n continue;\r\n }\r\n if (scaleBoxes[index]) {\r\n scaleBoxes[index].position.set(this._boundingDimensions.x * (i / 2), this._boundingDimensions.y * (j / 2), this._boundingDimensions.z * (k / 2));\r\n scaleBoxes[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);\r\n const distanceFromCamera = (this.scaleBoxSize * this._tmpVector.length()) / this.fixedDragMeshScreenSizeDistanceFactor;\r\n scaleBoxes[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n } else if (this.fixedDragMeshBoundsSize) {\r\n scaleBoxes[index].scaling.set(\r\n this.scaleBoxSize * this._boundingDimensions.x,\r\n this.scaleBoxSize * this._boundingDimensions.y,\r\n this.scaleBoxSize * this._boundingDimensions.z\r\n );\r\n } else {\r\n scaleBoxes[index].scaling.set(this.scaleBoxSize, this.scaleBoxSize, this.scaleBoxSize);\r\n }\r\n }\r\n index++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Enables rotation on the specified axis and disables rotation on the others\r\n * @param axis The list of axis that should be enabled (eg. \"xy\" or \"xyz\")\r\n */\r\n public setEnabledRotationAxis(axis: string) {\r\n this._rotateSpheresParent.getChildMeshes().forEach((m, i) => {\r\n if (i < 4) {\r\n m.setEnabled(axis.indexOf(\"x\") != -1);\r\n } else if (i < 8) {\r\n m.setEnabled(axis.indexOf(\"y\") != -1);\r\n } else {\r\n m.setEnabled(axis.indexOf(\"z\") != -1);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Enables/disables scaling\r\n * @param enable if scaling should be enabled\r\n * @param homogeneousScaling defines if scaling should only be homogeneous\r\n */\r\n public setEnabledScaling(enable: boolean, homogeneousScaling = false) {\r\n this._scaleBoxesParent.getChildMeshes().forEach((m) => {\r\n let enableMesh = enable;\r\n // Disable heterogeneous scale handles if requested.\r\n if (homogeneousScaling && m.metadata === true) {\r\n enableMesh = false;\r\n }\r\n m.setEnabled(enableMesh);\r\n });\r\n }\r\n\r\n private _updateDummy() {\r\n if (this._dragMesh) {\r\n this._dragMesh.position.copyFrom(this._lineBoundingBox.getAbsolutePosition());\r\n this._dragMesh.scaling.copyFrom(this._lineBoundingBox.scaling);\r\n this._dragMesh.rotationQuaternion!.copyFrom(this._rootMesh.rotationQuaternion!);\r\n }\r\n }\r\n\r\n /**\r\n * Enables a pointer drag behavior on the bounding box of the gizmo\r\n */\r\n public enableDragBehavior() {\r\n this._dragMesh = CreateBox(\"dummy\", { size: 1 }, this.gizmoLayer.utilityLayerScene);\r\n this._dragMesh.visibility = 0;\r\n this._dragMesh.rotationQuaternion = new Quaternion();\r\n this._pointerDragBehavior.useObjectOrientationForDragging = false;\r\n this._dragMesh.addBehavior(this._pointerDragBehavior);\r\n }\r\n\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n public dispose() {\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver);\r\n this._lineBoundingBox.dispose();\r\n this._rotateSpheresParent.dispose();\r\n this._scaleBoxesParent.dispose();\r\n if (this._dragMesh) {\r\n this._dragMesh.dispose();\r\n }\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Makes a mesh not pickable and wraps the mesh inside of a bounding box mesh that is pickable. (This is useful to avoid picking within complex geometry)\r\n * @param mesh the mesh to wrap in the bounding box mesh and make not pickable\r\n * @returns the bounding box mesh with the passed in mesh as a child\r\n */\r\n public static MakeNotPickableAndWrapInBoundingBox(mesh: Mesh): Mesh {\r\n const makeNotPickable = (root: AbstractMesh) => {\r\n root.isPickable = false;\r\n root.getChildMeshes().forEach((c) => {\r\n makeNotPickable(c);\r\n });\r\n };\r\n makeNotPickable(mesh);\r\n\r\n // Reset position to get bounding box from origin with no rotation\r\n if (!mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(mesh.rotation.y, mesh.rotation.x, mesh.rotation.z);\r\n }\r\n const oldPos = mesh.position.clone();\r\n const oldRot = mesh.rotationQuaternion.clone();\r\n mesh.rotationQuaternion.set(0, 0, 0, 1);\r\n mesh.position.set(0, 0, 0);\r\n\r\n // Update bounding dimensions/positions\r\n const box = CreateBox(\"box\", { size: 1 }, mesh.getScene());\r\n const boundingMinMax = mesh.getHierarchyBoundingVectors();\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, box.scaling);\r\n\r\n // Adjust scale to avoid undefined behavior when adding child\r\n if (box.scaling.y === 0) {\r\n box.scaling.y = Epsilon;\r\n }\r\n if (box.scaling.x === 0) {\r\n box.scaling.x = Epsilon;\r\n }\r\n if (box.scaling.z === 0) {\r\n box.scaling.z = Epsilon;\r\n }\r\n\r\n box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);\r\n\r\n // Restore original positions\r\n mesh.addChild(box);\r\n mesh.rotationQuaternion.copyFrom(oldRot);\r\n mesh.position.copyFrom(oldPos);\r\n\r\n // Reverse parenting\r\n mesh.removeChild(box);\r\n\r\n box.addChild(mesh);\r\n box.visibility = 0;\r\n return box;\r\n }\r\n /**\r\n * CustomMeshes are not supported by this gizmo\r\n */\r\n public setCustomMesh() {\r\n Logger.Error(\"Custom meshes are not supported on this gizmo\");\r\n }\r\n}\r\n"]}
package/Lights/light.js CHANGED
@@ -456,7 +456,7 @@ var Light = /** @class */ (function (_super) {
456
456
  serializationObject.type = this.getTypeID();
457
457
  // Parent
458
458
  if (this.parent) {
459
- serializationObject.parentId = this.parent.uniqueId;
459
+ this.parent._serializeAsParent(serializationObject);
460
460
  }
461
461
  // Inclusion / exclusions
462
462
  if (this.excludedMeshes.length > 0) {
@@ -516,6 +516,9 @@ var Light = /** @class */ (function (_super) {
516
516
  if (parsedLight.parentId !== undefined) {
517
517
  light._waitingParentId = parsedLight.parentId;
518
518
  }
519
+ if (parsedLight.parentInstanceIndex !== undefined) {
520
+ light._waitingParentInstanceIndex = parsedLight.parentInstanceIndex;
521
+ }
519
522
  // Falloff
520
523
  if (parsedLight.falloffType !== undefined) {
521
524
  light.falloffType = parsedLight.falloffType;