@galacean/engine 1.0.0-beta.10 → 1.0.0-beta.12

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
@@ -5642,6 +5642,13 @@
5642
5642
  TextureFormat[TextureFormat[/** 16-bit depth + 8-bit stencil format. */ "Depth24Stencil8"] = 30] = "Depth24Stencil8";
5643
5643
  TextureFormat[TextureFormat[/** 32-bit depth + 8-bit stencil format. */ "Depth32Stencil8"] = 31] = "Depth32Stencil8";
5644
5644
  })(exports.TextureFormat || (exports.TextureFormat = {}));
5645
+ /**
5646
+ * Texture usage.
5647
+ */ exports.TextureUsage = void 0;
5648
+ (function(TextureUsage) {
5649
+ TextureUsage[TextureUsage[/** The content of the texture is intended to be specified once. */ "Static"] = 0] = "Static";
5650
+ TextureUsage[TextureUsage[/** The content of the texture is intended to be updated frequently, with better performance. */ "Dynamic"] = 1] = "Dynamic";
5651
+ })(exports.TextureUsage || (exports.TextureUsage = {}));
5645
5652
  /**
5646
5653
  * Wrapping mode of the texture.
5647
5654
  */ exports.TextureWrapMode = void 0;
@@ -5779,6 +5786,14 @@
5779
5786
  return this._height;
5780
5787
  }
5781
5788
  },
