@babylonjs/core 7.4.0 → 7.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/Audio/sound.js +3 -0
  2. package/Audio/sound.js.map +1 -1
  3. package/Buffers/storageBuffer.d.ts +2 -2
  4. package/Buffers/storageBuffer.js.map +1 -1
  5. package/Cameras/arcRotateCamera.js +3 -0
  6. package/Cameras/arcRotateCamera.js.map +1 -1
  7. package/Cameras/flyCamera.js +3 -0
  8. package/Cameras/flyCamera.js.map +1 -1
  9. package/Cameras/followCamera.js +4 -0
  10. package/Cameras/followCamera.js.map +1 -1
  11. package/Cameras/freeCamera.js +3 -0
  12. package/Cameras/freeCamera.js.map +1 -1
  13. package/Engines/Extensions/index.d.ts +0 -3
  14. package/Engines/Extensions/index.js +0 -3
  15. package/Engines/Extensions/index.js.map +1 -1
  16. package/Engines/WebGPU/Extensions/index.d.ts +0 -3
  17. package/Engines/WebGPU/Extensions/index.js +0 -3
  18. package/Engines/WebGPU/Extensions/index.js.map +1 -1
  19. package/Engines/abstractEngine.d.ts +11 -63
  20. package/Engines/abstractEngine.js +7 -7
  21. package/Engines/abstractEngine.js.map +1 -1
  22. package/Engines/nativeEngine.js +2 -2
  23. package/Engines/nativeEngine.js.map +1 -1
  24. package/Engines/thinEngine.d.ts +2 -2
  25. package/Engines/thinEngine.functions.d.ts +2 -10
  26. package/Engines/thinEngine.functions.js +1 -20
  27. package/Engines/thinEngine.functions.js.map +1 -1
  28. package/Engines/thinEngine.js +27 -11
  29. package/Engines/thinEngine.js.map +1 -1
  30. package/Engines/webgpuEngine.d.ts +54 -2
  31. package/Engines/webgpuEngine.js +147 -0
  32. package/Engines/webgpuEngine.js.map +1 -1
  33. package/Inputs/scene.inputManager.d.ts +1 -0
  34. package/Inputs/scene.inputManager.js +1 -0
  35. package/Inputs/scene.inputManager.js.map +1 -1
  36. package/Lights/directionalLight.js +3 -0
  37. package/Lights/directionalLight.js.map +1 -1
  38. package/Lights/hemisphericLight.js +3 -0
  39. package/Lights/hemisphericLight.js.map +1 -1
  40. package/Lights/pointLight.js +3 -0
  41. package/Lights/pointLight.js.map +1 -1
  42. package/Lights/spotLight.js +3 -0
  43. package/Lights/spotLight.js.map +1 -1
  44. package/Loading/Plugins/babylonFileLoader.js +25 -14
  45. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  46. package/Materials/Background/backgroundMaterial.js +1 -2
  47. package/Materials/Background/backgroundMaterial.js.map +1 -1
  48. package/Materials/GreasedLine/greasedLinePluginMaterial.js +7 -3
  49. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  50. package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +1 -1
  51. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  52. package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +1 -1
  53. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  54. package/Materials/Node/Blocks/Dual/fogBlock.d.ts +1 -1
  55. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  56. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +1 -1
  57. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  58. package/Materials/Node/Blocks/Dual/sceneDepthBlock.d.ts +1 -1
  59. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  60. package/Materials/Node/Blocks/Dual/textureBlock.d.ts +1 -1
  61. package/Materials/Node/Blocks/Dual/textureBlock.js +5 -1
  62. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  63. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +1 -1
  64. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  65. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +1 -1
  66. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  67. package/Materials/Node/Blocks/Fragment/screenSizeBlock.d.ts +1 -1
  68. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  69. package/Materials/Node/Blocks/Fragment/shadowMapBlock.d.ts +1 -1
  70. package/Materials/Node/Blocks/Fragment/shadowMapBlock.js.map +1 -1
  71. package/Materials/Node/Blocks/Input/animatedInputBlockTypes.d.ts +2 -1
  72. package/Materials/Node/Blocks/Input/animatedInputBlockTypes.js +1 -0
  73. package/Materials/Node/Blocks/Input/animatedInputBlockTypes.js.map +1 -1
  74. package/Materials/Node/Blocks/Input/inputBlock.d.ts +1 -1
  75. package/Materials/Node/Blocks/Input/inputBlock.js +16 -0
  76. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  77. package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +1 -1
  78. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  79. package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +1 -1
  80. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  81. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +1 -1
  82. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  83. package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +1 -1
  84. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  85. package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +1 -1
  86. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  87. package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +1 -1
  88. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  89. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.d.ts +1 -1
  90. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
  91. package/Materials/Node/Blocks/baseMathBlock.js +2 -4
  92. package/Materials/Node/Blocks/baseMathBlock.js.map +1 -1
  93. package/Materials/Node/Blocks/modBlock.js +7 -1
  94. package/Materials/Node/Blocks/modBlock.js.map +1 -1
  95. package/Materials/Node/Blocks/triPlanarBlock.d.ts +1 -1
  96. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  97. package/Materials/Node/nodeMaterial.d.ts +2 -4
  98. package/Materials/Node/nodeMaterial.js +1 -3
  99. package/Materials/Node/nodeMaterial.js.map +1 -1
  100. package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +34 -14
  101. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +87 -9
  102. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  103. package/Materials/Node/nodeMaterialBuildState.d.ts +1 -1
  104. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  105. package/Materials/PBR/pbrBaseMaterial.d.ts +1 -2
  106. package/Materials/PBR/pbrBaseMaterial.js +1 -2
  107. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  108. package/Materials/Textures/Loaders/ktxTextureLoader.js +1 -1
  109. package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
  110. package/Materials/Textures/htmlElementTexture.d.ts +0 -1
  111. package/Materials/Textures/htmlElementTexture.js +7 -2
  112. package/Materials/Textures/htmlElementTexture.js.map +1 -1
  113. package/Materials/Textures/videoTexture.js +4 -2
  114. package/Materials/Textures/videoTexture.js.map +1 -1
  115. package/Materials/effect.d.ts +4 -0
  116. package/Materials/effect.functions.d.ts +1 -1
  117. package/Materials/effect.functions.js +6 -4
  118. package/Materials/effect.functions.js.map +1 -1
  119. package/Materials/effect.js +1 -1
  120. package/Materials/effect.js.map +1 -1
  121. package/Materials/effect.webgl.functions.js +3 -3
  122. package/Materials/effect.webgl.functions.js.map +1 -1
  123. package/Materials/imageProcessingConfiguration.d.ts +5 -0
  124. package/Materials/imageProcessingConfiguration.defines.d.ts +2 -4
  125. package/Materials/imageProcessingConfiguration.defines.js +1 -2
  126. package/Materials/imageProcessingConfiguration.defines.js.map +1 -1
  127. package/Materials/imageProcessingConfiguration.js +26 -11
  128. package/Materials/imageProcessingConfiguration.js.map +1 -1
  129. package/Materials/materialPluginBase.js +3 -0
  130. package/Materials/materialPluginBase.js.map +1 -1
  131. package/Materials/meshDebugPluginMaterial.js +2 -2
  132. package/Materials/meshDebugPluginMaterial.js.map +1 -1
  133. package/Materials/shaderMaterial.js +18 -8
  134. package/Materials/shaderMaterial.js.map +1 -1
  135. package/Materials/standardMaterial.d.ts +1 -2
  136. package/Materials/standardMaterial.js +1 -2
  137. package/Materials/standardMaterial.js.map +1 -1
  138. package/Maths/math.color.d.ts +85 -82
  139. package/Maths/math.color.js +34 -27
  140. package/Maths/math.color.js.map +1 -1
  141. package/Maths/math.vector.d.ts +202 -202
  142. package/Maths/math.vector.js +133 -130
  143. package/Maths/math.vector.js.map +1 -1
  144. package/Maths/tensor.d.ts +44 -42
  145. package/Maths/tensor.js.map +1 -1
  146. package/Meshes/Compression/dracoCompression.d.ts +7 -0
  147. package/Meshes/Compression/dracoCompression.js +14 -0
  148. package/Meshes/Compression/dracoCompression.js.map +1 -1
  149. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +6 -0
  150. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  151. package/Meshes/instancedMesh.js +3 -0
  152. package/Meshes/instancedMesh.js.map +1 -1
  153. package/Misc/dumpTools.js +11 -0
  154. package/Misc/dumpTools.js.map +1 -1
  155. package/Misc/fileTools.d.ts +9 -3
  156. package/Misc/fileTools.js +17 -14
  157. package/Misc/fileTools.js.map +1 -1
  158. package/Misc/greasedLineTools.js +7 -1
  159. package/Misc/greasedLineTools.js.map +1 -1
  160. package/Misc/sceneSerializer.js +9 -1
  161. package/Misc/sceneSerializer.js.map +1 -1
  162. package/Misc/textureTools.d.ts +2 -0
  163. package/Misc/textureTools.js +2 -0
  164. package/Misc/textureTools.js.map +1 -1
  165. package/Misc/tools.d.ts +5 -6
  166. package/Misc/tools.js +9 -9
  167. package/Misc/tools.js.map +1 -1
  168. package/Misc/typeStore.d.ts +4 -0
  169. package/Misc/typeStore.js +11 -0
  170. package/Misc/typeStore.js.map +1 -1
  171. package/NOTICE.md +8 -0
  172. package/Particles/baseParticleSystem.js +3 -0
  173. package/Particles/baseParticleSystem.js.map +1 -1
  174. package/Particles/computeShaderParticleSystem.d.ts +2 -2
  175. package/Particles/computeShaderParticleSystem.js.map +1 -1
  176. package/Physics/v1/Plugins/ammoJSPlugin.js +39 -10
  177. package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
  178. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +4 -0
  179. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  180. package/PostProcesses/imageProcessingPostProcess.js +14 -5
  181. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  182. package/Rendering/GlobalIllumination/giRSMManager.d.ts +6 -0
  183. package/Rendering/GlobalIllumination/giRSMManager.js +15 -1
  184. package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
  185. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +22 -20
  186. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  187. package/Rendering/renderingGroup.js +1 -1
  188. package/Rendering/renderingGroup.js.map +1 -1
  189. package/Shaders/ShadersInclude/imageProcessingFunctions.js +8 -5
  190. package/Shaders/ShadersInclude/imageProcessingFunctions.js.map +1 -1
  191. package/Shaders/ShadersInclude/screenSpaceRayTrace.js +8 -0
  192. package/Shaders/ShadersInclude/screenSpaceRayTrace.js.map +1 -1
  193. package/Shaders/lod.fragment.d.ts +5 -0
  194. package/Shaders/lod.fragment.js +12 -0
  195. package/Shaders/lod.fragment.js.map +1 -0
  196. package/Shaders/lodCube.fragment.d.ts +5 -0
  197. package/Shaders/lodCube.fragment.js +30 -0
  198. package/Shaders/lodCube.fragment.js.map +1 -0
  199. package/Shaders/screenSpaceReflection2.fragment.js +7 -1
  200. package/Shaders/screenSpaceReflection2.fragment.js.map +1 -1
  201. package/Shaders/ssao2.fragment.js +1 -1
  202. package/Shaders/ssao2.fragment.js.map +1 -1
  203. package/XR/features/WebXRNearInteraction.d.ts +6 -0
  204. package/XR/features/WebXRNearInteraction.js +14 -2
  205. package/XR/features/WebXRNearInteraction.js.map +1 -1
  206. package/XR/webXRManagedOutputCanvas.d.ts +2 -0
  207. package/XR/webXRManagedOutputCanvas.js +14 -6
  208. package/XR/webXRManagedOutputCanvas.js.map +1 -1
  209. package/abstractScene.js +3 -0
  210. package/abstractScene.js.map +1 -1
  211. package/assets/glslang/glslang.js +113 -0
  212. package/assets/glslang/glslang.wasm +0 -0
  213. package/assets/twgsl/twgsl.js +53 -0
  214. package/assets/twgsl/twgsl.wasm +0 -0
  215. package/package.json +1 -1
  216. package/scene.js +3 -0
  217. package/scene.js.map +1 -1
  218. package/Engines/Extensions/engine.externalTexture.d.ts +0 -18
  219. package/Engines/Extensions/engine.externalTexture.js +0 -10
  220. package/Engines/Extensions/engine.externalTexture.js.map +0 -1
  221. package/Engines/Extensions/engine.storageBuffer.d.ts +0 -39
  222. package/Engines/Extensions/engine.storageBuffer.js +0 -16
  223. package/Engines/Extensions/engine.storageBuffer.js.map +0 -1
  224. package/Engines/Extensions/engine.textureSampler.d.ts +0 -12
  225. package/Engines/Extensions/engine.textureSampler.js +0 -6
  226. package/Engines/Extensions/engine.textureSampler.js.map +0 -1
  227. package/Engines/WebGPU/Extensions/engine.externalTexture.d.ts +0 -28
  228. package/Engines/WebGPU/Extensions/engine.externalTexture.js +0 -18
  229. package/Engines/WebGPU/Extensions/engine.externalTexture.js.map +0 -1
  230. package/Engines/WebGPU/Extensions/engine.storageBuffer.d.ts +0 -50
  231. package/Engines/WebGPU/Extensions/engine.storageBuffer.js +0 -88
  232. package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +0 -1
  233. package/Engines/WebGPU/Extensions/engine.textureSampler.d.ts +0 -22
  234. package/Engines/WebGPU/Extensions/engine.textureSampler.js +0 -9
  235. package/Engines/WebGPU/Extensions/engine.textureSampler.js.map +0 -1
