@galacean/effects-plugin-model 2.0.0-alpha.17 → 2.0.0-alpha.19

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,14 +3,34 @@
3
3
  * Description: Galacean Effects player model plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 飂兮
6
- * Version: v2.0.0-alpha.17
6
+ * Version: v2.0.0-alpha.19
7
7
  */
8
8
 
9
9
  'use strict';
10
10
 
11
11
  Object.defineProperty(exports, '__esModule', { value: true });
12
12
 
13
- var effects = require('@galacean/effects');
13
+ var EFFECTS = require('@galacean/effects');
14
+
15
+ function _interopNamespace(e) {
16
+ if (e && e.__esModule) return e;
17
+ var n = Object.create(null);
18
+ if (e) {
19
+ Object.keys(e).forEach(function (k) {
20
+ if (k !== 'default') {
21
+ var d = Object.getOwnPropertyDescriptor(e, k);
22
+ Object.defineProperty(n, k, d.get ? d : {
23
+ enumerable: true,
24
+ get: function () { return e[k]; }
25
+ });
26
+ }
27
+ });
28
+ }
29
+ n["default"] = e;
30
+ return Object.freeze(n);
31
+ }
32
+
33
+ var EFFECTS__namespace = /*#__PURE__*/_interopNamespace(EFFECTS);
14
34
 
