@galacean/engine-core 1.2.0-alpha.8 → 1.2.0-alpha.9

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
@@ -3530,16 +3530,6 @@ var ShaderFactory = /*#__PURE__*/ function() {
3530
3530
  return ShaderPart;
3531
3531
  }();
3532
3532
 
3533
- /**
3534
- * Shader data grouping.
3535
- */ var ShaderDataGroup;
3536
- (function(ShaderDataGroup) {
3537
- ShaderDataGroup[ShaderDataGroup[/** Scene group. */ "Scene"] = 0] = "Scene";
3538
- ShaderDataGroup[ShaderDataGroup[/** Camera group. */ "Camera"] = 1] = "Camera";
3539
- ShaderDataGroup[ShaderDataGroup[/** Renderer group. */ "Renderer"] = 2] = "Renderer";
3540
- ShaderDataGroup[ShaderDataGroup[/** material group. */ "Material"] = 3] = "Material";
3541
- })(ShaderDataGroup || (ShaderDataGroup = {}));
3542
-
3543
3533
  /**
3544
3534
  * Color Space.
3545
3535
  */ exports.ColorSpace = void 0;
@@ -3749,6 +3739,16 @@ var ShaderFactory = /*#__PURE__*/ function() {
3749
3739
  this.textureUniforms = [];
3750
3740
  };
3751
3741
 
3742
+ /**
3743
+ * Shader data grouping.
3744
+ */ var ShaderDataGroup;
3745
+ (function(ShaderDataGroup) {
3746
+ ShaderDataGroup[ShaderDataGroup[/** Scene group. */ "Scene"] = 0] = "Scene";
3747
+ ShaderDataGroup[ShaderDataGroup[/** Camera group. */ "Camera"] = 1] = "Camera";
3748
+ ShaderDataGroup[ShaderDataGroup[/** Renderer group. */ "Renderer"] = 2] = "Renderer";
3749
+ ShaderDataGroup[ShaderDataGroup[/** material group. */ "Material"] = 3] = "Material";
3750
+ })(ShaderDataGroup || (ShaderDataGroup = {}));
3751
+
3752
3752
  /**
3753
3753
  * Shader program, corresponding to the GPU shader program.
3754
3754
  * @internal
@@ -4044,6 +4044,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
4044
4044
  break;
4045
4045
  case gl.SAMPLER_2D:
4046
4046
  case gl.SAMPLER_CUBE:
4047
+ case gl.UNSIGNED_INT_SAMPLER_2D:
4047
4048
  case gl.SAMPLER_2D_ARRAY:
4048
4049
  case gl.SAMPLER_2D_SHADOW:
4049
4050
  var defaultTexture;
@@ -4054,6 +4055,9 @@ var ShaderFactory = /*#__PURE__*/ function() {
4054
4055
  case gl.SAMPLER_CUBE:
4055
4056
  defaultTexture = _this._engine._magentaTextureCube;
4056
4057
  break;
4058
+ case gl.UNSIGNED_INT_SAMPLER_2D:
4059
+ defaultTexture = _this._engine._uintMagentaTexture2D;
4060
+ break;
4057
4061
  case gl.SAMPLER_2D_ARRAY:
4058
4062
  defaultTexture = _this._engine._magentaTexture2DArray;
4059
4063
  break;
@@ -5143,6 +5147,57 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource1) {
5143
5147
  return GraphicsResource;
5144
5148
  }(ReferResource);
5145
5149
 
