@babylonjs/core 8.48.0 → 8.48.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/Audio/analyser.js.map +1 -1
  2. package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.js.map +1 -1
  3. package/Buffers/buffer.align.js +3 -3
  4. package/Buffers/buffer.align.js.map +1 -1
  5. package/Buffers/bufferUtils.d.ts +7 -0
  6. package/Buffers/bufferUtils.js +31 -13
  7. package/Buffers/bufferUtils.js.map +1 -1
  8. package/Engines/Extensions/engine.dynamicBuffer.js +3 -3
  9. package/Engines/Extensions/engine.dynamicBuffer.js.map +1 -1
  10. package/Engines/Native/nativeDataStream.d.ts +1 -1
  11. package/Engines/Native/nativeDataStream.js.map +1 -1
  12. package/Engines/Native/nativeInterfaces.d.ts +4 -4
  13. package/Engines/Native/nativeInterfaces.js.map +1 -1
  14. package/Engines/WebGPU/Extensions/engine.rawTexture.d.ts +13 -1
  15. package/Engines/WebGPU/Extensions/engine.rawTexture.js +26 -8
  16. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  17. package/Engines/WebGPU/webgpuTextureManager.d.ts +2 -1
  18. package/Engines/WebGPU/webgpuTextureManager.js +19 -6
  19. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  20. package/Engines/abstractEngine.d.ts +4 -2
  21. package/Engines/abstractEngine.functions.d.ts +1 -1
  22. package/Engines/abstractEngine.functions.js +8 -8
  23. package/Engines/abstractEngine.functions.js.map +1 -1
  24. package/Engines/abstractEngine.js +6 -4
  25. package/Engines/abstractEngine.js.map +1 -1
  26. package/Engines/engine.d.ts +12 -0
  27. package/Engines/thinNativeEngine.js +1 -1
  28. package/Engines/thinNativeEngine.js.map +1 -1
  29. package/Engines/thinWebGPUEngine.js +3 -0
  30. package/Engines/thinWebGPUEngine.js.map +1 -1
  31. package/Engines/webgpuEngine.js +18 -18
  32. package/Engines/webgpuEngine.js.map +1 -1
  33. package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
  34. package/Materials/Background/backgroundMaterial.d.ts +16 -8
  35. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +14 -1
  36. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  37. package/Materials/Node/nodeMaterial.d.ts +16 -8
  38. package/Materials/PBR/openpbrMaterial.d.ts +16 -8
  39. package/Materials/PBR/pbrBaseMaterial.d.ts +16 -8
  40. package/Materials/Textures/Loaders/EXR/exrLoader.compression.rle.d.ts +1 -1
  41. package/Materials/Textures/Loaders/EXR/exrLoader.compression.rle.js.map +1 -1
  42. package/Materials/Textures/Loaders/EXR/exrLoader.core.d.ts +1 -1
  43. package/Materials/Textures/Loaders/EXR/exrLoader.core.js.map +1 -1
  44. package/Materials/Textures/internalTexture.d.ts +6 -0
  45. package/Materials/Textures/internalTexture.js +24 -2
  46. package/Materials/Textures/internalTexture.js.map +1 -1
  47. package/Materials/Textures/rawTexture.d.ts +8 -1
  48. package/Materials/Textures/rawTexture.js +12 -3
  49. package/Materials/Textures/rawTexture.js.map +1 -1
  50. package/Materials/Textures/rawTexture2DArray.d.ts +8 -1
  51. package/Materials/Textures/rawTexture2DArray.js +14 -3
  52. package/Materials/Textures/rawTexture2DArray.js.map +1 -1
  53. package/Materials/imageProcessing.d.ts +47 -8
  54. package/Materials/standardMaterial.d.ts +16 -8
  55. package/Meshes/Builders/shapeBuilder.d.ts +4 -0
  56. package/Meshes/Builders/shapeBuilder.js +12 -9
  57. package/Meshes/Builders/shapeBuilder.js.map +1 -1
  58. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +68 -4
  59. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +343 -26
  60. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  61. package/Misc/dds.js.map +1 -1
  62. package/Misc/environmentTextureTools.js +3 -1
  63. package/Misc/environmentTextureTools.js.map +1 -1
  64. package/Misc/fileTools.js +9 -1
  65. package/Misc/fileTools.js.map +1 -1
  66. package/Physics/v1/physicsImpostor.d.ts +2 -2
  67. package/Physics/v1/physicsImpostor.js.map +1 -1
  68. package/Shaders/ShadersInclude/gaussianSplatting.js +16 -3
  69. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  70. package/Shaders/gaussianSplatting.vertex.js +17 -4
  71. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  72. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +11 -1
  73. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  74. package/ShadersWGSL/gaussianSplatting.vertex.js +17 -4
  75. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  76. package/XR/native/nativeXRFrame.d.ts +1 -1
  77. package/XR/native/nativeXRFrame.js.map +1 -1
  78. package/package.json +1 -1
  79. package/types.d.ts +1 -1
  80. package/types.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"physicsImpostor.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v1/physicsImpostor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAOzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA+K9C,IAAI,CAAC,sBAAsB,GAAG,UAAU,KAAY,EAAE,YAAmC,EAAE,UAAe;IACtG,OAAO,IAAI,eAAe,CACtB,YAAY,EACZ,UAAU,CAAC,eAAe,EAC1B;QACI,IAAI,EAAE,UAAU,CAAC,WAAW;QAC5B,QAAQ,EAAE,UAAU,CAAC,eAAe;QACpC,WAAW,EAAE,UA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,CAAC,AAAJ,CAAK;AAC7B;;GAEG;AACW,8BAAc,GAAG,CAAC,AAAJ,CAAK;AACjC;;GAEG;AACW,2BAAW,GAAG,CAAC,AAAJ,CAAK;AAC9B;;GAEG;AACW,6BAAa,GAAG,CAAC,AAAJ,CAAK;AAChC;;GAEG;AACW,4BAAY,GAAG,CAAC,AAAJ,CAAK;AAC/B;;GAEG;AACW,+BAAe,GAAG,CAAC,AAAJ,CAAK;AAClC;;GAEG;AACW,gCAAgB,GAAG,CAAC,AAAJ,CAAK;AACnC;;GAEG;AACW,gCAAgB,GAAG,CAAC,AAAJ,CAAK;AACnC;;GAEG;AACW,iCAAiB,GAAG,CAAC,AAAJ,CAAK;AACpC;;GAEG;AACW,kCAAkB,GAAG,EAAE,AAAL,CAAM;AACtC;;GAEG;AACW,8BAAc,GAAG,GAAG,AAAN,CAAO;AACnC;;GAEG;AACW,4BAAY,GAAG,GAAG,AAAN,CAAO;AACjC;;GAEG;AACW,6BAAa,GAAG,GAAG,AAAN,CAAO;AAClC;;GAEG;AACW,gCAAgB,GAAG,GAAG,AAAN,CAAO","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-return */\r\nimport type { Nullable, IndicesArray } from \"../../types\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { BuildArray } from \"../../Misc/arrayTools\";\r\nimport type { Matrix } from \"../../Maths/math.vector\";\r\nimport { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Bone } from \"../../Bones/bone\";\r\nimport type { BoundingInfo } from \"../../Culling/boundingInfo\";\r\nimport type { PhysicsEngine as PhysicsEngineV1 } from \"./physicsEngine\";\r\n\r\nimport type { PhysicsJointData } from \"./physicsJoint\";\r\nimport { PhysicsJoint } from \"./physicsJoint\";\r\nimport { Space } from \"../../Maths/math.axis\";\r\n\r\n/**\r\n * The interface for the physics imposter parameters\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsImpostorParameters {\r\n /**\r\n * The mass of the physics imposter\r\n */\r\n mass: number;\r\n /**\r\n * The friction of the physics imposter\r\n */\r\n friction?: number;\r\n /**\r\n * The coefficient of restitution of the physics imposter\r\n */\r\n restitution?: number;\r\n /**\r\n * The native options of the physics imposter\r\n */\r\n nativeOptions?: any;\r\n /**\r\n * Specifies if the parent should be ignored\r\n */\r\n ignoreParent?: boolean;\r\n /**\r\n * Specifies if bi-directional transformations should be disabled\r\n */\r\n disableBidirectionalTransformation?: boolean;\r\n /**\r\n * The pressure inside the physics imposter, soft object only\r\n */\r\n pressure?: number;\r\n /**\r\n * The stiffness the physics imposter, soft object only\r\n */\r\n stiffness?: number;\r\n /**\r\n * The number of iterations used in maintaining consistent vertex velocities, soft object only\r\n */\r\n velocityIterations?: number;\r\n /**\r\n * The number of iterations used in maintaining consistent vertex positions, soft object only\r\n */\r\n positionIterations?: number;\r\n /**\r\n * The number used to fix points on a cloth (0, 1, 2, 4, 8) or rope (0, 1, 2) only\r\n * 0 None, 1, back left or top, 2, back right or bottom, 4, front left, 8, front right\r\n * Add to fix multiple points\r\n */\r\n fixedPoints?: number;\r\n /**\r\n * The collision margin around a soft object\r\n */\r\n margin?: number;\r\n /**\r\n * The collision margin around a soft object\r\n */\r\n damping?: number;\r\n /**\r\n * The path for a rope based on an extrusion\r\n */\r\n path?: any;\r\n /**\r\n * The shape of an extrusion used for a rope based on an extrusion\r\n */\r\n shape?: any;\r\n}\r\n\r\n/**\r\n * Interface for a physics-enabled object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface IPhysicsEnabledObject {\r\n /**\r\n * The position of the physics-enabled object\r\n */\r\n position: Vector3;\r\n /**\r\n * The rotation of the physics-enabled object\r\n */\r\n rotationQuaternion: Nullable<Quaternion>;\r\n /**\r\n * The scale of the physics-enabled object\r\n */\r\n scaling: Vector3;\r\n /**\r\n * The rotation of the physics-enabled object\r\n */\r\n rotation?: Vector3;\r\n /**\r\n * The parent of the physics-enabled object\r\n */\r\n parent?: any;\r\n /**\r\n * The bounding info of the physics-enabled object\r\n * @returns The bounding info of the physics-enabled object\r\n */\r\n getBoundingInfo(): BoundingInfo;\r\n /**\r\n * Computes the world matrix\r\n * @param force Specifies if the world matrix should be computed by force\r\n * @returns A world matrix\r\n */\r\n computeWorldMatrix(force: boolean): Matrix;\r\n /**\r\n * Gets the world matrix\r\n * @returns A world matrix\r\n */\r\n getWorldMatrix?(): Matrix;\r\n /**\r\n * Gets the child meshes\r\n * @param directDescendantsOnly Specifies if only direct-descendants should be obtained\r\n * @returns An array of abstract meshes\r\n */\r\n getChildMeshes?(directDescendantsOnly?: boolean): Array<AbstractMesh>;\r\n /**\r\n * Gets the vertex data\r\n * @param kind The type of vertex data\r\n * @returns A nullable array of numbers, or a float32 array\r\n */\r\n getVerticesData(kind: string): Nullable<Array<number> | Float32Array>;\r\n /**\r\n * Gets the indices from the mesh\r\n * @returns A nullable array of index arrays\r\n */\r\n getIndices?(): Nullable<IndicesArray>;\r\n /**\r\n * Gets the scene from the mesh\r\n * @returns the indices array or null\r\n */\r\n getScene?(): Scene;\r\n /**\r\n * Gets the absolute position from the mesh\r\n * @returns the absolute position\r\n */\r\n getAbsolutePosition(): Vector3;\r\n /**\r\n * Gets the absolute pivot point from the mesh\r\n * @returns the absolute pivot point\r\n */\r\n getAbsolutePivotPoint(): Vector3;\r\n /**\r\n * Rotates the mesh\r\n * @param axis The axis of rotation\r\n * @param amount The amount of rotation\r\n * @param space The space of the rotation\r\n * @returns The rotation transform node\r\n */\r\n rotate(axis: Vector3, amount: number, space?: Space): TransformNode;\r\n /**\r\n * Translates the mesh\r\n * @param axis The axis of translation\r\n * @param distance The distance of translation\r\n * @param space The space of the translation\r\n * @returns The transform node\r\n */\r\n translate(axis: Vector3, distance: number, space?: Space): TransformNode;\r\n /**\r\n * Sets the absolute position of the mesh\r\n * @param absolutePosition The absolute position of the mesh\r\n * @returns The transform node\r\n */\r\n setAbsolutePosition(absolutePosition: Vector3): TransformNode;\r\n /**\r\n * Gets the class name of the mesh\r\n * @returns The class name\r\n */\r\n getClassName(): string;\r\n}\r\n\r\nMesh._PhysicsImpostorParser = function (scene: Scene, physicObject: IPhysicsEnabledObject, jsonObject: any): PhysicsImpostor {\r\n return new PhysicsImpostor(\r\n physicObject,\r\n jsonObject.physicsImpostor,\r\n {\r\n mass: jsonObject.physicsMass,\r\n friction: jsonObject.physicsFriction,\r\n restitution: jsonObject.physicsRestitution,\r\n },\r\n scene\r\n );\r\n};\r\n\r\n/**\r\n * Represents a physics imposter\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsImpostor {\r\n /**\r\n * The default object size of the imposter\r\n */\r\n public static DEFAULT_OBJECT_SIZE: Vector3 = new Vector3(1, 1, 1);\r\n\r\n /**\r\n * The identity quaternion of the imposter\r\n */\r\n public static IDENTITY_QUATERNION = Quaternion.Identity();\r\n\r\n /** @internal */\r\n public _pluginData: any = {};\r\n\r\n private _physicsEngine: Nullable<PhysicsEngineV1>;\r\n //The native cannon/oimo/energy physics body object.\r\n private _physicsBody: any;\r\n private _bodyUpdateRequired: boolean = false;\r\n\r\n private _onBeforePhysicsStepCallbacks = new Array<(impostor: PhysicsImpostor) => void>();\r\n private _onAfterPhysicsStepCallbacks = new Array<(impostor: PhysicsImpostor) => void>();\r\n /** @internal */\r\n public _onPhysicsCollideCallbacks: Array<{\r\n callback: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor, point: Nullable<Vector3>, distance: number, impulse: number, normal: Nullable<Vector3>) => void;\r\n otherImpostors: Array<PhysicsImpostor>;\r\n }> = [];\r\n\r\n private _deltaPosition: Vector3 = Vector3.Zero();\r\n private _deltaRotation: Quaternion;\r\n private _deltaRotationConjugated: Quaternion;\r\n\r\n /** @internal */\r\n public _isFromLine: boolean;\r\n\r\n //If set, this is this impostor's parent\r\n private _parent: Nullable<PhysicsImpostor>;\r\n\r\n private _isDisposed = false;\r\n\r\n private static _TmpVecs: Vector3[] = BuildArray(3, Vector3.Zero);\r\n private static _TmpQuat: Quaternion = Quaternion.Identity();\r\n\r\n /**\r\n * Specifies if the physics imposter is disposed\r\n */\r\n get isDisposed(): boolean {\r\n return this._isDisposed;\r\n }\r\n\r\n /**\r\n * Gets the mass of the physics imposter\r\n */\r\n get mass(): number {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyMass(this) : 0;\r\n }\r\n\r\n set mass(value: number) {\r\n this.setMass(value);\r\n }\r\n\r\n /**\r\n * Gets the coefficient of friction\r\n */\r\n get friction(): number {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyFriction(this) : 0;\r\n }\r\n\r\n /**\r\n * Sets the coefficient of friction\r\n */\r\n set friction(value: number) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._physicsEngine.getPhysicsPlugin().setBodyFriction(this, value);\r\n }\r\n\r\n /**\r\n * Gets the coefficient of restitution\r\n */\r\n get restitution(): number {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this) : 0;\r\n }\r\n\r\n /**\r\n * Sets the coefficient of restitution\r\n */\r\n set restitution(value: number) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this, value);\r\n }\r\n\r\n /**\r\n * Gets the pressure of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get pressure(): number {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyPressure) {\r\n return 0;\r\n }\r\n return plugin.getBodyPressure!(this);\r\n }\r\n\r\n /**\r\n * Sets the pressure of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set pressure(value: number) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyPressure) {\r\n return;\r\n }\r\n plugin.setBodyPressure(this, value);\r\n }\r\n\r\n /**\r\n * Gets the stiffness of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get stiffness(): number {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.getBodyStiffness) {\r\n return 0;\r\n }\r\n return plugin.getBodyStiffness(this);\r\n }\r\n\r\n /**\r\n * Sets the stiffness of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set stiffness(value: number) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyStiffness) {\r\n return;\r\n }\r\n plugin.setBodyStiffness(this, value);\r\n }\r\n\r\n /**\r\n * Gets the velocityIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get velocityIterations(): number {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.getBodyVelocityIterations) {\r\n return 0;\r\n }\r\n return plugin.getBodyVelocityIterations(this);\r\n }\r\n\r\n /**\r\n * Sets the velocityIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set velocityIterations(value: number) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyVelocityIterations) {\r\n return;\r\n }\r\n plugin.setBodyVelocityIterations(this, value);\r\n }\r\n\r\n /**\r\n * Gets the positionIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get positionIterations(): number {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.getBodyPositionIterations) {\r\n return 0;\r\n }\r\n return plugin.getBodyPositionIterations(this);\r\n }\r\n\r\n /**\r\n * Sets the positionIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set positionIterations(value: number) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyPositionIterations) {\r\n return;\r\n }\r\n plugin.setBodyPositionIterations(this, value);\r\n }\r\n\r\n /**\r\n * The unique id of the physics imposter\r\n * set by the physics engine when adding this impostor to the array\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * @internal\r\n */\r\n public soft: boolean = false;\r\n\r\n /**\r\n * @internal\r\n */\r\n public segments: number = 0;\r\n\r\n private _joints: Array<{\r\n joint: PhysicsJoint;\r\n otherImpostor: PhysicsImpostor;\r\n }>;\r\n\r\n /**\r\n * Initializes the physics imposter\r\n * @param object The physics-enabled object used as the physics imposter\r\n * @param type The type of the physics imposter. Types are available as static members of this class.\r\n * @param _options The options for the physics imposter\r\n * @param _scene The Babylon scene\r\n */\r\n constructor(\r\n /**\r\n * The physics-enabled object used as the physics imposter\r\n */\r\n public object: IPhysicsEnabledObject,\r\n /**\r\n * The type of the physics imposter\r\n */\r\n public type: number,\r\n private _options: PhysicsImpostorParameters = { mass: 0 },\r\n private _scene?: Scene\r\n ) {\r\n //sanity check!\r\n if (!this.object) {\r\n Logger.Error(\"No object was provided. A physics object is obligatory\");\r\n return;\r\n }\r\n if (this.object.parent && _options.mass !== 0) {\r\n Logger.Warn(\"A physics impostor has been created for an object which has a parent. Babylon physics currently works in local space so unexpected issues may occur.\");\r\n }\r\n\r\n // Legacy support for old syntax.\r\n if (!this._scene && object.getScene) {\r\n this._scene = object.getScene();\r\n }\r\n\r\n if (!this._scene) {\r\n return;\r\n }\r\n\r\n if (this.type > 100) {\r\n this.soft = true;\r\n }\r\n\r\n this._physicsEngine = this._scene.getPhysicsEngine() as any;\r\n if (!this._physicsEngine) {\r\n Logger.Error(\"Physics not enabled. Please use scene.enablePhysics(...) before creating impostors.\");\r\n } else {\r\n //set the object's quaternion, if not set\r\n if (!this.object.rotationQuaternion) {\r\n if (this.object.rotation) {\r\n this.object.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.object.rotation.y, this.object.rotation.x, this.object.rotation.z);\r\n } else {\r\n this.object.rotationQuaternion = new Quaternion();\r\n }\r\n }\r\n //default options params\r\n this._options.mass = _options.mass === void 0 ? 0 : _options.mass;\r\n this._options.friction = _options.friction === void 0 ? 0.2 : _options.friction;\r\n this._options.restitution = _options.restitution === void 0 ? 0.2 : _options.restitution;\r\n if (this.soft) {\r\n //softbody mass must be above 0;\r\n this._options.mass = this._options.mass > 0 ? this._options.mass : 1;\r\n this._options.pressure = _options.pressure === void 0 ? 200 : _options.pressure;\r\n this._options.stiffness = _options.stiffness === void 0 ? 1 : _options.stiffness;\r\n this._options.velocityIterations = _options.velocityIterations === void 0 ? 20 : _options.velocityIterations;\r\n this._options.positionIterations = _options.positionIterations === void 0 ? 20 : _options.positionIterations;\r\n this._options.fixedPoints = _options.fixedPoints === void 0 ? 0 : _options.fixedPoints;\r\n this._options.margin = _options.margin === void 0 ? 0 : _options.margin;\r\n this._options.damping = _options.damping === void 0 ? 0 : _options.damping;\r\n this._options.path = _options.path === void 0 ? null : _options.path;\r\n this._options.shape = _options.shape === void 0 ? null : _options.shape;\r\n }\r\n this._joints = [];\r\n //If the mesh has a parent, don't initialize the physicsBody. Instead wait for the parent to do that.\r\n if (!this.object.parent || this._options.ignoreParent) {\r\n this._init();\r\n } else if (this.object.parent.physicsImpostor) {\r\n Logger.Warn(\"You must affect impostors to children before affecting impostor to parent.\");\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * This function will completely initialize this impostor.\r\n * It will create a new body - but only if this mesh has no parent.\r\n * If it has, this impostor will not be used other than to define the impostor\r\n * of the child mesh.\r\n * @internal\r\n */\r\n public _init() {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n\r\n this._physicsEngine.removeImpostor(this);\r\n this.physicsBody = null;\r\n this._parent = this._parent || this._getPhysicsParent();\r\n if (!this._isDisposed && (!this.parent || this._options.ignoreParent)) {\r\n this._physicsEngine.addImpostor(this);\r\n }\r\n }\r\n\r\n private _getPhysicsParent(): Nullable<PhysicsImpostor> {\r\n if (this.object.parent instanceof AbstractMesh) {\r\n const parentMesh: AbstractMesh = this.object.parent;\r\n return parentMesh.physicsImpostor;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Should a new body be generated.\r\n * @returns boolean specifying if body initialization is required\r\n */\r\n public isBodyInitRequired(): boolean {\r\n return this._bodyUpdateRequired || (!this._physicsBody && (!this._parent || !!this._options.ignoreParent));\r\n }\r\n\r\n /**\r\n * Sets the updated scaling\r\n */\r\n public setScalingUpdated() {\r\n this.forceUpdate();\r\n }\r\n\r\n /**\r\n * Force a regeneration of this or the parent's impostor's body.\r\n * Use with caution - This will remove all previously-instantiated joints.\r\n */\r\n public forceUpdate() {\r\n this._init();\r\n if (this.parent && !this._options.ignoreParent) {\r\n this.parent.forceUpdate();\r\n }\r\n }\r\n\r\n /*public get mesh(): AbstractMesh {\r\n return this._mesh;\r\n }*/\r\n\r\n /**\r\n * Gets the body that holds this impostor. Either its own, or its parent.\r\n */\r\n public get physicsBody(): any {\r\n return this._parent && !this._options.ignoreParent ? this._parent.physicsBody : this._physicsBody;\r\n }\r\n\r\n /**\r\n * Get the parent of the physics imposter\r\n * @returns Physics imposter or null\r\n */\r\n public get parent(): Nullable<PhysicsImpostor> {\r\n return !this._options.ignoreParent && this._parent ? this._parent : null;\r\n }\r\n\r\n /**\r\n * Sets the parent of the physics imposter\r\n */\r\n public set parent(value: Nullable<PhysicsImpostor>) {\r\n this._parent = value;\r\n }\r\n\r\n /**\r\n * Set the physics body. Used mainly by the physics engine/plugin\r\n */\r\n public set physicsBody(physicsBody: any) {\r\n if (this._physicsBody && this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this);\r\n }\r\n this._physicsBody = physicsBody;\r\n this.resetUpdateFlags();\r\n }\r\n\r\n /**\r\n * Resets the update flags\r\n */\r\n public resetUpdateFlags() {\r\n this._bodyUpdateRequired = false;\r\n }\r\n\r\n /**\r\n * Gets the object extents\r\n * @returns the object extents\r\n */\r\n public getObjectExtents(): Vector3 {\r\n if (this.object.getBoundingInfo) {\r\n const q = this.object.rotationQuaternion;\r\n const scaling = this.object.scaling.clone();\r\n //reset rotation\r\n this.object.rotationQuaternion = PhysicsImpostor.IDENTITY_QUATERNION;\r\n //calculate the world matrix with no rotation\r\n const worldMatrix = this.object.computeWorldMatrix && this.object.computeWorldMatrix(true);\r\n if (worldMatrix) {\r\n worldMatrix.decompose(scaling, undefined, undefined);\r\n }\r\n const boundingInfo = this.object.getBoundingInfo();\r\n // get the global scaling of the object\r\n const size = boundingInfo.boundingBox.extendSize.scale(2).multiplyInPlace(scaling);\r\n size.x = Math.abs(size.x);\r\n size.y = Math.abs(size.y);\r\n size.z = Math.abs(size.z);\r\n //bring back the rotation\r\n this.object.rotationQuaternion = q;\r\n //calculate the world matrix with the new rotation\r\n if (this.object.computeWorldMatrix) {\r\n this.object.computeWorldMatrix(true);\r\n }\r\n return size;\r\n } else {\r\n return PhysicsImpostor.DEFAULT_OBJECT_SIZE;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the object center\r\n * @returns The object center\r\n */\r\n public getObjectCenter(): Vector3 {\r\n if (this.object.getBoundingInfo) {\r\n const boundingInfo = this.object.getBoundingInfo();\r\n return boundingInfo.boundingBox.centerWorld;\r\n } else {\r\n return this.object.position;\r\n }\r\n }\r\n\r\n /**\r\n * Get a specific parameter from the options parameters\r\n * @param paramName The object parameter name\r\n * @returns The object parameter\r\n */\r\n public getParam(paramName: string): any {\r\n return (<any>this._options)[paramName];\r\n }\r\n\r\n /**\r\n * Sets a specific parameter in the options given to the physics plugin\r\n * @param paramName The parameter name\r\n * @param value The value of the parameter\r\n */\r\n public setParam(paramName: string, value: number) {\r\n (<any>this._options)[paramName] = value;\r\n this._bodyUpdateRequired = true;\r\n }\r\n\r\n /**\r\n * Specifically change the body's mass. Won't recreate the physics body object\r\n * @param mass The mass of the physics imposter\r\n */\r\n public setMass(mass: number) {\r\n if (this.getParam(\"mass\") !== mass) {\r\n this.setParam(\"mass\", mass);\r\n }\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().setBodyMass(this, mass);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the linear velocity\r\n * @returns linear velocity or null\r\n */\r\n public getLinearVelocity(): Nullable<Vector3> {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this) : Vector3.Zero();\r\n }\r\n\r\n /**\r\n * Sets the linear velocity\r\n * @param velocity linear velocity or null\r\n */\r\n public setLinearVelocity(velocity: Nullable<Vector3>) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this, velocity);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the angular velocity\r\n * @returns angular velocity or null\r\n */\r\n public getAngularVelocity(): Nullable<Vector3> {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this) : Vector3.Zero();\r\n }\r\n\r\n /**\r\n * Sets the angular velocity\r\n * @param velocity The velocity or null\r\n */\r\n public setAngularVelocity(velocity: Nullable<Vector3>) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this, velocity);\r\n }\r\n }\r\n\r\n /**\r\n * Execute a function with the physics plugin native code\r\n * Provide a function the will have two variables - the world object and the physics body object\r\n * @param func The function to execute with the physics plugin native code\r\n */\r\n public executeNativeFunction(func: (world: any, physicsBody: any) => void) {\r\n if (this._physicsEngine) {\r\n func(this._physicsEngine.getPhysicsPlugin().world, this.physicsBody);\r\n }\r\n }\r\n\r\n /**\r\n * Register a function that will be executed before the physics world is stepping forward\r\n * @param func The function to execute before the physics world is stepped forward\r\n */\r\n public registerBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void {\r\n this._onBeforePhysicsStepCallbacks.push(func);\r\n }\r\n\r\n /**\r\n * Unregister a function that will be executed before the physics world is stepping forward\r\n * @param func The function to execute before the physics world is stepped forward\r\n */\r\n public unregisterBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void {\r\n const index = this._onBeforePhysicsStepCallbacks.indexOf(func);\r\n\r\n if (index > -1) {\r\n this._onBeforePhysicsStepCallbacks.splice(index, 1);\r\n } else {\r\n Logger.Warn(\"Function to remove was not found\");\r\n }\r\n }\r\n\r\n /**\r\n * Register a function that will be executed after the physics step\r\n * @param func The function to execute after physics step\r\n */\r\n public registerAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void {\r\n this._onAfterPhysicsStepCallbacks.push(func);\r\n }\r\n\r\n /**\r\n * Unregisters a function that will be executed after the physics step\r\n * @param func The function to execute after physics step\r\n */\r\n public unregisterAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void {\r\n const index = this._onAfterPhysicsStepCallbacks.indexOf(func);\r\n\r\n if (index > -1) {\r\n this._onAfterPhysicsStepCallbacks.splice(index, 1);\r\n } else {\r\n Logger.Warn(\"Function to remove was not found\");\r\n }\r\n }\r\n\r\n /**\r\n * register a function that will be executed when this impostor collides against a different body\r\n * @param collideAgainst Physics imposter, or array of physics imposters to collide against\r\n * @param func Callback that is executed on collision\r\n */\r\n public registerOnPhysicsCollide(\r\n collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>,\r\n func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor, point: Nullable<Vector3>) => void\r\n ): void {\r\n const collidedAgainstList: Array<PhysicsImpostor> = collideAgainst instanceof Array ? collideAgainst : [collideAgainst];\r\n this._onPhysicsCollideCallbacks.push({ callback: func, otherImpostors: collidedAgainstList });\r\n }\r\n\r\n /**\r\n * Unregisters the physics imposter's collision callback\r\n * @param collideAgainst The physics object to collide against\r\n * @param func Callback to execute on collision\r\n */\r\n public unregisterOnPhysicsCollide(\r\n collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>,\r\n func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor | Array<PhysicsImpostor>, point: Nullable<Vector3>) => void\r\n ): void {\r\n const collidedAgainstList: Array<PhysicsImpostor> = collideAgainst instanceof Array ? collideAgainst : [collideAgainst];\r\n let index = -1;\r\n const found = this._onPhysicsCollideCallbacks.some((cbDef, idx) => {\r\n if (cbDef.callback === func && cbDef.otherImpostors.length === collidedAgainstList.length) {\r\n // chcek the arrays match\r\n const sameList = cbDef.otherImpostors.every((impostor) => {\r\n return collidedAgainstList.indexOf(impostor) > -1;\r\n });\r\n if (sameList) {\r\n index = idx;\r\n }\r\n return sameList;\r\n }\r\n return false;\r\n });\r\n\r\n if (found) {\r\n this._onPhysicsCollideCallbacks.splice(index, 1);\r\n } else {\r\n Logger.Warn(\"Function to remove was not found\");\r\n }\r\n }\r\n\r\n //temp variables for parent rotation calculations\r\n //private _mats: Array<Matrix> = [new Matrix(), new Matrix()];\r\n private _tmpQuat: Quaternion = new Quaternion();\r\n private _tmpQuat2: Quaternion = new Quaternion();\r\n\r\n /**\r\n * Get the parent rotation\r\n * @returns The parent rotation\r\n */\r\n public getParentsRotation(): Quaternion {\r\n let parent = this.object.parent;\r\n this._tmpQuat.copyFromFloats(0, 0, 0, 1);\r\n while (parent) {\r\n if (parent.rotationQuaternion) {\r\n this._tmpQuat2.copyFrom(parent.rotationQuaternion);\r\n } else {\r\n Quaternion.RotationYawPitchRollToRef(parent.rotation.y, parent.rotation.x, parent.rotation.z, this._tmpQuat2);\r\n }\r\n this._tmpQuat.multiplyToRef(this._tmpQuat2, this._tmpQuat);\r\n parent = parent.parent;\r\n }\r\n return this._tmpQuat;\r\n }\r\n\r\n /**\r\n * this function is executed by the physics engine.\r\n */\r\n public beforeStep = () => {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n\r\n this.object.translate(this._deltaPosition, -1);\r\n if (this._deltaRotationConjugated && this.object.rotationQuaternion) {\r\n this.object.rotationQuaternion.multiplyToRef(this._deltaRotationConjugated, this.object.rotationQuaternion);\r\n }\r\n this.object.computeWorldMatrix(false);\r\n if (this.object.parent && this.object.rotationQuaternion) {\r\n this.getParentsRotation();\r\n this._tmpQuat.multiplyToRef(this.object.rotationQuaternion, this._tmpQuat);\r\n } else {\r\n this._tmpQuat.copyFrom(this.object.rotationQuaternion || new Quaternion());\r\n }\r\n if (!this._options.disableBidirectionalTransformation) {\r\n if (this.object.rotationQuaternion) {\r\n this._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(this, /*bInfo.boundingBox.centerWorld*/ this.object.getAbsolutePosition(), this._tmpQuat);\r\n }\r\n }\r\n\r\n for (const func of this._onBeforePhysicsStepCallbacks) {\r\n func(this);\r\n }\r\n };\r\n\r\n /**\r\n * this function is executed by the physics engine\r\n */\r\n public afterStep = () => {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n\r\n for (const func of this._onAfterPhysicsStepCallbacks) {\r\n func(this);\r\n }\r\n\r\n this._physicsEngine.getPhysicsPlugin().setTransformationFromPhysicsBody(this);\r\n // object has now its world rotation. needs to be converted to local.\r\n if (this.object.parent && this.object.rotationQuaternion) {\r\n this.getParentsRotation();\r\n this._tmpQuat.conjugateInPlace();\r\n this._tmpQuat.multiplyToRef(this.object.rotationQuaternion, this.object.rotationQuaternion);\r\n }\r\n // take the position set and make it the absolute position of this object.\r\n this.object.setAbsolutePosition(this.object.position);\r\n if (this._deltaRotation) {\r\n if (this.object.rotationQuaternion) {\r\n this.object.rotationQuaternion.multiplyToRef(this._deltaRotation, this.object.rotationQuaternion);\r\n }\r\n this._deltaPosition.applyRotationQuaternionToRef(this._deltaRotation, PhysicsImpostor._TmpVecs[0]);\r\n this.object.translate(PhysicsImpostor._TmpVecs[0], 1);\r\n } else {\r\n this.object.translate(this._deltaPosition, 1);\r\n }\r\n this.object.computeWorldMatrix(true);\r\n };\r\n\r\n /**\r\n * Legacy collision detection event support\r\n */\r\n public onCollideEvent: Nullable<(collider: PhysicsImpostor, collidedWith: PhysicsImpostor) => void> = null;\r\n\r\n /**\r\n * define an onCollide function to call when this impostor collides against a different body\r\n * @param e collide event data\r\n */\r\n public onCollide = (e: { body: any; point: Nullable<Vector3>; distance: number; impulse: number; normal: Nullable<Vector3> }) => {\r\n if (!this._onPhysicsCollideCallbacks.length && !this.onCollideEvent) {\r\n return;\r\n }\r\n\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n const otherImpostor = this._physicsEngine.getImpostorWithPhysicsBody(e.body);\r\n if (otherImpostor) {\r\n // Legacy collision detection event support\r\n if (this.onCollideEvent) {\r\n this.onCollideEvent(this, otherImpostor);\r\n }\r\n const callbacks = this._onPhysicsCollideCallbacks.filter((obj) => {\r\n return obj.otherImpostors.indexOf(<PhysicsImpostor>otherImpostor) !== -1;\r\n });\r\n\r\n for (const obj of callbacks) {\r\n obj.callback(this, <PhysicsImpostor>otherImpostor, e.point, e.distance, e.impulse, e.normal);\r\n }\r\n }\r\n };\r\n\r\n /**\r\n * Apply a force\r\n * @param force The force to apply\r\n * @param contactPoint The contact point for the force\r\n * @returns The physics imposter\r\n */\r\n public applyForce(force: Vector3, contactPoint: Vector3): PhysicsImpostor {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().applyForce(this, force, contactPoint);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Apply an impulse\r\n * @param force The impulse force\r\n * @param contactPoint The contact point for the impulse force\r\n * @returns The physics imposter\r\n */\r\n public applyImpulse(force: Vector3, contactPoint: Vector3): PhysicsImpostor {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().applyImpulse(this, force, contactPoint);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * A help function to create a joint\r\n * @param otherImpostor A physics imposter used to create a joint\r\n * @param jointType The type of joint\r\n * @param jointData The data for the joint\r\n * @returns The physics imposter\r\n */\r\n public createJoint(otherImpostor: PhysicsImpostor, jointType: number, jointData: PhysicsJointData): PhysicsImpostor {\r\n const joint = new PhysicsJoint(jointType, jointData);\r\n this.addJoint(otherImpostor, joint);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Add a joint to this impostor with a different impostor\r\n * @param otherImpostor A physics imposter used to add a joint\r\n * @param joint The joint to add\r\n * @returns The physics imposter\r\n */\r\n public addJoint(otherImpostor: PhysicsImpostor, joint: PhysicsJoint): PhysicsImpostor {\r\n this._joints.push({\r\n otherImpostor: otherImpostor,\r\n joint: joint,\r\n });\r\n\r\n if (this._physicsEngine) {\r\n this._physicsEngine.addJoint(this, otherImpostor, joint);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Add an anchor to a cloth impostor\r\n * @param otherImpostor rigid impostor to anchor to\r\n * @param width ratio across width from 0 to 1\r\n * @param height ratio up height from 0 to 1\r\n * @param influence the elasticity between cloth impostor and anchor from 0, very stretchy to 1, little stretch\r\n * @param noCollisionBetweenLinkedBodies when true collisions between cloth impostor and anchor are ignored; default false\r\n * @returns impostor the soft imposter\r\n */\r\n public addAnchor(otherImpostor: PhysicsImpostor, width: number, height: number, influence: number, noCollisionBetweenLinkedBodies: boolean): PhysicsImpostor {\r\n if (!this._physicsEngine) {\r\n return this;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.appendAnchor) {\r\n return this;\r\n }\r\n if (this._physicsEngine) {\r\n plugin.appendAnchor(this, otherImpostor, width, height, influence, noCollisionBetweenLinkedBodies);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Add a hook to a rope impostor\r\n * @param otherImpostor rigid impostor to anchor to\r\n * @param length ratio across rope from 0 to 1\r\n * @param influence the elasticity between rope impostor and anchor from 0, very stretchy to 1, little stretch\r\n * @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false\r\n * @returns impostor the rope imposter\r\n */\r\n public addHook(otherImpostor: PhysicsImpostor, length: number, influence: number, noCollisionBetweenLinkedBodies: boolean): PhysicsImpostor {\r\n if (!this._physicsEngine) {\r\n return this;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.appendAnchor) {\r\n return this;\r\n }\r\n if (this._physicsEngine) {\r\n plugin.appendHook!(this, otherImpostor, length, influence, noCollisionBetweenLinkedBodies);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Will keep this body still, in a sleep mode.\r\n * @returns the physics imposter\r\n */\r\n public sleep(): PhysicsImpostor {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().sleepBody(this);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Wake the body up.\r\n * @returns The physics imposter\r\n */\r\n public wakeUp(): PhysicsImpostor {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().wakeUpBody(this);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Clones the physics imposter\r\n * @param newObject The physics imposter clones to this physics-enabled object\r\n * @returns A nullable physics imposter\r\n */\r\n public clone(newObject: IPhysicsEnabledObject): Nullable<PhysicsImpostor> {\r\n if (!newObject) {\r\n return null;\r\n }\r\n return new PhysicsImpostor(newObject, this.type, this._options, this._scene);\r\n }\r\n\r\n /**\r\n * Disposes the physics imposter\r\n */\r\n public dispose(/*disposeChildren: boolean = true*/) {\r\n //no dispose if no physics engine is available.\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n\r\n for (const j of this._joints) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.removeJoint(this, j.otherImpostor, j.joint);\r\n }\r\n }\r\n //dispose the physics body\r\n this._physicsEngine.removeImpostor(this);\r\n if (this.parent) {\r\n this.parent.forceUpdate();\r\n }\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /**\r\n * Sets the delta position\r\n * @param position The delta position amount\r\n */\r\n public setDeltaPosition(position: Vector3) {\r\n this._deltaPosition.copyFrom(position);\r\n }\r\n\r\n /**\r\n * Sets the delta rotation\r\n * @param rotation The delta rotation amount\r\n */\r\n public setDeltaRotation(rotation: Quaternion) {\r\n if (!this._deltaRotation) {\r\n this._deltaRotation = new Quaternion();\r\n }\r\n this._deltaRotation.copyFrom(rotation);\r\n this._deltaRotationConjugated = this._deltaRotation.conjugate();\r\n }\r\n\r\n /**\r\n * Gets the box size of the physics imposter and stores the result in the input parameter\r\n * @param result Stores the box size\r\n * @returns The physics imposter\r\n */\r\n public getBoxSizeToRef(result: Vector3): PhysicsImpostor {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this, result);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the radius of the physics imposter\r\n * @returns Radius of the physics imposter\r\n */\r\n public getRadius(): number {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getRadius(this) : 0;\r\n }\r\n\r\n /**\r\n * Sync a bone with this impostor\r\n * @param bone The bone to sync to the impostor.\r\n * @param boneMesh The mesh that the bone is influencing.\r\n * @param jointPivot The pivot of the joint / bone in local space.\r\n * @param distToJoint Optional distance from the impostor to the joint.\r\n * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.\r\n */\r\n public syncBoneWithImpostor(bone: Bone, boneMesh: AbstractMesh, jointPivot: Vector3, distToJoint?: number, adjustRotation?: Quaternion) {\r\n const tempVec = PhysicsImpostor._TmpVecs[0];\r\n const mesh = <AbstractMesh>this.object;\r\n\r\n if (mesh.rotationQuaternion) {\r\n if (adjustRotation) {\r\n const tempQuat = PhysicsImpostor._TmpQuat;\r\n mesh.rotationQuaternion.multiplyToRef(adjustRotation, tempQuat);\r\n bone.setRotationQuaternion(tempQuat, Space.WORLD, boneMesh);\r\n } else {\r\n bone.setRotationQuaternion(mesh.rotationQuaternion, Space.WORLD, boneMesh);\r\n }\r\n }\r\n\r\n tempVec.x = 0;\r\n tempVec.y = 0;\r\n tempVec.z = 0;\r\n\r\n if (jointPivot) {\r\n tempVec.x = jointPivot.x;\r\n tempVec.y = jointPivot.y;\r\n tempVec.z = jointPivot.z;\r\n\r\n bone.getDirectionToRef(tempVec, boneMesh, tempVec);\r\n\r\n if (distToJoint === undefined || distToJoint === null) {\r\n distToJoint = jointPivot.length();\r\n }\r\n\r\n tempVec.x *= distToJoint;\r\n tempVec.y *= distToJoint;\r\n tempVec.z *= distToJoint;\r\n }\r\n\r\n if (bone.getParent()) {\r\n tempVec.addInPlace(mesh.getAbsolutePosition());\r\n bone.setAbsolutePosition(tempVec, boneMesh);\r\n } else {\r\n boneMesh.setAbsolutePosition(mesh.getAbsolutePosition());\r\n boneMesh.position.x -= tempVec.x;\r\n boneMesh.position.y -= tempVec.y;\r\n boneMesh.position.z -= tempVec.z;\r\n }\r\n }\r\n\r\n /**\r\n * Sync impostor to a bone\r\n * @param bone The bone that the impostor will be synced to.\r\n * @param boneMesh The mesh that the bone is influencing.\r\n * @param jointPivot The pivot of the joint / bone in local space.\r\n * @param distToJoint Optional distance from the impostor to the joint.\r\n * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.\r\n * @param boneAxis Optional vector3 axis the bone is aligned with\r\n */\r\n public syncImpostorWithBone(bone: Bone, boneMesh: AbstractMesh, jointPivot: Vector3, distToJoint?: number, adjustRotation?: Quaternion, boneAxis?: Vector3) {\r\n const mesh = <AbstractMesh>this.object;\r\n\r\n if (mesh.rotationQuaternion) {\r\n if (adjustRotation) {\r\n const tempQuat = PhysicsImpostor._TmpQuat;\r\n bone.getRotationQuaternionToRef(Space.WORLD, boneMesh, tempQuat);\r\n tempQuat.multiplyToRef(adjustRotation, mesh.rotationQuaternion);\r\n } else {\r\n bone.getRotationQuaternionToRef(Space.WORLD, boneMesh, mesh.rotationQuaternion);\r\n }\r\n }\r\n\r\n const pos = PhysicsImpostor._TmpVecs[0];\r\n const boneDir = PhysicsImpostor._TmpVecs[1];\r\n\r\n if (!boneAxis) {\r\n boneAxis = PhysicsImpostor._TmpVecs[2];\r\n boneAxis.x = 0;\r\n boneAxis.y = 1;\r\n boneAxis.z = 0;\r\n }\r\n\r\n bone.getDirectionToRef(boneAxis, boneMesh, boneDir);\r\n bone.getAbsolutePositionToRef(boneMesh, pos);\r\n\r\n if ((distToJoint === undefined || distToJoint === null) && jointPivot) {\r\n distToJoint = jointPivot.length();\r\n }\r\n\r\n if (distToJoint !== undefined && distToJoint !== null) {\r\n pos.x += boneDir.x * distToJoint;\r\n pos.y += boneDir.y * distToJoint;\r\n pos.z += boneDir.z * distToJoint;\r\n }\r\n\r\n mesh.setAbsolutePosition(pos);\r\n }\r\n\r\n //Impostor types\r\n /**\r\n * No-Imposter type\r\n */\r\n public static NoImpostor = 0;\r\n /**\r\n * Sphere-Imposter type\r\n */\r\n public static SphereImpostor = 1;\r\n /**\r\n * Box-Imposter type\r\n */\r\n public static BoxImpostor = 2;\r\n /**\r\n * Plane-Imposter type\r\n */\r\n public static PlaneImpostor = 3;\r\n /**\r\n * Mesh-imposter type (Only available to objects with vertices data)\r\n */\r\n public static MeshImpostor = 4;\r\n /**\r\n * Capsule-Impostor type (Ammo.js plugin only)\r\n */\r\n public static CapsuleImpostor = 6;\r\n /**\r\n * Cylinder-Imposter type\r\n */\r\n public static CylinderImpostor = 7;\r\n /**\r\n * Particle-Imposter type\r\n */\r\n public static ParticleImpostor = 8;\r\n /**\r\n * Heightmap-Imposter type\r\n */\r\n public static HeightmapImpostor = 9;\r\n /**\r\n * ConvexHull-Impostor type (Ammo.js plugin only)\r\n */\r\n public static ConvexHullImpostor = 10;\r\n /**\r\n * Custom-Imposter type (Ammo.js plugin only)\r\n */\r\n public static CustomImpostor = 100;\r\n /**\r\n * Rope-Imposter type\r\n */\r\n public static RopeImpostor = 101;\r\n /**\r\n * Cloth-Imposter type\r\n */\r\n public static ClothImpostor = 102;\r\n /**\r\n * Softbody-Imposter type\r\n */\r\n public static SoftbodyImpostor = 103;\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsImpostor.js","sourceRoot":"","sources":["../../../../../dev/core/src/Phys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ACW,gCAAgB,GAAG,GAAG,AAAN,CAAO","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-return */\r\nimport type { Nullable, IndicesArray, FloatArray } from \"../../types\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { BuildArray } from \"../../Misc/arrayTools\";\r\nimport type { Matrix } from \"../../Maths/math.vector\";\r\nimport { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Bone } from \"../../Bones/bone\";\r\nimport type { BoundingInfo } from \"../../Culling/boundingInfo\";\r\nimport type { PhysicsEngine as PhysicsEngineV1 } from \"./physicsEngine\";\r\n\r\nimport type { PhysicsJointData } from \"./physicsJoint\";\r\nimport { PhysicsJoint } from \"./physicsJoint\";\r\nimport { Space } from \"../../Maths/math.axis\";\r\n\r\n/**\r\n * The interface for the physics imposter parameters\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsImpostorParameters {\r\n /**\r\n * The mass of the physics imposter\r\n */\r\n mass: number;\r\n /**\r\n * The friction of the physics imposter\r\n */\r\n friction?: number;\r\n /**\r\n * The coefficient of restitution of the physics imposter\r\n */\r\n restitution?: number;\r\n /**\r\n * The native options of the physics imposter\r\n */\r\n nativeOptions?: any;\r\n /**\r\n * Specifies if the parent should be ignored\r\n */\r\n ignoreParent?: boolean;\r\n /**\r\n * Specifies if bi-directional transformations should be disabled\r\n */\r\n disableBidirectionalTransformation?: boolean;\r\n /**\r\n * The pressure inside the physics imposter, soft object only\r\n */\r\n pressure?: number;\r\n /**\r\n * The stiffness the physics imposter, soft object only\r\n */\r\n stiffness?: number;\r\n /**\r\n * The number of iterations used in maintaining consistent vertex velocities, soft object only\r\n */\r\n velocityIterations?: number;\r\n /**\r\n * The number of iterations used in maintaining consistent vertex positions, soft object only\r\n */\r\n positionIterations?: number;\r\n /**\r\n * The number used to fix points on a cloth (0, 1, 2, 4, 8) or rope (0, 1, 2) only\r\n * 0 None, 1, back left or top, 2, back right or bottom, 4, front left, 8, front right\r\n * Add to fix multiple points\r\n */\r\n fixedPoints?: number;\r\n /**\r\n * The collision margin around a soft object\r\n */\r\n margin?: number;\r\n /**\r\n * The collision margin around a soft object\r\n */\r\n damping?: number;\r\n /**\r\n * The path for a rope based on an extrusion\r\n */\r\n path?: any;\r\n /**\r\n * The shape of an extrusion used for a rope based on an extrusion\r\n */\r\n shape?: any;\r\n}\r\n\r\n/**\r\n * Interface for a physics-enabled object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface IPhysicsEnabledObject {\r\n /**\r\n * The position of the physics-enabled object\r\n */\r\n position: Vector3;\r\n /**\r\n * The rotation of the physics-enabled object\r\n */\r\n rotationQuaternion: Nullable<Quaternion>;\r\n /**\r\n * The scale of the physics-enabled object\r\n */\r\n scaling: Vector3;\r\n /**\r\n * The rotation of the physics-enabled object\r\n */\r\n rotation?: Vector3;\r\n /**\r\n * The parent of the physics-enabled object\r\n */\r\n parent?: any;\r\n /**\r\n * The bounding info of the physics-enabled object\r\n * @returns The bounding info of the physics-enabled object\r\n */\r\n getBoundingInfo(): BoundingInfo;\r\n /**\r\n * Computes the world matrix\r\n * @param force Specifies if the world matrix should be computed by force\r\n * @returns A world matrix\r\n */\r\n computeWorldMatrix(force: boolean): Matrix;\r\n /**\r\n * Gets the world matrix\r\n * @returns A world matrix\r\n */\r\n getWorldMatrix?(): Matrix;\r\n /**\r\n * Gets the child meshes\r\n * @param directDescendantsOnly Specifies if only direct-descendants should be obtained\r\n * @returns An array of abstract meshes\r\n */\r\n getChildMeshes?(directDescendantsOnly?: boolean): Array<AbstractMesh>;\r\n /**\r\n * Gets the vertex data\r\n * @param kind The type of vertex data\r\n * @returns A nullable array of numbers, or a float32 array\r\n */\r\n getVerticesData(kind: string): Nullable<FloatArray>;\r\n /**\r\n * Gets the indices from the mesh\r\n * @returns A nullable array of index arrays\r\n */\r\n getIndices?(): Nullable<IndicesArray>;\r\n /**\r\n * Gets the scene from the mesh\r\n * @returns the indices array or null\r\n */\r\n getScene?(): Scene;\r\n /**\r\n * Gets the absolute position from the mesh\r\n * @returns the absolute position\r\n */\r\n getAbsolutePosition(): Vector3;\r\n /**\r\n * Gets the absolute pivot point from the mesh\r\n * @returns the absolute pivot point\r\n */\r\n getAbsolutePivotPoint(): Vector3;\r\n /**\r\n * Rotates the mesh\r\n * @param axis The axis of rotation\r\n * @param amount The amount of rotation\r\n * @param space The space of the rotation\r\n * @returns The rotation transform node\r\n */\r\n rotate(axis: Vector3, amount: number, space?: Space): TransformNode;\r\n /**\r\n * Translates the mesh\r\n * @param axis The axis of translation\r\n * @param distance The distance of translation\r\n * @param space The space of the translation\r\n * @returns The transform node\r\n */\r\n translate(axis: Vector3, distance: number, space?: Space): TransformNode;\r\n /**\r\n * Sets the absolute position of the mesh\r\n * @param absolutePosition The absolute position of the mesh\r\n * @returns The transform node\r\n */\r\n setAbsolutePosition(absolutePosition: Vector3): TransformNode;\r\n /**\r\n * Gets the class name of the mesh\r\n * @returns The class name\r\n */\r\n getClassName(): string;\r\n}\r\n\r\nMesh._PhysicsImpostorParser = function (scene: Scene, physicObject: IPhysicsEnabledObject, jsonObject: any): PhysicsImpostor {\r\n return new PhysicsImpostor(\r\n physicObject,\r\n jsonObject.physicsImpostor,\r\n {\r\n mass: jsonObject.physicsMass,\r\n friction: jsonObject.physicsFriction,\r\n restitution: jsonObject.physicsRestitution,\r\n },\r\n scene\r\n );\r\n};\r\n\r\n/**\r\n * Represents a physics imposter\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsImpostor {\r\n /**\r\n * The default object size of the imposter\r\n */\r\n public static DEFAULT_OBJECT_SIZE: Vector3 = new Vector3(1, 1, 1);\r\n\r\n /**\r\n * The identity quaternion of the imposter\r\n */\r\n public static IDENTITY_QUATERNION = Quaternion.Identity();\r\n\r\n /** @internal */\r\n public _pluginData: any = {};\r\n\r\n private _physicsEngine: Nullable<PhysicsEngineV1>;\r\n //The native cannon/oimo/energy physics body object.\r\n private _physicsBody: any;\r\n private _bodyUpdateRequired: boolean = false;\r\n\r\n private _onBeforePhysicsStepCallbacks = new Array<(impostor: PhysicsImpostor) => void>();\r\n private _onAfterPhysicsStepCallbacks = new Array<(impostor: PhysicsImpostor) => void>();\r\n /** @internal */\r\n public _onPhysicsCollideCallbacks: Array<{\r\n callback: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor, point: Nullable<Vector3>, distance: number, impulse: number, normal: Nullable<Vector3>) => void;\r\n otherImpostors: Array<PhysicsImpostor>;\r\n }> = [];\r\n\r\n private _deltaPosition: Vector3 = Vector3.Zero();\r\n private _deltaRotation: Quaternion;\r\n private _deltaRotationConjugated: Quaternion;\r\n\r\n /** @internal */\r\n public _isFromLine: boolean;\r\n\r\n //If set, this is this impostor's parent\r\n private _parent: Nullable<PhysicsImpostor>;\r\n\r\n private _isDisposed = false;\r\n\r\n private static _TmpVecs: Vector3[] = BuildArray(3, Vector3.Zero);\r\n private static _TmpQuat: Quaternion = Quaternion.Identity();\r\n\r\n /**\r\n * Specifies if the physics imposter is disposed\r\n */\r\n get isDisposed(): boolean {\r\n return this._isDisposed;\r\n }\r\n\r\n /**\r\n * Gets the mass of the physics imposter\r\n */\r\n get mass(): number {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyMass(this) : 0;\r\n }\r\n\r\n set mass(value: number) {\r\n this.setMass(value);\r\n }\r\n\r\n /**\r\n * Gets the coefficient of friction\r\n */\r\n get friction(): number {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyFriction(this) : 0;\r\n }\r\n\r\n /**\r\n * Sets the coefficient of friction\r\n */\r\n set friction(value: number) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._physicsEngine.getPhysicsPlugin().setBodyFriction(this, value);\r\n }\r\n\r\n /**\r\n * Gets the coefficient of restitution\r\n */\r\n get restitution(): number {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this) : 0;\r\n }\r\n\r\n /**\r\n * Sets the coefficient of restitution\r\n */\r\n set restitution(value: number) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this, value);\r\n }\r\n\r\n /**\r\n * Gets the pressure of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get pressure(): number {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyPressure) {\r\n return 0;\r\n }\r\n return plugin.getBodyPressure!(this);\r\n }\r\n\r\n /**\r\n * Sets the pressure of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set pressure(value: number) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyPressure) {\r\n return;\r\n }\r\n plugin.setBodyPressure(this, value);\r\n }\r\n\r\n /**\r\n * Gets the stiffness of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get stiffness(): number {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.getBodyStiffness) {\r\n return 0;\r\n }\r\n return plugin.getBodyStiffness(this);\r\n }\r\n\r\n /**\r\n * Sets the stiffness of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set stiffness(value: number) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyStiffness) {\r\n return;\r\n }\r\n plugin.setBodyStiffness(this, value);\r\n }\r\n\r\n /**\r\n * Gets the velocityIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get velocityIterations(): number {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.getBodyVelocityIterations) {\r\n return 0;\r\n }\r\n return plugin.getBodyVelocityIterations(this);\r\n }\r\n\r\n /**\r\n * Sets the velocityIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set velocityIterations(value: number) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyVelocityIterations) {\r\n return;\r\n }\r\n plugin.setBodyVelocityIterations(this, value);\r\n }\r\n\r\n /**\r\n * Gets the positionIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n get positionIterations(): number {\r\n if (!this._physicsEngine) {\r\n return 0;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.getBodyPositionIterations) {\r\n return 0;\r\n }\r\n return plugin.getBodyPositionIterations(this);\r\n }\r\n\r\n /**\r\n * Sets the positionIterations of a soft body; only supported by the AmmoJSPlugin\r\n */\r\n set positionIterations(value: number) {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.setBodyPositionIterations) {\r\n return;\r\n }\r\n plugin.setBodyPositionIterations(this, value);\r\n }\r\n\r\n /**\r\n * The unique id of the physics imposter\r\n * set by the physics engine when adding this impostor to the array\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * @internal\r\n */\r\n public soft: boolean = false;\r\n\r\n /**\r\n * @internal\r\n */\r\n public segments: number = 0;\r\n\r\n private _joints: Array<{\r\n joint: PhysicsJoint;\r\n otherImpostor: PhysicsImpostor;\r\n }>;\r\n\r\n /**\r\n * Initializes the physics imposter\r\n * @param object The physics-enabled object used as the physics imposter\r\n * @param type The type of the physics imposter. Types are available as static members of this class.\r\n * @param _options The options for the physics imposter\r\n * @param _scene The Babylon scene\r\n */\r\n constructor(\r\n /**\r\n * The physics-enabled object used as the physics imposter\r\n */\r\n public object: IPhysicsEnabledObject,\r\n /**\r\n * The type of the physics imposter\r\n */\r\n public type: number,\r\n private _options: PhysicsImpostorParameters = { mass: 0 },\r\n private _scene?: Scene\r\n ) {\r\n //sanity check!\r\n if (!this.object) {\r\n Logger.Error(\"No object was provided. A physics object is obligatory\");\r\n return;\r\n }\r\n if (this.object.parent && _options.mass !== 0) {\r\n Logger.Warn(\"A physics impostor has been created for an object which has a parent. Babylon physics currently works in local space so unexpected issues may occur.\");\r\n }\r\n\r\n // Legacy support for old syntax.\r\n if (!this._scene && object.getScene) {\r\n this._scene = object.getScene();\r\n }\r\n\r\n if (!this._scene) {\r\n return;\r\n }\r\n\r\n if (this.type > 100) {\r\n this.soft = true;\r\n }\r\n\r\n this._physicsEngine = this._scene.getPhysicsEngine() as any;\r\n if (!this._physicsEngine) {\r\n Logger.Error(\"Physics not enabled. Please use scene.enablePhysics(...) before creating impostors.\");\r\n } else {\r\n //set the object's quaternion, if not set\r\n if (!this.object.rotationQuaternion) {\r\n if (this.object.rotation) {\r\n this.object.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.object.rotation.y, this.object.rotation.x, this.object.rotation.z);\r\n } else {\r\n this.object.rotationQuaternion = new Quaternion();\r\n }\r\n }\r\n //default options params\r\n this._options.mass = _options.mass === void 0 ? 0 : _options.mass;\r\n this._options.friction = _options.friction === void 0 ? 0.2 : _options.friction;\r\n this._options.restitution = _options.restitution === void 0 ? 0.2 : _options.restitution;\r\n if (this.soft) {\r\n //softbody mass must be above 0;\r\n this._options.mass = this._options.mass > 0 ? this._options.mass : 1;\r\n this._options.pressure = _options.pressure === void 0 ? 200 : _options.pressure;\r\n this._options.stiffness = _options.stiffness === void 0 ? 1 : _options.stiffness;\r\n this._options.velocityIterations = _options.velocityIterations === void 0 ? 20 : _options.velocityIterations;\r\n this._options.positionIterations = _options.positionIterations === void 0 ? 20 : _options.positionIterations;\r\n this._options.fixedPoints = _options.fixedPoints === void 0 ? 0 : _options.fixedPoints;\r\n this._options.margin = _options.margin === void 0 ? 0 : _options.margin;\r\n this._options.damping = _options.damping === void 0 ? 0 : _options.damping;\r\n this._options.path = _options.path === void 0 ? null : _options.path;\r\n this._options.shape = _options.shape === void 0 ? null : _options.shape;\r\n }\r\n this._joints = [];\r\n //If the mesh has a parent, don't initialize the physicsBody. Instead wait for the parent to do that.\r\n if (!this.object.parent || this._options.ignoreParent) {\r\n this._init();\r\n } else if (this.object.parent.physicsImpostor) {\r\n Logger.Warn(\"You must affect impostors to children before affecting impostor to parent.\");\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * This function will completely initialize this impostor.\r\n * It will create a new body - but only if this mesh has no parent.\r\n * If it has, this impostor will not be used other than to define the impostor\r\n * of the child mesh.\r\n * @internal\r\n */\r\n public _init() {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n\r\n this._physicsEngine.removeImpostor(this);\r\n this.physicsBody = null;\r\n this._parent = this._parent || this._getPhysicsParent();\r\n if (!this._isDisposed && (!this.parent || this._options.ignoreParent)) {\r\n this._physicsEngine.addImpostor(this);\r\n }\r\n }\r\n\r\n private _getPhysicsParent(): Nullable<PhysicsImpostor> {\r\n if (this.object.parent instanceof AbstractMesh) {\r\n const parentMesh: AbstractMesh = this.object.parent;\r\n return parentMesh.physicsImpostor;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Should a new body be generated.\r\n * @returns boolean specifying if body initialization is required\r\n */\r\n public isBodyInitRequired(): boolean {\r\n return this._bodyUpdateRequired || (!this._physicsBody && (!this._parent || !!this._options.ignoreParent));\r\n }\r\n\r\n /**\r\n * Sets the updated scaling\r\n */\r\n public setScalingUpdated() {\r\n this.forceUpdate();\r\n }\r\n\r\n /**\r\n * Force a regeneration of this or the parent's impostor's body.\r\n * Use with caution - This will remove all previously-instantiated joints.\r\n */\r\n public forceUpdate() {\r\n this._init();\r\n if (this.parent && !this._options.ignoreParent) {\r\n this.parent.forceUpdate();\r\n }\r\n }\r\n\r\n /*public get mesh(): AbstractMesh {\r\n return this._mesh;\r\n }*/\r\n\r\n /**\r\n * Gets the body that holds this impostor. Either its own, or its parent.\r\n */\r\n public get physicsBody(): any {\r\n return this._parent && !this._options.ignoreParent ? this._parent.physicsBody : this._physicsBody;\r\n }\r\n\r\n /**\r\n * Get the parent of the physics imposter\r\n * @returns Physics imposter or null\r\n */\r\n public get parent(): Nullable<PhysicsImpostor> {\r\n return !this._options.ignoreParent && this._parent ? this._parent : null;\r\n }\r\n\r\n /**\r\n * Sets the parent of the physics imposter\r\n */\r\n public set parent(value: Nullable<PhysicsImpostor>) {\r\n this._parent = value;\r\n }\r\n\r\n /**\r\n * Set the physics body. Used mainly by the physics engine/plugin\r\n */\r\n public set physicsBody(physicsBody: any) {\r\n if (this._physicsBody && this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this);\r\n }\r\n this._physicsBody = physicsBody;\r\n this.resetUpdateFlags();\r\n }\r\n\r\n /**\r\n * Resets the update flags\r\n */\r\n public resetUpdateFlags() {\r\n this._bodyUpdateRequired = false;\r\n }\r\n\r\n /**\r\n * Gets the object extents\r\n * @returns the object extents\r\n */\r\n public getObjectExtents(): Vector3 {\r\n if (this.object.getBoundingInfo) {\r\n const q = this.object.rotationQuaternion;\r\n const scaling = this.object.scaling.clone();\r\n //reset rotation\r\n this.object.rotationQuaternion = PhysicsImpostor.IDENTITY_QUATERNION;\r\n //calculate the world matrix with no rotation\r\n const worldMatrix = this.object.computeWorldMatrix && this.object.computeWorldMatrix(true);\r\n if (worldMatrix) {\r\n worldMatrix.decompose(scaling, undefined, undefined);\r\n }\r\n const boundingInfo = this.object.getBoundingInfo();\r\n // get the global scaling of the object\r\n const size = boundingInfo.boundingBox.extendSize.scale(2).multiplyInPlace(scaling);\r\n size.x = Math.abs(size.x);\r\n size.y = Math.abs(size.y);\r\n size.z = Math.abs(size.z);\r\n //bring back the rotation\r\n this.object.rotationQuaternion = q;\r\n //calculate the world matrix with the new rotation\r\n if (this.object.computeWorldMatrix) {\r\n this.object.computeWorldMatrix(true);\r\n }\r\n return size;\r\n } else {\r\n return PhysicsImpostor.DEFAULT_OBJECT_SIZE;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the object center\r\n * @returns The object center\r\n */\r\n public getObjectCenter(): Vector3 {\r\n if (this.object.getBoundingInfo) {\r\n const boundingInfo = this.object.getBoundingInfo();\r\n return boundingInfo.boundingBox.centerWorld;\r\n } else {\r\n return this.object.position;\r\n }\r\n }\r\n\r\n /**\r\n * Get a specific parameter from the options parameters\r\n * @param paramName The object parameter name\r\n * @returns The object parameter\r\n */\r\n public getParam(paramName: string): any {\r\n return (<any>this._options)[paramName];\r\n }\r\n\r\n /**\r\n * Sets a specific parameter in the options given to the physics plugin\r\n * @param paramName The parameter name\r\n * @param value The value of the parameter\r\n */\r\n public setParam(paramName: string, value: number) {\r\n (<any>this._options)[paramName] = value;\r\n this._bodyUpdateRequired = true;\r\n }\r\n\r\n /**\r\n * Specifically change the body's mass. Won't recreate the physics body object\r\n * @param mass The mass of the physics imposter\r\n */\r\n public setMass(mass: number) {\r\n if (this.getParam(\"mass\") !== mass) {\r\n this.setParam(\"mass\", mass);\r\n }\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().setBodyMass(this, mass);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the linear velocity\r\n * @returns linear velocity or null\r\n */\r\n public getLinearVelocity(): Nullable<Vector3> {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this) : Vector3.Zero();\r\n }\r\n\r\n /**\r\n * Sets the linear velocity\r\n * @param velocity linear velocity or null\r\n */\r\n public setLinearVelocity(velocity: Nullable<Vector3>) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this, velocity);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the angular velocity\r\n * @returns angular velocity or null\r\n */\r\n public getAngularVelocity(): Nullable<Vector3> {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this) : Vector3.Zero();\r\n }\r\n\r\n /**\r\n * Sets the angular velocity\r\n * @param velocity The velocity or null\r\n */\r\n public setAngularVelocity(velocity: Nullable<Vector3>) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this, velocity);\r\n }\r\n }\r\n\r\n /**\r\n * Execute a function with the physics plugin native code\r\n * Provide a function the will have two variables - the world object and the physics body object\r\n * @param func The function to execute with the physics plugin native code\r\n */\r\n public executeNativeFunction(func: (world: any, physicsBody: any) => void) {\r\n if (this._physicsEngine) {\r\n func(this._physicsEngine.getPhysicsPlugin().world, this.physicsBody);\r\n }\r\n }\r\n\r\n /**\r\n * Register a function that will be executed before the physics world is stepping forward\r\n * @param func The function to execute before the physics world is stepped forward\r\n */\r\n public registerBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void {\r\n this._onBeforePhysicsStepCallbacks.push(func);\r\n }\r\n\r\n /**\r\n * Unregister a function that will be executed before the physics world is stepping forward\r\n * @param func The function to execute before the physics world is stepped forward\r\n */\r\n public unregisterBeforePhysicsStep(func: (impostor: PhysicsImpostor) => void): void {\r\n const index = this._onBeforePhysicsStepCallbacks.indexOf(func);\r\n\r\n if (index > -1) {\r\n this._onBeforePhysicsStepCallbacks.splice(index, 1);\r\n } else {\r\n Logger.Warn(\"Function to remove was not found\");\r\n }\r\n }\r\n\r\n /**\r\n * Register a function that will be executed after the physics step\r\n * @param func The function to execute after physics step\r\n */\r\n public registerAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void {\r\n this._onAfterPhysicsStepCallbacks.push(func);\r\n }\r\n\r\n /**\r\n * Unregisters a function that will be executed after the physics step\r\n * @param func The function to execute after physics step\r\n */\r\n public unregisterAfterPhysicsStep(func: (impostor: PhysicsImpostor) => void): void {\r\n const index = this._onAfterPhysicsStepCallbacks.indexOf(func);\r\n\r\n if (index > -1) {\r\n this._onAfterPhysicsStepCallbacks.splice(index, 1);\r\n } else {\r\n Logger.Warn(\"Function to remove was not found\");\r\n }\r\n }\r\n\r\n /**\r\n * register a function that will be executed when this impostor collides against a different body\r\n * @param collideAgainst Physics imposter, or array of physics imposters to collide against\r\n * @param func Callback that is executed on collision\r\n */\r\n public registerOnPhysicsCollide(\r\n collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>,\r\n func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor, point: Nullable<Vector3>) => void\r\n ): void {\r\n const collidedAgainstList: Array<PhysicsImpostor> = collideAgainst instanceof Array ? collideAgainst : [collideAgainst];\r\n this._onPhysicsCollideCallbacks.push({ callback: func, otherImpostors: collidedAgainstList });\r\n }\r\n\r\n /**\r\n * Unregisters the physics imposter's collision callback\r\n * @param collideAgainst The physics object to collide against\r\n * @param func Callback to execute on collision\r\n */\r\n public unregisterOnPhysicsCollide(\r\n collideAgainst: PhysicsImpostor | Array<PhysicsImpostor>,\r\n func: (collider: PhysicsImpostor, collidedAgainst: PhysicsImpostor | Array<PhysicsImpostor>, point: Nullable<Vector3>) => void\r\n ): void {\r\n const collidedAgainstList: Array<PhysicsImpostor> = collideAgainst instanceof Array ? collideAgainst : [collideAgainst];\r\n let index = -1;\r\n const found = this._onPhysicsCollideCallbacks.some((cbDef, idx) => {\r\n if (cbDef.callback === func && cbDef.otherImpostors.length === collidedAgainstList.length) {\r\n // chcek the arrays match\r\n const sameList = cbDef.otherImpostors.every((impostor) => {\r\n return collidedAgainstList.indexOf(impostor) > -1;\r\n });\r\n if (sameList) {\r\n index = idx;\r\n }\r\n return sameList;\r\n }\r\n return false;\r\n });\r\n\r\n if (found) {\r\n this._onPhysicsCollideCallbacks.splice(index, 1);\r\n } else {\r\n Logger.Warn(\"Function to remove was not found\");\r\n }\r\n }\r\n\r\n //temp variables for parent rotation calculations\r\n //private _mats: Array<Matrix> = [new Matrix(), new Matrix()];\r\n private _tmpQuat: Quaternion = new Quaternion();\r\n private _tmpQuat2: Quaternion = new Quaternion();\r\n\r\n /**\r\n * Get the parent rotation\r\n * @returns The parent rotation\r\n */\r\n public getParentsRotation(): Quaternion {\r\n let parent = this.object.parent;\r\n this._tmpQuat.copyFromFloats(0, 0, 0, 1);\r\n while (parent) {\r\n if (parent.rotationQuaternion) {\r\n this._tmpQuat2.copyFrom(parent.rotationQuaternion);\r\n } else {\r\n Quaternion.RotationYawPitchRollToRef(parent.rotation.y, parent.rotation.x, parent.rotation.z, this._tmpQuat2);\r\n }\r\n this._tmpQuat.multiplyToRef(this._tmpQuat2, this._tmpQuat);\r\n parent = parent.parent;\r\n }\r\n return this._tmpQuat;\r\n }\r\n\r\n /**\r\n * this function is executed by the physics engine.\r\n */\r\n public beforeStep = () => {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n\r\n this.object.translate(this._deltaPosition, -1);\r\n if (this._deltaRotationConjugated && this.object.rotationQuaternion) {\r\n this.object.rotationQuaternion.multiplyToRef(this._deltaRotationConjugated, this.object.rotationQuaternion);\r\n }\r\n this.object.computeWorldMatrix(false);\r\n if (this.object.parent && this.object.rotationQuaternion) {\r\n this.getParentsRotation();\r\n this._tmpQuat.multiplyToRef(this.object.rotationQuaternion, this._tmpQuat);\r\n } else {\r\n this._tmpQuat.copyFrom(this.object.rotationQuaternion || new Quaternion());\r\n }\r\n if (!this._options.disableBidirectionalTransformation) {\r\n if (this.object.rotationQuaternion) {\r\n this._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(this, /*bInfo.boundingBox.centerWorld*/ this.object.getAbsolutePosition(), this._tmpQuat);\r\n }\r\n }\r\n\r\n for (const func of this._onBeforePhysicsStepCallbacks) {\r\n func(this);\r\n }\r\n };\r\n\r\n /**\r\n * this function is executed by the physics engine\r\n */\r\n public afterStep = () => {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n\r\n for (const func of this._onAfterPhysicsStepCallbacks) {\r\n func(this);\r\n }\r\n\r\n this._physicsEngine.getPhysicsPlugin().setTransformationFromPhysicsBody(this);\r\n // object has now its world rotation. needs to be converted to local.\r\n if (this.object.parent && this.object.rotationQuaternion) {\r\n this.getParentsRotation();\r\n this._tmpQuat.conjugateInPlace();\r\n this._tmpQuat.multiplyToRef(this.object.rotationQuaternion, this.object.rotationQuaternion);\r\n }\r\n // take the position set and make it the absolute position of this object.\r\n this.object.setAbsolutePosition(this.object.position);\r\n if (this._deltaRotation) {\r\n if (this.object.rotationQuaternion) {\r\n this.object.rotationQuaternion.multiplyToRef(this._deltaRotation, this.object.rotationQuaternion);\r\n }\r\n this._deltaPosition.applyRotationQuaternionToRef(this._deltaRotation, PhysicsImpostor._TmpVecs[0]);\r\n this.object.translate(PhysicsImpostor._TmpVecs[0], 1);\r\n } else {\r\n this.object.translate(this._deltaPosition, 1);\r\n }\r\n this.object.computeWorldMatrix(true);\r\n };\r\n\r\n /**\r\n * Legacy collision detection event support\r\n */\r\n public onCollideEvent: Nullable<(collider: PhysicsImpostor, collidedWith: PhysicsImpostor) => void> = null;\r\n\r\n /**\r\n * define an onCollide function to call when this impostor collides against a different body\r\n * @param e collide event data\r\n */\r\n public onCollide = (e: { body: any; point: Nullable<Vector3>; distance: number; impulse: number; normal: Nullable<Vector3> }) => {\r\n if (!this._onPhysicsCollideCallbacks.length && !this.onCollideEvent) {\r\n return;\r\n }\r\n\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n const otherImpostor = this._physicsEngine.getImpostorWithPhysicsBody(e.body);\r\n if (otherImpostor) {\r\n // Legacy collision detection event support\r\n if (this.onCollideEvent) {\r\n this.onCollideEvent(this, otherImpostor);\r\n }\r\n const callbacks = this._onPhysicsCollideCallbacks.filter((obj) => {\r\n return obj.otherImpostors.indexOf(<PhysicsImpostor>otherImpostor) !== -1;\r\n });\r\n\r\n for (const obj of callbacks) {\r\n obj.callback(this, <PhysicsImpostor>otherImpostor, e.point, e.distance, e.impulse, e.normal);\r\n }\r\n }\r\n };\r\n\r\n /**\r\n * Apply a force\r\n * @param force The force to apply\r\n * @param contactPoint The contact point for the force\r\n * @returns The physics imposter\r\n */\r\n public applyForce(force: Vector3, contactPoint: Vector3): PhysicsImpostor {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().applyForce(this, force, contactPoint);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Apply an impulse\r\n * @param force The impulse force\r\n * @param contactPoint The contact point for the impulse force\r\n * @returns The physics imposter\r\n */\r\n public applyImpulse(force: Vector3, contactPoint: Vector3): PhysicsImpostor {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().applyImpulse(this, force, contactPoint);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * A help function to create a joint\r\n * @param otherImpostor A physics imposter used to create a joint\r\n * @param jointType The type of joint\r\n * @param jointData The data for the joint\r\n * @returns The physics imposter\r\n */\r\n public createJoint(otherImpostor: PhysicsImpostor, jointType: number, jointData: PhysicsJointData): PhysicsImpostor {\r\n const joint = new PhysicsJoint(jointType, jointData);\r\n this.addJoint(otherImpostor, joint);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Add a joint to this impostor with a different impostor\r\n * @param otherImpostor A physics imposter used to add a joint\r\n * @param joint The joint to add\r\n * @returns The physics imposter\r\n */\r\n public addJoint(otherImpostor: PhysicsImpostor, joint: PhysicsJoint): PhysicsImpostor {\r\n this._joints.push({\r\n otherImpostor: otherImpostor,\r\n joint: joint,\r\n });\r\n\r\n if (this._physicsEngine) {\r\n this._physicsEngine.addJoint(this, otherImpostor, joint);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Add an anchor to a cloth impostor\r\n * @param otherImpostor rigid impostor to anchor to\r\n * @param width ratio across width from 0 to 1\r\n * @param height ratio up height from 0 to 1\r\n * @param influence the elasticity between cloth impostor and anchor from 0, very stretchy to 1, little stretch\r\n * @param noCollisionBetweenLinkedBodies when true collisions between cloth impostor and anchor are ignored; default false\r\n * @returns impostor the soft imposter\r\n */\r\n public addAnchor(otherImpostor: PhysicsImpostor, width: number, height: number, influence: number, noCollisionBetweenLinkedBodies: boolean): PhysicsImpostor {\r\n if (!this._physicsEngine) {\r\n return this;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.appendAnchor) {\r\n return this;\r\n }\r\n if (this._physicsEngine) {\r\n plugin.appendAnchor(this, otherImpostor, width, height, influence, noCollisionBetweenLinkedBodies);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Add a hook to a rope impostor\r\n * @param otherImpostor rigid impostor to anchor to\r\n * @param length ratio across rope from 0 to 1\r\n * @param influence the elasticity between rope impostor and anchor from 0, very stretchy to 1, little stretch\r\n * @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false\r\n * @returns impostor the rope imposter\r\n */\r\n public addHook(otherImpostor: PhysicsImpostor, length: number, influence: number, noCollisionBetweenLinkedBodies: boolean): PhysicsImpostor {\r\n if (!this._physicsEngine) {\r\n return this;\r\n }\r\n const plugin = this._physicsEngine.getPhysicsPlugin();\r\n if (!plugin.appendAnchor) {\r\n return this;\r\n }\r\n if (this._physicsEngine) {\r\n plugin.appendHook!(this, otherImpostor, length, influence, noCollisionBetweenLinkedBodies);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Will keep this body still, in a sleep mode.\r\n * @returns the physics imposter\r\n */\r\n public sleep(): PhysicsImpostor {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().sleepBody(this);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Wake the body up.\r\n * @returns The physics imposter\r\n */\r\n public wakeUp(): PhysicsImpostor {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().wakeUpBody(this);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Clones the physics imposter\r\n * @param newObject The physics imposter clones to this physics-enabled object\r\n * @returns A nullable physics imposter\r\n */\r\n public clone(newObject: IPhysicsEnabledObject): Nullable<PhysicsImpostor> {\r\n if (!newObject) {\r\n return null;\r\n }\r\n return new PhysicsImpostor(newObject, this.type, this._options, this._scene);\r\n }\r\n\r\n /**\r\n * Disposes the physics imposter\r\n */\r\n public dispose(/*disposeChildren: boolean = true*/) {\r\n //no dispose if no physics engine is available.\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n\r\n for (const j of this._joints) {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.removeJoint(this, j.otherImpostor, j.joint);\r\n }\r\n }\r\n //dispose the physics body\r\n this._physicsEngine.removeImpostor(this);\r\n if (this.parent) {\r\n this.parent.forceUpdate();\r\n }\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /**\r\n * Sets the delta position\r\n * @param position The delta position amount\r\n */\r\n public setDeltaPosition(position: Vector3) {\r\n this._deltaPosition.copyFrom(position);\r\n }\r\n\r\n /**\r\n * Sets the delta rotation\r\n * @param rotation The delta rotation amount\r\n */\r\n public setDeltaRotation(rotation: Quaternion) {\r\n if (!this._deltaRotation) {\r\n this._deltaRotation = new Quaternion();\r\n }\r\n this._deltaRotation.copyFrom(rotation);\r\n this._deltaRotationConjugated = this._deltaRotation.conjugate();\r\n }\r\n\r\n /**\r\n * Gets the box size of the physics imposter and stores the result in the input parameter\r\n * @param result Stores the box size\r\n * @returns The physics imposter\r\n */\r\n public getBoxSizeToRef(result: Vector3): PhysicsImpostor {\r\n if (this._physicsEngine) {\r\n this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this, result);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the radius of the physics imposter\r\n * @returns Radius of the physics imposter\r\n */\r\n public getRadius(): number {\r\n return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getRadius(this) : 0;\r\n }\r\n\r\n /**\r\n * Sync a bone with this impostor\r\n * @param bone The bone to sync to the impostor.\r\n * @param boneMesh The mesh that the bone is influencing.\r\n * @param jointPivot The pivot of the joint / bone in local space.\r\n * @param distToJoint Optional distance from the impostor to the joint.\r\n * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.\r\n */\r\n public syncBoneWithImpostor(bone: Bone, boneMesh: AbstractMesh, jointPivot: Vector3, distToJoint?: number, adjustRotation?: Quaternion) {\r\n const tempVec = PhysicsImpostor._TmpVecs[0];\r\n const mesh = <AbstractMesh>this.object;\r\n\r\n if (mesh.rotationQuaternion) {\r\n if (adjustRotation) {\r\n const tempQuat = PhysicsImpostor._TmpQuat;\r\n mesh.rotationQuaternion.multiplyToRef(adjustRotation, tempQuat);\r\n bone.setRotationQuaternion(tempQuat, Space.WORLD, boneMesh);\r\n } else {\r\n bone.setRotationQuaternion(mesh.rotationQuaternion, Space.WORLD, boneMesh);\r\n }\r\n }\r\n\r\n tempVec.x = 0;\r\n tempVec.y = 0;\r\n tempVec.z = 0;\r\n\r\n if (jointPivot) {\r\n tempVec.x = jointPivot.x;\r\n tempVec.y = jointPivot.y;\r\n tempVec.z = jointPivot.z;\r\n\r\n bone.getDirectionToRef(tempVec, boneMesh, tempVec);\r\n\r\n if (distToJoint === undefined || distToJoint === null) {\r\n distToJoint = jointPivot.length();\r\n }\r\n\r\n tempVec.x *= distToJoint;\r\n tempVec.y *= distToJoint;\r\n tempVec.z *= distToJoint;\r\n }\r\n\r\n if (bone.getParent()) {\r\n tempVec.addInPlace(mesh.getAbsolutePosition());\r\n bone.setAbsolutePosition(tempVec, boneMesh);\r\n } else {\r\n boneMesh.setAbsolutePosition(mesh.getAbsolutePosition());\r\n boneMesh.position.x -= tempVec.x;\r\n boneMesh.position.y -= tempVec.y;\r\n boneMesh.position.z -= tempVec.z;\r\n }\r\n }\r\n\r\n /**\r\n * Sync impostor to a bone\r\n * @param bone The bone that the impostor will be synced to.\r\n * @param boneMesh The mesh that the bone is influencing.\r\n * @param jointPivot The pivot of the joint / bone in local space.\r\n * @param distToJoint Optional distance from the impostor to the joint.\r\n * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.\r\n * @param boneAxis Optional vector3 axis the bone is aligned with\r\n */\r\n public syncImpostorWithBone(bone: Bone, boneMesh: AbstractMesh, jointPivot: Vector3, distToJoint?: number, adjustRotation?: Quaternion, boneAxis?: Vector3) {\r\n const mesh = <AbstractMesh>this.object;\r\n\r\n if (mesh.rotationQuaternion) {\r\n if (adjustRotation) {\r\n const tempQuat = PhysicsImpostor._TmpQuat;\r\n bone.getRotationQuaternionToRef(Space.WORLD, boneMesh, tempQuat);\r\n tempQuat.multiplyToRef(adjustRotation, mesh.rotationQuaternion);\r\n } else {\r\n bone.getRotationQuaternionToRef(Space.WORLD, boneMesh, mesh.rotationQuaternion);\r\n }\r\n }\r\n\r\n const pos = PhysicsImpostor._TmpVecs[0];\r\n const boneDir = PhysicsImpostor._TmpVecs[1];\r\n\r\n if (!boneAxis) {\r\n boneAxis = PhysicsImpostor._TmpVecs[2];\r\n boneAxis.x = 0;\r\n boneAxis.y = 1;\r\n boneAxis.z = 0;\r\n }\r\n\r\n bone.getDirectionToRef(boneAxis, boneMesh, boneDir);\r\n bone.getAbsolutePositionToRef(boneMesh, pos);\r\n\r\n if ((distToJoint === undefined || distToJoint === null) && jointPivot) {\r\n distToJoint = jointPivot.length();\r\n }\r\n\r\n if (distToJoint !== undefined && distToJoint !== null) {\r\n pos.x += boneDir.x * distToJoint;\r\n pos.y += boneDir.y * distToJoint;\r\n pos.z += boneDir.z * distToJoint;\r\n }\r\n\r\n mesh.setAbsolutePosition(pos);\r\n }\r\n\r\n //Impostor types\r\n /**\r\n * No-Imposter type\r\n */\r\n public static NoImpostor = 0;\r\n /**\r\n * Sphere-Imposter type\r\n */\r\n public static SphereImpostor = 1;\r\n /**\r\n * Box-Imposter type\r\n */\r\n public static BoxImpostor = 2;\r\n /**\r\n * Plane-Imposter type\r\n */\r\n public static PlaneImpostor = 3;\r\n /**\r\n * Mesh-imposter type (Only available to objects with vertices data)\r\n */\r\n public static MeshImpostor = 4;\r\n /**\r\n * Capsule-Impostor type (Ammo.js plugin only)\r\n */\r\n public static CapsuleImpostor = 6;\r\n /**\r\n * Cylinder-Imposter type\r\n */\r\n public static CylinderImpostor = 7;\r\n /**\r\n * Particle-Imposter type\r\n */\r\n public static ParticleImpostor = 8;\r\n /**\r\n * Heightmap-Imposter type\r\n */\r\n public static HeightmapImpostor = 9;\r\n /**\r\n * ConvexHull-Impostor type (Ammo.js plugin only)\r\n */\r\n public static ConvexHullImpostor = 10;\r\n /**\r\n * Custom-Imposter type (Ammo.js plugin only)\r\n */\r\n public static CustomImpostor = 100;\r\n /**\r\n * Rope-Imposter type\r\n */\r\n public static RopeImpostor = 101;\r\n /**\r\n * Cloth-Imposter type\r\n */\r\n public static ClothImpostor = 102;\r\n /**\r\n * Softbody-Imposter type\r\n */\r\n public static SoftbodyImpostor = 103;\r\n}\r\n"]}
