@idetik/core 0.2.0 → 0.2.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/dist/index.js CHANGED
@@ -230,6 +230,7 @@ uniform mediump sampler2DArray ImageSampler;
230
230
  #endif
231
231
 
232
232
  #define MAX_CHANNELS 32
233
+ uniform uint ChannelCount;
233
234
  uniform bool Visible[MAX_CHANNELS];
234
235
  uniform vec3 Color[MAX_CHANNELS];
235
236
  uniform float ValueOffset[MAX_CHANNELS];
@@ -240,7 +241,7 @@ in vec2 TexCoords;
240
241
 
241
242
  void main() {
242
243
  vec3 rgbColor = vec3(0, 0, 0);
243
- for (int i = 0; i < MAX_CHANNELS; i++) {
244
+ for (uint i = 0u; i < ChannelCount; i++) {
244
245
  if (!Visible[i]) continue;
245
246
  float texel = float(texture(ImageSampler, vec3(TexCoords, i)).r);
246
247
  float value = (texel + ValueOffset[i]) * ValueScale[i];
@@ -604,6 +605,12 @@ class IQ {
604
605
  case this.gl_.FLOAT_MAT4:
605
606
  this.gl_.uniformMatrix4fv(B, !1, I);
606
607
  break;
608
+ case this.gl_.INT:
609
+ this.gl_.uniform1i(B, I);
610
+ break;
611
+ case this.gl_.UNSIGNED_INT:
612
+ this.gl_.uniform1ui(B, I);
613
+ break;
607
614
  // For samplers, the value is the texture index.
608
615
  case this.gl_.SAMPLER_2D:
609
616
  case this.gl_.SAMPLER_CUBE:
@@ -690,10 +697,12 @@ const gQ = typeof window < "u" ? [
690
697
  WebGL2RenderingContext.SAMPLER_2D_SHADOW,
691
698
  WebGL2RenderingContext.SAMPLER_CUBE_SHADOW,
692
699
  WebGL2RenderingContext.SAMPLER_2D_ARRAY_SHADOW,
700
+ WebGL2RenderingContext.INT,
693
701
  WebGL2RenderingContext.INT_SAMPLER_2D,
694
702
  WebGL2RenderingContext.INT_SAMPLER_3D,
695
703
  WebGL2RenderingContext.INT_SAMPLER_CUBE,
696
704
  WebGL2RenderingContext.INT_SAMPLER_2D_ARRAY,
705
+ WebGL2RenderingContext.UNSIGNED_INT,
697
706
  WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_2D,
698
707
  WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_3D,
699
708
  WebGL2RenderingContext.UNSIGNED_INT_SAMPLER_CUBE,
@@ -3734,7 +3743,8 @@ class sg extends mA {
3734
3743
  ImageSampler: 0,
3735
3744
  Color: I.rgb,
3736
3745
  ValueOffset: -B[0],
3737
- ValueScale: 1 / (B[1] - B[0])
3746
+ ValueScale: 1 / (B[1] - B[0]),
3747
+ ChannelCount: 1
3738
3748
  };
3739
3749
  } else {
3740
3750
  const I = [], B = [], Q = [], C = [];
@@ -3747,7 +3757,8 @@ class sg extends mA {
3747
3757
  "Visible[0]": I,
3748
3758
  "Color[0]": B,
3749
3759
  "ValueOffset[0]": Q,
3750
- "ValueScale[0]": C
3760
+ "ValueScale[0]": C,
3761
+ ChannelCount: this.channels_.length
3751
3762
  };
3752
3763
  }
3753
3764
  }