@babylonjs/core 7.5.0 → 7.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Audio/sound.js +3 -0
- package/Audio/sound.js.map +1 -1
- package/Bones/bone.js +1 -1
- package/Bones/bone.js.map +1 -1
- package/Buffers/storageBuffer.d.ts +2 -2
- package/Buffers/storageBuffer.js.map +1 -1
- package/Cameras/arcRotateCamera.js +3 -0
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.js +1 -1
- package/Cameras/camera.js.map +1 -1
- package/Cameras/flyCamera.js +3 -0
- package/Cameras/flyCamera.js.map +1 -1
- package/Cameras/followCamera.js +4 -0
- package/Cameras/followCamera.js.map +1 -1
- package/Cameras/freeCamera.js +3 -0
- package/Cameras/freeCamera.js.map +1 -1
- package/Engines/Extensions/index.d.ts +0 -3
- package/Engines/Extensions/index.js +0 -3
- package/Engines/Extensions/index.js.map +1 -1
- package/Engines/WebGPU/Extensions/index.d.ts +0 -3
- package/Engines/WebGPU/Extensions/index.js +0 -3
- package/Engines/WebGPU/Extensions/index.js.map +1 -1
- package/Engines/abstractEngine.d.ts +0 -51
- package/Engines/abstractEngine.js +7 -3
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.js +5 -2
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.js +2 -2
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/thinEngine.functions.d.ts +0 -10
- package/Engines/thinEngine.functions.js +0 -19
- package/Engines/thinEngine.functions.js.map +1 -1
- package/Engines/thinEngine.js +18 -1
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +54 -2
- package/Engines/webgpuEngine.js +147 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/Inputs/scene.inputManager.d.ts +1 -0
- package/Inputs/scene.inputManager.js +1 -0
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Lights/directionalLight.js +3 -0
- package/Lights/directionalLight.js.map +1 -1
- package/Lights/hemisphericLight.js +3 -0
- package/Lights/hemisphericLight.js.map +1 -1
- package/Lights/light.js +1 -1
- package/Lights/light.js.map +1 -1
- package/Lights/pointLight.js +3 -0
- package/Lights/pointLight.js.map +1 -1
- package/Lights/spotLight.js +3 -0
- package/Lights/spotLight.js.map +1 -1
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +9 -3
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.d.ts +2 -2
- package/Materials/Node/Blocks/Dual/textureBlock.js +13 -3
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/shadowMapBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/shadowMapBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/animatedInputBlockTypes.d.ts +2 -1
- package/Materials/Node/Blocks/Input/animatedInputBlockTypes.js +1 -0
- package/Materials/Node/Blocks/Input/animatedInputBlockTypes.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +16 -0
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/baseMathBlock.js +2 -4
- package/Materials/Node/Blocks/baseMathBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.d.ts +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/trigonometryBlock.d.ts +3 -1
- package/Materials/Node/Blocks/trigonometryBlock.js +6 -0
- package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +6 -3
- package/Materials/Node/nodeMaterial.js +9 -6
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.d.ts +1 -1
- package/Materials/Node/nodeMaterialBlock.js +1 -1
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +34 -14
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +87 -9
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +1 -1
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Textures/Loaders/ktxTextureLoader.js +1 -1
- package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.d.ts +0 -1
- package/Materials/Textures/htmlElementTexture.js +7 -2
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/videoTexture.js +4 -2
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/effect.functions.d.ts +1 -1
- package/Materials/effect.functions.js +4 -4
- package/Materials/effect.functions.js.map +1 -1
- package/Materials/effect.js +1 -1
- package/Materials/effect.js.map +1 -1
- package/Materials/effect.webgl.functions.js +2 -2
- package/Materials/effect.webgl.functions.js.map +1 -1
- package/Materials/imageProcessingConfiguration.js +3 -0
- package/Materials/imageProcessingConfiguration.js.map +1 -1
- package/Materials/materialPluginBase.js +3 -0
- package/Materials/materialPluginBase.js.map +1 -1
- package/Materials/shaderMaterial.js +18 -8
- package/Materials/shaderMaterial.js.map +1 -1
- package/Maths/math.color.d.ts +85 -82
- package/Maths/math.color.js +34 -27
- package/Maths/math.color.js.map +1 -1
- package/Maths/math.vector.d.ts +202 -202
- package/Maths/math.vector.js +133 -130
- package/Maths/math.vector.js.map +1 -1
- package/Maths/tensor.d.ts +44 -42
- package/Maths/tensor.js.map +1 -1
- package/Meshes/Compression/dracoCompression.d.ts +7 -0
- package/Meshes/Compression/dracoCompression.js +14 -0
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/instancedMesh.js +3 -0
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/transformNode.js +1 -1
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/dumpTools.js +11 -0
- package/Misc/dumpTools.js.map +1 -1
- package/Misc/fileTools.d.ts +9 -9
- package/Misc/fileTools.js +17 -15
- package/Misc/fileTools.js.map +1 -1
- package/Misc/tools.d.ts +5 -0
- package/Misc/tools.js +9 -0
- package/Misc/tools.js.map +1 -1
- package/Misc/typeStore.d.ts +4 -0
- package/Misc/typeStore.js +11 -0
- package/Misc/typeStore.js.map +1 -1
- package/NOTICE.md +8 -0
- package/Particles/baseParticleSystem.js +3 -0
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/computeShaderParticleSystem.d.ts +2 -2
- package/Particles/computeShaderParticleSystem.js.map +1 -1
- package/Physics/v1/Plugins/ammoJSPlugin.js +39 -10
- package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +3 -0
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +4 -0
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +7 -0
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +40 -20
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.js +3 -0
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/screenSpaceRayTrace.js +8 -0
- package/Shaders/ShadersInclude/screenSpaceRayTrace.js.map +1 -1
- package/Shaders/fluidRenderingRender.fragment.js +11 -2
- package/Shaders/fluidRenderingRender.fragment.js.map +1 -1
- package/Shaders/screenSpaceReflection2.fragment.js +7 -1
- package/Shaders/screenSpaceReflection2.fragment.js.map +1 -1
- package/Shaders/sprites.fragment.d.ts +2 -0
- package/Shaders/sprites.fragment.js +8 -1
- package/Shaders/sprites.fragment.js.map +1 -1
- package/Shaders/sprites.vertex.d.ts +2 -0
- package/Shaders/sprites.vertex.js +4 -0
- package/Shaders/sprites.vertex.js.map +1 -1
- package/Shaders/ssao2.fragment.js +1 -1
- package/Shaders/ssao2.fragment.js.map +1 -1
- package/Sprites/spriteManager.d.ts +3 -0
- package/Sprites/spriteManager.js +11 -0
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteRenderer.d.ts +11 -3
- package/Sprites/spriteRenderer.js +49 -32
- package/Sprites/spriteRenderer.js.map +1 -1
- package/XR/features/WebXRNearInteraction.d.ts +6 -0
- package/XR/features/WebXRNearInteraction.js +14 -2
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/webXRManagedOutputCanvas.d.ts +2 -0
- package/XR/webXRManagedOutputCanvas.js +14 -6
- package/XR/webXRManagedOutputCanvas.js.map +1 -1
- package/abstractScene.js +3 -0
- package/abstractScene.js.map +1 -1
- package/assets/glslang/glslang.js +113 -0
- package/assets/glslang/glslang.wasm +0 -0
- package/assets/twgsl/twgsl.js +53 -0
- package/assets/twgsl/twgsl.wasm +0 -0
- package/node.d.ts +2 -1
- package/node.js +5 -1
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +3 -0
- package/scene.js.map +1 -1
- package/Engines/Extensions/engine.externalTexture.d.ts +0 -18
- package/Engines/Extensions/engine.externalTexture.js +0 -10
- package/Engines/Extensions/engine.externalTexture.js.map +0 -1
- package/Engines/Extensions/engine.storageBuffer.d.ts +0 -39
- package/Engines/Extensions/engine.storageBuffer.js +0 -16
- package/Engines/Extensions/engine.storageBuffer.js.map +0 -1
- package/Engines/Extensions/engine.textureSampler.d.ts +0 -12
- package/Engines/Extensions/engine.textureSampler.js +0 -6
- package/Engines/Extensions/engine.textureSampler.js.map +0 -1
- package/Engines/WebGPU/Extensions/engine.externalTexture.d.ts +0 -28
- package/Engines/WebGPU/Extensions/engine.externalTexture.js +0 -18
- package/Engines/WebGPU/Extensions/engine.externalTexture.js.map +0 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.d.ts +0 -50
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js +0 -88
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +0 -1
- package/Engines/WebGPU/Extensions/engine.textureSampler.d.ts +0 -22
- package/Engines/WebGPU/Extensions/engine.textureSampler.js +0 -9
- package/Engines/WebGPU/Extensions/engine.textureSampler.js.map +0 -1
package/Maths/math.color.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Scalar } from "./math.scalar.js";
|
|
2
|
-
import { Clamp, ToHex } from "./math.scalar.functions.js";
|
|
3
|
-
import { ToLinearSpace, ToGammaSpace, Epsilon } from "./math.constants.js";
|
|
4
1
|
import { ArrayTools } from "../Misc/arrayTools.js";
|
|
5
2
|
import { RegisterClass } from "../Misc/typeStore.js";
|
|
3
|
+
import { Epsilon, ToGammaSpace, ToLinearSpace } from "./math.constants.js";
|
|
4
|
+
import { Scalar } from "./math.scalar.js";
|
|
5
|
+
import { Clamp, ToHex } from "./math.scalar.functions.js";
|
|
6
6
|
function colorChannelToLinearSpace(color) {
|
|
7
7
|
return Math.pow(color, ToLinearSpace);
|
|
8
8
|
}
|
|
@@ -123,7 +123,7 @@ export class Color3 {
|
|
|
123
123
|
* @returns the new Color3 object
|
|
124
124
|
*/
|
|
125
125
|
multiply(otherColor) {
|
|
126
|
-
return new
|
|
126
|
+
return new Color3(this.r * otherColor.r, this.g * otherColor.g, this.b * otherColor.b);
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
129
|
* Multiply the rgb values of the Color3 and the given Color3 and stores the result in the object "result"
|
|
@@ -156,7 +156,7 @@ export class Color3 {
|
|
|
156
156
|
* @returns the new Color3
|
|
157
157
|
*/
|
|
158
158
|
multiplyByFloats(r, g, b) {
|
|
159
|
-
return new
|
|
159
|
+
return new Color3(this.r * r, this.g * g, this.b * b);
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
* @internal
|
|
@@ -313,7 +313,7 @@ export class Color3 {
|
|
|
313
313
|
* @returns a new Color3 object
|
|
314
314
|
*/
|
|
315
315
|
scale(scale) {
|
|
316
|
-
return new
|
|
316
|
+
return new Color3(this.r * scale, this.g * scale, this.b * scale);
|
|
317
317
|
}
|
|
318
318
|
/**
|
|
319
319
|
* Multiplies the Color3 values by the float "scale"
|
|
@@ -369,7 +369,7 @@ export class Color3 {
|
|
|
369
369
|
* @returns the new Color3
|
|
370
370
|
*/
|
|
371
371
|
add(otherColor) {
|
|
372
|
-
return new
|
|
372
|
+
return new Color3(this.r + otherColor.r, this.g + otherColor.g, this.b + otherColor.b);
|
|
373
373
|
}
|
|
374
374
|
/**
|
|
375
375
|
* Adds the given color to the current Color3
|
|
@@ -413,7 +413,7 @@ export class Color3 {
|
|
|
413
413
|
* @returns the new Color3
|
|
414
414
|
*/
|
|
415
415
|
subtract(otherColor) {
|
|
416
|
-
return new
|
|
416
|
+
return new Color3(this.r - otherColor.r, this.g - otherColor.g, this.b - otherColor.b);
|
|
417
417
|
}
|
|
418
418
|
/**
|
|
419
419
|
* Stores the result of the subtraction of given one from the current Color3 rgb values into "result"
|
|
@@ -446,7 +446,7 @@ export class Color3 {
|
|
|
446
446
|
* @returns the resulting Color3
|
|
447
447
|
*/
|
|
448
448
|
subtractFromFloats(r, g, b) {
|
|
449
|
-
return new
|
|
449
|
+
return new Color3(this.r - r, this.g - g, this.b - b);
|
|
450
450
|
}
|
|
451
451
|
/**
|
|
452
452
|
* Subtracts the given floats from the current Color3 coordinates and set the given color "result" with this result
|
|
@@ -457,14 +457,17 @@ export class Color3 {
|
|
|
457
457
|
* @returns the result
|
|
458
458
|
*/
|
|
459
459
|
subtractFromFloatsToRef(r, g, b, result) {
|
|
460
|
-
|
|
460
|
+
result.r = this.r - r;
|
|
461
|
+
result.g = this.g - g;
|
|
462
|
+
result.b = this.b - b;
|
|
463
|
+
return result;
|
|
461
464
|
}
|
|
462
465
|
/**
|
|
463
466
|
* Copy the current object
|
|
464
467
|
* @returns a new Color3 copied the current one
|
|
465
468
|
*/
|
|
466
469
|
clone() {
|
|
467
|
-
return new
|
|
470
|
+
return new Color3(this.r, this.g, this.b);
|
|
468
471
|
}
|
|
469
472
|
/**
|
|
470
473
|
* Copies the rgb values from the source in the current Color3
|
|
@@ -524,13 +527,12 @@ export class Color3 {
|
|
|
524
527
|
* @returns a new color3 representing the HSV values
|
|
525
528
|
*/
|
|
526
529
|
toHSV() {
|
|
527
|
-
|
|
528
|
-
this.toHSVToRef(result);
|
|
529
|
-
return result;
|
|
530
|
+
return this.toHSVToRef(new Color3());
|
|
530
531
|
}
|
|
531
532
|
/**
|
|
532
533
|
* Converts current color in rgb space to HSV values
|
|
533
534
|
* @param result defines the Color3 where to store the HSV values
|
|
535
|
+
* @returns the updated result
|
|
534
536
|
*/
|
|
535
537
|
toHSVToRef(result) {
|
|
536
538
|
const r = this.r;
|
|
@@ -563,6 +565,7 @@ export class Color3 {
|
|
|
563
565
|
result.r = h;
|
|
564
566
|
result.g = s;
|
|
565
567
|
result.b = v;
|
|
568
|
+
return result;
|
|
566
569
|
}
|
|
567
570
|
/**
|
|
568
571
|
* Computes a new Color3 converted from the current one to linear space
|
|
@@ -570,7 +573,7 @@ export class Color3 {
|
|
|
570
573
|
* @returns a new Color3 object
|
|
571
574
|
*/
|
|
572
575
|
toLinearSpace(exact = false) {
|
|
573
|
-
const convertedColor = new
|
|
576
|
+
const convertedColor = new Color3();
|
|
574
577
|
this.toLinearSpaceToRef(convertedColor, exact);
|
|
575
578
|
return convertedColor;
|
|
576
579
|
}
|
|
@@ -599,7 +602,7 @@ export class Color3 {
|
|
|
599
602
|
* @returns a new Color3 object
|
|
600
603
|
*/
|
|
601
604
|
toGammaSpace(exact = false) {
|
|
602
|
-
const convertedColor = new
|
|
605
|
+
const convertedColor = new Color3();
|
|
603
606
|
this.toGammaSpaceToRef(convertedColor, exact);
|
|
604
607
|
return convertedColor;
|
|
605
608
|
}
|
|
@@ -628,6 +631,7 @@ export class Color3 {
|
|
|
628
631
|
* @param saturation defines the saturation (value between 0 and 1)
|
|
629
632
|
* @param value defines the value (value between 0 and 1)
|
|
630
633
|
* @param result defines the Color3 where to store the RGB values
|
|
634
|
+
* @returns the updated result
|
|
631
635
|
*/
|
|
632
636
|
static HSVtoRGBToRef(hue, saturation, value, result) {
|
|
633
637
|
const chroma = value * saturation;
|
|
@@ -661,7 +665,10 @@ export class Color3 {
|
|
|
661
665
|
b = x;
|
|
662
666
|
}
|
|
663
667
|
const m = value - chroma;
|
|
664
|
-
result.
|
|
668
|
+
result.r = r + m;
|
|
669
|
+
result.g = g + m;
|
|
670
|
+
result.b = b + m;
|
|
671
|
+
return result;
|
|
665
672
|
}
|
|
666
673
|
/**
|
|
667
674
|
* Converts Hue, saturation and value to a new Color3 (RGB)
|
|
@@ -964,7 +971,7 @@ export class Color4 {
|
|
|
964
971
|
* @returns a new Color4 object
|
|
965
972
|
*/
|
|
966
973
|
add(otherColor) {
|
|
967
|
-
return new
|
|
974
|
+
return new Color4(this.r + otherColor.r, this.g + otherColor.g, this.b + otherColor.b, this.a + otherColor.a);
|
|
968
975
|
}
|
|
969
976
|
/**
|
|
970
977
|
* Updates the given color "result" with the result of the addition of the current Color4 and the given one.
|
|
@@ -1012,7 +1019,7 @@ export class Color4 {
|
|
|
1012
1019
|
* @returns a new Color4 object
|
|
1013
1020
|
*/
|
|
1014
1021
|
subtract(otherColor) {
|
|
1015
|
-
return new
|
|
1022
|
+
return new Color4(this.r - otherColor.r, this.g - otherColor.g, this.b - otherColor.b, this.a - otherColor.a);
|
|
1016
1023
|
}
|
|
1017
1024
|
/**
|
|
1018
1025
|
* Subtracts the given ones from the current Color4 values and stores the results in "result"
|
|
@@ -1048,7 +1055,7 @@ export class Color4 {
|
|
|
1048
1055
|
* @returns new color containing the result
|
|
1049
1056
|
*/
|
|
1050
1057
|
subtractFromFloats(r, g, b, a) {
|
|
1051
|
-
return new
|
|
1058
|
+
return new Color4(this.r - r, this.g - g, this.b - b, this.a - a);
|
|
1052
1059
|
}
|
|
1053
1060
|
/**
|
|
1054
1061
|
* Sets the given color "result" set with the result of the subtraction of the given floats from the current Color4 coordinates.
|
|
@@ -1072,7 +1079,7 @@ export class Color4 {
|
|
|
1072
1079
|
* @returns a new Color4 object
|
|
1073
1080
|
*/
|
|
1074
1081
|
scale(scale) {
|
|
1075
|
-
return new
|
|
1082
|
+
return new Color4(this.r * scale, this.g * scale, this.b * scale, this.a * scale);
|
|
1076
1083
|
}
|
|
1077
1084
|
/**
|
|
1078
1085
|
* Multiplies the Color4 values by the float "scale"
|
|
@@ -1132,7 +1139,7 @@ export class Color4 {
|
|
|
1132
1139
|
* @returns a new Color4 object
|
|
1133
1140
|
*/
|
|
1134
1141
|
multiply(color) {
|
|
1135
|
-
return new
|
|
1142
|
+
return new Color4(this.r * color.r, this.g * color.g, this.b * color.b, this.a * color.a);
|
|
1136
1143
|
}
|
|
1137
1144
|
/**
|
|
1138
1145
|
* Multiply a Color4 value by another and push the result in a reference value
|
|
@@ -1168,7 +1175,7 @@ export class Color4 {
|
|
|
1168
1175
|
* @returns resulting new color
|
|
1169
1176
|
*/
|
|
1170
1177
|
multiplyByFloats(r, g, b, a) {
|
|
1171
|
-
return new
|
|
1178
|
+
return new Color4(this.r * r, this.g * g, this.b * b, this.a * a);
|
|
1172
1179
|
}
|
|
1173
1180
|
/**
|
|
1174
1181
|
* @internal
|
|
@@ -1347,7 +1354,7 @@ export class Color4 {
|
|
|
1347
1354
|
* @returns a new Color4 object
|
|
1348
1355
|
*/
|
|
1349
1356
|
clone() {
|
|
1350
|
-
const result = new
|
|
1357
|
+
const result = new Color4();
|
|
1351
1358
|
return result.copyFrom(this);
|
|
1352
1359
|
}
|
|
1353
1360
|
/**
|
|
@@ -1505,9 +1512,7 @@ export class Color4 {
|
|
|
1505
1512
|
* @returns a new Color4 object
|
|
1506
1513
|
*/
|
|
1507
1514
|
static Lerp(left, right, amount) {
|
|
1508
|
-
|
|
1509
|
-
Color4.LerpToRef(left, right, amount, result);
|
|
1510
|
-
return result;
|
|
1515
|
+
return Color4.LerpToRef(left, right, amount, new Color4());
|
|
1511
1516
|
}
|
|
1512
1517
|
/**
|
|
1513
1518
|
* Set the given "result" with the linearly interpolated values of "amount" between the left Color4 object and the right Color4 object
|
|
@@ -1515,12 +1520,14 @@ export class Color4 {
|
|
|
1515
1520
|
* @param right defines the end value
|
|
1516
1521
|
* @param amount defines the gradient factor
|
|
1517
1522
|
* @param result defines the Color4 object where to store data
|
|
1523
|
+
* @returns the updated result
|
|
1518
1524
|
*/
|
|
1519
1525
|
static LerpToRef(left, right, amount, result) {
|
|
1520
1526
|
result.r = left.r + (right.r - left.r) * amount;
|
|
1521
1527
|
result.g = left.g + (right.g - left.g) * amount;
|
|
1522
1528
|
result.b = left.b + (right.b - left.b) * amount;
|
|
1523
1529
|
result.a = left.a + (right.a - left.a) * amount;
|
|
1530
|
+
return result;
|
|
1524
1531
|
}
|
|
1525
1532
|
/**
|
|
1526
1533
|
* Interpolate between two Color4 using Hermite interpolation
|