5150
+ /**
5151
+ * The filter mode of the texture.
5152
+ */ exports.TextureFilterMode = void 0;
5153
+ (function(TextureFilterMode) {
5154
+ TextureFilterMode[TextureFilterMode[/** Point filtering. */ "Point"] = 0] = "Point";
5155
+ TextureFilterMode[TextureFilterMode[/** Bilinear filtering. */ "Bilinear"] = 1] = "Bilinear";
5156
+ TextureFilterMode[TextureFilterMode[/** Trilinear filtering. */ "Trilinear"] = 2] = "Trilinear";
5157
+ })(exports.TextureFilterMode || (exports.TextureFilterMode = {}));
5158
+
5159
+ /**
5160
+ * Texture format enumeration.
5161
+ */ exports.TextureFormat = void 0;
5162
+ (function(TextureFormat) {
5163
+ TextureFormat[TextureFormat[/** RGB format, 8 bits per channel. */ "R8G8B8"] = 0] = "R8G8B8";
5164
+ TextureFormat[TextureFormat[/** RGBA format, 8 bits per channel. */ "R8G8B8A8"] = 1] = "R8G8B8A8";
5165
+ TextureFormat[TextureFormat[/** RGBA format, 4 bits per channel. */ "R4G4B4A4"] = 2] = "R4G4B4A4";
5166
+ TextureFormat[TextureFormat[/** RGBA format, 5 bits in R channel, 5 bits in G channel, 5 bits in B channel, 1 bit in A channel. */ "R5G5B5A1"] = 3] = "R5G5B5A1";
5167
+ TextureFormat[TextureFormat[/** RGB format, 5 bits in R channel, 6 bits in G channel, 5 bits in B channel. */ "R5G6B5"] = 4] = "R5G6B5";
5168
+ TextureFormat[TextureFormat[/** Transparent format, 8 bits. */ "Alpha8"] = 5] = "Alpha8";
5169
+ TextureFormat[TextureFormat[/** Luminance/alpha in RGB channel, alpha in A channel. */ "LuminanceAlpha"] = 6] = "LuminanceAlpha";
5170
+ TextureFormat[TextureFormat[/** RGBA format, 16 bits per channel. */ "R16G16B16A16"] = 7] = "R16G16B16A16";
5171
+ TextureFormat[TextureFormat[/** RGBA format, 32 bits per channel. */ "R32G32B32A32"] = 8] = "R32G32B32A32";
5172
+ TextureFormat[TextureFormat[/** RGBA unsigned integer format, 32 bits per channel. */ "R32G32B32A32_UInt"] = 9] = "R32G32B32A32_UInt";
5173
+ TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "BC1"] = 10] = "BC1";
5174
+ TextureFormat[TextureFormat[/** RGBA compressed format, 8 bits per pixel. */ "BC3"] = 11] = "BC3";
5175
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "BC7"] = 12] = "BC7";
5176
+ TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC1_RGB"] = 13] = "ETC1_RGB";
5177
+ TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC2_RGB"] = 14] = "ETC2_RGB";
5178
+ TextureFormat[TextureFormat[/** RGBA compressed format, 5 bits per pixel, 4 bit in RGB, 1 bit in A. */ "ETC2_RGBA5"] = 15] = "ETC2_RGBA5";
5179
+ TextureFormat[TextureFormat[/** RGB compressed format, 8 bits per pixel. */ "ETC2_RGBA8"] = 16] = "ETC2_RGBA8";
5180
+ TextureFormat[TextureFormat[/** RGB compressed format, 2 bits per pixel. */ "PVRTC_RGB2"] = 17] = "PVRTC_RGB2";
5181
+ TextureFormat[TextureFormat[/** RGBA compressed format, 2 bits per pixel. */ "PVRTC_RGBA2"] = 18] = "PVRTC_RGBA2";
5182
+ TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "PVRTC_RGB4"] = 19] = "PVRTC_RGB4";
5183
+ TextureFormat[TextureFormat[/** RGBA compressed format, 4 bits per pixel. */ "PVRTC_RGBA4"] = 20] = "PVRTC_RGBA4";
5184
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "ASTC_4x4"] = 21] = "ASTC_4x4";
5185
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 5x5 pixel block. */ "ASTC_5x5"] = 22] = "ASTC_5x5";
5186
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 6x6 pixel block. */ "ASTC_6x6"] = 23] = "ASTC_6x6";
5187
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 8x8 pixel block. */ "ASTC_8x8"] = 24] = "ASTC_8x8";
5188
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 10x10 pixel block. */ "ASTC_10x10"] = 25] = "ASTC_10x10";
5189
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 12x12 pixel block. */ "ASTC_12x12"] = 26] = "ASTC_12x12";
5190
+ TextureFormat[TextureFormat[/** Automatic depth format, engine will automatically select the supported precision. */ "Depth"] = 27] = "Depth";
5191
+ TextureFormat[TextureFormat[/** Automatic depth stencil format, engine will automatically select the supported precision. */ "DepthStencil"] = 28] = "DepthStencil";
5192
+ TextureFormat[TextureFormat[/** 16-bit depth format. */ "Depth16"] = 29] = "Depth16";
5193
+ TextureFormat[TextureFormat[/** 24-bit depth format. */ "Depth24"] = 30] = "Depth24";
5194
+ TextureFormat[TextureFormat[/** 32-bit depth format. */ "Depth32"] = 31] = "Depth32";
5195
+ TextureFormat[TextureFormat[/** 16-bit depth + 8-bit stencil format. */ "Depth24Stencil8"] = 32] = "Depth24Stencil8";
5196
+ TextureFormat[TextureFormat[/** 32-bit depth + 8-bit stencil format. */ "Depth32Stencil8"] = 33] = "Depth32Stencil8";
5197
+ TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC1` instead. */ "DXT1"] = 34] = "DXT1";
5198
+ TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC3` instead. */ "DXT5"] = 35] = "DXT5";
5199
+ })(exports.TextureFormat || (exports.TextureFormat = {}));
5200
+
5146
5201
  /**
5147
5202
  * The base class of texture, contains some common functions of texture-related classes.
5148
5203
  */ var Texture = /*#__PURE__*/ function(GraphicsResource1) {
@@ -5199,6 +5254,12 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource1) {
5199
5254
  _proto._getMipmapCount = function _getMipmapCount() {
5200
5255
  return this._mipmap ? Math.floor(Math.log2(Math.max(this._width, this._height))) + 1 : 1;
5201
5256
  };
5257
+ _proto._isIntFormat = function _isIntFormat() {
5258
+ if (exports.TextureFormat.R32G32B32A32_UInt === this._format) {
5259
+ return true;
5260
+ }
5261
+ return false;
5262
+ };
5202
5263
  _create_class(Texture, [
5203
5264
  {
5204
5265
  key: "format",
@@ -5275,6 +5336,11 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource1) {
5275
5336
  },
5276
5337
  set: function set(value) {
5277
5338
  if (value === this._filterMode) return;
5339
+ if (value !== exports.TextureFilterMode.Point && this._isIntFormat()) {
5340
+ value = exports.TextureFilterMode.Point;
5341
+ Logger.warn("Int or UInt format texture only support TextureFilterMode.Point");
5342
+ return;
5343
+ }
5278
5344
  this._filterMode = value;
5279
5345
  this._platformTexture.filterMode = value;
5280
5346
  }
@@ -7578,56 +7644,6 @@ var /**
7578
7644
  TextureDepthCompareFunction[TextureDepthCompareFunction[/** always pass. */ "Always"] = 7] = "Always";
7579
7645
  })(exports.TextureDepthCompareFunction || (exports.TextureDepthCompareFunction = {}));