@@ -7,7 +7,7 @@ matrix[0][1],matrix[1][1],matrix[2][1],
7
7
  matrix[0][2],matrix[1][2],matrix[2][2]);}
8
8
  #endif
9
9
  vec2 getDataUV(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return vec2((x+0.5)/textureSize.x,(y+0.5)/textureSize.y);}
10
- #if SH_DEGREE>0
10
+ #if SH_DEGREE>0 || IS_COMPOUND
11
11
  ivec2 getDataUVint(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return ivec2(uint(x+0.5),uint(y+0.5));}
12
12
  #endif
13
13
  struct Splat {vec4 center;vec4 color;vec4 covA;vec4 covB;
@@ -20,14 +20,20 @@ uvec4 sh1;
20
20
  #if SH_DEGREE>2
21
21
  uvec4 sh2;
22
22
  #endif
23
+ #if IS_COMPOUND
24
+ uint partIndex;
25
+ #endif
23
26
  };float getSplatIndex(int localIndex)
24
27
  {float splatIndex;switch (localIndex)
25
28
  {case 0: splatIndex=splatIndex0.x; break;case 1: splatIndex=splatIndex0.y; break;case 2: splatIndex=splatIndex0.z; break;case 3: splatIndex=splatIndex0.w; break;case 4: splatIndex=splatIndex1.x; break;case 5: splatIndex=splatIndex1.y; break;case 6: splatIndex=splatIndex1.z; break;case 7: splatIndex=splatIndex1.w; break;case 8: splatIndex=splatIndex2.x; break;case 9: splatIndex=splatIndex2.y; break;case 10: splatIndex=splatIndex2.z; break;case 11: splatIndex=splatIndex2.w; break;case 12: splatIndex=splatIndex3.x; break;case 13: splatIndex=splatIndex3.y; break;case 14: splatIndex=splatIndex3.z; break;case 15: splatIndex=splatIndex3.w; break;}
26
29
  return splatIndex;}