@@ -132,7 +132,7 @@ export class Vector2 {
132
132
  * @returns a new Vector2 set with the addition of the current Vector2 and the given one coordinates
133
133
  */
134
134
  add(otherVector) {
135
- return new this.constructor(this.x + otherVector.x, this.y + otherVector.y);
135
+ return new Vector2(this.x + otherVector.x, this.y + otherVector.y);
136
136
  }
137
137
  /**
138
138
  * Sets the "result" coordinates with the addition of the current Vector2 and the given one coordinates
@@ -175,7 +175,7 @@ export class Vector2 {
175
175
  * @returns a new Vector2
176
176
  */
177
177
  addVector3(otherVector) {
178
- return new this.constructor(this.x + otherVector.x, this.y + otherVector.y);
178
+ return new Vector2(this.x + otherVector.x, this.y + otherVector.y);
179
179
  }
180
180
  /**
181
181
  * Gets a new Vector2 set with the subtracted coordinates of the given one from the current Vector2
@@ -184,7 +184,7 @@ export class Vector2 {
184
184
  * @returns a new Vector2
185
185
  */
186
186
  subtract(otherVector) {
187
- return new this.constructor(this.x - otherVector.x, this.y - otherVector.y);
187
+ return new Vector2(this.x - otherVector.x, this.y - otherVector.y);
188
188
  }
189
189
  /**
190
190
  * Sets the "result" coordinates with the subtraction of the given one from the current Vector2 coordinates.
@@ -227,7 +227,7 @@ export class Vector2 {
227
227
  * @returns a new Vector2
228
228
  */
229
229
  multiply(otherVector) {
230
- return new this.constructor(this.x * otherVector.x, this.y * otherVector.y);
230
+ return new Vector2(this.x * otherVector.x, this.y * otherVector.y);
231
231
  }
232
232
  /**
233
233
  * Sets "result" coordinates with the multiplication of the current Vector2 and the given one coordinates
@@ -249,7 +249,7 @@ export class Vector2 {
249
249
  * @returns a new Vector2
250
250
  */
251
251
  multiplyByFloats(x, y) {
252
- return new this.constructor(this.x * x, this.y * y);
252
+ return new Vector2(this.x * x, this.y * y);
253
253
  }
254
254
  /**
255
255
  * Returns a new Vector2 set with the Vector2 coordinates divided by the given one coordinates
@@ -258,7 +258,7 @@ export class Vector2 {
258
258
  * @returns a new Vector2
259
259
  */
260
260
  divide(otherVector) {
261
- return new this.constructor(this.x / otherVector.x, this.y / otherVector.y);
261
+ return new Vector2(this.x / otherVector.x, this.y / otherVector.y);
262
262
  }
263
263
  /**
264
264
  * Sets the "result" coordinates with the Vector2 divided by the given one coordinates
@@ -328,7 +328,7 @@ export class Vector2 {
328
328
  * @returns the resulting Vector2
329
329
  */
330
330
  subtractFromFloats(x, y) {
331
- return new this.constructor(this.x - x, this.y - y);
331
+ return new Vector2(this.x - x, this.y - y);
332
332
  }
333
333
  /**
334
334
  * Subtracts the given floats from the current Vector2 coordinates and set the given vector "result" with this result
@@ -338,14 +338,16 @@ export class Vector2 {
338
338
  * @returns the result
339
339
  */
340
340
  subtractFromFloatsToRef(x, y, result) {
341
- return result.copyFromFloats(this.x - x, this.y - y);
341
+ result.x = this.x - x;
342
+ result.y = this.y - y;
343
+ return result;
342
344
  }
343
345
  /**
344
346
  * Gets a new Vector2 with current Vector2 negated coordinates
345
347
  * @returns a new Vector2
346
348
  */
347
349
  negate() {
348
- return new this.constructor(-this.x, -this.y);
350
+ return new Vector2(-this.x, -this.y);
349
351
  }
350
352
  /**
351
353
  * Negate this vector in place
@@ -364,7 +366,9 @@ export class Vector2 {
364
366
  * @returns the result
365
367
  */
366
368
  negateToRef(result) {
367
- return result.copyFromFloats(this.x * -1, this.y * -1);
369
+ result.x = -this.x;
370
+ result.y = -this.y;
371
+ return result;
368
372
  }
369
373
  /**
370
374
  * Multiply the Vector2 coordinates by
@@ -384,7 +388,7 @@ export class Vector2 {
384
388
  * @returns a new Vector2
385
389
  */
386
390
  scale(scale) {
387
- return new this.constructor(this.x * scale, this.y * scale);
391
+ return new Vector2(this.x * scale, this.y * scale);
388
392
  }
389
393
  /**
390
394
  * Scale the current Vector2 values by a factor to a given Vector2
@@ -445,7 +449,7 @@ export class Vector2 {
445
449
  * @returns a new Vector2
446
450
  */
447
451
  floor() {
448
- return new this.constructor(Math.floor(this.x), Math.floor(this.y));
452
+ return new Vector2(Math.floor(this.x), Math.floor(this.y));
449
453
  }
450
454
  /**
451
455
  * Gets the current Vector2's floored values and stores them in result
@@ -464,7 +468,7 @@ export class Vector2 {
464
468
  * @returns a new Vector2
465
469
  */
466
470
  fract() {
467
- return new this.constructor(this.x - Math.floor(this.x), this.y - Math.floor(this.y));
471
+ return new Vector2(this.x - Math.floor(this.x), this.y - Math.floor(this.y));
468
472
  }
469
473
  /**
470
474
  * Gets the current Vector2's fractional values and stores them in result
@@ -533,21 +537,22 @@ export class Vector2 {
533
537
  * @returns the new Vector2
534
538
  */
535
539
  normalizeToNew() {
536
- const normalized = new this.constructor();
540
+ const normalized = new Vector2();
537
541
  this.normalizeToRef(normalized);
538
542
  return normalized;
539
543
  }
540
544
  /**
541
545
  * Normalize the current Vector2 to the reference
542
- * @param reference define the Vector to update
546
+ * @param result define the Vector to update
543
547
  * @returns the updated Vector2
544
548
  */
545
- normalizeToRef(reference) {
549
+ normalizeToRef(result) {
546
550
  const len = this.length();
547
551
  if (len === 0) {
548
- return reference.copyFrom(this);
552
+ result.x = this.x;
553
+ result.y = this.y;
549
554
  }
550
- return this.scaleToRef(1.0 / len, reference);
555
+ return this.scaleToRef(1.0 / len, result);
551
556
  }
552
557
  /**
553
558
  * Gets a new Vector2 copied from the Vector2
@@ -555,7 +560,7 @@ export class Vector2 {
555
560
  * @returns a new Vector2
556
561
  */
557
562
  clone() {
558
- return new this.constructor(this.x, this.y);
563
+ return new Vector2(this.x, this.y);
559
564
  }
560
565
  /**
561
566
  * Gets the dot product of the current vector and the vector "otherVector"
@@ -662,7 +667,7 @@ export class Vector2 {
662
667
  (-value1.y + value3.y) * amount +
663
668
  (2.0 * value1.y - 5.0 * value2.y + 4.0 * value3.y - value4.y) * squared +
664
669
  (-value1.y + 3.0 * value2.y - 3.0 * value3.y + value4.y) * cubed);
665
- return new value1.constructor(x, y);
670
+ return new Vector2(x, y);
666
671
  }
667
672
  /**
668
673
  * Sets reference with same the coordinates than "value" ones if the vector "value" is in the square defined by "min" and "max".
@@ -692,7 +697,7 @@ export class Vector2 {
692
697
  static Clamp(value, min, max) {
693
698
  const x = Clamp(value.x, min.x, max.x);
694
699
  const y = Clamp(value.y, min.y, max.y);
695
- return new value.constructor(x, y);
700
+ return new Vector2(x, y);
696
701
  }
697
702
  /**
698
703
  * Returns a new Vector2 located for "amount" (float) on the Hermite spline defined by the vectors "value1", "value2", "tangent1", "tangent2"
@@ -713,7 +718,7 @@ export class Vector2 {
713
718
  const part4 = cubed - squared;
714
719
  const x = value1.x * part1 + value2.x * part2 + tangent1.x * part3 + tangent2.x * part4;
715
720
  const y = value1.y * part1 + value2.y * part2 + tangent1.y * part3 + tangent2.y * part4;
716
- return new value1.constructor(x, y);
721
+ return new Vector2(x, y);
717
722
  }
718
723
  /**
719
724
  * Returns a new Vector2 which is the 1st derivative of the Hermite spline defined by the vectors "value1", "value2", "tangent1", "tangent2".
@@ -726,9 +731,7 @@ export class Vector2 {
726
731
  * @returns 1st derivative
727
732
  */
728
733
  static Hermite1stDerivative(value1, tangent1, value2, tangent2, time) {
729
- const result = new value1.constructor();
730
- this.Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result);
731
- return result;
734
+ return this.Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, new Vector2());
732
735
  }
