@galacean/effects 1.4.4 → 1.4.5

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
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime player for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v1.4.4
6
+ * Version: v1.4.5
7
7
  */
8
8
 
9
9
  'use strict';
@@ -25643,7 +25643,7 @@ var Composition = /** @class */ (function () {
25643
25643
  }());
25644
25644
 
25645
25645
  /**
25646
- * Engine 基类,负责维护所有 GPU 资源的销毁
25646
+ * Engine 基类,负责维护所有 GPU 资源的管理及销毁
25647
25647
  */
25648
25648
  var Engine = /** @class */ (function () {
25649
25649
  function Engine() {
@@ -25653,6 +25653,10 @@ var Engine = /** @class */ (function () {
25653
25653
  this.geometries = [];
25654
25654
  this.meshes = [];
25655
25655
  this.renderPasses = [];
25656
+ /**
25657
+ * 渲染过程中错误队列
25658
+ */
25659
+ this.renderErrors = new Set();
25656
25660
  }
25657
25661
  Engine.prototype.addTexture = function (tex) {
25658
25662
  if (this.destroyed) {
@@ -26496,7 +26500,6 @@ var GLRendererInternal = /** @class */ (function () {
26496
26500
  var glMaterial = material;
26497
26501
  var program = glMaterial.shader.program;
26498
26502
  if (!program) {
26499
- console.warn('Material ' + glMaterial.name + ' 的shader着色器程序未初始化。');
26500
26503
  return;
26501
26504
  }
26502
26505
  var vao = program.setupAttributes(glGeometry);
@@ -27604,29 +27607,34 @@ var GLMaterial = /** @class */ (function (_super) {
27604
27607
  };
27605
27608
  GLMaterial.prototype.use = function (renderer, globalUniforms) {
27606
27609
  var e_1, _a, e_2, _b;
27610
+ var _c;
27607
27611
  var engine = renderer.engine;
27608
27612
  var pipelineContext = engine.getGLPipelineContext();
27613
+ if (!this.shader.program) {
27614
+ (_c = this.engine) === null || _c === void 0 ? void 0 : _c.renderErrors.add(new Error('Shader program is not initialized'));
27615
+ return;
27616
+ }
27609
27617
  this.shader.program.bind();
27610
27618
  this.setupStates(pipelineContext);
27611
27619
  var name;
27612
27620
  if (globalUniforms) {
27613
27621
  try {
27614
27622
  // 加入全局 uniform 名称
27615
- for (var _c = __values$1(globalUniforms.uniforms), _d = _c.next(); !_d.done; _d = _c.next()) {
27616
- name = _d.value;
27623
+ for (var _d = __values$1(globalUniforms.uniforms), _e = _d.next(); !_e.done; _e = _d.next()) {
27624
+ name = _e.value;
27617
27625
  this.checkUniform(name);
27618
27626
  }
27619
27627
  }
27620
27628
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
27621
27629
  finally {
27622
27630
  try {
27623
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
27631
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
27624
27632
  }
27625
27633
  finally { if (e_1) throw e_1.error; }
27626
27634
  }
27627
27635
  try {
27628
- for (var _e = __values$1(globalUniforms.samplers), _f = _e.next(); !_f.done; _f = _e.next()) {
27629
- name = _f.value;
27636
+ for (var _f = __values$1(globalUniforms.samplers), _g = _f.next(); !_g.done; _g = _f.next()) {
27637
+ name = _g.value;
27630
27638
  if (!this.samplers.includes(name)) {
27631
27639
  this.samplers.push(name);
27632
27640
  this.uniformDirtyFlag = true;
@@ -27636,7 +27644,7 @@ var GLMaterial = /** @class */ (function (_super) {
27636
27644
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
27637
27645
  finally {
27638
27646
  try {
27639
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
27647
+ if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
27640
27648
  }
27641
27649
  finally { if (e_2) throw e_2.error; }
27642
27650
  }
@@ -30553,7 +30561,14 @@ var Player = /** @class */ (function () {
30553
30561
  };
30554
30562
  Player.prototype.doTick = function (dt, forceRender) {
30555
30563
  var _this = this;
30556
- var _a, _b, _c;
30564
+ var _a, _b, _c, _d, _e;
30565
+ var renderErrors = this.renderer.engine.renderErrors;
30566
+ // TODO: 临时处理,2.0.0 做优化
30567
+ if (renderErrors.size > 0) {
30568
+ (_a = this.handleRenderError) === null || _a === void 0 ? void 0 : _a.call(this, renderErrors.values().next().value);
30569
+ // 有渲染错误时暂停播放
30570
+ (_b = this.ticker) === null || _b === void 0 ? void 0 : _b.pause();
30571
+ }
30557
30572
  dt = Math.min(dt, 33) * this.speed;
30558
30573
  var comps = this.compositions;
30559
30574
  var skipRender = false;
@@ -30576,8 +30591,8 @@ var Player = /** @class */ (function () {
30576
30591
  }
30577
30592
  this.baseCompositionIndex = this.compositions.length;
30578
30593
  if (skipRender) {
30579
- (_a = this.handleRenderError) === null || _a === void 0 ? void 0 : _a.call(this, new Error('play when texture offloaded'));
30580
- return (_b = this.ticker) === null || _b === void 0 ? void 0 : _b.pause();
30594
+ (_c = this.handleRenderError) === null || _c === void 0 ? void 0 : _c.call(this, new Error('play when texture offloaded'));
30595
+ return (_d = this.ticker) === null || _d === void 0 ? void 0 : _d.pause();
30581
30596
  }
30582
30597
  if (!this.paused || forceRender) {
30583
30598
  var level = this.gpuCapability.level;
@@ -30601,7 +30616,7 @@ var Player = /** @class */ (function () {
30601
30616
  time === null || time === void 0 ? void 0 : time.end();
30602
30617
  time === null || time === void 0 ? void 0 : time.getTime().then(function (t) { var _a; return (_a = _this.reportGPUTime) === null || _a === void 0 ? void 0 : _a.call(_this, t !== null && t !== void 0 ? t : 0); }).catch;
30603
30618
  if (this.autoPlaying) {
30604
- (_c = this.handlePlayableUpdate) === null || _c === void 0 ? void 0 : _c.call(this, {
30619
+ (_e = this.handlePlayableUpdate) === null || _e === void 0 ? void 0 : _e.call(this, {
30605
30620
  player: this,
30606
30621
  playing: true,
30607
30622
  });
@@ -30926,7 +30941,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
30926
30941
  Engine.create = function (gl) {
30927
30942
  return new GLEngine(gl);
30928
30943
  };
30929
- var version = "1.4.4";
30944
+ var version = "1.4.5";
30930
30945
  logger.info('player version: ' + version);
30931
30946
 
30932
30947
  exports.AbstractPlugin = AbstractPlugin;