15
35
  /**
16
36
  * Model 插件元素类型
@@ -203,7 +223,7 @@ function _extends() {
203
223
  return _extends.apply(this, arguments);
204
224
  }
205
225
 
206
- var Vector2 = effects.math.Vector2, Vector3 = effects.math.Vector3, Vector4 = effects.math.Vector4, Matrix3 = effects.math.Matrix3, Matrix4 = effects.math.Matrix4, Color = effects.math.Color, Euler = effects.math.Euler, EulerOrder = effects.math.EulerOrder, Quaternion = effects.math.Quaternion, Box3 = effects.math.Box3, Sphere = effects.math.Sphere, Ray = effects.math.Ray, DEG2RAD = effects.math.DEG2RAD;
226
+ var Vector2 = EFFECTS.math.Vector2, Vector3 = EFFECTS.math.Vector3, Vector4 = EFFECTS.math.Vector4, Matrix3 = EFFECTS.math.Matrix3, Matrix4 = EFFECTS.math.Matrix4, Color = EFFECTS.math.Color, Euler = EFFECTS.math.Euler, EulerOrder = EFFECTS.math.EulerOrder, Quaternion = EFFECTS.math.Quaternion, Box3 = EFFECTS.math.Box3, Sphere = EFFECTS.math.Sphere, Ray = EFFECTS.math.Ray, DEG2RAD = EFFECTS.math.DEG2RAD;
207
227
 
208
228
  exports.PObjectType = void 0;
209
229
  (function(PObjectType) {
@@ -292,10 +312,10 @@ var UnlitShaderGUID = "unlit000000000000000000000000000";
292
312
  * @param trans - GE 变换对象或数据
293
313
  * @returns
294
314
  */ _proto.fromEffectsTransform = function fromEffectsTransform(trans) {
295
- if (_instanceof1(trans, effects.Transform)) {
315
+ if (_instanceof1(trans, EFFECTS.Transform)) {
296
316
  this.setMatrix(trans.getWorldMatrix());
297
317
  } else {
298
- var effectsTrans = new effects.Transform(_extends({}, trans, {
318
+ var effectsTrans = new EFFECTS.Transform(_extends({}, trans, {
299
319
  valid: true
300
320
  }));
301
321
  effectsTrans.setValid(true);
@@ -470,10 +490,10 @@ var UnlitShaderGUID = "unlit000000000000000000000000000";
470
490
  function PGlobalState() {
471
491
  this.isWebGL2 = false;
472
492
  this.shaderShared = true;
473
- this.runtimeEnv = effects.PLAYER_OPTIONS_ENV_EDITOR;
493
+ this.runtimeEnv = EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
474
494
  this.compatibleMode = "gltf";
475
495
  this.visBoundingBox = false;
476
- this.renderMode3D = effects.spec.RenderMode3D.none;
496
+ this.renderMode3D = EFFECTS.spec.RenderMode3D.none;
477
497
  this.renderMode3DUVGridSize = 1 / 16;
478
498
  }
479
499
  var _proto = PGlobalState.prototype;
@@ -482,16 +502,16 @@ var UnlitShaderGUID = "unlit000000000000000000000000000";
482
502
  */ _proto.reset = function reset() {
483
503
  this.isWebGL2 = false;
484
504
  this.shaderShared = true;
485
- this.runtimeEnv = effects.PLAYER_OPTIONS_ENV_EDITOR;
505
+ this.runtimeEnv = EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
486
506
  this.compatibleMode = "gltf";
487
507
  this.visBoundingBox = false;
488
- this.renderMode3D = effects.spec.RenderMode3D.none;
508
+ this.renderMode3D = EFFECTS.spec.RenderMode3D.none;
489
509
  this.renderMode3DUVGridSize = 1 / 16;
490
510
  };
491
511
  /**
492
512
  * 是否可视化渲染中间结果
493
513
  */ _proto.hasRenderMode3D = function hasRenderMode3D() {
494
- return this.renderMode3D !== effects.spec.RenderMode3D.none;
514
+ return this.renderMode3D !== EFFECTS.spec.RenderMode3D.none;
495
515
  };
496
516
  /**
497
517
  * 获取单例
@@ -506,7 +526,7 @@ var UnlitShaderGUID = "unlit000000000000000000000000000";
506
526
  get: /**
507
527
  * 是否编辑器模式
508
528
  */ function get() {
509
- return this.runtimeEnv === effects.PLAYER_OPTIONS_ENV_EDITOR;
529
+ return this.runtimeEnv === EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
510
530
  }
511
531
  },
512
532
  {
@@ -782,7 +802,7 @@ var ctrlMap = {
782
802
  * @param binaries
783
803
  * @param pointer
784
804
  */ function typedArrayFromBinary(binary, pointer) {
785
- if (pointer.length != 2 || pointer[0] !== effects.spec.ValueType.BINARY || !_instanceof1(pointer[1], Array)) {
805
+ if (pointer.length != 2 || pointer[0] !== EFFECTS.spec.ValueType.BINARY || !_instanceof1(pointer[1], Array)) {
786
806
  // 不是BinaryPointer,可能已经创建,直接返回
787
807
  return pointer;
788
808
  }
@@ -1159,7 +1179,7 @@ exports.TextureDataMode = void 0;
1159
1179
  var matList = props.inverseBindMatrices;
1160
1180
  if (matList !== undefined && matList.length > 0) {
1161
1181
  if (matList.length % 16 !== 0 || matList.length !== this.jointItem.length * 16) {
1162
- throw new Error("Invalid array length, invert bind matrices " + matList.length + ", joint array " + this.jointItem.length);
1182
+ throw new Error("Invalid array length, invert bind matrices " + matList.length + ", joint array " + this.jointItem.length + ".");
1163
1183
  }
1164
1184
  var matrixCount = matList.length / 16;
1165
1185
  for(var i = 0; i < matrixCount; i++){
@@ -1190,7 +1210,7 @@ exports.TextureDataMode = void 0;
1190
1210
  });
1191
1211
  } else {
1192
1212
  this.animationMatrices = this.inverseBindMatrices;
1193
- console.error("Some error occured, replace skin animation matrices by invert bind matrices");
1213
+ console.error("Some error occured, replace skin animation matrices by invert bind matrices.");
1194
1214
  }
1195
1215
  };
1196
1216
  /**
@@ -1251,7 +1271,7 @@ exports.TextureDataMode = void 0;
1251
1271
  } else if (detail.halfFloatTexture) {
1252
1272
  return 2;
1253
1273
  } else {
1254
- throw new Error("Too many joint count " + jointCount + ", half float texture not support");
1274
+ throw new Error("Too many joint count " + jointCount + ", half float texture not support.");
1255
1275
  }
1256
1276
  } else {
1257
1277
  return 0;
@@ -1264,7 +1284,7 @@ exports.TextureDataMode = void 0;
1264
1284
  (_props_boneNames = props.boneNames) == null ? void 0 : _props_boneNames.forEach(function(boneName) {
1265
1285
  var node = name2Item[boneName];
1266
1286
  if (!node) {
1267
- throw new Error("Can't find node of bone name " + boneName);
1287
+ throw new Error("Can't find node of bone name " + boneName + ".");
1268
1288
  }
1269
1289
  jointItems.push(node);
1270
1290
  });
@@ -1361,19 +1381,19 @@ exports.TextureDataMode = void 0;
1361
1381
  * 还要注意最大数目不能超过5,否则也直接报错。
1362
1382
  * 后续考虑是否做个兼容,目前还是严格报错比较好。
1363
1383
  */ if (positionCount > 0 && positionCount != this.morphWeightsLength) {
1364
- console.error("Position morph count mismatch: " + this.morphWeightsLength + ", " + positionCount);
1384
+ console.error("Position morph count mismatch: " + this.morphWeightsLength + ", " + positionCount + ".");
1365
1385
  return false;
1366
1386
  }
1367
1387
  if (normalCount > 0 && normalCount != this.morphWeightsLength) {
1368
- console.error("Normal morph count mismatch: " + this.morphWeightsLength + ", " + normalCount);
1388
+ console.error("Normal morph count mismatch: " + this.morphWeightsLength + ", " + normalCount + ".");
1369
1389
  return false;
1370
1390
  }
1371
1391
  if (tangentCount > 0 && tangentCount != this.morphWeightsLength) {
1372
- console.error("Tangent morph count mismatch: " + this.morphWeightsLength + ", " + tangentCount);
1392
+ console.error("Tangent morph count mismatch: " + this.morphWeightsLength + ", " + tangentCount + ".");
1373
1393
  return false;
1374
1394
  }
1375
1395
  if (this.morphWeightsLength > 5) {
1376
- console.error("Tangent morph count should not greater than 5, current " + this.morphWeightsLength);
1396
+ console.error("Tangent morph count should not greater than 5, current " + this.morphWeightsLength + ".");
1377
1397
  return false;
1378
1398
  }
1379
1399
  return true;
@@ -1395,7 +1415,7 @@ exports.TextureDataMode = void 0;
1395
1415
  _proto.updateWeights = function updateWeights(weights) {
1396
1416
  var _this = this;
1397
1417
  if (weights.length != this.morphWeightsArray.length) {
1398
- console.error("Length of morph weights mismatch: input " + weights.length + ", internel " + this.morphWeightsArray.length);
1418
+ console.error("Length of morph weights mismatch: input " + weights.length + ", internel " + this.morphWeightsArray.length + ".");
1399
1419
  return;
1400
1420
  }
1401
1421
  weights.forEach(function(value, index) {
@@ -1516,16 +1536,16 @@ exports.PAnimPathType = void 0;
1516
1536
  this.component = this.dataArray.length / this.timeArray.length;
1517
1537
  // special checker for weights animation
1518
1538
  if (this.component <= 0) {
1519
- console.error("Invalid weights component: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length);
1539
+ console.error("Invalid weights component: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length + ".");
1520
1540
  } else if (this.timeArray.length * this.component != this.dataArray.length) {
1521
- console.error("Invalid weights array length: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length);
1541
+ console.error("Invalid weights array length: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length + ".");
1522
1542
  }
1523
1543
  } else {
1524
1544
  // should never happened
1525
- console.error("Invalid path status: " + path);
1545
+ console.error("Invalid path status: " + path + ".");
1526
1546
  }
1527
1547
  if (this.timeArray.length * this.component > this.dataArray.length) {
1528
- throw new Error("Data length mismatch: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length);
1548
+ throw new Error("Data length mismatch: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length + ".");
1529
1549
  }
1530
1550
  if (interpolation === "LINEAR") {
1531
1551
  this.interp = 0;
@@ -1650,21 +1670,21 @@ exports.PAnimPathType = void 0;
1650
1670
  }
1651
1671
  var _this_buffer_data;
1652
1672
  var data = (_this_buffer_data = (_this_buffer = this.buffer) == null ? void 0 : _this_buffer.data) != null ? _this_buffer_data : new Float32Array(this.getSize() * 4);
1653
- var type = this.isHalfFloat ? effects.glContext.HALF_FLOAT : effects.glContext.FLOAT;
1654
- this.texture = effects.Texture.create(this.engine, {
1673
+ var type = this.isHalfFloat ? EFFECTS.glContext.HALF_FLOAT : EFFECTS.glContext.FLOAT;
1674
+ this.texture = EFFECTS.Texture.create(this.engine, {
1655
1675
  name: name,
1656
1676
  data: {
1657
1677
  width: this.width,
1658
1678
  height: this.height,
1659
1679
  data: data
1660
1680
  },
1661
- target: effects.glContext.TEXTURE_2D,
1662
- format: effects.glContext.RGBA,
1681
+ target: EFFECTS.glContext.TEXTURE_2D,
1682
+ format: EFFECTS.glContext.RGBA,
1663
1683
  type: type,
1664
- wrapS: effects.glContext.CLAMP_TO_EDGE,
1665
- wrapT: effects.glContext.CLAMP_TO_EDGE,
1666
- minFilter: effects.glContext.NEAREST,
1667
- magFilter: effects.glContext.NEAREST
1684
+ wrapS: EFFECTS.glContext.CLAMP_TO_EDGE,
1685
+ wrapT: EFFECTS.glContext.CLAMP_TO_EDGE,
1686
+ minFilter: EFFECTS.glContext.NEAREST,
1687
+ magFilter: EFFECTS.glContext.NEAREST
1668
1688
  });
1669
1689
  };
1670
1690
  /**
@@ -1678,13 +1698,13 @@ exports.PAnimPathType = void 0;
1678
1698
  var _this_buffer;
1679
1699
  var _this_buffer_data;
1680
1700
  this.texture.updateSource({
1681
- sourceType: effects.TextureSourceType.data,
1701
+ sourceType: EFFECTS.TextureSourceType.data,
1682
1702
  data: {
1683
1703
  width: this.width,
1684
1704
  height: this.height,
1685
1705
  data: (_this_buffer_data = (_this_buffer = this.buffer) == null ? void 0 : _this_buffer.data) != null ? _this_buffer_data : buffer
1686
1706
  },
1687
- target: effects.glContext.TEXTURE_2D
1707
+ target: EFFECTS.glContext.TEXTURE_2D
1688
1708
  });
1689
1709
  }
1690
1710
  };
@@ -1882,7 +1902,7 @@ var deg2rad = Math.PI / 180;
1882
1902
  */ _this.aspect = 1.0;
1883
1903
  /**
1884
1904
  * 剪裁模式,默认是剪裁左右
1885
- */ _this.clipMode = effects.spec.CameraClipMode.landscape;
1905
+ */ _this.clipMode = EFFECTS.spec.CameraClipMode.landscape;
1886
1906
  /**
1887
1907
  * 投影矩阵
1888
1908
  */ _this.projectionMatrix = new Matrix4();
@@ -1905,7 +1925,7 @@ var deg2rad = Math.PI / 180;
1905
1925
  var _data_aspect;
1906
1926
  _this.aspect = (_data_aspect = data.aspect) != null ? _data_aspect : _this.width / _this.height;
1907
1927
  var _data_clipMode;
1908
- _this.clipMode = (_data_clipMode = data.clipMode) != null ? _data_clipMode : effects.spec.CameraClipMode.landscape;
1928
+ _this.clipMode = (_data_clipMode = data.clipMode) != null ? _data_clipMode : EFFECTS.spec.CameraClipMode.landscape;
1909
1929
  _this.update();
1910
1930
  return _this;
1911
1931
  }
@@ -1916,7 +1936,7 @@ var deg2rad = Math.PI / 180;
1916
1936
  if (this.owner !== undefined) {
1917
1937
  this.transform.fromEffectsTransform(this.owner.transform);
1918
1938
  }
1919
- var reverse = this.clipMode === effects.spec.CameraClipMode.portrait;
1939
+ var reverse = this.clipMode === EFFECTS.spec.CameraClipMode.portrait;
1920
1940
  this.projectionMatrix.perspective(this.fov * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse);
1921
1941
  this.viewMatrix = this.matrix.invert();
1922
1942
  };
@@ -1925,7 +1945,7 @@ var deg2rad = Math.PI / 180;
1925
1945
  * @param fov - 视角大小
1926
1946
  * @returns 投影矩阵
1927
1947
  */ _proto.getNewProjectionMatrix = function getNewProjectionMatrix(fov) {
1928
- var reverse = this.clipMode === effects.spec.CameraClipMode.portrait;
1948
+ var reverse = this.clipMode === EFFECTS.spec.CameraClipMode.portrait;
1929
1949
  return new Matrix4().perspective(Math.min(fov * 1.25, 140) * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse);
1930
1950
  };
1931
1951
  /**
@@ -1973,7 +1993,7 @@ var deg2rad = Math.PI / 180;
1973
1993
  * 是否剪裁上下
1974
1994
  * @returns
1975
1995
  */ _proto.isReversed = function isReversed() {
1976
- return this.clipMode === effects.spec.CameraClipMode.portrait;
1996
+ return this.clipMode === EFFECTS.spec.CameraClipMode.portrait;
1977
1997
  };
1978
1998
  /**
1979
1999
  * 获取眼睛位置
@@ -2002,7 +2022,7 @@ var deg2rad = Math.PI / 180;
2002
2022
  fov: 60,
2003
2023
  far: 1000,
2004
2024
  near: 0.001,
2005
- clipMode: effects.spec.CameraClipMode.portrait,
2025
+ clipMode: EFFECTS.spec.CameraClipMode.portrait,
2006
2026
  item: {
2007
2027
  id: "0"
2008
2028
  }
@@ -2155,11 +2175,11 @@ var deg2rad = Math.PI / 180;
2155
2175
  var color = data.color;
2156
2176
  _this.color = new Vector3(color.r, color.g, color.b);
2157
2177
  _this.intensity = data.intensity;
2158
- if (data.lightType === effects.spec.LightType.point) {
2178
+ if (data.lightType === EFFECTS.spec.LightType.point) {
2159
2179
  _this.lightType = exports.PLightType.point;
2160
2180
  var _data_range;
2161
2181
  _this.range = (_data_range = data.range) != null ? _data_range : -1;
2162
- } else if (data.lightType === effects.spec.LightType.spot) {
2182
+ } else if (data.lightType === EFFECTS.spec.LightType.spot) {
2163
2183
  _this.lightType = exports.PLightType.spot;
2164
2184
  var _data_range1;
2165
2185
  _this.range = (_data_range1 = data.range) != null ? _data_range1 : -1;
@@ -2167,7 +2187,7 @@ var deg2rad = Math.PI / 180;
2167
2187
  _this.outerConeAngle = (_data_outerConeAngle = data.outerConeAngle) != null ? _data_outerConeAngle : Math.PI;
2168
2188
  var _data_innerConeAngle;
2169
2189
  _this.innerConeAngle = (_data_innerConeAngle = data.innerConeAngle) != null ? _data_innerConeAngle : 0;
2170
- } else if (data.lightType === effects.spec.LightType.directional) {
2190
+ } else if (data.lightType === EFFECTS.spec.LightType.directional) {
2171
2191
  _this.lightType = exports.PLightType.directional;
2172
2192
  } else {
2173
2193
  _this.lightType = exports.PLightType.ambient;
@@ -2309,14 +2329,14 @@ function _assert_this_initialized(self) {
2309
2329
  */ _proto.addDepthAttachment = function addDepthAttachment(options) {
2310
2330
  var _options_storageType;
2311
2331
  this.depthAttachment = {
2312
- storageType: (_options_storageType = options.storageType) != null ? _options_storageType : effects.RenderPassAttachmentStorageType.depth_16_texture
2332
+ storageType: (_options_storageType = options.storageType) != null ? _options_storageType : EFFECTS.RenderPassAttachmentStorageType.depth_16_texture
2313
2333
  };
2314
2334
  };
2315
2335
  /**
2316
2336
  * 添加默认深度附件,数据格式是 depth_16_texture
2317
2337
  */ _proto.addDefaultDepthAttachment = function addDefaultDepthAttachment() {
2318
2338
  this.depthAttachment = {
2319
- storageType: effects.RenderPassAttachmentStorageType.depth_16_texture
2339
+ storageType: EFFECTS.RenderPassAttachmentStorageType.depth_16_texture
2320
2340
  };
2321
2341
  };
2322
2342
  /**
@@ -2331,10 +2351,10 @@ function _assert_this_initialized(self) {
2331
2351
  var _options_format, _options_type, _options_filter, _options_filter1;
2332
2352
  this.colorAttachments.push({
2333
2353
  texture: {
2334
- format: (_options_format = options.format) != null ? _options_format : effects.glContext.RGBA,
2335
- type: (_options_type = options.type) != null ? _options_type : effects.glContext.HALF_FLOAT,
2336
- minFilter: (_options_filter = options.filter) != null ? _options_filter : effects.glContext.LINEAR,
2337
- magFilter: (_options_filter1 = options.filter) != null ? _options_filter1 : effects.glContext.LINEAR
2354
+ format: (_options_format = options.format) != null ? _options_format : EFFECTS.glContext.RGBA,
2355
+ type: (_options_type = options.type) != null ? _options_type : EFFECTS.glContext.HALF_FLOAT,
2356
+ minFilter: (_options_filter = options.filter) != null ? _options_filter : EFFECTS.glContext.LINEAR,
2357
+ magFilter: (_options_filter1 = options.filter) != null ? _options_filter1 : EFFECTS.glContext.LINEAR
2338
2358
  }
2339
2359
  });
2340
2360
  };
@@ -2367,7 +2387,7 @@ function _assert_this_initialized(self) {
2367
2387
  * 包围盒 Mesh 类,负责 3D Mesh 测试包围盒的显示
2368
2388
  */ var BoxMesh = /*#__PURE__*/ function() {
2369
2389
  function BoxMesh(engine, priority) {
2370
- var material = effects.Material.create(engine, {
2390
+ var material = EFFECTS.Material.create(engine, {
2371
2391
  shader: {
2372
2392
  vertex: this.vertexShader,
2373
2393
  fragment: this.fragmentShader,
@@ -2376,10 +2396,10 @@ function _assert_this_initialized(self) {
2376
2396
  });
2377
2397
  material.depthTest = true;
2378
2398
  material.depthMask = true;
2379
- this.mesh = effects.Mesh.create(engine, {
2399
+ this.mesh = EFFECTS.Mesh.create(engine, {
2380
2400
  name: "boxMesh",
2381
2401
  material: material,
2382
- geometry: effects.Geometry.create(engine, this.geometry),
2402
+ geometry: EFFECTS.Geometry.create(engine, this.geometry),
2383
2403
  priority: priority
2384
2404
  });
2385
2405
  }
@@ -2467,14 +2487,14 @@ function _assert_this_initialized(self) {
2467
2487
  return {
2468
2488
  attributes: {
2469
2489
  aPos: {
2470
- type: effects.glContext.FLOAT,
2490
+ type: EFFECTS.glContext.FLOAT,
2471
2491
  size: 1,
2472
2492
  data: data,
2473
2493
  stride: Float32Array.BYTES_PER_ELEMENT,
2474
2494
  offset: 0
2475
2495
  }
2476
2496
  },
2477
- mode: effects.glContext.LINES,
2497
+ mode: EFFECTS.glContext.LINES,
2478
2498
  indices: {
2479
2499
  data: index
2480
2500
  },
@@ -2545,7 +2565,7 @@ function _assert_this_initialized(self) {
2545
2565
  _this.subMeshes.push(subMesh);
2546
2566
  });
2547
2567
  if (_this.subMeshes.length <= 0) {
2548
- console.warn("No primitive inside mesh item " + name);
2568
+ console.warn("No primitive inside mesh item " + name + ".");
2549
2569
  }
2550
2570
  _this.boundingBox = _this.getItemBoundingBox(meshData.interaction);
2551
2571
  return _this;
@@ -2633,7 +2653,7 @@ function _assert_this_initialized(self) {
2633
2653
  return;
2634
2654
  }
2635
2655
  if (updatedArray.length != weightsArray.length) {
2636
- throw new Error("weight array length mismatch");
2656
+ throw new Error("Weight array length mismatch.");
2637
2657
  }
2638
2658
  for(var i = 0; i < updatedArray.length; i++){
2639
2659
  updatedArray[i] = weightsArray[i];
@@ -2749,7 +2769,7 @@ function _assert_this_initialized(self) {
2749
2769
  if (inBounding === undefined) {
2750
2770
  return new Box3();
2751
2771
  }
2752
- if (inBounding.type === effects.spec.ModelBoundingType.box) {
2772
+ if (inBounding.type === EFFECTS.spec.ModelBoundingType.box) {
2753
2773
  var _inBounding_center;
2754
2774
  var center = (_inBounding_center = inBounding.center) != null ? _inBounding_center : [
2755
2775
  0,
@@ -2884,12 +2904,12 @@ function _assert_this_initialized(self) {
2884
2904
  });
2885
2905
  this.material.setMaterialStates(material);
2886
2906
  } else {
2887
- material = effects.Material.create(this.engine, {
2907
+ material = EFFECTS.Material.create(this.engine, {
2888
2908
  shader: {
2889
2909
  vertex: this.material.vertexShaderCode,
2890
2910
  fragment: this.material.fragmentShaderCode,
2891
2911
  shared: globalState.shaderShared,
2892
- glslVersion: isWebGL2 ? effects.GLSLVersion.GLSL3 : effects.GLSLVersion.GLSL1
2912
+ glslVersion: isWebGL2 ? EFFECTS.GLSLVersion.GLSL3 : EFFECTS.GLSLVersion.GLSL1
2893
2913
  },
2894
2914
  uniformSemantics: newSemantics
2895
2915
  });
@@ -3124,7 +3144,7 @@ function _assert_this_initialized(self) {
3124
3144
  });
3125
3145
  }
3126
3146
  var proxy = new HitTestingProxy();
3127
- var doubleSided = this.material.isDoubleSide();
3147
+ var doubleSided = this.material.isBothSide();
3128
3148
  proxy.create(this.geometry.geometry, doubleSided, bindMatrices);
3129
3149
  return proxy.getHitPoint(newOrigin, newDirection);
3130
3150
  };
@@ -3155,21 +3175,21 @@ function _assert_this_initialized(self) {
3155
3175
  * @returns 返回相应的宏定义
3156
3176
  */ _proto.getRenderMode3DDefine = function getRenderMode3DDefine(mode) {
3157
3177
  switch(mode){
3158
- case effects.spec.RenderMode3D.uv:
3178
+ case EFFECTS.spec.RenderMode3D.uv:
3159
3179
  return "DEBUG_UV";
3160
- case effects.spec.RenderMode3D.normal:
3180
+ case EFFECTS.spec.RenderMode3D.normal:
3161
3181
  return "DEBUG_NORMAL";
3162
- case effects.spec.RenderMode3D.basecolor:
3182
+ case EFFECTS.spec.RenderMode3D.basecolor:
3163
3183
  return "DEBUG_BASECOLOR";
3164
- case effects.spec.RenderMode3D.alpha:
3184
+ case EFFECTS.spec.RenderMode3D.alpha:
3165
3185
  return "DEBUG_ALPHA";
3166
- case effects.spec.RenderMode3D.metallic:
3186
+ case EFFECTS.spec.RenderMode3D.metallic:
3167
3187
  return "DEBUG_METALLIC";
3168
- case effects.spec.RenderMode3D.roughness:
3188
+ case EFFECTS.spec.RenderMode3D.roughness:
3169
3189
  return "DEBUG_ROUGHNESS";
3170
- case effects.spec.RenderMode3D.ao:
3190
+ case EFFECTS.spec.RenderMode3D.ao:
3171
3191
  return "DEBUG_OCCLUSION";
3172
- case effects.spec.RenderMode3D.emissive:
3192
+ case EFFECTS.spec.RenderMode3D.emissive:
3173
3193
  return "DEBUG_EMISSIVE";
3174
3194
  }
3175
3195
  };
@@ -3265,8 +3285,7 @@ function _assert_this_initialized(self) {
3265
3285
  material.setVector3("_shCoefficients." + n, Vector3.fromArray(coeffs[i]));
3266
3286
  });
3267
3287
  }
3268
- var _skybox_specularMipCount;
3269
- material.setInt("_MipCount", (_skybox_specularMipCount = skybox.specularMipCount) != null ? _skybox_specularMipCount : 1);
3288
+ material.setInt("_MipCount", skybox.specularMipCount - 1);
3270
3289
  material.setTexture("_SpecularEnvSampler", skybox.specularImage);
3271
3290
  }
3272
3291
  }
@@ -3627,7 +3646,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3627
3646
  this.brdfLUT = this.sceneCache.getBrdfLutTexture();
3628
3647
  this.initGlobalState(opts);
3629
3648
  if (this.maxLightCount > 8) {
3630
- console.warn("Too many light items: " + this.maxLightCount + " light(s)");
3649
+ console.warn("Too many light items: " + this.maxLightCount + " light(s).");
3631
3650
  }
3632
3651
  };
3633
3652
  _proto.initGlobalState = function initGlobalState(opts) {
@@ -3637,13 +3656,13 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3637
3656
  globalState.isWebGL2 = capbility.level === 2;
3638
3657
  var _opts_runtimeEnv;
3639
3658
  //globalState.shaderShared = composition.env === PLAYER_OPTIONS_ENV_EDITOR;
3640
- globalState.runtimeEnv = (_opts_runtimeEnv = opts.runtimeEnv) != null ? _opts_runtimeEnv : effects.PLAYER_OPTIONS_ENV_EDITOR;
3659
+ globalState.runtimeEnv = (_opts_runtimeEnv = opts.runtimeEnv) != null ? _opts_runtimeEnv : EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
3641
3660
  var _opts_compatibleMode;
3642
3661
  globalState.compatibleMode = (_opts_compatibleMode = opts.compatibleMode) != null ? _opts_compatibleMode : "gltf";
3643
3662
  var _opts_visBoundingBox;
3644
3663
  globalState.visBoundingBox = (_opts_visBoundingBox = opts.visBoundingBox) != null ? _opts_visBoundingBox : false;
3645
3664
  var _opts_renderMode3D;
3646
- globalState.renderMode3D = (_opts_renderMode3D = opts.renderMode3D) != null ? _opts_renderMode3D : effects.spec.RenderMode3D.none;
3665
+ globalState.renderMode3D = (_opts_renderMode3D = opts.renderMode3D) != null ? _opts_renderMode3D : EFFECTS.spec.RenderMode3D.none;
3647
3666
  var _opts_renderMode3DUVGridSize;
3648
3667
  globalState.renderMode3DUVGridSize = (_opts_renderMode3DUVGridSize = opts.renderMode3DUVGridSize) != null ? _opts_renderMode3DUVGridSize : 1 / 16;
3649
3668
  };
@@ -3699,7 +3718,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3699
3718
  if (mesh.parentItemId !== undefined) {
3700
3719
  this.parentId2Mesh.set(mesh.parentItemId, mesh);
3701
3720
  }
3702
- effects.addItem(this.meshList, mesh);
3721
+ EFFECTS.addItem(this.meshList, mesh);
3703
3722
  } else if (_instanceof1(item, PSkybox)) {
3704
3723
  var skybox = item;
3705
3724
  skybox.setup(this.brdfLUT);
@@ -3716,7 +3735,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3716
3735
  } else {
3717
3736
  this.cameraManager.insertCamera(item);
3718
3737
  }
3719
- effects.addItem(this.itemList, item);
3738
+ EFFECTS.addItem(this.itemList, item);
3720
3739
  };
3721
3740
  /**
3722
3741
  * 从场景中删除插件元素
@@ -3727,7 +3746,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3727
3746
  if (mesh.parentItemId !== undefined) {
3728
3747
  this.parentId2Mesh.delete(mesh.parentItemId);
3729
3748
  }
3730
- effects.removeItem(this.meshList, mesh);
3749
+ EFFECTS.removeItem(this.meshList, mesh);
3731
3750
  } else if (_instanceof1(item, PSkybox)) {
3732
3751
  this.skybox = undefined;
3733
3752
  } else if (_instanceof1(item, PLight)) {
@@ -3735,13 +3754,13 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3735
3754
  } else {
3736
3755
  this.cameraManager.remove(item);
3737
3756
  }
3738
- effects.removeItem(this.itemList, item);
3757
+ EFFECTS.removeItem(this.itemList, item);
3739
3758
  };
3740
3759
  /**
3741
3760
  * 更新默认相机状态,根据传入的相机参数
3742
3761
  * @param camera - 相机参数
3743
3762
  */ _proto.updateDefaultCamera = function updateDefaultCamera(camera) {
3744
- var effectsTransfrom = new effects.Transform(_extends({}, camera, {
3763
+ var effectsTransfrom = new EFFECTS.Transform(_extends({}, camera, {
3745
3764
  valid: true
3746
3765
  }));
3747
3766
  var newTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
@@ -3772,9 +3791,9 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3772
3791
  maxLightCount: this.maxLightCount,
3773
3792
  skybox: this.skybox
3774
3793
  };
3775
- // if (this.enableDynamicSort) {
3776
- // this.dynamicSortMeshes(states);
3777
- // }
3794
+ if (this.enableDynamicSort) {
3795
+ this.dynamicSortMeshes(this.sceneStates);
3796
+ }
3778
3797
  this.tickCount += 1;
3779
3798
  this.lastTickSecond += deltaSeconds;
3780
3799
  };
@@ -3783,12 +3802,14 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3783
3802
  * 主要是为了和 Tiny 渲染对齐,正常渲染不进行调整
3784
3803
  * @param states - 场景中的状态数据
3785
3804
  */ _proto.dynamicSortMeshes = function dynamicSortMeshes(states) {
3786
- var meshList = [];
3805
+ var meshComponents = [];
3787
3806
  var priorityList = [];
3788
- var meshSet = this.renderedMeshSet.now;
3789
- meshSet.forEach(function(mesh) {
3790
- meshList.push(mesh);
3791
- priorityList.push(mesh.priority);
3807
+ this.meshList.forEach(function(mesh) {
3808
+ if (mesh.owner && mesh.owner.enabled) {
3809
+ var component = mesh.owner;
3810
+ meshComponents.push(component);
3811
+ priorityList.push(component.priority);
3812
+ }
3792
3813
  });
3793
3814
  priorityList.sort(function(a, b) {
3794
3815
  return a - b;
@@ -3796,26 +3817,30 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3796
3817
  // 按照 Tiny 排序算法,对 Mesh 对象进行排序
3797
3818
  // 将透明和不透明物体拆开,从而渲染正确
3798
3819
  var viewMatrix = states.viewMatrix;
3799
- meshList.sort(function(a, b) {
3820
+ meshComponents.sort(function(a, b) {
3800
3821
  var atransparent = WebGLHelper.isTransparentMesh(a);
3801
3822
  var btransparent = WebGLHelper.isTransparentMesh(b);
3802
3823
  if (atransparent && btransparent) {
3803
- var aposition = Vector3.fromArray(a.worldMatrix.elements, 12);
3804
- var bposition = Vector3.fromArray(b.worldMatrix.elements, 12);
3824
+ var aposition = a.transform.getWorldPosition();
3825
+ var bposition = b.transform.getWorldPosition();
3805
3826
  var anewPos = viewMatrix.transformPoint(aposition);
3806
3827
  var bnewPos = viewMatrix.transformPoint(bposition);
3807
- return anewPos.z - bnewPos.z;
3828
+ if (anewPos.z === bnewPos.z) {
3829
+ return a.priority - b.priority;
3830
+ } else {
3831
+ return anewPos.z - bnewPos.z;
3832
+ }
3808
3833
  } else if (atransparent) {
3809
3834
  return 1;
3810
3835
  } else if (btransparent) {
3811
3836
  return -1;
3812
3837
  } else {
3813
- return 0;
3838
+ return a.priority - b.priority;
3814
3839
  }
3815
3840
  });
3816
3841
  // 重新赋值渲染优先级
3817
- for(var i = 0; i < meshList.length; i++){
3818
- var mesh = meshList[i];
3842
+ for(var i = 0; i < meshComponents.length; i++){
3843
+ var mesh = meshComponents[i];
3819
3844
  var priority = priorityList[i];
3820
3845
  mesh.priority = priority;
3821
3846
  }
@@ -3960,7 +3985,7 @@ var StandardShaderSource;
3960
3985
  if (isWebGL2) {
3961
3986
  return "#version 300 es\n" + source;
3962
3987
  } else {
3963
- return "#version 100\n" + source;
3988
+ return source;
3964
3989
  }
3965
3990
  }
3966
3991
  /**
@@ -3977,9 +4002,8 @@ var StandardShaderSource;
3977
4002
  }
3978
4003
  if (isWebGL2) {
3979
4004
  return "#version 300 es\n" + source;
3980
- } else {
3981
- return "#version 100\n" + source;
3982
4005
  }
4006
+ return source;
3983
4007
  }
3984
4008
  StandardShaderSource.getSourceCode = getSourceCode;
3985
4009
  })(StandardShaderSource || (StandardShaderSource = {}));
@@ -4257,7 +4281,7 @@ function getQuadFilterVS() {
4257
4281
  if (func !== undefined) {
4258
4282
  return func(context);
4259
4283
  } else {
4260
- throw new Error("Invalid material type " + materialType + ", shader content " + context);
4284
+ throw new Error("Invalid material type " + materialType + ", shader content " + context + ".");
4261
4285
  }
4262
4286
  };
4263
4287
  /**
@@ -4385,12 +4409,12 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
4385
4409
  var bounding = _this.bounding;
4386
4410
  if (bounding && (force || Number.isInteger(bounding.behavior))) {
4387
4411
  var type = bounding.type;
4388
- if (type === effects.spec.ModelBoundingType.box) {
4412
+ if (type === EFFECTS.spec.ModelBoundingType.box) {
4389
4413
  if (_instanceof1(_this.content, PMesh)) {
4390
4414
  var mesh = _this.content;
4391
4415
  var customHitTest = {
4392
4416
  behavior: bounding.behavior,
4393
- type: effects.HitTestType.custom,
4417
+ type: EFFECTS.HitTestType.custom,
4394
4418
  collect: function collect(ray, pointInCanvas) {
4395
4419
  var result = mesh.hitTesting(ray.origin, ray.direction);
4396
4420
  return result;
@@ -4401,7 +4425,7 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
4401
4425
  var worldMatrixData = _this.transform.getWorldMatrix();
4402
4426
  var customHitTest1 = {
4403
4427
  behavior: bounding.behavior,
4404
- type: effects.HitTestType.custom,
4428
+ type: EFFECTS.HitTestType.custom,
4405
4429
  collect: function collect(ray, pointInCanvas) {
4406
4430
  var result = RayIntersectsBoxWithRotation(ray, worldMatrixData, bounding);
4407
4431
  return result;
@@ -4409,7 +4433,7 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
4409
4433
  };
4410
4434
  return customHitTest1;
4411
4435
  }
4412
- } else if (type === effects.spec.ModelBoundingType.sphere) {
4436
+ } else if (type === EFFECTS.spec.ModelBoundingType.sphere) {
4413
4437
  var pos = new Vector3();
4414
4438
  _this.transform.assignWorldTRS(pos);
4415
4439
  var center = new Vector3();
@@ -4516,7 +4540,7 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
4516
4540
  var size = bbox.getSize(new Vector3());
4517
4541
  this.bounding = {
4518
4542
  behavior: (_this_bounding = this.bounding) == null ? void 0 : _this_bounding.behavior,
4519
- type: effects.spec.ModelBoundingType.box,
4543
+ type: EFFECTS.spec.ModelBoundingType.box,
4520
4544
  center: [
4521
4545
  center.x,
4522
4546
  center.y,
@@ -4534,9 +4558,9 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
4534
4558
  }
4535
4559
  };
4536
4560
  return ModelMeshComponent;
4537
- }(effects.RendererComponent);
4561
+ }(EFFECTS.RendererComponent);
4538
4562
  exports.ModelMeshComponent = __decorate([
4539
- effects.effectsClass(effects.spec.DataType.MeshComponent)
4563
+ EFFECTS.effectsClass(EFFECTS.spec.DataType.MeshComponent)
4540
4564
  ], exports.ModelMeshComponent);
4541
4565
  exports.ModelSkyboxComponent = /*#__PURE__*/ function(RendererComponent) {
4542
4566
  _inherits(ModelSkyboxComponent, RendererComponent);
@@ -4608,9 +4632,9 @@ exports.ModelSkyboxComponent = /*#__PURE__*/ function(RendererComponent) {
4608
4632
  return (_this_content_visible = (_this_content = this.content) == null ? void 0 : _this_content.visible) != null ? _this_content_visible : false;
4609
4633
  };
4610
4634
  return ModelSkyboxComponent;
4611
- }(effects.RendererComponent);
4635
+ }(EFFECTS.RendererComponent);
4612
4636
  exports.ModelSkyboxComponent = __decorate([
4613
- effects.effectsClass(effects.spec.DataType.SkyboxComponent)
4637
+ EFFECTS.effectsClass(EFFECTS.spec.DataType.SkyboxComponent)
4614
4638
  ], exports.ModelSkyboxComponent);
4615
4639
  exports.ModelLightComponent = /*#__PURE__*/ function(ItemBehaviour) {
4616
4640
  _inherits(ModelLightComponent, ItemBehaviour);
@@ -4673,9 +4697,9 @@ exports.ModelLightComponent = /*#__PURE__*/ function(ItemBehaviour) {
4673
4697
  return (_this_content_visible = (_this_content = this.content) == null ? void 0 : _this_content.visible) != null ? _this_content_visible : false;
4674
4698
  };
4675
4699
  return ModelLightComponent;
4676
- }(effects.ItemBehaviour);
4700
+ }(EFFECTS.ItemBehaviour);
4677
4701
  exports.ModelLightComponent = __decorate([
4678
- effects.effectsClass(effects.spec.DataType.LightComponent)
4702
+ EFFECTS.effectsClass(EFFECTS.spec.DataType.LightComponent)
4679
4703
  ], exports.ModelLightComponent);
4680
4704
  exports.ModelCameraComponent = /*#__PURE__*/ function(ItemBehaviour) {
4681
4705
  _inherits(ModelCameraComponent, ItemBehaviour);
@@ -4707,7 +4731,8 @@ exports.ModelCameraComponent = /*#__PURE__*/ function(ItemBehaviour) {
4707
4731
  /**
4708
4732
  * 组件销毁
4709
4733
  */ _proto.onDestroy = function onDestroy() {
4710
- this.content.dispose();
4734
+ var _this_content;
4735
+ (_this_content = this.content) == null ? void 0 : _this_content.dispose();
4711
4736
  };
4712
4737
  /**
4713
4738
  * 反序列化,记录传入参数
@@ -4753,9 +4778,9 @@ exports.ModelCameraComponent = /*#__PURE__*/ function(ItemBehaviour) {
4753
4778
  this.updateMainCamera();
4754
4779
  };
4755
4780
  return ModelCameraComponent;
4756
- }(effects.ItemBehaviour);
4781
+ }(EFFECTS.ItemBehaviour);
4757
4782
  exports.ModelCameraComponent = __decorate([
4758
- effects.effectsClass(effects.spec.DataType.CameraComponent)
4783
+ EFFECTS.effectsClass(EFFECTS.spec.DataType.CameraComponent)
4759
4784
  ], exports.ModelCameraComponent);
4760
4785
  exports.AnimationComponent = /*#__PURE__*/ function(ItemBehaviour) {
4761
4786
  _inherits(AnimationComponent, ItemBehaviour);
@@ -4806,9 +4831,9 @@ exports.AnimationComponent = /*#__PURE__*/ function(ItemBehaviour) {
4806
4831
  });
4807
4832
  };
4808
4833
  return AnimationComponent;
4809
- }(effects.ItemBehaviour);
4834
+ }(EFFECTS.ItemBehaviour);
4810
4835
  exports.AnimationComponent = __decorate([
4811
- effects.effectsClass(effects.spec.DataType.AnimationComponent)
4836
+ EFFECTS.effectsClass(EFFECTS.spec.DataType.AnimationComponent)
4812
4837
  ], exports.AnimationComponent);
4813
4838
  var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
4814
4839
  _inherits(ModelAnimationClip, AnimationClip);
@@ -4824,29 +4849,25 @@ var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
4824
4849
  var life = Math.max(0, time) % duration;
4825
4850
  for(var _iterator = _create_for_of_iterator_helper_loose(this.positionCurves), _step; !(_step = _iterator()).done;){
4826
4851
  var curve = _step.value;
4827
- var maxTime = curve.keyFrames.getMaxTime();
4828
- var value = curve.keyFrames.getValue(life % maxTime);
4852
+ var value = curve.keyFrames.getValue(life % this.duration);
4829
4853
  var target = this.getTargetItem(vfxItem, curve.path);
4830
4854
  target == null ? void 0 : target.transform.setPosition(value.x, value.y, value.z);
4831
4855
  }
4832
4856
  for(var _iterator1 = _create_for_of_iterator_helper_loose(this.rotationCurves), _step1; !(_step1 = _iterator1()).done;){
4833
4857
  var curve1 = _step1.value;
4834
- var maxTime1 = curve1.keyFrames.getMaxTime();
4835
- var value1 = curve1.keyFrames.getValue(life % maxTime1);
4858
+ var value1 = curve1.keyFrames.getValue(life % this.duration);
4836
4859
  var target1 = this.getTargetItem(vfxItem, curve1.path);
4837
4860
  target1 == null ? void 0 : target1.transform.setQuaternion(value1.x, value1.y, value1.z, value1.w);
4838
4861
  }
4839
4862
  for(var _iterator2 = _create_for_of_iterator_helper_loose(this.scaleCurves), _step2; !(_step2 = _iterator2()).done;){
4840
4863
  var curve2 = _step2.value;
4841
- var maxTime2 = curve2.keyFrames.getMaxTime();
4842
- var value2 = curve2.keyFrames.getValue(life % maxTime2);
4864
+ var value2 = curve2.keyFrames.getValue(life % this.duration);
4843
4865
  var target2 = this.getTargetItem(vfxItem, curve2.path);
4844
4866
  target2 == null ? void 0 : target2.transform.setScale(value2.x, value2.y, value2.z);
4845
4867
  }
4846
4868
  for(var _iterator3 = _create_for_of_iterator_helper_loose(this.floatCurves), _step3; !(_step3 = _iterator3()).done;){
4847
4869
  var curve3 = _step3.value;
4848
- var maxTime3 = curve3.keyFrames.getMaxTime();
4849
- var value3 = curve3.keyFrames.getValue(life % maxTime3);
4870
+ var value3 = curve3.keyFrames.getValue(life % this.duration);
4850
4871
  var target3 = this.getTargetItem(vfxItem, curve3.path);
4851
4872
  if (curve3.className === "ModelMeshComponent") {
4852
4873
  var component = target3 == null ? void 0 : target3.getComponent(exports.ModelMeshComponent);
@@ -4854,14 +4875,15 @@ var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
4854
4875
  var properties = curve3.property.split(".");
4855
4876
  setProperty(component, properties, value3);
4856
4877
  } else {
4857
- console.error("Can't find mesh component");
4878
+ console.error("Can't find mesh component.");
4858
4879
  }
4859
4880
  } else {
4860
- console.warn("Ignore curve: className " + curve3.className);
4881
+ console.warn("Ignore curve: className " + curve3.className + ".");
4861
4882
  }
4862
4883
  }
4863
4884
  };
4864
4885
  _proto.setFromAnimationClip = function setFromAnimationClip(clip) {
4886
+ this.duration = clip.duration;
4865
4887
  this.positionCurves = clip.positionCurves.slice();
4866
4888
  this.rotationCurves = clip.rotationCurves.slice();
4867
4889
  this.scaleCurves = clip.scaleCurves.slice();
@@ -4885,21 +4907,21 @@ var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
4885
4907
  }
4886
4908
  }
4887
4909
  if (!findTag) {
4888
- throw new Error("Can't find path in tree " + rootItem.id + ", " + path);
4910
+ throw new Error("Can't find path in tree " + rootItem.id + ", " + path + ".");
4889
4911
  }
4890
4912
  }
4891
4913
  this.path2Node[path] = target;
4892
4914
  return target;
4893
4915
  };
4894
4916
  return ModelAnimationClip;
4895
- }(effects.AnimationClip);
4917
+ }(EFFECTS.AnimationClip);
4896
4918
  function setProperty(obj, properties, value) {
4897
4919
  var len = properties.length;
4898
4920
  var current = obj;
4899
4921
  for(var i = 0; i < len - 1; i++){
4900
4922
  var propName = properties[i];
4901
4923
  if (!(propName in current) || typeof current[propName] !== "object") {
4902
- console.error("Invalid properties " + properties);
4924
+ console.error("Invalid properties " + properties + ".");
4903
4925
  return;
4904
4926
  }
4905
4927
  current = current[propName];
@@ -5142,13 +5164,13 @@ var normal = new Vector3();
5142
5164
  var blob, urlCreator, imageUrl, imageObj;
5143
5165
  return __generator(this, function(_state) {
5144
5166
  if (image.imageData === undefined) {
5145
- console.error("createTexture2D: Invalid image data from " + image);
5167
+ console.error("createTexture2D: Invalid image data from " + image + ".");
5146
5168
  // 这里不应该发生的,做个兜底
5147
5169
  return [
5148
5170
  2,
5149
- effects.Texture.create(engine, {
5171
+ EFFECTS.Texture.create(engine, {
5150
5172
  name: "createTexture2D",
5151
- sourceType: effects.TextureSourceType.data,
5173
+ sourceType: EFFECTS.TextureSourceType.data,
5152
5174
  data: {
5153
5175
  data: new Uint8Array([
5154
5176
  255,
@@ -5176,34 +5198,34 @@ var normal = new Vector3();
5176
5198
  new Promise(function(resolve, reject) {
5177
5199
  imageObj.onload = function() {
5178
5200
  var _texture_minFilter;
5179
- var minFilter = (_texture_minFilter = texture.minFilter) != null ? _texture_minFilter : effects.glContext.LINEAR_MIPMAP_LINEAR;
5201
+ var minFilter = (_texture_minFilter = texture.minFilter) != null ? _texture_minFilter : EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
5180
5202
  var premultiplyAlpha = false;
5181
5203
  if (tiny3dMode) {
5182
5204
  //if (minFilter === glContext.NEAREST_MIPMAP_LINEAR
5183
5205
  // || minFilter === glContext.LINEAR_MIPMAP_NEAREST) {
5184
- minFilter = effects.glContext.LINEAR_MIPMAP_LINEAR;
5206
+ minFilter = EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
5185
5207
  //}
5186
5208
  if (!WebGLHelper.isPow2(imageObj.width) || !WebGLHelper.isPow2(imageObj.height)) {
5187
- minFilter = effects.glContext.LINEAR;
5209
+ minFilter = EFFECTS.glContext.LINEAR;
5188
5210
  }
5189
5211
  //
5190
5212
  premultiplyAlpha = isBaseColor ? false : true;
5191
5213
  }
5192
5214
  var generateMipmap = false;
5193
- if (minFilter == effects.glContext.NEAREST_MIPMAP_NEAREST || minFilter == effects.glContext.LINEAR_MIPMAP_NEAREST || minFilter == effects.glContext.NEAREST_MIPMAP_LINEAR || minFilter == effects.glContext.LINEAR_MIPMAP_LINEAR) {
5215
+ if (minFilter == EFFECTS.glContext.NEAREST_MIPMAP_NEAREST || minFilter == EFFECTS.glContext.LINEAR_MIPMAP_NEAREST || minFilter == EFFECTS.glContext.NEAREST_MIPMAP_LINEAR || minFilter == EFFECTS.glContext.LINEAR_MIPMAP_LINEAR) {
5194
5216
  generateMipmap = true;
5195
5217
  }
5196
5218
  var _texture_wrapS, _texture_wrapT, _texture_magFilter;
5197
- var res = effects.Texture.create(engine, {
5219
+ var res = EFFECTS.Texture.create(engine, {
5198
5220
  name: "createTexture2D",
5199
- wrapS: (_texture_wrapS = texture.wrapS) != null ? _texture_wrapS : effects.glContext.REPEAT,
5200
- wrapT: (_texture_wrapT = texture.wrapT) != null ? _texture_wrapT : effects.glContext.REPEAT,
5201
- magFilter: (_texture_magFilter = texture.magFilter) != null ? _texture_magFilter : effects.glContext.LINEAR,
5221
+ wrapS: (_texture_wrapS = texture.wrapS) != null ? _texture_wrapS : EFFECTS.glContext.REPEAT,
5222
+ wrapT: (_texture_wrapT = texture.wrapT) != null ? _texture_wrapT : EFFECTS.glContext.REPEAT,
5223
+ magFilter: (_texture_magFilter = texture.magFilter) != null ? _texture_magFilter : EFFECTS.glContext.LINEAR,
5202
5224
  minFilter: minFilter,
5203
5225
  anisotropic: 1,
5204
5226
  //flipY: tex.flipY,
5205
5227
  premultiplyAlpha: premultiplyAlpha,
5206
- sourceType: effects.TextureSourceType.image,
5228
+ sourceType: EFFECTS.TextureSourceType.image,
5207
5229
  image: imageObj,
5208
5230
  generateMipmap: generateMipmap
5209
5231
  });
@@ -5369,9 +5391,9 @@ var normal = new Vector3();
5369
5391
  case 0:
5370
5392
  return [
5371
5393
  4,
5372
- effects.getDefaultTextureFactory().loadSource({
5373
- type: effects.TextureSourceType.image,
5374
- target: effects.glContext.TEXTURE_CUBE_MAP,
5394
+ EFFECTS.getDefaultTextureFactory().loadSource({
5395
+ type: EFFECTS.TextureSourceType.image,
5396
+ target: EFFECTS.glContext.TEXTURE_CUBE_MAP,
5375
5397
  map: cubeImage
5376
5398
  }, _this.cubemapTexConfig)
5377
5399
  ];
@@ -5379,7 +5401,7 @@ var normal = new Vector3();
5379
5401
  textureOptions = _state.sent();
5380
5402
  return [
5381
5403
  2,
5382
- effects.Texture.create(engine, textureOptions)
5404
+ EFFECTS.Texture.create(engine, textureOptions)
5383
5405
  ];
5384
5406
  }
5385
5407
  });
@@ -5399,9 +5421,9 @@ var normal = new Vector3();
5399
5421
  case 0:
5400
5422
  return [
5401
5423
  4,
5402
- effects.getDefaultTextureFactory().loadSource({
5403
- type: effects.TextureSourceType.mipmaps,
5404
- target: effects.glContext.TEXTURE_CUBE_MAP,
5424
+ EFFECTS.getDefaultTextureFactory().loadSource({
5425
+ type: EFFECTS.TextureSourceType.mipmaps,
5426
+ target: EFFECTS.glContext.TEXTURE_CUBE_MAP,
5405
5427
  maps: cubeImages
5406
5428
  }, _this.cubemapMipTexConfig)
5407
5429
  ];
@@ -5409,7 +5431,7 @@ var normal = new Vector3();
5409
5431
  textureOptions = _state.sent();
5410
5432
  return [
5411
5433
  2,
5412
- effects.Texture.create(engine, textureOptions)
5434
+ EFFECTS.Texture.create(engine, textureOptions)
5413
5435
  ];
5414
5436
  }
5415
5437
  });
@@ -5435,11 +5457,11 @@ var normal = new Vector3();
5435
5457
  cubemap = _state.sent();
5436
5458
  return [
5437
5459
  2,
5438
- effects.Texture.create(engine, _extends({
5460
+ EFFECTS.Texture.create(engine, _extends({
5439
5461
  name: "createTextureCubeFromBuffer",
5440
- sourceType: effects.TextureSourceType.image,
5462
+ sourceType: EFFECTS.TextureSourceType.image,
5441
5463
  cube: cubemap,
5442
- target: effects.glContext.TEXTURE_CUBE_MAP
5464
+ target: EFFECTS.glContext.TEXTURE_CUBE_MAP
5443
5465
  }, _this.cubemapTexConfig))
5444
5466
  ];
5445
5467
  }
@@ -5480,7 +5502,7 @@ var normal = new Vector3();
5480
5502
  url = "https://gw.alipayobjects.com/zos/gltf-asset/67896749597915/img" + index + ".png";
5481
5503
  return [
5482
5504
  4,
5483
- effects.loadImage(url)
5505
+ EFFECTS.loadImage(url)
5484
5506
  ];
5485
5507
  case 3:
5486
5508
  imageData = _state.sent();
@@ -5499,11 +5521,11 @@ var normal = new Vector3();
5499
5521
  case 4:
5500
5522
  return [
5501
5523
  2,
5502
- effects.Texture.create(engine, _extends({
5524
+ EFFECTS.Texture.create(engine, _extends({
5503
5525
  name: "createTextureCubeMipmapFromBuffer",
5504
- sourceType: effects.TextureSourceType.mipmaps,
5526
+ sourceType: EFFECTS.TextureSourceType.mipmaps,
5505
5527
  mipmaps: mipmaps,
5506
- target: effects.glContext.TEXTURE_CUBE_MAP
5528
+ target: EFFECTS.glContext.TEXTURE_CUBE_MAP
5507
5529
  }, _this.cubemapMipTexConfig))
5508
5530
  ];
5509
5531
  }
@@ -5531,14 +5553,14 @@ var normal = new Vector3();
5531
5553
  var options = {
5532
5554
  name: "createTextureFromImage",
5533
5555
  image: image,
5534
- sourceType: effects.TextureSourceType.image,
5556
+ sourceType: EFFECTS.TextureSourceType.image,
5535
5557
  flipY: false,
5536
- magFilter: effects.glContext.LINEAR,
5537
- minFilter: effects.glContext.LINEAR,
5538
- wrapT: effects.glContext.REPEAT,
5539
- wrapS: effects.glContext.REPEAT
5558
+ magFilter: EFFECTS.glContext.LINEAR,
5559
+ minFilter: EFFECTS.glContext.LINEAR,
5560
+ wrapT: EFFECTS.glContext.REPEAT,
5561
+ wrapS: EFFECTS.glContext.REPEAT
5540
5562
  };
5541
- return effects.Texture.create(engine, options);
5563
+ return EFFECTS.Texture.create(engine, options);
5542
5564
  };
5543
5565
  /**
5544
5566
  * 创建渲染 Pass
@@ -5549,10 +5571,10 @@ var normal = new Vector3();
5549
5571
  * @param fboOpts - FBO 参数
5550
5572
  * @returns
5551
5573
  */ WebGLHelper.createRenderPass = function createRenderPass(renderer, name, priority, meshData, fboOpts) {
5552
- var meshList = _instanceof1(meshData, effects.Mesh) ? [
5574
+ var meshList = _instanceof1(meshData, EFFECTS.Mesh) ? [
5553
5575
  meshData
5554
5576
  ] : meshData;
5555
- return new effects.RenderPass(renderer, {
5577
+ return new EFFECTS.RenderPass(renderer, {
5556
5578
  name: name,
5557
5579
  priority: priority,
5558
5580
  attachments: fboOpts.colorAttachments,
@@ -5566,8 +5588,8 @@ var normal = new Vector3();
5566
5588
  0,
5567
5589
  0
5568
5590
  ],
5569
- colorAction: effects.TextureLoadAction.clear,
5570
- depthAction: effects.TextureLoadAction.clear
5591
+ colorAction: EFFECTS.TextureLoadAction.clear,
5592
+ depthAction: EFFECTS.TextureLoadAction.clear
5571
5593
  },
5572
5594
  // storeAction: {
5573
5595
  // colorAction: TextureStoreAction.store,
@@ -5587,9 +5609,9 @@ var normal = new Vector3();
5587
5609
  * @param mesh - Mesh 对象
5588
5610
  */ WebGLHelper.deleteMesh = function deleteMesh(mesh) {
5589
5611
  mesh.dispose({
5590
- geometries: effects.DestroyOptions.destroy,
5612
+ geometries: EFFECTS.DestroyOptions.destroy,
5591
5613
  material: {
5592
- textures: effects.DestroyOptions.destroy
5614
+ textures: EFFECTS.DestroyOptions.destroy
5593
5615
  }
5594
5616
  });
5595
5617
  };
@@ -5605,22 +5627,22 @@ var normal = new Vector3();
5605
5627
  */ WebGLHelper.deleteRenderPass = function deleteRenderPass(pass) {
5606
5628
  pass.dispose({
5607
5629
  meshes: {
5608
- geometries: effects.DestroyOptions.destroy,
5630
+ geometries: EFFECTS.DestroyOptions.destroy,
5609
5631
  material: {
5610
- textures: effects.DestroyOptions.destroy
5632
+ textures: EFFECTS.DestroyOptions.destroy
5611
5633
  }
5612
5634
  },
5613
- depthStencilAttachment: effects.RenderPassDestroyAttachmentType.force,
5614
- colorAttachment: effects.RenderPassDestroyAttachmentType.force,
5615
- semantics: effects.DestroyOptions.destroy
5635
+ depthStencilAttachment: EFFECTS.RenderPassDestroyAttachmentType.force,
5636
+ colorAttachment: EFFECTS.RenderPassDestroyAttachmentType.force,
5637
+ semantics: EFFECTS.DestroyOptions.destroy
5616
5638
  });
5617
5639
  };
5618
5640
  /**
5619
5641
  * 返回 Mesh 是否半透明
5620
- * @param mesh - gl mesh 对象
5642
+ * @param component - ModelMeshComponent 对象
5621
5643
  * @return 是否半透明
5622
- */ WebGLHelper.isTransparentMesh = function isTransparentMesh(mesh) {
5623
- return mesh.material.blending === true;
5644
+ */ WebGLHelper.isTransparentMesh = function isTransparentMesh(component) {
5645
+ return component.material.blending === true;
5624
5646
  };
5625
5647
  /**
5626
5648
  * renderer 是否支持 Float 纹理
@@ -5650,18 +5672,18 @@ var normal = new Vector3();
5650
5672
  * 立方体纹理参数
5651
5673
  */ WebGLHelper.cubemapTexConfig = {
5652
5674
  name: "cubemap texture",
5653
- wrapS: effects.glContext.CLAMP_TO_EDGE,
5654
- wrapT: effects.glContext.CLAMP_TO_EDGE,
5655
- magFilter: effects.glContext.LINEAR,
5656
- minFilter: effects.glContext.LINEAR
5675
+ wrapS: EFFECTS.glContext.CLAMP_TO_EDGE,
5676
+ wrapT: EFFECTS.glContext.CLAMP_TO_EDGE,
5677
+ magFilter: EFFECTS.glContext.LINEAR,
5678
+ minFilter: EFFECTS.glContext.LINEAR
5657
5679
  };
5658
5680
  /**
5659
5681
  * 立方体纹理参数,带 Mipmap 滤波
5660
5682
  */ WebGLHelper.cubemapMipTexConfig = {
5661
- wrapS: effects.glContext.CLAMP_TO_EDGE,
5662
- wrapT: effects.glContext.CLAMP_TO_EDGE,
5663
- magFilter: effects.glContext.LINEAR,
5664
- minFilter: effects.glContext.LINEAR_MIPMAP_LINEAR
5683
+ wrapS: EFFECTS.glContext.CLAMP_TO_EDGE,
5684
+ wrapT: EFFECTS.glContext.CLAMP_TO_EDGE,
5685
+ magFilter: EFFECTS.glContext.LINEAR,
5686
+ minFilter: EFFECTS.glContext.LINEAR_MIPMAP_LINEAR
5665
5687
  };
5666
5688
  /**
5667
5689
  * Mesh 辅助类,负责 Mesh 相关的基础对象创建
@@ -5678,19 +5700,19 @@ var normal = new Vector3();
5678
5700
  var globalState = PGlobalState.getInstance();
5679
5701
  var vertexShader = material.vertexShaderCode;
5680
5702
  var fragmentShader = material.fragmentShaderCode;
5681
- var geometry = effects.Geometry.create(engine, MeshHelper.getPlaneGeometry());
5703
+ var geometry = EFFECTS.Geometry.create(engine, MeshHelper.getPlaneGeometry());
5682
5704
  var isWebGL2 = engine.gpuCapability.level === 2;
5683
- var effectsMaterial = effects.Material.create(engine, {
5705
+ var effectsMaterial = EFFECTS.Material.create(engine, {
5684
5706
  shader: {
5685
5707
  vertex: vertexShader,
5686
5708
  fragment: fragmentShader,
5687
5709
  shared: globalState.shaderShared,
5688
- glslVersion: isWebGL2 ? effects.GLSLVersion.GLSL3 : effects.GLSLVersion.GLSL1
5710
+ glslVersion: isWebGL2 ? EFFECTS.GLSLVersion.GLSL3 : EFFECTS.GLSLVersion.GLSL1
5689
5711
  },
5690
5712
  uniformSemantics: uniformSemantics
5691
5713
  });
5692
5714
  material.setMaterialStates(effectsMaterial);
5693
- return effects.Mesh.create(engine, {
5715
+ return EFFECTS.Mesh.create(engine, {
5694
5716
  name: name,
5695
5717
  worldMatrix: Matrix4.fromIdentity(),
5696
5718
  material: effectsMaterial,
@@ -5705,21 +5727,21 @@ var normal = new Vector3();
5705
5727
  return {
5706
5728
  attributes: {
5707
5729
  aPos: {
5708
- type: effects.glContext.FLOAT,
5730
+ type: EFFECTS.glContext.FLOAT,
5709
5731
  size: 3,
5710
5732
  data: data,
5711
5733
  stride: Float32Array.BYTES_PER_ELEMENT * 8,
5712
5734
  offset: 0
5713
5735
  },
5714
5736
  aUV: {
5715
- type: effects.glContext.FLOAT,
5737
+ type: EFFECTS.glContext.FLOAT,
5716
5738
  size: 2,
5717
5739
  stride: Float32Array.BYTES_PER_ELEMENT * 8,
5718
5740
  offset: Float32Array.BYTES_PER_ELEMENT * 3,
5719
5741
  dataSource: "aPos"
5720
5742
  },
5721
5743
  aNormal: {
5722
- type: effects.glContext.FLOAT,
5744
+ type: EFFECTS.glContext.FLOAT,
5723
5745
  size: 3,
5724
5746
  stride: Float32Array.BYTES_PER_ELEMENT * 8,
5725
5747
  offset: Float32Array.BYTES_PER_ELEMENT * 5,
@@ -5998,7 +6020,7 @@ var normal = new Vector3();
5998
6020
  rotationMat.transformPoint(deltaPos);
5999
6021
  var newCamPos = deltaPos.clone().add(targetPos);
6000
6022
  var viewMatrix = new Matrix4().lookAt(newCamPos, targetPos, new Vector3(0, 1, 0)).invert();
6001
- var effectsTransform = new effects.Transform();
6023
+ var effectsTransform = new EFFECTS.Transform();
6002
6024
  effectsTransform.setValid(true);
6003
6025
  effectsTransform.cloneFromMatrix(viewMatrix);
6004
6026
  return effectsTransform;
@@ -6012,7 +6034,7 @@ var normal = new Vector3();
6012
6034
  * @returns 场景信息描述
6013
6035
  */ PluginHelper.preprocessScene = function preprocessScene(scene, runtimeEnv, compatibleMode) {
6014
6036
  var _this = this;
6015
- var deviceEnv = runtimeEnv !== effects.PLAYER_OPTIONS_ENV_EDITOR;
6037
+ var deviceEnv = runtimeEnv !== EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
6016
6038
  var tiny3dMode = compatibleMode === "tiny3d";
6017
6039
  // 默认skybox如何处理需要讨论
6018
6040
  var jsonScene = scene.jsonScene;
@@ -6037,7 +6059,7 @@ var normal = new Vector3();
6037
6059
  _this.preprocessTextureOptions(dataMap, mat.textures["_EmissiveSampler"], false, tiny3dMode);
6038
6060
  });
6039
6061
  jsonScene.components.forEach(function(comp) {
6040
- if (comp.dataType === effects.spec.DataType.SkyboxComponent) {
6062
+ if (comp.dataType === EFFECTS.spec.DataType.SkyboxComponent) {
6041
6063
  loadSkybox = true;
6042
6064
  var skybox = comp;
6043
6065
  if (skybox.diffuseImage) {
@@ -6077,29 +6099,36 @@ var normal = new Vector3();
6077
6099
  if (!texOptions) {
6078
6100
  return;
6079
6101
  }
6080
- if (texOptions.target === undefined || texOptions.target === effects.glContext.TEXTURE_2D) {
6081
- texOptions.wrapS = effects.glContext.REPEAT;
6082
- texOptions.wrapT = effects.glContext.REPEAT;
6083
- texOptions.magFilter = effects.glContext.LINEAR;
6084
- texOptions.minFilter = effects.glContext.LINEAR_MIPMAP_LINEAR;
6085
- texOptions.generateMipmap = true;
6102
+ if (texOptions.target === undefined || texOptions.target === EFFECTS.glContext.TEXTURE_2D) {
6103
+ texOptions.wrapS = EFFECTS.glContext.REPEAT;
6104
+ texOptions.wrapT = EFFECTS.glContext.REPEAT;
6105
+ texOptions.magFilter = EFFECTS.glContext.LINEAR;
6106
+ texOptions.minFilter = EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
6086
6107
  if (!isBaseColor) {
6087
6108
  texOptions.premultiplyAlpha = true;
6088
6109
  }
6089
- } else if (texOptions.target === effects.glContext.TEXTURE_CUBE_MAP) {
6090
- texOptions.wrapS = effects.glContext.CLAMP_TO_EDGE;
6091
- texOptions.wrapT = effects.glContext.CLAMP_TO_EDGE;
6110
+ var newOptions = texOptions;
6111
+ newOptions.generateMipmap = true;
6112
+ var image = newOptions.image;
6113
+ if (image && image.width && image.height) {
6114
+ if (!WebGLHelper.isPow2(image.width) || !WebGLHelper.isPow2(image.height)) {
6115
+ texOptions.minFilter = EFFECTS.glContext.LINEAR;
6116
+ }
6117
+ }
6118
+ } else if (texOptions.target === EFFECTS.glContext.TEXTURE_CUBE_MAP) {
6119
+ texOptions.wrapS = EFFECTS.glContext.CLAMP_TO_EDGE;
6120
+ texOptions.wrapT = EFFECTS.glContext.CLAMP_TO_EDGE;
6092
6121
  if (texOptions.mipmaps !== undefined) {
6093
6122
  if (texOptions.mipmaps.length === 1) {
6094
- texOptions.magFilter = effects.glContext.LINEAR;
6095
- texOptions.minFilter = effects.glContext.LINEAR;
6123
+ texOptions.magFilter = EFFECTS.glContext.LINEAR;
6124
+ texOptions.minFilter = EFFECTS.glContext.LINEAR;
6096
6125
  } else {
6097
- texOptions.magFilter = effects.glContext.LINEAR;
6098
- texOptions.minFilter = effects.glContext.LINEAR_MIPMAP_LINEAR;
6126
+ texOptions.magFilter = EFFECTS.glContext.LINEAR;
6127
+ texOptions.minFilter = EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
6099
6128
  }
6100
6129
  } else {
6101
- texOptions.magFilter = effects.glContext.LINEAR;
6102
- texOptions.minFilter = effects.glContext.LINEAR;
6130
+ texOptions.magFilter = EFFECTS.glContext.LINEAR;
6131
+ texOptions.minFilter = EFFECTS.glContext.LINEAR;
6103
6132
  }
6104
6133
  }
6105
6134
  };
@@ -6129,12 +6158,12 @@ var normal = new Vector3();
6129
6158
  sceneComp.items.forEach(function(data) {
6130
6159
  var itemId = data.id;
6131
6160
  var item = composition.getEngine().jsonSceneData[itemId];
6132
- if (item.type === effects.spec.ItemType.mesh) {
6161
+ if (item.type === EFFECTS.spec.ItemType.mesh) {
6133
6162
  var meshItem = item;
6134
6163
  var skin = meshItem.content.options.skin;
6135
6164
  var primitives = meshItem.content.options.primitives;
6136
6165
  primitives.forEach(function(prim, primId) {
6137
- if (_instanceof1(prim.geometry, effects.Geometry)) {
6166
+ if (_instanceof1(prim.geometry, EFFECTS.Geometry)) {
6138
6167
  // 可能已经创建,直接返回
6139
6168
  return;
6140
6169
  }
@@ -6143,7 +6172,7 @@ var normal = new Vector3();
6143
6172
  var studioPrim = prim;
6144
6173
  studioPrim.geometry = riGeometry;
6145
6174
  var material = prim.material;
6146
- if (material.type === effects.spec.MaterialType.pbr) {
6175
+ if (material.type === EFFECTS.spec.MaterialType.pbr) {
6147
6176
  var studioMat = studioPrim.material;
6148
6177
  studioMat.baseColorTexture = _this.getTextureObj(composition.textures, material.baseColorTexture);
6149
6178
  studioMat.metallicRoughnessTexture = _this.getTextureObj(composition.textures, material.metallicRoughnessTexture);
@@ -6161,10 +6190,10 @@ var normal = new Vector3();
6161
6190
  if (_instanceof1(inverseBindMatrices, Float32Array)) {
6162
6191
  studioSkin.inverseBindMatrices = inverseBindMatrices;
6163
6192
  } else {
6164
- console.error("setupItem3DOptions: Invalid inverseBindMatrices type, " + inverseBindMatrices);
6193
+ console.error("setupItem3DOptions: Invalid inverseBindMatrices type, " + inverseBindMatrices + ".");
6165
6194
  }
6166
6195
  }
6167
- } else if (item.type === effects.spec.ItemType.tree) {
6196
+ } else if (item.type === EFFECTS.spec.ItemType.tree) {
6168
6197
  var jsonItem = item;
6169
6198
  var studioItem = item;
6170
6199
  var jsonAnimations = jsonItem.content.options.tree.animations;
@@ -6179,24 +6208,24 @@ var normal = new Vector3();
6179
6208
  if (_instanceof1(inputArray, Float32Array)) {
6180
6209
  studioTrack.input = inputArray;
6181
6210
  } else {
6182
- console.error("setupItem3DOptions: Type of inputArray should be float32, " + inputArray);
6211
+ console.error("setupItem3DOptions: Type of inputArray should be float32, " + inputArray + ".");
6183
6212
  }
6184
6213
  if (_instanceof1(outputArray, Float32Array)) {
6185
6214
  studioTrack.output = outputArray;
6186
6215
  } else {
6187
- console.error("setupItem3DOptions: Type of outputArray should be float32, " + outputArray);
6216
+ console.error("setupItem3DOptions: Type of outputArray should be float32, " + outputArray + ".");
6188
6217
  }
6189
6218
  });
6190
6219
  });
6191
6220
  }
6192
- } else if (item.type === effects.spec.ItemType.skybox) {
6221
+ } else if (item.type === EFFECTS.spec.ItemType.skybox) {
6193
6222
  var skybox = item;
6194
6223
  var studioSkybox = item;
6195
6224
  var options = skybox.content.options;
6196
6225
  var studioOptions = studioSkybox.content.options;
6197
6226
  var specularImage = _this.getTextureObj(composition.textures, options.specularImage);
6198
6227
  if (specularImage === undefined) {
6199
- console.error("setupItem3DOptions: skybox specualrImage is undefined, " + CheckerHelper.stringify(options));
6228
+ console.error("setupItem3DOptions: skybox specualrImage is undefined, " + CheckerHelper.stringify(options) + ".");
6200
6229
  }
6201
6230
  studioOptions.specularImage = specularImage;
6202
6231
  //
@@ -6224,7 +6253,7 @@ var normal = new Vector3();
6224
6253
  attributes[name] = attribData;
6225
6254
  }
6226
6255
  geomOptions.attributes = attributes;
6227
- return effects.Geometry.create(engine, geomOptions);
6256
+ return EFFECTS.Geometry.create(engine, geomOptions);
6228
6257
  };
6229
6258
  /**
6230
6259
  * 索引数组类型转换
@@ -6240,7 +6269,7 @@ var normal = new Vector3();
6240
6269
  case WebGLRenderingContext["UNSIGNED_BYTE"]:
6241
6270
  return array;
6242
6271
  default:
6243
- console.error("Invalid index attribute type " + type);
6272
+ console.error("Invalid index attribute type " + type + ".");
6244
6273
  }
6245
6274
  };
6246
6275
  /**
@@ -6268,7 +6297,7 @@ var normal = new Vector3();
6268
6297
  // aPos, aNormal, aTangent,
6269
6298
  // aUV, aUV2, aJoints, aWeights
6270
6299
  // aTargetXXX
6271
- console.warn("Unknown attribute name: " + name);
6300
+ console.warn("Unknown attribute name: " + name + ".");
6272
6301
  }
6273
6302
  return name;
6274
6303
  };
@@ -6282,7 +6311,7 @@ var normal = new Vector3();
6282
6311
  return null;
6283
6312
  }
6284
6313
  if (index < 0 || index >= textures.length) {
6285
- console.error("Invalid index for textures: " + index + ", " + textures.length);
6314
+ console.error("Invalid index for textures: " + index + ", " + textures.length + ".");
6286
6315
  }
6287
6316
  return textures[index];
6288
6317
  };
@@ -6332,10 +6361,10 @@ var normal = new Vector3();
6332
6361
  var canvas = document.createElement("canvas");
6333
6362
  canvas.width = 512;
6334
6363
  canvas.height = 512;
6335
- return new effects.Player({
6364
+ return new EFFECTS.Player({
6336
6365
  canvas: canvas,
6337
6366
  renderFramework: "webgl2",
6338
- env: effects.PLAYER_OPTIONS_ENV_EDITOR,
6367
+ env: EFFECTS.PLAYER_OPTIONS_ENV_EDITOR,
6339
6368
  renderOptions: {
6340
6369
  willCaptureImage: true
6341
6370
  },
@@ -6367,7 +6396,7 @@ var normal = new Vector3();
6367
6396
  return __generator(this, function(_state) {
6368
6397
  return [
6369
6398
  2,
6370
- effects.loadImage(new Blob([
6399
+ EFFECTS.loadImage(new Blob([
6371
6400
  image.imageData
6372
6401
  ], {
6373
6402
  type: image.mimeType
@@ -6385,7 +6414,7 @@ var normal = new Vector3();
6385
6414
  return __generator(this, function(_state) {
6386
6415
  return [
6387
6416
  2,
6388
- effects.loadImage(new Blob([
6417
+ EFFECTS.loadImage(new Blob([
6389
6418
  image.data
6390
6419
  ], {
6391
6420
  type: image.mimeType
@@ -6408,7 +6437,7 @@ var normal = new Vector3();
6408
6437
  if (b) {
6409
6438
  resolve(b.arrayBuffer());
6410
6439
  } else {
6411
- reject(new Error("no canvas blob"));
6440
+ reject(new Error("No canvas blob."));
6412
6441
  }
6413
6442
  }, "image/png", 1);
6414
6443
  })
@@ -6570,7 +6599,7 @@ var AttributeArray = /*#__PURE__*/ function() {
6570
6599
  this.offset = (_inAttrib_offset = inAttrib.offset) != null ? _inAttrib_offset : 0;
6571
6600
  if (this.offset > 0) {
6572
6601
  if (this.offset % this.typeSize !== 0) {
6573
- console.error("Invalid offset " + this.offset + ", type size " + this.typeSize);
6602
+ console.error("Invalid offset " + this.offset + ", type size " + this.typeSize + ".");
6574
6603
  }
6575
6604
  this.offset = this.offset / this.typeSize;
6576
6605
  }
@@ -6579,7 +6608,7 @@ var AttributeArray = /*#__PURE__*/ function() {
6579
6608
  this.stride = (_inAttrib_stride = inAttrib.stride) != null ? _inAttrib_stride : 0;
6580
6609
  if (this.stride > 0) {
6581
6610
  if (this.stride % this.typeSize !== 0) {
6582
- console.error("Invalid stride " + this.stride + ", type size " + this.typeSize);
6611
+ console.error("Invalid stride " + this.stride + ", type size " + this.typeSize + ".");
6583
6612
  }
6584
6613
  this.stride = this.stride / this.typeSize;
6585
6614
  } else {
@@ -7090,9 +7119,9 @@ var AttributeArray = /*#__PURE__*/ function() {
7090
7119
  * @param v - 纹理对象
7091
7120
  * @returns
7092
7121
  */ CheckerHelper.checkTexture = function checkTexture(v) {
7093
- if (_instanceof1(v, effects.Texture)) {
7122
+ if (_instanceof1(v, EFFECTS.Texture)) {
7094
7123
  if (v.isDestroyed) {
7095
- console.error("Texture is destroyed, " + v.name);
7124
+ console.error("Texture is destroyed, " + v.name + ".");
7096
7125
  }
7097
7126
  return !v.isDestroyed;
7098
7127
  } else {
@@ -7140,14 +7169,14 @@ var AttributeArray = /*#__PURE__*/ function() {
7140
7169
  * @param v - 材质混合参数或未定义
7141
7170
  * @returns
7142
7171
  */ CheckerHelper.checkMatBlending = function checkMatBlending(v) {
7143
- return v === undefined || v === effects.spec.MaterialBlending.opaque || v === effects.spec.MaterialBlending.masked || v === effects.spec.MaterialBlending.translucent || v === effects.spec.MaterialBlending.additive;
7172
+ return v === undefined || v === EFFECTS.spec.MaterialBlending.opaque || v === EFFECTS.spec.MaterialBlending.masked || v === EFFECTS.spec.MaterialBlending.translucent || v === EFFECTS.spec.MaterialBlending.additive;
7144
7173
  };
7145
7174
  /**
7146
7175
  * 检查材质单双面模式或未定义
7147
7176
  * @param v - 材质单双面模式或未定义
7148
7177
  * @returns
7149
7178
  */ CheckerHelper.checkMatSide = function checkMatSide(v) {
7150
- return v === undefined || v === effects.spec.SideMode.BACK || v === effects.spec.SideMode.DOUBLE || v === effects.spec.SideMode.FRONT;
7179
+ return v === undefined || v === EFFECTS.spec.SideMode.BACK || v === EFFECTS.spec.SideMode.DOUBLE || v === EFFECTS.spec.SideMode.FRONT;
7151
7180
  };
7152
7181
  /**
7153
7182
  * 检查动画路径模式
@@ -7168,15 +7197,15 @@ var AttributeArray = /*#__PURE__*/ function() {
7168
7197
  * @param v - 几何体
7169
7198
  * @param s - 蒙皮参数
7170
7199
  */ CheckerHelper.assertGeometry = function assertGeometry(v, s) {
7171
- if (!_instanceof1(v, effects.Geometry)) {
7172
- console.error("Invalid geometry type " + this.stringify(v));
7200
+ if (!_instanceof1(v, EFFECTS.Geometry)) {
7201
+ console.error("Invalid geometry type " + this.stringify(v) + ".");
7173
7202
  }
7174
7203
  // @ts-expect-error
7175
7204
  if (v.isDestroyed === true) {
7176
- console.error("Geometry object is destroyed");
7205
+ console.error("Geometry object is destroyed.");
7177
7206
  }
7178
7207
  if (!this.checkNonnegative(v.getDrawStart())) {
7179
- console.error("Invalid geometry draw start: " + v.getDrawStart() + ", " + this.stringify(v));
7208
+ console.error("Invalid geometry draw start: " + v.getDrawStart() + ", " + this.stringify(v) + ".");
7180
7209
  }
7181
7210
  // // drawCount不再为负
7182
7211
  // if (!this.checkPositive(v.getDrawCount())) {
@@ -7235,7 +7264,7 @@ var AttributeArray = /*#__PURE__*/ function() {
7235
7264
  var attribArray = this.createAttributeArray(v, name);
7236
7265
  if (attribArray !== undefined) {
7237
7266
  if (attribArray.getLength() < drawCount) {
7238
- console.error(name + " Length(" + attribArray.getLength() + ") is less than draw count(" + drawCount + "), " + this.stringify(v));
7267
+ console.error(name + " Length(" + attribArray.getLength() + ") is less than draw count(" + drawCount + "), " + this.stringify(v) + ".");
7239
7268
  }
7240
7269
  }
7241
7270
  };
@@ -7268,24 +7297,24 @@ var AttributeArray = /*#__PURE__*/ function() {
7268
7297
  * @param v - 蒙皮参数
7269
7298
  */ CheckerHelper.assertModelSkinOptions = function assertModelSkinOptions(v) {
7270
7299
  if (!this.checkStringUndef(v.name)) {
7271
- console.error("Invalid skin name " + v.name + ", " + this.stringify(v));
7300
+ console.error("Invalid skin name " + v.name + ", " + this.stringify(v) + ".");
7272
7301
  }
7273
7302
  if (!this.checkNumberArray(v.joints)) {
7274
- console.error("Invalid skin joints " + v.joints + ", " + this.stringify(v));
7303
+ console.error("Invalid skin joints " + v.joints + ", " + this.stringify(v) + ".");
7275
7304
  }
7276
7305
  if (!this.checkNumberUndef(v.skeleton)) {
7277
- console.error("Invalid skin skeleton " + v.skeleton + ", " + this.stringify(v));
7306
+ console.error("Invalid skin skeleton " + v.skeleton + ", " + this.stringify(v) + ".");
7278
7307
  }
7279
7308
  if (!this.checkFloat32ArrayUndef(v.inverseBindMatrices)) {
7280
- console.error("Invalid skin inverseBindMatrices " + v.inverseBindMatrices + ", " + this.stringify(v));
7309
+ console.error("Invalid skin inverseBindMatrices " + v.inverseBindMatrices + ", " + this.stringify(v) + ".");
7281
7310
  }
7282
7311
  //
7283
7312
  if (v.inverseBindMatrices !== undefined) {
7284
7313
  if (v.inverseBindMatrices.length <= 0 || v.inverseBindMatrices.length % 16 !== 0) {
7285
- console.error("Invalid skin inverseBindMatrices length " + v.inverseBindMatrices + ", " + this.stringify(v));
7314
+ console.error("Invalid skin inverseBindMatrices length " + v.inverseBindMatrices + ", " + this.stringify(v) + ".");
7286
7315
  }
7287
7316
  if (v.joints.length * 16 !== v.inverseBindMatrices.length) {
7288
- console.error("Mismatch: skin joints and inverseBindMatrices length, " + v.joints + ", " + v.inverseBindMatrices + ", " + this.stringify(v));
7317
+ console.error("Mismatch: skin joints and inverseBindMatrices length, " + v.joints + ", " + v.inverseBindMatrices + ", " + this.stringify(v) + ".");
7289
7318
  }
7290
7319
  var mat = new Matrix4();
7291
7320
  for(var i = 0; i < v.inverseBindMatrices.length; i += 16){
@@ -7293,12 +7322,12 @@ var AttributeArray = /*#__PURE__*/ function() {
7293
7322
  mat.elements[j] = v.inverseBindMatrices[i + j];
7294
7323
  }
7295
7324
  if (Math.abs(mat.determinant()) < 1e-5) {
7296
- console.error("Determinant of inverseBindMatrices is too small " + mat.determinant() + ", index " + i / 16 + ", " + this.stringify(v));
7325
+ console.error("Determinant of inverseBindMatrices is too small " + mat.determinant() + ", index " + i / 16 + ", " + this.stringify(v) + ".");
7297
7326
  }
7298
7327
  }
7299
7328
  } else {
7300
7329
  if (v.joints.length <= 0) {
7301
- console.error("Invalid skin joints length " + v.joints + ", " + this.stringify(v));
7330
+ console.error("Invalid skin joints length " + v.joints + ", " + this.stringify(v) + ".");
7302
7331
  }
7303
7332
  }
7304
7333
  };
@@ -7306,140 +7335,140 @@ var AttributeArray = /*#__PURE__*/ function() {
7306
7335
  * 检查材质参数
7307
7336
  * @param v - 材质参数
7308
7337
  */ CheckerHelper.assertMatOptions = function assertMatOptions(v) {
7309
- if (v.type === effects.spec.MaterialType.unlit) {
7338
+ if (v.type === EFFECTS.spec.MaterialType.unlit) {
7310
7339
  if (!this.checkString(v.name)) {
7311
- console.error("Invalid material name " + v.name + ", " + this.stringify(v));
7340
+ console.error("Invalid material name " + v.name + ", " + this.stringify(v) + ".");
7312
7341
  }
7313
7342
  //
7314
7343
  if (!this.checkNonnegative4(v.baseColorFactor)) {
7315
- console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v));
7344
+ console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v) + ".");
7316
7345
  }
7317
7346
  if (!this.checkTextureUndef(v.baseColorTexture)) {
7318
- console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v));
7347
+ console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v) + ".");
7319
7348
  }
7320
7349
  if (!this.checkTexTransformUndef(v.baseColorTextureTransform)) {
7321
- console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v));
7350
+ console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v) + ".");
7322
7351
  }
7323
7352
  if (!this.checkTexCoord(v.baseColorTextureCoordinate)) {
7324
- console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v));
7353
+ console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v) + ".");
7325
7354
  }
7326
7355
  //
7327
7356
  if (!this.checkBooleanUndef(v.depthMask)) {
7328
- console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v));
7357
+ console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v) + ".");
7329
7358
  }
7330
7359
  if (!this.checkMatBlending(v.blending)) {
7331
- console.error("Invalid material blending " + v.blending + ", " + this.stringify(v));
7360
+ console.error("Invalid material blending " + v.blending + ", " + this.stringify(v) + ".");
7332
7361
  }
7333
7362
  if (!this.checkMatSide(v.side)) {
7334
- console.error("Invalid material side " + v.side + ", " + this.stringify(v));
7363
+ console.error("Invalid material side " + v.side + ", " + this.stringify(v) + ".");
7335
7364
  }
7336
- if (v.blending === effects.spec.MaterialBlending.masked) {
7365
+ if (v.blending === EFFECTS.spec.MaterialBlending.masked) {
7337
7366
  if (v.alphaCutOff === undefined) {
7338
- console.error("Material alphaCutOff is required for mask, " + this.stringify(v));
7367
+ console.error("Material alphaCutOff is required for mask, " + this.stringify(v) + ".");
7339
7368
  }
7340
7369
  }
7341
7370
  if (!this.checkNumber01Undef(v.alphaCutOff)) {
7342
- console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v));
7371
+ console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v) + ".");
7343
7372
  }
7344
- } else if (v.type === effects.spec.MaterialType.pbr) {
7373
+ } else if (v.type === EFFECTS.spec.MaterialType.pbr) {
7345
7374
  if (!this.checkString(v.name)) {
7346
- console.error("Invalid material name " + v.name + ", " + this.stringify(v));
7375
+ console.error("Invalid material name " + v.name + ", " + this.stringify(v) + ".");
7347
7376
  }
7348
7377
  //
7349
7378
  if (!this.checkNonnegative4(v.baseColorFactor)) {
7350
- console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v));
7379
+ console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v) + ".");
7351
7380
  }
7352
7381
  if (!this.checkTextureUndef(v.baseColorTexture)) {
7353
- console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v));
7382
+ console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v) + ".");
7354
7383
  }
7355
7384
  if (!this.checkTexTransformUndef(v.baseColorTextureTransform)) {
7356
- console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v));
7385
+ console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v) + ".");
7357
7386
  }
7358
7387
  if (!this.checkTexCoord(v.baseColorTextureCoordinate)) {
7359
- console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v));
7388
+ console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v) + ".");
7360
7389
  }
7361
7390
  //
7362
7391
  if (!this.checkBooleanUndef(v.useSpecularAA)) {
7363
- console.error("Invalid material useSpecularAA " + v.useSpecularAA + ", " + this.stringify(v));
7392
+ console.error("Invalid material useSpecularAA " + v.useSpecularAA + ", " + this.stringify(v) + ".");
7364
7393
  }
7365
7394
  if (!this.checkNumber01(v.metallicFactor)) {
7366
- console.error("Invalid material metallicFactor " + v.metallicFactor + ", " + this.stringify(v));
7395
+ console.error("Invalid material metallicFactor " + v.metallicFactor + ", " + this.stringify(v) + ".");
7367
7396
  }
7368
7397
  if (!this.checkNonnegative(v.roughnessFactor)) {
7369
- console.error("Invalid material roughnessFactor " + v.roughnessFactor + ", " + this.stringify(v));
7398
+ console.error("Invalid material roughnessFactor " + v.roughnessFactor + ", " + this.stringify(v) + ".");
7370
7399
  }
7371
7400
  if (!this.checkTextureUndef(v.metallicRoughnessTexture)) {
7372
- console.error("Invalid material metallicRoughnessTexture " + v.metallicRoughnessTexture + ", " + this.stringify(v));
7401
+ console.error("Invalid material metallicRoughnessTexture " + v.metallicRoughnessTexture + ", " + this.stringify(v) + ".");
7373
7402
  }
7374
7403
  if (!this.checkTexTransformUndef(v.metallicRoughnessTextureTransform)) {
7375
- console.error("Invalid material metallicRoughnessTextureTransform " + v.metallicRoughnessTextureTransform + ", " + this.stringify(v));
7404
+ console.error("Invalid material metallicRoughnessTextureTransform " + v.metallicRoughnessTextureTransform + ", " + this.stringify(v) + ".");
7376
7405
  }
7377
7406
  if (!this.checkTexCoord(v.metallicRoughnessTextureCoordinate)) {
7378
- console.error("Invalid material metallicRoughnessTextureCoordinate " + v.metallicRoughnessTextureCoordinate + ", " + this.stringify(v));
7407
+ console.error("Invalid material metallicRoughnessTextureCoordinate " + v.metallicRoughnessTextureCoordinate + ", " + this.stringify(v) + ".");
7379
7408
  }
7380
7409
  //
7381
7410
  if (!this.checkTextureUndef(v.normalTexture)) {
7382
- console.error("Invalid material normalTexture " + v.normalTexture + ", " + this.stringify(v));
7411
+ console.error("Invalid material normalTexture " + v.normalTexture + ", " + this.stringify(v) + ".");
7383
7412
  }
7384
7413
  if (!this.checkNonnegativeUndef(v.normalTextureScale)) {
7385
- console.error("Invalid material normalTextureScale " + v.normalTextureScale + ", " + this.stringify(v));
7414
+ console.error("Invalid material normalTextureScale " + v.normalTextureScale + ", " + this.stringify(v) + ".");
7386
7415
  }
7387
7416
  if (!this.checkTexTransformUndef(v.normalTextureTransform)) {
7388
- console.error("Invalid material normalTextureTransform " + v.normalTextureTransform + ", " + this.stringify(v));
7417
+ console.error("Invalid material normalTextureTransform " + v.normalTextureTransform + ", " + this.stringify(v) + ".");
7389
7418
  }
7390
7419
  if (!this.checkTexCoord(v.normalTextureCoordinate)) {
7391
- console.error("Invalid material normalTextureCoordinate " + v.normalTextureCoordinate + ", " + this.stringify(v));
7420
+ console.error("Invalid material normalTextureCoordinate " + v.normalTextureCoordinate + ", " + this.stringify(v) + ".");
7392
7421
  }
7393
7422
  //
7394
7423
  if (!this.checkTextureUndef(v.occlusionTexture)) {
7395
- console.error("Invalid material occlusionTexture " + v.occlusionTexture + ", " + this.stringify(v));
7424
+ console.error("Invalid material occlusionTexture " + v.occlusionTexture + ", " + this.stringify(v) + ".");
7396
7425
  }
7397
7426
  if (!this.checkNumber01Undef(v.occlusionTextureStrength)) {
7398
- console.error("Invalid material occlusionTextureStrength " + v.occlusionTextureStrength + ", " + this.stringify(v));
7427
+ console.error("Invalid material occlusionTextureStrength " + v.occlusionTextureStrength + ", " + this.stringify(v) + ".");
7399
7428
  }
7400
7429
  if (!this.checkTexTransformUndef(v.occlusionTextureTransform)) {
7401
- console.error("Invalid material occlusionTextureTransform " + v.occlusionTextureTransform + ", " + this.stringify(v));
7430
+ console.error("Invalid material occlusionTextureTransform " + v.occlusionTextureTransform + ", " + this.stringify(v) + ".");
7402
7431
  }
7403
7432
  if (!this.checkTexCoord(v.occlusionTextureCoordinate)) {
7404
- console.error("Invalid material occlusionTextureCoordinate " + v.occlusionTextureCoordinate + ", " + this.stringify(v));
7433
+ console.error("Invalid material occlusionTextureCoordinate " + v.occlusionTextureCoordinate + ", " + this.stringify(v) + ".");
7405
7434
  }
7406
7435
  //
7407
7436
  //
7408
7437
  if (!this.checkNonnegative4(v.emissiveFactor)) {
7409
- console.error("Invalid material emissiveFactor " + v.emissiveFactor + ", " + this.stringify(v));
7438
+ console.error("Invalid material emissiveFactor " + v.emissiveFactor + ", " + this.stringify(v) + ".");
7410
7439
  }
7411
7440
  if (!this.checkNonnegative(v.emissiveIntensity)) {
7412
- console.error("Invalid material emissiveIntensity " + v.emissiveIntensity + ", " + this.stringify(v));
7441
+ console.error("Invalid material emissiveIntensity " + v.emissiveIntensity + ", " + this.stringify(v) + ".");
7413
7442
  }
7414
7443
  if (!this.checkTextureUndef(v.emissiveTexture)) {
7415
- console.error("Invalid material emissiveTexture " + v.emissiveTexture + ", " + this.stringify(v));
7444
+ console.error("Invalid material emissiveTexture " + v.emissiveTexture + ", " + this.stringify(v) + ".");
7416
7445
  }
7417
7446
  if (!this.checkTexTransformUndef(v.emissiveTextureTransform)) {
7418
- console.error("Invalid material emissiveTextureTransform " + v.emissiveTextureTransform + ", " + this.stringify(v));
7447
+ console.error("Invalid material emissiveTextureTransform " + v.emissiveTextureTransform + ", " + this.stringify(v) + ".");
7419
7448
  }
7420
7449
  if (!this.checkTexCoord(v.emissiveTextureCoordinate)) {
7421
- console.error("Invalid material emissiveTextureCoordinate " + v.emissiveTextureCoordinate + ", " + this.stringify(v));
7450
+ console.error("Invalid material emissiveTextureCoordinate " + v.emissiveTextureCoordinate + ", " + this.stringify(v) + ".");
7422
7451
  }
7423
7452
  //
7424
7453
  if (!this.checkBooleanUndef(v.depthMask)) {
7425
- console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v));
7454
+ console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v) + ".");
7426
7455
  }
7427
7456
  if (!this.checkMatBlending(v.blending)) {
7428
- console.error("Invalid material blending " + v.blending + ", " + this.stringify(v));
7457
+ console.error("Invalid material blending " + v.blending + ", " + this.stringify(v) + ".");
7429
7458
  }
7430
7459
  if (!this.checkMatSide(v.side)) {
7431
- console.error("Invalid material side " + v.side + ", " + this.stringify(v));
7460
+ console.error("Invalid material side " + v.side + ", " + this.stringify(v) + ".");
7432
7461
  }
7433
- if (v.blending === effects.spec.MaterialBlending.masked) {
7462
+ if (v.blending === EFFECTS.spec.MaterialBlending.masked) {
7434
7463
  if (v.alphaCutOff === undefined) {
7435
- console.error("Material alphaCutOff is required for mask, " + this.stringify(v));
7464
+ console.error("Material alphaCutOff is required for mask, " + this.stringify(v) + ".");
7436
7465
  }
7437
7466
  }
7438
7467
  if (!this.checkNumber01Undef(v.alphaCutOff)) {
7439
- console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v));
7468
+ console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v) + ".");
7440
7469
  }
7441
7470
  } else {
7442
- console.error("Invalid material type " + this.stringify(v));
7471
+ console.error("Invalid material type " + this.stringify(v) + ".");
7443
7472
  }
7444
7473
  };
7445
7474
  /**
@@ -7457,7 +7486,7 @@ var AttributeArray = /*#__PURE__*/ function() {
7457
7486
  * @param v - Model 插件 Mesh 参数
7458
7487
  */ CheckerHelper.assertModelMeshOptions = function assertModelMeshOptions(v) {
7459
7488
  if (!this.checkParent(v.parent)) {
7460
- console.error("Invalid mesh parent " + v.parent + ", " + this.stringify(v));
7489
+ console.error("Invalid mesh parent " + v.parent + ", " + this.stringify(v) + ".");
7461
7490
  }
7462
7491
  if (v.skin !== undefined) {
7463
7492
  this.assertModelSkinOptions(v.skin);
@@ -7466,7 +7495,7 @@ var AttributeArray = /*#__PURE__*/ function() {
7466
7495
  for(var i = 0; i < v.primitives.length; i++){
7467
7496
  var prim = v.primitives[i];
7468
7497
  if (!this.assertPrimOptions(prim)) {
7469
- console.error("Invalid primitive " + prim + ", " + this.stringify(v));
7498
+ console.error("Invalid primitive " + prim + ", " + this.stringify(v) + ".");
7470
7499
  }
7471
7500
  var morph = new PMorph();
7472
7501
  morph.create(prim.geometry);
@@ -7476,11 +7505,11 @@ var AttributeArray = /*#__PURE__*/ function() {
7476
7505
  var morph0 = morphList[i1 - 1];
7477
7506
  var morph1 = morphList[i1];
7478
7507
  if (!morph0.equals(morph1)) {
7479
- console.error("Morph states mismatch: " + this.stringify(morph0) + ", " + this.stringify(morph1) + ", " + this.stringify(v));
7508
+ console.error("Morph states mismatch: " + this.stringify(morph0) + ", " + this.stringify(morph1) + ", " + this.stringify(v) + ".");
7480
7509
  }
7481
7510
  }
7482
7511
  if (!this.checkBooleanUndef(v.hide)) {
7483
- console.error("Invalid mesh hide " + v.hide + ", " + this.stringify(v));
7512
+ console.error("Invalid mesh hide " + v.hide + ", " + this.stringify(v) + ".");
7484
7513
  }
7485
7514
  };
7486
7515
  /**
@@ -7488,22 +7517,22 @@ var AttributeArray = /*#__PURE__*/ function() {
7488
7517
  * @param v - Model 插件相机参数
7489
7518
  */ CheckerHelper.assertModelCameraOptions = function assertModelCameraOptions(v) {
7490
7519
  if (!this.checkParent(v.parent)) {
7491
- console.error("Invalid camera parent " + v.parent + ", " + this.stringify(v));
7520
+ console.error("Invalid camera parent " + v.parent + ", " + this.stringify(v) + ".");
7492
7521
  }
7493
7522
  if (!this.checkNumberUndef(v.aspect)) {
7494
- console.error("Invalid camera aspect " + v.aspect + ", " + this.stringify(v));
7523
+ console.error("Invalid camera aspect " + v.aspect + ", " + this.stringify(v) + ".");
7495
7524
  }
7496
7525
  if (!this.checkPositive(v.near)) {
7497
- console.error("Invalid camera near " + v.near + ", " + this.stringify(v));
7526
+ console.error("Invalid camera near " + v.near + ", " + this.stringify(v) + ".");
7498
7527
  }
7499
7528
  if (!this.checkPositive(v.far) || v.far <= v.near) {
7500
- console.error("Invalid camera far " + v.far + ", " + this.stringify(v));
7529
+ console.error("Invalid camera far " + v.far + ", " + this.stringify(v) + ".");
7501
7530
  }
7502
7531
  if (!this.checkPositive(v.fov)) {
7503
- console.error("Invalid camera fov " + v.fov + ", " + this.stringify(v));
7532
+ console.error("Invalid camera fov " + v.fov + ", " + this.stringify(v) + ".");
7504
7533
  }
7505
7534
  if (!this.checkNumber01(v.clipMode)) {
7506
- console.error("Invalid camera clipMode " + v.clipMode + ", " + this.stringify(v));
7535
+ console.error("Invalid camera clipMode " + v.clipMode + ", " + this.stringify(v) + ".");
7507
7536
  }
7508
7537
  };
7509
7538
  /**
@@ -7512,58 +7541,58 @@ var AttributeArray = /*#__PURE__*/ function() {
7512
7541
  */ CheckerHelper.assertModelLightOptions = function assertModelLightOptions(v) {
7513
7542
  if (v.lightType === "directional") {
7514
7543
  if (!this.checkParent(v.parent)) {
7515
- console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
7544
+ console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
7516
7545
  }
7517
7546
  if (!this.checkNonnegative4(v.color)) {
7518
- console.error("Invalid light color " + v.color + ", " + this.stringify(v));
7547
+ console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
7519
7548
  }
7520
7549
  if (!this.checkNonnegative(v.intensity)) {
7521
- console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
7550
+ console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
7522
7551
  }
7523
7552
  } else if (v.lightType === "point") {
7524
7553
  if (!this.checkParent(v.parent)) {
7525
- console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
7554
+ console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
7526
7555
  }
7527
7556
  if (!this.checkNonnegative4(v.color)) {
7528
- console.error("Invalid light color " + v.color + ", " + this.stringify(v));
7557
+ console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
7529
7558
  }
7530
7559
  if (!this.checkNonnegative(v.intensity)) {
7531
- console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
7560
+ console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
7532
7561
  }
7533
7562
  if (!this.checkNonnegative(v.range)) {
7534
- console.error("Invalid light range " + v.range + ", " + this.stringify(v));
7563
+ console.error("Invalid light range " + v.range + ", " + this.stringify(v) + ".");
7535
7564
  }
7536
7565
  } else if (v.lightType === "spot") {
7537
7566
  if (!this.checkParent(v.parent)) {
7538
- console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
7567
+ console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
7539
7568
  }
7540
7569
  if (!this.checkNonnegative4(v.color)) {
7541
- console.error("Invalid light color " + v.color + ", " + this.stringify(v));
7570
+ console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
7542
7571
  }
7543
7572
  if (!this.checkNonnegative(v.intensity)) {
7544
- console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
7573
+ console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
7545
7574
  }
7546
7575
  if (!this.checkNonnegative(v.range)) {
7547
- console.error("Invalid light range " + v.range + ", " + this.stringify(v));
7576
+ console.error("Invalid light range " + v.range + ", " + this.stringify(v) + ".");
7548
7577
  }
7549
7578
  if (!this.checkNonnegative(v.innerConeAngle)) {
7550
- console.error("Invalid light innerConeAngle " + v.innerConeAngle + ", " + this.stringify(v));
7579
+ console.error("Invalid light innerConeAngle " + v.innerConeAngle + ", " + this.stringify(v) + ".");
7551
7580
  }
7552
7581
  if (!this.checkNonnegative(v.outerConeAngle)) {
7553
- console.error("Invalid light outerConeAngle " + v.outerConeAngle + ", " + this.stringify(v));
7582
+ console.error("Invalid light outerConeAngle " + v.outerConeAngle + ", " + this.stringify(v) + ".");
7554
7583
  }
7555
7584
  } else if (v.lightType === "ambient") {
7556
7585
  if (!this.checkParent(v.parent)) {
7557
- console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
7586
+ console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
7558
7587
  }
7559
7588
  if (!this.checkNonnegative4(v.color)) {
7560
- console.error("Invalid light color " + v.color + ", " + this.stringify(v));
7589
+ console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
7561
7590
  }
7562
7591
  if (!this.checkNonnegative(v.intensity)) {
7563
- console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
7592
+ console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
7564
7593
  }
7565
7594
  } else {
7566
- console.error("Invalid light type " + this.stringify(v));
7595
+ console.error("Invalid light type " + this.stringify(v) + ".");
7567
7596
  }
7568
7597
  };
7569
7598
  /**
@@ -7572,43 +7601,43 @@ var AttributeArray = /*#__PURE__*/ function() {
7572
7601
  */ CheckerHelper.assertModelSkyboxOptions = function assertModelSkyboxOptions(v) {
7573
7602
  var _this = this;
7574
7603
  if (!this.checkBoolean(v.renderable)) {
7575
- console.error("Invalid skybox renderable " + v.renderable + ", " + this.stringify(v));
7604
+ console.error("Invalid skybox renderable " + v.renderable + ", " + this.stringify(v) + ".");
7576
7605
  }
7577
7606
  if (!this.checkNonnegative(v.intensity)) {
7578
- console.error("Invalid skybox intensity " + v.intensity + ", " + this.stringify(v));
7607
+ console.error("Invalid skybox intensity " + v.intensity + ", " + this.stringify(v) + ".");
7579
7608
  }
7580
7609
  if (!this.checkNonnegative(v.reflectionsIntensity)) {
7581
- console.error("Invalid skybox reflectionsIntensity " + v.reflectionsIntensity + ", " + this.stringify(v));
7610
+ console.error("Invalid skybox reflectionsIntensity " + v.reflectionsIntensity + ", " + this.stringify(v) + ".");
7582
7611
  }
7583
7612
  //
7584
7613
  var c = v.irradianceCoeffs;
7585
7614
  if (c !== undefined) {
7586
7615
  if (!Array.isArray(c) || c.length != 9) {
7587
- console.error("Invalid skybox irradianceCoeffs " + c + ", " + this.stringify(v));
7616
+ console.error("Invalid skybox irradianceCoeffs " + c + ", " + this.stringify(v) + ".");
7588
7617
  }
7589
7618
  c.forEach(function(v) {
7590
7619
  if (!_this.checkVec3(v)) {
7591
- console.error("Invalid skybox irradianceCoeffs " + c + ", " + _this.stringify(v));
7620
+ console.error("Invalid skybox irradianceCoeffs " + c + ", " + _this.stringify(v) + ".");
7592
7621
  }
7593
7622
  });
7594
7623
  } else if (v.diffuseImage !== undefined) {
7595
7624
  if (!this.checkTexture(v.diffuseImage)) {
7596
- console.error("Invalid skybox diffuseImage " + v.diffuseImage + ", " + this.stringify(v));
7625
+ console.error("Invalid skybox diffuseImage " + v.diffuseImage + ", " + this.stringify(v) + ".");
7597
7626
  }
7598
7627
  } else {
7599
- console.error("Invalid skybox, irradianceCoeffs or diffuseImage should give one, " + this.stringify(v));
7628
+ console.error("Invalid skybox, irradianceCoeffs or diffuseImage should give one, " + this.stringify(v) + ".");
7600
7629
  }
7601
7630
  if (!this.checkTexture(v.specularImage)) {
7602
- console.error("Invalid skybox specularImage " + v.specularImage + ", " + this.stringify(v));
7631
+ console.error("Invalid skybox specularImage " + v.specularImage + ", " + this.stringify(v) + ".");
7603
7632
  }
7604
7633
  if (!this.checkPositive(v.specularImageSize)) {
7605
- console.error("Invalid skybox specularImageSize " + v.specularImageSize + ", " + this.stringify(v));
7634
+ console.error("Invalid skybox specularImageSize " + v.specularImageSize + ", " + this.stringify(v) + ".");
7606
7635
  }
7607
7636
  if (!this.checkPositive(v.specularMipCount)) {
7608
- console.error("Invalid skybox specularMipCount " + v.specularMipCount + ", " + this.stringify(v));
7637
+ console.error("Invalid skybox specularMipCount " + v.specularMipCount + ", " + this.stringify(v) + ".");
7609
7638
  }
7610
7639
  if (this.pow2(v.specularMipCount) > v.specularImageSize) {
7611
- console.error("Invalid skybox specularMipCount or specularImageSize, " + this.stringify(v));
7640
+ console.error("Invalid skybox specularMipCount or specularImageSize, " + this.stringify(v) + ".");
7612
7641
  }
7613
7642
  };
7614
7643
  /**
@@ -7644,14 +7673,14 @@ var AttributeArray = /*#__PURE__*/ function() {
7644
7673
  */ CheckerHelper.assertModelAnimOptions = function assertModelAnimOptions(v) {
7645
7674
  var _this = this;
7646
7675
  if (!this.checkStringUndef(v.name)) {
7647
- console.error("Invalid animation name " + v.name + ", " + this.stringify(v));
7676
+ console.error("Invalid animation name " + v.name + ", " + this.stringify(v) + ".");
7648
7677
  }
7649
7678
  if (!Array.isArray(v.tracks)) {
7650
- console.error("Invalid animation tracks " + v.tracks + ", " + this.stringify(v));
7679
+ console.error("Invalid animation tracks " + v.tracks + ", " + this.stringify(v) + ".");
7651
7680
  }
7652
7681
  v.tracks.forEach(function(t) {
7653
7682
  if (!_this.checkModelAnimTrackOptions(t)) {
7654
- console.error("Invalid animation track " + t + ", " + _this.stringify(v));
7683
+ console.error("Invalid animation track " + t + ", " + _this.stringify(v) + ".");
7655
7684
  }
7656
7685
  });
7657
7686
  };
@@ -7661,18 +7690,18 @@ var AttributeArray = /*#__PURE__*/ function() {
7661
7690
  */ CheckerHelper.assertTreeOptions = function assertTreeOptions(v) {
7662
7691
  var _this = this;
7663
7692
  if (!this.checkNumberUndef(v.animation)) {
7664
- console.error("Invalid tree animation " + v.animation + ", " + this.stringify(v));
7693
+ console.error("Invalid tree animation " + v.animation + ", " + this.stringify(v) + ".");
7665
7694
  }
7666
7695
  if (v.animations !== undefined) {
7667
7696
  if (!Array.isArray(v.animations)) {
7668
- console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v));
7697
+ console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v) + ".");
7669
7698
  }
7670
7699
  v.animations.forEach(function(anim) {
7671
7700
  _this.assertModelAnimOptions(anim);
7672
7701
  });
7673
7702
  if (v.animation !== undefined) {
7674
7703
  if (v.animation < -1 || v.animation >= v.animations.length) {
7675
- console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v));
7704
+ console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v) + ".");
7676
7705
  }
7677
7706
  }
7678
7707
  }
@@ -7693,15 +7722,15 @@ var AttributeArray = /*#__PURE__*/ function() {
7693
7722
  if (typeof object[prop] == "function") {
7694
7723
  continue;
7695
7724
  }
7696
- if (_instanceof1(object[prop], effects.Texture)) {
7725
+ if (_instanceof1(object[prop], EFFECTS.Texture)) {
7697
7726
  simpleObject[prop] = object[prop].name;
7698
7727
  continue;
7699
7728
  }
7700
- if (_instanceof1(object[prop], effects.Geometry)) {
7729
+ if (_instanceof1(object[prop], EFFECTS.Geometry)) {
7701
7730
  simpleObject[prop] = object[prop].name;
7702
7731
  continue;
7703
7732
  }
7704
- if (_instanceof1(object[prop], effects.Renderer)) {
7733
+ if (_instanceof1(object[prop], EFFECTS.Renderer)) {
7705
7734
  continue;
7706
7735
  }
7707
7736
  simpleObject[prop] = object[prop];
@@ -7784,18 +7813,6 @@ var toHalf = function() {
7784
7813
  };
7785
7814
  }();
7786
7815
 
7787
- exports.RenderType = void 0;
7788
- (function(RenderType) {
7789
- RenderType["Opaque"] = "Opaque";
7790
- RenderType["Mask"] = "Mask";
7791
- RenderType["Blend"] = "Blend";
7792
- })(exports.RenderType || (exports.RenderType = {}));
7793
- exports.CullMode = void 0;
7794
- (function(CullMode) {
7795
- CullMode["Front"] = "Front";
7796
- CullMode["Back"] = "Back";
7797
- CullMode["Double"] = "Double";
7798
- })(exports.CullMode || (exports.CullMode = {}));
7799
7816
  /**
7800
7817
  * 3D 材质基础类,支持公共的材质功能
7801
7818
  */ var PMaterialBase = /*#__PURE__*/ function(PObject) {
@@ -7820,13 +7837,16 @@ exports.CullMode = void 0;
7820
7837
  */ _this.ZTest = true;
7821
7838
  /**
7822
7839
  * 渲染类型,默认是不透明
7823
- */ _this.renderType = "Opaque";
7840
+ */ _this.renderType = EFFECTS.spec.RenderType.Opaque;
7841
+ /**
7842
+ * 是否 Alpha 裁剪,默认关闭
7843
+ */ _this.alphaClip = false;
7824
7844
  /**
7825
7845
  * Alpha 测试截断值
7826
- */ _this.alphaCutOff = 0.5;
7846
+ */ _this.alphaCutoff = 0.5;
7827
7847
  /**
7828
7848
  * 面侧模式,默认是正面
7829
- */ _this.cullMode = "Front";
7849
+ */ _this.renderFace = EFFECTS.spec.RenderFace.Front;
7830
7850
  return _this;
7831
7851
  }
7832
7852
  var _proto = PMaterialBase.prototype;
@@ -7835,28 +7855,28 @@ exports.CullMode = void 0;
7835
7855
  * @returns 特性列表
7836
7856
  */ _proto.getShaderFeatures = function getShaderFeatures() {
7837
7857
  var featureList = [];
7838
- if (this.isOpaque()) {
7839
- featureList.push("ALPHAMODE_OPAQUE 1");
7840
- } else if (this.isMasked()) {
7858
+ if (this.isAlphaClip()) {
7841
7859
  featureList.push("ALPHAMODE_MASK 1");
7860
+ } else if (this.isOpaque()) {
7861
+ featureList.push("ALPHAMODE_OPAQUE 1");
7842
7862
  }
7843
- if (this.cullMode === "Double") {
7863
+ if (this.renderFace === EFFECTS.spec.RenderFace.Both) {
7844
7864
  featureList.push("DOUBLE_SIDED 1");
7845
7865
  }
7846
7866
  return featureList;
7847
7867
  };
7848
7868
  _proto.getShaderMacros = function getShaderMacros() {
7849
7869
  var macroList = [];
7850
- if (this.isOpaque()) {
7870
+ if (this.isAlphaClip()) {
7851
7871
  macroList.push({
7852
- name: "ALPHAMODE_OPAQUE"
7872
+ name: "ALPHAMODE_MASK"
7853
7873
  });
7854
- } else if (this.isMasked()) {
7874
+ } else if (this.isOpaque()) {
7855
7875
  macroList.push({
7856
- name: "ALPHAMODE_MASK"
7876
+ name: "ALPHAMODE_OPAQUE"
7857
7877
  });
7858
7878
  }
7859
- if (this.cullMode === "Double") {
7879
+ if (this.renderFace === EFFECTS.spec.RenderFace.Both) {
7860
7880
  macroList.push({
7861
7881
  name: "DOUBLE_SIDED"
7862
7882
  });
@@ -7869,7 +7889,7 @@ exports.CullMode = void 0;
7869
7889
  */ _proto.updateUniforms = function updateUniforms(material) {
7870
7890
  // 渲染 UV 结果输出时,设置 uv 大小
7871
7891
  var renderMode = PGlobalState.getInstance().renderMode3D;
7872
- if (renderMode === effects.spec.RenderMode3D.uv) {
7892
+ if (renderMode === EFFECTS.spec.RenderMode3D.uv) {
7873
7893
  var debugUVGridSize = PGlobalState.getInstance().renderMode3DUVGridSize;
7874
7894
  material.setFloat("_DebugUVGridSize", debugUVGridSize);
7875
7895
  }
@@ -7939,19 +7959,19 @@ exports.CullMode = void 0;
7939
7959
  * 设置材质状态,根据 GE 材质状态
7940
7960
  * @param material - GE 材质
7941
7961
  */ _proto.setMaterialStates = function setMaterialStates(material) {
7942
- if (this.renderType === "Blend") {
7962
+ if (this.renderType === EFFECTS.spec.RenderType.Transparent) {
7943
7963
  material.blending = true;
7944
7964
  material.depthTest = this.ZTest;
7945
7965
  material.depthMask = this.ZWrite;
7946
7966
  material.blendEquation = [
7947
- effects.glContext.FUNC_ADD,
7948
- effects.glContext.FUNC_ADD
7967
+ EFFECTS.glContext.FUNC_ADD,
7968
+ EFFECTS.glContext.FUNC_ADD
7949
7969
  ];
7950
7970
  material.blendFunction = [
7951
- effects.glContext.ONE,
7952
- effects.glContext.ONE_MINUS_SRC_ALPHA,
7953
- effects.glContext.ONE,
7954
- effects.glContext.ONE_MINUS_SRC_ALPHA
7971
+ EFFECTS.glContext.ONE,
7972
+ EFFECTS.glContext.ONE_MINUS_SRC_ALPHA,
7973
+ EFFECTS.glContext.ONE,
7974
+ EFFECTS.glContext.ONE_MINUS_SRC_ALPHA
7955
7975
  ];
7956
7976
  } else {
7957
7977
  if (PGlobalState.getInstance().isTiny3dMode) {
@@ -7968,15 +7988,15 @@ exports.CullMode = void 0;
7968
7988
  this.setFaceSideStates(material);
7969
7989
  };
7970
7990
  _proto.setFaceSideStates = function setFaceSideStates(material) {
7971
- if (this.isDoubleSide()) {
7991
+ if (this.isBothSide()) {
7972
7992
  material.culling = false;
7973
7993
  } else if (this.isBackSide()) {
7974
- material.cullFace = effects.glContext.FRONT;
7975
- material.frontFace = effects.glContext.CCW;
7994
+ material.cullFace = EFFECTS.glContext.FRONT;
7995
+ material.frontFace = EFFECTS.glContext.CCW;
7976
7996
  material.culling = true;
7977
7997
  } else {
7978
- material.cullFace = effects.glContext.BACK;
7979
- material.frontFace = effects.glContext.CCW;
7998
+ material.cullFace = EFFECTS.glContext.BACK;
7999
+ material.frontFace = EFFECTS.glContext.CCW;
7980
8000
  material.culling = true;
7981
8001
  }
7982
8002
  };
@@ -7996,37 +8016,37 @@ exports.CullMode = void 0;
7996
8016
  * 是否不透明
7997
8017
  * @returns
7998
8018
  */ _proto.isOpaque = function isOpaque() {
7999
- return this.renderType === "Opaque";
8019
+ return this.renderType === EFFECTS.spec.RenderType.Opaque;
8000
8020
  };
8001
8021
  /**
8002
- * 是否遮罩
8022
+ * 是否 Alpha 裁剪
8003
8023
  * @returns
8004
- */ _proto.isMasked = function isMasked() {
8005
- return this.renderType === "Mask";
8024
+ */ _proto.isAlphaClip = function isAlphaClip() {
8025
+ return this.alphaClip;
8006
8026
  };
8007
8027
  /**
8008
8028
  * 是否半透明
8009
8029
  * @returns
8010
- */ _proto.isBlend = function isBlend() {
8011
- return this.renderType === "Blend";
8030
+ */ _proto.isTransparent = function isTransparent() {
8031
+ return this.renderType === EFFECTS.spec.RenderType.Transparent;
8012
8032
  };
8013
8033
  /**
8014
8034
  * 是否正面模式
8015
8035
  * @returns
8016
8036
  */ _proto.isFrontSide = function isFrontSide() {
8017
- return this.cullMode === "Front";
8037
+ return this.renderFace === EFFECTS.spec.RenderFace.Front;
8018
8038
  };
8019
8039
  /**
8020
8040
  * 是否背面模式
8021
8041
  * @returns
8022
8042
  */ _proto.isBackSide = function isBackSide() {
8023
- return this.cullMode === "Back";
8043
+ return this.renderFace === EFFECTS.spec.RenderFace.Back;
8024
8044
  };
8025
8045
  /**
8026
8046
  * 是否双面模式
8027
8047
  * @returns
8028
- */ _proto.isDoubleSide = function isDoubleSide() {
8029
- return this.cullMode === "Double";
8048
+ */ _proto.isBothSide = function isBothSide() {
8049
+ return this.renderFace === EFFECTS.spec.RenderFace.Both;
8030
8050
  };
8031
8051
  return PMaterialBase;
8032
8052
  }(PObject);
@@ -8058,14 +8078,15 @@ exports.CullMode = void 0;
8058
8078
  var _material_getColor;
8059
8079
  this.baseColorFactor = (_material_getColor = material.getColor("_BaseColorFactor")) != null ? _material_getColor : new Color(1.0, 1.0, 1.0, 1.0);
8060
8080
  //
8061
- this.ZWrite = material.stringTags["ZWrite"] !== "false";
8062
- this.ZTest = material.stringTags["ZTest"] !== "false";
8081
+ this.ZWrite = material.getFloat("ZWrite") !== 0;
8082
+ this.ZTest = material.getFloat("ZTest") !== 0;
8063
8083
  var _material_stringTags_RenderType;
8064
- this.renderType = (_material_stringTags_RenderType = material.stringTags["RenderType"]) != null ? _material_stringTags_RenderType : "Opaque";
8084
+ this.renderType = (_material_stringTags_RenderType = material.stringTags["RenderType"]) != null ? _material_stringTags_RenderType : EFFECTS.spec.RenderType.Opaque;
8085
+ this.alphaClip = material.getFloat("AlphaClip") === 1;
8065
8086
  var _material_getFloat;
8066
- this.alphaCutOff = (_material_getFloat = material.getFloat("_AlphaCutoff")) != null ? _material_getFloat : 0;
8067
- var _material_stringTags_Cull;
8068
- this.cullMode = (_material_stringTags_Cull = material.stringTags["Cull"]) != null ? _material_stringTags_Cull : "Front";
8087
+ this.alphaCutoff = (_material_getFloat = material.getFloat("_AlphaCutoff")) != null ? _material_getFloat : 0;
8088
+ var _material_stringTags_RenderFace;
8089
+ this.renderFace = (_material_stringTags_RenderFace = material.stringTags["RenderFace"]) != null ? _material_stringTags_RenderFace : EFFECTS.spec.RenderFace.Front;
8069
8090
  };
8070
8091
  /**
8071
8092
  * 销毁材质
@@ -8233,14 +8254,15 @@ exports.CullMode = void 0;
8233
8254
  var _material_getFloat4;
8234
8255
  this.emissiveIntensity = (_material_getFloat4 = material.getFloat("_EmissiveIntensity")) != null ? _material_getFloat4 : 1;
8235
8256
  //
8236
- this.ZWrite = material.stringTags["ZWrite"] !== "false";
8237
- this.ZTest = material.stringTags["ZTest"] !== "false";
8257
+ this.ZWrite = material.getFloat("ZWrite") !== 0;
8258
+ this.ZTest = material.getFloat("ZTest") !== 0;
8238
8259
  var _material_stringTags_RenderType;
8239
- this.renderType = (_material_stringTags_RenderType = material.stringTags["RenderType"]) != null ? _material_stringTags_RenderType : "Opaque";
8260
+ this.renderType = (_material_stringTags_RenderType = material.stringTags["RenderType"]) != null ? _material_stringTags_RenderType : EFFECTS.spec.RenderType.Opaque;
8261
+ this.alphaClip = material.getFloat("AlphaClip") === 1;
8240
8262
  var _material_getFloat5;
8241
- this.alphaCutOff = (_material_getFloat5 = material.getFloat("_AlphaCutoff")) != null ? _material_getFloat5 : 0;
8242
- var _material_stringTags_Cull;
8243
- this.cullMode = (_material_stringTags_Cull = material.stringTags["Cull"]) != null ? _material_stringTags_Cull : "Front";
8263
+ this.alphaCutoff = (_material_getFloat5 = material.getFloat("_AlphaCutoff")) != null ? _material_getFloat5 : 0;
8264
+ var _material_stringTags_RenderFace;
8265
+ this.renderFace = (_material_stringTags_RenderFace = material.stringTags["RenderFace"]) != null ? _material_stringTags_RenderFace : EFFECTS.spec.RenderFace.Front;
8244
8266
  };
8245
8267
  /**
8246
8268
  * 销毁材质
@@ -8687,7 +8709,7 @@ exports.CullMode = void 0;
8687
8709
  if (this.irradianceCoeffs === undefined && this.diffuseImage === undefined) {
8688
8710
  return false;
8689
8711
  }
8690
- return this.specularImage !== undefined && this.specularMipCount > 0;
8712
+ return this.specularImage !== undefined && this.specularMipCount >= 0;
8691
8713
  }
8692
8714
  },
8693
8715
  {
@@ -8797,7 +8819,7 @@ exports.CullMode = void 0;
8797
8819
  } else {
8798
8820
  var coeffs = this.irradianceCoeffs;
8799
8821
  if (coeffs === undefined || coeffs.length != 9) {
8800
- throw new Error("Invalid skybox irradiance coeffs " + coeffs);
8822
+ throw new Error("Invalid skybox irradiance coeffs " + coeffs + ".");
8801
8823
  }
8802
8824
  var aliasName = [
8803
8825
  "l00",
@@ -8814,7 +8836,7 @@ exports.CullMode = void 0;
8814
8836
  material.setVector3("_shCoefficients." + n, Vector3.fromArray(coeffs[i]));
8815
8837
  });
8816
8838
  }
8817
- material.setInt("_MipCount", this.specularMipCount);
8839
+ material.setInt("_MipCount", this.specularMipCount - 1);
8818
8840
  material.setTexture("_SpecularEnvSampler", this.specularImage);
8819
8841
  };
8820
8842
  /**
@@ -8853,18 +8875,18 @@ exports.PSkyboxType = void 0;
8853
8875
  ];
8854
8876
  return [
8855
8877
  4,
8856
- effects.loadImage(imageList[i])
8878
+ EFFECTS.loadImage(imageList[i])
8857
8879
  ];
8858
8880
  case 2:
8859
8881
  image = _state.sent();
8860
8882
  if (i > 0) {
8861
8883
  if (i % 6 === 0) {
8862
8884
  if (image.width * 2 !== lastImage.width || image.height * 2 !== lastImage.height) {
8863
- throw new Error("Invalid cube map list1: index " + i + ", image0 " + lastImage + ", image1 " + image);
8885
+ throw new Error("Invalid cube map list1: index " + i + ", image0 " + lastImage + ", image1 " + image + ".");
8864
8886
  }
8865
8887
  } else {
8866
8888
  if (image.width !== lastImage.width || image.height !== lastImage.height) {
8867
- throw new Error("Invalid cube map list2: index " + i + ", image0 " + lastImage + ", image1 " + image);
8889
+ throw new Error("Invalid cube map list2: index " + i + ", image0 " + lastImage + ", image1 " + image + ".");
8868
8890
  }
8869
8891
  }
8870
8892
  }
@@ -8901,18 +8923,18 @@ exports.PSkyboxType = void 0;
8901
8923
  brdfURL = "https://gw.alipayobjects.com/zos/gltf-asset/61420044606400/lut-ggx.png";
8902
8924
  return [
8903
8925
  4,
8904
- effects.loadImage(brdfURL)
8926
+ EFFECTS.loadImage(brdfURL)
8905
8927
  ];
8906
8928
  case 1:
8907
8929
  brdfLutImage = _state.sent();
8908
8930
  brdfLutOpts = {
8909
8931
  name: "brdfLut",
8910
- wrapS: effects.glContext.CLAMP_TO_EDGE,
8911
- wrapT: effects.glContext.CLAMP_TO_EDGE,
8912
- magFilter: effects.glContext.LINEAR,
8913
- minFilter: effects.glContext.LINEAR,
8932
+ wrapS: EFFECTS.glContext.CLAMP_TO_EDGE,
8933
+ wrapT: EFFECTS.glContext.CLAMP_TO_EDGE,
8934
+ magFilter: EFFECTS.glContext.LINEAR,
8935
+ minFilter: EFFECTS.glContext.LINEAR,
8914
8936
  anisotropic: 1,
8915
- sourceType: effects.TextureSourceType.image,
8937
+ sourceType: EFFECTS.TextureSourceType.image,
8916
8938
  image: brdfLutImage,
8917
8939
  generateMipmap: false,
8918
8940
  flipY: false,
@@ -8943,7 +8965,7 @@ exports.PSkyboxType = void 0;
8943
8965
  ];
8944
8966
  case 1:
8945
8967
  brdfLutOpts = _state.sent();
8946
- brdfLutTexture = effects.Texture.create(engine, brdfLutOpts);
8968
+ brdfLutTexture = EFFECTS.Texture.create(engine, brdfLutOpts);
8947
8969
  return [
8948
8970
  2,
8949
8971
  brdfLutTexture
@@ -9023,10 +9045,10 @@ exports.PSkyboxType = void 0;
9023
9045
  id: specularCubeData.textureOptions.id
9024
9046
  };
9025
9047
  var componentData = {
9026
- id: effects.generateGUID(),
9027
- dataType: effects.spec.DataType.SkyboxComponent,
9048
+ id: EFFECTS.generateGUID(),
9049
+ dataType: EFFECTS.spec.DataType.SkyboxComponent,
9028
9050
  item: {
9029
- id: effects.generateGUID()
9051
+ id: EFFECTS.generateGUID()
9030
9052
  },
9031
9053
  renderable: renderable,
9032
9054
  intensity: intensity,
@@ -9079,7 +9101,7 @@ exports.PSkyboxType = void 0;
9079
9101
  params.specularImage.forEach(function(cubemap) {
9080
9102
  var mipmap = [];
9081
9103
  cubemap.forEach(function(image) {
9082
- var imageId = effects.generateGUID();
9104
+ var imageId = EFFECTS.generateGUID();
9083
9105
  imageDatas.push({
9084
9106
  id: imageId,
9085
9107
  // @ts-expect-error
@@ -9092,10 +9114,10 @@ exports.PSkyboxType = void 0;
9092
9114
  mipmaps.push(mipmap);
9093
9115
  });
9094
9116
  var textureOptions = _extends({
9095
- id: effects.generateGUID(),
9096
- dataType: effects.spec.DataType.Texture,
9097
- sourceType: effects.TextureSourceType.mipmaps,
9098
- target: effects.glContext.TEXTURE_CUBE_MAP,
9117
+ id: EFFECTS.generateGUID(),
9118
+ dataType: EFFECTS.spec.DataType.Texture,
9119
+ sourceType: EFFECTS.TextureSourceType.mipmaps,
9120
+ target: EFFECTS.glContext.TEXTURE_CUBE_MAP,
9099
9121
  // @ts-expect-error
9100
9122
  mipmaps: mipmaps
9101
9123
  }, WebGLHelper.cubemapMipTexConfig);
@@ -9139,7 +9161,7 @@ exports.PSkyboxType = void 0;
9139
9161
  var imageDatas = [];
9140
9162
  var cubemap = [];
9141
9163
  params.diffuseImage.forEach(function(image) {
9142
- var imageId = effects.generateGUID();
9164
+ var imageId = EFFECTS.generateGUID();
9143
9165
  imageDatas.push({
9144
9166
  id: imageId,
9145
9167
  // @ts-expect-error
@@ -9150,10 +9172,10 @@ exports.PSkyboxType = void 0;
9150
9172
  });
9151
9173
  });
9152
9174
  var textureOptions = _extends({
9153
- id: effects.generateGUID(),
9154
- dataType: effects.spec.DataType.Texture,
9155
- sourceType: effects.TextureSourceType.mipmaps,
9156
- target: effects.glContext.TEXTURE_CUBE_MAP,
9175
+ id: EFFECTS.generateGUID(),
9176
+ dataType: EFFECTS.spec.DataType.Texture,
9177
+ sourceType: EFFECTS.TextureSourceType.mipmaps,
9178
+ target: EFFECTS.glContext.TEXTURE_CUBE_MAP,
9157
9179
  // @ts-expect-error
9158
9180
  mipmaps: [
9159
9181
  cubemap
@@ -9180,7 +9202,7 @@ exports.PSkyboxType = void 0;
9180
9202
  diffuseImage: this.getDiffuseImageList(skyboxType, specularImage),
9181
9203
  specularImage: specularImage,
9182
9204
  specularImageSize: Math.pow(2, specularImage.length - 1),
9183
- specularMipCount: specularImage.length - 1
9205
+ specularMipCount: specularImage.length
9184
9206
  };
9185
9207
  return params;
9186
9208
  };
@@ -9398,11 +9420,11 @@ exports.PSkyboxType = void 0;
9398
9420
  this.loadSkybox = loadSkybox;
9399
9421
  if (this.brdfLutTexture === undefined || this.brdfLutTexture.isDestroyed) {
9400
9422
  if (CompositionCache.brdfLutTexOptions === undefined) {
9401
- throw new Error("Please load brdfLutTexOptions at first");
9423
+ throw new Error("Please load brdfLutTexOptions at first.");
9402
9424
  }
9403
9425
  //
9404
9426
  var brdfLutTextureName = "brdfLutTexture";
9405
- this.brdfLutTexture = effects.Texture.create(this.engine, CompositionCache.brdfLutTexOptions);
9427
+ this.brdfLutTexture = EFFECTS.Texture.create(this.engine, CompositionCache.brdfLutTexOptions);
9406
9428
  this.deleteTexture(brdfLutTextureName);
9407
9429
  this.setTexture(brdfLutTextureName, this.brdfLutTexture);
9408
9430
  }
@@ -9431,7 +9453,7 @@ exports.PSkyboxType = void 0;
9431
9453
  if (tex !== undefined) {
9432
9454
  return tex;
9433
9455
  }
9434
- var newTex = effects.Texture.create(this.engine, options);
9456
+ var newTex = EFFECTS.Texture.create(this.engine, options);
9435
9457
  this.textureCache.set(name, newTex);
9436
9458
  return newTex;
9437
9459
  };
@@ -9646,9 +9668,9 @@ exports.PSkyboxType = void 0;
9646
9668
  id: "ModelPluginItem",
9647
9669
  name: "ModelPluginItem",
9648
9670
  duration: 9999999,
9649
- endBehavior: effects.spec.END_BEHAVIOR_FORWARD
9671
+ endBehavior: EFFECTS.spec.END_BEHAVIOR_FORWARD
9650
9672
  };
9651
- var item = new effects.VFXItem(composition.getEngine(), props);
9673
+ var item = new EFFECTS.VFXItem(composition.getEngine(), props);
9652
9674
  composition.addItem(item);
9653
9675
  //
9654
9676
  var comp = item.addComponent(exports.ModelPluginComponent);
@@ -9718,33 +9740,33 @@ exports.PSkyboxType = void 0;
9718
9740
  var pbrShaderData = {
9719
9741
  id: PBRShaderGUID,
9720
9742
  name: "PBR Shader",
9721
- dataType: effects.spec.DataType.Shader,
9743
+ dataType: EFFECTS.spec.DataType.Shader,
9722
9744
  fragment: pbrShaderCode.fragmentShaderCode,
9723
9745
  vertex: pbrShaderCode.vertexShaderCode,
9724
9746
  // @ts-expect-error
9725
- glslVersion: isWebGL2 ? effects.GLSLVersion.GLSL3 : effects.GLSLVersion.GLSL1
9747
+ glslVersion: isWebGL2 ? EFFECTS.GLSLVersion.GLSL3 : EFFECTS.GLSLVersion.GLSL1
9726
9748
  };
9727
9749
  var unlitShaderData = {
9728
9750
  id: UnlitShaderGUID,
9729
9751
  name: "Unlit Shader",
9730
- dataType: effects.spec.DataType.Shader,
9752
+ dataType: EFFECTS.spec.DataType.Shader,
9731
9753
  fragment: unlitShaderCode.fragmentShaderCode,
9732
9754
  vertex: unlitShaderCode.vertexShaderCode,
9733
9755
  // @ts-expect-error
9734
- glslVersion: isWebGL2 ? effects.GLSLVersion.GLSL3 : effects.GLSLVersion.GLSL1
9756
+ glslVersion: isWebGL2 ? EFFECTS.GLSLVersion.GLSL3 : EFFECTS.GLSLVersion.GLSL1
9735
9757
  };
9736
9758
  renderer.engine.addEffectsObjectData(pbrShaderData);
9737
9759
  renderer.engine.addEffectsObjectData(unlitShaderData);
9738
9760
  return Promise.resolve();
9739
9761
  };
9740
9762
  return ModelPlugin;
9741
- }(effects.AbstractPlugin);
9763
+ }(EFFECTS.AbstractPlugin);
9742
9764
  exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
9743
9765
  _inherits(ModelPluginComponent, ItemBehaviour);
9744
9766
  function ModelPluginComponent(engine, options) {
9745
9767
  var _this;
9746
9768
  _this = ItemBehaviour.call(this, engine) || this;
9747
- _this.runtimeEnv = effects.PLAYER_OPTIONS_ENV_EDITOR;
9769
+ _this.runtimeEnv = EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
9748
9770
  _this.compatibleMode = "gltf";
9749
9771
  _this.renderSkybox = true;
9750
9772
  _this.visBoundingBox = false;
@@ -9756,7 +9778,7 @@ exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
9756
9778
  /**
9757
9779
  * 3D 渲染模式,支持可视化渲染中间结果
9758
9780
  * none 表示正常的渲染结果
9759
- */ _this.renderMode3D = effects.spec.RenderMode3D.none;
9781
+ */ _this.renderMode3D = EFFECTS.spec.RenderMode3D.none;
9760
9782
  /**
9761
9783
  * UV 渲染模式中,指定棋盘格的大小,相对于大小为 1 的纹理
9762
9784
  * 取值范围(0, 1)
@@ -9807,8 +9829,8 @@ exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
9807
9829
  var newPosition = invWorldMatrix.transformPoint(position);
9808
9830
  component.setTransform(newPosition);
9809
9831
  // 正式版本不会走到这个流程,只在测试时使用
9810
- console.info("Scene AABB [" + sceneAABB.min.toArray() + "], [" + sceneAABB.max.toArray() + "]");
9811
- console.info("Update camera position [" + newPosition.toArray() + "]");
9832
+ console.info("Scene AABB [" + sceneAABB.min.toArray() + "], [" + sceneAABB.max.toArray() + "].");
9833
+ console.info("Update camera position [" + newPosition.toArray() + "].");
9812
9834
  }
9813
9835
  }
9814
9836
  });
@@ -9892,9 +9914,9 @@ exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
9892
9914
  return lightItemCount;
9893
9915
  };
9894
9916
  return ModelPluginComponent;
9895
- }(effects.ItemBehaviour);
9917
+ }(EFFECTS.ItemBehaviour);
9896
9918
  exports.ModelPluginComponent = __decorate([
9897
- effects.effectsClass(effects.spec.DataType.ModelPluginComponent)
9919
+ EFFECTS.effectsClass(EFFECTS.spec.DataType.ModelPluginComponent)
9898
9920
  ], exports.ModelPluginComponent);
9899
9921
  /**
9900
9922
  * 获取场景管理器,从合成中查找
@@ -9985,7 +10007,7 @@ exports.ModelPluginComponent = __decorate([
9985
10007
  var nodes = options.nodes.map(function(node, i) {
9986
10008
  return {
9987
10009
  name: node.name || node.id || i + "",
9988
- transform: new effects.Transform(_extends({}, node.transform, {
10010
+ transform: new EFFECTS.Transform(_extends({}, node.transform, {
9989
10011
  valid: true
9990
10012
  }), topTransform),
9991
10013
  id: "^" + (node.id || i),
@@ -10041,7 +10063,7 @@ exports.ModelTreeComponent = /*#__PURE__*/ function(ItemBehaviour) {
10041
10063
  /**
10042
10064
  * 组件开始,查询合成中场景管理器并设置到动画管理器中
10043
10065
  */ _proto.start = function start() {
10044
- this.item.type = effects.spec.ItemType.tree;
10066
+ this.item.type = EFFECTS.spec.ItemType.tree;
10045
10067
  this.content.baseTransform.setValid(true);
10046
10068
  var sceneManager = getSceneManager(this);
10047
10069
  if (sceneManager) {
@@ -10088,9 +10110,9 @@ exports.ModelTreeComponent = /*#__PURE__*/ function(ItemBehaviour) {
10088
10110
  }
10089
10111
  };
10090
10112
  return ModelTreeComponent;
10091
- }(effects.ItemBehaviour);
10113
+ }(EFFECTS.ItemBehaviour);
10092
10114
  exports.ModelTreeComponent = __decorate([
10093
- effects.effectsClass(effects.spec.DataType.TreeComponent)
10115
+ EFFECTS.effectsClass(EFFECTS.spec.DataType.TreeComponent)
10094
10116
  ], exports.ModelTreeComponent);
10095
10117
 
10096
10118
  /**
@@ -10109,7 +10131,7 @@ exports.ModelTreeComponent = __decorate([
10109
10131
  return _this;
10110
10132
  }
10111
10133
  return ModelTreePlugin;
10112
- }(effects.AbstractPlugin);
10134
+ }(EFFECTS.AbstractPlugin);
10113
10135
 
10114
10136
  exports.CameraGestureType = void 0;
10115
10137
  (function(CameraGestureType) {
@@ -10158,11 +10180,11 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
10158
10180
  // can't find camera item, throw error message
10159
10181
  var item = this.getItem();
10160
10182
  if (item === undefined) {
10161
- console.warn("can't find camera item " + this.startParams.target);
10183
+ console.warn("[CameraGestureHandlerImp] Unable to locate camera item with ID: " + this.startParams.target + ".");
10162
10184
  return this.composition.camera.getOptions();
10163
10185
  }
10164
10186
  var camera = this.composition.camera;
10165
- var effectsTransfrom = new effects.Transform(_extends({}, camera.getOptions(), {
10187
+ var effectsTransfrom = new EFFECTS.Transform(_extends({}, camera.getOptions(), {
10166
10188
  valid: true
10167
10189
  }));
10168
10190
  var cameraTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
@@ -10329,7 +10351,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
10329
10351
  this.startParams.type = exports.CameraGestureType.none;
10330
10352
  var item = this.getItem();
10331
10353
  if (item === undefined) {
10332
- console.warn("can't find camera item");
10354
+ console.warn("[CameraGestureHandlerImp] Can't find camera item.");
10333
10355
  return;
10334
10356
  }
10335
10357
  this.setPosition(item, position);
@@ -10339,7 +10361,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
10339
10361
  this.startParams.type = exports.CameraGestureType.none;
10340
10362
  var item = this.getItem();
10341
10363
  if (item === undefined) {
10342
- console.warn("can't find camera item");
10364
+ console.warn("[CameraGestureHandlerImp] Can't find camera item.");
10343
10365
  return;
10344
10366
  }
10345
10367
  this.setQuaternion(item, quat);
@@ -10349,7 +10371,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
10349
10371
  this.startParams.type = exports.CameraGestureType.none;
10350
10372
  var item = this.getItem();
10351
10373
  if (item === undefined) {
10352
- console.warn("can't find camera item");
10374
+ console.warn("[CameraGestureHandlerImp] Can't find camera item.");
10353
10375
  return;
10354
10376
  }
10355
10377
  var newDistance = distance != null ? distance : 5;
@@ -10398,7 +10420,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
10398
10420
  };
10399
10421
  _proto.getCameraTransform = function getCameraTransform() {
10400
10422
  var camera = this.composition.camera;
10401
- var transform = new effects.Transform(camera.getOptions());
10423
+ var transform = new EFFECTS.Transform(camera.getOptions());
10402
10424
  transform.setValid(true);
10403
10425
  return transform;
10404
10426
  };
@@ -10406,7 +10428,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
10406
10428
  this.startParams = args;
10407
10429
  this.updateCameraTransform(this.composition.camera.getOptions());
10408
10430
  if (!this.getItem()) {
10409
- console.warn("invalid target");
10431
+ console.warn("[CameraGestureHandlerImp] Invalid target specified in startGesture.");
10410
10432
  }
10411
10433
  return this.composition.camera.getOptions();
10412
10434
  };
@@ -10414,7 +10436,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
10414
10436
  if (this.getCurrentType() === arg.type) {
10415
10437
  var item = this.getItem();
10416
10438
  if (item === undefined) {
10417
- console.warn("can't find camera item");
10439
+ console.warn("[CameraGestureHandlerImp] Can't find camera item.");
10418
10440
  return this.composition.camera.getOptions();
10419
10441
  }
10420
10442
  var _arg_speed;
@@ -10468,10 +10490,10 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
10468
10490
  item.transform.setQuaternion(newRotation1.x, newRotation1.y, newRotation1.z, newRotation1.w);
10469
10491
  this.setTransform(item, newPosition, item.transform.rotation);
10470
10492
  } else {
10471
- console.warn("not implement");
10493
+ console.warn("[CameraGestureHandlerImp] Movement type not implemented.");
10472
10494
  }
10473
10495
  } else {
10474
- console.warn("invalid move type");
10496
+ console.warn("[CameraGestureHandlerImp] Invalid move type specified: " + arg.type);
10475
10497
  }
10476
10498
  return this.composition.camera.getOptions();
10477
10499
  };
@@ -10503,7 +10525,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
10503
10525
  this.startParams.target = "";
10504
10526
  };
10505
10527
  _proto.updateCameraTransform = function updateCameraTransform(cameraOptions) {
10506
- var effectsTransfrom = new effects.Transform(cameraOptions);
10528
+ var effectsTransfrom = new EFFECTS.Transform(cameraOptions);
10507
10529
  effectsTransfrom.setValid(true);
10508
10530
  this.cameraTransform.fromEffectsTransform(effectsTransfrom);
10509
10531
  this.cameraCoordiante.fromPTransform(this.cameraTransform);
@@ -10523,7 +10545,7 @@ var LoaderHelper = /*#__PURE__*/ function() {
10523
10545
  };
10524
10546
  };
10525
10547
  LoaderHelper.getEffectsTransformFromMat4 = function getEffectsTransformFromMat4(mat) {
10526
- var transform = new effects.Transform({
10548
+ var transform = new EFFECTS.Transform({
10527
10549
  valid: true
10528
10550
  });
10529
10551
  transform.cloneFromMatrix(mat);
@@ -10740,7 +10762,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
10740
10762
  var nodeList = scene.nodes.map(function(node, nodeIndex) {
10741
10763
  var children = node.children.map(function(child) {
10742
10764
  if (child.nodeIndex === undefined) {
10743
- throw new Error("Undefined nodeIndex for child " + child);
10765
+ throw new Error("Undefined nodeIndex for child " + child + ".");
10744
10766
  }
10745
10767
  return child.nodeIndex;
10746
10768
  });
@@ -10749,7 +10771,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
10749
10771
  var scale;
10750
10772
  if (node.matrix !== undefined) {
10751
10773
  if (node.matrix.length !== 16) {
10752
- throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node);
10774
+ throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node + ".");
10753
10775
  }
10754
10776
  var mat = Matrix4.fromArray(node.matrix);
10755
10777
  var transform = mat.getTransform();
@@ -10782,7 +10804,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
10782
10804
  });
10783
10805
  var rootNodes = scene.rootNodes.map(function(root) {
10784
10806
  if (root.nodeIndex === undefined) {
10785
- throw new Error("Undefined nodeIndex for root " + root);
10807
+ throw new Error("Undefined nodeIndex for root " + root + ".");
10786
10808
  }
10787
10809
  return root.nodeIndex;
10788
10810
  });
@@ -10827,18 +10849,18 @@ var LoaderImpl = /*#__PURE__*/ function() {
10827
10849
  _proto.createTextureCube = function createTextureCube(cubeImages, level0Size) {
10828
10850
  var _this = this;
10829
10851
  if (cubeImages.length == 0) {
10830
- throw new Error("createTextureCube: Invalid cubeImages length " + cubeImages);
10852
+ throw new Error("createTextureCube: Invalid cubeImages length " + cubeImages + ".");
10831
10853
  }
10832
10854
  var mipmaps = [];
10833
10855
  cubeImages.forEach(function(cubeImage) {
10834
10856
  if (cubeImage.length != 6) {
10835
- throw new Error("createTextureCube: cubeimage count should always be 6, " + cubeImage);
10857
+ throw new Error("createTextureCube: cubeimage count should always be 6, " + cubeImage + ".");
10836
10858
  }
10837
10859
  //
10838
10860
  var imgList = [];
10839
10861
  cubeImage.forEach(function(img) {
10840
10862
  if (img.imageData === undefined) {
10841
- throw new Error("createTextureCube: Invalid image data from " + img);
10863
+ throw new Error("createTextureCube: Invalid image data from " + img + ".");
10842
10864
  }
10843
10865
  //
10844
10866
  imgList.push({
@@ -10889,9 +10911,9 @@ var LoaderImpl = /*#__PURE__*/ function() {
10889
10911
  }
10890
10912
  return newImages;
10891
10913
  });
10892
- var specularMipCount = specularImages.length - 1;
10914
+ var specularMipCount = specularImages.length;
10893
10915
  var _ibl_specularImageSize;
10894
- var specularImageSize = (_ibl_specularImageSize = ibl.specularImageSize) != null ? _ibl_specularImageSize : Math.pow(2, specularMipCount);
10916
+ var specularImageSize = (_ibl_specularImageSize = ibl.specularImageSize) != null ? _ibl_specularImageSize : Math.pow(2, specularMipCount - 1);
10895
10917
  var params = {
10896
10918
  type: "buffer",
10897
10919
  renderable: this.isSkyboxVis(),
@@ -10906,7 +10928,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
10906
10928
  };
10907
10929
  _proto.createDefaultSkybox = function createDefaultSkybox(typeName) {
10908
10930
  if (typeName !== "NFT" && typeName !== "FARM") {
10909
- throw new Error("Invalid skybox type name " + typeName);
10931
+ throw new Error("Invalid skybox type specified: '" + typeName + "'. Valid types are: 'NFT', 'FARM'.");
10910
10932
  }
10911
10933
  //
10912
10934
  var typ = typeName === "NFT" ? exports.PSkyboxType.NFT : exports.PSkyboxType.FARM;
@@ -10937,7 +10959,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
10937
10959
  };
10938
10960
  gltfResource = options.gltf.resource;
10939
10961
  if (typeof gltfResource === "string" || _instanceof1(gltfResource, Uint8Array)) {
10940
- throw new Error("Please load resource by GLTFTools at first");
10962
+ throw new Error("Please load the resource using GLTFTools first.");
10941
10963
  }
10942
10964
  _this._gltfScene = gltfResource.scenes[0];
10943
10965
  _this._gltfSkins = _this._gltfScene.skins;
@@ -10985,7 +11007,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
10985
11007
  });
10986
11008
  sceneAABB = new Box3();
10987
11009
  _this._gltfScene.rootNodes.forEach(function(root) {
10988
- var parentTransform = new effects.Transform({
11010
+ var parentTransform = new EFFECTS.Transform({
10989
11011
  valid: true
10990
11012
  });
10991
11013
  _this._computeSceneAABB(root, parentTransform, sceneAABB);
@@ -11148,7 +11170,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
11148
11170
  var texIndex = texInfo.index;
11149
11171
  var tex = this.getTextureManager().getTexture(matIndex, texIndex, isBaseColor);
11150
11172
  if (tex === undefined && noWarning !== true) {
11151
- console.warn("Can't find texture for mat " + matIndex + ", tex " + JSON.stringify(texInfo) + ", basecolor " + isBaseColor);
11173
+ console.warn("Can't find texture for mat " + matIndex + ", tex " + JSON.stringify(texInfo) + ", basecolor " + isBaseColor + ".");
11152
11174
  }
11153
11175
  return tex;
11154
11176
  };
@@ -11167,7 +11189,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
11167
11189
  name: scene.name,
11168
11190
  duration: this.getItemDuration(),
11169
11191
  endBehavior: this.getItemEndBehavior(),
11170
- type: effects.spec.ItemType.tree,
11192
+ type: EFFECTS.spec.ItemType.tree,
11171
11193
  content: {
11172
11194
  options: {
11173
11195
  tree: treeOptions
@@ -11180,7 +11202,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
11180
11202
  var _this = this;
11181
11203
  var meshIndex = node.mesh;
11182
11204
  if (meshIndex === undefined) {
11183
- throw new Error("Invalid mesh index in node " + node);
11205
+ throw new Error("Invalid mesh index in node " + node + ".");
11184
11206
  }
11185
11207
  var skin;
11186
11208
  if (node.skin !== undefined) {
@@ -11199,7 +11221,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
11199
11221
  var geometry = _this.createGeometry(prim, skin !== undefined);
11200
11222
  var material = _this.createMaterial(mat);
11201
11223
  material.baseColorTexture = _this.getTexture2D(matIndex, mat.baseColorTexture, true);
11202
- if (material.type === effects.spec.MaterialType.pbr) {
11224
+ if (material.type === EFFECTS.spec.MaterialType.pbr) {
11203
11225
  material.metallicRoughnessTexture = _this.getTexture2D(matIndex, mat.metallicRoughnessTexture, false);
11204
11226
  material.normalTexture = _this.getTexture2D(matIndex, mat.normalTexture, false);
11205
11227
  material.emissiveTexture = _this.getTexture2D(matIndex, mat.emissiveTexture, false);
@@ -11221,8 +11243,8 @@ var LoaderImpl = /*#__PURE__*/ function() {
11221
11243
  var boxSize = aabb.getSize(new Vector3());
11222
11244
  var boxCenter = aabb.getCenter(new Vector3());
11223
11245
  var interaction = {
11224
- behavior: effects.spec.InteractBehavior.NOTIFY,
11225
- type: effects.spec.ModelBoundingType.box,
11246
+ behavior: EFFECTS.spec.InteractBehavior.NOTIFY,
11247
+ type: EFFECTS.spec.ModelBoundingType.box,
11226
11248
  size: [
11227
11249
  boxSize.x,
11228
11250
  boxSize.y,
@@ -11241,7 +11263,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
11241
11263
  name: mesh.name,
11242
11264
  duration: this.getItemDuration(),
11243
11265
  endBehavior: this.getItemEndBehavior(),
11244
- type: effects.spec.ItemType.mesh,
11266
+ type: EFFECTS.spec.ItemType.mesh,
11245
11267
  pluginName: "model",
11246
11268
  content: {
11247
11269
  options: meshOptions,
@@ -11264,7 +11286,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
11264
11286
  name: (_light_name = light.name) != null ? _light_name : "light",
11265
11287
  duration: this.getItemDuration(),
11266
11288
  endBehavior: this.getItemEndBehavior(),
11267
- type: effects.spec.ItemType.light,
11289
+ type: EFFECTS.spec.ItemType.light,
11268
11290
  pluginName: "model",
11269
11291
  content: {
11270
11292
  options: lightOptions
@@ -11306,7 +11328,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
11306
11328
  name: "skybox",
11307
11329
  duration: this.getItemDuration(),
11308
11330
  endBehavior: this.getItemEndBehavior(),
11309
- type: effects.spec.ItemType.skybox,
11331
+ type: EFFECTS.spec.ItemType.skybox,
11310
11332
  pluginName: "model",
11311
11333
  content: {
11312
11334
  options: this._skyboxOptions
@@ -11333,7 +11355,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
11333
11355
  transformData.scale = node.scale;
11334
11356
  }
11335
11357
  }
11336
- var nodeTransform = new effects.Transform(transformData, parentTransform);
11358
+ var nodeTransform = new EFFECTS.Transform(transformData, parentTransform);
11337
11359
  nodeTransform.setValid(true);
11338
11360
  //
11339
11361
  if (node.mesh !== undefined) {
@@ -11424,7 +11446,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
11424
11446
  };
11425
11447
  _proto.getItemEndBehavior = function getItemEndBehavior() {
11426
11448
  var _this__sceneOptions_effects_endBehavior;
11427
- return (_this__sceneOptions_effects_endBehavior = this._sceneOptions.effects.endBehavior) != null ? _this__sceneOptions_effects_endBehavior : effects.spec.ItemEndBehavior.loop;
11449
+ return (_this__sceneOptions_effects_endBehavior = this._sceneOptions.effects.endBehavior) != null ? _this__sceneOptions_effects_endBehavior : EFFECTS.spec.ItemEndBehavior.loop;
11428
11450
  };
11429
11451
  _proto.getSkyboxType = function getSkyboxType() {
11430
11452
  var typeName = this._sceneOptions.gltf.skyboxType;
@@ -11467,11 +11489,11 @@ var TextureManager = /*#__PURE__*/ function() {
11467
11489
  this._textureMap.clear();
11468
11490
  };
11469
11491
  _proto.addTexture = function addTexture(matIndex, texIndex, tex, isBaseColor) {
11470
- var index = isBaseColor ? matIndex * 100000 + texIndex : texIndex;
11492
+ var index = isBaseColor ? (matIndex + 1) * 100000 + texIndex : texIndex;
11471
11493
  this._textureMap.set(index, tex);
11472
11494
  };
11473
11495
  _proto.getTexture = function getTexture(matIndex, texIndex, isBaseColor) {
11474
- var index = isBaseColor ? matIndex * 100000 + texIndex : texIndex;
11496
+ var index = isBaseColor ? (matIndex + 1) * 100000 + texIndex : texIndex;
11475
11497
  return this._textureMap.get(index);
11476
11498
  };
11477
11499
  return TextureManager;
@@ -11516,7 +11538,7 @@ var GeometryProxy = /*#__PURE__*/ function() {
11516
11538
  var attrib = this.positionAttrib;
11517
11539
  attributes["aPos"] = this._getBufferAttrib(attrib);
11518
11540
  } else {
11519
- throw new Error("Position attribute missing");
11541
+ throw new Error("Position attribute missing.");
11520
11542
  }
11521
11543
  if (this.hasNormal) {
11522
11544
  var attrib1 = this.normalAttrib;
@@ -11563,21 +11585,21 @@ var GeometryProxy = /*#__PURE__*/ function() {
11563
11585
  }
11564
11586
  var indexArray = this.indexArray;
11565
11587
  if (indexArray !== undefined) {
11566
- return effects.Geometry.create(this.engine, {
11588
+ return EFFECTS.Geometry.create(this.engine, {
11567
11589
  attributes: attributes,
11568
11590
  indices: {
11569
11591
  data: indexArray
11570
11592
  },
11571
11593
  drawStart: 0,
11572
11594
  drawCount: indexArray.length,
11573
- mode: effects.glContext.TRIANGLES
11595
+ mode: EFFECTS.glContext.TRIANGLES
11574
11596
  });
11575
11597
  } else {
11576
- return effects.Geometry.create(this.engine, {
11598
+ return EFFECTS.Geometry.create(this.engine, {
11577
11599
  attributes: attributes,
11578
11600
  drawStart: 0,
11579
11601
  drawCount: this.positionAttrib.array.length / 3,
11580
- mode: effects.glContext.TRIANGLES
11602
+ mode: EFFECTS.glContext.TRIANGLES
11581
11603
  });
11582
11604
  }
11583
11605
  }
@@ -11747,19 +11769,19 @@ var MaterialProxy = /*#__PURE__*/ function() {
11747
11769
  get: function get() {
11748
11770
  var mat = this.gltfMaterial;
11749
11771
  var isUnlit = GLTFHelper.isUnlitMaterial(mat);
11750
- var blending = effects.spec.MaterialBlending.opaque;
11772
+ var blending = EFFECTS.spec.MaterialBlending.opaque;
11751
11773
  switch(mat.alphaMode){
11752
11774
  case "OPAQUE":
11753
- blending = effects.spec.MaterialBlending.opaque;
11775
+ blending = EFFECTS.spec.MaterialBlending.opaque;
11754
11776
  break;
11755
11777
  case "MASK":
11756
- blending = effects.spec.MaterialBlending.masked;
11778
+ blending = EFFECTS.spec.MaterialBlending.masked;
11757
11779
  break;
11758
11780
  case "BLEND":
11759
- blending = effects.spec.MaterialBlending.translucent;
11781
+ blending = EFFECTS.spec.MaterialBlending.translucent;
11760
11782
  break;
11761
11783
  }
11762
- var side = mat.doubleSided ? effects.spec.SideMode.DOUBLE : effects.spec.SideMode.FRONT;
11784
+ var side = mat.doubleSided ? EFFECTS.spec.SideMode.DOUBLE : EFFECTS.spec.SideMode.FRONT;
11763
11785
  var enableShadow = false;
11764
11786
  var _mat_alphaCutOff;
11765
11787
  var alphaCutOff = (_mat_alphaCutOff = mat.alphaCutOff) != null ? _mat_alphaCutOff : 0.5;
@@ -11768,7 +11790,7 @@ var MaterialProxy = /*#__PURE__*/ function() {
11768
11790
  var _mat_extras;
11769
11791
  return {
11770
11792
  name: name,
11771
- type: effects.spec.MaterialType.unlit,
11793
+ type: EFFECTS.spec.MaterialType.unlit,
11772
11794
  baseColorTexture: this.baseColorTextureObj,
11773
11795
  baseColorTextureCoordinate: this.baseColorTextureCoord,
11774
11796
  baseColorTextureTransform: this.baseColorTextureTransfrom,
@@ -11783,7 +11805,7 @@ var MaterialProxy = /*#__PURE__*/ function() {
11783
11805
  var _mat_extras1;
11784
11806
  return {
11785
11807
  name: name,
11786
- type: effects.spec.MaterialType.pbr,
11808
+ type: EFFECTS.spec.MaterialType.pbr,
11787
11809
  baseColorTexture: this.baseColorTextureObj,
11788
11810
  baseColorTextureCoordinate: this.baseColorTextureCoord,
11789
11811
  baseColorTextureTransform: this.baseColorTextureTransfrom,
@@ -12013,7 +12035,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12013
12035
  this.treeInfo = new TreeInfo();
12014
12036
  this.engine = player.renderer.engine;
12015
12037
  this.renderer = player.renderer;
12016
- this.downloader = new effects.Downloader();
12038
+ this.downloader = new EFFECTS.Downloader();
12017
12039
  }
12018
12040
  var _proto = JSONConverter.prototype;
12019
12041
  _proto.processScene = function processScene(sceneData) {
@@ -12023,7 +12045,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12023
12045
  return __generator(this, function(_state) {
12024
12046
  switch(_state.label){
12025
12047
  case 0:
12026
- if (!effects.isObject(sceneData)) return [
12048
+ if (!EFFECTS.isObject(sceneData)) return [
12027
12049
  3,
12028
12050
  1
12029
12051
  ];
@@ -12048,7 +12070,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12048
12070
  tex.source = 0;
12049
12071
  }
12050
12072
  });
12051
- oldScene = effects.getStandardJSON(sceneJSON);
12073
+ oldScene = EFFECTS.getStandardJSON(sceneJSON);
12052
12074
  binFiles = [];
12053
12075
  if (!oldScene.bins) return [
12054
12076
  3,
@@ -12160,7 +12182,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12160
12182
  loadedMipmaps = _state.sent();
12161
12183
  newMipmaps = loadedMipmaps.map(function(mipmaps) {
12162
12184
  return mipmaps.map(function(img) {
12163
- var id = effects.generateGUID();
12185
+ var id = EFFECTS.generateGUID();
12164
12186
  var sceneImage = {
12165
12187
  url: img,
12166
12188
  id: id
@@ -12178,7 +12200,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12178
12200
  mipmaps: newMipmaps,
12179
12201
  sourceFrom: {
12180
12202
  target: target,
12181
- type: effects.TextureSourceType.mipmaps,
12203
+ type: EFFECTS.TextureSourceType.mipmaps,
12182
12204
  mipmaps: mipmaps.map(function(mipmap) {
12183
12205
  return mipmap.map(function(pointer) {
12184
12206
  return [
@@ -12224,26 +12246,26 @@ var JSONConverter = /*#__PURE__*/ function() {
12224
12246
  var newComponents = newScene.components;
12225
12247
  for(var _iterator = _create_for_of_iterator_helper_loose(oldScene.components), _step; !(_step = _iterator()).done;){
12226
12248
  var comp = _step.value;
12227
- if (comp.dataType === effects.spec.DataType.SkyboxComponent) {
12249
+ if (comp.dataType === EFFECTS.spec.DataType.SkyboxComponent) {
12228
12250
  newComponents.push(this.createSkyboxComponent(comp, newScene));
12229
- } else if (comp.dataType === effects.spec.DataType.LightComponent) {
12251
+ } else if (comp.dataType === EFFECTS.spec.DataType.LightComponent) {
12230
12252
  newComponents.push(this.createLightComponent(comp, newScene));
12231
- } else if (comp.dataType === effects.spec.DataType.CameraComponent) {
12253
+ } else if (comp.dataType === EFFECTS.spec.DataType.CameraComponent) {
12232
12254
  newComponents.push(comp);
12233
- console.warn("Find camera component", comp);
12234
- } else if (comp.dataType === effects.spec.DataType.TreeComponent) {
12255
+ console.warn("Camera component found: " + comp + ".");
12256
+ } else if (comp.dataType === EFFECTS.spec.DataType.TreeComponent) {
12235
12257
  var treeComp = comp;
12236
12258
  this.createItemsFromTreeComponent(comp, newScene, oldScene);
12237
12259
  treeComp.options.tree.animation = undefined;
12238
12260
  treeComp.options.tree.animations = undefined;
12239
12261
  newComponents.push(comp);
12240
- } else if (comp.dataType !== effects.spec.DataType.MeshComponent) {
12262
+ } else if (comp.dataType !== EFFECTS.spec.DataType.MeshComponent) {
12241
12263
  newComponents.push(comp);
12242
12264
  }
12243
12265
  }
12244
12266
  for(var _iterator1 = _create_for_of_iterator_helper_loose(oldScene.components), _step1; !(_step1 = _iterator1()).done;){
12245
12267
  var comp1 = _step1.value;
12246
- if (comp1.dataType === effects.spec.DataType.MeshComponent) {
12268
+ if (comp1.dataType === EFFECTS.spec.DataType.MeshComponent) {
12247
12269
  newComponents.push(this.createMeshComponent(comp1, newScene, oldScene));
12248
12270
  }
12249
12271
  }
@@ -12274,7 +12296,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12274
12296
  2,
12275
12297
  new Promise(function(resolve, reject) {
12276
12298
  _this.downloader.downloadJSON(url, resolve, function(status, responseText) {
12277
- reject(new Error("Couldn't load JSON " + JSON.stringify(url) + ": status " + status + ", " + responseText));
12299
+ reject(new Error("Failed to load JSON from URL '" + url + "': status " + status + " - " + responseText + ". Please check the URL or network settings."));
12278
12300
  });
12279
12301
  })
12280
12302
  ];
@@ -12303,7 +12325,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12303
12325
  _pointer_ = pointer[1], index = _pointer_[0], start = _pointer_[1], length = _pointer_[2];
12304
12326
  bin = bins[index];
12305
12327
  if (!bin) {
12306
- throw new Error("invalid bin pointer: " + JSON.stringify(pointer));
12328
+ throw new Error("Invalid bin pointer: " + JSON.stringify(pointer) + ".");
12307
12329
  }
12308
12330
  return [
12309
12331
  2,
@@ -12345,7 +12367,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12345
12367
  id: scene.textures[skyboxOptions.specularImage].id
12346
12368
  },
12347
12369
  specularImageSize: skyboxOptions.specularImageSize,
12348
- specularMipCount: skyboxOptions.specularMipCount
12370
+ specularMipCount: skyboxOptions.specularMipCount + 1
12349
12371
  };
12350
12372
  return skyboxComponent;
12351
12373
  };
@@ -12372,7 +12394,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12372
12394
  });
12373
12395
  var geometryData = getGeometryDataFromPropsList(geometryPropsList);
12374
12396
  if (!geometryData) {
12375
- throw new Error("no primitives");
12397
+ throw new Error("No primitives available to process.");
12376
12398
  }
12377
12399
  newScene.geometries.push(geometryData);
12378
12400
  (_newScene_materials = newScene.materials).push.apply(_newScene_materials, [].concat(materialDatas));
@@ -12399,12 +12421,12 @@ var JSONConverter = /*#__PURE__*/ function() {
12399
12421
  }
12400
12422
  }
12401
12423
  if (parentItemId === component.item.id) {
12402
- throw new Error("Can't item " + component.item);
12424
+ throw new Error("Can't item " + component.item + ".");
12403
12425
  }
12404
12426
  var treeItem = this.treeInfo.getTreeItemByNodeId(parentItemId);
12405
12427
  var treeNodeList = this.treeInfo.getTreeNodeListByNodeId(parentItemId);
12406
12428
  if (!treeItem || !treeNodeList) {
12407
- throw new Error("Can't find tree node list for " + component.item);
12429
+ throw new Error("Failed to retrieve tree node list for item with ID " + component.item.id + ". Ensure the item exists and has a valid tree structure.");
12408
12430
  }
12409
12431
  var rootBoneItem = this.setupBoneData(geometryData, meshOptions.skin, oldScene, treeItem, treeNodeList);
12410
12432
  meshComponent.rootBone = {
@@ -12432,13 +12454,13 @@ var JSONConverter = /*#__PURE__*/ function() {
12432
12454
  treeData.nodes.forEach(function(node, index) {
12433
12455
  var _node_name;
12434
12456
  var item = {
12435
- id: effects.generateGUID(),
12457
+ id: EFFECTS.generateGUID(),
12436
12458
  parentId: treeItem.id,
12437
12459
  name: (_node_name = node.name) != null ? _node_name : "node" + index,
12438
12460
  duration: treeItem.duration,
12439
12461
  // @ts-expect-error
12440
12462
  type: "ECS",
12441
- dataType: effects.spec.DataType.VFXItemData,
12463
+ dataType: EFFECTS.spec.DataType.VFXItemData,
12442
12464
  visible: treeItem.visible,
12443
12465
  endBehavior: treeItem.endBehavior,
12444
12466
  delay: treeItem.delay,
@@ -12503,8 +12525,8 @@ var JSONConverter = /*#__PURE__*/ function() {
12503
12525
  var _this = this;
12504
12526
  var animation = treeOptions.animation, animations = treeOptions.animations;
12505
12527
  var animationComponent = {
12506
- id: effects.generateGUID(),
12507
- dataType: effects.spec.DataType.AnimationComponent,
12528
+ id: EFFECTS.generateGUID(),
12529
+ dataType: EFFECTS.spec.DataType.AnimationComponent,
12508
12530
  item: {
12509
12531
  id: treeItem.id
12510
12532
  },
@@ -12516,9 +12538,9 @@ var JSONConverter = /*#__PURE__*/ function() {
12516
12538
  var bins = oldScene.bins;
12517
12539
  animations.forEach(function(anim) {
12518
12540
  var clipData = {
12519
- id: effects.generateGUID(),
12541
+ id: EFFECTS.generateGUID(),
12520
12542
  name: anim.name,
12521
- dataType: effects.spec.DataType.AnimationClip,
12543
+ dataType: EFFECTS.spec.DataType.AnimationClip,
12522
12544
  positionCurves: [],
12523
12545
  rotationCurves: [],
12524
12546
  scaleCurves: [],
@@ -12533,13 +12555,13 @@ var JSONConverter = /*#__PURE__*/ function() {
12533
12555
  var inputArray = typedArrayFromBinary(bins, track.input);
12534
12556
  var outputArray = typedArrayFromBinary(bins, track.output);
12535
12557
  if (!_instanceof1(inputArray, Float32Array)) {
12536
- throw new Error("Type of inputArray should be float32, " + inputArray);
12558
+ throw new Error("Type of inputArray should be float32, " + inputArray + ".");
12537
12559
  }
12538
12560
  if (!_instanceof1(outputArray, Float32Array)) {
12539
- throw new Error("Type of outputArray should be float32, " + outputArray);
12561
+ throw new Error("Type of outputArray should be float32, " + outputArray + ".");
12540
12562
  }
12541
12563
  if (track.interpolation !== "LINEAR") {
12542
- throw new Error("Invalid interpolation type " + track.interpolation);
12564
+ throw new Error("Invalid interpolation type " + track.interpolation + ".");
12543
12565
  }
12544
12566
  if (track.path === "rotation") {
12545
12567
  var points = [];
@@ -12563,7 +12585,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12563
12585
  controlPoints.push(p2.toArray());
12564
12586
  }
12565
12587
  lineValue.push([
12566
- effects.spec.BezierKeyframeType.LINE,
12588
+ EFFECTS.spec.BezierKeyframeType.LINE,
12567
12589
  [
12568
12590
  inputArray[i],
12569
12591
  i
@@ -12573,7 +12595,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12573
12595
  var node = _this.treeInfo.getTreeNode(treeItem.id, track.node);
12574
12596
  var path = _this.treeInfo.getNodePath(node.id);
12575
12597
  var keyFrames = [
12576
- effects.spec.ValueType.BEZIER_CURVE_QUAT,
12598
+ EFFECTS.spec.ValueType.BEZIER_CURVE_QUAT,
12577
12599
  [
12578
12600
  lineValue,
12579
12601
  points,
@@ -12601,7 +12623,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12601
12623
  var lineValue1 = [];
12602
12624
  for(var i2 = 0; i2 < inputArray.length; i2++){
12603
12625
  lineValue1.push([
12604
- effects.spec.BezierKeyframeType.LINE,
12626
+ EFFECTS.spec.BezierKeyframeType.LINE,
12605
12627
  [
12606
12628
  inputArray[i2],
12607
12629
  outputArray[i2 * component + c]
@@ -12609,7 +12631,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12609
12631
  ]);
12610
12632
  }
12611
12633
  var keyFrames1 = [
12612
- effects.spec.ValueType.BEZIER_CURVE,
12634
+ EFFECTS.spec.ValueType.BEZIER_CURVE,
12613
12635
  lineValue1
12614
12636
  ];
12615
12637
  clipData.floatCurves.push({
@@ -12638,7 +12660,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12638
12660
  controlPoints1.push(p21.toArray());
12639
12661
  }
12640
12662
  lineValue2.push([
12641
- effects.spec.BezierKeyframeType.LINE,
12663
+ EFFECTS.spec.BezierKeyframeType.LINE,
12642
12664
  [
12643
12665
  inputArray[i3],
12644
12666
  i3
@@ -12648,7 +12670,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12648
12670
  var node2 = _this.treeInfo.getTreeNode(treeItem.id, track.node);
12649
12671
  var path2 = _this.treeInfo.getNodePath(node2.id);
12650
12672
  var keyFrames2 = [
12651
- effects.spec.ValueType.BEZIER_CURVE_PATH,
12673
+ EFFECTS.spec.ValueType.BEZIER_CURVE_PATH,
12652
12674
  [
12653
12675
  lineValue2,
12654
12676
  points1,
@@ -12680,7 +12702,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12680
12702
  newScene.components.push(animationComponent);
12681
12703
  };
12682
12704
  _proto.getMaterialData = function getMaterialData(material, scene) {
12683
- if (material.type === effects.spec.MaterialType.unlit) {
12705
+ if (material.type === EFFECTS.spec.MaterialType.unlit) {
12684
12706
  var floats = {};
12685
12707
  if (material.alphaCutOff !== undefined) {
12686
12708
  floats["_AlphaCutoff"] = material.alphaCutOff;
@@ -12693,9 +12715,9 @@ var JSONConverter = /*#__PURE__*/ function() {
12693
12715
  textures["_BaseColorSampler"] = this.getTextureData(scene, floats, material.baseColorTexture, material.baseColorTextureTransform);
12694
12716
  }
12695
12717
  var newMaterial = {
12696
- id: effects.generateGUID(),
12718
+ id: EFFECTS.generateGUID(),
12697
12719
  name: material.name,
12698
- dataType: effects.spec.DataType.Material,
12720
+ dataType: EFFECTS.spec.DataType.Material,
12699
12721
  shader: {
12700
12722
  id: UnlitShaderGUID
12701
12723
  },
@@ -12750,9 +12772,9 @@ var JSONConverter = /*#__PURE__*/ function() {
12750
12772
  textures1["_EmissiveSampler"] = this.getTextureData(scene, floats1, material.emissiveTexture, material.emissiveTextureTransform);
12751
12773
  }
12752
12774
  var newMaterial1 = {
12753
- id: effects.generateGUID(),
12775
+ id: EFFECTS.generateGUID(),
12754
12776
  name: material.name,
12755
- dataType: effects.spec.DataType.Material,
12777
+ dataType: EFFECTS.spec.DataType.Material,
12756
12778
  shader: {
12757
12779
  id: PBRShaderGUID
12758
12780
  },
@@ -12769,34 +12791,33 @@ var JSONConverter = /*#__PURE__*/ function() {
12769
12791
  }
12770
12792
  };
12771
12793
  _proto.setupMaterial = function setupMaterial(oldMat, newMat) {
12772
- if (oldMat.blending === effects.spec.MaterialBlending.translucent) {
12773
- newMat.stringTags["RenderType"] = effects.spec.RenderType.Transparent;
12794
+ if (oldMat.blending === EFFECTS.spec.MaterialBlending.translucent) {
12795
+ newMat.stringTags["RenderType"] = EFFECTS.spec.RenderType.Transparent;
12774
12796
  } else {
12775
- newMat.stringTags["RenderType"] = effects.spec.RenderType.Opaque;
12797
+ newMat.stringTags["RenderType"] = EFFECTS.spec.RenderType.Opaque;
12776
12798
  }
12777
- if (oldMat.blending === effects.spec.MaterialBlending.masked) {
12799
+ if (oldMat.blending === EFFECTS.spec.MaterialBlending.masked) {
12778
12800
  newMat.floats["AlphaClip"] = 1;
12779
12801
  var _oldMat_alphaCutOff;
12780
- newMat.floats["_Cutoff"] = (_oldMat_alphaCutOff = oldMat.alphaCutOff) != null ? _oldMat_alphaCutOff : 0;
12802
+ newMat.floats["_AlphaCutoff"] = (_oldMat_alphaCutOff = oldMat.alphaCutOff) != null ? _oldMat_alphaCutOff : 0;
12781
12803
  } else {
12782
12804
  newMat.floats["AlphaClip"] = 0;
12783
12805
  }
12784
12806
  switch(oldMat.side){
12785
- case effects.spec.SideMode.BACK:
12786
- newMat.stringTags["RenderFace"] = effects.spec.RenderFace.Back;
12807
+ case EFFECTS.spec.SideMode.BACK:
12808
+ newMat.stringTags["RenderFace"] = EFFECTS.spec.RenderFace.Back;
12787
12809
  break;
12788
- case effects.spec.SideMode.DOUBLE:
12789
- newMat.stringTags["RenderFace"] = effects.spec.RenderFace.Both;
12810
+ case EFFECTS.spec.SideMode.DOUBLE:
12811
+ newMat.stringTags["RenderFace"] = EFFECTS.spec.RenderFace.Both;
12790
12812
  break;
12791
12813
  default:
12792
- newMat.stringTags["RenderFace"] = effects.spec.RenderFace.Front;
12814
+ newMat.stringTags["RenderFace"] = EFFECTS.spec.RenderFace.Front;
12793
12815
  }
12794
- if (oldMat.type === effects.spec.MaterialType.pbr) {
12816
+ if (oldMat.type === EFFECTS.spec.MaterialType.pbr) {
12795
12817
  newMat.floats["_SpecularAA"] = oldMat.useSpecularAA ? 1 : 0;
12796
12818
  }
12797
- var _oldMat_depthMask;
12798
- newMat.stringTags["ZWrite"] = String((_oldMat_depthMask = oldMat.depthMask) != null ? _oldMat_depthMask : true);
12799
- newMat.stringTags["ZTest"] = String(true);
12819
+ newMat.floats["ZWrite"] = oldMat.depthMask !== false ? 1 : 0;
12820
+ newMat.floats["ZTest"] = 1;
12800
12821
  };
12801
12822
  _proto.getTextureData = function getTextureData(scene, floats, texIndex, texTransform) {
12802
12823
  var _scene_textures_texIndex_id;
@@ -12875,7 +12896,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12875
12896
  var bins = oldScene.bins;
12876
12897
  var joints = skin.joints, skeleton = skin.skeleton, inverseBindMatrices = skin.inverseBindMatrices;
12877
12898
  if (!inverseBindMatrices) {
12878
- throw new Error("inverseBindMatrices is undefined " + skin);
12899
+ throw new Error("'inverseBindMatrices' is undefined for the skin configuration: " + JSON.stringify(skin) + ". Ensure 'inverseBindMatrices' is properly defined in your skin data.");
12879
12900
  }
12880
12901
  var bindMatrixArray = typedArrayFromBinary(bins, inverseBindMatrices);
12881
12902
  geom.inverseBindMatrices = Array.from(bindMatrixArray);
@@ -12884,12 +12905,12 @@ var JSONConverter = /*#__PURE__*/ function() {
12884
12905
  if (skeleton !== undefined) {
12885
12906
  rootBoneItem = treeNodeList[skeleton];
12886
12907
  } else {
12887
- console.warn("Root bone is missing");
12908
+ console.warn("Root bone is missing for the skeleton. Defaulting to the primary tree item as the root bone.");
12888
12909
  }
12889
12910
  joints.forEach(function(joint) {
12890
12911
  var node = treeNodeList[joint];
12891
12912
  if (node !== rootBoneItem && node.parentId === rootBoneItem.parentId) {
12892
- console.error("Find invalid node for rootBoneItem and adjust rootBoneItem");
12913
+ console.error("Invalid node detected for 'rootBoneItem'. Adjusting 'rootBoneItem' to the primary tree item. Please verify the tree structure.");
12893
12914
  rootBoneItem = treeItem;
12894
12915
  }
12895
12916
  });
@@ -12927,12 +12948,12 @@ var TreeInfo = /*#__PURE__*/ function() {
12927
12948
  _proto.add = function add(treeItem, treeNodeList) {
12928
12949
  var _this = this;
12929
12950
  if (this.tree2NodeList[treeItem.id]) {
12930
- throw new Error("Find duplicate treeItem id: " + treeItem.id);
12951
+ throw new Error("Duplicate treeItem ID detected: " + treeItem.id + ". Ensure each tree item has a unique ID.");
12931
12952
  }
12932
12953
  this.tree2NodeList[treeItem.id] = treeNodeList;
12933
12954
  treeNodeList.forEach(function(node) {
12934
12955
  if (_this.nodeList2Tree[node.id]) {
12935
- throw new Error("Find duplicate tree node id: " + node.id);
12956
+ throw new Error("Duplicate tree node ID found: " + node.id + ". Each node in the tree must have a unique ID.");
12936
12957
  }
12937
12958
  _this.nodeList2Tree[node.id] = treeItem;
12938
12959
  _this.nodeId2Node[node.id] = node;
@@ -12961,7 +12982,7 @@ var TreeInfo = /*#__PURE__*/ function() {
12961
12982
  _proto.getTreeNodeListByNodeId = function getTreeNodeListByNodeId(id) {
12962
12983
  var treeItem = this.nodeList2Tree[id];
12963
12984
  if (!treeItem) {
12964
- throw new Error("Invalid id " + id);
12985
+ throw new Error("Invalid id " + id + ".");
12965
12986
  }
12966
12987
  return this.getTreeNodeListByTreeId(treeItem.id);
12967
12988
  };
@@ -12988,11 +13009,11 @@ var TreeInfo = /*#__PURE__*/ function() {
12988
13009
  }();
12989
13010
  function getGeometryDataFromOptions(geomOptions) {
12990
13011
  var vertexCount = 0;
12991
- var verticesType = effects.spec.VertexFormatType.Float32;
13012
+ var verticesType = EFFECTS.spec.VertexFormatType.Float32;
12992
13013
  var verticesNormalize = false;
12993
- var uvsType = effects.spec.VertexFormatType.Float32;
13014
+ var uvsType = EFFECTS.spec.VertexFormatType.Float32;
12994
13015
  var uvsNormalize = false;
12995
- var normalsType = effects.spec.VertexFormatType.Float32;
13016
+ var normalsType = EFFECTS.spec.VertexFormatType.Float32;
12996
13017
  var normalsNormalize = false;
12997
13018
  var _geomOptions_name;
12998
13019
  var modelData = {
@@ -13012,21 +13033,21 @@ function getGeometryDataFromOptions(geomOptions) {
13012
13033
  var _attribData_normalize;
13013
13034
  verticesNormalize = (_attribData_normalize = attribData.normalize) != null ? _attribData_normalize : false;
13014
13035
  var _attribData_type;
13015
- verticesType = effects.glType2VertexFormatType((_attribData_type = attribData.type) != null ? _attribData_type : effects.glContext.FLOAT);
13036
+ verticesType = EFFECTS.glType2VertexFormatType((_attribData_type = attribData.type) != null ? _attribData_type : EFFECTS.glContext.FLOAT);
13016
13037
  } else if (attrib === "aNormal") {
13017
13038
  // @ts-expect-error
13018
13039
  modelData.normals = attribData.data;
13019
13040
  var _attribData_normalize1;
13020
13041
  normalsNormalize = (_attribData_normalize1 = attribData.normalize) != null ? _attribData_normalize1 : false;
13021
13042
  var _attribData_type1;
13022
- normalsType = effects.glType2VertexFormatType((_attribData_type1 = attribData.type) != null ? _attribData_type1 : effects.glContext.FLOAT);
13043
+ normalsType = EFFECTS.glType2VertexFormatType((_attribData_type1 = attribData.type) != null ? _attribData_type1 : EFFECTS.glContext.FLOAT);
13023
13044
  } else if (attrib === "aUV1") {
13024
13045
  // @ts-expect-error
13025
13046
  modelData.uvs = attribData.data;
13026
13047
  var _attribData_normalize2;
13027
13048
  uvsNormalize = (_attribData_normalize2 = attribData.normalize) != null ? _attribData_normalize2 : false;
13028
13049
  var _attribData_type2;
13029
- uvsType = effects.glType2VertexFormatType((_attribData_type2 = attribData.type) != null ? _attribData_type2 : effects.glContext.FLOAT);
13050
+ uvsType = EFFECTS.glType2VertexFormatType((_attribData_type2 = attribData.type) != null ? _attribData_type2 : EFFECTS.glContext.FLOAT);
13030
13051
  }
13031
13052
  }
13032
13053
  var verticesOffset = getOffset(verticesType, 3, vertexCount);
@@ -13047,32 +13068,32 @@ function getGeometryDataFromOptions(geomOptions) {
13047
13068
  }
13048
13069
  modelData.indices = indices1;
13049
13070
  }
13050
- var indicesType = effects.spec.IndexFormatType.UInt16;
13071
+ var indicesType = EFFECTS.spec.IndexFormatType.UInt16;
13051
13072
  if (modelData.indices.BYTES_PER_ELEMENT === 4) {
13052
- indicesType = effects.spec.IndexFormatType.UInt32;
13073
+ indicesType = EFFECTS.spec.IndexFormatType.UInt32;
13053
13074
  }
13054
13075
  var geometryData = {
13055
- id: effects.generateGUID(),
13056
- dataType: effects.spec.DataType.Geometry,
13076
+ id: EFFECTS.generateGUID(),
13077
+ dataType: EFFECTS.spec.DataType.Geometry,
13057
13078
  vertexData: {
13058
13079
  vertexCount: vertexCount,
13059
13080
  channels: [
13060
13081
  {
13061
- semantic: effects.spec.VertexBufferSemantic.Position,
13082
+ semantic: EFFECTS.spec.VertexBufferSemantic.Position,
13062
13083
  offset: 0,
13063
13084
  format: verticesType,
13064
13085
  dimension: 3,
13065
13086
  normalize: verticesNormalize
13066
13087
  },
13067
13088
  {
13068
- semantic: effects.spec.VertexBufferSemantic.Uv,
13089
+ semantic: EFFECTS.spec.VertexBufferSemantic.Uv,
13069
13090
  offset: verticesOffset,
13070
13091
  format: uvsType,
13071
13092
  dimension: 2,
13072
13093
  normalize: uvsNormalize
13073
13094
  },
13074
13095
  {
13075
- semantic: effects.spec.VertexBufferSemantic.Normal,
13096
+ semantic: EFFECTS.spec.VertexBufferSemantic.Normal,
13076
13097
  offset: verticesOffset + uvsOffset,
13077
13098
  format: normalsType,
13078
13099
  dimension: 3,
@@ -13081,7 +13102,7 @@ function getGeometryDataFromOptions(geomOptions) {
13081
13102
  ]
13082
13103
  },
13083
13104
  subMeshes: [],
13084
- mode: effects.spec.GeometryType.TRIANGLES,
13105
+ mode: EFFECTS.spec.GeometryType.TRIANGLES,
13085
13106
  indexFormat: indicesType,
13086
13107
  indexOffset: verticesOffset + uvsOffset + normalsOffset,
13087
13108
  buffer: encodeVertexData(modelData)
@@ -13147,11 +13168,11 @@ function getGeometryDataFromPropsList(geomPropsList) {
13147
13168
  }
13148
13169
  function getOffset(formatType, dimension, count) {
13149
13170
  switch(formatType){
13150
- case effects.spec.VertexFormatType.Int8:
13151
- case effects.spec.VertexFormatType.UInt8:
13171
+ case EFFECTS.spec.VertexFormatType.Int8:
13172
+ case EFFECTS.spec.VertexFormatType.UInt8:
13152
13173
  return dimension * count;
13153
- case effects.spec.VertexFormatType.Int16:
13154
- case effects.spec.VertexFormatType.UInt16:
13174
+ case EFFECTS.spec.VertexFormatType.Int16:
13175
+ case EFFECTS.spec.VertexFormatType.UInt16:
13155
13176
  return dimension * count * 2;
13156
13177
  default:
13157
13178
  return dimension * count * 4;
@@ -13175,7 +13196,7 @@ function createGeometryData(props, subMeshes) {
13175
13196
  var attribData1 = props.attributes[attrib1];
13176
13197
  var semantic = vertexBufferSemanticMap[attrib1];
13177
13198
  if (!semantic) {
13178
- throw new Error("Invalid attrib " + attrib1);
13199
+ throw new Error("Invalid attrib " + attrib1 + ".");
13179
13200
  }
13180
13201
  // @ts-expect-error
13181
13202
  vertexCount = attribData1.data.length / attribData1.size;
@@ -13183,7 +13204,7 @@ function createGeometryData(props, subMeshes) {
13183
13204
  var vertexChannel = {
13184
13205
  semantic: semantic,
13185
13206
  offset: bufferOffset,
13186
- format: effects.glType2VertexFormatType((_attribData_type = attribData1.type) != null ? _attribData_type : effects.glContext.FLOAT),
13207
+ format: EFFECTS.glType2VertexFormatType((_attribData_type = attribData1.type) != null ? _attribData_type : EFFECTS.glContext.FLOAT),
13187
13208
  dimension: attribData1.size,
13188
13209
  normalize: attribData1.normalize
13189
13210
  };
@@ -13195,16 +13216,16 @@ function createGeometryData(props, subMeshes) {
13195
13216
  bufferOffset += subBuffer.byteLength;
13196
13217
  }
13197
13218
  var geometryData = {
13198
- id: effects.generateGUID(),
13199
- dataType: effects.spec.DataType.Geometry,
13219
+ id: EFFECTS.generateGUID(),
13220
+ dataType: EFFECTS.spec.DataType.Geometry,
13200
13221
  vertexData: {
13201
13222
  vertexCount: vertexCount,
13202
13223
  channels: vertexChannels
13203
13224
  },
13204
13225
  subMeshes: subMeshes,
13205
- mode: effects.spec.GeometryType.TRIANGLES,
13206
- indexFormat: effects.spec.IndexFormatType.UInt16,
13207
- indexOffset: -1,
13226
+ mode: EFFECTS.spec.GeometryType.TRIANGLES,
13227
+ indexFormat: EFFECTS.spec.IndexFormatType.None,
13228
+ indexOffset: 0,
13208
13229
  buffer: ""
13209
13230
  };
13210
13231
  if (props.indices) {
@@ -13213,7 +13234,9 @@ function createGeometryData(props, subMeshes) {
13213
13234
  buffer.set(subBuffer1, bufferOffset);
13214
13235
  geometryData.indexOffset = bufferOffset;
13215
13236
  if (_instanceof1(indices, Uint32Array)) {
13216
- geometryData.indexFormat = effects.spec.IndexFormatType.UInt32;
13237
+ geometryData.indexFormat = EFFECTS.spec.IndexFormatType.UInt32;
13238
+ } else {
13239
+ geometryData.indexFormat = EFFECTS.spec.IndexFormatType.UInt16;
13217
13240
  }
13218
13241
  }
13219
13242
  geometryData.buffer = toBase64String(buffer);
@@ -13368,11 +13391,1051 @@ var vertexBufferSemanticMap = {
13368
13391
  a_Target_Tangent3: "TANGENT_BS3"
13369
13392
  };
13370
13393
 
13371
- effects.registerPlugin("tree", ModelTreePlugin, effects.VFXItem, true);
13372
- effects.registerPlugin("model", ModelPlugin, effects.VFXItem);
13373
- var version = "2.0.0-alpha.17";
13374
- effects.logger.info("plugin model version: " + version);
13375
- if (version !== effects.version) {
13394
+ var LoaderECSImpl = /*#__PURE__*/ function() {
13395
+ function LoaderECSImpl(composition) {
13396
+ this.gltfSkins = [];
13397
+ this.gltfMeshs = [];
13398
+ this.gltfLights = [];
13399
+ this.gltfCameras = [];
13400
+ this.gltfImages = [];
13401
+ this.gltfTextures = [];
13402
+ this.gltfMaterials = [];
13403
+ this.gltfAnimations = [];
13404
+ this.gltfImageBasedLights = [];
13405
+ this.timelineAssetId = "";
13406
+ this.images = [];
13407
+ this.imageElements = [];
13408
+ this.textures = [];
13409
+ this.items = [];
13410
+ this.components = [];
13411
+ this.materials = [];
13412
+ this.shaders = [];
13413
+ this.geometries = [];
13414
+ this.animations = [];
13415
+ if (composition) {
13416
+ this.composition = composition;
13417
+ } else {
13418
+ this.timelineAssetId = EFFECTS.generateGUID();
13419
+ this.composition = {
13420
+ id: "1",
13421
+ name: "test1",
13422
+ duration: 9999,
13423
+ endBehavior: EFFECTS.spec.CompositionEndBehavior.restart,
13424
+ camera: {
13425
+ fov: 45,
13426
+ far: 2000,
13427
+ near: 0.001,
13428
+ position: [
13429
+ 0,
13430
+ 0,
13431
+ 8
13432
+ ],
13433
+ rotation: [
13434
+ 0,
13435
+ 0,
13436
+ 0
13437
+ ],
13438
+ clipMode: EFFECTS.spec.CameraClipMode.portrait
13439
+ },
13440
+ items: [],
13441
+ timelineAsset: {
13442
+ id: this.timelineAssetId
13443
+ },
13444
+ sceneBindings: []
13445
+ };
13446
+ }
13447
+ }
13448
+ var _proto = LoaderECSImpl.prototype;
13449
+ _proto.initial = function initial(engine, options) {
13450
+ this.engine = engine;
13451
+ this.loaderOptions = options != null ? options : {};
13452
+ };
13453
+ _proto.loadScene = function loadScene(options) {
13454
+ var _this = this;
13455
+ return _async_to_generator(function() {
13456
+ var _this_components, _this_components1, _this_components2, _this_items, _options_effects_renderer, gltfResource, gltfScene, component, clips, index;
13457
+ return __generator(this, function(_state) {
13458
+ switch(_state.label){
13459
+ case 0:
13460
+ _this.clear();
13461
+ _this.sceneOptions = options;
13462
+ _this.engine = (_options_effects_renderer = options.effects.renderer) == null ? void 0 : _options_effects_renderer.engine;
13463
+ _this.loaderOptions = {
13464
+ compatibleMode: options.gltf.compatibleMode
13465
+ };
13466
+ gltfResource = options.gltf.resource;
13467
+ if (typeof gltfResource === "string" || _instanceof1(gltfResource, Uint8Array)) {
13468
+ throw new Error("Please load the resource using GLTFTools first.");
13469
+ }
13470
+ _this.images = gltfResource.images.map(function(gltfImage) {
13471
+ var _gltfImage_mimeType;
13472
+ var blob = new Blob([
13473
+ gltfImage.imageData.buffer
13474
+ ], {
13475
+ type: (_gltfImage_mimeType = gltfImage.mimeType) != null ? _gltfImage_mimeType : "image/png"
13476
+ });
13477
+ return {
13478
+ id: gltfImage.id,
13479
+ url: URL.createObjectURL(blob)
13480
+ };
13481
+ });
13482
+ return [
13483
+ 4,
13484
+ Promise.all(_this.images.map(/*#__PURE__*/ _async_to_generator(function(image) {
13485
+ return __generator(this, function(_state) {
13486
+ return [
13487
+ 2,
13488
+ EFFECTS.loadImage(image.url)
13489
+ ];
13490
+ });
13491
+ })))
13492
+ ];
13493
+ case 1:
13494
+ _this.imageElements = _state.sent();
13495
+ _this.processGLTFResource(gltfResource);
13496
+ _this.gltfScene = gltfResource.scenes[0];
13497
+ _this.gltfSkins = _this.gltfScene.skins;
13498
+ _this.gltfMeshs = gltfResource.meshes;
13499
+ _this.gltfLights = _this.gltfScene.lights;
13500
+ _this.gltfCameras = _this.gltfScene.cameras;
13501
+ _this.gltfImages = gltfResource.images;
13502
+ _this.gltfTextures = gltfResource.textures;
13503
+ _this.gltfMaterials = gltfResource.materials;
13504
+ _this.gltfAnimations = gltfResource.animations;
13505
+ _this.gltfImageBasedLights = gltfResource.imageBasedLights;
13506
+ _this.textures = _this.gltfTextures.map(function(texture) {
13507
+ var textureOptions = texture.textureOptions;
13508
+ var source = textureOptions.source;
13509
+ if (typeof source === "number") {
13510
+ // @ts-expect-error
13511
+ textureOptions.source = {
13512
+ id: _this.images[source].id
13513
+ };
13514
+ }
13515
+ return textureOptions;
13516
+ });
13517
+ _this.materials = _this.gltfMaterials.map(function(material) {
13518
+ return material.materialData;
13519
+ });
13520
+ gltfResource.meshes.forEach(function(mesh) {
13521
+ _this.geometries.push(mesh.geometryData);
13522
+ });
13523
+ gltfScene = gltfResource.scenes[0];
13524
+ gltfScene.meshesComponentData.forEach(function(mesh) {
13525
+ return _this.checkMeshComponentData(mesh, gltfResource);
13526
+ });
13527
+ (_this_components = _this.components).push.apply(_this_components, [].concat(gltfScene.camerasComponentData));
13528
+ (_this_components1 = _this.components).push.apply(_this_components1, [].concat(gltfScene.lightsComponentData));
13529
+ (_this_components2 = _this.components).push.apply(_this_components2, [].concat(gltfScene.meshesComponentData));
13530
+ if (gltfScene.animationsComponentData.length === 1) {
13531
+ component = gltfScene.animationsComponentData[0];
13532
+ if (!options.effects.playAllAnimation && options.effects.playAnimation !== undefined) {
13533
+ clips = component.animationClips;
13534
+ index = options.effects.playAnimation;
13535
+ if (index >= 0 && index < clips.length) {
13536
+ component.animationClips = [
13537
+ clips[index]
13538
+ ];
13539
+ } else {
13540
+ component.animationClips = [];
13541
+ }
13542
+ }
13543
+ _this.components.push(component);
13544
+ } else if (gltfScene.animationsComponentData.length > 1) {
13545
+ throw new Error("Find many animation component data " + gltfScene.animationsComponentData.length);
13546
+ }
13547
+ _this.animations = [];
13548
+ _this.gltfAnimations.forEach(function(anim) {
13549
+ _this.animations.push(anim.animationClipData);
13550
+ });
13551
+ _this.items = [];
13552
+ return [
13553
+ 4,
13554
+ _this.tryAddSkybox({
13555
+ skyboxType: options.gltf.skyboxType,
13556
+ renderable: options.gltf.skyboxVis
13557
+ })
13558
+ ];
13559
+ case 2:
13560
+ _state.sent();
13561
+ (_this_items = _this.items).push.apply(_this_items, [].concat(gltfResource.scenes[0].vfxItemData));
13562
+ _this.items.forEach(function(item) {
13563
+ if (item.type === "root") {
13564
+ item.type = "ECS";
13565
+ }
13566
+ });
13567
+ return [
13568
+ 2,
13569
+ _this.getLoadResult()
13570
+ ];
13571
+ }
13572
+ });
13573
+ })();
13574
+ };
13575
+ _proto.checkMeshComponentData = function checkMeshComponentData(mesh, resource) {
13576
+ if (mesh.materials.length <= 0) {
13577
+ throw new Error("Submesh array is empty for mesh with ID: " + mesh.id + ".");
13578
+ }
13579
+ var geometryData;
13580
+ resource.meshes.forEach(function(meshData) {
13581
+ if (meshData.geometryData.id === mesh.geometry.id) {
13582
+ geometryData = meshData.geometryData;
13583
+ }
13584
+ });
13585
+ if (geometryData === undefined) {
13586
+ throw new Error("Unable to find geometry data for mesh with ID: " + mesh.geometry.id + ".");
13587
+ }
13588
+ if (geometryData.subMeshes.length !== mesh.materials.length) {
13589
+ throw new Error("Mismatch between submeshes count (" + geometryData.subMeshes.length + ") and materials count (" + mesh.materials.length + ").");
13590
+ }
13591
+ //mesh.materials.length !=
13592
+ };
13593
+ _proto.processGLTFResource = function processGLTFResource(resource) {
13594
+ var _loop = function() {
13595
+ var baseColorId = _step.value;
13596
+ if (emissiveIdSet.has(baseColorId)) {
13597
+ var texData = textures.find(function(tex) {
13598
+ return tex.textureOptions.id === baseColorId;
13599
+ });
13600
+ if (texData) {
13601
+ var newId = EFFECTS.generateGUID();
13602
+ // @ts-expect-error
13603
+ var newTexData = _extends({}, texData);
13604
+ newTexData.textureOptions = _extends({}, texData.textureOptions, {
13605
+ id: newId
13606
+ });
13607
+ textures.push(newTexData);
13608
+ dataMap[newId] = newTexData.textureOptions;
13609
+ textureIdMap[baseColorId] = newId;
13610
+ mapCount += 1;
13611
+ }
13612
+ }
13613
+ };
13614
+ var _this = this;
13615
+ var dataMap = {};
13616
+ var textures = resource.textures, materials = resource.materials, scenes = resource.scenes, imageBasedLights = resource.imageBasedLights;
13617
+ textures.forEach(function(tex) {
13618
+ var texData = tex.textureOptions;
13619
+ var texId = texData.id;
13620
+ if (texId) {
13621
+ if (dataMap[texId]) {
13622
+ console.error("Duplicate GUID found: " + texId + ", old " + dataMap[texId] + ", new " + texData + ".");
13623
+ }
13624
+ dataMap[texId] = texData;
13625
+ } else {
13626
+ console.error("No GUID in texture Data: " + texData + ".");
13627
+ }
13628
+ });
13629
+ var baseColorIdSet = new Set();
13630
+ var emissiveIdSet = new Set();
13631
+ materials.forEach(function(mat) {
13632
+ var _materialData_textures__BaseColorSampler, _materialData_textures__EmissiveSampler;
13633
+ var materialData = mat.materialData;
13634
+ var baseColorTexture = (_materialData_textures__BaseColorSampler = materialData.textures["_BaseColorSampler"]) == null ? void 0 : _materialData_textures__BaseColorSampler.texture;
13635
+ var emissiveTexture = (_materialData_textures__EmissiveSampler = materialData.textures["_EmissiveSampler"]) == null ? void 0 : _materialData_textures__EmissiveSampler.texture;
13636
+ if (baseColorTexture) {
13637
+ baseColorIdSet.add(baseColorTexture.id);
13638
+ }
13639
+ if (emissiveTexture) {
13640
+ emissiveIdSet.add(emissiveTexture.id);
13641
+ }
13642
+ });
13643
+ var mapCount = 0;
13644
+ var textureIdMap = {};
13645
+ for(var _iterator = _create_for_of_iterator_helper_loose(baseColorIdSet), _step; !(_step = _iterator()).done;)_loop();
13646
+ if (mapCount > 0) {
13647
+ console.warn("Duplicate emissive texture " + mapCount);
13648
+ }
13649
+ materials.forEach(function(mat) {
13650
+ var _materialData_shader, _materialData_shader1;
13651
+ var materialData = mat.materialData;
13652
+ _this.processMaterialData(materialData);
13653
+ if (((_materialData_shader = materialData.shader) == null ? void 0 : _materialData_shader.id) === UnlitShaderGUID) {
13654
+ _this.processMaterialTexture(materialData, "_BaseColorSampler", true, dataMap);
13655
+ } else if (((_materialData_shader1 = materialData.shader) == null ? void 0 : _materialData_shader1.id) === PBRShaderGUID) {
13656
+ var _materialData_textures__EmissiveSampler;
13657
+ var emissiveTexture = (_materialData_textures__EmissiveSampler = materialData.textures["_EmissiveSampler"]) == null ? void 0 : _materialData_textures__EmissiveSampler.texture;
13658
+ if (emissiveTexture && textureIdMap[emissiveTexture.id]) {
13659
+ emissiveTexture.id = textureIdMap[emissiveTexture.id];
13660
+ }
13661
+ _this.processMaterialTexture(materialData, "_BaseColorSampler", true, dataMap);
13662
+ _this.processMaterialTexture(materialData, "_MetallicRoughnessSampler", false, dataMap);
13663
+ _this.processMaterialTexture(materialData, "_NormalSampler", false, dataMap);
13664
+ _this.processMaterialTexture(materialData, "_OcclusionSampler", false, dataMap);
13665
+ _this.processMaterialTexture(materialData, "_EmissiveSampler", false, dataMap);
13666
+ }
13667
+ });
13668
+ var gltfScene = scenes[0];
13669
+ gltfScene.camerasComponentData.forEach(function(comp) {
13670
+ return _this.processCameraComponentData(comp);
13671
+ });
13672
+ gltfScene.lightsComponentData.forEach(function(comp) {
13673
+ return _this.processLightComponentData(comp);
13674
+ });
13675
+ gltfScene.meshesComponentData.forEach(function(comp) {
13676
+ return _this.processMeshComponentData(comp);
13677
+ });
13678
+ var cubeTextures = [];
13679
+ imageBasedLights.forEach(function(ibl) {
13680
+ var data = ibl.imageBaseLightData;
13681
+ if (data.reflectionsIntensity === undefined) {
13682
+ data.reflectionsIntensity = data.intensity;
13683
+ }
13684
+ if (data.diffuseImage) {
13685
+ var diffuseTexture = dataMap[data.diffuseImage.id];
13686
+ EFFECTS.addItem(cubeTextures, diffuseTexture);
13687
+ }
13688
+ if (data.specularImage) {
13689
+ var specularImage = dataMap[data.specularImage.id];
13690
+ EFFECTS.addItem(cubeTextures, specularImage);
13691
+ }
13692
+ });
13693
+ cubeTextures.forEach(function(tex) {
13694
+ if (tex.target === EFFECTS.glContext.TEXTURE_CUBE_MAP) {
13695
+ var cube = tex;
13696
+ cube.mipmaps.forEach(function(mipmap) {
13697
+ var ref;
13698
+ ref = [
13699
+ mipmap[5],
13700
+ mipmap[4]
13701
+ ], mipmap[4] = ref[0], mipmap[5] = ref[1];
13702
+ });
13703
+ if (cube.mipmaps.length === 1) {
13704
+ cube.minFilter = EFFECTS.glContext.LINEAR;
13705
+ cube.magFilter = EFFECTS.glContext.LINEAR;
13706
+ } else {
13707
+ cube.minFilter = EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
13708
+ cube.magFilter = EFFECTS.glContext.LINEAR;
13709
+ }
13710
+ }
13711
+ });
13712
+ };
13713
+ _proto.processComponentData = function processComponentData(components) {
13714
+ var _this = this;
13715
+ components.forEach(function(comp) {
13716
+ if (comp.dataType === EFFECTS.spec.DataType.LightComponent) {
13717
+ _this.processLightComponentData(comp);
13718
+ } else if (comp.dataType === EFFECTS.spec.DataType.CameraComponent) {
13719
+ _this.processCameraComponentData(comp);
13720
+ } else if (comp.dataType === EFFECTS.spec.DataType.MeshComponent) {
13721
+ _this.processMeshComponentData(comp);
13722
+ } else if (comp.dataType === EFFECTS.spec.DataType.SkyboxComponent) {
13723
+ _this.processSkyboxComponentData(comp);
13724
+ }
13725
+ });
13726
+ };
13727
+ _proto.processLightComponentData = function processLightComponentData(light) {
13728
+ if (!light.color) {
13729
+ light.color = {
13730
+ r: 1,
13731
+ g: 1,
13732
+ b: 1,
13733
+ a: 1
13734
+ };
13735
+ }
13736
+ if (!light.intensity) {
13737
+ light.intensity = 1;
13738
+ }
13739
+ if (light.lightType === EFFECTS.spec.LightType.point) {
13740
+ if (!light.range) {
13741
+ light.range = 0;
13742
+ }
13743
+ } else if (light.lightType === EFFECTS.spec.LightType.spot) {
13744
+ if (!light.range) {
13745
+ light.range = 0;
13746
+ }
13747
+ if (!light.innerConeAngle) {
13748
+ light.innerConeAngle = 0;
13749
+ }
13750
+ if (!light.outerConeAngle) {
13751
+ light.outerConeAngle = Math.PI / 4;
13752
+ }
13753
+ }
13754
+ };
13755
+ _proto.processCameraComponentData = function processCameraComponentData(camera) {
13756
+ if (camera.type === EFFECTS.spec.CameraType.perspective) {
13757
+ if (camera.fov) {
13758
+ camera.fov *= Math.PI / 180;
13759
+ }
13760
+ }
13761
+ };
13762
+ _proto.processMeshComponentData = function processMeshComponentData(mesh) {};
13763
+ _proto.processSkyboxComponentData = function processSkyboxComponentData(skybox) {
13764
+ if (skybox.intensity === undefined) {
13765
+ skybox.intensity = 1;
13766
+ }
13767
+ if (skybox.reflectionsIntensity === undefined) {
13768
+ skybox.reflectionsIntensity = 1;
13769
+ }
13770
+ };
13771
+ _proto.processMaterialData = function processMaterialData(material) {
13772
+ var _material_shader, _material_shader1;
13773
+ if (((_material_shader = material.shader) == null ? void 0 : _material_shader.id) === UnlitShaderGUID) {
13774
+ if (!material.colors["_BaseColorFactor"]) {
13775
+ material.colors["_BaseColorFactor"] = {
13776
+ r: 1,
13777
+ g: 1,
13778
+ b: 1,
13779
+ a: 1
13780
+ };
13781
+ }
13782
+ if (material.floats["_AlphaCutoff"] === undefined) {
13783
+ material.floats["_AlphaCutoff"] = 0;
13784
+ }
13785
+ if (material.floats["ZWrite"] === undefined) {
13786
+ material.floats["ZWrite"] = 1;
13787
+ }
13788
+ if (material.floats["ZTest"] === undefined) {
13789
+ material.floats["ZTest"] = 1;
13790
+ }
13791
+ if (!material.stringTags["RenderType"]) {
13792
+ material.stringTags["RenderType"] = EFFECTS.spec.RenderType.Opaque;
13793
+ }
13794
+ if (!material.stringTags["RenderFace"]) {
13795
+ material.stringTags["RenderFace"] = EFFECTS.spec.RenderFace.Front;
13796
+ }
13797
+ } else if (((_material_shader1 = material.shader) == null ? void 0 : _material_shader1.id) === PBRShaderGUID) {
13798
+ if (!material.colors["_BaseColorFactor"]) {
13799
+ material.colors["_BaseColorFactor"] = {
13800
+ r: 1,
13801
+ g: 1,
13802
+ b: 1,
13803
+ a: 1
13804
+ };
13805
+ }
13806
+ if (material.floats["_SpecularAA"] === undefined) {
13807
+ material.floats["_SpecularAA"] = 0;
13808
+ }
13809
+ if (material.floats["_MetallicFactor"] === undefined) {
13810
+ material.floats["_MetallicFactor"] = 1;
13811
+ }
13812
+ if (material.floats["_RoughnessFactor"] === undefined) {
13813
+ material.floats["_RoughnessFactor"] = 0;
13814
+ }
13815
+ if (material.floats["_NormalScale"] === undefined) {
13816
+ material.floats["_NormalScale"] = 1;
13817
+ }
13818
+ if (material.floats["_OcclusionStrength"] === undefined) {
13819
+ material.floats["_OcclusionStrength"] = this.isTiny3dMode() ? 0 : 1;
13820
+ }
13821
+ if (!material.colors["_EmissiveFactor"]) {
13822
+ material.colors["_EmissiveFactor"] = {
13823
+ r: 0,
13824
+ g: 0,
13825
+ b: 0,
13826
+ a: 1
13827
+ };
13828
+ }
13829
+ if (material.floats["_EmissiveIntensity"] === undefined) {
13830
+ material.floats["_EmissiveIntensity"] = 1;
13831
+ }
13832
+ if (material.floats["_AlphaCutoff"] === undefined) {
13833
+ material.floats["_AlphaCutoff"] = 0;
13834
+ }
13835
+ if (material.floats["ZWrite"] === undefined) {
13836
+ material.floats["ZWrite"] = 1;
13837
+ }
13838
+ if (material.floats["ZTest"] === undefined) {
13839
+ material.floats["ZTest"] = 1;
13840
+ }
13841
+ if (!material.stringTags["RenderType"]) {
13842
+ material.stringTags["RenderType"] = EFFECTS.spec.RenderType.Opaque;
13843
+ }
13844
+ if (!material.stringTags["RenderFace"]) {
13845
+ material.stringTags["RenderFace"] = EFFECTS.spec.RenderFace.Front;
13846
+ }
13847
+ } else {
13848
+ console.error("Encountered unknown shader ID in material with ID: " + material.id + ".");
13849
+ }
13850
+ };
13851
+ _proto.processTextureOptions = function processTextureOptions(options, isBaseColor, image) {
13852
+ var premultiplyAlpha = false;
13853
+ var _options_minFilter;
13854
+ var minFilter = (_options_minFilter = options.minFilter) != null ? _options_minFilter : EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
13855
+ if (this.isTiny3dMode()) {
13856
+ minFilter = EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
13857
+ if (image) {
13858
+ if (!WebGLHelper.isPow2(image.width) || !WebGLHelper.isPow2(image.height)) {
13859
+ minFilter = EFFECTS.glContext.LINEAR;
13860
+ }
13861
+ }
13862
+ premultiplyAlpha = isBaseColor ? false : true;
13863
+ }
13864
+ var generateMipmap = minFilter == EFFECTS.glContext.NEAREST_MIPMAP_NEAREST || minFilter == EFFECTS.glContext.LINEAR_MIPMAP_NEAREST || minFilter == EFFECTS.glContext.NEAREST_MIPMAP_LINEAR || minFilter == EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
13865
+ var _options_wrapS;
13866
+ options.wrapS = (_options_wrapS = options.wrapS) != null ? _options_wrapS : EFFECTS.glContext.REPEAT;
13867
+ var _options_wrapT;
13868
+ options.wrapT = (_options_wrapT = options.wrapT) != null ? _options_wrapT : EFFECTS.glContext.REPEAT;
13869
+ var _options_magFilter;
13870
+ options.magFilter = (_options_magFilter = options.magFilter) != null ? _options_magFilter : EFFECTS.glContext.LINEAR;
13871
+ options.minFilter = minFilter;
13872
+ options.anisotropic = 1;
13873
+ options.premultiplyAlpha = premultiplyAlpha;
13874
+ options.generateMipmap = generateMipmap;
13875
+ };
13876
+ _proto.processMaterialTexture = function processMaterialTexture(material, textureName, isBaseColor, dataMap) {
13877
+ var texture = material.textures[textureName];
13878
+ if (texture) {
13879
+ var id = texture.texture.id;
13880
+ var texData = dataMap[id];
13881
+ var imageObj;
13882
+ // @ts-expect-error
13883
+ if (typeof texData.source !== "number") {
13884
+ // @ts-expect-error
13885
+ throw new Error("Invalid texture option source data, " + texData.source);
13886
+ } else {
13887
+ // @ts-expect-error
13888
+ imageObj = this.imageElements[texData.source];
13889
+ }
13890
+ if (texData) {
13891
+ this.processTextureOptions(texData, isBaseColor, imageObj);
13892
+ }
13893
+ }
13894
+ };
13895
+ _proto.getLoadResult = function getLoadResult() {
13896
+ var itemIds = [];
13897
+ this.items.forEach(function(item) {
13898
+ return itemIds.push({
13899
+ id: item.id
13900
+ });
13901
+ });
13902
+ this.composition.items = itemIds;
13903
+ var jsonScene = {
13904
+ version: "3.0",
13905
+ playerVersion: {
13906
+ web: "2.0",
13907
+ native: "2.0"
13908
+ },
13909
+ type: "ge",
13910
+ compositionId: this.composition.id,
13911
+ compositions: [
13912
+ this.composition
13913
+ ],
13914
+ images: this.images,
13915
+ shapes: [],
13916
+ plugins: [
13917
+ "model"
13918
+ ],
13919
+ textures: this.textures,
13920
+ items: this.items,
13921
+ components: this.components,
13922
+ materials: this.materials,
13923
+ shaders: this.shaders,
13924
+ geometries: this.geometries,
13925
+ animations: this.animations,
13926
+ miscs: [
13927
+ {
13928
+ id: this.timelineAssetId,
13929
+ dataType: EFFECTS.spec.DataType.TimelineAsset
13930
+ }
13931
+ ]
13932
+ };
13933
+ return {
13934
+ source: this.getRemarkString(),
13935
+ jsonScene: jsonScene,
13936
+ sceneAABB: {
13937
+ min: [
13938
+ -1,
13939
+ -1,
13940
+ -1
13941
+ ],
13942
+ max: [
13943
+ 1,
13944
+ 1,
13945
+ 1
13946
+ ]
13947
+ }
13948
+ };
13949
+ };
13950
+ _proto.addLight = function addLight(data) {
13951
+ var itemId = EFFECTS.generateGUID();
13952
+ var component = {
13953
+ id: EFFECTS.generateGUID(),
13954
+ item: {
13955
+ id: itemId
13956
+ },
13957
+ dataType: EFFECTS.spec.DataType.LightComponent,
13958
+ //
13959
+ lightType: data.lightType,
13960
+ color: data.color,
13961
+ intensity: data.intensity,
13962
+ range: data.range,
13963
+ innerConeAngle: data.innerConeAngle,
13964
+ outerConeAngle: data.outerConeAngle
13965
+ };
13966
+ var item = {
13967
+ id: itemId,
13968
+ name: data.name,
13969
+ duration: data.duration,
13970
+ type: EFFECTS.spec.ItemType.light,
13971
+ pn: 0,
13972
+ visible: true,
13973
+ endBehavior: data.endBehavior,
13974
+ transform: {
13975
+ position: {
13976
+ x: data.position[0],
13977
+ y: data.position[1],
13978
+ z: data.position[2]
13979
+ },
13980
+ eulerHint: {
13981
+ x: data.rotation[0],
13982
+ y: data.rotation[1],
13983
+ z: data.rotation[2]
13984
+ },
13985
+ scale: {
13986
+ x: data.scale[0],
13987
+ y: data.scale[1],
13988
+ z: data.scale[2]
13989
+ }
13990
+ },
13991
+ components: [
13992
+ {
13993
+ id: component.id
13994
+ }
13995
+ ],
13996
+ content: {},
13997
+ dataType: EFFECTS.spec.DataType.VFXItemData
13998
+ };
13999
+ this.items.push(item);
14000
+ this.components.push(component);
14001
+ };
14002
+ _proto.addCamera = function addCamera(camera) {
14003
+ var itemId = EFFECTS.generateGUID();
14004
+ var component = {
14005
+ id: EFFECTS.generateGUID(),
14006
+ item: {
14007
+ id: itemId
14008
+ },
14009
+ dataType: EFFECTS.spec.DataType.CameraComponent,
14010
+ fov: camera.fov,
14011
+ near: camera.near,
14012
+ far: camera.far,
14013
+ clipMode: camera.clipMode
14014
+ };
14015
+ var item = {
14016
+ id: itemId,
14017
+ name: camera.name,
14018
+ duration: camera.duration,
14019
+ // @ts-expect-error
14020
+ type: "camera",
14021
+ pn: 0,
14022
+ visible: true,
14023
+ endBehavior: camera.endBehavior,
14024
+ transform: {
14025
+ position: {
14026
+ x: camera.position[0],
14027
+ y: camera.position[1],
14028
+ z: camera.position[2]
14029
+ },
14030
+ eulerHint: {
14031
+ x: camera.rotation[0],
14032
+ y: camera.rotation[1],
14033
+ z: camera.rotation[2]
14034
+ },
14035
+ scale: {
14036
+ x: 1,
14037
+ y: 1,
14038
+ z: 1
14039
+ }
14040
+ },
14041
+ components: [
14042
+ {
14043
+ id: component.id
14044
+ }
14045
+ ],
14046
+ content: {},
14047
+ dataType: EFFECTS.spec.DataType.VFXItemData
14048
+ };
14049
+ this.items.push(item);
14050
+ this.components.push(component);
14051
+ };
14052
+ _proto.tryAddSkybox = function tryAddSkybox(skybox) {
14053
+ var _this = this;
14054
+ return _async_to_generator(function() {
14055
+ var ibl, _this_images, // @ts-expect-error
14056
+ _this_textures, itemId, skyboxInfo, imageList, textureOptionsList, component, _skybox_renderable, _skybox_duration, item;
14057
+ return __generator(this, function(_state) {
14058
+ if (_this.gltfImageBasedLights.length > 0 && !_this.ignoreSkybox()) {
14059
+ ibl = _this.gltfImageBasedLights[0];
14060
+ _this.components.push(ibl.imageBaseLightData);
14061
+ } else if (skybox.skyboxType !== undefined) {
14062
+ itemId = EFFECTS.generateGUID();
14063
+ skyboxInfo = _this.createSkyboxComponentData(skybox.skyboxType);
14064
+ imageList = skyboxInfo.imageList, textureOptionsList = skyboxInfo.textureOptionsList, component = skyboxInfo.component;
14065
+ component.item.id = itemId;
14066
+ if (skybox.intensity !== undefined) {
14067
+ component.intensity = skybox.intensity;
14068
+ }
14069
+ if (skybox.reflectionsIntensity !== undefined) {
14070
+ component.reflectionsIntensity = skybox.reflectionsIntensity;
14071
+ }
14072
+ component.renderable = (_skybox_renderable = skybox.renderable) != null ? _skybox_renderable : false;
14073
+ item = {
14074
+ id: itemId,
14075
+ name: "Skybox-" + skybox.skyboxType,
14076
+ duration: (_skybox_duration = skybox.duration) != null ? _skybox_duration : 999,
14077
+ type: EFFECTS.spec.ItemType.skybox,
14078
+ pn: 0,
14079
+ visible: true,
14080
+ endBehavior: EFFECTS.spec.ItemEndBehavior.freeze,
14081
+ transform: {
14082
+ position: {
14083
+ x: 0,
14084
+ y: 0,
14085
+ z: 0
14086
+ },
14087
+ eulerHint: {
14088
+ x: 0,
14089
+ y: 0,
14090
+ z: 0
14091
+ },
14092
+ scale: {
14093
+ x: 1,
14094
+ y: 1,
14095
+ z: 1
14096
+ }
14097
+ },
14098
+ components: [
14099
+ {
14100
+ id: component.id
14101
+ }
14102
+ ],
14103
+ content: {},
14104
+ dataType: EFFECTS.spec.DataType.VFXItemData
14105
+ };
14106
+ (_this_images = _this.images).push.apply(_this_images, [].concat(imageList));
14107
+ (_this_textures = _this.textures).push.apply(_this_textures, [].concat(textureOptionsList));
14108
+ _this.items.push(item);
14109
+ _this.components.push(component);
14110
+ }
14111
+ return [
14112
+ 2
14113
+ ];
14114
+ });
14115
+ })();
14116
+ };
14117
+ _proto.createTreeOptions = function createTreeOptions(scene) {
14118
+ var nodeList = scene.nodes.map(function(node, nodeIndex) {
14119
+ var children = node.children.map(function(child) {
14120
+ if (child.nodeIndex === undefined) {
14121
+ throw new Error("Undefined nodeIndex for child " + child + ".");
14122
+ }
14123
+ return child.nodeIndex;
14124
+ });
14125
+ var pos = [
14126
+ 0,
14127
+ 0,
14128
+ 0
14129
+ ];
14130
+ var quat = [
14131
+ 0,
14132
+ 0,
14133
+ 0,
14134
+ 0
14135
+ ];
14136
+ var scale = [
14137
+ 0,
14138
+ 0,
14139
+ 0
14140
+ ];
14141
+ if (node.matrix !== undefined) {
14142
+ if (node.matrix.length !== 16) {
14143
+ throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node + ".");
14144
+ }
14145
+ var mat = Matrix4.fromArray(node.matrix);
14146
+ var transform = mat.getTransform();
14147
+ pos = transform.translation.toArray();
14148
+ quat = transform.rotation.toArray();
14149
+ scale = transform.scale.toArray();
14150
+ } else {
14151
+ if (node.translation !== undefined) {
14152
+ pos = node.translation;
14153
+ }
14154
+ if (node.rotation !== undefined) {
14155
+ quat = node.rotation;
14156
+ }
14157
+ if (node.scale !== undefined) {
14158
+ scale = node.scale;
14159
+ }
14160
+ }
14161
+ node.nodeIndex = nodeIndex;
14162
+ var treeNode = {
14163
+ name: node.name,
14164
+ transform: {
14165
+ position: pos,
14166
+ quat: quat,
14167
+ scale: scale
14168
+ },
14169
+ children: children,
14170
+ id: "" + node.nodeIndex
14171
+ };
14172
+ return treeNode;
14173
+ });
14174
+ var rootNodes = scene.rootNodes.map(function(root) {
14175
+ if (root.nodeIndex === undefined) {
14176
+ throw new Error("Undefined nodeIndex for root " + root + ".");
14177
+ }
14178
+ return root.nodeIndex;
14179
+ });
14180
+ var treeOptions = {
14181
+ nodes: nodeList,
14182
+ children: rootNodes,
14183
+ animation: -1,
14184
+ animations: []
14185
+ };
14186
+ return treeOptions;
14187
+ };
14188
+ _proto.createAnimations = function createAnimations(animations) {
14189
+ return animations.map(function(anim) {
14190
+ var tracks = anim.channels.map(function(channel) {
14191
+ var track = {
14192
+ input: channel.input.array,
14193
+ output: channel.output.array,
14194
+ node: channel.target.node,
14195
+ path: channel.target.path,
14196
+ interpolation: channel.interpolation
14197
+ };
14198
+ return track;
14199
+ });
14200
+ var newAnim = {
14201
+ name: anim.name,
14202
+ tracks: tracks
14203
+ };
14204
+ return newAnim;
14205
+ });
14206
+ };
14207
+ _proto.createTexture2D = function createTexture2D(image, texture, isBaseColor) {
14208
+ return WebGLHelper.createTexture2D(this.engine, image, texture, isBaseColor, this.isTiny3dMode());
14209
+ };
14210
+ _proto.createSkyboxComponentData = function createSkyboxComponentData(typeName) {
14211
+ if (typeName !== "NFT" && typeName !== "FARM") {
14212
+ throw new Error("Invalid skybox type specified: '" + typeName + "'. Valid types are: 'NFT', 'FARM'.");
14213
+ }
14214
+ //
14215
+ var typ = typeName === "NFT" ? exports.PSkyboxType.NFT : exports.PSkyboxType.FARM;
14216
+ var params = PSkyboxCreator.getSkyboxParams(typ);
14217
+ return PSkyboxCreator.createSkyboxComponentData(this.engine, params);
14218
+ };
14219
+ _proto.scaleColorVal = function scaleColorVal(val, fromGLTF) {
14220
+ return fromGLTF ? LoaderHelper.scaleTo255(val) : LoaderHelper.scaleTo1(val);
14221
+ };
14222
+ _proto.scaleColorVec = function scaleColorVec(vec, fromGLTF) {
14223
+ var _this = this;
14224
+ return vec.map(function(val) {
14225
+ return _this.scaleColorVal(val, fromGLTF);
14226
+ });
14227
+ };
14228
+ _proto.createLightOptions = function createLightOptions(light) {
14229
+ return PluginHelper.createLightOptions(light);
14230
+ };
14231
+ _proto.createCameraOptions = function createCameraOptions(camera) {
14232
+ var _PluginHelper_createCameraOptions;
14233
+ return (_PluginHelper_createCameraOptions = PluginHelper.createCameraOptions(camera)) != null ? _PluginHelper_createCameraOptions : {
14234
+ fov: 45,
14235
+ far: 1000,
14236
+ near: 0.01,
14237
+ clipMode: EFFECTS.spec.CameraClipMode.portrait
14238
+ };
14239
+ };
14240
+ _proto.clear = function clear() {
14241
+ this.images = [];
14242
+ this.textures = [];
14243
+ this.items = [];
14244
+ this.components = [];
14245
+ this.materials = [];
14246
+ this.shaders = [];
14247
+ this.geometries = [];
14248
+ };
14249
+ /**
14250
+ * 按照传入的动画播放参数,计算需要播放的动画索引
14251
+ *
14252
+ * @param treeOptions 节点树属性,需要初始化animations列表。
14253
+ * @returns 返回计算的动画索引,-1表示没有动画需要播放,-88888888表示播放所有动画。
14254
+ */ _proto.getPlayAnimationIndex = function getPlayAnimationIndex(treeOptions) {
14255
+ var animations = treeOptions.animations;
14256
+ if (animations === undefined || animations.length <= 0) {
14257
+ // 硬编码,内部指定的不播放动画的索引值
14258
+ return -1;
14259
+ }
14260
+ if (this.isPlayAllAnimation()) {
14261
+ // 硬编码,内部指定的播放全部动画的索引值
14262
+ return -88888888;
14263
+ }
14264
+ var animationInfo = this.sceneOptions.effects.playAnimation;
14265
+ if (animationInfo === undefined) {
14266
+ return -1;
14267
+ }
14268
+ if (typeof animationInfo === "number") {
14269
+ if (animationInfo >= 0 && animationInfo < animations.length) {
14270
+ return animationInfo;
14271
+ } else {
14272
+ return -1;
14273
+ }
14274
+ } else {
14275
+ // typeof animationInfo === 'string'
14276
+ var animationIndex = -1;
14277
+ // 通过动画名字查找动画索引
14278
+ animations.forEach(function(anim, index) {
14279
+ if (anim.name === animationInfo) {
14280
+ animationIndex = index;
14281
+ }
14282
+ });
14283
+ return animationIndex;
14284
+ }
14285
+ };
14286
+ _proto.isPlayAnimation = function isPlayAnimation() {
14287
+ return this.sceneOptions.effects.playAnimation !== undefined;
14288
+ };
14289
+ _proto.isPlayAllAnimation = function isPlayAllAnimation() {
14290
+ return this.sceneOptions.effects.playAllAnimation === true;
14291
+ };
14292
+ _proto.getRemarkString = function getRemarkString() {
14293
+ var remark = this.sceneOptions.gltf.remark;
14294
+ if (remark === undefined) {
14295
+ return "Unknown";
14296
+ } else if (typeof remark === "string") {
14297
+ return remark;
14298
+ } else {
14299
+ return "BinaryBuffer";
14300
+ }
14301
+ };
14302
+ _proto.getCompositionDuration = function getCompositionDuration() {
14303
+ return this.composition.duration;
14304
+ };
14305
+ _proto.isTiny3dMode = function isTiny3dMode() {
14306
+ return this.loaderOptions.compatibleMode === "tiny3d";
14307
+ };
14308
+ _proto.getItemDuration = function getItemDuration() {
14309
+ var _this_sceneOptions_effects_duration;
14310
+ return (_this_sceneOptions_effects_duration = this.sceneOptions.effects.duration) != null ? _this_sceneOptions_effects_duration : 9999;
14311
+ };
14312
+ _proto.getItemEndBehavior = function getItemEndBehavior() {
14313
+ var _this_sceneOptions_effects_endBehavior;
14314
+ return (_this_sceneOptions_effects_endBehavior = this.sceneOptions.effects.endBehavior) != null ? _this_sceneOptions_effects_endBehavior : EFFECTS.spec.ItemEndBehavior.loop;
14315
+ };
14316
+ _proto.getSkyboxType = function getSkyboxType() {
14317
+ var typeName = this.sceneOptions.gltf.skyboxType;
14318
+ switch(typeName){
14319
+ case "NFT":
14320
+ return exports.PSkyboxType.NFT;
14321
+ case "FARM":
14322
+ return exports.PSkyboxType.FARM;
14323
+ }
14324
+ };
14325
+ _proto.isSkyboxVis = function isSkyboxVis() {
14326
+ return this.sceneOptions.gltf.skyboxVis === true;
14327
+ };
14328
+ _proto.ignoreSkybox = function ignoreSkybox() {
14329
+ return this.sceneOptions.gltf.ignoreSkybox === true;
14330
+ };
14331
+ _proto.isEnvironmentTest = function isEnvironmentTest() {
14332
+ if (typeof this.sceneOptions.gltf.remark === "string") {
14333
+ return this.sceneOptions.gltf.remark.includes("EnvironmentTest");
14334
+ } else {
14335
+ return false;
14336
+ }
14337
+ };
14338
+ return LoaderECSImpl;
14339
+ }();
14340
+ var globalLoader;
14341
+ function getDefaultEffectsGLTFLoaderECS(engine, options) {
14342
+ if (!globalLoader) {
14343
+ globalLoader = new LoaderECSImpl();
14344
+ }
14345
+ globalLoader.initial(engine, options);
14346
+ return globalLoader;
14347
+ }
14348
+ function setDefaultEffectsGLTFLoaderECS(loader) {
14349
+ globalLoader = loader;
14350
+ }
14351
+ function getPBRShaderProperties() {
14352
+ return '\n _BaseColorSampler ("基础贴图", 2D) = "" {}\n _BaseColorFactor ("基础颜色", Color) = (1, 1, 1, 1)\n _MetallicRoughnessSampler ("金属贴图", 2D) = "" {}\n _MetallicFactor ("金属度", Range(0, 1)) = 1\n _RoughnessFactor ("粗糙度", Range(0, 1)) = 1\n [Toggle] _SpecularAA ("高光抗锯齿", Float) = 0\n _NormalSampler ("法线贴图", 2D) = "" {}\n _NormalScale ("法线贴图强度", Range(0, 2)) = 1\n _OcclusionSampler ("AO贴图", 2D) = "" {}\n _OcclusionStrength ("AO贴图强度", Range(0, 1)) = 1\n _EmissiveSampler ("自发光贴图", 2D) = "" {}\n _EmissiveIntensity ("自发光贴图强度", Float) = 1\n _EmissiveFactor ("自发光颜色", Color) = (0, 0, 0, 1)\n _AlphaCutoff ("Alpha裁剪值", Range(0, 1)) = 0.5\n ';
14353
+ }
14354
+ function getUnlitShaderProperties() {
14355
+ return '\n _BaseColorSampler ("基础贴图", 2D) = "" {}\n _BaseColorFactor ("基础颜色", Color) = (1, 1, 1, 1)\n _AlphaCutoff ("Alpha裁剪值", Range(0, 1)) = 0.5\n ';
14356
+ }
14357
+ function getDefaultPBRMaterialData() {
14358
+ var material = {
14359
+ "id": "00000000000000000000000000000000",
14360
+ "name": "PBR Material",
14361
+ "dataType": EFFECTS.spec.DataType.Material,
14362
+ "stringTags": {
14363
+ "RenderType": EFFECTS.spec.RenderType.Opaque,
14364
+ "RenderFace": "Front"
14365
+ },
14366
+ "macros": [],
14367
+ "shader": {
14368
+ "id": "pbr00000000000000000000000000000"
14369
+ },
14370
+ "ints": {},
14371
+ "floats": {
14372
+ "ZWrite": 1,
14373
+ "ZTest": 1,
14374
+ "_SpecularAA": 0,
14375
+ "_MetallicFactor": 1,
14376
+ "_RoughnessFactor": 0.0,
14377
+ "_NormalScale": 1,
14378
+ "_OcclusionStrength": 1,
14379
+ "_EmissiveIntensity": 1,
14380
+ "_AlphaCutoff": 0.5
14381
+ },
14382
+ "vector4s": {},
14383
+ "colors": {
14384
+ "_BaseColorFactor": {
14385
+ "r": 1,
14386
+ "g": 1,
14387
+ "b": 1,
14388
+ "a": 1
14389
+ },
14390
+ "_EmissiveFactor": {
14391
+ "r": 0,
14392
+ "g": 0,
14393
+ "b": 0,
14394
+ "a": 1
14395
+ }
14396
+ },
14397
+ "textures": {}
14398
+ };
14399
+ return material;
14400
+ }
14401
+ function getDefaultUnlitMaterialData() {
14402
+ var material = {
14403
+ "id": "00000000000000000000000000000000",
14404
+ "name": "Unlit Material",
14405
+ "dataType": EFFECTS.spec.DataType.Material,
14406
+ "stringTags": {
14407
+ "ZWrite": "true",
14408
+ "ZTest": "true",
14409
+ "RenderType": EFFECTS.spec.RenderType.Opaque,
14410
+ "Cull": "Front"
14411
+ },
14412
+ "macros": [],
14413
+ "shader": {
14414
+ "id": "unlit000000000000000000000000000"
14415
+ },
14416
+ "ints": {},
14417
+ "floats": {
14418
+ "_AlphaCutoff": 0.5
14419
+ },
14420
+ "vector4s": {},
14421
+ "colors": {
14422
+ "_BaseColorFactor": {
14423
+ "r": 1,
14424
+ "g": 1,
14425
+ "b": 1,
14426
+ "a": 1
14427
+ }
14428
+ },
14429
+ "textures": {}
14430
+ };
14431
+ return material;
14432
+ }
14433
+
14434
+ EFFECTS.registerPlugin("tree", ModelTreePlugin, EFFECTS.VFXItem, true);
14435
+ EFFECTS.registerPlugin("model", ModelPlugin, EFFECTS.VFXItem);
14436
+ var version = "2.0.0-alpha.19";
14437
+ EFFECTS.logger.info("Plugin model version: " + version + ".");
14438
+ if (version !== EFFECTS__namespace.version) {
13376
14439
  console.error("注意:请统一 Model 插件与 Player 版本,不统一的版本混用会有不可预知的后果!", "\nAttention: Please ensure the Model plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");
13377
14440
  }
13378
14441
 
@@ -13393,6 +14456,7 @@ exports.HitTestingProxy = HitTestingProxy;
13393
14456
  exports.HookOGLFunc = HookOGLFunc;
13394
14457
  exports.InterpolationSampler = InterpolationSampler;
13395
14458
  exports.JSONConverter = JSONConverter;
14459
+ exports.LoaderECSImpl = LoaderECSImpl;
13396
14460
  exports.LoaderHelper = LoaderHelper;
13397
14461
  exports.LoaderImpl = LoaderImpl;
13398
14462
  exports.Matrix3 = Matrix3;
@@ -13450,6 +14514,9 @@ exports.createPluginMaterial = createPluginMaterial;
13450
14514
  exports.fetchPBRShaderCode = fetchPBRShaderCode;
13451
14515
  exports.fetchUnlitShaderCode = fetchUnlitShaderCode;
13452
14516
  exports.getDefaultEffectsGLTFLoader = getDefaultEffectsGLTFLoader;
14517
+ exports.getDefaultEffectsGLTFLoaderECS = getDefaultEffectsGLTFLoaderECS;
14518
+ exports.getDefaultPBRMaterialData = getDefaultPBRMaterialData;
14519
+ exports.getDefaultUnlitMaterialData = getDefaultUnlitMaterialData;
13453
14520
  exports.getDiffuseOnlyShaderCode = getDiffuseOnlyShaderCode;
13454
14521
  exports.getGaussianBlurShaderCodeV1 = getGaussianBlurShaderCodeV1;
13455
14522
  exports.getGaussianBlurShaderCodeV2 = getGaussianBlurShaderCodeV2;
@@ -13458,6 +14525,7 @@ exports.getGeometryDataFromPropsList = getGeometryDataFromPropsList;
13458
14525
  exports.getKawaseBlurShaderCode = getKawaseBlurShaderCode;
13459
14526
  exports.getNormalVisShaderCode = getNormalVisShaderCode;
13460
14527
  exports.getPBRPassShaderCode = getPBRPassShaderCode;
14528
+ exports.getPBRShaderProperties = getPBRShaderProperties;
13461
14529
  exports.getPMeshList = getPMeshList;
13462
14530
  exports.getQuadFilterShaderCode = getQuadFilterShaderCode;
13463
14531
  exports.getRendererGPUInfo = getRendererGPUInfo;
@@ -13467,6 +14535,8 @@ exports.getSimpleFilterShaderCode = getSimpleFilterShaderCode;
13467
14535
  exports.getSkyBoxShaderCode = getSkyBoxShaderCode;
13468
14536
  exports.getTransparecyBaseShader = getTransparecyBaseShader;
13469
14537
  exports.getTransparecyFilterShader = getTransparecyFilterShader;
14538
+ exports.getUnlitShaderProperties = getUnlitShaderProperties;
13470
14539
  exports.setDefaultEffectsGLTFLoader = setDefaultEffectsGLTFLoader;
14540
+ exports.setDefaultEffectsGLTFLoaderECS = setDefaultEffectsGLTFLoaderECS;
13471
14541
  exports.version = version;
13472
14542
  //# sourceMappingURL=index.js.map