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