733
736
  /**
734
737
  * Returns a new Vector2 which is the 1st derivative of the Hermite spline defined by the vectors "value1", "value2", "tangent1", "tangent2".
@@ -758,7 +761,7 @@ export class Vector2 {
758
761
  static Lerp(start, end, amount) {
759
762
  const x = start.x + (end.x - start.x) * amount;
760
763
  const y = start.y + (end.y - start.y) * amount;
761
- return new start.constructor(x, y);
764
+ return new Vector2(x, y);
762
765
  }
763
766
  /**
764
767
  * Gets the dot product of the vector "left" and the vector "right"
@@ -777,9 +780,7 @@ export class Vector2 {
777
780
  * @returns a new Vector2
778
781
  */
779
782
  static Normalize(vector) {
780
- const result = new vector.constructor();
781
- Vector2.NormalizeToRef(vector, result);
782
- return result;
783
+ return Vector2.NormalizeToRef(vector, new Vector2());
783
784
  }
784
785
  /**
785
786
  * Normalize a given vector into a second one
@@ -802,7 +803,7 @@ export class Vector2 {
802
803
  static Minimize(left, right) {
803
804
  const x = left.x < right.x ? left.x : right.x;
804
805
  const y = left.y < right.y ? left.y : right.y;
805
- return new left.constructor(x, y);
806
+ return new Vector2(x, y);
806
807
  }
807
808
  /**
808
809
  * Gets a new Vector2 set with the maximal coordinate values from the "left" and "right" vectors
@@ -814,7 +815,7 @@ export class Vector2 {
814
815
  static Maximize(left, right) {
815
816
  const x = left.x > right.x ? left.x : right.x;
816
817
  const y = left.y > right.y ? left.y : right.y;
817
- return new left.constructor(x, y);
818
+ return new Vector2(x, y);
818
819
  }
819
820
  /**
820
821
  * Gets a new Vector2 set with the transformed coordinates of the given vector by the given transformation matrix
@@ -824,9 +825,7 @@ export class Vector2 {
824
825
  * @returns a new Vector2
825
826
  */
