@babylonjs/core 6.45.0 → 6.46.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/Animations/animation.js +1 -1
  2. package/Animations/animation.js.map +1 -1
  3. package/BakedVertexAnimation/bakedVertexAnimationManager.js +2 -1
  4. package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
  5. package/Bones/skeleton.js +2 -2
  6. package/Bones/skeleton.js.map +1 -1
  7. package/Cameras/camera.d.ts +3 -3
  8. package/Cameras/camera.js +2 -1
  9. package/Cameras/camera.js.map +1 -1
  10. package/Cameras/cameraInputsManager.js +1 -1
  11. package/Cameras/cameraInputsManager.js.map +1 -1
  12. package/Cameras/targetCamera.js +4 -0
  13. package/Cameras/targetCamera.js.map +1 -1
  14. package/Compute/computeShader.d.ts +4 -2
  15. package/Compute/computeShader.js +7 -3
  16. package/Compute/computeShader.js.map +1 -1
  17. package/Debug/directionalLightFrustumViewer.js +6 -6
  18. package/Debug/directionalLightFrustumViewer.js.map +1 -1
  19. package/Engines/Extensions/engine.computeShader.d.ts +2 -1
  20. package/Engines/Extensions/engine.computeShader.js +1 -0
  21. package/Engines/Extensions/engine.computeShader.js.map +1 -1
  22. package/Engines/Extensions/engine.rawTexture.js +3 -3
  23. package/Engines/Extensions/engine.rawTexture.js.map +1 -1
  24. package/Engines/Native/nativePipelineContext.js +1 -1
  25. package/Engines/Native/nativePipelineContext.js.map +1 -1
  26. package/Engines/WebGL/webGLPipelineContext.js +1 -1
  27. package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
  28. package/Engines/WebGPU/webgpuComputeContext.js +7 -3
  29. package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
  30. package/Engines/engine.d.ts +1 -1
  31. package/Engines/thinEngine.js +2 -2
  32. package/Engines/thinEngine.js.map +1 -1
  33. package/Engines/webgpuEngine.js +2 -15
  34. package/Engines/webgpuEngine.js.map +1 -1
  35. package/Layers/glowLayer.js +2 -1
  36. package/Layers/glowLayer.js.map +1 -1
  37. package/Layers/highlightLayer.js +2 -1
  38. package/Layers/highlightLayer.js.map +1 -1
  39. package/Lights/light.js +2 -1
  40. package/Lights/light.js.map +1 -1
  41. package/Loading/Plugins/babylonFileLoader.js +9 -0
  42. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  43. package/Loading/sceneLoader.d.ts +6 -1
  44. package/Loading/sceneLoader.js +6 -5
  45. package/Loading/sceneLoader.js.map +1 -1
  46. package/Materials/Background/backgroundMaterial.js +2 -1
  47. package/Materials/Background/backgroundMaterial.js.map +1 -1
  48. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +1 -1
  49. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  50. package/Materials/Node/nodeMaterial.d.ts +2 -1
  51. package/Materials/Node/nodeMaterial.js +5 -1
  52. package/Materials/Node/nodeMaterial.js.map +1 -1
  53. package/Materials/PBR/pbrBaseMaterial.d.ts +1 -1
  54. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  55. package/Materials/PBR/pbrMaterial.js +2 -1
  56. package/Materials/PBR/pbrMaterial.js.map +1 -1
  57. package/Materials/PBR/pbrMetallicRoughnessMaterial.js +2 -1
  58. package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
  59. package/Materials/PBR/pbrSpecularGlossinessMaterial.js +2 -1
  60. package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
  61. package/Materials/Textures/baseTexture.js +2 -1
  62. package/Materials/Textures/baseTexture.js.map +1 -1
  63. package/Materials/Textures/cubeTexture.js +2 -1
  64. package/Materials/Textures/cubeTexture.js.map +1 -1
  65. package/Materials/Textures/rawCubeTexture.js +1 -1
  66. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  67. package/Materials/Textures/texture.js +2 -1
  68. package/Materials/Textures/texture.js.map +1 -1
  69. package/Materials/colorCurves.d.ts +1 -1
  70. package/Materials/colorCurves.functions.d.ts +5 -0
  71. package/Materials/colorCurves.functions.js +8 -0
  72. package/Materials/colorCurves.functions.js.map +1 -0
  73. package/Materials/colorCurves.js +8 -8
  74. package/Materials/colorCurves.js.map +1 -1
  75. package/Materials/fresnelParameters.js +1 -1
  76. package/Materials/fresnelParameters.js.map +1 -1
  77. package/Materials/imageProcessingConfiguration.d.ts +3 -48
  78. package/Materials/imageProcessingConfiguration.defines.d.ts +46 -0
  79. package/Materials/imageProcessingConfiguration.defines.js +27 -0
  80. package/Materials/imageProcessingConfiguration.defines.js.map +1 -0
  81. package/Materials/imageProcessingConfiguration.functions.d.ts +13 -0
  82. package/Materials/imageProcessingConfiguration.functions.js +41 -0
  83. package/Materials/imageProcessingConfiguration.functions.js.map +1 -0
  84. package/Materials/imageProcessingConfiguration.js +18 -69
  85. package/Materials/imageProcessingConfiguration.js.map +1 -1
  86. package/Materials/material.js +2 -1
  87. package/Materials/material.js.map +1 -1
  88. package/Materials/materialHelper.d.ts +33 -33
  89. package/Materials/materialHelper.js +244 -286
  90. package/Materials/materialHelper.js.map +1 -1
  91. package/Materials/materialPluginBase.js +2 -1
  92. package/Materials/materialPluginBase.js.map +1 -1
  93. package/Materials/materialStencilState.js +2 -1
  94. package/Materials/materialStencilState.js.map +1 -1
  95. package/Materials/shaderMaterial.js +1 -1
  96. package/Materials/shaderMaterial.js.map +1 -1
  97. package/Materials/standardMaterial.d.ts +1 -1
  98. package/Materials/standardMaterial.js +2 -1
  99. package/Materials/standardMaterial.js.map +1 -1
  100. package/Materials/uniformBuffer.js +2 -2
  101. package/Materials/uniformBuffer.js.map +1 -1
  102. package/Maths/math.color.d.ts +392 -66
  103. package/Maths/math.color.js +541 -65
  104. package/Maths/math.color.js.map +1 -1
  105. package/Maths/math.like.d.ts +17 -28
  106. package/Maths/math.like.js.map +1 -1
  107. package/Maths/math.plane.d.ts +2 -1
  108. package/Maths/math.plane.js.map +1 -1
  109. package/Maths/math.polar.d.ts +1 -1
  110. package/Maths/math.polar.js.map +1 -1
  111. package/Maths/math.scalar.d.ts +6 -6
  112. package/Maths/math.scalar.functions.d.ts +51 -0
  113. package/Maths/math.scalar.functions.js +80 -0
  114. package/Maths/math.scalar.functions.js.map +1 -0
  115. package/Maths/math.scalar.js +48 -73
  116. package/Maths/math.scalar.js.map +1 -1
  117. package/Maths/math.vector.d.ts +571 -72
  118. package/Maths/math.vector.js +917 -119
  119. package/Maths/math.vector.js.map +1 -1
  120. package/Maths/math.viewport.d.ts +2 -1
  121. package/Maths/math.viewport.js.map +1 -1
  122. package/Maths/tensor.d.ts +411 -0
  123. package/Maths/tensor.js +3 -0
  124. package/Maths/tensor.js.map +1 -0
  125. package/Meshes/Node/Blocks/Set/setColorsBlock.js +20 -4
  126. package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
  127. package/Meshes/Node/nodeGeometry.js +2 -1
  128. package/Meshes/Node/nodeGeometry.js.map +1 -1
  129. package/Meshes/mesh.js +2 -2
  130. package/Meshes/mesh.js.map +1 -1
  131. package/Meshes/mesh.vertexData.d.ts +4 -0
  132. package/Meshes/mesh.vertexData.js +10 -0
  133. package/Meshes/mesh.vertexData.js.map +1 -1
  134. package/Meshes/transformNode.js +2 -1
  135. package/Meshes/transformNode.js.map +1 -1
  136. package/Misc/arrayTools.d.ts +2 -19
  137. package/Misc/arrayTools.js.map +1 -1
  138. package/Misc/decorators.d.ts +0 -80
  139. package/Misc/decorators.functions.d.ts +7 -0
  140. package/Misc/decorators.functions.js +52 -0
  141. package/Misc/decorators.functions.js.map +1 -0
  142. package/Misc/decorators.js +2 -318
  143. package/Misc/decorators.js.map +1 -1
  144. package/Misc/decorators.serialization.d.ts +81 -0
  145. package/Misc/decorators.serialization.js +269 -0
  146. package/Misc/decorators.serialization.js.map +1 -0
  147. package/Misc/index.d.ts +1 -0
  148. package/Misc/index.js +1 -0
  149. package/Misc/index.js.map +1 -1
  150. package/Misc/sceneRecorder.js +1 -1
  151. package/Misc/sceneRecorder.js.map +1 -1
  152. package/Misc/sceneSerializer.js +8 -1
  153. package/Misc/sceneSerializer.js.map +1 -1
  154. package/Misc/tools.functions.d.ts +14 -0
  155. package/Misc/tools.functions.js +23 -0
  156. package/Misc/tools.functions.js.map +1 -0
  157. package/Misc/tools.js +5 -6
  158. package/Misc/tools.js.map +1 -1
  159. package/Morph/morphTarget.js +2 -1
  160. package/Morph/morphTarget.js.map +1 -1
  161. package/Particles/EmitterTypes/boxParticleEmitter.js +8 -8
  162. package/Particles/EmitterTypes/boxParticleEmitter.js.map +1 -1
  163. package/Particles/baseParticleSystem.d.ts +8 -11
  164. package/Particles/baseParticleSystem.js +9 -40
  165. package/Particles/baseParticleSystem.js.map +1 -1
  166. package/Particles/gpuParticleSystem.d.ts +71 -1
  167. package/Particles/gpuParticleSystem.js +102 -1
  168. package/Particles/gpuParticleSystem.js.map +1 -1
  169. package/Particles/particle.d.ts +3 -3
  170. package/Particles/particle.js +3 -3
  171. package/Particles/particle.js.map +1 -1
  172. package/Particles/particleSystem.d.ts +81 -455
  173. package/Particles/particleSystem.functions.d.ts +61 -0
  174. package/Particles/particleSystem.functions.js +79 -0
  175. package/Particles/particleSystem.functions.js.map +1 -0
  176. package/Particles/particleSystem.js +390 -1984
  177. package/Particles/particleSystem.js.map +1 -1
  178. package/Particles/thinParticleSystem.d.ts +485 -0
  179. package/Particles/thinParticleSystem.js +1768 -0
  180. package/Particles/thinParticleSystem.js.map +1 -0
  181. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +2 -1
  182. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  183. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +2 -1
  184. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  185. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +2 -1
  186. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  187. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js +2 -1
  188. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
  189. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +2 -1
  190. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
  191. package/PostProcesses/blackAndWhitePostProcess.js +2 -1
  192. package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
  193. package/PostProcesses/blurPostProcess.js +2 -1
  194. package/PostProcesses/blurPostProcess.js.map +1 -1
  195. package/PostProcesses/chromaticAberrationPostProcess.js +2 -1
  196. package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
  197. package/PostProcesses/colorCorrectionPostProcess.js +2 -1
  198. package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
  199. package/PostProcesses/convolutionPostProcess.js +2 -1
  200. package/PostProcesses/convolutionPostProcess.js.map +1 -1
  201. package/PostProcesses/displayPassPostProcess.js +1 -1
  202. package/PostProcesses/displayPassPostProcess.js.map +1 -1
  203. package/PostProcesses/filterPostProcess.js +2 -1
  204. package/PostProcesses/filterPostProcess.js.map +1 -1
  205. package/PostProcesses/fxaaPostProcess.js +1 -1
  206. package/PostProcesses/fxaaPostProcess.js.map +1 -1
  207. package/PostProcesses/grainPostProcess.js +2 -1
  208. package/PostProcesses/grainPostProcess.js.map +1 -1
  209. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  210. package/PostProcesses/motionBlurPostProcess.js +2 -1
  211. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  212. package/PostProcesses/passPostProcess.js +1 -1
  213. package/PostProcesses/passPostProcess.js.map +1 -1
  214. package/PostProcesses/postProcess.js +2 -1
  215. package/PostProcesses/postProcess.js.map +1 -1
  216. package/PostProcesses/refractionPostProcess.js +2 -1
  217. package/PostProcesses/refractionPostProcess.js.map +1 -1
  218. package/PostProcesses/screenSpaceCurvaturePostProcess.js +2 -1
  219. package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
  220. package/PostProcesses/screenSpaceReflectionPostProcess.js +2 -1
  221. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  222. package/PostProcesses/sharpenPostProcess.js +2 -1
  223. package/PostProcesses/sharpenPostProcess.js.map +1 -1
  224. package/Probes/reflectionProbe.js +2 -1
  225. package/Probes/reflectionProbe.js.map +1 -1
  226. package/Sprites/spriteManager.d.ts +4 -0
  227. package/Sprites/spriteManager.js.map +1 -1
  228. package/XR/features/WebXRControllerTeleportation.d.ts +9 -0
  229. package/XR/features/WebXRControllerTeleportation.js +75 -31
  230. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  231. package/node.js +2 -1
  232. package/node.js.map +1 -1
  233. package/package.json +1 -1
  234. package/types.d.ts +105 -0
  235. package/types.js.map +1 -1