5789
+ {
5790
+ key: "usage",
5791
+ get: /**
5792
+ * The usage of the texture.
5793
+ */ function get() {
5794
+ return this._usage;
5795
+ }
5796
+ },
5782
5797
  {
5783
5798
  key: "wrapModeU",
5784
5799
  get: /**
@@ -6019,14 +6034,16 @@
6019
6034
  /**
6020
6035
  * Two-dimensional texture.
6021
6036
  */ var Texture2D = /*#__PURE__*/ function(Texture) {
6022
- var Texture2D = function Texture2D(engine, width, height, format, mipmap) {
6037
+ var Texture2D = function Texture2D(engine, width, height, format, mipmap, usage) {
6023
6038
  if (format === void 0) format = exports.TextureFormat.R8G8B8A8;
6024
6039
  if (mipmap === void 0) mipmap = true;
6040
+ if (usage === void 0) usage = exports.TextureUsage.Static;
6025
6041
  var _this;
6026
6042
  _this = Texture.call(this, engine) || this;
6027
6043
  _this._mipmap = mipmap;
6028
6044
  _this._width = width;
6029
6045
  _this._height = height;
6046
+ _this._usage = usage;
6030
6047
  _this._format = format;
6031
6048
  _this._mipmapCount = _this._getMipmapCount();
6032
6049
  _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;
@@ -7116,6 +7133,29 @@
7116
7133
  * @remarks The release principle is that it is not referenced by the components, including direct and indirect reference.
7117
7134
  */ _proto.gc = function gc() {
7118
7135
  this._gc(false);
7136
+ var engine = this.engine;
7137
+ engine._renderElementPool.garbageCollection();
7138
+ engine._meshRenderDataPool.garbageCollection();
7139
+ engine._spriteRenderDataPool.garbageCollection();
7140
+ engine._spriteMaskRenderDataPool.garbageCollection();
7141
+ engine._textRenderDataPool.garbageCollection();
7142
+ var _componentsManager = engine._componentsManager, _lightManager = engine._lightManager;
7143
+ _componentsManager._renderers.garbageCollection();
7144
+ // @ts-ignore
7145
+ _componentsManager._onStartScripts.garbageCollection();
7146
+ // @ts-ignore
7147
+ _componentsManager._onUpdateScripts.garbageCollection();
7148
+ // @ts-ignore
7149
+ _componentsManager._onLateUpdateScripts.garbageCollection();
7150
+ // @ts-ignore
7151
+ _componentsManager._onPhysicsUpdateScripts.garbageCollection();
7152
+ // @ts-ignore
7153
+ _componentsManager._onUpdateAnimations.garbageCollection();
7154
+ // @ts-ignore
7155
+ _componentsManager._onUpdateRenderers.garbageCollection();
7156
+ _lightManager._spotLights.garbageCollection();
7157
+ _lightManager._pointLights.garbageCollection();
7158
+ _lightManager._directLights.garbageCollection();
7119
7159
  };
7120
7160
  /**
7121
7161
  * Add content restorer.
@@ -9532,6 +9572,11 @@
9532
9572
  * @returns Cloned entity
9533
9573
  */ _proto.clone = function clone() {
9534
9574
  var cloneEntity = new Entity(this._engine, this.name);
9575
+ var _this = this, hookResource = _this._hookResource;
9576
+ if (hookResource) {
9577
+ cloneEntity._hookResource = hookResource;
9578
+ hookResource._addReferCount(1);
9579
+ }
9535
9580
  cloneEntity._isActive = this._isActive;
9536
9581
  cloneEntity.transform.localMatrix = this.transform.localMatrix;
9537
9582
  var children = this._children;
@@ -9556,6 +9601,10 @@
9556
9601
  return;
9557
9602
  }
9558
9603
  EngineObject.prototype.destroy.call(this);
9604
+ if (this._hookResource) {
9605
+ this._hookResource._addReferCount(-1);
9606
+ this._hookResource = null;
9607
+ }
9559
9608
  var components = this._components;
9560
9609
  for(var i = components.length - 1; i >= 0; i--){
9561
9610
  components[i].destroy();
@@ -14146,9 +14195,9 @@
14146
14195
  var Material = function Material(engine, shader) {
14147
14196
  var _this;
14148
14197
  _this = ReferResource.call(this, engine) || this;
14149
- /** Shader data. */ _this.shaderData = new ShaderData(ShaderDataGroup.Material);
14150
14198
  /** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
14151
14199
  ;
14200
+ _this._shaderData = new ShaderData(ShaderDataGroup.Material);
14152
14201
  _this.shader = shader;
14153
14202
  return _this;
14154
14203
  };
@@ -14173,7 +14222,23 @@
14173
14222
  ReferResource.prototype._addReferCount.call(this, value);
14174
14223
  this.shaderData._addReferCount(value);
14175
14224
  };
14225
+ /**
14226
+ * @override
14227
+ */ _proto._onDestroy = function _onDestroy() {
14228
+ this._shader = null;
14229
+ this._shaderData = null;
14230
+ this._renderStates.length = 0;
14231
+ this._renderStates = null;
14232
+ };
14176
14233
  _create_class$3(Material, [
14234
+ {
14235
+ key: "shaderData",
14236
+ get: /**
14237
+ * Shader data.
14238
+ */ function get() {
14239
+ return this._shaderData;
14240
+ }
14241
+ },
14177
14242
  {
14178
14243
  key: "shader",
14179
14244
  get: /**
@@ -14245,6 +14310,12 @@
14245
14310
  */ _proto.resetPool = function resetPool() {
14246
14311
  this._elementPoolIndex = 0;
14247
14312
  };
14313
+ _proto.garbageCollection = function garbageCollection() {
14314
+ var _this = this, pool = _this._elementPool;
14315
+ for(var i = pool.length - 1; i >= 0; i--){
14316
+ pool[i].dispose && pool[i].dispose();
14317
+ }
14318
+ };
14248
14319
  return ClassPool;
14249
14320
  }();
14250
14321
  var RenderData = function RenderData() {};
@@ -14262,6 +14333,9 @@
14262
14333
  this.mesh = mesh;
14263
14334
  this.subMesh = subMesh;
14264
14335
  };
14336
+ _proto.dispose = function dispose() {
14337
+ this.component = this.material = this.mesh = this.subMesh = null;
14338
+ };
14265
14339
  return MeshRenderData;
14266
14340
  }(RenderData);
14267
14341
  /**
@@ -15334,6 +15408,9 @@
15334
15408
  this.shaderPass = shaderPass;
15335
15409
  this.renderState = renderState;
15336
15410
  };
15411
+ _proto.dispose = function dispose() {
15412
+ this.data = this.shaderPass = this.renderState = null;
15413
+ };
15337
15414
  return RenderElement;
15338
15415
  }();
15339
15416
  /**
@@ -15350,7 +15427,6 @@
15350
15427
  var Renderer1 = function Renderer1(entity) {
15351
15428
  var _this;
15352
15429
  _this = Component.call(this, entity) || this;
15353
- /** ShaderData related to renderer. */ _this.shaderData = new ShaderData(ShaderDataGroup.Renderer);
15354
15430
  /** @internal */ _this._onUpdateIndex = -1;
15355
15431
  /** @internal */ _this._rendererIndex = -1;
15356
15432
  /** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
@@ -15358,6 +15434,7 @@
15358
15434
  _this._overrideUpdate = false;
15359
15435
  _this._materials = [];
15360
15436
  _this._dirtyUpdateFlag = 0;
15437
+ _this._shaderData = new ShaderData(ShaderDataGroup.Renderer);
15361
15438
  _this._mvMatrix = new Matrix();
15362
15439
  _this._mvpMatrix = new Matrix();
15363
15440
  _this._mvInvMatrix = new Matrix();
@@ -15504,6 +15581,17 @@
15504
15581
  var _materials_i;
15505
15582
  (_materials_i = materials[i]) == null ? void 0 : _materials_i._addReferCount(-1);
15506
15583
  }
15584
+ this._entity = null;
15585
+ this._globalShaderMacro = null;
15586
+ this._bounds = null;
15587
+ this._materials = null;
15588
+ this._shaderData = null;
15589
+ this._mvMatrix = null;
15590
+ this._mvpMatrix = null;
15591
+ this._mvInvMatrix = null;
15592
+ this._normalMatrix = null;
15593
+ this._materialsInstanced = null;
15594
+ this._rendererLayer = null;
15507
15595
  };
15508
15596
  /**
15509
15597
  * @internal
@@ -15579,6 +15667,14 @@
15579
15667
  this._dirtyUpdateFlag |= 0x1;
15580
15668
  };
15581
15669
  _create_class$3(Renderer1, [
15670
+ {
15671
+ key: "shaderData",
15672
+ get: /**
15673
+ * ShaderData related to renderer.
15674
+ */ function get() {
15675
+ return this._shaderData;
15676
+ }
15677
+ },
15582
15678
  {
15583
15679
  key: "isCulled",
15584
15680
  get: /**
@@ -15663,9 +15759,6 @@
15663
15759
  }(), function() {
15664
15760
  _Renderer._rendererLayerProperty = ShaderProperty.getByName("renderer_Layer");
15665
15761
  }(), _Renderer);
15666
- __decorate$1([
15667
- deepClone
15668
- ], exports.Renderer.prototype, "shaderData", void 0);
15669
15762
  __decorate$1([
15670
15763
  ignoreClone
15671
15764
  ], exports.Renderer.prototype, "_distanceForSort", void 0);
@@ -15693,6 +15786,9 @@
15693
15786
  __decorate$1([
15694
15787
  ignoreClone
15695
15788
  ], exports.Renderer.prototype, "_dirtyUpdateFlag", void 0);
15789
+ __decorate$1([
15790
+ deepClone
15791
+ ], exports.Renderer.prototype, "_shaderData", void 0);
15696
15792
  __decorate$1([
15697
15793
  ignoreClone
15698
15794
  ], exports.Renderer.prototype, "_mvMatrix", void 0);
@@ -15942,6 +16038,7 @@
15942
16038
  sprite._addReferCount(-1);
15943
16039
  sprite._updateFlagManager.removeListener(this._onSpriteChange);
15944
16040
  }
16041
+ this._entity = null;
15945
16042
  this._sprite = null;
15946
16043
  this._verticesData = null;
15947
16044
  };
@@ -16485,14 +16582,19 @@
16485
16582
  }();
16486
16583
  /**
16487
16584
  * Sub-mesh, mainly contains drawing information.
16488
- */ var SubMesh = function SubMesh(start, count, topology) {
16489
- if (start === void 0) start = 0;
16490
- if (count === void 0) count = 0;
16491
- if (topology === void 0) topology = exports.MeshTopology.Triangles;
16492
- this.start = start;
16493
- this.count = count;
16494
- this.topology = topology;
16495
- };
16585
+ */ var SubMesh = /*#__PURE__*/ function() {
16586
+ var SubMesh = function SubMesh(start, count, topology) {
16587
+ if (start === void 0) start = 0;
16588
+ if (count === void 0) count = 0;
16589
+ if (topology === void 0) topology = exports.MeshTopology.Triangles;
16590
+ this.start = start;
16591
+ this.count = count;
16592
+ this.topology = topology;
16593
+ };
16594
+ var _proto = SubMesh.prototype;
16595
+ _proto.dispose = function dispose() {};
16596
+ return SubMesh;
16597
+ }();
16496
16598
  /**
16497
16599
  * Mesh.
16498
16600
  */ var Mesh = /*#__PURE__*/ function(GraphicsResource) {
@@ -18241,8 +18343,8 @@
18241
18343
  */ _proto._onDestroy = function _onDestroy() {
18242
18344
  Renderer.prototype._onDestroy.call(this);
18243
18345
  var mesh = this._mesh;
18244
- if (mesh && !mesh.destroyed) {
18245
- mesh._addReferCount(-1);
18346
+ if (mesh) {
18347
+ mesh.destroyed || mesh._addReferCount(-1);
18246
18348
  mesh._updateFlagManager.removeListener(this._onMeshChanged);
18247
18349
  this._mesh = null;
18248
18350
  }
@@ -18497,10 +18599,21 @@
18497
18599
  /**
18498
18600
  * @internal
18499
18601
  */ _proto._onDestroy = function _onDestroy() {
18500
- var _this_rootBone, _this__jointTexture;
18602
+ var _this__rootBone, _this__jointTexture;
18501
18603
  MeshRenderer.prototype._onDestroy.call(this);
18502
- (_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
18604
+ (_this__rootBone = this._rootBone) == null ? void 0 : _this__rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
18605
+ this._rootBone = null;
18606
+ this._jointDataCreateCache = null;
18607
+ this._skin = null;
18608
+ this._blendShapeWeights = null;
18609
+ this._localBounds = null;
18610
+ this._jointMatrices = null;
18503
18611
  (_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
18612
+ this._jointTexture = null;
18613
+ if (this._jointEntities) {
18614
+ this._jointEntities.length = 0;
18615
+ this._jointEntities = null;
18616
+ }
18504
18617
  };
18505
18618
  /**
18506
18619
  * @internal
@@ -20188,6 +20301,9 @@
20188
20301
  this.material = material;
20189
20302
  this.verticesData = verticesData;
20190
20303
  };
20304
+ _proto.dispose = function dispose() {
20305
+ this.component = this.material = this.verticesData = null;
20306
+ };
20191
20307
  return SpriteMaskRenderData;
20192
20308
  }(RenderData);
20193
20309
  var SpriteRenderData = /*#__PURE__*/ function(RenderData) {
@@ -20207,6 +20323,9 @@
20207
20323
  this.texture = texture;
20208
20324
  this.dataIndex = dataIndex;
20209
20325
  };
20326
+ _proto.dispose = function dispose() {
20327
+ this.component = this.material = this.verticesData = this.texture = null;
20328
+ };
20210
20329
  return SpriteRenderData;
20211
20330
  }(RenderData);
20212
20331
  var TextRenderData = /*#__PURE__*/ function(RenderData) {
@@ -20218,6 +20337,11 @@
20218
20337
  return _this;
20219
20338
  };
20220
20339
  _inherits$2(TextRenderData, RenderData);
20340
+ var _proto = TextRenderData.prototype;
20341
+ _proto.dispose = function dispose() {
20342
+ this.component = this.material = null;
20343
+ this.charsData.length = 0;
20344
+ };
20221
20345
  return TextRenderData;
20222
20346
  }(RenderData);
20223
20347
  /**
@@ -20743,8 +20867,6 @@
20743
20867
  function Scene(engine, name) {
20744
20868
  var _this;
20745
20869
  _this = EngineObject.call(this, engine) || this;
20746
- /** The background of the scene. */ _this.background = new Background(_this._engine);
20747
- /** Scene-related shader data. */ _this.shaderData = new ShaderData(ShaderDataGroup.Scene);
20748
20870
  /** If cast shadows. */ _this.castShadows = true;
20749
20871
  /** The resolution of the shadow maps. */ _this.shadowResolution = exports.ShadowResolution.Medium;
20750
20872
  /** The splits of two cascade distribution. */ _this.shadowTwoCascadeSplits = 1.0 / 3.0;
@@ -20754,6 +20876,8 @@
20754
20876
  /** @internal */ _this._isActiveInEngine = false;
20755
20877
  /** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
20756
20878
  /** @internal */ _this._rootEntities = [];
20879
+ _this._background = new Background(_this._engine);
20880
+ _this._shaderData = new ShaderData(ShaderDataGroup.Scene);
20757
20881
  _this._shadowCascades = exports.ShadowCascadesMode.NoCascades;
20758
20882
  _this._fogMode = exports.FogMode.None;
20759
20883
  _this._fogColor = new Color$1(0.5, 0.5, 0.5, 1.0);
@@ -20920,6 +21044,8 @@
20920
21044
  shaderData.setColor(Scene._sunlightColorProperty, sunlight._getLightIntensityColor());
20921
21045
  shaderData.setVector3(Scene._sunlightDirectionProperty, sunlight.direction);
20922
21046
  this._sunLight = sunlight;
21047
+ } else {
21048
+ this._sunLight = null;
20923
21049
  }
20924
21050
  if (this.castShadows && this._sunLight && this._sunLight.shadowType !== exports.ShadowType.None) {
20925
21051
  shaderData.enableMacro("SCENE_SHADOW_TYPE", this._sunLight.shadowType.toString());
@@ -20979,6 +21105,22 @@
20979
21105
  this._fogParams.w = density / Math.sqrt(Math.LN2);
20980
21106
  };
20981
21107
  _create_class$3(Scene, [
21108
+ {
21109
+ key: "shaderData",
21110
+ get: /**
21111
+ * Scene-related shader data.
21112
+ */ function get() {
21113
+ return this._shaderData;
21114
+ }
21115
+ },
21116
+ {
21117
+ key: "background",
21118
+ get: /**
21119
+ * The background of the scene.
21120
+ */ function get() {
21121
+ return this._background;
21122
+ }
21123
+ },
20982
21124
  {
20983
21125
  key: "shadowCascades",
20984
21126
  get: /**
@@ -23410,7 +23552,6 @@
23410
23552
  var Camera1 = function Camera1(entity) {
23411
23553
  var _this;
23412
23554
  _this = Component.call(this, entity) || this;
23413
- /** Shader data. */ _this.shaderData = new ShaderData(ShaderDataGroup.Camera);
23414
23555
  /** Rendering priority - A Camera with higher priority will be rendered on top of a camera with lower priority. */ _this.priority = 0;
23415
23556
  /** Whether to enable frustum culling, it is enabled by default. */ _this.enableFrustumCulling = true;
23416
23557
  /**
@@ -23426,6 +23567,7 @@
23426
23567
  /** @internal */ _this._virtualCamera = new VirtualCamera();
23427
23568
  /** @internal */ _this._replacementShader = null;
23428
23569
  /** @internal */ _this._replacementSubShaderTag = null;
23570
+ _this._shaderData = new ShaderData(ShaderDataGroup.Camera);
23429
23571
  _this._isProjMatSetting = false;
23430
23572
  _this._nearClipPlane = 0.1;
23431
23573
  _this._farClipPlane = 100;
@@ -23636,6 +23778,20 @@
23636
23778
  this._isInvViewProjDirty.destroy();
23637
23779
  this._isViewMatrixDirty.destroy();
23638
23780
  this.shaderData._addReferCount(-1);
23781
+ this._entity = null;
23782
+ this._globalShaderMacro = null;
23783
+ this._frustum = null;
23784
+ this._renderPipeline = null;
23785
+ this._virtualCamera = null;
23786
+ this._shaderData = null;
23787
+ this._frustumViewChangeFlag = null;
23788
+ this._transform = null;
23789
+ this._isViewMatrixDirty = null;
23790
+ this._isInvViewProjDirty = null;
23791
+ this._viewport = null;
23792
+ this._inverseProjectionMatrix = null;
23793
+ this._lastAspectSize = null;
23794
+ this._invViewProjMat = null;
23639
23795
  };
23640
23796
  _proto._projMatChange = function _projMatChange() {
23641
23797
  this._isFrustumProjectDirty = true;
@@ -23675,6 +23831,14 @@
23675
23831
  return this._inverseProjectionMatrix;
23676
23832
  };
23677
23833
  _create_class$3(Camera1, [
23834
+ {
23835
+ key: "shaderData",
23836
+ get: /**
23837
+ * Shader data.
23838
+ */ function get() {
23839
+ return this._shaderData;
23840
+ }
23841
+ },
23678
23842
  {
23679
23843
  key: "nearClipPlane",
23680
23844
  get: /**
@@ -26064,6 +26228,7 @@
26064
26228
  sprite._addReferCount(-1);
26065
26229
  sprite._updateFlagManager.removeListener(this._onSpriteChange);
26066
26230
  }
26231
+ this._entity = null;
26067
26232
  this._color = null;
26068
26233
  this._sprite = null;
26069
26234
  this._assembler = null;
@@ -28336,9 +28501,14 @@
28336
28501
  })(LayerState || (LayerState = {}));
28337
28502
  /**
28338
28503
  * @internal
28339
- */ var AnimationEventHandler = function AnimationEventHandler() {
28340
- this.handlers = [];
28341
- };
28504
+ */ var AnimationEventHandler = /*#__PURE__*/ function() {
28505
+ var AnimationEventHandler = function AnimationEventHandler() {
28506
+ this.handlers = [];
28507
+ };
28508
+ var _proto = AnimationEventHandler.prototype;
28509
+ _proto.dispose = function dispose() {};
28510
+ return AnimationEventHandler;
28511
+ }();
28342
28512
  /**
28343
28513
  * Transitions define when and how the state machine switch from on state to another. AnimatorTransition always originate from a StateMachine or a StateMachine entry.
28344
28514
  */ var AnimatorStateTransition = function AnimatorStateTransition() {
@@ -30909,6 +31079,7 @@
30909
31079
  get TextureDepthCompareFunction () { return exports.TextureDepthCompareFunction; },
30910
31080
  get TextureFilterMode () { return exports.TextureFilterMode; },
30911
31081
  get TextureFormat () { return exports.TextureFormat; },
31082
+ get TextureUsage () { return exports.TextureUsage; },
30912
31083
  get TextureWrapMode () { return exports.TextureWrapMode; },
30913
31084
  Time: Time,
30914
31085
  TrailMaterial: TrailMaterial,
@@ -31676,9 +31847,9 @@
31676
31847
  var isWebGL2 = this._isWebGL2;
31677
31848
  var _this__formatDetail = this._formatDetail, internalFormat = _this__formatDetail.internalFormat, baseFormat = _this__formatDetail.baseFormat, dataType = _this__formatDetail.dataType;
31678
31849
  // @ts-ignore
31679
- var _this__texture = this._texture, mipmapCount = _this__texture.mipmapCount, width = _this__texture.width, height = _this__texture.height, _isDepthTexture = _this__texture._isDepthTexture;
31850
+ var _this__texture = this._texture, mipmapCount = _this__texture.mipmapCount, width = _this__texture.width, height = _this__texture.height, usage = _this__texture.usage, _isDepthTexture = _this__texture._isDepthTexture;
31680
31851
  this._bind();
31681
- if (isWebGL2 && !(baseFormat === gl.LUMINANCE_ALPHA || baseFormat === gl.ALPHA)) {
31852
+ if (isWebGL2 && !(baseFormat === gl.LUMINANCE_ALPHA || baseFormat === gl.ALPHA) && usage !== exports.TextureUsage.Dynamic) {
31682
31853
  gl.texStorage2D(this._target, mipmapCount, internalFormat, width, height);
31683
31854
  } else {
31684
31855
  if (!isCube) {
@@ -32470,11 +32641,15 @@
32470
32641
  * {@inheritDoc IPlatformTexture2D.setImageSource}
32471
32642
  */ _proto.setImageSource = function setImageSource(imageSource, mipLevel, flipY, premultiplyAlpha, x, y) {
32472
32643
  var gl = this._gl;
32473
- var _this__formatDetail = this._formatDetail, baseFormat = _this__formatDetail.baseFormat, dataType = _this__formatDetail.dataType;
32644
+ var _this__formatDetail = this._formatDetail, internalFormat = _this__formatDetail.internalFormat, baseFormat = _this__formatDetail.baseFormat, dataType = _this__formatDetail.dataType;
32474
32645
  this._bind();
32475
32646
  gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, +flipY);
32476
32647
  gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, +premultiplyAlpha);
32477
- gl.texSubImage2D(this._target, mipLevel, x || 0, y || 0, baseFormat, dataType, imageSource);
32648
+ if (this._texture.usage === exports.TextureUsage.Dynamic) {
32649
+ gl.texImage2D(this._target, mipLevel, internalFormat, baseFormat, dataType, imageSource);
32650
+ } else {
32651
+ gl.texSubImage2D(this._target, mipLevel, x || 0, y || 0, baseFormat, dataType, imageSource);
32652
+ }
32478
32653
  };
32479
32654
  /**
32480
32655
  * {@inheritDoc IPlatformTexture2D.getPixelBuffer }
@@ -34817,6 +34992,10 @@
34817
34992
  }
34818
34993
  glTFResource.sceneRoots = sceneRoots;
34819
34994
  glTFResource.defaultSceneRoot = sceneRoots[sceneID];
34995
+ // @ts-ignore
34996
+ glTFResource.defaultSceneRoot._hookResource = glTFResource;
34997
+ // @ts-ignore
34998
+ glTFResource._addReferCount(1);
34820
34999
  };
34821
35000
  return GLTFEntityParser;
34822
35001
  }(GLTFParser);
@@ -35548,33 +35727,16 @@
35548
35727
  })();
35549
35728
  /**
35550
35729
  * Product after glTF parser, usually, `defaultSceneRoot` is only needed to use.
35551
- */ var GLTFResource = /*#__PURE__*/ function(EngineObject) {
35730
+ */ var GLTFResource = /*#__PURE__*/ function(ReferResource) {
35552
35731
  var GLTFResource = function GLTFResource(engine, url) {
35553
35732
  var _this;
35554
- _this = EngineObject.call(this, engine) || this;
35733
+ _this = ReferResource.call(this, engine) || this;
35555
35734
  _this.url = url;
35556
35735
  return _this;
35557
35736
  };
35558
- _inherits(GLTFResource, EngineObject);
35559
- var _proto = GLTFResource.prototype;
35560
- /**
35561
- * @internal
35562
- */ _proto._onDestroy = function _onDestroy() {
35563
- EngineObject.prototype._onDestroy.call(this);
35564
- this.defaultSceneRoot.destroy();
35565
- this.textures = null;
35566
- this.materials = null;
35567
- this.meshes = null;
35568
- this.skins = null;
35569
- this.animations = null;
35570
- this.entities = null;
35571
- this.cameras = null;
35572
- this.lights = null;
35573
- this.sceneRoots = null;
35574
- this.extensionsData = null;
35575
- };
35737
+ _inherits(GLTFResource, ReferResource);
35576
35738
  return GLTFResource;
35577
- }(EngineObject);
35739
+ }(ReferResource);
35578
35740
  var GLTFLoader = /*#__PURE__*/ function(Loader) {
35579
35741
  var GLTFLoader = function GLTFLoader() {
35580
35742
  return Loader.apply(this, arguments);
@@ -38016,7 +38178,7 @@
38016
38178
  ], GALACEAN_animation_event);
38017
38179
 
38018
38180
  //@ts-ignore
38019
- var version = "1.0.0-beta.10";
38181
+ var version = "1.0.0-beta.12";
38020
38182
  console.log("Galacean engine version: " + version);
38021
38183
  for(var key in CoreObjects){
38022
38184
  Loader.registerClass(key, CoreObjects[key]);