826
827
  static Transform(vector, transformation) {
827
- const result = new vector.constructor();
828
- Vector2.TransformToRef(vector, transformation, result);
829
- return result;
828
+ return Vector2.TransformToRef(vector, transformation, new Vector2());
830
829
  }
831
830
  /**
832
831
  * Transforms the given vector coordinates by the given transformation matrix and stores the result in the vector "result" coordinates
@@ -891,8 +890,7 @@ export class Vector2 {
891
890
  * @returns a new Vector2
892
891
  */
893
892
  static Center(value1, value2) {
894
- const result = new value1.constructor();
895
- return Vector2.CenterToRef(value1, value2, result);
893
+ return Vector2.CenterToRef(value1, value2, new Vector2());
896
894
  }
897
895
  /**
898
896
  * Gets the center of the vectors "value1" and "value2" and stores the result in the vector "ref"
@@ -1079,7 +1077,7 @@ export class Vector3 {
1079
1077
  * @returns the resulting Vector3
1080
1078
  */
1081
1079
  add(otherVector) {
1082
- return new this.constructor(this._x + otherVector._x, this._y + otherVector._y, this._z + otherVector._z);
1080
+ return new Vector3(this._x + otherVector._x, this._y + otherVector._y, this._z + otherVector._z);
1083
1081
  }
1084
1082
  /**
1085
1083
  * Adds the current Vector3 to the given one and stores the result in the vector "result"
@@ -1111,7 +1109,7 @@ export class Vector3 {
1111
1109
  * @returns the resulting Vector3
1112
1110
  */
1113
1111
  subtract(otherVector) {
1114
- return new this.constructor(this._x - otherVector._x, this._y - otherVector._y, this._z - otherVector._z);
1112
+ return new Vector3(this._x - otherVector._x, this._y - otherVector._y, this._z - otherVector._z);
1115
1113
  }
1116
1114
  /**
1117
1115
  * Subtracts the given vector from the current Vector3 and stores the result in the vector "result".
@@ -1132,7 +1130,7 @@ export class Vector3 {
1132
1130
  * @returns the resulting Vector3
1133
1131
  */
1134
1132
  subtractFromFloats(x, y, z) {
1135
- return new this.constructor(this._x - x, this._y - y, this._z - z);
1133
+ return new Vector3(this._x - x, this._y - y, this._z - z);
1136
1134
  }
1137
1135
  /**
1138
1136
  * Subtracts the given floats from the current Vector3 coordinates and set the given vector "result" with this result
@@ -1152,7 +1150,7 @@ export class Vector3 {
1152
1150
  * @returns a new Vector3
1153
1151
  */
1154
1152
  negate() {
1155
- return new this.constructor(-this._x, -this._y, -this._z);
1153
+ return new Vector3(-this._x, -this._y, -this._z);
1156
1154
  }
1157
1155
  /**
1158
1156
  * Negate this vector in place
@@ -1195,7 +1193,7 @@ export class Vector3 {
1195
1193
  * @returns a new Vector3
1196
1194
  */
1197
1195
  scale(scale) {
1198
- return new this.constructor(this._x * scale, this._y * scale, this._z * scale);
1196
+ return new Vector3(this._x * scale, this._y * scale, this._z * scale);
1199
1197
  }
1200
1198
  /**
1201
1199
  * Multiplies the current Vector3 coordinates by the float "scale" and stores the result in the given vector "result" coordinates
@@ -1278,7 +1276,7 @@ export class Vector3 {
1278
1276
  * @returns a new Vector3
1279
1277
  */
1280
1278
  applyRotationQuaternion(q) {
1281
- return this.applyRotationQuaternionToRef(q, new this.constructor());
1279
+ return this.applyRotationQuaternionToRef(q, new Vector3());
1282
1280
  }
1283
1281
  /**
1284
1282
  * Scale the current Vector3 values by a factor and add the result to a given Vector3
@@ -1298,9 +1296,7 @@ export class Vector3 {
1298
1296
  * @returns the projected vector3
1299
1297
  */
1300
1298
  projectOnPlane(plane, origin) {
1301
- const result = new this.constructor();
1302
- this.projectOnPlaneToRef(plane, origin, result);
1303
- return result;
1299
+ return this.projectOnPlaneToRef(plane, origin, new Vector3());
1304
1300
  }
1305
1301
  /**
1306
1302
  * Projects the current point Vector3 to a plane along a ray starting from a specified origin and passing through the current point Vector3.
@@ -1401,7 +1397,7 @@ export class Vector3 {
1401
1397
  * @returns the new Vector3
1402
1398
  */
1403
1399
  multiplyByFloats(x, y, z) {
1404
- return new this.constructor(this._x * x, this._y * y, this._z * z);
1400
+ return new Vector3(this._x * x, this._y * y, this._z * z);
1405
1401
  }
1406
1402
  /**
1407
1403
  * Returns a new Vector3 set with the result of the division of the current Vector3 coordinates by the given ones
@@ -1410,7 +1406,7 @@ export class Vector3 {
1410
1406
  * @returns the new Vector3
1411
1407
  */
1412
1408
  divide(otherVector) {
1413
- return new this.constructor(this._x / otherVector._x, this._y / otherVector._y, this._z / otherVector._z);
1409
+ return new Vector3(this._x / otherVector._x, this._y / otherVector._y, this._z / otherVector._z);
1414
1410
  }
1415
1411
  /**
1416
1412
  * Divides the current Vector3 coordinates by the given ones and stores the result in the given vector "result"
@@ -1547,7 +1543,7 @@ export class Vector3 {
1547
1543
  * @returns a new Vector3
1548
1544
  */
1549
1545
  floor() {
1550
- return new this.constructor(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z));
1546
+ return new Vector3(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z));
1551
1547
  }
1552
1548
  /**
1553
1549
  * Gets the current Vector3's fractional values and stores them in result
@@ -1567,7 +1563,7 @@ export class Vector3 {
1567
1563
  * @returns a new Vector3
1568
1564
  */
1569
1565
  fract() {
1570
- return new this.constructor(this.x - Math.floor(this._x), this.y - Math.floor(this._y), this.z - Math.floor(this._z));
1566
+ return new Vector3(this.x - Math.floor(this._x), this.y - Math.floor(this._y), this.z - Math.floor(this._z));
1571
1567
  }
1572
1568
  // Properties
1573
1569
  /**
@@ -1653,8 +1649,7 @@ export class Vector3 {
1653
1649
  * @returns the cross product
1654
1650
  */
1655
1651
  cross(other) {
1656
- const result = new this.constructor();
1657
- return Vector3.CrossToRef(this, other, result);
1652
+ return Vector3.CrossToRef(this, other, new Vector3());
1658
1653
  }
1659
1654
  /**
1660
1655
  * Normalize the current Vector3 with the given input length.
@@ -1675,9 +1670,7 @@ export class Vector3 {
1675
1670
  * @returns the new Vector3
1676
1671
  */
