@galacean/engine 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/browser.js CHANGED
@@ -8397,15 +8397,6 @@
8397
8397
  ]);
8398
8398
  return ShaderPart;
8399
8399
  }();
8400
- /**
8401
- * Shader data grouping.
8402
- */ var ShaderDataGroup;
8403
- (function(ShaderDataGroup) {
8404
- ShaderDataGroup[ShaderDataGroup[/** Scene group. */ "Scene"] = 0] = "Scene";
8405
- ShaderDataGroup[ShaderDataGroup[/** Camera group. */ "Camera"] = 1] = "Camera";
8406
- ShaderDataGroup[ShaderDataGroup[/** Renderer group. */ "Renderer"] = 2] = "Renderer";
8407
- ShaderDataGroup[ShaderDataGroup[/** material group. */ "Material"] = 3] = "Material";
8408
- })(ShaderDataGroup || (ShaderDataGroup = {}));
8409
8400
  /**
8410
8401
  * Color Space.
8411
8402
  */ exports.ColorSpace = void 0;
@@ -8612,6 +8603,15 @@
8612
8603
  this.constUniforms = [];
8613
8604
  this.textureUniforms = [];
8614
8605
  };
8606
+ /**
8607
+ * Shader data grouping.
8608
+ */ var ShaderDataGroup;
8609
+ (function(ShaderDataGroup) {
8610
+ ShaderDataGroup[ShaderDataGroup[/** Scene group. */ "Scene"] = 0] = "Scene";
8611
+ ShaderDataGroup[ShaderDataGroup[/** Camera group. */ "Camera"] = 1] = "Camera";
8612
+ ShaderDataGroup[ShaderDataGroup[/** Renderer group. */ "Renderer"] = 2] = "Renderer";
8613
+ ShaderDataGroup[ShaderDataGroup[/** material group. */ "Material"] = 3] = "Material";
8614
+ })(ShaderDataGroup || (ShaderDataGroup = {}));
8615
8615
  /**
8616
8616
  * Shader program, corresponding to the GPU shader program.
8617
8617
  * @internal
@@ -8907,6 +8907,7 @@
8907
8907
  break;
8908
8908
  case gl.SAMPLER_2D:
8909
8909
  case gl.SAMPLER_CUBE:
8910
+ case gl.UNSIGNED_INT_SAMPLER_2D:
8910
8911
  case gl.SAMPLER_2D_ARRAY:
8911
8912
  case gl.SAMPLER_2D_SHADOW:
8912
8913
  var defaultTexture;
@@ -8917,6 +8918,9 @@
8917
8918
  case gl.SAMPLER_CUBE:
8918
8919
  defaultTexture = _this._engine._magentaTextureCube;
8919
8920
  break;
8921
+ case gl.UNSIGNED_INT_SAMPLER_2D:
8922
+ defaultTexture = _this._engine._uintMagentaTexture2D;
8923
+ break;
8920
8924
  case gl.SAMPLER_2D_ARRAY:
8921
8925
  defaultTexture = _this._engine._magentaTexture2DArray;
8922
8926
  break;
@@ -9995,6 +9999,55 @@
9995
9999
  ]);
9996
10000
  return GraphicsResource;
9997
10001
  }(ReferResource);
10002
+ /**
10003
+ * The filter mode of the texture.
10004
+ */ exports.TextureFilterMode = void 0;
10005
+ (function(TextureFilterMode) {
10006
+ TextureFilterMode[TextureFilterMode[/** Point filtering. */ "Point"] = 0] = "Point";
10007
+ TextureFilterMode[TextureFilterMode[/** Bilinear filtering. */ "Bilinear"] = 1] = "Bilinear";
10008
+ TextureFilterMode[TextureFilterMode[/** Trilinear filtering. */ "Trilinear"] = 2] = "Trilinear";
10009
+ })(exports.TextureFilterMode || (exports.TextureFilterMode = {}));
10010
+ /**
10011
+ * Texture format enumeration.
10012
+ */ exports.TextureFormat = void 0;
10013
+ (function(TextureFormat) {
10014
+ TextureFormat[TextureFormat[/** RGB format, 8 bits per channel. */ "R8G8B8"] = 0] = "R8G8B8";
10015
+ TextureFormat[TextureFormat[/** RGBA format, 8 bits per channel. */ "R8G8B8A8"] = 1] = "R8G8B8A8";
10016
+ TextureFormat[TextureFormat[/** RGBA format, 4 bits per channel. */ "R4G4B4A4"] = 2] = "R4G4B4A4";
10017
+ 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";
10018
+ TextureFormat[TextureFormat[/** RGB format, 5 bits in R channel, 6 bits in G channel, 5 bits in B channel. */ "R5G6B5"] = 4] = "R5G6B5";
10019
+ TextureFormat[TextureFormat[/** Transparent format, 8 bits. */ "Alpha8"] = 5] = "Alpha8";
10020
+ TextureFormat[TextureFormat[/** Luminance/alpha in RGB channel, alpha in A channel. */ "LuminanceAlpha"] = 6] = "LuminanceAlpha";
10021
+ TextureFormat[TextureFormat[/** RGBA format, 16 bits per channel. */ "R16G16B16A16"] = 7] = "R16G16B16A16";
10022
+ TextureFormat[TextureFormat[/** RGBA format, 32 bits per channel. */ "R32G32B32A32"] = 8] = "R32G32B32A32";
10023
+ TextureFormat[TextureFormat[/** RGBA unsigned integer format, 32 bits per channel. */ "R32G32B32A32_UInt"] = 9] = "R32G32B32A32_UInt";
10024
+ TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "BC1"] = 10] = "BC1";
10025
+ TextureFormat[TextureFormat[/** RGBA compressed format, 8 bits per pixel. */ "BC3"] = 11] = "BC3";
10026
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "BC7"] = 12] = "BC7";
10027
+ TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC1_RGB"] = 13] = "ETC1_RGB";
10028
+ TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC2_RGB"] = 14] = "ETC2_RGB";
10029
+ TextureFormat[TextureFormat[/** RGBA compressed format, 5 bits per pixel, 4 bit in RGB, 1 bit in A. */ "ETC2_RGBA5"] = 15] = "ETC2_RGBA5";
10030
+ TextureFormat[TextureFormat[/** RGB compressed format, 8 bits per pixel. */ "ETC2_RGBA8"] = 16] = "ETC2_RGBA8";
10031
+ TextureFormat[TextureFormat[/** RGB compressed format, 2 bits per pixel. */ "PVRTC_RGB2"] = 17] = "PVRTC_RGB2";
10032
+ TextureFormat[TextureFormat[/** RGBA compressed format, 2 bits per pixel. */ "PVRTC_RGBA2"] = 18] = "PVRTC_RGBA2";
10033
+ TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "PVRTC_RGB4"] = 19] = "PVRTC_RGB4";
10034
+ TextureFormat[TextureFormat[/** RGBA compressed format, 4 bits per pixel. */ "PVRTC_RGBA4"] = 20] = "PVRTC_RGBA4";
10035
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "ASTC_4x4"] = 21] = "ASTC_4x4";
10036
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 5x5 pixel block. */ "ASTC_5x5"] = 22] = "ASTC_5x5";
10037
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 6x6 pixel block. */ "ASTC_6x6"] = 23] = "ASTC_6x6";
10038
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 8x8 pixel block. */ "ASTC_8x8"] = 24] = "ASTC_8x8";
10039
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 10x10 pixel block. */ "ASTC_10x10"] = 25] = "ASTC_10x10";
10040
+ TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 12x12 pixel block. */ "ASTC_12x12"] = 26] = "ASTC_12x12";
10041
+ TextureFormat[TextureFormat[/** Automatic depth format, engine will automatically select the supported precision. */ "Depth"] = 27] = "Depth";
10042
+ TextureFormat[TextureFormat[/** Automatic depth stencil format, engine will automatically select the supported precision. */ "DepthStencil"] = 28] = "DepthStencil";
10043
+ TextureFormat[TextureFormat[/** 16-bit depth format. */ "Depth16"] = 29] = "Depth16";
10044
+ TextureFormat[TextureFormat[/** 24-bit depth format. */ "Depth24"] = 30] = "Depth24";
10045
+ TextureFormat[TextureFormat[/** 32-bit depth format. */ "Depth32"] = 31] = "Depth32";
10046
+ TextureFormat[TextureFormat[/** 16-bit depth + 8-bit stencil format. */ "Depth24Stencil8"] = 32] = "Depth24Stencil8";
10047
+ TextureFormat[TextureFormat[/** 32-bit depth + 8-bit stencil format. */ "Depth32Stencil8"] = 33] = "Depth32Stencil8";
10048
+ TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC1` instead. */ "DXT1"] = 34] = "DXT1";
10049
+ TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC3` instead. */ "DXT5"] = 35] = "DXT5";
10050
+ })(exports.TextureFormat || (exports.TextureFormat = {}));
9998
10051
  /**
9999
10052
  * The base class of texture, contains some common functions of texture-related classes.
10000
10053
  */ var Texture = /*#__PURE__*/ function(GraphicsResource1) {
@@ -10051,6 +10104,12 @@
10051
10104
  _proto._getMipmapCount = function _getMipmapCount() {
10052
10105
  return this._mipmap ? Math.floor(Math.log2(Math.max(this._width, this._height))) + 1 : 1;
10053
10106
  };
10107
+ _proto._isIntFormat = function _isIntFormat() {
10108
+ if (exports.TextureFormat.R32G32B32A32_UInt === this._format) {
10109
+ return true;
10110
+ }
10111
+ return false;
10112
+ };
10054
10113
  _create_class$2(Texture, [
10055
10114
  {
10056
10115
  key: "format",
@@ -10127,6 +10186,11 @@
10127
10186
  },
10128
10187
  set: function set(value) {
10129
10188
  if (value === this._filterMode) return;
10189
+ if (value !== exports.TextureFilterMode.Point && this._isIntFormat()) {
10190
+ value = exports.TextureFilterMode.Point;
10191
+ Logger.warn("Int or UInt format texture only support TextureFilterMode.Point");
10192
+ return;
10193
+ }
10130
10194
  this._filterMode = value;
10131
10195
  this._platformTexture.filterMode = value;
10132
10196
  }
@@ -12401,54 +12465,6 @@
12401
12465
  TextureDepthCompareFunction[TextureDepthCompareFunction[/** pass if the compare value is greater than or equal to the sample value. */ "GreaterEqual"] = 6] = "GreaterEqual";
12402
12466
  TextureDepthCompareFunction[TextureDepthCompareFunction[/** always pass. */ "Always"] = 7] = "Always";
12403
12467
  })(exports.TextureDepthCompareFunction || (exports.TextureDepthCompareFunction = {}));
12404
- /**
12405
- * The filter mode of the texture.
12406
- */ exports.TextureFilterMode = void 0;
12407
- (function(TextureFilterMode) {
12408
- TextureFilterMode[TextureFilterMode[/** Point filtering. */ "Point"] = 0] = "Point";
12409
- TextureFilterMode[TextureFilterMode[/** Bilinear filtering. */ "Bilinear"] = 1] = "Bilinear";
12410
- TextureFilterMode[TextureFilterMode[/** Trilinear filtering. */ "Trilinear"] = 2] = "Trilinear";
12411
- })(exports.TextureFilterMode || (exports.TextureFilterMode = {}));
12412
- /**
12413
- * Texture format enumeration.
12414
- */ exports.TextureFormat = void 0;
12415
- (function(TextureFormat) {
12416
- TextureFormat[TextureFormat[/** RGB format, 8 bits per channel. */ "R8G8B8"] = 0] = "R8G8B8";
12417
- TextureFormat[TextureFormat[/** RGBA format, 8 bits per channel. */ "R8G8B8A8"] = 1] = "R8G8B8A8";
12418
- TextureFormat[TextureFormat[/** RGBA format, 4 bits per channel. */ "R4G4B4A4"] = 2] = "R4G4B4A4";
12419
- 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";
12420
- TextureFormat[TextureFormat[/** RGB format, 5 bits in R channel, 6 bits in G channel, 5 bits in B channel. */ "R5G6B5"] = 4] = "R5G6B5";
12421
- TextureFormat[TextureFormat[/** Transparent format, 8 bits. */ "Alpha8"] = 5] = "Alpha8";
12422
- TextureFormat[TextureFormat[/** Luminance/alpha in RGB channel, alpha in A channel. */ "LuminanceAlpha"] = 6] = "LuminanceAlpha";
12423
- TextureFormat[TextureFormat[/** RGBA format, 16 bits per channel. */ "R16G16B16A16"] = 7] = "R16G16B16A16";
12424
- TextureFormat[TextureFormat[/** RGBA format, 32 bits per channel. */ "R32G32B32A32"] = 8] = "R32G32B32A32";
12425
- TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "BC1"] = 9] = "BC1";
12426
- TextureFormat[TextureFormat[/** RGBA compressed format, 8 bits per pixel. */ "BC3"] = 10] = "BC3";
12427
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "BC7"] = 11] = "BC7";
12428
- TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC1_RGB"] = 12] = "ETC1_RGB";
12429
- TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC2_RGB"] = 13] = "ETC2_RGB";
12430
- TextureFormat[TextureFormat[/** RGBA compressed format, 5 bits per pixel, 4 bit in RGB, 1 bit in A. */ "ETC2_RGBA5"] = 14] = "ETC2_RGBA5";
12431
- TextureFormat[TextureFormat[/** RGB compressed format, 8 bits per pixel. */ "ETC2_RGBA8"] = 15] = "ETC2_RGBA8";
12432
- TextureFormat[TextureFormat[/** RGB compressed format, 2 bits per pixel. */ "PVRTC_RGB2"] = 16] = "PVRTC_RGB2";
12433
- TextureFormat[TextureFormat[/** RGBA compressed format, 2 bits per pixel. */ "PVRTC_RGBA2"] = 17] = "PVRTC_RGBA2";
12434
- TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "PVRTC_RGB4"] = 18] = "PVRTC_RGB4";
12435
- TextureFormat[TextureFormat[/** RGBA compressed format, 4 bits per pixel. */ "PVRTC_RGBA4"] = 19] = "PVRTC_RGBA4";
12436
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "ASTC_4x4"] = 20] = "ASTC_4x4";
12437
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 5x5 pixel block. */ "ASTC_5x5"] = 21] = "ASTC_5x5";
12438
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 6x6 pixel block. */ "ASTC_6x6"] = 22] = "ASTC_6x6";
12439
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 8x8 pixel block. */ "ASTC_8x8"] = 23] = "ASTC_8x8";
12440
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 10x10 pixel block. */ "ASTC_10x10"] = 24] = "ASTC_10x10";
12441
- TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 12x12 pixel block. */ "ASTC_12x12"] = 25] = "ASTC_12x12";
12442
- TextureFormat[TextureFormat[/** Automatic depth format, engine will automatically select the supported precision. */ "Depth"] = 26] = "Depth";
12443
- TextureFormat[TextureFormat[/** Automatic depth stencil format, engine will automatically select the supported precision. */ "DepthStencil"] = 27] = "DepthStencil";
12444
- TextureFormat[TextureFormat[/** 16-bit depth format. */ "Depth16"] = 28] = "Depth16";
12445
- TextureFormat[TextureFormat[/** 24-bit depth format. */ "Depth24"] = 29] = "Depth24";
12446
- TextureFormat[TextureFormat[/** 32-bit depth format. */ "Depth32"] = 30] = "Depth32";
12447
- TextureFormat[TextureFormat[/** 16-bit depth + 8-bit stencil format. */ "Depth24Stencil8"] = 31] = "Depth24Stencil8";
12448
- TextureFormat[TextureFormat[/** 32-bit depth + 8-bit stencil format. */ "Depth32Stencil8"] = 32] = "Depth32Stencil8";
12449
- TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC1` instead. */ "DXT1"] = 33] = "DXT1";
12450
- TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC3` instead. */ "DXT5"] = 34] = "DXT5";
12451
- })(exports.TextureFormat || (exports.TextureFormat = {}));
12452
12468
  /**
12453
12469
  * Texture usage.
12454
12470
  */ exports.TextureUsage = void 0;