@@ -1,5 +1,6 @@
1
1
  import { Scalar } from "./math.scalar.js";
2
- import { ToLinearSpace, ToGammaSpace } from "./math.constants.js";
2
+ import { Clamp, ToHex } from "./math.scalar.functions.js";
3
+ import { ToLinearSpace, ToGammaSpace, Epsilon } from "./math.constants.js";
3
4
  import { ArrayTools } from "../Misc/arrayTools.js";
4
5
  import { RegisterClass } from "../Misc/typeStore.js";
5
6
  function colorChannelToLinearSpace(color) {
@@ -122,20 +123,132 @@ export class Color3 {
122
123
  * @returns the new Color3 object
123
124
  */
124
125
  multiply(otherColor) {
125
- return new Color3(this.r * otherColor.r, this.g * otherColor.g, this.b * otherColor.b);
126
+ return new this.constructor(this.r * otherColor.r, this.g * otherColor.g, this.b * otherColor.b);
126
127
  }
127
128
  /**
128
129
  * Multiply the rgb values of the Color3 and the given Color3 and stores the result in the object "result"
129
130
  * @param otherColor defines the second operand
130
131
  * @param result defines the Color3 object where to store the result
131
- * @returns the current Color3
132
+ * @returns the result Color3
132
133
  */
133
134
  multiplyToRef(otherColor, result) {
134
135
  result.r = this.r * otherColor.r;
135
136
  result.g = this.g * otherColor.g;
136
137
  result.b = this.b * otherColor.b;
138
+ return result;
139
+ }
140
+ /**
141
+ * Multiplies the current Color3 coordinates by the given ones
142
+ * @param otherColor defines the second operand
143
+ * @returns the current updated Color3
144
+ */
145
+ multiplyInPlace(otherColor) {
146
+ this.r *= otherColor.r;
147
+ this.g *= otherColor.g;
148
+ this.b *= otherColor.b;
149
+ return this;
150
+ }
151
+ /**
152
+ * Returns a new Color3 set with the result of the multiplication of the current Color3 coordinates by the given floats
153
+ * @param r defines the r coordinate of the operand
154
+ * @param g defines the g coordinate of the operand
155
+ * @param b defines the b coordinate of the operand
156
+ * @returns the new Color3
157
+ */
158
+ multiplyByFloats(r, g, b) {
159
+ return new this.constructor(this.r * r, this.g * g, this.b * b);
160
+ }
161
+ /**
162
+ * @internal
163
+ * Do not use
164
+ */
165
+ divide(_other) {
166
+ throw new ReferenceError("Can not divide a color");
167
+ }
168
+ /**
169
+ * @internal
170
+ * Do not use
171
+ */
172
+ divideToRef(_other, _result) {
173
+ throw new ReferenceError("Can not divide a color");
174
+ }
175
+ /**
176
+ * @internal
177
+ * Do not use
178
+ */
179
+ divideInPlace(_other) {
180
+ throw new ReferenceError("Can not divide a color");
181
+ }
182
+ /**
183
+ * Updates the current Color3 with the minimal coordinate values between its and the given color ones
184
+ * @param other defines the second operand
185
+ * @returns the current updated Color3
186
+ */
187
+ minimizeInPlace(other) {
188
+ return this.minimizeInPlaceFromFloats(other.r, other.g, other.b);
189
+ }
190
+ /**
191
+ * Updates the current Color3 with the maximal coordinate values between its and the given color ones.
192
+ * @param other defines the second operand
193
+ * @returns the current updated Color3
194
+ */
195
+ maximizeInPlace(other) {
196
+ return this.maximizeInPlaceFromFloats(other.r, other.g, other.b);
197
+ }
198
+ /**
199
+ * Updates the current Color3 with the minimal coordinate values between its and the given coordinates
200
+ * @param r defines the r coordinate of the operand
201
+ * @param g defines the g coordinate of the operand
202
+ * @param b defines the b coordinate of the operand
203
+ * @returns the current updated Color3
204
+ */
205
+ minimizeInPlaceFromFloats(r, g, b) {
206
+ this.r = Math.min(r, this.r);
207
+ this.g = Math.min(g, this.g);
208
+ this.b = Math.min(b, this.b);
209
+ return this;
210
+ }
211
+ /**
212
+ * Updates the current Color3 with the maximal coordinate values between its and the given coordinates.
213
+ * @param r defines the r coordinate of the operand
214
+ * @param g defines the g coordinate of the operand
215
+ * @param b defines the b coordinate of the operand
216
+ * @returns the current updated Color3
217
+ */
218
+ maximizeInPlaceFromFloats(r, g, b) {
219
+ this.r = Math.max(r, this.r);
220
+ this.g = Math.max(g, this.g);
221
+ this.b = Math.max(b, this.b);
137
222
  return this;
138
223
  }
224
+ /**
225
+ * @internal
226
+ * Do not use
227
+ */
228
+ floorToRef(_result) {
229
+ throw new ReferenceError("Can not floor a color");
230
+ }
231
+ /**
232
+ * @internal
233
+ * Do not use
234
+ */
235
+ floor() {
236
+ throw new ReferenceError("Can not floor a color");
237
+ }
238
+ /**
239
+ * @internal
240
+ * Do not use
241
+ */
242
+ fractToRef(_result) {
243
+ throw new ReferenceError("Can not fract a color");
244
+ }
245
+ /**
246
+ * @internal
247
+ * Do not use
248
+ */
249
+ fract() {
250
+ throw new ReferenceError("Can not fract a color");
251
+ }
139
252
  /**
140
253
  * Determines equality between Color3 objects
141
254
  * @param otherColor defines the second operand
@@ -144,6 +257,16 @@ export class Color3 {
144
257
  equals(otherColor) {
145
258
  return otherColor && this.r === otherColor.r && this.g === otherColor.g && this.b === otherColor.b;
146
259
  }
260
+ /**
261
+ * Alias for equalsToFloats
262
+ * @param r red color component
263
+ * @param g green color component
264
+ * @param b blue color component
265
+ * @returns boolean
266
+ */
267
+ equalsFloats(r, g, b) {
268
+ return this.equalsToFloats(r, g, b);
269
+ }
147
270
  /**
148
271
  * Determines equality between the current Color3 object and a set of r,b,g values
149
272
  * @param r defines the red component to check
@@ -151,16 +274,46 @@ export class Color3 {
151
274
  * @param b defines the blue component to check
152
275
  * @returns true if the rgb values are equal to the given ones
153
276
  */
154
- equalsFloats(r, g, b) {
277
+ equalsToFloats(r, g, b) {
155
278
  return this.r === r && this.g === g && this.b === b;
156
279
  }
280
+ /**
281
+ * Returns true if the current Color3 and the given color coordinates are distant less than epsilon
282
+ * @param otherColor defines the second operand
283
+ * @param epsilon defines the minimal distance to define values as equals
284
+ * @returns true if both colors are distant less than epsilon
285
+ */
286
+ equalsWithEpsilon(otherColor, epsilon = Epsilon) {
287
+ return Scalar.WithinEpsilon(this.r, otherColor.r, epsilon) && Scalar.WithinEpsilon(this.g, otherColor.g, epsilon) && Scalar.WithinEpsilon(this.b, otherColor.b, epsilon);
288
+ }
289
+ /**
290
+ * @internal
291
+ * Do not use
292
+ */
293
+ negate() {
294
+ throw new ReferenceError("Can not negate a color");
295
+ }
296
+ /**
297
+ * @internal
298
+ * Do not use
299
+ */
300
+ negateInPlace() {
301
+ throw new ReferenceError("Can not negate a color");
302
+ }
303
+ /**
304
+ * @internal
305
+ * Do not use
306
+ */
307
+ negateToRef(_result) {
308
+ throw new ReferenceError("Can not negate a color");
309
+ }
157
310
  /**
158
311
  * Creates a new Color3 with the current Color3 values multiplied by scale
159
312
  * @param scale defines the scaling factor to apply
160
313
  * @returns a new Color3 object
161
314
  */
162
315
  scale(scale) {
163
- return new Color3(this.r * scale, this.g * scale, this.b * scale);
316
+ return new this.constructor(this.r * scale, this.g * scale, this.b * scale);
164
317
  }
165
318
  /**
166
319
  * Multiplies the Color3 values by the float "scale"
@@ -177,38 +330,38 @@ export class Color3 {
177
330
  * Multiplies the rgb values by scale and stores the result into "result"
178
331
  * @param scale defines the scaling factor
179
332
  * @param result defines the Color3 object where to store the result
180
- * @returns the unmodified current Color3
333
+ * @returns the result Color3
181
334
  */
182
335
  scaleToRef(scale, result) {
183
336
  result.r = this.r * scale;
184
337
  result.g = this.g * scale;
185
338
  result.b = this.b * scale;
186
- return this;
339
+ return result;
187
340
  }
188
341
  /**
189
342
  * Scale the current Color3 values by a factor and add the result to a given Color3
190
343
  * @param scale defines the scale factor
191
344
  * @param result defines color to store the result into
192
- * @returns the unmodified current Color3
345
+ * @returns the result Color3
193
346
  */
194
347
  scaleAndAddToRef(scale, result) {
195
348
  result.r += this.r * scale;
196
349
  result.g += this.g * scale;
197
350
  result.b += this.b * scale;
198
- return this;
351
+ return result;
199
352
  }
200
353
  /**
201
354
  * Clamps the rgb values by the min and max values and stores the result into "result"
202
355
  * @param min defines minimum clamping value (default is 0)
203
356
  * @param max defines maximum clamping value (default is 1)
204
357
  * @param result defines color to store the result into
205
- * @returns the original Color3
358
+ * @returns the result Color3
206
359
  */
207
360
  clampToRef(min = 0, max = 1, result) {
208
- result.r = Scalar.Clamp(this.r, min, max);
209
- result.g = Scalar.Clamp(this.g, min, max);
210
- result.b = Scalar.Clamp(this.b, min, max);
211
- return this;
361
+ result.r = Clamp(this.r, min, max);
362
+ result.g = Clamp(this.g, min, max);
363
+ result.b = Clamp(this.b, min, max);
364
+ return result;
212
365
  }
213
366
  /**
214
367
  * Creates a new Color3 set with the added values of the current Color3 and of the given one
@@ -216,7 +369,31 @@ export class Color3 {
216
369
  * @returns the new Color3
217
370
  */
218
371
  add(otherColor) {
219
- return new Color3(this.r + otherColor.r, this.g + otherColor.g, this.b + otherColor.b);
372
+ return new this.constructor(this.r + otherColor.r, this.g + otherColor.g, this.b + otherColor.b);
373
+ }
374
+ /**
375
+ * Adds the given color to the current Color3
376
+ * @param otherColor defines the second operand
377
+ * @returns the current updated Color3
378
+ */
379
+ addInPlace(otherColor) {
380
+ this.r += otherColor.r;
381
+ this.g += otherColor.g;
382
+ this.b += otherColor.b;
383
+ return this;
384
+ }
385
+ /**
386
+ * Adds the given coordinates to the current Color3
387
+ * @param r defines the r coordinate of the operand
388
+ * @param g defines the g coordinate of the operand
389
+ * @param b defines the b coordinate of the operand
390
+ * @returns the current updated Color3
391
+ */
392
+ addInPlaceFromFloats(r, g, b) {
393
+ this.r += r;
394
+ this.g += g;
395
+ this.b += b;
396
+ return this;
220
397
  }
221
398
  /**
222
399
  * Stores the result of the addition of the current Color3 and given one rgb values into "result"
@@ -228,7 +405,7 @@ export class Color3 {
228
405
  result.r = this.r + otherColor.r;
229
406
  result.g = this.g + otherColor.g;
230
407
  result.b = this.b + otherColor.b;
231
- return this;
408
+ return result;
232
409
  }
233
410
  /**
234
411
  * Returns a new Color3 set with the subtracted values of the given one from the current Color3
@@ -236,7 +413,7 @@ export class Color3 {
236
413
  * @returns the new Color3
237
414
  */
238
415
  subtract(otherColor) {
239
- return new Color3(this.r - otherColor.r, this.g - otherColor.g, this.b - otherColor.b);
416
+ return new this.constructor(this.r - otherColor.r, this.g - otherColor.g, this.b - otherColor.b);
240
417
  }
241
418
  /**
242
419
  * Stores the result of the subtraction of given one from the current Color3 rgb values into "result"
@@ -248,14 +425,46 @@ export class Color3 {
248
425
  result.r = this.r - otherColor.r;
249
426
  result.g = this.g - otherColor.g;
250
427
  result.b = this.b - otherColor.b;
428
+ return result;
429
+ }
430
+ /**
431
+ * Subtract the given color from the current Color3
432
+ * @param otherColor defines the second operand
433
+ * @returns the current updated Color3
434
+ */
435
+ subtractInPlace(otherColor) {
436
+ this.r -= otherColor.r;
437
+ this.g -= otherColor.g;
438
+ this.b -= otherColor.b;
251
439
  return this;
252
440
  }
441
+ /**
442
+ * Returns a new Color3 set with the subtraction of the given floats from the current Color3 coordinates
443
+ * @param r defines the r coordinate of the operand
444
+ * @param g defines the g coordinate of the operand
445
+ * @param b defines the b coordinate of the operand
446
+ * @returns the resulting Color3
447
+ */
448
+ subtractFromFloats(r, g, b) {
449
+ return new this.constructor(this.r - r, this.g - g, this.b - b);
450
+ }
451
+ /**
452
+ * Subtracts the given floats from the current Color3 coordinates and set the given color "result" with this result
453
+ * @param r defines the r coordinate of the operand
454
+ * @param g defines the g coordinate of the operand
455
+ * @param b defines the b coordinate of the operand
456
+ * @param result defines the Color3 object where to store the result
457
+ * @returns the result
458
+ */
459
+ subtractFromFloatsToRef(r, g, b, result) {
460
+ return result.copyFromFloats(this.r - r, this.g - g, this.b - b);
461
+ }
253
462
  /**
254
463
  * Copy the current object
255
464
  * @returns a new Color3 copied the current one
256
465
  */
257
466
  clone() {
258
- return new Color3(this.r, this.g, this.b);
467
+ return new this.constructor(this.r, this.g, this.b);
259
468
  }
260
469
  /**
261
470
  * Copies the rgb values from the source in the current Color3
@@ -291,6 +500,15 @@ export class Color3 {
291
500
  set(r, g, b) {
292
501
  return this.copyFromFloats(r, g, b);
293
502
  }
503
+ /**
504
+ * Copies the given float to the current Color3 coordinates
505
+ * @param v defines the r, g and b coordinates of the operand
506
+ * @returns the current updated Color3
507
+ */
508
+ setAll(v) {
509
+ this.r = this.g = this.b = v;
510
+ return this;
511
+ }
294
512
  /**
295
513
  * Compute the Color3 hexadecimal code as a string
296
514
  * @returns a string containing the hexadecimal representation of the Color3 object
@@ -299,14 +517,14 @@ export class Color3 {
299
517
  const intR = Math.round(this.r * 255);
300
518
  const intG = Math.round(this.g * 255);
301
519
  const intB = Math.round(this.b * 255);
302
- return "#" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB);
520
+ return "#" + ToHex(intR) + ToHex(intG) + ToHex(intB);
303
521
  }
304
522
  /**
305
523
  * Converts current color in rgb space to HSV values
306
524
  * @returns a new color3 representing the HSV values
307
525
  */
308
526
  toHSV() {
309
- const result = new Color3();
527
+ const result = new this.constructor();
310
528
  this.toHSVToRef(result);
311
529
  return result;
312
530
  }
@@ -352,7 +570,7 @@ export class Color3 {
352
570
  * @returns a new Color3 object
353
571
  */
354
572
  toLinearSpace(exact = false) {
355
- const convertedColor = new Color3();
573
+ const convertedColor = new this.constructor();
356
574
  this.toLinearSpaceToRef(convertedColor, exact);
357
575
  return convertedColor;
358
576
  }
@@ -381,7 +599,7 @@ export class Color3 {
381
599
  * @returns a new Color3 object
382
600
  */
383
601
  toGammaSpace(exact = false) {
384
- const convertedColor = new Color3();
602
+ const convertedColor = new this.constructor();
385
603
  this.toGammaSpaceToRef(convertedColor, exact);
386
604
  return convertedColor;
387
605
  }
@@ -492,7 +710,7 @@ export class Color3 {
492
710
  result.b = array[offset + 2];
493
711
  }
494
712
  /**
495
- * Creates a new Color3 from integer values (< 256)
713
+ * Creates a new Color3 from integer values (\< 256)
496
714
  * @param r defines the red component to read from (value between 0 and 255)
497
715
  * @param g defines the green component to read from (value between 0 and 255)
498
716
  * @param b defines the blue component to read from (value between 0 and 255)
@@ -661,6 +879,10 @@ export class Color3 {
661
879
  }
662
880
  // Statics
663
881
  Color3._BlackReadOnly = Color3.Black();
882
+ Object.defineProperties(Color3.prototype, {
883
+ dimension: { value: [3] },
884
+ rank: { value: 1 },
885
+ });
664
886
  /**
665
887
  * Class used to hold a RBGA color
666
888
  */
@@ -695,18 +917,6 @@ export class Color4 {
695
917
  this.a = a;
696
918
  }
697
919
  // Operators
698
- /**
699
- * Adds in place the given Color4 values to the current Color4 object
700
- * @param right defines the second operand
701
- * @returns the current updated Color4 object
702
- */
703
- addInPlace(right) {
704
- this.r += right.r;
705
- this.g += right.g;
706
- this.b += right.b;
707
- this.a += right.a;
708
- return this;
709
- }
710
920
  /**
711
921
  * Creates a new array populated with 4 numeric elements : red, green, blue, alpha values
712
922
  * @returns the new array
@@ -734,7 +944,10 @@ export class Color4 {
734
944
  * @returns the current Color4 object
735
945
  */
736
946
  fromArray(array, offset = 0) {
737
- Color4.FromArrayToRef(array, offset, this);
947
+ this.r = array[offset];
948
+ this.g = array[offset + 1];
949
+ this.b = array[offset + 2];
950
+ this.a = array[offset + 3];
738
951
  return this;
739
952
  }
740
953
  /**
@@ -747,40 +960,119 @@ export class Color4 {
747
960
  }
748
961
  /**
749
962
  * Creates a new Color4 set with the added values of the current Color4 and of the given one
750
- * @param right defines the second operand
963
+ * @param otherColor defines the second operand
751
964
  * @returns a new Color4 object
752
965
  */
753
- add(right) {
754
- return new Color4(this.r + right.r, this.g + right.g, this.b + right.b, this.a + right.a);
966
+ add(otherColor) {
967
+ return new this.constructor(this.r + otherColor.r, this.g + otherColor.g, this.b + otherColor.b, this.a + otherColor.a);
968
+ }
969
+ /**
970
+ * Updates the given color "result" with the result of the addition of the current Color4 and the given one.
971
+ * @param otherColor the color to add
972
+ * @param result the color to store the result
973
+ * @returns result input
974
+ */
975
+ addToRef(otherColor, result) {
976
+ result.r = this.r + otherColor.r;
977
+ result.g = this.g + otherColor.g;
978
+ result.b = this.b + otherColor.b;
979
+ result.a = this.a + otherColor.a;
980
+ return result;
981
+ }
982
+ /**
983
+ * Adds in place the given Color4 values to the current Color4 object
984
+ * @param otherColor defines the second operand
985
+ * @returns the current updated Color4 object
986
+ */
987
+ addInPlace(otherColor) {
988
+ this.r += otherColor.r;
989
+ this.g += otherColor.g;
990
+ this.b += otherColor.b;
991
+ this.a += otherColor.a;
992
+ return this;
993
+ }
994
+ /**
995
+ * Adds the given coordinates to the current Color4
996
+ * @param r defines the r coordinate of the operand
997
+ * @param g defines the g coordinate of the operand
998
+ * @param b defines the b coordinate of the operand
999
+ * @param a defines the a coordinate of the operand
1000
+ * @returns the current updated Color4
1001
+ */
1002
+ addInPlaceFromFloats(r, g, b, a) {
1003
+ this.r += r;
1004
+ this.g += g;
1005
+ this.b += b;
1006
+ this.a += a;
1007
+ return this;
755
1008
  }
756
1009
  /**
757
1010
  * Creates a new Color4 set with the subtracted values of the given one from the current Color4
758
- * @param right defines the second operand
1011
+ * @param otherColor defines the second operand
759
1012
  * @returns a new Color4 object
760
1013
  */
761
- subtract(right) {
762
- return new Color4(this.r - right.r, this.g - right.g, this.b - right.b, this.a - right.a);
1014
+ subtract(otherColor) {
1015
+ return new this.constructor(this.r - otherColor.r, this.g - otherColor.g, this.b - otherColor.b, this.a - otherColor.a);
763
1016
  }
764
1017
  /**
765
1018
  * Subtracts the given ones from the current Color4 values and stores the results in "result"
766
- * @param right defines the second operand
1019
+ * @param otherColor defines the second operand
767
1020
  * @param result defines the Color4 object where to store the result
768
- * @returns the current Color4 object
1021
+ * @returns the result Color4 object
769
1022
  */
770
- subtractToRef(right, result) {
771
- result.r = this.r - right.r;
772
- result.g = this.g - right.g;
773
- result.b = this.b - right.b;
774
- result.a = this.a - right.a;
1023
+ subtractToRef(otherColor, result) {
1024
+ result.r = this.r - otherColor.r;
1025
+ result.g = this.g - otherColor.g;
1026
+ result.b = this.b - otherColor.b;
1027
+ result.a = this.a - otherColor.a;
1028
+ return result;
1029
+ }
1030
+ /**
1031
+ * Subtract in place the given color from the current Color4.
1032
+ * @param otherColor the color to subtract
1033
+ * @returns the updated Color4.
1034
+ */
1035
+ subtractInPlace(otherColor) {
1036
+ this.r -= otherColor.r;
1037
+ this.g -= otherColor.g;
1038
+ this.b -= otherColor.b;
1039
+ this.a -= otherColor.a;
775
1040
  return this;
776
1041
  }
1042
+ /**
1043
+ * Returns a new Color4 set with the result of the subtraction of the given floats from the current Color4 coordinates.
1044
+ * @param r value to subtract
1045
+ * @param g value to subtract
1046
+ * @param b value to subtract
1047
+ * @param a value to subtract
1048
+ * @returns new color containing the result
1049
+ */
1050
+ subtractFromFloats(r, g, b, a) {
1051
+ return new this.constructor(this.r - r, this.g - g, this.b - b, this.a - a);
1052
+ }
1053
+ /**
1054
+ * Sets the given color "result" set with the result of the subtraction of the given floats from the current Color4 coordinates.
1055
+ * @param r value to subtract
1056
+ * @param g value to subtract
1057
+ * @param b value to subtract
1058
+ * @param a value to subtract
1059
+ * @param result the color to store the result in
1060
+ * @returns result input
1061
+ */
1062
+ subtractFromFloatsToRef(r, g, b, a, result) {
1063
+ result.r = this.r - r;
1064
+ result.g = this.g - g;
1065
+ result.b = this.b - b;
1066
+ result.a = this.a - a;
1067
+ return result;
1068
+ }
777
1069
  /**
778
1070
  * Creates a new Color4 with the current Color4 values multiplied by scale
779
1071
  * @param scale defines the scaling factor to apply
780
1072
  * @returns a new Color4 object
781
1073
  */
782
1074
  scale(scale) {
783
- return new Color4(this.r * scale, this.g * scale, this.b * scale, this.a * scale);
1075
+ return new this.constructor(this.r * scale, this.g * scale, this.b * scale, this.a * scale);
784
1076
  }
785
1077
  /**
786
1078
  * Multiplies the Color4 values by the float "scale"
@@ -798,41 +1090,41 @@ export class Color4 {
798
1090
  * Multiplies the current Color4 values by scale and stores the result in "result"
799
1091
  * @param scale defines the scaling factor to apply
800
1092
  * @param result defines the Color4 object where to store the result
801
- * @returns the current unmodified Color4
1093
+ * @returns the result Color4
802
1094
  */
803
1095
  scaleToRef(scale, result) {
804
1096
  result.r = this.r * scale;
805
1097
  result.g = this.g * scale;
806
1098
  result.b = this.b * scale;
807
1099
  result.a = this.a * scale;
808
- return this;
1100
+ return result;
809
1101
  }
810
1102
  /**
811
1103
  * Scale the current Color4 values by a factor and add the result to a given Color4
812
1104
  * @param scale defines the scale factor
813
1105
  * @param result defines the Color4 object where to store the result
814
- * @returns the unmodified current Color4
1106
+ * @returns the result Color4
815
1107
  */
816
1108
  scaleAndAddToRef(scale, result) {
817
1109
  result.r += this.r * scale;
818
1110
  result.g += this.g * scale;
819
1111
  result.b += this.b * scale;
820
1112
  result.a += this.a * scale;
821
- return this;
1113
+ return result;
822
1114
  }
823
1115
  /**
824
1116
  * Clamps the rgb values by the min and max values and stores the result into "result"
825
1117
  * @param min defines minimum clamping value (default is 0)
826
1118
  * @param max defines maximum clamping value (default is 1)
827
1119
  * @param result defines color to store the result into.
828
- * @returns the current Color4
1120
+ * @returns the result Color4
829
1121
  */
830
1122
  clampToRef(min = 0, max = 1, result) {
831
- result.r = Scalar.Clamp(this.r, min, max);
832
- result.g = Scalar.Clamp(this.g, min, max);
833
- result.b = Scalar.Clamp(this.b, min, max);
834
- result.a = Scalar.Clamp(this.a, min, max);
835
- return this;
1123
+ result.r = Clamp(this.r, min, max);
1124
+ result.g = Clamp(this.g, min, max);
1125
+ result.b = Clamp(this.b, min, max);
1126
+ result.a = Clamp(this.a, min, max);
1127
+ return result;
836
1128
  }
837
1129
  /**
838
1130
  * Multiply an Color4 value by another and return a new Color4 object
@@ -840,7 +1132,7 @@ export class Color4 {
840
1132
  * @returns a new Color4 object
841
1133
  */
842
1134
  multiply(color) {
843
- return new Color4(this.r * color.r, this.g * color.g, this.b * color.b, this.a * color.a);
1135
+ return new this.constructor(this.r * color.r, this.g * color.g, this.b * color.b, this.a * color.a);
844
1136
  }
845
1137
  /**
846
1138
  * Multiply a Color4 value by another and push the result in a reference value
@@ -855,6 +1147,176 @@ export class Color4 {
855
1147
  result.a = this.a * color.a;
856
1148
  return result;
857
1149
  }
1150
+ /**
1151
+ * Multiplies in place the current Color4 by the given one.
1152
+ * @param otherColor color to multiple with
1153
+ * @returns the updated Color4.
1154
+ */
1155
+ multiplyInPlace(otherColor) {
1156
+ this.r *= otherColor.r;
1157
+ this.g *= otherColor.g;
1158
+ this.b *= otherColor.b;
1159
+ this.a *= otherColor.a;
1160
+ return this;
1161
+ }
1162
+ /**
1163
+ * Returns a new Color4 set with the multiplication result of the given floats and the current Color4 coordinates.
1164
+ * @param r value multiply with
1165
+ * @param g value multiply with
1166
+ * @param b value multiply with
1167
+ * @param a value multiply with
1168
+ * @returns resulting new color
1169
+ */
1170
+ multiplyByFloats(r, g, b, a) {
1171
+ return new this.constructor(this.r * r, this.g * g, this.b * b, this.a * a);
1172
+ }
1173
+ /**
1174
+ * @internal
1175
+ * Do not use
1176
+ */
1177
+ divide(_other) {
1178
+ throw new ReferenceError("Can not divide a color");
1179
+ }
1180
+ /**
1181
+ * @internal
1182
+ * Do not use
1183
+ */
1184
+ divideToRef(_other, _result) {
1185
+ throw new ReferenceError("Can not divide a color");
1186
+ }
1187
+ /**
1188
+ * @internal
1189
+ * Do not use
1190
+ */
1191
+ divideInPlace(_other) {
1192
+ throw new ReferenceError("Can not divide a color");
1193
+ }
1194
+ /**
1195
+ * Updates the Color4 coordinates with the minimum values between its own and the given color ones
1196
+ * @param other defines the second operand
1197
+ * @returns the current updated Color4
1198
+ */
1199
+ minimizeInPlace(other) {
1200
+ this.r = Math.min(this.r, other.r);
1201
+ this.g = Math.min(this.g, other.g);
1202
+ this.b = Math.min(this.b, other.b);
1203
+ this.a = Math.min(this.a, other.a);
1204
+ return this;
1205
+ }
1206
+ /**
1207
+ * Updates the Color4 coordinates with the maximum values between its own and the given color ones
1208
+ * @param other defines the second operand
1209
+ * @returns the current updated Color4
1210
+ */
1211
+ maximizeInPlace(other) {
1212
+ this.r = Math.max(this.r, other.r);
1213
+ this.g = Math.max(this.g, other.g);
1214
+ this.b = Math.max(this.b, other.b);
1215
+ this.a = Math.max(this.a, other.a);
1216
+ return this;
1217
+ }
1218
+ /**
1219
+ * Updates the current Color4 with the minimal coordinate values between its and the given coordinates
1220
+ * @param r defines the r coordinate of the operand
1221
+ * @param g defines the g coordinate of the operand
1222
+ * @param b defines the b coordinate of the operand
1223
+ * @param a defines the a coordinate of the operand
1224
+ * @returns the current updated Color4
1225
+ */
1226
+ minimizeInPlaceFromFloats(r, g, b, a) {
1227
+ this.r = Math.min(r, this.r);
1228
+ this.g = Math.min(g, this.g);
1229
+ this.b = Math.min(b, this.b);
1230
+ this.a = Math.min(a, this.a);
1231
+ return this;
1232
+ }
1233
+ /**
1234
+ * Updates the current Color4 with the maximal coordinate values between its and the given coordinates.
1235
+ * @param r defines the r coordinate of the operand
1236
+ * @param g defines the g coordinate of the operand
1237
+ * @param b defines the b coordinate of the operand
1238
+ * @param a defines the a coordinate of the operand
1239
+ * @returns the current updated Color4
1240
+ */
1241
+ maximizeInPlaceFromFloats(r, g, b, a) {
1242
+ this.r = Math.max(r, this.r);
1243
+ this.g = Math.max(g, this.g);
1244
+ this.b = Math.max(b, this.b);
1245
+ this.a = Math.max(a, this.a);
1246
+ return this;
1247
+ }
1248
+ /**
1249
+ * @internal
1250
+ * Do not use
1251
+ */
1252
+ floorToRef(_result) {
1253
+ throw new ReferenceError("Can not floor a color");
1254
+ }
1255
+ /**
1256
+ * @internal
1257
+ * Do not use
1258
+ */
1259
+ floor() {
1260
+ throw new ReferenceError("Can not floor a color");
1261
+ }
1262
+ /**
1263
+ * @internal
1264
+ * Do not use
1265
+ */
1266
+ fractToRef(_result) {
1267
+ throw new ReferenceError("Can not fract a color");
1268
+ }
1269
+ /**
1270
+ * @internal
1271
+ * Do not use
1272
+ */
1273
+ fract() {
1274
+ throw new ReferenceError("Can not fract a color");
1275
+ }
1276
+ /**
1277
+ * @internal
1278
+ * Do not use
1279
+ */
1280
+ negate() {
1281
+ throw new ReferenceError("Can not negate a color");
1282
+ }
1283
+ /**
1284
+ * @internal
1285
+ * Do not use
1286
+ */
1287
+ negateInPlace() {
1288
+ throw new ReferenceError("Can not negate a color");
1289
+ }
1290
+ /**
1291
+ * @internal
1292
+ * Do not use
1293
+ */
1294
+ negateToRef(_result) {
1295
+ throw new ReferenceError("Can not negate a color");
1296
+ }
1297
+ /**
1298
+ * Boolean : True if the current Color4 coordinates are each beneath the distance "epsilon" from the given color ones.
1299
+ * @param otherColor color to compare against
1300
+ * @param epsilon (Default: very small number)
1301
+ * @returns true if they are equal
1302
+ */
1303
+ equalsWithEpsilon(otherColor, epsilon = Epsilon) {
1304
+ return (Scalar.WithinEpsilon(this.r, otherColor.r, epsilon) &&
1305
+ Scalar.WithinEpsilon(this.g, otherColor.g, epsilon) &&
1306
+ Scalar.WithinEpsilon(this.b, otherColor.b, epsilon) &&
1307
+ Scalar.WithinEpsilon(this.a, otherColor.a, epsilon));
1308
+ }
1309
+ /**
1310
+ * Boolean : True if the given floats are strictly equal to the current Color4 coordinates.
1311
+ * @param x x value to compare against
1312
+ * @param y y value to compare against
1313
+ * @param z z value to compare against
1314
+ * @param w w value to compare against
1315
+ * @returns true if equal
1316
+ */
1317
+ equalsToFloats(x, y, z, w) {
1318
+ return this.r === x && this.g === y && this.b === z && this.a === w;
1319
+ }
858
1320
  /**
859
1321
  * Creates a string with the Color4 current values
860
1322
  * @returns the string representation of the Color4 object
@@ -885,7 +1347,8 @@ export class Color4 {
885
1347
  * @returns a new Color4 object
886
1348
  */
887
1349
  clone() {
888
- return new Color4(this.r, this.g, this.b, this.a);
1350
+ const result = new this.constructor();
1351
+ return result.copyFrom(this);
889
1352
  }
890
1353
  /**
891
1354
  * Copies the given Color4 values into the current one
@@ -925,6 +1388,15 @@ export class Color4 {
925
1388
  set(r, g, b, a) {
926
1389
  return this.copyFromFloats(r, g, b, a);
927
1390
  }
1391
+ /**
1392
+ * Copies the given float to the current Vector4 coordinates
1393
+ * @param v defines the r, g, b, and a coordinates of the operand
1394
+ * @returns the current updated Vector4
1395
+ */
1396
+ setAll(v) {
1397
+ this.r = this.g = this.b = this.a = v;
1398
+ return this;
1399
+ }
928
1400
  /**
929
1401
  * Compute the Color4 hexadecimal code as a string
930
1402
  * @param returnAsColor3 defines if the string should only contains RGB values (off by default)
@@ -935,10 +1407,10 @@ export class Color4 {
935
1407
  const intG = Math.round(this.g * 255);
936
1408
  const intB = Math.round(this.b * 255);
937
1409
  if (returnAsColor3) {
938
- return "#" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB);
1410
+ return "#" + ToHex(intR) + ToHex(intG) + ToHex(intB);
939
1411
  }
940
1412
  const intA = Math.round(this.a * 255);
941
- return "#" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB) + Scalar.ToHex(intA);
1413
+ return "#" + ToHex(intR) + ToHex(intG) + ToHex(intB) + ToHex(intA);
942
1414
  }
943
1415
  /**
944
1416
  * Computes a new Color4 converted from the current one to linear space
@@ -1133,7 +1605,7 @@ export class Color4 {
1133
1605
  result.a = array[offset + 3];
1134
1606
  }
1135
1607
  /**
1136
- * Creates a new Color3 from integer values (< 256)
1608
+ * Creates a new Color3 from integer values (less than 256)
1137
1609
  * @param r defines the red component to read from (value between 0 and 255)
1138
1610
  * @param g defines the green component to read from (value between 0 and 255)
1139
1611
  * @param b defines the blue component to read from (value between 0 and 255)
@@ -1166,6 +1638,10 @@ export class Color4 {
1166
1638
  return colors;
1167
1639
  }
1168
1640
  }
1641
+ Object.defineProperties(Color4.prototype, {
1642
+ dimension: { value: [4] },
1643
+ rank: { value: 1 },
1644
+ });
1169
1645
  /**
1170
1646
  * @internal
1171
1647
  */