1677
1672
  normalizeToNew() {
1678
- const normalized = new this.constructor(0, 0, 0);
1679
- this.normalizeToRef(normalized);
1680
- return normalized;
1673
+ return this.normalizeToRef(new Vector3());
1681
1674
  }
1682
1675
  /**
1683
1676
  * Normalize the current Vector3 to the reference
@@ -1698,7 +1691,7 @@ export class Vector3 {
1698
1691
  * @returns the new Vector3
1699
1692
  */
1700
1693
  clone() {
1701
- return new this.constructor(this._x, this._y, this._z);
1694
+ return new Vector3(this._x, this._y, this._z);
1702
1695
  }
1703
1696
  /**
1704
1697
  * Copies the given vector coordinates to the current Vector3 ones
@@ -2217,7 +2210,7 @@ export class Vector3 {
2217
2210
  (-value1._z + value3._z) * amount +
2218
2211
  (2.0 * value1._z - 5.0 * value2._z + 4.0 * value3._z - value4._z) * squared +
2219
2212
  (-value1._z + 3.0 * value2._z - 3.0 * value3._z + value4._z) * cubed);
2220
- return new value1.constructor(x, y, z);
2213
+ return new Vector3(x, y, z);
2221
2214
  }
2222
2215
  /**
2223
2216
  * Returns a new Vector3 set with the coordinates of "value", if the vector "value" is in the cube defined by the vectors "min" and "max"
@@ -2230,7 +2223,7 @@ export class Vector3 {
2230
2223
  * @returns the new Vector3
2231
2224
  */
2232
2225
  static Clamp(value, min, max) {
2233
- const result = new value.constructor();
2226
+ const result = new Vector3();
2234
2227
  Vector3.ClampToRef(value, min, max, result);
2235
2228
  return result;
2236
2229
  }
@@ -2289,7 +2282,7 @@ export class Vector3 {
2289
2282
  const x = value1._x * part1 + value2._x * part2 + tangent1._x * part3 + tangent2._x * part4;
2290
2283
  const y = value1._y * part1 + value2._y * part2 + tangent1._y * part3 + tangent2._y * part4;
2291
2284
  const z = value1._z * part1 + value2._z * part2 + tangent1._z * part3 + tangent2._z * part4;
2292
- return new value1.constructor(x, y, z);
2285
+ return new Vector3(x, y, z);
2293
2286
  }
2294
2287
  /**
2295
2288
  * Returns a new Vector3 which is the 1st derivative of the Hermite spline defined by the vectors "value1", "value2", "tangent1", "tangent2".
@@ -2302,7 +2295,7 @@ export class Vector3 {
2302
2295
  * @returns 1st derivative
2303
2296
  */
2304
2297
  static Hermite1stDerivative(value1, tangent1, value2, tangent2, time) {
2305
- const result = new value1.constructor();
2298
+ const result = new Vector3();
2306
2299
  this.Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result);
2307
2300
  return result;
2308
2301
  }