27
30
  Splat readSplat(float splatIndex)
28
31
  {Splat splat;vec2 splatUV=getDataUV(splatIndex,dataTextureSize);splat.center=texture2D(centersTexture,splatUV);splat.color=texture2D(colorsTexture,splatUV);splat.covA=texture2D(covariancesATexture,splatUV)*splat.center.w;splat.covB=texture2D(covariancesBTexture,splatUV)*splat.center.w;
32
+ #if SH_DEGREE>0 || IS_COMPOUND
33
+ ivec2 splatUVint=getDataUVint(splatIndex,dataTextureSize);
34
+ #endif
29
35
  #if SH_DEGREE>0
30
- ivec2 splatUVint=getDataUVint(splatIndex,dataTextureSize);splat.sh0=texelFetch(shTexture0,splatUVint,0);
36
+ splat.sh0=texelFetch(shTexture0,splatUVint,0);
31
37
  #endif
32
38
  #if SH_DEGREE>1
33
39
  splat.sh1=texelFetch(shTexture1,splatUVint,0);
@@ -35,6 +41,9 @@ splat.sh1=texelFetch(shTexture1,splatUVint,0);
35
41
  #if SH_DEGREE>2
36
42
  splat.sh2=texelFetch(shTexture2,splatUVint,0);
37
43
  #endif
44
+ #if IS_COMPOUND
45
+ splat.partIndex=uint(texture2D(partIndicesTexture,splatUV).r*255.0+0.5);
46
+ #endif
38
47
  return splat;}