7580
7646
 
7581
- /**
7582
- * The filter mode of the texture.
7583
- */ exports.TextureFilterMode = void 0;
7584
- (function(TextureFilterMode) {
7585
- TextureFilterMode[TextureFilterMode[/** Point filtering. */ "Point"] = 0] = "Point";
7586
- TextureFilterMode[TextureFilterMode[/** Bilinear filtering. */ "Bilinear"] = 1] = "Bilinear";
7587
- TextureFilterMode[TextureFilterMode[/** Trilinear filtering. */ "Trilinear"] = 2] = "Trilinear";
7588
- })(exports.TextureFilterMode || (exports.TextureFilterMode = {}));
7589
-
7590
- /**
7591
- * Texture format enumeration.
7592
- */ exports.TextureFormat = void 0;
7593
- (function(TextureFormat) {
7594
- TextureFormat[TextureFormat[/** RGB format, 8 bits per channel. */ "R8G8B8"] = 0] = "R8G8B8";
7595
- TextureFormat[TextureFormat[/** RGBA format, 8 bits per channel. */ "R8G8B8A8"] = 1] = "R8G8B8A8";
7596
- TextureFormat[TextureFormat[/** RGBA format, 4 bits per channel. */ "R4G4B4A4"] = 2] = "R4G4B4A4";
7597
- TextureFormat[TextureFormat[/** RGBA format, 5 bits in R channel, 5 bits in G channel, 5 bits in B channel, 1 bit in A channel. */ "R5G5B5A1"] = 3] = "R5G5B5A1";
7598
- TextureFormat[TextureFormat[/** RGB format, 5 bits in R channel, 6 bits in G channel, 5 bits in B channel. */ "R5G6B5"] = 4] = "R5G6B5";
7599
- TextureFormat[TextureFormat[/** Transparent format, 8 bits. */ "Alpha8"] = 5] = "Alpha8";
7600
- TextureFormat[TextureFormat[/** Luminance/alpha in RGB channel, alpha in A channel. */ "LuminanceAlpha"] = 6] = "LuminanceAlpha";
7601
- TextureFormat[TextureFormat[/** RGBA format, 16 bits per channel. */ "R16G16B16A16"] = 7] = "R16G16B16A16";
7602
- TextureFormat[TextureFormat[/** RGBA format, 32 bits per channel. */ "R32G32B32A32"] = 8] = "R32G32B32A32";
7603
- TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "BC1"] = 9] = "BC1";
7604
- TextureFormat[TextureFormat[/** RGBA compressed format, 8 bits per pixel. */ "BC3"] = 10] = "BC3";
7605
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "BC7"] = 11] = "BC7";
7606
- TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC1_RGB"] = 12] = "ETC1_RGB";
7607
- TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC2_RGB"] = 13] = "ETC2_RGB";
7608
- TextureFormat[TextureFormat[/** RGBA compressed format, 5 bits per pixel, 4 bit in RGB, 1 bit in A. */ "ETC2_RGBA5"] = 14] = "ETC2_RGBA5";
7609
- TextureFormat[TextureFormat[/** RGB compressed format, 8 bits per pixel. */ "ETC2_RGBA8"] = 15] = "ETC2_RGBA8";
7610
- TextureFormat[TextureFormat[/** RGB compressed format, 2 bits per pixel. */ "PVRTC_RGB2"] = 16] = "PVRTC_RGB2";
7611
- TextureFormat[TextureFormat[/** RGBA compressed format, 2 bits per pixel. */ "PVRTC_RGBA2"] = 17] = "PVRTC_RGBA2";
7612
- TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "PVRTC_RGB4"] = 18] = "PVRTC_RGB4";
7613
- TextureFormat[TextureFormat[/** RGBA compressed format, 4 bits per pixel. */ "PVRTC_RGBA4"] = 19] = "PVRTC_RGBA4";
7614
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "ASTC_4x4"] = 20] = "ASTC_4x4";
7615
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 5x5 pixel block. */ "ASTC_5x5"] = 21] = "ASTC_5x5";
7616
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 6x6 pixel block. */ "ASTC_6x6"] = 22] = "ASTC_6x6";
7617
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 8x8 pixel block. */ "ASTC_8x8"] = 23] = "ASTC_8x8";
7618
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 10x10 pixel block. */ "ASTC_10x10"] = 24] = "ASTC_10x10";
7619
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 12x12 pixel block. */ "ASTC_12x12"] = 25] = "ASTC_12x12";
7620
- TextureFormat[TextureFormat[/** Automatic depth format, engine will automatically select the supported precision. */ "Depth"] = 26] = "Depth";
7621
- TextureFormat[TextureFormat[/** Automatic depth stencil format, engine will automatically select the supported precision. */ "DepthStencil"] = 27] = "DepthStencil";
7622
- TextureFormat[TextureFormat[/** 16-bit depth format. */ "Depth16"] = 28] = "Depth16";
7623
- TextureFormat[TextureFormat[/** 24-bit depth format. */ "Depth24"] = 29] = "Depth24";
7624
- TextureFormat[TextureFormat[/** 32-bit depth format. */ "Depth32"] = 30] = "Depth32";
7625
- TextureFormat[TextureFormat[/** 16-bit depth + 8-bit stencil format. */ "Depth24Stencil8"] = 31] = "Depth24Stencil8";
7626
- TextureFormat[TextureFormat[/** 32-bit depth + 8-bit stencil format. */ "Depth32Stencil8"] = 32] = "Depth32Stencil8";
7627
- TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC1` instead. */ "DXT1"] = 33] = "DXT1";
7628
- TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC3` instead. */ "DXT5"] = 34] = "DXT5";
7629
- })(exports.TextureFormat || (exports.TextureFormat = {}));
7630
-
7631
7647
  /**
7632
7648
  * Texture usage.
7633
7649
  */ exports.TextureUsage = void 0;