@@ -2334,7 +2327,7 @@ export class Vector3 {
2334
2327
  * @returns the new Vector3
2335
2328
  */
2336
2329
  static Lerp(start, end, amount) {
2337
- const result = new start.constructor(0, 0, 0);
2330
+ const result = new Vector3(0, 0, 0);
2338
2331
  Vector3.LerpToRef(start, end, amount, result);
2339
2332
  return result;
2340
2333
  }
@@ -2381,7 +2374,7 @@ export class Vector3 {
2381
2374
  * @returns the cross product
2382
2375
  */
2383
2376
  static Cross(left, right) {
2384
- const result = new left.constructor();
2377
+ const result = new Vector3();
2385
2378
  Vector3.CrossToRef(left, right, result);
2386
2379
  return result;
2387
2380
  }
@@ -2433,7 +2426,7 @@ export class Vector3 {
2433
2426
  * @returns the new Vector3
2434
2427
  */
2435
2428
  static Project(vector, world, transform, viewport) {
2436
- const result = new vector.constructor();
2429
+ const result = new Vector3();
2437
2430
  Vector3.ProjectToRef(vector, world, transform, viewport, result);
2438
2431
  return result;
2439
2432
  }
@@ -2521,7 +2514,7 @@ export class Vector3 {
2521
2514
  * @returns the new Vector3
2522
2515
  */
2523
2516
  static Unproject(source, viewportWidth, viewportHeight, world, view, projection) {
2524
- const result = new source.constructor();
2517
+ const result = new Vector3();
2525
2518
  Vector3.UnprojectToRef(source, viewportWidth, viewportHeight, world, view, projection, result);
2526
2519
  return result;
2527
2520
  }
@@ -2580,7 +2573,7 @@ export class Vector3 {
2580
2573
  * @returns the new Vector3
2581
2574
  */
2582
2575
  static Minimize(left, right) {
2583
- const min = new left.constructor();
2576
+ const min = new Vector3();
2584
2577
  min.copyFrom(left);
2585
2578
  min.minimizeInPlace(right);
2586
2579
  return min;
@@ -2593,7 +2586,7 @@ export class Vector3 {
2593
2586
  * @returns the new Vector3
2594
2587
  */
2595
2588
  static Maximize(left, right) {
2596
- const max = new left.constructor();
2589
+ const max = new Vector3();
2597
2590
  max.copyFrom(left);
2598
2591
  max.maximizeInPlace(right);
2599
2592
  return max;
@@ -2795,7 +2788,7 @@ export class Vector3 {
2795
2788
  * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/target_align
2796
2789
  */
2797
2790
  static RotationFromAxis(axis1, axis2, axis3) {
2798
- const rotation = new axis1.constructor();
2791
+ const rotation = new Vector3();
2799
2792
  Vector3.RotationFromAxisToRef(axis1, axis2, axis3, rotation);
2800
2793
  return rotation;
2801
2794
  }
@@ -2951,7 +2944,7 @@ export class Vector4 {
2951
2944
  * @returns the resulting vector
2952
2945
  */
2953
2946
  add(otherVector) {
2954
- return new this.constructor(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z, this.w + otherVector.w);
2947
+ return new Vector4(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z, this.w + otherVector.w);
2955
2948
  }
2956
2949
  /**
2957
2950
  * Updates the given vector "result" with the result of the addition of the current Vector4 and the given one.
@@ -2984,7 +2977,7 @@ export class Vector4 {
2984
2977
  * @returns the new vector with the result
2985
2978
  */
2986
2979
  subtract(otherVector) {
2987
- return new this.constructor(this.x - otherVector.x, this.y - otherVector.y, this.z - otherVector.z, this.w - otherVector.w);
2980
+ return new Vector4(this.x - otherVector.x, this.y - otherVector.y, this.z - otherVector.z, this.w - otherVector.w);
2988
2981
  }
2989
2982
  /**
2990
2983
  * Sets the given vector "result" with the result of the subtraction of the given vector from the current Vector4.
@@ -3008,7 +3001,7 @@ export class Vector4 {
3008
3001
  * @returns new vector containing the result
3009
3002
  */
3010
3003
  subtractFromFloats(x, y, z, w) {
3011
- return new this.constructor(this.x - x, this.y - y, this.z - z, this.w - w);
3004
+ return new Vector4(this.x - x, this.y - y, this.z - z, this.w - w);
3012
3005
  }
3013
3006
  /**
3014
3007
  * Sets the given vector "result" set with the result of the subtraction of the given floats from the current Vector4 coordinates.
@@ -3031,7 +3024,7 @@ export class Vector4 {
3031
3024
  * @returns a new vector with the negated values
3032
3025
  */
3033
3026
  negate() {
3034
- return new this.constructor(-this.x, -this.y, -this.z, -this.w);
3027
+ return new Vector4(-this.x, -this.y, -this.z, -this.w);
3035
3028
  }
3036
3029
  /**
3037
3030
  * Negate this vector in place
@@ -3050,7 +3043,11 @@ export class Vector4 {
3050
3043
  * @returns the result
3051
3044
  */
3052
3045
  negateToRef(result) {
3053
- return result.copyFromFloats(this.x * -1, this.y * -1, this.z * -1, this.w * -1);
3046
+ result.x = -this.x;
3047
+ result.y = -this.y;
3048
+ result.z = -this.z;
3049
+ result.w = -this.w;
3050
+ return result;
3054
3051
  }
3055
3052
  /**
3056
3053
  * Multiplies the current Vector4 coordinates by scale (float).
@@ -3070,7 +3067,7 @@ export class Vector4 {
3070
3067
  * @returns a new vector with the result
3071
3068
  */
3072
3069
  scale(scale) {
3073
- return new this.constructor(this.x * scale, this.y * scale, this.z * scale, this.w * scale);
3070
+ return new Vector4(this.x * scale, this.y * scale, this.z * scale, this.w * scale);
3074
3071
  }
3075
3072
  /**
3076
3073
  * Sets the given vector "result" with the current Vector4 coordinates multiplied by scale (float).
@@ -3148,7 +3145,7 @@ export class Vector4 {
3148
3145
  * @returns resulting new vector
3149
3146
  */
3150
3147
  multiply(otherVector) {
3151
- return new this.constructor(this.x * otherVector.x, this.y * otherVector.y, this.z * otherVector.z, this.w * otherVector.w);
3148
+ return new Vector4(this.x * otherVector.x, this.y * otherVector.y, this.z * otherVector.z, this.w * otherVector.w);
3152
3149
  }
3153
3150
  /**
3154
3151
  * Updates the given vector "result" with the multiplication result of the current Vector4 and the given one.
@@ -3172,7 +3169,7 @@ export class Vector4 {
3172
3169
  * @returns resulting new vector
3173
3170
  */
3174
3171
  multiplyByFloats(x, y, z, w) {
3175
- return new this.constructor(this.x * x, this.y * y, this.z * z, this.w * w);
3172
+ return new Vector4(this.x * x, this.y * y, this.z * z, this.w * w);
3176
3173
  }
3177
3174
  /**
3178
3175
  * Returns a new Vector4 set with the division result of the current Vector4 by the given one.
@@ -3180,7 +3177,7 @@ export class Vector4 {
3180
3177
  * @returns resulting new vector
3181
3178
  */
3182
3179
  divide(otherVector) {
3183
- return new this.constructor(this.x / otherVector.x, this.y / otherVector.y, this.z / otherVector.z, this.w / otherVector.w);
3180
+ return new Vector4(this.x / otherVector.x, this.y / otherVector.y, this.z / otherVector.z, this.w / otherVector.w);
3184
3181
  }
3185
3182
  /**
3186
3183
  * Updates the given vector "result" with the division result of the current Vector4 by the given one.
@@ -3290,7 +3287,7 @@ export class Vector4 {
3290
3287
  * @returns a new Vector4
3291
3288
  */
3292
3289
  floor() {
3293
- return new this.constructor(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z), Math.floor(this.w));
3290
+ return new Vector4(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z), Math.floor(this.w));
3294
3291
  }
3295
3292
  /**
3296
3293
  * Gets the current Vector4's fractional values and stores them in result
@@ -3309,7 +3306,7 @@ export class Vector4 {
3309
3306
  * @returns a new Vector4
3310
3307
  */
3311
3308
  fract() {
3312
- return new this.constructor(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z), this.w - Math.floor(this.w));
3309
+ return new Vector4(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z), this.w - Math.floor(this.w));
3313
3310
  }
3314
3311
  // Properties
3315
3312
  /**
@@ -3351,9 +3348,7 @@ export class Vector4 {
3351
3348
  * @returns the new Vector4
3352
3349
  */
3353
3350
  normalizeToNew() {
3354
- const normalized = new this.constructor();
3355
- this.normalizeToRef(normalized);
3356
- return normalized;
3351
+ return this.normalizeToRef(new Vector4());
3357
3352
  }
3358
3353
  /**
3359
3354
  * Normalize the current Vector4 to the reference
@@ -3363,7 +3358,11 @@ export class Vector4 {
3363
3358
  normalizeToRef(reference) {
3364
3359
  const len = this.length();
3365
3360
  if (len === 0 || len === 1.0) {
3366
- return reference.copyFrom(this);
3361
+ reference.x = this.x;
3362
+ reference.y = this.y;
3363
+ reference.z = this.z;
3364
+ reference.w = this.w;
3365
+ return reference;
3367
3366
  }
3368
3367
  return this.scaleToRef(1.0 / len, reference);
3369
3368
  }
@@ -3379,7 +3378,7 @@ export class Vector4 {
3379
3378
  * @returns the new cloned vector
3380
3379
  */
3381
3380
  clone() {
3382
- return new this.constructor(this.x, this.y, this.z, this.w);
3381
+ return new Vector4(this.x, this.y, this.z, this.w);
3383
3382
  }
3384
3383
  /**
3385
3384
  * Updates the current Vector4 with the given one coordinates.
@@ -3521,7 +3520,11 @@ export class Vector4 {
3521
3520
  * @returns the ref with random values between min and max
3522
3521
  */
3523
3522
  static RandomToRef(min = 0, max = 1, ref) {
3524
- return ref.copyFromFloats(RandomRange(min, max), RandomRange(min, max), RandomRange(min, max), RandomRange(min, max));
3523
+ ref.x = RandomRange(min, max);
3524
+ ref.y = RandomRange(min, max);
3525
+ ref.z = RandomRange(min, max);
3526
+ ref.w = RandomRange(min, max);
3527
+ return ref;
3525
3528
  }
3526
3529
  /**
3527
3530
  * Returns a new Vector4 set with the coordinates of "value", if the vector "value" is in the cube defined by the vectors "min" and "max"
@@ -3533,9 +3536,7 @@ export class Vector4 {
3533
3536
  * @returns the new Vector4
3534
3537
  */
3535
3538
  static Clamp(value, min, max) {
3536
- const result = new value.constructor();
3537
- Vector4.ClampToRef(value, min, max, result);
3538
- return result;
3539
+ return Vector4.ClampToRef(value, min, max, new Vector4());
3539
3540
  }
3540
3541
  /**
3541
3542
  * Sets the given vector "result" with the coordinates of "value", if the vector "value" is in the cube defined by the vectors "min" and "max"
@@ -3548,7 +3549,11 @@ export class Vector4 {
3548
3549
  * @returns result input
3549
3550
  */
3550
3551
  static ClampToRef(value, min, max, result) {
3551
- return result.copyFromFloats(Clamp(value.x, min.x, max.x), Clamp(value.y, min.y, max.y), Clamp(value.z, min.z, max.z), Clamp(value.w, min.w, max.w));
3552
+ result.x = Clamp(value.x, min.x, max.x);
3553
+ result.y = Clamp(value.y, min.y, max.y);
3554
+ result.z = Clamp(value.z, min.z, max.z);
3555
+ result.w = Clamp(value.w, min.w, max.w);
3556
+ return result;
3552
3557
  }
3553
3558
  /**
3554
3559
  * Checks if a given vector is inside a specific range
@@ -3573,9 +3578,7 @@ export class Vector4 {
3573
3578
  * @returns the vector
3574
3579
  */
3575
3580
  static Normalize(vector) {
3576
- const result = Vector4.Zero();
3577
- Vector4.NormalizeToRef(vector, result);
3578
- return result;
3581
+ return Vector4.NormalizeToRef(vector, new Vector4());
3579
3582
  }
3580
3583
  /**
3581
3584
  * Updates the given vector "result" from the normalization of the given one.
@@ -3594,7 +3597,7 @@ export class Vector4 {
3594
3597
  * @returns a new vector with the minimum of the left and right vector values
3595
3598
  */
3596
3599
  static Minimize(left, right) {
3597
- const min = new left.constructor();
3600
+ const min = new Vector4();
3598
3601
  min.copyFrom(left);
3599
3602
  min.minimizeInPlace(right);
3600
3603
  return min;
@@ -3606,7 +3609,7 @@ export class Vector4 {
3606
3609
  * @returns a new vector with the maximum of the left and right vector values
3607
3610
  */
3608
3611
  static Maximize(left, right) {
3609
- const max = new left.constructor();
3612
+ const max = new Vector4();
3610
3613
  max.copyFrom(left);
3611
3614
  max.maximizeInPlace(right);
3612
3615
  return max;
@@ -3640,7 +3643,7 @@ export class Vector4 {
3640
3643
  * @returns the center between the two vectors
3641
3644
  */
3642
3645
  static Center(value1, value2) {
3643
- return Vector4.CenterToRef(value1, value2, Vector4.Zero());
3646
+ return Vector4.CenterToRef(value1, value2, new Vector4());
3644
3647
  }
3645
3648
  /**
3646
3649
  * Gets the center of the vectors "value1" and "value2" and stores the result in the vector "ref"
@@ -3650,7 +3653,11 @@ export class Vector4 {
3650
3653
  * @returns ref
3651
3654
  */
3652
3655
  static CenterToRef(value1, value2, ref) {
3653
- return ref.copyFromFloats((value1.x + value2.x) / 2, (value1.y + value2.y) / 2, (value1.z + value2.z) / 2, (value1.w + value2.w) / 2);
3656
+ ref.x = (value1.x + value2.x) / 2;
3657
+ ref.y = (value1.y + value2.y) / 2;
3658
+ ref.z = (value1.z + value2.z) / 2;
3659
+ ref.w = (value1.w + value2.w) / 2;
3660
+ return ref;
3654
3661
  }
3655
3662
  /**
3656
3663
  * Returns a new Vector4 set with the result of the transformation by the given matrix of the given vector.
@@ -3661,9 +3668,7 @@ export class Vector4 {
3661
3668
  * @returns the transformed Vector4
3662
3669
  */
3663
3670
  static TransformCoordinates(vector, transformation) {
3664
- const result = Vector4.Zero();
3665
- Vector4.TransformCoordinatesToRef(vector, transformation, result);
3666
- return result;
3671
+ return Vector4.TransformCoordinatesToRef(vector, transformation, new Vector4());
3667
3672
  }
3668
3673
  /**
3669
3674
  * Sets the given vector "result" coordinates with the result of the transformation by the given matrix of the given vector
@@ -3709,9 +3714,7 @@ export class Vector4 {
3709
3714
  * @returns the new vector
3710
3715
  */
3711
3716
  static TransformNormal(vector, transformation) {
3712
- const result = new vector.constructor();
3713
- Vector4.TransformNormalToRef(vector, transformation, result);
3714
- return result;
3717
+ return Vector4.TransformNormalToRef(vector, transformation, new Vector4());
3715
3718
  }
3716
3719
  /**
3717
3720
  * Sets the given vector "result" with the result of the normal transformation by the given matrix of the given vector.
@@ -3767,7 +3770,7 @@ export class Vector4 {
3767
3770
  * @returns the dot product
3768
3771
  */
3769
3772
  static Dot(left, right) {
3770
- return left.dot(right);
3773
+ return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w;
3771
3774
  }
3772
3775
  }
3773
3776
  Vector4._ZeroReadOnly = Vector4.Zero();
@@ -3913,7 +3916,7 @@ export class Quaternion {
3913
3916
  * @returns a new quaternion copied from the current one
3914
3917
  */
3915
3918
  clone() {
3916
- return new this.constructor(this._x, this._y, this._z, this._w);
3919
+ return new Quaternion(this._x, this._y, this._z, this._w);
3917
3920
  }
3918
3921
  /**
3919
3922
  * Copy a quaternion to the current one
@@ -3968,7 +3971,7 @@ export class Quaternion {
3968
3971
  * @returns a new quaternion as the addition result of the given one and the current quaternion
3969
3972
  */
3970
3973
  add(other) {
3971
- return new this.constructor(this._x + other._x, this._y + other._y, this._z + other._z, this._w + other._w);
3974
+ return new Quaternion(this._x + other._x, this._y + other._y, this._z + other._z, this._w + other._w);
3972
3975
  }
3973
3976
  /**
3974
3977
  * Add a quaternion to the current one
@@ -4009,7 +4012,7 @@ export class Quaternion {
4009
4012
  return result;
4010
4013
  }
4011
4014
  subtractFromFloats(x, y, z, w) {
4012
- return this.subtractFromFloatsToRef(x, y, z, w, new this.constructor());
4015
+ return this.subtractFromFloatsToRef(x, y, z, w, new Quaternion());
4013
4016
  }
4014
4017
  subtractFromFloatsToRef(x, y, z, w, result) {
4015
4018
  result._x = this._x - x;
@@ -4026,7 +4029,7 @@ export class Quaternion {
4026
4029
  * @returns a new quaternion as the subtraction result of the given one from the current one
4027
4030
  */
4028
4031
  subtract(other) {
4029
- return new this.constructor(this._x - other._x, this._y - other._y, this._z - other._z, this._w - other._w);
4032
+ return new Quaternion(this._x - other._x, this._y - other._y, this._z - other._z, this._w - other._w);
4030
4033
  }
4031
4034
  /**
4032
4035
  * Subtract a quaternion to the current one
@@ -4049,7 +4052,7 @@ export class Quaternion {
4049
4052
  * @returns a new quaternion set by multiplying the current quaternion coordinates by the float "scale"
4050
4053
  */
4051
4054
  scale(value) {
4052
- return new this.constructor(this._x * value, this._y * value, this._z * value, this._w * value);
4055
+ return new Quaternion(this._x * value, this._y * value, this._z * value, this._w * value);
4053
4056
  }
4054
4057
  /**
4055
4058
  * Scale the current quaternion values by a factor and stores the result to a given quaternion
@@ -4102,7 +4105,7 @@ export class Quaternion {
4102
4105
  * @returns a new quaternion set as the multiplication result of the current one with the given one "q1"
4103
4106
  */
4104
4107
  multiply(q1) {
4105
- const result = new this.constructor(0, 0, 0, 1.0);
4108
+ const result = new Quaternion(0, 0, 0, 1.0);
4106
4109
  this.multiplyToRef(q1, result);
4107
4110
  return result;
4108
4111
  }
@@ -4188,7 +4191,7 @@ export class Quaternion {
4188
4191
  throw new ReferenceError("Can not maximize a quaternion");
4189
4192
  }
4190
4193
  negate() {
4191
- return this.negateToRef(new this.constructor());
4194
+ return this.negateToRef(new Quaternion());
4192
4195
  }
4193
4196
  negateInPlace() {
4194
4197
  this._x = -this._x;
@@ -4265,7 +4268,7 @@ export class Quaternion {
4265
4268
  * @returns a new quaternion
4266
4269
  */
4267
4270
  conjugate() {
4268
- return new this.constructor(-this._x, -this._y, -this._z, this._w);
4271
+ return new Quaternion(-this._x, -this._y, -this._z, this._w);
4269
4272
  }
4270
4273
  /**
4271
4274
  * Returns the inverse of the current quaternion
@@ -4337,7 +4340,7 @@ export class Quaternion {
4337
4340
  * @returns the normalized quaternion
4338
4341
  */
4339
4342
  normalizeToNew() {
4340
- const normalized = new this.constructor(0, 0, 0, 1);
4343
+ const normalized = new Quaternion(0, 0, 0, 1);
4341
4344
  this.normalizeToRef(normalized);
4342
4345
  return normalized;
4343
4346
  }
@@ -4542,7 +4545,7 @@ export class Quaternion {
4542
4545
  * @returns a new quaternion as the inverted current quaternion
4543
4546
  */
4544
4547
  static Inverse(q) {
4545
- return new q.constructor(-q._x, -q._y, -q._z, q._w);
4548
+ return new Quaternion(-q._x, -q._y, -q._z, q._w);
4546
4549
  }
4547
4550
  /**
4548
4551
  * Inverse a given quaternion
@@ -4940,7 +4943,7 @@ export class Quaternion {
4940
4943
  const y = value1._y * part1 + value2._y * part2 + tangent1._y * part3 + tangent2._y * part4;
4941
4944
  const z = value1._z * part1 + value2._z * part2 + tangent1._z * part3 + tangent2._z * part4;
4942
4945
  const w = value1._w * part1 + value2._w * part2 + tangent1._w * part3 + tangent2._w * part4;
4943
- return new value1.constructor(x, y, z, w);
4946
+ return new Quaternion(x, y, z, w);
4944
4947
  }
4945
4948
  /**
4946
4949
  * Returns a new Quaternion which is the 1st derivative of the Hermite spline defined by the quaternions "value1", "value2", "tangent1", "tangent2".
@@ -4953,7 +4956,7 @@ export class Quaternion {
4953
4956
  * @returns 1st derivative
4954
4957
  */
4955
4958
  static Hermite1stDerivative(value1, tangent1, value2, tangent2, time) {
4956
- const result = new value1.constructor();
4959
+ const result = new Quaternion();
4957
4960
  this.Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result);
4958
4961
  return result;
4959
4962
  }
@@ -5007,7 +5010,7 @@ export class Quaternion {
5007
5010
  * @returns the new Quaternion
5008
5011
  */
5009
5012
  static Clamp(value, min, max) {
5010
- const result = new value.constructor();
5013
+ const result = new Quaternion();
5011
5014
  Quaternion.ClampToRef(value, min, max, result);
5012
5015
  return result;
5013
5016
  }
@@ -5343,7 +5346,7 @@ export class Matrix {
5343
5346
  * @returns a new matrix as the addition of the current matrix and the given one
5344
5347
  */
5345
5348
  add(other) {
5346
- const result = new this.constructor();
5349
+ const result = new Matrix();
5347
5350
  this.addToRef(other, result);
5348
5351
  return result;
5349
5352
  }
@@ -5420,7 +5423,7 @@ export class Matrix {
5420
5423
  return this;
5421
5424
  }
5422
5425
  subtractFromFloats(...floats) {
5423
- return this.subtractFromFloatsToRef(...floats, new this.constructor());
5426
+ return this.subtractFromFloatsToRef(...floats, new Matrix());
5424
5427
  }
5425
5428
  subtractFromFloatsToRef(...args) {
5426
5429
  const result = args.pop(), m = this._m, resultM = result._m, values = args;
@@ -5631,7 +5634,7 @@ export class Matrix {
5631
5634
  * @returns a new matrix set with the multiplication result of the current Matrix and the given one
5632
5635
  */
5633
5636
  multiply(other) {
5634
- const result = new this.constructor();
5637
+ const result = new Matrix();
5635
5638
  this.multiplyToRef(other, result);
5636
5639
  return result;
5637
5640
  }
@@ -5734,7 +5737,7 @@ export class Matrix {
5734
5737
  return this;
5735
5738
  }
5736
5739
  divide(other) {
5737
- return this.divideToRef(other, new this.constructor());
5740
+ return this.divideToRef(other, new Matrix());
5738
5741
  }
5739
5742
  divideToRef(other, result) {
5740
5743
  const m = this._m, otherM = other.m, resultM = result._m;
@@ -5785,7 +5788,7 @@ export class Matrix {
5785
5788
  return this;
5786
5789
  }
5787
5790
  negate() {
5788
- return this.negateToRef(new this.constructor());
5791
+ return this.negateToRef(new Matrix());
5789
5792
  }
5790
5793
  negateInPlace() {
5791
5794
  const m = this._m;
@@ -5856,7 +5859,7 @@ export class Matrix {
5856
5859
  return true;
5857
5860
  }
5858
5861
  floor() {
5859
- return this.floorToRef(new this.constructor());
5862
+ return this.floorToRef(new Matrix());
5860
5863
  }
5861
5864
  floorToRef(result) {
5862
5865
  const m = this._m, resultM = result._m;
@@ -5867,7 +5870,7 @@ export class Matrix {
5867
5870
  return result;
5868
5871
  }
5869
5872
  fract() {
5870
- return this.fractToRef(new this.constructor());
5873
+ return this.fractToRef(new Matrix());
5871
5874
  }
5872
5875
  fractToRef(result) {
5873
5876
  const m = this._m, resultM = result._m;
@@ -5883,7 +5886,7 @@ export class Matrix {
5883
5886
  * @returns a new matrix from the current matrix
5884
5887
  */
5885
5888
  clone() {
5886
- const matrix = new this.constructor();
5889
+ const matrix = new Matrix();
5887
5890
  matrix.copyFrom(this);
5888
5891
  return matrix;
5889
5892
  }
@@ -6018,7 +6021,7 @@ export class Matrix {
6018
6021
  * @returns the new transposed matrix
6019
6022
  */
6020
6023
  transpose() {
6021
- const result = new this.constructor();
6024
+ const result = new Matrix();
6022
6025
  Matrix.TransposeToRef(this, result);
6023
6026
  return result;
6024
6027
  }
@@ -6060,7 +6063,7 @@ export class Matrix {
6060
6063
  * @returns a new matrix
6061
6064
  */
6062
6065
  scale(scale) {
6063
- const result = new this.constructor();
6066
+ const result = new Matrix();
6064
6067
  this.scaleToRef(scale, result);
6065
6068
  return result;
6066
6069
  }
@@ -6117,7 +6120,7 @@ export class Matrix {
6117
6120
  * @returns a new matrix sets to the extracted rotation matrix from the current one
6118
6121
  */
6119
6122
  getRotationMatrix() {
6120
- const result = new this.constructor();
6123
+ const result = new Matrix();
6121
6124
  this.getRotationMatrixToRef(result);
6122
6125
  return result;
6123
6126
  }
@@ -6391,7 +6394,7 @@ export class Matrix {
6391
6394
  * @returns the new matrix
6392
6395
  */
6393
6396
  static Invert(source) {
6394
- const result = new source.constructor();
6397
+ const result = new Matrix();
6395
6398
  source.invertToRef(result);
6396
6399
  return result;
6397
6400
  }
@@ -6647,7 +6650,7 @@ export class Matrix {
6647
6650
  * @returns the new matrix
6648
6651
  */
6649
6652
  static Lerp(startValue, endValue, gradient) {
6650
- const result = new startValue.constructor();
6653
+ const result = new Matrix();
6651
6654
  Matrix.LerpToRef(startValue, endValue, gradient, result);
6652
6655
  return result;
6653
6656
  }
@@ -6683,7 +6686,7 @@ export class Matrix {
6683
6686
  * @returns the new matrix
6684
6687
  */
6685
6688
  static DecomposeLerp(startValue, endValue, gradient) {
6686
- const result = new startValue.constructor();
6689
+ const result = new Matrix();
6687
6690
  Matrix.DecomposeLerpToRef(startValue, endValue, gradient, result);
6688
6691
  return result;
6689
6692
  }
@@ -7250,7 +7253,7 @@ export class Matrix {
7250
7253
  const cx = viewport.x;
7251
7254
  const cy = viewport.y;
7252
7255
  const viewportMatrix = Matrix.FromValues(cw / 2.0, 0.0, 0.0, 0.0, 0.0, -ch / 2.0, 0.0, 0.0, 0.0, 0.0, zmax - zmin, 0.0, cx + cw / 2.0, ch / 2.0 + cy, zmin, 1.0);
7253
- const matrix = new world.constructor();
7256
+ const matrix = new Matrix();
7254
7257
  world.multiplyToRef(view, matrix);
7255
7258
  matrix.multiplyToRef(projection, matrix);
7256
7259
  return matrix.multiplyToRef(viewportMatrix, matrix);
@@ -7282,7 +7285,7 @@ export class Matrix {
7282
7285
  * @returns the new matrix
7283
7286
  */
7284
7287
  static Transpose(matrix) {
7285
- const result = new matrix.constructor();
7288
+ const result = new Matrix();
7286
7289
  Matrix.TransposeToRef(matrix, result);
7287
7290
  return result;
7288
7291
  }