@carbonenginejs/runtime-utils 0.1.0 → 0.1.2

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/src/vec3.js CHANGED
@@ -559,6 +559,21 @@ vec3.isEmpty = function (a)
559
559
  return a[0] === 0 && a[1] === 0 && a[2] === 0;
560
560
  };
561
561
 
562
+ /**
563
+ * The largest of the three components.
564
+ *
565
+ * A reduction to one number, unlike `max`, which is the component-wise maximum
566
+ * of two vectors. Carbon spells it `MaxVectorComponent`, and uses it to reduce a
567
+ * colour to the single value that decides how bright it counts as.
568
+ *
569
+ * @param {vec3} a
570
+ * @returns {Number}
571
+ */
572
+ vec3.maxComponent = function (a)
573
+ {
574
+ return Math.max(a[0], a[1], a[2]);
575
+ };
576
+
562
577
  /**
563
578
  * Multiplies a vec3 by a scalar
564
579
  *
@@ -1097,6 +1112,7 @@ export const {
1097
1112
  length,
1098
1113
  lerp,
1099
1114
  max,
1115
+ maxComponent,
1100
1116
  min,
1101
1117
  mul,
1102
1118
  multiply,