39
48
  #if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)
40
49
  vec3 computeColorFromSHDegree(vec3 dir,const vec3 sh[16])
@@ -112,7 +121,11 @@ float mid=(cov2d[0][0]+cov2d[1][1])/2.0;float radius=length(vec2((cov2d[0][0]-co
112
121
  vec2 diagonalVector=normalize(vec2(cov2d[0][1],lambda1-cov2d[0][0]));vec2 majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;vec2 minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2(diagonalVector.y,-diagonalVector.x);vec2 vCenter=vec2(pos2d);float scaleFactor=isOrtho ? 1.0 : pos2d.w;return vec4(
113
122
  vCenter
114
123
  + ((meshPos.x*majorAxis
115
- + meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,pos2d.zw);}`;
124
+ + meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,pos2d.zw);}
125
+ #if IS_COMPOUND
126
+ mat4 getPartWorld(uint partIndex) {return partWorld[partIndex];}
127
+ #endif
128
+ `;
116
129
  // Sideeffect
117
130
  if (!ShaderStore.IncludesShadersStore[name]) {
118
131
  ShaderStore.IncludesShadersStore[name] = shader;
@@ -1 +1 @@
1
- {"version":3,"file":"gaussianSplatting.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/gaussianSplatting.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kEA+GmD,CAAC;AACnE,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1C,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"gaussianSplatting\";\nconst shader = `#if !defined(WEBGL2) && !defined(WEBGPU) && !defined(NATIVE)\nmat3 transpose(mat3 matrix) {return mat3(matrix[0][0],matrix[1][0],matrix[2][0],\nmatrix[0][1],matrix[1][1],matrix[2][1],\nmatrix[0][2],matrix[1][2],matrix[2][2]);}\n#endif\nvec2 getDataUV(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return vec2((x+0.5)/textureSize.x,(y+0.5)/textureSize.y);}\n#if SH_DEGREE>0\nivec2 getDataUVint(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return ivec2(uint(x+0.5),uint(y+0.5));}\n#endif\nstruct Splat {vec4 center;vec4 color;vec4 covA;vec4 covB;\n#if SH_DEGREE>0\nuvec4 sh0; \n#endif\n#if SH_DEGREE>1\nuvec4 sh1;\n#endif\n#if SH_DEGREE>2\nuvec4 sh2;\n#endif\n};float getSplatIndex(int localIndex)\n{float splatIndex;switch (localIndex)\n{case 0: splatIndex=splatIndex0.x; break;case 1: splatIndex=splatIndex0.y; break;case 2: splatIndex=splatIndex0.z; break;case 3: splatIndex=splatIndex0.w; break;case 4: splatIndex=splatIndex1.x; break;case 5: splatIndex=splatIndex1.y; break;case 6: splatIndex=splatIndex1.z; break;case 7: splatIndex=splatIndex1.w; break;case 8: splatIndex=splatIndex2.x; break;case 9: splatIndex=splatIndex2.y; break;case 10: splatIndex=splatIndex2.z; break;case 11: splatIndex=splatIndex2.w; break;case 12: splatIndex=splatIndex3.x; break;case 13: splatIndex=splatIndex3.y; break;case 14: splatIndex=splatIndex3.z; break;case 15: splatIndex=splatIndex3.w; break;}\nreturn splatIndex;}\nSplat readSplat(float splatIndex)\n{Splat splat;vec2 splatUV=getDataUV(splatIndex,dataTextureSize);splat.center=texture2D(centersTexture,splatUV);splat.color=texture2D(colorsTexture,splatUV);splat.covA=texture2D(covariancesATexture,splatUV)*splat.center.w;splat.covB=texture2D(covariancesBTexture,splatUV)*splat.center.w;\n#if SH_DEGREE>0\nivec2 splatUVint=getDataUVint(splatIndex,dataTextureSize);splat.sh0=texelFetch(shTexture0,splatUVint,0);\n#endif\n#if SH_DEGREE>1\nsplat.sh1=texelFetch(shTexture1,splatUVint,0);\n#endif\n#if SH_DEGREE>2\nsplat.sh2=texelFetch(shTexture2,splatUVint,0);\n#endif\nreturn splat;}\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nvec3 computeColorFromSHDegree(vec3 dir,const vec3 sh[16])\n{const float SH_C0=0.28209479;const float SH_C1=0.48860251;float SH_C2[5];SH_C2[0]=1.092548430;SH_C2[1]=-1.09254843;SH_C2[2]=0.315391565;SH_C2[3]=-1.09254843;SH_C2[4]=0.546274215;float SH_C3[7];SH_C3[0]=-0.59004358;SH_C3[1]=2.890611442;SH_C3[2]=-0.45704579;SH_C3[3]=0.373176332;SH_C3[4]=-0.45704579;SH_C3[5]=1.445305721;SH_C3[6]=-0.59004358;vec3 result=/*SH_C0**/sh[0];\n#if SH_DEGREE>0\nfloat x=dir.x;float y=dir.y;float z=dir.z;result+=- SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3];\n#if SH_DEGREE>1\nfloat xx=x*x,yy=y*y,zz=z*z;float xy=x*y,yz=y*z,xz=x*z;result+=\nSH_C2[0]*xy*sh[4] +\nSH_C2[1]*yz*sh[5] +\nSH_C2[2]*(2.0*zz-xx-yy)*sh[6] +\nSH_C2[3]*xz*sh[7] +\nSH_C2[4]*(xx-yy)*sh[8];\n#if SH_DEGREE>2\nresult+=\nSH_C3[0]*y*(3.0*xx-yy)*sh[9] +\nSH_C3[1]*xy*z*sh[10] +\nSH_C3[2]*y*(4.0*zz-xx-yy)*sh[11] +\nSH_C3[3]*z*(2.0*zz-3.0*xx-3.0*yy)*sh[12] +\nSH_C3[4]*x*(4.0*zz-xx-yy)*sh[13] +\nSH_C3[5]*z*(xx-yy)*sh[14] +\nSH_C3[6]*x*(xx-3.0*yy)*sh[15];\n#endif\n#endif\n#endif\nreturn result;}\nvec4 decompose(uint value)\n{vec4 components=vec4(\nfloat((value ) & 255u),\nfloat((value>>uint( 8)) & 255u),\nfloat((value>>uint(16)) & 255u),\nfloat((value>>uint(24)) & 255u));return components*vec4(2./255.)-vec4(1.);}\nvec3 computeSH(Splat splat,vec3 dir)\n{vec3 sh[16];sh[0]=vec3(0.,0.,0.);\n#if SH_DEGREE>0\nvec4 sh00=decompose(splat.sh0.x);vec4 sh01=decompose(splat.sh0.y);vec4 sh02=decompose(splat.sh0.z);sh[1]=vec3(sh00.x,sh00.y,sh00.z);sh[2]=vec3(sh00.w,sh01.x,sh01.y);sh[3]=vec3(sh01.z,sh01.w,sh02.x);\n#endif\n#if SH_DEGREE>1\nvec4 sh03=decompose(splat.sh0.w);vec4 sh04=decompose(splat.sh1.x);vec4 sh05=decompose(splat.sh1.y);sh[4]=vec3(sh02.y,sh02.z,sh02.w);sh[5]=vec3(sh03.x,sh03.y,sh03.z);sh[6]=vec3(sh03.w,sh04.x,sh04.y);sh[7]=vec3(sh04.z,sh04.w,sh05.x);sh[8]=vec3(sh05.y,sh05.z,sh05.w);\n#endif\n#if SH_DEGREE>2\nvec4 sh06=decompose(splat.sh1.z);vec4 sh07=decompose(splat.sh1.w);vec4 sh08=decompose(splat.sh2.x);vec4 sh09=decompose(splat.sh2.y);vec4 sh10=decompose(splat.sh2.z);vec4 sh11=decompose(splat.sh2.w);sh[9]=vec3(sh06.x,sh06.y,sh06.z);sh[10]=vec3(sh06.w,sh07.x,sh07.y);sh[11]=vec3(sh07.z,sh07.w,sh08.x);sh[12]=vec3(sh08.y,sh08.z,sh08.w);sh[13]=vec3(sh09.x,sh09.y,sh09.z);sh[14]=vec3(sh09.w,sh10.x,sh10.y);sh[15]=vec3(sh10.z,sh10.w,sh11.x); \n#endif\nreturn computeColorFromSHDegree(dir,sh);}\n#else\nvec3 computeSH(Splat splat,vec3 dir)\n{return vec3(0.,0.,0.);}\n#endif\nvec4 gaussianSplatting(vec2 meshPos,vec3 worldPos,vec2 scale,vec3 covA,vec3 covB,mat4 worldMatrix,mat4 viewMatrix,mat4 projectionMatrix)\n{mat4 modelView=viewMatrix*worldMatrix;vec4 camspace=viewMatrix*vec4(worldPos,1.);vec4 pos2d=projectionMatrix*camspace;float bounds=1.2*pos2d.w;if (pos2d.z<-pos2d.w || pos2d.x<-bounds || pos2d.x>bounds\n|| pos2d.y<-bounds || pos2d.y>bounds) {return vec4(0.0,0.0,2.0,1.0);}\nmat3 Vrk=mat3(\ncovA.x,covA.y,covA.z,\ncovA.y,covB.x,covB.y,\ncovA.z,covB.y,covB.z\n);bool isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;mat3 J;if (isOrtho) {J=mat3(\nfocal.x,0.,0.,\n0.,focal.y,0.,\n0.,0.,0.\n);} else {J=mat3(\nfocal.x/camspace.z,0.,-(focal.x*camspace.x)/(camspace.z*camspace.z),\n0.,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z),\n0.,0.,0.\n);}\nmat3 T=transpose(mat3(modelView))*J;mat3 cov2d=transpose(T)*Vrk*T;\n#if COMPENSATION\nfloat c00=cov2d[0][0];float c11=cov2d[1][1];float c01=cov2d[0][1];float detOrig=c00*c11-c01*c01;\n#endif\ncov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize;\n#if COMPENSATION\nvec3 c2d=vec3(cov2d[0][0],c01,cov2d[1][1]);float detBlur=c2d.x*c2d.z-c2d.y*c2d.y;float compensation=sqrt(max(0.,detOrig/detBlur));vColor.w*=compensation;\n#endif\nfloat mid=(cov2d[0][0]+cov2d[1][1])/2.0;float radius=length(vec2((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));float epsilon=0.0001;float lambda1=mid+radius+epsilon,lambda2=mid-radius+epsilon;if (lambda2<0.0)\n{return vec4(0.0,0.0,2.0,1.0);}\nvec2 diagonalVector=normalize(vec2(cov2d[0][1],lambda1-cov2d[0][0]));vec2 majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;vec2 minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2(diagonalVector.y,-diagonalVector.x);vec2 vCenter=vec2(pos2d);float scaleFactor=isOrtho ? 1.0 : pos2d.w;return vec4(\nvCenter \n+ ((meshPos.x*majorAxis\n+ meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,pos2d.zw);}`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const gaussianSplatting = { name, shader };\n"]}
1
+ {"version":3,"file":"gaussianSplatting.js","sourceRoot":"","sources":["../../../../../dev/core/src/Shaders/ShadersInclude/gaussianSplatting.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Hd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1C,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"gaussianSplatting\";\nconst shader = `#if !defined(WEBGL2) && !defined(WEBGPU) && !defined(NATIVE)\nmat3 transpose(mat3 matrix) {return mat3(matrix[0][0],matrix[1][0],matrix[2][0],\nmatrix[0][1],matrix[1][1],matrix[2][1],\nmatrix[0][2],matrix[1][2],matrix[2][2]);}\n#endif\nvec2 getDataUV(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return vec2((x+0.5)/textureSize.x,(y+0.5)/textureSize.y);}\n#if SH_DEGREE>0 || IS_COMPOUND\nivec2 getDataUVint(float index,vec2 textureSize) {float y=floor(index/textureSize.x);float x=index-y*textureSize.x;return ivec2(uint(x+0.5),uint(y+0.5));}\n#endif\nstruct Splat {vec4 center;vec4 color;vec4 covA;vec4 covB;\n#if SH_DEGREE>0\nuvec4 sh0; \n#endif\n#if SH_DEGREE>1\nuvec4 sh1;\n#endif\n#if SH_DEGREE>2\nuvec4 sh2;\n#endif\n#if IS_COMPOUND\nuint partIndex;\n#endif\n};float getSplatIndex(int localIndex)\n{float splatIndex;switch (localIndex)\n{case 0: splatIndex=splatIndex0.x; break;case 1: splatIndex=splatIndex0.y; break;case 2: splatIndex=splatIndex0.z; break;case 3: splatIndex=splatIndex0.w; break;case 4: splatIndex=splatIndex1.x; break;case 5: splatIndex=splatIndex1.y; break;case 6: splatIndex=splatIndex1.z; break;case 7: splatIndex=splatIndex1.w; break;case 8: splatIndex=splatIndex2.x; break;case 9: splatIndex=splatIndex2.y; break;case 10: splatIndex=splatIndex2.z; break;case 11: splatIndex=splatIndex2.w; break;case 12: splatIndex=splatIndex3.x; break;case 13: splatIndex=splatIndex3.y; break;case 14: splatIndex=splatIndex3.z; break;case 15: splatIndex=splatIndex3.w; break;}\nreturn splatIndex;}\nSplat readSplat(float splatIndex)\n{Splat splat;vec2 splatUV=getDataUV(splatIndex,dataTextureSize);splat.center=texture2D(centersTexture,splatUV);splat.color=texture2D(colorsTexture,splatUV);splat.covA=texture2D(covariancesATexture,splatUV)*splat.center.w;splat.covB=texture2D(covariancesBTexture,splatUV)*splat.center.w;\n#if SH_DEGREE>0 || IS_COMPOUND\nivec2 splatUVint=getDataUVint(splatIndex,dataTextureSize);\n#endif\n#if SH_DEGREE>0\nsplat.sh0=texelFetch(shTexture0,splatUVint,0);\n#endif\n#if SH_DEGREE>1\nsplat.sh1=texelFetch(shTexture1,splatUVint,0);\n#endif\n#if SH_DEGREE>2\nsplat.sh2=texelFetch(shTexture2,splatUVint,0);\n#endif\n#if IS_COMPOUND\nsplat.partIndex=uint(texture2D(partIndicesTexture,splatUV).r*255.0+0.5);\n#endif\nreturn splat;}\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nvec3 computeColorFromSHDegree(vec3 dir,const vec3 sh[16])\n{const float SH_C0=0.28209479;const float SH_C1=0.48860251;float SH_C2[5];SH_C2[0]=1.092548430;SH_C2[1]=-1.09254843;SH_C2[2]=0.315391565;SH_C2[3]=-1.09254843;SH_C2[4]=0.546274215;float SH_C3[7];SH_C3[0]=-0.59004358;SH_C3[1]=2.890611442;SH_C3[2]=-0.45704579;SH_C3[3]=0.373176332;SH_C3[4]=-0.45704579;SH_C3[5]=1.445305721;SH_C3[6]=-0.59004358;vec3 result=/*SH_C0**/sh[0];\n#if SH_DEGREE>0\nfloat x=dir.x;float y=dir.y;float z=dir.z;result+=- SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3];\n#if SH_DEGREE>1\nfloat xx=x*x,yy=y*y,zz=z*z;float xy=x*y,yz=y*z,xz=x*z;result+=\nSH_C2[0]*xy*sh[4] +\nSH_C2[1]*yz*sh[5] +\nSH_C2[2]*(2.0*zz-xx-yy)*sh[6] +\nSH_C2[3]*xz*sh[7] +\nSH_C2[4]*(xx-yy)*sh[8];\n#if SH_DEGREE>2\nresult+=\nSH_C3[0]*y*(3.0*xx-yy)*sh[9] +\nSH_C3[1]*xy*z*sh[10] +\nSH_C3[2]*y*(4.0*zz-xx-yy)*sh[11] +\nSH_C3[3]*z*(2.0*zz-3.0*xx-3.0*yy)*sh[12] +\nSH_C3[4]*x*(4.0*zz-xx-yy)*sh[13] +\nSH_C3[5]*z*(xx-yy)*sh[14] +\nSH_C3[6]*x*(xx-3.0*yy)*sh[15];\n#endif\n#endif\n#endif\nreturn result;}\nvec4 decompose(uint value)\n{vec4 components=vec4(\nfloat((value ) & 255u),\nfloat((value>>uint( 8)) & 255u),\nfloat((value>>uint(16)) & 255u),\nfloat((value>>uint(24)) & 255u));return components*vec4(2./255.)-vec4(1.);}\nvec3 computeSH(Splat splat,vec3 dir)\n{vec3 sh[16];sh[0]=vec3(0.,0.,0.);\n#if SH_DEGREE>0\nvec4 sh00=decompose(splat.sh0.x);vec4 sh01=decompose(splat.sh0.y);vec4 sh02=decompose(splat.sh0.z);sh[1]=vec3(sh00.x,sh00.y,sh00.z);sh[2]=vec3(sh00.w,sh01.x,sh01.y);sh[3]=vec3(sh01.z,sh01.w,sh02.x);\n#endif\n#if SH_DEGREE>1\nvec4 sh03=decompose(splat.sh0.w);vec4 sh04=decompose(splat.sh1.x);vec4 sh05=decompose(splat.sh1.y);sh[4]=vec3(sh02.y,sh02.z,sh02.w);sh[5]=vec3(sh03.x,sh03.y,sh03.z);sh[6]=vec3(sh03.w,sh04.x,sh04.y);sh[7]=vec3(sh04.z,sh04.w,sh05.x);sh[8]=vec3(sh05.y,sh05.z,sh05.w);\n#endif\n#if SH_DEGREE>2\nvec4 sh06=decompose(splat.sh1.z);vec4 sh07=decompose(splat.sh1.w);vec4 sh08=decompose(splat.sh2.x);vec4 sh09=decompose(splat.sh2.y);vec4 sh10=decompose(splat.sh2.z);vec4 sh11=decompose(splat.sh2.w);sh[9]=vec3(sh06.x,sh06.y,sh06.z);sh[10]=vec3(sh06.w,sh07.x,sh07.y);sh[11]=vec3(sh07.z,sh07.w,sh08.x);sh[12]=vec3(sh08.y,sh08.z,sh08.w);sh[13]=vec3(sh09.x,sh09.y,sh09.z);sh[14]=vec3(sh09.w,sh10.x,sh10.y);sh[15]=vec3(sh10.z,sh10.w,sh11.x); \n#endif\nreturn computeColorFromSHDegree(dir,sh);}\n#else\nvec3 computeSH(Splat splat,vec3 dir)\n{return vec3(0.,0.,0.);}\n#endif\nvec4 gaussianSplatting(vec2 meshPos,vec3 worldPos,vec2 scale,vec3 covA,vec3 covB,mat4 worldMatrix,mat4 viewMatrix,mat4 projectionMatrix)\n{mat4 modelView=viewMatrix*worldMatrix;vec4 camspace=viewMatrix*vec4(worldPos,1.);vec4 pos2d=projectionMatrix*camspace;float bounds=1.2*pos2d.w;if (pos2d.z<-pos2d.w || pos2d.x<-bounds || pos2d.x>bounds\n|| pos2d.y<-bounds || pos2d.y>bounds) {return vec4(0.0,0.0,2.0,1.0);}\nmat3 Vrk=mat3(\ncovA.x,covA.y,covA.z,\ncovA.y,covB.x,covB.y,\ncovA.z,covB.y,covB.z\n);bool isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;mat3 J;if (isOrtho) {J=mat3(\nfocal.x,0.,0.,\n0.,focal.y,0.,\n0.,0.,0.\n);} else {J=mat3(\nfocal.x/camspace.z,0.,-(focal.x*camspace.x)/(camspace.z*camspace.z),\n0.,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z),\n0.,0.,0.\n);}\nmat3 T=transpose(mat3(modelView))*J;mat3 cov2d=transpose(T)*Vrk*T;\n#if COMPENSATION\nfloat c00=cov2d[0][0];float c11=cov2d[1][1];float c01=cov2d[0][1];float detOrig=c00*c11-c01*c01;\n#endif\ncov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize;\n#if COMPENSATION\nvec3 c2d=vec3(cov2d[0][0],c01,cov2d[1][1]);float detBlur=c2d.x*c2d.z-c2d.y*c2d.y;float compensation=sqrt(max(0.,detOrig/detBlur));vColor.w*=compensation;\n#endif\nfloat mid=(cov2d[0][0]+cov2d[1][1])/2.0;float radius=length(vec2((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));float epsilon=0.0001;float lambda1=mid+radius+epsilon,lambda2=mid-radius+epsilon;if (lambda2<0.0)\n{return vec4(0.0,0.0,2.0,1.0);}\nvec2 diagonalVector=normalize(vec2(cov2d[0][1],lambda1-cov2d[0][0]));vec2 majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;vec2 minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2(diagonalVector.y,-diagonalVector.x);vec2 vCenter=vec2(pos2d);float scaleFactor=isOrtho ? 1.0 : pos2d.w;return vec4(\nvCenter \n+ ((meshPos.x*majorAxis\n+ meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,pos2d.zw);}\n#if IS_COMPOUND\nmat4 getPartWorld(uint partIndex) {return partWorld[partIndex];}\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const gaussianSplatting = { name, shader };\n"]}
@@ -19,7 +19,11 @@ const shader = `#include<__decl__gaussianSplattingVertex>
19
19
  #include<fogVertexDeclaration>
20
20
  #include<logDepthDeclaration>
21
21
  #include<helperFunctions>
22
- uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform float alpha;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;
22
+ uniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform float alpha;
23
+ #if IS_COMPOUND
24
+ uniform mat4 partWorld[MAX_PART_COUNT];
25
+ #endif
26
+ uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;
23
27
  #if SH_DEGREE>0
24
28
  uniform highp usampler2D shTexture0;
25
29
  #endif
@@ -29,13 +33,22 @@ uniform highp usampler2D shTexture1;
29
33
  #if SH_DEGREE>2
30
34
  uniform highp usampler2D shTexture2;
31
35
  #endif
36
+ #if IS_COMPOUND
37
+ uniform sampler2D partIndicesTexture;
38
+ #endif
32
39
  varying vec4 vColor;varying vec2 vPosition;
33
40
  #include<gaussianSplatting>
34
- void main () {float splatIndex=getSplatIndex(int(position.z+0.5));Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);vec4 worldPos=world*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position.xy;
41
+ void main () {float splatIndex=getSplatIndex(int(position.z+0.5));Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);
42
+ #if IS_COMPOUND
43
+ mat4 splatWorld=getPartWorld(splat.partIndex);
44
+ #else
45
+ mat4 splatWorld=world;
46
+ #endif
47
+ vec4 worldPos=splatWorld*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position.xy;
35
48
  #if SH_DEGREE>0
36
- mat3 worldRot=mat3(world);mat3 normWorldRot=inverseMat3(worldRot);vec3 eyeToSplatLocalSpace=normalize(normWorldRot*(worldPos.xyz-eyePosition));vColor.xyz=splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace);
49
+ mat3 worldRot=mat3(splatWorld);mat3 normWorldRot=inverseMat3(worldRot);vec3 eyeToSplatLocalSpace=normalize(normWorldRot*(worldPos.xyz-eyePosition));vColor.xyz=splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace);
37
50
  #endif
38
- vColor.w*=alpha;gl_Position=gaussianSplatting(position.xy,worldPos.xyz,vec2(1.,1.),covA,covB,world,view,projection);
51
+ vColor.w*=alpha;gl_Position=gaussianSplatting(position.xy,worldPos.xyz,vec2(1.,1.),covA,covB,splatWorld,view,projection);
39
52
  #include<clipPlaneVertex>
40
53
  #include<fogVertex>
41
54
  #include<logDepthVertex>
@@ -1 +1 @@
1
- {"version":3,"file":"gaussianSplatting.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/gaussianSplatting.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,qDAAqD,CAAC;AAC7D,OAAO,kDAAkD,CAAC;AAC1D,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Bd,CAAC;AACF,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,6BAA6B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/gaussianSplattingVertexDeclaration\";\nimport \"./ShadersInclude/gaussianSplattingUboDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/helperFunctions\";\nimport \"./ShadersInclude/gaussianSplatting\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"gaussianSplattingVertexShader\";\nconst shader = `#include<__decl__gaussianSplattingVertex>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\n#include<helperFunctions>\nuniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform float alpha;uniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;\n#if SH_DEGREE>0\nuniform highp usampler2D shTexture0;\n#endif\n#if SH_DEGREE>1\nuniform highp usampler2D shTexture1;\n#endif\n#if SH_DEGREE>2\nuniform highp usampler2D shTexture2;\n#endif\nvarying vec4 vColor;varying vec2 vPosition;\n#include<gaussianSplatting>\nvoid main () {float splatIndex=getSplatIndex(int(position.z+0.5));Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);vec4 worldPos=world*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position.xy;\n#if SH_DEGREE>0\nmat3 worldRot=mat3(world);mat3 normWorldRot=inverseMat3(worldRot);vec3 eyeToSplatLocalSpace=normalize(normWorldRot*(worldPos.xyz-eyePosition));vColor.xyz=splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace);\n#endif\nvColor.w*=alpha;gl_Position=gaussianSplatting(position.xy,worldPos.xyz,vec2(1.,1.),covA,covB,world,view,projection);\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const gaussianSplattingVertexShader = { name, shader };\n"]}
1
+ {"version":3,"file":"gaussianSplatting.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/gaussianSplatting.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,qDAAqD,CAAC;AAC7D,OAAO,kDAAkD,CAAC;AAC1D,OAAO,6CAA6C,CAAC;AACrD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Cd,CAAC;AACF,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,6BAA6B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/gaussianSplattingVertexDeclaration\";\nimport \"./ShadersInclude/gaussianSplattingUboDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/fogVertexDeclaration\";\nimport \"./ShadersInclude/logDepthDeclaration\";\nimport \"./ShadersInclude/helperFunctions\";\nimport \"./ShadersInclude/gaussianSplatting\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/fogVertex\";\nimport \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"gaussianSplattingVertexShader\";\nconst shader = `#include<__decl__gaussianSplattingVertex>\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\n#include<helperFunctions>\nuniform vec2 invViewport;uniform vec2 dataTextureSize;uniform vec2 focal;uniform float kernelSize;uniform vec3 eyePosition;uniform float alpha;\n#if IS_COMPOUND\nuniform mat4 partWorld[MAX_PART_COUNT];\n#endif\nuniform sampler2D covariancesATexture;uniform sampler2D covariancesBTexture;uniform sampler2D centersTexture;uniform sampler2D colorsTexture;\n#if SH_DEGREE>0\nuniform highp usampler2D shTexture0;\n#endif\n#if SH_DEGREE>1\nuniform highp usampler2D shTexture1;\n#endif\n#if SH_DEGREE>2\nuniform highp usampler2D shTexture2;\n#endif\n#if IS_COMPOUND\nuniform sampler2D partIndicesTexture;\n#endif\nvarying vec4 vColor;varying vec2 vPosition;\n#include<gaussianSplatting>\nvoid main () {float splatIndex=getSplatIndex(int(position.z+0.5));Splat splat=readSplat(splatIndex);vec3 covA=splat.covA.xyz;vec3 covB=vec3(splat.covA.w,splat.covB.xy);\n#if IS_COMPOUND\nmat4 splatWorld=getPartWorld(splat.partIndex);\n#else\nmat4 splatWorld=world;\n#endif\nvec4 worldPos=splatWorld*vec4(splat.center.xyz,1.0);vColor=splat.color;vPosition=position.xy;\n#if SH_DEGREE>0\nmat3 worldRot=mat3(splatWorld);mat3 normWorldRot=inverseMat3(worldRot);vec3 eyeToSplatLocalSpace=normalize(normWorldRot*(worldPos.xyz-eyePosition));vColor.xyz=splat.color.xyz+computeSH(splat,eyeToSplatLocalSpace);\n#endif\nvColor.w*=alpha;gl_Position=gaussianSplatting(position.xy,worldPos.xyz,vec2(1.,1.),covA,covB,splatWorld,view,projection);\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const gaussianSplattingVertexShader = { name, shader };\n"]}
@@ -15,6 +15,9 @@ sh1: vec4<u32>,
15
15
  #if SH_DEGREE>2
16
16
  sh2: vec4<u32>,
17
17
  #endif
18
+ #if IS_COMPOUND
19
+ partIndex: u32,
20
+ #endif
18
21
  };fn getSplatIndex(localIndex: i32,splatIndex0: vec4f,splatIndex1: vec4f,splatIndex2: vec4f,splatIndex3: vec4f)->f32 {var splatIndex: f32;switch (localIndex)
19
22
  {case 0:
20
23
  {splatIndex=splatIndex0.x;break;}
@@ -59,6 +62,9 @@ splat.sh1=textureLoad(shTexture1,splatUVi32,0);
59
62
  #if SH_DEGREE>2
60
63
  splat.sh2=textureLoad(shTexture2,splatUVi32,0);
61
64
  #endif
65
+ #if IS_COMPOUND
66
+ splat.partIndex=u32(textureLoad(partIndicesTexture,splatUVi32,0).r*255.0+0.5);
67
+ #endif
62
68
  return splat;}
63
69
  fn computeColorFromSHDegree(dir: vec3f,sh: array<vec3<f32>,16>)->vec3f
64
70
  {let SH_C0: f32=0.28209479;let SH_C1: f32=0.48860251;var SH_C2: array<f32,5>=array<f32,5>(
@@ -158,7 +164,11 @@ let diagonalVector=normalize(vec2<f32>(cov2d[0][1],lambda1-cov2d[0][0]));let maj
158
164
  vCenter+((meshPos.x*majorAxis+meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,
159
165
  pos2d.z,
160
166
  pos2d.w
161
- );}`;
167
+ );}
168
+ #if IS_COMPOUND
169
+ fn getPartWorld(partIndex: u32)->mat4x4<f32> {return uniforms.partWorld[partIndex];}
170
+ #endif
171
+ `;
162
172
  // Sideeffect
163
173
  if (!ShaderStore.IncludesShadersStoreWGSL[name]) {
164
174
  ShaderStore.IncludesShadersStoreWGSL[name] = shader;
@@ -1 +1 @@
1
- {"version":3,"file":"gaussianSplatting.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/gaussianSplatting.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6JX,CAAC;AACL,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"gaussianSplatting\";\nconst shader = `fn getDataUV(index: f32,dataTextureSize: vec2f)->vec2<f32> {let y: f32=floor(index/dataTextureSize.x);let x: f32=index-y*dataTextureSize.x;return vec2f((x+0.5),(y+0.5));}\nstruct Splat {center: vec4f,\ncolor: vec4f,\ncovA: vec4f,\ncovB: vec4f,\n#if SH_DEGREE>0\nsh0: vec4<u32>,\n#endif\n#if SH_DEGREE>1\nsh1: vec4<u32>,\n#endif\n#if SH_DEGREE>2\nsh2: vec4<u32>,\n#endif\n};fn getSplatIndex(localIndex: i32,splatIndex0: vec4f,splatIndex1: vec4f,splatIndex2: vec4f,splatIndex3: vec4f)->f32 {var splatIndex: f32;switch (localIndex)\n{case 0:\n{splatIndex=splatIndex0.x;break;}\ncase 1:\n{splatIndex=splatIndex0.y;break;}\ncase 2:\n{splatIndex=splatIndex0.z;break;}\ncase 3:\n{splatIndex=splatIndex0.w;break;}\ncase 4:\n{splatIndex=splatIndex1.x;break;}\ncase 5:\n{splatIndex=splatIndex1.y;break;}\ncase 6:\n{splatIndex=splatIndex1.z;break;}\ncase 7:\n{splatIndex=splatIndex1.w;break;}\ncase 8:\n{splatIndex=splatIndex2.x;break;}\ncase 9:\n{splatIndex=splatIndex2.y;break;}\ncase 10:\n{splatIndex=splatIndex2.z;break;}\ncase 11:\n{splatIndex=splatIndex2.w;break;}\ncase 12:\n{splatIndex=splatIndex3.x;break;}\ncase 13:\n{splatIndex=splatIndex3.y;break;}\ncase 14:\n{splatIndex=splatIndex3.z;break;}\ndefault:\n{splatIndex=splatIndex3.w;break;}}\nreturn splatIndex;}\nfn readSplat(splatIndex: f32,dataTextureSize: vec2f)->Splat {var splat: Splat;let splatUV=getDataUV(splatIndex,dataTextureSize);let splatUVi32=vec2<i32>(i32(splatUV.x),i32(splatUV.y));splat.center=textureLoad(centersTexture,splatUVi32,0);splat.color=textureLoad(colorsTexture,splatUVi32,0);splat.covA=textureLoad(covariancesATexture,splatUVi32,0)*splat.center.w;splat.covB=textureLoad(covariancesBTexture,splatUVi32,0)*splat.center.w;\n#if SH_DEGREE>0\nsplat.sh0=textureLoad(shTexture0,splatUVi32,0);\n#endif\n#if SH_DEGREE>1\nsplat.sh1=textureLoad(shTexture1,splatUVi32,0);\n#endif\n#if SH_DEGREE>2\nsplat.sh2=textureLoad(shTexture2,splatUVi32,0);\n#endif\nreturn splat;}\nfn computeColorFromSHDegree(dir: vec3f,sh: array<vec3<f32>,16>)->vec3f\n{let SH_C0: f32=0.28209479;let SH_C1: f32=0.48860251;var SH_C2: array<f32,5>=array<f32,5>(\n1.092548430,\n-1.09254843,\n0.315391565,\n-1.09254843,\n0.546274215\n);var SH_C3: array<f32,7>=array<f32,7>(\n-0.59004358,\n2.890611442,\n-0.45704579,\n0.373176332,\n-0.45704579,\n1.445305721,\n-0.59004358\n);var result: vec3f=/*SH_C0**/sh[0];\n#if SH_DEGREE>0\nlet x: f32=dir.x;let y: f32=dir.y;let z: f32=dir.z;result+=-SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3];\n#if SH_DEGREE>1\nlet xx: f32=x*x;let yy: f32=y*y;let zz: f32=z*z;let xy: f32=x*y;let yz: f32=y*z;let xz: f32=x*z;result+=\nSH_C2[0]*xy*sh[4] +\nSH_C2[1]*yz*sh[5] +\nSH_C2[2]*(2.0f*zz-xx-yy)*sh[6] +\nSH_C2[3]*xz*sh[7] +\nSH_C2[4]*(xx-yy)*sh[8];\n#if SH_DEGREE>2\nresult+=\nSH_C3[0]*y*(3.0f*xx-yy)*sh[9] +\nSH_C3[1]*xy*z*sh[10] +\nSH_C3[2]*y*(4.0f*zz-xx-yy)*sh[11] +\nSH_C3[3]*z*(2.0f*zz-3.0f*xx-3.0f*yy)*sh[12] +\nSH_C3[4]*x*(4.0f*zz-xx-yy)*sh[13] +\nSH_C3[5]*z*(xx-yy)*sh[14] +\nSH_C3[6]*x*(xx-3.0f*yy)*sh[15];\n#endif\n#endif\n#endif\nreturn result;}\nfn decompose(value: u32)->vec4f\n{let components : vec4f=vec4f(\nf32((value ) & 255u),\nf32((value>>u32( 8)) & 255u),\nf32((value>>u32(16)) & 255u),\nf32((value>>u32(24)) & 255u));return components*vec4f(2./255.)-vec4f(1.);}\nfn computeSH(splat: Splat,dir: vec3f)->vec3f\n{var sh: array<vec3<f32>,16>;sh[0]=vec3f(0.,0.,0.);\n#if SH_DEGREE>0\nlet sh00: vec4f=decompose(splat.sh0.x);let sh01: vec4f=decompose(splat.sh0.y);let sh02: vec4f=decompose(splat.sh0.z);sh[1]=vec3f(sh00.x,sh00.y,sh00.z);sh[2]=vec3f(sh00.w,sh01.x,sh01.y);sh[3]=vec3f(sh01.z,sh01.w,sh02.x);\n#endif\n#if SH_DEGREE>1\nlet sh03: vec4f=decompose(splat.sh0.w);let sh04: vec4f=decompose(splat.sh1.x);let sh05: vec4f=decompose(splat.sh1.y);sh[4]=vec3f(sh02.y,sh02.z,sh02.w);sh[5]=vec3f(sh03.x,sh03.y,sh03.z);sh[6]=vec3f(sh03.w,sh04.x,sh04.y);sh[7]=vec3f(sh04.z,sh04.w,sh05.x);sh[8]=vec3f(sh05.y,sh05.z,sh05.w);\n#endif\n#if SH_DEGREE>2\nlet sh06: vec4f=decompose(splat.sh1.z);let sh07: vec4f=decompose(splat.sh1.w);let sh08: vec4f=decompose(splat.sh2.x);let sh09: vec4f=decompose(splat.sh2.y);let sh10: vec4f=decompose(splat.sh2.z);let sh11: vec4f=decompose(splat.sh2.w);sh[9]=vec3f(sh06.x,sh06.y,sh06.z);sh[10]=vec3f(sh06.w,sh07.x,sh07.y);sh[11]=vec3f(sh07.z,sh07.w,sh08.x);sh[12]=vec3f(sh08.y,sh08.z,sh08.w);sh[13]=vec3f(sh09.x,sh09.y,sh09.z);sh[14]=vec3f(sh09.w,sh10.x,sh10.y);sh[15]=vec3f(sh10.z,sh10.w,sh11.x); \n#endif\nreturn computeColorFromSHDegree(dir,sh);}\nfn gaussianSplatting(\nmeshPos: vec2<f32>,\nworldPos: vec3<f32>,\nscale: vec2<f32>,\ncovA: vec3<f32>,\ncovB: vec3<f32>,\nworldMatrix: mat4x4<f32>,\nviewMatrix: mat4x4<f32>,\nprojectionMatrix: mat4x4<f32>,\nfocal: vec2f,\ninvViewport: vec2f,\nkernelSize: f32\n)->vec4f {let modelView=viewMatrix*worldMatrix;let camspace=viewMatrix*vec4f(worldPos,1.0);let pos2d=projectionMatrix*camspace;let bounds=1.2*pos2d.w;if (pos2d.z<0. || pos2d.x<-bounds || pos2d.x>bounds || pos2d.y<-bounds || pos2d.y>bounds) {return vec4f(0.0,0.0,2.0,1.0);}\nlet Vrk=mat3x3<f32>(\ncovA.x,covA.y,covA.z,\ncovA.y,covB.x,covB.y,\ncovA.z,covB.y,covB.z\n);let isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;var J: mat3x3<f32>;if (isOrtho) {J=mat3x3<f32>(\nfocal.x,0.0,0.0,\n0.0,focal.y,0.0,\n0.0,0.0,0.0\n);} else {J=mat3x3<f32>(\nfocal.x/camspace.z,0.0,-(focal.x*camspace.x)/(camspace.z*camspace.z),\n0.0,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z),\n0.0,0.0,0.0\n);}\nlet T=transpose(mat3x3<f32>(\nmodelView[0].xyz,\nmodelView[1].xyz,\nmodelView[2].xyz))*J;var cov2d=transpose(T)*Vrk*T;\n#if COMPENSATION\nlet c00: f32=cov2d[0][0];let c11: f32=cov2d[1][1];let c01: f32=cov2d[0][1];let detOrig: f32=c00*c11-c01*c01;\n#endif\ncov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize;\n#if COMPENSATION\nlet c2d: vec3f=vec3f(cov2d[0][0],c01,cov2d[1][1]);let detBlur: f32=c2d.x*c2d.z-c2d.y*c2d.y;let compensation: f32=sqrt(max(0.,detOrig/detBlur));vertexOutputs.vColor.w*=compensation;\n#endif\nlet mid=(cov2d[0][0]+cov2d[1][1])/2.0;let radius=length(vec2<f32>((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));let lambda1=mid+radius;let lambda2=mid-radius;if (lambda2<0.0) {return vec4f(0.0,0.0,2.0,1.0);}\nlet diagonalVector=normalize(vec2<f32>(cov2d[0][1],lambda1-cov2d[0][0]));let majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;let minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2<f32>(diagonalVector.y,-diagonalVector.x);let vCenter=vec2<f32>(pos2d.x,pos2d.y);let scaleFactor=select(pos2d.w,1.0,isOrtho);return vec4f(\nvCenter+((meshPos.x*majorAxis+meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,\npos2d.z,\npos2d.w\n);}`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const gaussianSplattingWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"gaussianSplatting.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/gaussianSplatting.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AACjC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuKd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"gaussianSplatting\";\nconst shader = `fn getDataUV(index: f32,dataTextureSize: vec2f)->vec2<f32> {let y: f32=floor(index/dataTextureSize.x);let x: f32=index-y*dataTextureSize.x;return vec2f((x+0.5),(y+0.5));}\nstruct Splat {center: vec4f,\ncolor: vec4f,\ncovA: vec4f,\ncovB: vec4f,\n#if SH_DEGREE>0\nsh0: vec4<u32>,\n#endif\n#if SH_DEGREE>1\nsh1: vec4<u32>,\n#endif\n#if SH_DEGREE>2\nsh2: vec4<u32>,\n#endif\n#if IS_COMPOUND\npartIndex: u32,\n#endif\n};fn getSplatIndex(localIndex: i32,splatIndex0: vec4f,splatIndex1: vec4f,splatIndex2: vec4f,splatIndex3: vec4f)->f32 {var splatIndex: f32;switch (localIndex)\n{case 0:\n{splatIndex=splatIndex0.x;break;}\ncase 1:\n{splatIndex=splatIndex0.y;break;}\ncase 2:\n{splatIndex=splatIndex0.z;break;}\ncase 3:\n{splatIndex=splatIndex0.w;break;}\ncase 4:\n{splatIndex=splatIndex1.x;break;}\ncase 5:\n{splatIndex=splatIndex1.y;break;}\ncase 6:\n{splatIndex=splatIndex1.z;break;}\ncase 7:\n{splatIndex=splatIndex1.w;break;}\ncase 8:\n{splatIndex=splatIndex2.x;break;}\ncase 9:\n{splatIndex=splatIndex2.y;break;}\ncase 10:\n{splatIndex=splatIndex2.z;break;}\ncase 11:\n{splatIndex=splatIndex2.w;break;}\ncase 12:\n{splatIndex=splatIndex3.x;break;}\ncase 13:\n{splatIndex=splatIndex3.y;break;}\ncase 14:\n{splatIndex=splatIndex3.z;break;}\ndefault:\n{splatIndex=splatIndex3.w;break;}}\nreturn splatIndex;}\nfn readSplat(splatIndex: f32,dataTextureSize: vec2f)->Splat {var splat: Splat;let splatUV=getDataUV(splatIndex,dataTextureSize);let splatUVi32=vec2<i32>(i32(splatUV.x),i32(splatUV.y));splat.center=textureLoad(centersTexture,splatUVi32,0);splat.color=textureLoad(colorsTexture,splatUVi32,0);splat.covA=textureLoad(covariancesATexture,splatUVi32,0)*splat.center.w;splat.covB=textureLoad(covariancesBTexture,splatUVi32,0)*splat.center.w;\n#if SH_DEGREE>0\nsplat.sh0=textureLoad(shTexture0,splatUVi32,0);\n#endif\n#if SH_DEGREE>1\nsplat.sh1=textureLoad(shTexture1,splatUVi32,0);\n#endif\n#if SH_DEGREE>2\nsplat.sh2=textureLoad(shTexture2,splatUVi32,0);\n#endif\n#if IS_COMPOUND\nsplat.partIndex=u32(textureLoad(partIndicesTexture,splatUVi32,0).r*255.0+0.5);\n#endif\nreturn splat;}\nfn computeColorFromSHDegree(dir: vec3f,sh: array<vec3<f32>,16>)->vec3f\n{let SH_C0: f32=0.28209479;let SH_C1: f32=0.48860251;var SH_C2: array<f32,5>=array<f32,5>(\n1.092548430,\n-1.09254843,\n0.315391565,\n-1.09254843,\n0.546274215\n);var SH_C3: array<f32,7>=array<f32,7>(\n-0.59004358,\n2.890611442,\n-0.45704579,\n0.373176332,\n-0.45704579,\n1.445305721,\n-0.59004358\n);var result: vec3f=/*SH_C0**/sh[0];\n#if SH_DEGREE>0\nlet x: f32=dir.x;let y: f32=dir.y;let z: f32=dir.z;result+=-SH_C1*y*sh[1]+SH_C1*z*sh[2]-SH_C1*x*sh[3];\n#if SH_DEGREE>1\nlet xx: f32=x*x;let yy: f32=y*y;let zz: f32=z*z;let xy: f32=x*y;let yz: f32=y*z;let xz: f32=x*z;result+=\nSH_C2[0]*xy*sh[4] +\nSH_C2[1]*yz*sh[5] +\nSH_C2[2]*(2.0f*zz-xx-yy)*sh[6] +\nSH_C2[3]*xz*sh[7] +\nSH_C2[4]*(xx-yy)*sh[8];\n#if SH_DEGREE>2\nresult+=\nSH_C3[0]*y*(3.0f*xx-yy)*sh[9] +\nSH_C3[1]*xy*z*sh[10] +\nSH_C3[2]*y*(4.0f*zz-xx-yy)*sh[11] +\nSH_C3[3]*z*(2.0f*zz-3.0f*xx-3.0f*yy)*sh[12] +\nSH_C3[4]*x*(4.0f*zz-xx-yy)*sh[13] +\nSH_C3[5]*z*(xx-yy)*sh[14] +\nSH_C3[6]*x*(xx-3.0f*yy)*sh[15];\n#endif\n#endif\n#endif\nreturn result;}\nfn decompose(value: u32)->vec4f\n{let components : vec4f=vec4f(\nf32((value ) & 255u),\nf32((value>>u32( 8)) & 255u),\nf32((value>>u32(16)) & 255u),\nf32((value>>u32(24)) & 255u));return components*vec4f(2./255.)-vec4f(1.);}\nfn computeSH(splat: Splat,dir: vec3f)->vec3f\n{var sh: array<vec3<f32>,16>;sh[0]=vec3f(0.,0.,0.);\n#if SH_DEGREE>0\nlet sh00: vec4f=decompose(splat.sh0.x);let sh01: vec4f=decompose(splat.sh0.y);let sh02: vec4f=decompose(splat.sh0.z);sh[1]=vec3f(sh00.x,sh00.y,sh00.z);sh[2]=vec3f(sh00.w,sh01.x,sh01.y);sh[3]=vec3f(sh01.z,sh01.w,sh02.x);\n#endif\n#if SH_DEGREE>1\nlet sh03: vec4f=decompose(splat.sh0.w);let sh04: vec4f=decompose(splat.sh1.x);let sh05: vec4f=decompose(splat.sh1.y);sh[4]=vec3f(sh02.y,sh02.z,sh02.w);sh[5]=vec3f(sh03.x,sh03.y,sh03.z);sh[6]=vec3f(sh03.w,sh04.x,sh04.y);sh[7]=vec3f(sh04.z,sh04.w,sh05.x);sh[8]=vec3f(sh05.y,sh05.z,sh05.w);\n#endif\n#if SH_DEGREE>2\nlet sh06: vec4f=decompose(splat.sh1.z);let sh07: vec4f=decompose(splat.sh1.w);let sh08: vec4f=decompose(splat.sh2.x);let sh09: vec4f=decompose(splat.sh2.y);let sh10: vec4f=decompose(splat.sh2.z);let sh11: vec4f=decompose(splat.sh2.w);sh[9]=vec3f(sh06.x,sh06.y,sh06.z);sh[10]=vec3f(sh06.w,sh07.x,sh07.y);sh[11]=vec3f(sh07.z,sh07.w,sh08.x);sh[12]=vec3f(sh08.y,sh08.z,sh08.w);sh[13]=vec3f(sh09.x,sh09.y,sh09.z);sh[14]=vec3f(sh09.w,sh10.x,sh10.y);sh[15]=vec3f(sh10.z,sh10.w,sh11.x); \n#endif\nreturn computeColorFromSHDegree(dir,sh);}\nfn gaussianSplatting(\nmeshPos: vec2<f32>,\nworldPos: vec3<f32>,\nscale: vec2<f32>,\ncovA: vec3<f32>,\ncovB: vec3<f32>,\nworldMatrix: mat4x4<f32>,\nviewMatrix: mat4x4<f32>,\nprojectionMatrix: mat4x4<f32>,\nfocal: vec2f,\ninvViewport: vec2f,\nkernelSize: f32\n)->vec4f {let modelView=viewMatrix*worldMatrix;let camspace=viewMatrix*vec4f(worldPos,1.0);let pos2d=projectionMatrix*camspace;let bounds=1.2*pos2d.w;if (pos2d.z<0. || pos2d.x<-bounds || pos2d.x>bounds || pos2d.y<-bounds || pos2d.y>bounds) {return vec4f(0.0,0.0,2.0,1.0);}\nlet Vrk=mat3x3<f32>(\ncovA.x,covA.y,covA.z,\ncovA.y,covB.x,covB.y,\ncovA.z,covB.y,covB.z\n);let isOrtho=abs(projectionMatrix[3][3]-1.0)<0.001;var J: mat3x3<f32>;if (isOrtho) {J=mat3x3<f32>(\nfocal.x,0.0,0.0,\n0.0,focal.y,0.0,\n0.0,0.0,0.0\n);} else {J=mat3x3<f32>(\nfocal.x/camspace.z,0.0,-(focal.x*camspace.x)/(camspace.z*camspace.z),\n0.0,focal.y/camspace.z,-(focal.y*camspace.y)/(camspace.z*camspace.z),\n0.0,0.0,0.0\n);}\nlet T=transpose(mat3x3<f32>(\nmodelView[0].xyz,\nmodelView[1].xyz,\nmodelView[2].xyz))*J;var cov2d=transpose(T)*Vrk*T;\n#if COMPENSATION\nlet c00: f32=cov2d[0][0];let c11: f32=cov2d[1][1];let c01: f32=cov2d[0][1];let detOrig: f32=c00*c11-c01*c01;\n#endif\ncov2d[0][0]+=kernelSize;cov2d[1][1]+=kernelSize;\n#if COMPENSATION\nlet c2d: vec3f=vec3f(cov2d[0][0],c01,cov2d[1][1]);let detBlur: f32=c2d.x*c2d.z-c2d.y*c2d.y;let compensation: f32=sqrt(max(0.,detOrig/detBlur));vertexOutputs.vColor.w*=compensation;\n#endif\nlet mid=(cov2d[0][0]+cov2d[1][1])/2.0;let radius=length(vec2<f32>((cov2d[0][0]-cov2d[1][1])/2.0,cov2d[0][1]));let lambda1=mid+radius;let lambda2=mid-radius;if (lambda2<0.0) {return vec4f(0.0,0.0,2.0,1.0);}\nlet diagonalVector=normalize(vec2<f32>(cov2d[0][1],lambda1-cov2d[0][0]));let majorAxis=min(sqrt(2.0*lambda1),1024.0)*diagonalVector;let minorAxis=min(sqrt(2.0*lambda2),1024.0)*vec2<f32>(diagonalVector.y,-diagonalVector.x);let vCenter=vec2<f32>(pos2d.x,pos2d.y);let scaleFactor=select(pos2d.w,1.0,isOrtho);return vec4f(\nvCenter+((meshPos.x*majorAxis+meshPos.y*minorAxis)*invViewport*scaleFactor)*scale,\npos2d.z,\npos2d.w\n);}\n#if IS_COMPOUND\nfn getPartWorld(partIndex: u32)->mat4x4<f32> {return uniforms.partWorld[partIndex];}\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStoreWGSL[name]) {\n ShaderStore.IncludesShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const gaussianSplattingWGSL = { name, shader };\n"]}