@galacean/engine-math 1.4.15 → 1.5.0-alpha.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/dist/main.js +27 -16
- package/dist/main.js.map +1 -1
- package/dist/module.js +27 -16
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/Color.d.ts +16 -10
package/dist/module.js
CHANGED
|
@@ -4531,20 +4531,22 @@ Matrix._tempMat30 = new Matrix3x3();
|
|
|
4531
4531
|
* @param out - The color in linear space
|
|
4532
4532
|
* @returns The color in linear space
|
|
4533
4533
|
*/ _proto.toLinear = function toLinear(out) {
|
|
4534
|
-
out._r = Color.
|
|
4535
|
-
out._g = Color.
|
|
4536
|
-
out._b = Color.
|
|
4534
|
+
out._r = Color.sRGBToLinearSpace(this._r);
|
|
4535
|
+
out._g = Color.sRGBToLinearSpace(this._g);
|
|
4536
|
+
out._b = Color.sRGBToLinearSpace(this._b);
|
|
4537
|
+
out._a = this._a;
|
|
4537
4538
|
out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
|
|
4538
4539
|
return out;
|
|
4539
4540
|
};
|
|
4540
4541
|
/**
|
|
4541
|
-
* Modify components (r, g, b) of this color from linear space to
|
|
4542
|
-
* @param out - The color in
|
|
4543
|
-
* @returns The color in
|
|
4544
|
-
*/ _proto.
|
|
4545
|
-
out._r = Color.
|
|
4546
|
-
out._g = Color.
|
|
4547
|
-
out._b = Color.
|
|
4542
|
+
* Modify components (r, g, b) of this color from linear space to sRGB space.
|
|
4543
|
+
* @param out - The color in sRGB space
|
|
4544
|
+
* @returns The color in sRGB space
|
|
4545
|
+
*/ _proto.toSRGB = function toSRGB(out) {
|
|
4546
|
+
out._r = Color.linearToSRGBSpace(this._r);
|
|
4547
|
+
out._g = Color.linearToSRGBSpace(this._g);
|
|
4548
|
+
out._b = Color.linearToSRGBSpace(this._b);
|
|
4549
|
+
out._a = this._a;
|
|
4548
4550
|
out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
|
|
4549
4551
|
return out;
|
|
4550
4552
|
};
|
|
@@ -4574,11 +4576,14 @@ Matrix._tempMat30 = new Matrix3x3();
|
|
|
4574
4576
|
a: this._a
|
|
4575
4577
|
};
|
|
4576
4578
|
};
|
|
4579
|
+
/** @deprecated Please use `toSRGB` instead. */ _proto.toGamma = function toGamma(out) {
|
|
4580
|
+
return this.toSRGB(out);
|
|
4581
|
+
};
|
|
4577
4582
|
/**
|
|
4578
|
-
* Modify a value from the
|
|
4579
|
-
* @param value - The value in
|
|
4583
|
+
* Modify a value from the sRGB space to the linear space.
|
|
4584
|
+
* @param value - The value in sRGB space
|
|
4580
4585
|
* @returns The value in linear space
|
|
4581
|
-
*/ Color.
|
|
4586
|
+
*/ Color.sRGBToLinearSpace = function sRGBToLinearSpace(value) {
|
|
4582
4587
|
// https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_framebuffer_sRGB.txt
|
|
4583
4588
|
// https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB_decode.txt
|
|
4584
4589
|
if (value <= 0.0) return 0.0;
|
|
@@ -4587,10 +4592,10 @@ Matrix._tempMat30 = new Matrix3x3();
|
|
|
4587
4592
|
else return Math.pow(value, 2.4);
|
|
4588
4593
|
};
|
|
4589
4594
|
/**
|
|
4590
|
-
* Modify a value from the linear space to the
|
|
4595
|
+
* Modify a value from the linear space to the sRGB space.
|
|
4591
4596
|
* @param value - The value in linear space
|
|
4592
|
-
* @returns The value in
|
|
4593
|
-
*/ Color.
|
|
4597
|
+
* @returns The value in sRGB space
|
|
4598
|
+
*/ Color.linearToSRGBSpace = function linearToSRGBSpace(value) {
|
|
4594
4599
|
// https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_framebuffer_sRGB.txt
|
|
4595
4600
|
// https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB_decode.txt
|
|
4596
4601
|
if (value <= 0.0) return 0.0;
|
|
@@ -4661,6 +4666,12 @@ Matrix._tempMat30 = new Matrix3x3();
|
|
|
4661
4666
|
out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
|
|
4662
4667
|
return out;
|
|
4663
4668
|
};
|
|
4669
|
+
/** @deprecated Please use `sRGBToLinearSpace` instead. */ Color.gammaToLinearSpace = function gammaToLinearSpace(value) {
|
|
4670
|
+
return Color.sRGBToLinearSpace(value);
|
|
4671
|
+
};
|
|
4672
|
+
/** @deprecated Please use `linearToSRGBSpace` instead. */ Color.linearToGammaSpace = function linearToGammaSpace(value) {
|
|
4673
|
+
return Color.linearToSRGBSpace(value);
|
|
4674
|
+
};
|
|
4664
4675
|
_create_class(Color, [
|
|
4665
4676
|
{
|
|
4666
4677
|
key: "r",
|