@@ -12628,7 +12644,7 @@
12628
12644
  _this._mipmapCount = _this._getMipmapCount();
12629
12645
  _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;
12630
12646
  _this._platformTexture = engine._hardwareRenderer.createPlatformTexture2D(_assert_this_initialized(_this));
12631
- _this.filterMode = exports.TextureFilterMode.Bilinear;
12647
+ _this.filterMode = _this._isIntFormat() ? exports.TextureFilterMode.Point : exports.TextureFilterMode.Bilinear;
12632
12648
  _this.wrapModeU = _this.wrapModeV = exports.TextureWrapMode.Repeat;
12633
12649
  return _this;
12634
12650
  };
@@ -24051,6 +24067,26 @@
24051
24067
  this._magentaTexture2D = magentaTexture2D;
24052
24068
  this._magentaTextureCube = magentaTextureCube;
24053
24069
  if (hardwareRenderer.isWebGL2) {
24070
+ var magentaPixel32 = new Uint32Array([
24071
+ 255,
24072
+ 0,
24073
+ 255,
24074
+ 255
24075
+ ]);
24076
+ var uintMagentaTexture2D = new Texture2D(this, 1, 1, exports.TextureFormat.R32G32B32A32_UInt, false);
24077
+ uintMagentaTexture2D.setPixelBuffer(magentaPixel32);
24078
+ uintMagentaTexture2D.isGCIgnored = true;
24079
+ this.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
24080
+ var _class = function _class() {
24081
+ return ContentRestorer.call(this, uintMagentaTexture2D);
24082
+ };
24083
+ _inherits$2(_class, ContentRestorer);
24084
+ var _proto = _class.prototype;
24085
+ _proto.restoreContent = function restoreContent() {
24086
+ this.resource.setPixelBuffer(magentaPixel32);
24087
+ };
24088
+ return _class;
24089
+ }(ContentRestorer))());
24054
24090
  var magentaTexture2DArray = new Texture2DArray(this, 1, 1, 1, exports.TextureFormat.R8G8B8A8, false);