@@ -7811,7 +7827,7 @@ var /**
7811
7827
  _this._mipmapCount = _this._getMipmapCount();
7812
7828
  _this._isDepthTexture = format == exports.TextureFormat.Depth || format == exports.TextureFormat.DepthStencil || format == exports.TextureFormat.Depth16 || format == exports.TextureFormat.Depth24 || format == exports.TextureFormat.Depth32 || format == exports.TextureFormat.Depth24Stencil8 || format == exports.TextureFormat.Depth32Stencil8;
7813
7829
  _this._platformTexture = engine._hardwareRenderer.createPlatformTexture2D(_assert_this_initialized(_this));
7814
- _this.filterMode = exports.TextureFilterMode.Bilinear;
7830
+ _this.filterMode = _this._isIntFormat() ? exports.TextureFilterMode.Point : exports.TextureFilterMode.Bilinear;
7815
7831
  _this.wrapModeU = _this.wrapModeV = exports.TextureWrapMode.Repeat;
7816
7832
  return _this;
7817
7833
  }
@@ -19345,6 +19361,26 @@ ShaderPool.init();
19345
19361
  this._magentaTexture2D = magentaTexture2D;
19346
19362
  this._magentaTextureCube = magentaTextureCube;
19347
19363
  if (hardwareRenderer.isWebGL2) {
19364
+ var magentaPixel32 = new Uint32Array([
19365
+ 255,
19366
+ 0,
19367
+ 255,
19368
+ 255
19369
+ ]);
19370
+ var uintMagentaTexture2D = new Texture2D(this, 1, 1, exports.TextureFormat.R32G32B32A32_UInt, false);
19371
+ uintMagentaTexture2D.setPixelBuffer(magentaPixel32);
19372
+ uintMagentaTexture2D.isGCIgnored = true;
19373
+ this.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
19374
+ _inherits(_class, ContentRestorer);
19375
+ function _class() {
19376
+ return ContentRestorer.call(this, uintMagentaTexture2D);
19377
+ }
19378
+ var _proto = _class.prototype;
19379
+ _proto.restoreContent = function restoreContent() {
19380
+ this.resource.setPixelBuffer(magentaPixel32);
19381
+ };
19382
+ return _class;
19383
+ }(ContentRestorer))());
19348
19384
  var magentaTexture2DArray = new Texture2DArray(this, 1, 1, 1, exports.TextureFormat.R8G8B8A8, false);
19349
19385
  magentaTexture2DArray.setPixelBuffer(0, magentaPixel);
19350
19386
  magentaTexture2DArray.isGCIgnored = true;
@@ -19359,6 +19395,7 @@ ShaderPool.init();
19359
19395
  };
19360
19396
  return _class;
19361
19397
  }(ContentRestorer))());
19398
+ this._uintMagentaTexture2D = uintMagentaTexture2D;
19362
19399
  this._magentaTexture2DArray = magentaTexture2DArray;
19363
19400
  }
19364
19401
  };