24055
24091
  magentaTexture2DArray.setPixelBuffer(0, magentaPixel);
24056
24092
  magentaTexture2DArray.isGCIgnored = true;
@@ -24065,6 +24101,7 @@
24065
24101
  };
24066
24102
  return _class;
24067
24103
  }(ContentRestorer))());
24104
+ this._uintMagentaTexture2D = uintMagentaTexture2D;
24068
24105
  this._magentaTexture2DArray = magentaTexture2DArray;
24069
24106
  }
24070
24107
  };
@@ -36865,6 +36902,13 @@
36865
36902
  dataType: gl.FLOAT,
36866
36903
  isCompressed: false
36867
36904
  };
36905
+ case exports.TextureFormat.R32G32B32A32_UInt:
36906
+ return {
36907
+ internalFormat: isWebGL2 ? gl.RGBA32UI : gl.NONE,
36908
+ baseFormat: gl.RGBA_INTEGER,
36909
+ dataType: gl.UNSIGNED_INT,
36910
+ isCompressed: false
36911
+ };
36868
36912
  case exports.TextureFormat.BC1:
36869
36913
  return {
36870
36914
  internalFormat: exports.GLCompressedTextureInternalFormat.RGB_S3TC_DXT1_EXT,
@@ -37106,6 +37150,7 @@
37106
37150
  return false;
37107
37151
  }
37108
37152
  break;
37153
+ case exports.TextureFormat.R32G32B32A32_UInt:
37109
37154
  case exports.TextureFormat.Depth24:
37110
37155
  case exports.TextureFormat.Depth32:
37111
37156
  case exports.TextureFormat.Depth32Stencil8:
@@ -44688,7 +44733,7 @@
44688
44733
  ], KHR_materials_anisotropy);
44689
44734
 
44690
44735
  //@ts-ignore
44691
- var version = "1.2.0-alpha.8";
44736
+ var version = "1.2.0-alpha.9";
44692
44737
  console.log("Galacean engine version: " + version);
44693
44738
  for(var key in CoreObjects){
44694
44739
  Loader.registerClass(key, CoreObjects[key]);