@galacean/effects-plugin-model 2.0.0-alpha.12 → 2.0.0-alpha.13

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.mjs CHANGED
@@ -3,10 +3,10 @@
3
3
  * Description: Galacean Effects player model plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 飂兮
6
- * Version: v2.0.0-alpha.12
6
+ * Version: v2.0.0-alpha.13
7
7
  */
8
8
 
9
- import { math, Transform, PLAYER_OPTIONS_ENV_EDITOR, spec, glContext, Texture, TextureSourceType, RenderPassAttachmentStorageType, Material, Mesh, Geometry, GLSLVersion, addItem, removeItem, effectsClass, RendererComponent, ItemBehaviour, TimelineComponent, HitTestType, RenderPass, TextureLoadAction, DestroyOptions, RenderPassDestroyAttachmentType, Player, Renderer, getDefaultTextureFactory, loadImage, generateGUID, VFXItem, AbstractPlugin, glType2VertexFormatType, Downloader, getStandardJSON, registerPlugin, logger } from '@galacean/effects';
9
+ import { math, Transform, PLAYER_OPTIONS_ENV_EDITOR, spec, glContext, Texture, TextureSourceType, RenderPassAttachmentStorageType, Material, Mesh, Geometry, GLSLVersion, addItem, removeItem, effectsClass, RendererComponent, ItemBehaviour, HitTestType, AnimationClip, RenderPass, TextureLoadAction, DestroyOptions, RenderPassDestroyAttachmentType, Player, Renderer, getDefaultTextureFactory, loadImage, generateGUID, VFXItem, AbstractPlugin, glType2VertexFormatType, Downloader, getStandardJSON, registerPlugin, logger, version as version$1 } from '@galacean/effects';
10
10
 
11
11
  /**
12
12
  * Model 插件元素类型
@@ -790,6 +790,41 @@ var ctrlMap = {
790
790
  return new CTRL(binary[index], start, byteLength / CTRL.BYTES_PER_ELEMENT);
791
791
  }
792
792
 
793
+ function _array_like_to_array(arr, len) {
794
+ if (len == null || len > arr.length) len = arr.length;
795
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
796
+ return arr2;
797
+ }
798
+
799
+ function _unsupported_iterable_to_array(o, minLen) {
800
+ if (!o) return;
801
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
802
+ var n = Object.prototype.toString.call(o).slice(8, -1);
803
+ if (n === "Object" && o.constructor) n = o.constructor.name;
804
+ if (n === "Map" || n === "Set") return Array.from(n);
805
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
806
+ }
807
+
808
+ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
809
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
810
+ if (it) return (it = it.call(o)).next.bind(it);
811
+ // Fallback for engines without symbol support
812
+ if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
813
+ if (it) o = it;
814
+ var i = 0;
815
+ return function() {
816
+ if (i >= o.length) return {
817
+ done: true
818
+ };
819
+ return {
820
+ done: false,
821
+ value: o[i++]
822
+ };
823
+ };
824
+ }
825
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
826
+ }
827
+
793
828
  var InterpolationSampler = /*#__PURE__*/ function() {
794
829
  function InterpolationSampler(time, data, componentCount) {
795
830
  this.time = time;
@@ -1086,7 +1121,7 @@ var TextureDataMode;
1086
1121
  */ _this.skeleton = 0;
1087
1122
  /**
1088
1123
  * 关节索引
1089
- */ _this.jointList = [];
1124
+ */ _this.jointItem = [];
1090
1125
  /**
1091
1126
  * 逆绑定矩阵
1092
1127
  */ _this.inverseBindMatrices = [];
@@ -1101,27 +1136,26 @@ var TextureDataMode;
1101
1136
  var _proto = PSkin.prototype;
1102
1137
  /**
1103
1138
  * 创建蒙皮对象
1104
- * @param options - 蒙皮相关数据
1139
+ * @param props - 蒙皮相关数据
1105
1140
  * @param engine - 引擎对象
1106
- * @param parentItem - 场景树父元素
1107
- */ _proto.create = function create(options, engine, parentItem) {
1108
- var _options_name;
1109
- this.name = this.genName((_options_name = options.name) != null ? _options_name : "Unnamed skin");
1141
+ * @param rootBoneItem - 场景树父元素
1142
+ */ _proto.create = function create(props, engine, rootBoneItem) {
1143
+ var _props_rootBoneName;
1144
+ this.name = (_props_rootBoneName = props.rootBoneName) != null ? _props_rootBoneName : "Unnamed skin";
1110
1145
  this.type = PObjectType.skin;
1111
1146
  //
1112
- this.parentItem = parentItem;
1113
- var _options_skeleton;
1114
- this.skeleton = (_options_skeleton = options.skeleton) != null ? _options_skeleton : -1;
1115
- this.jointList = options.joints;
1147
+ this.rootBoneItem = rootBoneItem;
1148
+ this.skeleton = -1;
1149
+ this.jointItem = this.getJointItems(props, rootBoneItem);
1116
1150
  this.animationMatrices = [];
1117
1151
  //
1118
1152
  this.inverseBindMatrices = [];
1119
1153
  //
1120
1154
  this.textureDataMode = this.getTextureDataMode(this.getJointCount(), engine);
1121
- var matList = options.inverseBindMatrices;
1155
+ var matList = props.inverseBindMatrices;
1122
1156
  if (matList !== undefined && matList.length > 0) {
1123
- if (matList.length % 16 !== 0 || matList.length !== this.jointList.length * 16) {
1124
- throw new Error("Invalid array length, invert bind matrices " + matList.length + ", joint array " + this.jointList.length);
1157
+ if (matList.length % 16 !== 0 || matList.length !== this.jointItem.length * 16) {
1158
+ throw new Error("Invalid array length, invert bind matrices " + matList.length + ", joint array " + this.jointItem.length);
1125
1159
  }
1126
1160
  var matrixCount = matList.length / 16;
1127
1161
  for(var i = 0; i < matrixCount; i++){
@@ -1134,26 +1168,17 @@ var TextureDataMode;
1134
1168
  * 更新蒙皮矩阵
1135
1169
  */ _proto.updateSkinMatrices = function updateSkinMatrices() {
1136
1170
  var _this = this;
1137
- var _this_parentItem;
1138
1171
  this.animationMatrices = [];
1139
- var parentTree = (_this_parentItem = this.parentItem) == null ? void 0 : _this_parentItem.getComponent(ModelTreeComponent);
1140
- if (parentTree !== undefined) {
1141
- for(var i = 0; i < this.jointList.length; i++){
1142
- var joint = this.jointList[i];
1143
- var node = parentTree.content.getNodeById(joint);
1144
- // let parent = node?.transform.parentTransform;
1145
- // while(parent !== undefined){
1146
- // const pos = parent.position;
1147
- // parent.setPosition(pos[0], pos[1], pos[2]);
1148
- // parent = parent.parentTransform;
1149
- // }
1150
- if (node === undefined) {
1151
- console.error("Can't find joint " + joint + " in node tree " + this.parentItem + ".");
1152
- break;
1153
- }
1154
- var mat4 = node.transform.getWorldMatrix();
1155
- this.animationMatrices.push(mat4.clone());
1156
- }
1172
+ for(var i = 0; i < this.jointItem.length; i++){
1173
+ var node = this.jointItem[i];
1174
+ // let parent = node?.transform.parentTransform;
1175
+ // while(parent !== undefined){
1176
+ // const pos = parent.position;
1177
+ // parent.setPosition(pos[0], pos[1], pos[2]);
1178
+ // parent = parent.parentTransform;
1179
+ // }
1180
+ var mat4 = node.transform.getWorldMatrix();
1181
+ this.animationMatrices.push(mat4.clone());
1157
1182
  }
1158
1183
  if (this.animationMatrices.length === this.inverseBindMatrices.length) {
1159
1184
  this.animationMatrices.forEach(function(mat, index) {
@@ -1188,13 +1213,13 @@ var TextureDataMode;
1188
1213
  * 更新父元素
1189
1214
  * @param parentItem - 场景树父元素
1190
1215
  */ _proto.updateParentItem = function updateParentItem(parentItem) {
1191
- this.parentItem = parentItem;
1216
+ this.rootBoneItem = parentItem;
1192
1217
  };
1193
1218
  /**
1194
1219
  * 获取关节点数
1195
1220
  * @returns
1196
1221
  */ _proto.getJointCount = function getJointCount() {
1197
- return this.jointList.length;
1222
+ return this.jointItem.length;
1198
1223
  };
1199
1224
  /**
1200
1225
  * 是否纹理数据模式
@@ -1205,8 +1230,8 @@ var TextureDataMode;
1205
1230
  /**
1206
1231
  * 销毁
1207
1232
  */ _proto.dispose = function dispose() {
1208
- this.parentItem = undefined;
1209
- this.jointList = [];
1233
+ this.rootBoneItem = undefined;
1234
+ this.jointItem = [];
1210
1235
  this.inverseBindMatrices = [];
1211
1236
  this.animationMatrices = [];
1212
1237
  };
@@ -1228,6 +1253,38 @@ var TextureDataMode;
1228
1253
  return 0;
1229
1254
  }
1230
1255
  };
1256
+ _proto.getJointItems = function getJointItems(props, rootBoneItem) {
1257
+ var _props_boneNames;
1258
+ var name2Item = this.genNodeName(rootBoneItem);
1259
+ var jointItems = [];
1260
+ (_props_boneNames = props.boneNames) == null ? void 0 : _props_boneNames.forEach(function(boneName) {
1261
+ var node = name2Item[boneName];
1262
+ if (!node) {
1263
+ throw new Error("Can't find node of bone name " + boneName);
1264
+ }
1265
+ jointItems.push(node);
1266
+ });
1267
+ return jointItems;
1268
+ };
1269
+ _proto.genNodeName = function genNodeName(node) {
1270
+ var name2Item = {};
1271
+ var nameList = [];
1272
+ name2Item[""] = node;
1273
+ for(var _iterator = _create_for_of_iterator_helper_loose(node.children), _step; !(_step = _iterator()).done;){
1274
+ var child = _step.value;
1275
+ this.genNodeNameDFS(child, nameList, name2Item);
1276
+ }
1277
+ return name2Item;
1278
+ };
1279
+ _proto.genNodeNameDFS = function genNodeNameDFS(node, nameList, name2Item) {
1280
+ nameList.push(node.name);
1281
+ name2Item[nameList.join("/")] = node;
1282
+ for(var _iterator = _create_for_of_iterator_helper_loose(node.children), _step; !(_step = _iterator()).done;){
1283
+ var child = _step.value;
1284
+ this.genNodeNameDFS(child, nameList, name2Item);
1285
+ }
1286
+ nameList.pop();
1287
+ };
1231
1288
  return PSkin;
1232
1289
  }(PObject);
1233
1290
  /**
@@ -1245,6 +1302,10 @@ var TextureDataMode;
1245
1302
  * 范围要在 `[0, 8]` 之间,否则会报错。
1246
1303
  */ _this.morphWeightsLength = 0;
1247
1304
  /**
1305
+ * weights 数组的具体数据,来自动画控制器的每帧更新
1306
+ * 数组的长度必须和 morphWeightsLength 相同,否则会出错。
1307
+ */ _this.morphWeightsArray = [];
1308
+ /**
1248
1309
  * 是否有 Position 相关的 Morph 动画,shader 中需要知道
1249
1310
  */ _this.hasPositionMorph = false;
1250
1311
  /**
@@ -1286,7 +1347,7 @@ var TextureDataMode;
1286
1347
  });
1287
1348
  if (this.morphWeightsLength > 0) {
1288
1349
  // 有Morph动画,申请weights数据,判断各个属性是否有相关动画
1289
- this.morphWeightsArray = new Float32Array(this.morphWeightsLength);
1350
+ this.morphWeightsArray = Array(this.morphWeightsLength).fill(0);
1290
1351
  this.hasPositionMorph = positionCount == this.morphWeightsLength;
1291
1352
  this.hasNormalMorph = normalCount == this.morphWeightsLength;
1292
1353
  this.hasTangentMorph = tangentCount == this.morphWeightsLength;
@@ -1313,14 +1374,11 @@ var TextureDataMode;
1313
1374
  }
1314
1375
  return true;
1315
1376
  };
1316
- _proto.dispose = function dispose() {
1317
- this.morphWeightsArray = undefined;
1318
- };
1319
1377
  /**
1320
1378
  * 初始化 Morph target 的权重数组
1321
1379
  * @param weights - glTF Mesh 的权重数组,长度必须严格一致
1322
1380
  */ _proto.initWeights = function initWeights(weights) {
1323
- if (this.morphWeightsArray === undefined) {
1381
+ if (this.morphWeightsArray.length === 0) {
1324
1382
  return;
1325
1383
  }
1326
1384
  var morphWeights = this.morphWeightsArray;
@@ -1330,6 +1388,16 @@ var TextureDataMode;
1330
1388
  }
1331
1389
  });
1332
1390
  };
1391
+ _proto.updateWeights = function updateWeights(weights) {
1392
+ var _this = this;
1393
+ if (weights.length != this.morphWeightsArray.length) {
1394
+ console.error("Length of morph weights mismatch: input " + weights.length + ", internel " + this.morphWeightsArray.length);
1395
+ return;
1396
+ }
1397
+ weights.forEach(function(value, index) {
1398
+ return _this.morphWeightsArray[index] = value;
1399
+ });
1400
+ };
1333
1401
  /**
1334
1402
  * 当前状态是否有 Morph 动画:
1335
1403
  * 需要判断 weights 数组长度,以及 Position、Normal 和 Tangent 是否有动画
@@ -2457,6 +2525,7 @@ function _assert_this_initialized(self) {
2457
2525
  _this.parentIndex = proxy.getParentIndex();
2458
2526
  _this.parentItem = proxy.parentItem;
2459
2527
  _this.parentItemId = parentId;
2528
+ _this.rootBoneItem = meshData.rootBone;
2460
2529
  _this.skin = proxy.getSkinObj(engine);
2461
2530
  _this.morph = proxy.getMorphObj();
2462
2531
  _this.hide = proxy.isHide();
@@ -2499,6 +2568,9 @@ function _assert_this_initialized(self) {
2499
2568
  */ _proto.update = function update() {
2500
2569
  if (this.owner !== undefined) {
2501
2570
  this.transform.fromEffectsTransform(this.owner.transform);
2571
+ if (this.morph && this.morph.hasMorph() && this.owner.morphWeights.length > 0) {
2572
+ this.morph.updateWeights(this.owner.morphWeights);
2573
+ }
2502
2574
  }
2503
2575
  };
2504
2576
  /**
@@ -3130,12 +3202,8 @@ function _assert_this_initialized(self) {
3130
3202
  // Morph 相关的数据更新,仅需要更新 weights 数组
3131
3203
  var morph = this.morph;
3132
3204
  if (morph !== undefined && morph.hasMorph()) {
3133
- var morphWeights = morph.morphWeightsArray;
3134
- var morphWeightNumbers = [];
3135
- morphWeights.forEach(function(val) {
3136
- return morphWeightNumbers.push(val);
3137
- });
3138
- material.setFloats("_morphWeights", morphWeightNumbers);
3205
+ var morphWeights = morph.morphWeightsArray.slice();
3206
+ material.setFloats("_morphWeights", morphWeights);
3139
3207
  }
3140
3208
  };
3141
3209
  _proto.updateUniformsByScene = function updateUniformsByScene(sceneStates) {
@@ -3386,7 +3454,18 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3386
3454
  this.itemData = itemData;
3387
3455
  this.parentItem = parentItem;
3388
3456
  this.data = itemData;
3389
- this.morphObj = new PMorph();
3457
+ this.geometry = itemData.geometry;
3458
+ this.rootBoneItem = itemData.rootBone;
3459
+ var morphObj = new PMorph();
3460
+ if (morphObj.create(this.geometry)) {
3461
+ var _itemData_morph;
3462
+ // 设置初始权重数组
3463
+ if ((_itemData_morph = itemData.morph) == null ? void 0 : _itemData_morph.weights) {
3464
+ var _itemData_morph1;
3465
+ morphObj.initWeights((_itemData_morph1 = itemData.morph) == null ? void 0 : _itemData_morph1.weights);
3466
+ }
3467
+ this.morphObj = morphObj;
3468
+ }
3390
3469
  }
3391
3470
  var _proto = EffectsMeshProxy.prototype;
3392
3471
  _proto.hasMorphTarget = function hasMorphTarget() {
@@ -3428,20 +3507,17 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3428
3507
  return this.data.materials.length;
3429
3508
  };
3430
3509
  _proto.hasSkin = function hasSkin() {
3431
- // FIXME: skin
3432
- //return this.options.skin !== undefined;
3433
- return false;
3510
+ var skin = this.geometry.getSkinProps();
3511
+ return !!(skin.rootBoneName && skin.boneNames && skin.inverseBindMatrices && this.rootBoneItem);
3434
3512
  };
3435
3513
  _proto.getSkinOpts = function getSkinOpts() {
3436
- // FIXME: skin
3437
- //return this.options.skin;
3438
- return;
3514
+ return this.geometry.getSkinProps();
3439
3515
  };
3440
3516
  _proto.getSkinObj = function getSkinObj(engine) {
3441
3517
  var skin = this.getSkinOpts();
3442
- if (skin !== undefined) {
3518
+ if (skin.rootBoneName && skin.boneNames && skin.inverseBindMatrices && this.rootBoneItem) {
3443
3519
  var skinObj = new PSkin();
3444
- skinObj.create(skin, engine, this.parentItem);
3520
+ skinObj.create(skin, engine, this.rootBoneItem);
3445
3521
  return skinObj;
3446
3522
  }
3447
3523
  return undefined;
@@ -3839,7 +3915,7 @@ var shadowPassFrag = "#define FEATURES\n#include <shadowCommon.vert.glsl>\n#incl
3839
3915
 
3840
3916
  var skyboxVert = "precision highp float;\n#define FEATURES\n#include <webglCompatibility.glsl>\nvsIn vec3 aPos;vsOut vec3 v_CameraDir;uniform mat4 _InvViewProjectionMatrix;void main(){vec4 dir=_InvViewProjectionMatrix*vec4(aPos.xy,1,1);v_CameraDir=normalize(dir.xyz/dir.w);gl_Position=vec4(aPos.xy,0.99999,1);}";
3841
3917
 
3842
- var skyboxFrag = "precision highp float;\n#define FEATURES\n#if !defined(WEBGL2) && defined(USE_TEX_LOD)\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#if !defined(WEBGL2)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#include <webglCompatibility.glsl>\n#include <extensions.frag.glsl>\n#ifdef WEBGL2\nout vec4 outFragColor;\n#else\n#define outFragColor gl_FragColor\n#endif\nuniform sampler2D _brdfLUT;uniform vec2 _IblIntensity;uniform int _MipCount;uniform samplerCube _DiffuseEnvSampler;uniform samplerCube _SpecularEnvSampler;fsIn vec3 v_CameraDir;\n#ifdef IRRADIANCE_COEFFICIENTS\nstruct SHCoefficients{vec3 l00,l1m1,l10,l11,l2m2,l2m1,l20,l21,l22;};uniform SHCoefficients _shCoefficients;vec3 getIrradiance(vec3 norm,SHCoefficients c){float x=norm.x;float y=norm.y;float z=norm.z;float c1=0.429043;float c2=0.511664;float c3=0.743125;float c4=0.886227;float c5=0.247708;vec3 irradiance=c1*c.l22*(x*x-y*y)+c3*c.l20*(z*z)+c4*c.l00-c5*c.l20+2.0*c1*(c.l2m2*x*y+c.l21*x*z+c.l2m1*y*z)+2.0*c2*(c.l11*x+c.l1m1*y+c.l10*z);return irradiance;}\n#endif\nvec3 getIBLContribution(vec3 n,vec3 v){const float metallic=0.9;const float perceptualRoughness=0.1;const vec4 baseColor=vec4(1.0);const vec3 f0=vec3(0.04);const vec3 diffuseColor=baseColor.rgb*(vec3(1.0)-f0)*(1.0-metallic);const vec3 specularColor=mix(f0,baseColor.rgb,metallic);float NdotV=clamp(dot(n,v),0.0,1.0);float lod=clamp(perceptualRoughness*float(_MipCount),0.0,float(_MipCount));vec3 reflection=normalize(reflect(-v,n));vec2 brdfSamplePoint=clamp(vec2(NdotV,perceptualRoughness),vec2(0.0,0.0),vec2(1.0,1.0));vec2 brdf=texture2D(_brdfLUT,brdfSamplePoint).rg;vec4 diffuseSample=vec4(1.0,0.0,0.0,1.0);\n#ifdef IRRADIANCE_COEFFICIENTS\nvec3 irradiance=getIrradiance(n,_shCoefficients);diffuseSample=vec4(irradiance,1.0);\n#else\ndiffuseSample=textureCube(_DiffuseEnvSampler,n);\n#endif\n#ifdef USE_TEX_LOD\nvec4 specularSample=_textureCubeLodEXT(_SpecularEnvSampler,reflection,lod);\n#else\nvec4 specularSample=textureCube(_SpecularEnvSampler,reflection,lod);\n#endif\nvec3 diffuseLight=diffuseSample.rgb;vec3 specularLight=specularSample.rgb;vec3 diffuse=diffuseLight*diffuseColor;vec3 specular=specularLight*(specularColor*brdf.x+brdf.y);return diffuse*_IblIntensity[0]+specular*_IblIntensity[1];}void main(){vec3 dir=normalize(v_CameraDir);outFragColor=vec4(getIBLContribution(dir,dir),1.0);}";
3918
+ var skyboxFrag = "\n#define FEATURES\n#if !defined(WEBGL2) && defined(USE_TEX_LOD)\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#if !defined(WEBGL2)\n#extension GL_OES_standard_derivatives : enable\n#endif\nprecision highp float;\n#include <webglCompatibility.glsl>\n#include <extensions.frag.glsl>\n#ifdef WEBGL2\nout vec4 outFragColor;\n#else\n#define outFragColor gl_FragColor\n#endif\nuniform sampler2D _brdfLUT;uniform vec2 _IblIntensity;uniform int _MipCount;uniform samplerCube _DiffuseEnvSampler;uniform samplerCube _SpecularEnvSampler;fsIn vec3 v_CameraDir;\n#ifdef IRRADIANCE_COEFFICIENTS\nstruct SHCoefficients{vec3 l00,l1m1,l10,l11,l2m2,l2m1,l20,l21,l22;};uniform SHCoefficients _shCoefficients;vec3 getIrradiance(vec3 norm,SHCoefficients c){float x=norm.x;float y=norm.y;float z=norm.z;float c1=0.429043;float c2=0.511664;float c3=0.743125;float c4=0.886227;float c5=0.247708;vec3 irradiance=c1*c.l22*(x*x-y*y)+c3*c.l20*(z*z)+c4*c.l00-c5*c.l20+2.0*c1*(c.l2m2*x*y+c.l21*x*z+c.l2m1*y*z)+2.0*c2*(c.l11*x+c.l1m1*y+c.l10*z);return irradiance;}\n#endif\nvec3 getIBLContribution(vec3 n,vec3 v){const float metallic=0.9;const float perceptualRoughness=0.1;const vec4 baseColor=vec4(1.0);const vec3 f0=vec3(0.04);const vec3 diffuseColor=baseColor.rgb*(vec3(1.0)-f0)*(1.0-metallic);const vec3 specularColor=mix(f0,baseColor.rgb,metallic);float NdotV=clamp(dot(n,v),0.0,1.0);float lod=clamp(perceptualRoughness*float(_MipCount),0.0,float(_MipCount));vec3 reflection=normalize(reflect(-v,n));vec2 brdfSamplePoint=clamp(vec2(NdotV,perceptualRoughness),vec2(0.0,0.0),vec2(1.0,1.0));vec2 brdf=texture2D(_brdfLUT,brdfSamplePoint).rg;vec4 diffuseSample=vec4(1.0,0.0,0.0,1.0);\n#ifdef IRRADIANCE_COEFFICIENTS\nvec3 irradiance=getIrradiance(n,_shCoefficients);diffuseSample=vec4(irradiance,1.0);\n#else\ndiffuseSample=textureCube(_DiffuseEnvSampler,n);\n#endif\n#ifdef USE_TEX_LOD\nvec4 specularSample=_textureCubeLodEXT(_SpecularEnvSampler,reflection,lod);\n#else\nvec4 specularSample=textureCube(_SpecularEnvSampler,reflection,lod);\n#endif\nvec3 diffuseLight=diffuseSample.rgb;vec3 specularLight=specularSample.rgb;vec3 diffuse=diffuseLight*diffuseColor;vec3 specular=specularLight*(specularColor*brdf.x+brdf.y);return diffuse*_IblIntensity[0]+specular*_IblIntensity[1];}void main(){vec3 dir=normalize(v_CameraDir);outFragColor=vec4(getIBLContribution(dir,dir),1.0);}";
3843
3919
 
3844
3920
  var animationVertGLSL = "#ifdef HAS_TARGET_POSITION0\nvsIn vec3 aTargetPosition0;\n#endif\n#ifdef HAS_TARGET_POSITION1\nvsIn vec3 aTargetPosition1;\n#endif\n#ifdef HAS_TARGET_POSITION2\nvsIn vec3 aTargetPosition2;\n#endif\n#ifdef HAS_TARGET_POSITION3\nvsIn vec3 aTargetPosition3;\n#endif\n#ifdef HAS_TARGET_POSITION4\nvsIn vec3 aTargetPosition4;\n#endif\n#ifdef HAS_TARGET_POSITION5\nvsIn vec3 aTargetPosition5;\n#endif\n#ifdef HAS_TARGET_POSITION6\nvsIn vec3 aTargetPosition6;\n#endif\n#ifdef HAS_TARGET_POSITION7\nvsIn vec3 aTargetPosition7;\n#endif\n#ifdef HAS_TARGET_NORMAL0\nvsIn vec3 aTargetNormal0;\n#endif\n#ifdef HAS_TARGET_NORMAL1\nvsIn vec3 aTargetNormal1;\n#endif\n#ifdef HAS_TARGET_NORMAL2\nvsIn vec3 aTargetNormal2;\n#endif\n#ifdef HAS_TARGET_NORMAL3\nvsIn vec3 aTargetNormal3;\n#endif\n#ifdef HAS_TARGET_NORMAL4\nvsIn vec3 aTargetNormal4;\n#endif\n#ifdef HAS_TARGET_TANGENT0\nvsIn vec3 aTargetTangent0;\n#endif\n#ifdef HAS_TARGET_TANGENT1\nvsIn vec3 aTargetTangent1;\n#endif\n#ifdef HAS_TARGET_TANGENT2\nvsIn vec3 aTargetTangent2;\n#endif\n#ifdef HAS_TARGET_TANGENT3\nvsIn vec3 aTargetTangent3;\n#endif\n#ifdef HAS_TARGET_TANGENT4\nvsIn vec3 aTargetTangent4;\n#endif\n#ifdef USE_MORPHING\nuniform float _morphWeights[WEIGHT_COUNT];\n#endif\n#ifdef HAS_JOINT_SET1\nvsIn vec4 aJoints;\n#endif\n#ifdef HAS_JOINT_SET2\nvsIn vec4 aJoint2;\n#endif\n#ifdef HAS_WEIGHT_SET1\nvsIn vec4 aWeights;\n#endif\n#ifdef HAS_WEIGHT_SET2\nvsIn vec4 aWeight2;\n#endif\n#ifdef USE_SKINNING\n#ifdef USE_SKINNING_TEXTURE\nuniform sampler2D _jointMatrixSampler;uniform sampler2D _jointNormalMatrixSampler;\n#else\nuniform mat4 _jointMatrix[JOINT_COUNT];uniform mat4 _jointNormalMatrix[JOINT_COUNT];\n#endif\n#endif\n#define ROW0_U ((0.5 + 0.0) / 4.0)\n#define ROW1_U ((0.5 + 1.0) / 4.0)\n#define ROW2_U ((0.5 + 2.0) / 4.0)\n#define ROW3_U ((0.5 + 3.0) / 4.0)\n#ifdef USE_SKINNING\nmat4 getJointMatrix(float boneNdx){\n#ifdef USE_SKINNING_TEXTURE\nfloat v=(boneNdx+0.5)/float(JOINT_COUNT);return mat4(texture2D(_jointMatrixSampler,vec2(ROW0_U,v)),texture2D(_jointMatrixSampler,vec2(ROW1_U,v)),texture2D(_jointMatrixSampler,vec2(ROW2_U,v)),texture2D(_jointMatrixSampler,vec2(ROW3_U,v)));\n#else\nreturn _jointMatrix[int(boneNdx)];\n#endif\n}mat4 getJointNormalMatrix(float boneNdx){\n#ifdef USE_SKINNING_TEXTURE\nfloat v=(boneNdx+0.5)/float(JOINT_COUNT);return mat4(texture2D(_jointNormalMatrixSampler,vec2(ROW0_U,v)),texture2D(_jointNormalMatrixSampler,vec2(ROW1_U,v)),texture2D(_jointNormalMatrixSampler,vec2(ROW2_U,v)),texture2D(_jointNormalMatrixSampler,vec2(ROW3_U,v)));\n#else\nreturn _jointNormalMatrix[int(boneNdx)];\n#endif\n}mat4 getSkinningMatrix(){mat4 skin=mat4(0);\n#if defined(HAS_WEIGHT_SET1) && defined(HAS_JOINT_SET1)\nskin+=aWeights.x*getJointMatrix(aJoints.x)+aWeights.y*getJointMatrix(aJoints.y)+aWeights.z*getJointMatrix(aJoints.z)+aWeights.w*getJointMatrix(aJoints.w);\n#endif\nreturn skin;}mat4 getSkinningNormalMatrix(){mat4 skin=mat4(0);\n#if defined(HAS_WEIGHT_SET1) && defined(HAS_JOINT_SET1)\nskin+=aWeights.x*getJointNormalMatrix(aJoints.x)+aWeights.y*getJointNormalMatrix(aJoints.y)+aWeights.z*getJointNormalMatrix(aJoints.z)+aWeights.w*getJointNormalMatrix(aJoints.w);\n#endif\nreturn skin;}\n#endif\n#ifdef USE_MORPHING\nvec4 getTargetPosition(){vec4 pos=vec4(0);\n#ifdef HAS_TARGET_POSITION0\npos.xyz+=_morphWeights[0]*aTargetPosition0;\n#endif\n#ifdef HAS_TARGET_POSITION1\npos.xyz+=_morphWeights[1]*aTargetPosition1;\n#endif\n#ifdef HAS_TARGET_POSITION2\npos.xyz+=_morphWeights[2]*aTargetPosition2;\n#endif\n#ifdef HAS_TARGET_POSITION3\npos.xyz+=_morphWeights[3]*aTargetPosition3;\n#endif\n#ifdef HAS_TARGET_POSITION4\npos.xyz+=_morphWeights[4]*aTargetPosition4;\n#endif\nreturn pos;}vec4 getTargetNormal(){vec4 normal=vec4(0);\n#ifdef HAS_TARGET_NORMAL0\nnormal.xyz+=_morphWeights[0]*aTargetNormal0;\n#endif\n#ifdef HAS_TARGET_NORMAL1\nnormal.xyz+=_morphWeights[1]*aTargetNormal1;\n#endif\n#ifdef HAS_TARGET_NORMAL2\nnormal.xyz+=_morphWeights[2]*aTargetNormal2;\n#endif\n#ifdef HAS_TARGET_NORMAL3\nnormal.xyz+=_morphWeights[3]*aTargetNormal3;\n#endif\n#ifdef HAS_TARGET_NORMAL4\nnormal.xyz+=_morphWeights[4]*aTargetNormal4;\n#endif\nreturn normal;}vec4 getTargetTangent(){vec4 tangent=vec4(0);\n#ifdef HAS_TARGET_TANGENT0\ntangent.xyz+=_morphWeights[0]*aTargetTangent0;\n#endif\n#ifdef HAS_TARGET_TANGENT1\ntangent.xyz+=_morphWeights[1]*aTargetTangent1;\n#endif\n#ifdef HAS_TARGET_TANGENT2\ntangent.xyz+=_morphWeights[2]*aTargetTangent2;\n#endif\n#ifdef HAS_TARGET_TANGENT3\ntangent.xyz+=_morphWeights[3]*aTargetTangent3;\n#endif\n#ifdef HAS_TARGET_TANGENT4\ntangent.xyz+=_morphWeights[4]*aTargetTangent4;\n#endif\nreturn tangent;}\n#endif\n";
3845
3921
 
@@ -4294,6 +4370,9 @@ var ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
4294
4370
  var _this;
4295
4371
  _this = RendererComponent.call(this, engine) || this;
4296
4372
  /**
4373
+ * morph 动画权重
4374
+ */ _this.morphWeights = [];
4375
+ /**
4297
4376
  * 获取点击测试参数,根据元素包围盒进行相交测试,Mesh 对象会进行更加精确的点击测试
4298
4377
  * @param force - 是否强制进行点击测试
4299
4378
  * @returns 点击测试参数
@@ -4610,7 +4689,6 @@ var ModelCameraComponent = /*#__PURE__*/ function(ItemBehaviour) {
4610
4689
  */ _proto.start = function start() {
4611
4690
  this.createContent();
4612
4691
  this.item.type = VFX_ITEM_TYPE_3D;
4613
- this.timeline = this.item.getComponent(TimelineComponent);
4614
4692
  var scene = getSceneManager(this);
4615
4693
  scene == null ? void 0 : scene.addItem(this.content);
4616
4694
  this.updateMainCamera();
@@ -4662,19 +4740,11 @@ var ModelCameraComponent = /*#__PURE__*/ function(ItemBehaviour) {
4662
4740
  * @param position - 位置
4663
4741
  * @param rotation - 旋转
4664
4742
  */ _proto.setTransform = function setTransform(position, rotation) {
4665
- var _this_timeline_findTrack, _this_timeline;
4666
- var clip = (_this_timeline = this.timeline) == null ? void 0 : (_this_timeline_findTrack = _this_timeline.findTrack("AnimationTrack")) == null ? void 0 : _this_timeline_findTrack.findClip("AnimationTimelineClip");
4667
- if (position !== undefined) {
4743
+ if (position) {
4668
4744
  this.transform.setPosition(position.x, position.y, position.z);
4669
- if (clip) {
4670
- clip.playable.originalTransform.position = position.clone();
4671
- }
4672
4745
  }
4673
- if (rotation !== undefined) {
4746
+ if (rotation) {
4674
4747
  this.transform.setRotation(rotation.x, rotation.y, rotation.z);
4675
- if (clip) {
4676
- clip.playable.originalTransform.rotation = rotation.clone();
4677
- }
4678
4748
  }
4679
4749
  this.updateMainCamera();
4680
4750
  };
@@ -4683,6 +4753,155 @@ var ModelCameraComponent = /*#__PURE__*/ function(ItemBehaviour) {
4683
4753
  ModelCameraComponent = __decorate([
4684
4754
  effectsClass(spec.DataType.CameraComponent)
4685
4755
  ], ModelCameraComponent);
4756
+ var AnimationComponent = /*#__PURE__*/ function(ItemBehaviour) {
4757
+ _inherits(AnimationComponent, ItemBehaviour);
4758
+ function AnimationComponent(engine) {
4759
+ var _this;
4760
+ _this = ItemBehaviour.call(this, engine) || this;
4761
+ _this.elapsedTime = 0;
4762
+ _this.animation = -1;
4763
+ _this.clips = [];
4764
+ return _this;
4765
+ }
4766
+ var _proto = AnimationComponent.prototype;
4767
+ /**
4768
+ * 组件开始,需要创建内部对象和添加到场景管理器中
4769
+ */ _proto.start = function start() {
4770
+ this.elapsedTime = 0;
4771
+ this.item.type = VFX_ITEM_TYPE_3D;
4772
+ };
4773
+ /**
4774
+ * 组件更新,更新内部对象状态
4775
+ * @param dt - 更新间隔
4776
+ */ _proto.update = function update(dt) {
4777
+ this.elapsedTime += dt * 0.001;
4778
+ if (this.animation >= 0 && this.animation < this.clips.length) {
4779
+ this.clips[this.animation].sampleAnimation(this.item, this.elapsedTime);
4780
+ }
4781
+ };
4782
+ /**
4783
+ * 组件销毁
4784
+ */ _proto.onDestroy = function onDestroy() {};
4785
+ /**
4786
+ * 反序列化,记录传入参数
4787
+ * @param data - 组件参数
4788
+ */ _proto.fromData = function fromData(data) {
4789
+ var _this = this;
4790
+ ItemBehaviour.prototype.fromData.call(this, data);
4791
+ this.data = data;
4792
+ var _data_name;
4793
+ //
4794
+ this.name = (_data_name = data.name) != null ? _data_name : "<empty>";
4795
+ var _data_animation;
4796
+ this.animation = (_data_animation = data.animation) != null ? _data_animation : -1;
4797
+ this.clips = [];
4798
+ data.animationClips.forEach(function(clipData) {
4799
+ var clipObj = new ModelAnimationClip(_this.engine);
4800
+ clipObj.setFromAnimationClip(clipData);
4801
+ _this.clips.push(clipObj);
4802
+ });
4803
+ };
4804
+ return AnimationComponent;
4805
+ }(ItemBehaviour);
4806
+ AnimationComponent = __decorate([
4807
+ effectsClass(spec.DataType.AnimationComponent)
4808
+ ], AnimationComponent);
4809
+ var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
4810
+ _inherits(ModelAnimationClip, AnimationClip);
4811
+ function ModelAnimationClip() {
4812
+ var _this;
4813
+ _this = AnimationClip.apply(this, arguments) || this;
4814
+ _this.path2Node = {};
4815
+ return _this;
4816
+ }
4817
+ var _proto = ModelAnimationClip.prototype;
4818
+ _proto.sampleAnimation = function sampleAnimation(vfxItem, time) {
4819
+ var duration = vfxItem.duration;
4820
+ var life = Math.max(0, time) % duration;
4821
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.positionCurves), _step; !(_step = _iterator()).done;){
4822
+ var curve = _step.value;
4823
+ var maxTime = curve.keyFrames.getMaxTime();
4824
+ var value = curve.keyFrames.getValue(life % maxTime);
4825
+ var target = this.getTargetItem(vfxItem, curve.path);
4826
+ target == null ? void 0 : target.transform.setPosition(value.x, value.y, value.z);
4827
+ }
4828
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(this.rotationCurves), _step1; !(_step1 = _iterator1()).done;){
4829
+ var curve1 = _step1.value;
4830
+ var maxTime1 = curve1.keyFrames.getMaxTime();
4831
+ var value1 = curve1.keyFrames.getValue(life % maxTime1);
4832
+ var target1 = this.getTargetItem(vfxItem, curve1.path);
4833
+ target1 == null ? void 0 : target1.transform.setQuaternion(value1.x, value1.y, value1.z, value1.w);
4834
+ }
4835
+ for(var _iterator2 = _create_for_of_iterator_helper_loose(this.scaleCurves), _step2; !(_step2 = _iterator2()).done;){
4836
+ var curve2 = _step2.value;
4837
+ var maxTime2 = curve2.keyFrames.getMaxTime();
4838
+ var value2 = curve2.keyFrames.getValue(life % maxTime2);
4839
+ var target2 = this.getTargetItem(vfxItem, curve2.path);
4840
+ target2 == null ? void 0 : target2.transform.setScale(value2.x, value2.y, value2.z);
4841
+ }
4842
+ for(var _iterator3 = _create_for_of_iterator_helper_loose(this.floatCurves), _step3; !(_step3 = _iterator3()).done;){
4843
+ var curve3 = _step3.value;
4844
+ var maxTime3 = curve3.keyFrames.getMaxTime();
4845
+ var value3 = curve3.keyFrames.getValue(life % maxTime3);
4846
+ var target3 = this.getTargetItem(vfxItem, curve3.path);
4847
+ if (curve3.className === "ModelMeshComponent") {
4848
+ var component = target3 == null ? void 0 : target3.getComponent(ModelMeshComponent);
4849
+ if (component) {
4850
+ var properties = curve3.property.split(".");
4851
+ setProperty(component, properties, value3);
4852
+ } else {
4853
+ console.error("Can't find mesh component");
4854
+ }
4855
+ } else {
4856
+ console.warn("Ignore curve: className " + curve3.className);
4857
+ }
4858
+ }
4859
+ };
4860
+ _proto.setFromAnimationClip = function setFromAnimationClip(clip) {
4861
+ this.positionCurves = clip.positionCurves.slice();
4862
+ this.rotationCurves = clip.rotationCurves.slice();
4863
+ this.scaleCurves = clip.scaleCurves.slice();
4864
+ this.floatCurves = clip.floatCurves.slice();
4865
+ };
4866
+ _proto.getTargetItem = function getTargetItem(rootItem, path) {
4867
+ if (this.path2Node[path]) {
4868
+ return this.path2Node[path];
4869
+ }
4870
+ var target = rootItem;
4871
+ var nameList = path.split("/");
4872
+ for(var _iterator = _create_for_of_iterator_helper_loose(nameList), _step; !(_step = _iterator()).done;){
4873
+ var name = _step.value;
4874
+ var findTag = false;
4875
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(target.children), _step1; !(_step1 = _iterator1()).done;){
4876
+ var child = _step1.value;
4877
+ if (child.name === name) {
4878
+ target = child;
4879
+ findTag = true;
4880
+ break;
4881
+ }
4882
+ }
4883
+ if (!findTag) {
4884
+ throw new Error("Can't find path in tree " + rootItem.id + ", " + path);
4885
+ }
4886
+ }
4887
+ this.path2Node[path] = target;
4888
+ return target;
4889
+ };
4890
+ return ModelAnimationClip;
4891
+ }(AnimationClip);
4892
+ function setProperty(obj, properties, value) {
4893
+ var len = properties.length;
4894
+ var current = obj;
4895
+ for(var i = 0; i < len - 1; i++){
4896
+ var propName = properties[i];
4897
+ if (!(propName in current) || typeof current[propName] !== "object") {
4898
+ console.error("Invalid properties " + properties);
4899
+ return;
4900
+ }
4901
+ current = current[propName];
4902
+ }
4903
+ current[properties[len - 1]] = value;
4904
+ }
4686
4905
 
4687
4906
  // 射线与带旋转的包围盒求交
4688
4907
  // function transformDirection (m: Matrix4, direction: Vector3) {
@@ -11785,44 +12004,9 @@ var GLTFHelper = /*#__PURE__*/ function() {
11785
12004
  return GLTFHelper;
11786
12005
  }();
11787
12006
 
11788
- function _array_like_to_array(arr, len) {
11789
- if (len == null || len > arr.length) len = arr.length;
11790
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
11791
- return arr2;
11792
- }
11793
-
11794
- function _unsupported_iterable_to_array(o, minLen) {
11795
- if (!o) return;
11796
- if (typeof o === "string") return _array_like_to_array(o, minLen);
11797
- var n = Object.prototype.toString.call(o).slice(8, -1);
11798
- if (n === "Object" && o.constructor) n = o.constructor.name;
11799
- if (n === "Map" || n === "Set") return Array.from(n);
11800
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
11801
- }
11802
-
11803
- function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
11804
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
11805
- if (it) return (it = it.call(o)).next.bind(it);
11806
- // Fallback for engines without symbol support
11807
- if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
11808
- if (it) o = it;
11809
- var i = 0;
11810
- return function() {
11811
- if (i >= o.length) return {
11812
- done: true
11813
- };
11814
- return {
11815
- done: false,
11816
- value: o[i++]
11817
- };
11818
- };
11819
- }
11820
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
11821
- }
11822
-
11823
12007
  var JSONConverter = /*#__PURE__*/ function() {
11824
12008
  function JSONConverter(player) {
11825
- this.treeItemList = [];
12009
+ this.treeInfo = new TreeInfo();
11826
12010
  this.engine = player.renderer.engine;
11827
12011
  this.renderer = player.renderer;
11828
12012
  this.downloader = new Downloader();
@@ -11891,7 +12075,7 @@ var JSONConverter = /*#__PURE__*/ function() {
11891
12075
  case 7:
11892
12076
  // @ts-expect-error
11893
12077
  oldScene.bins = binFiles;
11894
- newScene = {
12078
+ newScene = _extends({}, oldScene, {
11895
12079
  version: "3.0",
11896
12080
  playerVersion: {
11897
12081
  web: "3.0",
@@ -11899,18 +12083,14 @@ var JSONConverter = /*#__PURE__*/ function() {
11899
12083
  },
11900
12084
  type: "ge",
11901
12085
  compositions: [],
11902
- compositionId: oldScene.compositionId,
11903
12086
  images: [],
11904
- shapes: oldScene.shapes,
11905
- plugins: oldScene.plugins,
11906
12087
  textures: [],
11907
12088
  items: [],
11908
12089
  components: [],
11909
12090
  materials: [],
11910
12091
  shaders: [],
11911
12092
  geometries: []
11912
- };
11913
- _this.treeItemList = [];
12093
+ });
11914
12094
  _this.setImage(newScene, oldScene);
11915
12095
  return [
11916
12096
  4,
@@ -12041,8 +12221,6 @@ var JSONConverter = /*#__PURE__*/ function() {
12041
12221
  var comp = _step.value;
12042
12222
  if (comp.dataType === spec.DataType.SkyboxComponent) {
12043
12223
  newComponents.push(this.createSkyboxComponent(comp, newScene));
12044
- } else if (comp.dataType === spec.DataType.MeshComponent) {
12045
- newComponents.push(this.createMeshComponent(comp, newScene, oldScene));
12046
12224
  } else if (comp.dataType === spec.DataType.LightComponent) {
12047
12225
  newComponents.push(this.createLightComponent(comp, newScene));
12048
12226
  } else if (comp.dataType === spec.DataType.CameraComponent) {
@@ -12054,16 +12232,22 @@ var JSONConverter = /*#__PURE__*/ function() {
12054
12232
  treeComp.options.tree.animation = undefined;
12055
12233
  treeComp.options.tree.animations = undefined;
12056
12234
  newComponents.push(comp);
12057
- } else {
12235
+ } else if (comp.dataType !== spec.DataType.MeshComponent) {
12058
12236
  newComponents.push(comp);
12059
12237
  }
12060
12238
  }
12239
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(oldScene.components), _step1; !(_step1 = _iterator1()).done;){
12240
+ var comp1 = _step1.value;
12241
+ if (comp1.dataType === spec.DataType.MeshComponent) {
12242
+ newComponents.push(this.createMeshComponent(comp1, newScene, oldScene));
12243
+ }
12244
+ }
12061
12245
  };
12062
12246
  _proto.setItem = function setItem(newScene, oldScene) {};
12063
12247
  _proto.setComposition = function setComposition(newScene, oldScene) {
12064
12248
  var _newScene_items;
12065
12249
  newScene.items = oldScene.items;
12066
- (_newScene_items = newScene.items).push.apply(_newScene_items, [].concat(this.treeItemList));
12250
+ (_newScene_items = newScene.items).push.apply(_newScene_items, [].concat(this.treeInfo.getAllTreeNodeList()));
12067
12251
  newScene.compositionId = oldScene.compositionId;
12068
12252
  newScene.compositions = oldScene.compositions;
12069
12253
  newScene.items.forEach(function(item) {
@@ -12202,16 +12386,38 @@ var JSONConverter = /*#__PURE__*/ function() {
12202
12386
  id: mat.id
12203
12387
  };
12204
12388
  return data;
12205
- }),
12206
- rootBone: {
12207
- id: ""
12208
- }
12389
+ })
12209
12390
  };
12391
+ if (meshOptions.skin) {
12392
+ var parentItemId = component.item.id;
12393
+ for(var _iterator = _create_for_of_iterator_helper_loose(oldScene.items), _step; !(_step = _iterator()).done;){
12394
+ var item = _step.value;
12395
+ if (item.id === component.item.id) {
12396
+ parentItemId = item.parentId;
12397
+ }
12398
+ }
12399
+ if (parentItemId === component.item.id) {
12400
+ throw new Error("Can't item " + component.item);
12401
+ }
12402
+ var treeItem = this.treeInfo.getTreeItemByNodeId(parentItemId);
12403
+ var treeNodeList = this.treeInfo.getTreeNodeListByNodeId(parentItemId);
12404
+ if (!treeItem || !treeNodeList) {
12405
+ throw new Error("Can't find tree node list for " + component.item);
12406
+ }
12407
+ var rootBoneItem = this.setupBoneData(geometryData, meshOptions.skin, oldScene, treeItem, treeNodeList);
12408
+ meshComponent.rootBone = {
12409
+ id: rootBoneItem.id
12410
+ };
12411
+ }
12412
+ if (meshOptions.weights !== undefined) {
12413
+ meshComponent.morph = {
12414
+ weights: meshOptions.weights
12415
+ };
12416
+ }
12210
12417
  return meshComponent;
12211
12418
  };
12212
12419
  _proto.createItemsFromTreeComponent = function createItemsFromTreeComponent(component, newScene, oldScene) {
12213
12420
  var _this = this;
12214
- var _this_treeItemList;
12215
12421
  var treeItem = oldScene.items[0];
12216
12422
  oldScene.items.forEach(function(item) {
12217
12423
  if (item.id === component.item.id) {
@@ -12220,13 +12426,13 @@ var JSONConverter = /*#__PURE__*/ function() {
12220
12426
  });
12221
12427
  var treeComp = component;
12222
12428
  var treeData = treeComp.options.tree;
12223
- var treeItemList = [];
12224
- treeData.nodes.forEach(function(node) {
12429
+ var treeNodeList = [];
12430
+ treeData.nodes.forEach(function(node, index) {
12225
12431
  var _node_name;
12226
12432
  var item = {
12227
12433
  id: generateGUID(),
12228
12434
  parentId: treeItem.id,
12229
- name: (_node_name = node.name) != null ? _node_name : "<unnamed>",
12435
+ name: (_node_name = node.name) != null ? _node_name : "node" + index,
12230
12436
  duration: treeItem.duration,
12231
12437
  // @ts-expect-error
12232
12438
  type: "ECS",
@@ -12241,14 +12447,14 @@ var JSONConverter = /*#__PURE__*/ function() {
12241
12447
  transform: _this.getTransformData(node.transform),
12242
12448
  components: []
12243
12449
  };
12244
- treeItemList.push(item);
12450
+ treeNodeList.push(item);
12245
12451
  newScene.items.push(item);
12246
12452
  });
12247
12453
  treeData.nodes.forEach(function(node, index) {
12248
12454
  var _node_children;
12249
- var item = treeItemList[index];
12455
+ var item = treeNodeList[index];
12250
12456
  (_node_children = node.children) == null ? void 0 : _node_children.forEach(function(child) {
12251
- var childItem = treeItemList[child];
12457
+ var childItem = treeNodeList[child];
12252
12458
  childItem.parentId = item.id;
12253
12459
  });
12254
12460
  });
@@ -12259,12 +12465,13 @@ var JSONConverter = /*#__PURE__*/ function() {
12259
12465
  var parentId = item.parentId.substring(0, index);
12260
12466
  var subIndex = +item.parentId.substring(index + 1);
12261
12467
  if (parentId === treeItem.id) {
12262
- item.parentId = treeItemList[subIndex].id;
12468
+ item.parentId = treeNodeList[subIndex].id;
12263
12469
  }
12264
12470
  }
12265
12471
  }
12266
12472
  });
12267
- (_this_treeItemList = this.treeItemList).push.apply(_this_treeItemList, [].concat(treeItemList));
12473
+ this.treeInfo.add(treeItem, treeNodeList);
12474
+ this.createAnimationComponent(treeData, treeItem, newScene, oldScene);
12268
12475
  };
12269
12476
  _proto.createLightComponent = function createLightComponent(component, scene) {
12270
12477
  var lightOptions = component.options;
@@ -12290,6 +12497,186 @@ var JSONConverter = /*#__PURE__*/ function() {
12290
12497
  }
12291
12498
  return lightComponent;
12292
12499
  };
12500
+ _proto.createAnimationComponent = function createAnimationComponent(treeOptions, treeItem, newScene, oldScene) {
12501
+ var _this = this;
12502
+ var animation = treeOptions.animation, animations = treeOptions.animations;
12503
+ var animationComponent = {
12504
+ id: generateGUID(),
12505
+ dataType: spec.DataType.AnimationComponent,
12506
+ item: {
12507
+ id: treeItem.id
12508
+ },
12509
+ animation: animation,
12510
+ animationClips: []
12511
+ };
12512
+ if (animations && animations.length) {
12513
+ // FIXME: calcuate tree item duration
12514
+ var bins = oldScene.bins;
12515
+ animations.forEach(function(anim) {
12516
+ var clipData = {
12517
+ id: generateGUID(),
12518
+ name: anim.name,
12519
+ dataType: spec.DataType.AnimationClip,
12520
+ positionCurves: [],
12521
+ rotationCurves: [],
12522
+ scaleCurves: [],
12523
+ floatCurves: []
12524
+ };
12525
+ var totalAnimationTime = 0;
12526
+ anim.tracks.forEach(function(track) {
12527
+ var inputArray = typedArrayFromBinary(bins, track.input);
12528
+ totalAnimationTime = Math.max(totalAnimationTime, inputArray[inputArray.length - 1]);
12529
+ });
12530
+ anim.tracks.forEach(function(track) {
12531
+ var inputArray = typedArrayFromBinary(bins, track.input);
12532
+ var outputArray = typedArrayFromBinary(bins, track.output);
12533
+ if (!_instanceof1(inputArray, Float32Array)) {
12534
+ throw new Error("Type of inputArray should be float32, " + inputArray);
12535
+ }
12536
+ if (!_instanceof1(outputArray, Float32Array)) {
12537
+ throw new Error("Type of outputArray should be float32, " + outputArray);
12538
+ }
12539
+ if (track.interpolation !== "LINEAR") {
12540
+ throw new Error("Invalid interpolation type " + track.interpolation);
12541
+ }
12542
+ if (track.path === "rotation") {
12543
+ var points = [];
12544
+ var controlPoints = [];
12545
+ var lineValue = [];
12546
+ for(var i = 0; i < inputArray.length; i++){
12547
+ points.push([
12548
+ outputArray[i * 4],
12549
+ outputArray[i * 4 + 1],
12550
+ outputArray[i * 4 + 2],
12551
+ outputArray[i * 4 + 3]
12552
+ ]);
12553
+ if (i > 0) {
12554
+ var p0 = Quaternion.fromArray(points[i - 1]);
12555
+ var p3 = Quaternion.fromArray(points[i]);
12556
+ var p1 = new Quaternion();
12557
+ var p2 = new Quaternion();
12558
+ p1.slerpQuaternions(p0, p3, 1 / 3);
12559
+ p2.slerpQuaternions(p0, p3, 2 / 3);
12560
+ controlPoints.push(p1.toArray());
12561
+ controlPoints.push(p2.toArray());
12562
+ }
12563
+ lineValue.push([
12564
+ spec.BezierKeyframeType.LINE,
12565
+ [
12566
+ inputArray[i],
12567
+ i
12568
+ ]
12569
+ ]);
12570
+ }
12571
+ var node = _this.treeInfo.getTreeNode(treeItem.id, track.node);
12572
+ var path = _this.treeInfo.getNodePath(node.id);
12573
+ var keyFrames = [
12574
+ spec.ValueType.BEZIER_CURVE_QUAT,
12575
+ [
12576
+ lineValue,
12577
+ points,
12578
+ controlPoints
12579
+ ]
12580
+ ];
12581
+ clipData.rotationCurves.push({
12582
+ path: path,
12583
+ keyFrames: keyFrames
12584
+ });
12585
+ } else if (track.path === "weights") {
12586
+ var node1 = _this.treeInfo.getTreeNode(treeItem.id, track.node);
12587
+ var path1 = _this.treeInfo.getNodePath(node1.id);
12588
+ if (node1.components.length === 0) {
12589
+ for(var i1 = 0; i1 < oldScene.items.length; i1++){
12590
+ var child = oldScene.items[i1];
12591
+ if (child.parentId === node1.id) {
12592
+ path1 += "/" + child.name;
12593
+ break;
12594
+ }
12595
+ }
12596
+ }
12597
+ var component = outputArray.length / inputArray.length;
12598
+ for(var c = 0; c < component; c++){
12599
+ var lineValue1 = [];
12600
+ for(var i2 = 0; i2 < inputArray.length; i2++){
12601
+ lineValue1.push([
12602
+ spec.BezierKeyframeType.LINE,
12603
+ [
12604
+ inputArray[i2],
12605
+ outputArray[i2 * component + c]
12606
+ ]
12607
+ ]);
12608
+ }
12609
+ var keyFrames1 = [
12610
+ spec.ValueType.BEZIER_CURVE,
12611
+ lineValue1
12612
+ ];
12613
+ clipData.floatCurves.push({
12614
+ path: path1,
12615
+ className: "ModelMeshComponent",
12616
+ property: "morphWeights." + c,
12617
+ keyFrames: keyFrames1
12618
+ });
12619
+ }
12620
+ } else {
12621
+ var points1 = [];
12622
+ var controlPoints1 = [];
12623
+ var lineValue2 = [];
12624
+ for(var i3 = 0; i3 < inputArray.length; i3++){
12625
+ points1.push([
12626
+ outputArray[i3 * 3],
12627
+ outputArray[i3 * 3 + 1],
12628
+ outputArray[i3 * 3 + 2]
12629
+ ]);
12630
+ if (i3 > 0) {
12631
+ var p01 = Vector3.fromArray(points1[i3 - 1]);
12632
+ var p31 = Vector3.fromArray(points1[i3]);
12633
+ var p11 = new Vector3().lerpVectors(p01, p31, 1 / 3);
12634
+ var p21 = new Vector3().lerpVectors(p01, p31, 2 / 3);
12635
+ controlPoints1.push(p11.toArray());
12636
+ controlPoints1.push(p21.toArray());
12637
+ }
12638
+ lineValue2.push([
12639
+ spec.BezierKeyframeType.LINE,
12640
+ [
12641
+ inputArray[i3],
12642
+ i3
12643
+ ]
12644
+ ]);
12645
+ }
12646
+ var node2 = _this.treeInfo.getTreeNode(treeItem.id, track.node);
12647
+ var path2 = _this.treeInfo.getNodePath(node2.id);
12648
+ var keyFrames2 = [
12649
+ spec.ValueType.BEZIER_CURVE_PATH,
12650
+ [
12651
+ lineValue2,
12652
+ points1,
12653
+ controlPoints1
12654
+ ]
12655
+ ];
12656
+ if (track.path === "translation") {
12657
+ clipData.positionCurves.push({
12658
+ path: path2,
12659
+ keyFrames: keyFrames2
12660
+ });
12661
+ } else {
12662
+ clipData.scaleCurves.push({
12663
+ path: path2,
12664
+ keyFrames: keyFrames2
12665
+ });
12666
+ }
12667
+ }
12668
+ });
12669
+ newScene.animations.push(clipData);
12670
+ animationComponent.animationClips.push({
12671
+ id: clipData.id
12672
+ });
12673
+ });
12674
+ }
12675
+ treeItem.components.push({
12676
+ id: animationComponent.id
12677
+ });
12678
+ newScene.components.push(animationComponent);
12679
+ };
12293
12680
  _proto.getMaterialData = function getMaterialData(material, scene) {
12294
12681
  if (material.type === spec.MaterialType.unlit) {
12295
12682
  var floats = {};
@@ -12310,7 +12697,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12310
12697
  shader: {
12311
12698
  id: UnlitShaderGUID
12312
12699
  },
12313
- stringTags: this.getStringTags(material),
12700
+ stringTags: {},
12314
12701
  macros: [],
12315
12702
  ints: {},
12316
12703
  floats: floats,
@@ -12318,6 +12705,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12318
12705
  colors: colors,
12319
12706
  textures: textures
12320
12707
  };
12708
+ this.setupMaterial(material, newMaterial);
12321
12709
  return newMaterial;
12322
12710
  } else {
12323
12711
  var floats1 = {
@@ -12366,7 +12754,7 @@ var JSONConverter = /*#__PURE__*/ function() {
12366
12754
  shader: {
12367
12755
  id: PBRShaderGUID
12368
12756
  },
12369
- stringTags: this.getStringTags(material),
12757
+ stringTags: {},
12370
12758
  macros: [],
12371
12759
  ints: {},
12372
12760
  floats: floats1,
@@ -12374,29 +12762,39 @@ var JSONConverter = /*#__PURE__*/ function() {
12374
12762
  colors: colors1,
12375
12763
  textures: textures1
12376
12764
  };
12765
+ this.setupMaterial(material, newMaterial1);
12377
12766
  return newMaterial1;
12378
12767
  }
12379
12768
  };
12380
- _proto.getStringTags = function getStringTags(material) {
12381
- var stringTags = {};
12382
- var _material_depthMask;
12383
- stringTags["ZWrite"] = String((_material_depthMask = material.depthMask) != null ? _material_depthMask : true);
12384
- stringTags["ZTest"] = String(true);
12385
- if (material.blending === spec.MaterialBlending.masked) {
12386
- stringTags["RenderType"] = RenderType.Mask;
12387
- } else if (material.blending === spec.MaterialBlending.translucent) {
12388
- stringTags["RenderType"] = RenderType.Blend;
12769
+ _proto.setupMaterial = function setupMaterial(oldMat, newMat) {
12770
+ if (oldMat.blending === spec.MaterialBlending.translucent) {
12771
+ newMat.stringTags["RenderType"] = spec.RenderType.Transparent;
12389
12772
  } else {
12390
- stringTags["RenderType"] = RenderType.Opaque;
12773
+ newMat.stringTags["RenderType"] = spec.RenderType.Opaque;
12391
12774
  }
12392
- if (material.side === spec.SideMode.BACK) {
12393
- stringTags["Cull"] = CullMode.Back;
12394
- } else if (material.side === spec.SideMode.DOUBLE) {
12395
- stringTags["Cull"] = CullMode.Double;
12775
+ if (oldMat.blending === spec.MaterialBlending.masked) {
12776
+ newMat.floats["AlphaClip"] = 1;
12777
+ var _oldMat_alphaCutOff;
12778
+ newMat.floats["_Cutoff"] = (_oldMat_alphaCutOff = oldMat.alphaCutOff) != null ? _oldMat_alphaCutOff : 0;
12396
12779
  } else {
12397
- stringTags["Cull"] = CullMode.Front;
12780
+ newMat.floats["AlphaClip"] = 0;
12398
12781
  }
12399
- return stringTags;
12782
+ switch(oldMat.side){
12783
+ case spec.SideMode.BACK:
12784
+ newMat.stringTags["RenderFace"] = spec.RenderFace.Back;
12785
+ break;
12786
+ case spec.SideMode.DOUBLE:
12787
+ newMat.stringTags["RenderFace"] = spec.RenderFace.Both;
12788
+ break;
12789
+ default:
12790
+ newMat.stringTags["RenderFace"] = spec.RenderFace.Front;
12791
+ }
12792
+ if (oldMat.type === spec.MaterialType.pbr) {
12793
+ newMat.floats["_SpecularAA"] = oldMat.useSpecularAA ? 1 : 0;
12794
+ }
12795
+ var _oldMat_depthMask;
12796
+ newMat.stringTags["ZWrite"] = String((_oldMat_depthMask = oldMat.depthMask) != null ? _oldMat_depthMask : true);
12797
+ newMat.stringTags["ZTest"] = String(true);
12400
12798
  };
12401
12799
  _proto.getTextureData = function getTextureData(scene, floats, texIndex, texTransform) {
12402
12800
  var _scene_textures_texIndex_id;
@@ -12471,8 +12869,121 @@ var JSONConverter = /*#__PURE__*/ function() {
12471
12869
  }
12472
12870
  return result;
12473
12871
  };
12872
+ _proto.setupBoneData = function setupBoneData(geom, skin, oldScene, treeItem, treeNodeList) {
12873
+ var bins = oldScene.bins;
12874
+ var joints = skin.joints, skeleton = skin.skeleton, inverseBindMatrices = skin.inverseBindMatrices;
12875
+ if (!inverseBindMatrices) {
12876
+ throw new Error("inverseBindMatrices is undefined " + skin);
12877
+ }
12878
+ var bindMatrixArray = typedArrayFromBinary(bins, inverseBindMatrices);
12879
+ geom.inverseBindMatrices = Array.from(bindMatrixArray);
12880
+ var id2Node = {};
12881
+ var rootBoneItem = treeItem;
12882
+ if (skeleton !== undefined) {
12883
+ rootBoneItem = treeNodeList[skeleton];
12884
+ } else {
12885
+ console.warn("Root bone is missing");
12886
+ }
12887
+ joints.forEach(function(joint) {
12888
+ var node = treeNodeList[joint];
12889
+ if (node !== rootBoneItem && node.parentId === rootBoneItem.parentId) {
12890
+ console.error("Find invalid node for rootBoneItem and adjust rootBoneItem");
12891
+ rootBoneItem = treeItem;
12892
+ }
12893
+ });
12894
+ treeNodeList.forEach(function(node) {
12895
+ id2Node[node.id] = node;
12896
+ });
12897
+ geom.rootBoneName = rootBoneItem.name;
12898
+ var boneNames = [];
12899
+ joints.forEach(function(joint) {
12900
+ var currentItem = treeNodeList[joint];
12901
+ var nodeList = [];
12902
+ while(currentItem && currentItem != rootBoneItem){
12903
+ nodeList.push(currentItem.name);
12904
+ if (currentItem.parentId) {
12905
+ currentItem = id2Node[currentItem.parentId];
12906
+ } else {
12907
+ break;
12908
+ }
12909
+ }
12910
+ boneNames.push(nodeList.reverse().join("/"));
12911
+ });
12912
+ geom.boneNames = boneNames;
12913
+ return rootBoneItem;
12914
+ };
12474
12915
  return JSONConverter;
12475
12916
  }();
12917
+ var TreeInfo = /*#__PURE__*/ function() {
12918
+ function TreeInfo() {
12919
+ this.tree2NodeList = {};
12920
+ this.nodeList2Tree = {};
12921
+ this.nodeId2Node = {};
12922
+ this.node2Path = {};
12923
+ }
12924
+ var _proto = TreeInfo.prototype;
12925
+ _proto.add = function add(treeItem, treeNodeList) {
12926
+ var _this = this;
12927
+ if (this.tree2NodeList[treeItem.id]) {
12928
+ throw new Error("Find duplicate treeItem id: " + treeItem.id);
12929
+ }
12930
+ this.tree2NodeList[treeItem.id] = treeNodeList;
12931
+ treeNodeList.forEach(function(node) {
12932
+ if (_this.nodeList2Tree[node.id]) {
12933
+ throw new Error("Find duplicate tree node id: " + node.id);
12934
+ }
12935
+ _this.nodeList2Tree[node.id] = treeItem;
12936
+ _this.nodeId2Node[node.id] = node;
12937
+ });
12938
+ treeNodeList.forEach(function(node) {
12939
+ _this.setNodePath(node);
12940
+ });
12941
+ };
12942
+ _proto.setNodePath = function setNodePath(node) {
12943
+ if (node.parentId) {
12944
+ if (this.node2Path[node.parentId]) {
12945
+ this.node2Path[node.id] = this.node2Path[node.parentId] + "/" + node.name;
12946
+ } else if (this.nodeId2Node[node.parentId]) {
12947
+ this.setNodePath(this.nodeId2Node[node.parentId]);
12948
+ this.node2Path[node.id] = this.node2Path[node.parentId] + "/" + node.name;
12949
+ } else {
12950
+ this.node2Path[node.id] = node.name;
12951
+ }
12952
+ } else {
12953
+ this.node2Path[node.id] = node.name;
12954
+ }
12955
+ };
12956
+ _proto.getTreeNodeListByTreeId = function getTreeNodeListByTreeId(id) {
12957
+ return this.tree2NodeList[id];
12958
+ };
12959
+ _proto.getTreeNodeListByNodeId = function getTreeNodeListByNodeId(id) {
12960
+ var treeItem = this.nodeList2Tree[id];
12961
+ if (!treeItem) {
12962
+ throw new Error("Invalid id " + id);
12963
+ }
12964
+ return this.getTreeNodeListByTreeId(treeItem.id);
12965
+ };
12966
+ _proto.getTreeItemByNodeId = function getTreeItemByNodeId(id) {
12967
+ return this.nodeList2Tree[id];
12968
+ };
12969
+ _proto.getTreeNode = function getTreeNode(treeId, nodeIndex) {
12970
+ var nodeList = this.getTreeNodeListByTreeId(treeId);
12971
+ return nodeList[nodeIndex];
12972
+ };
12973
+ _proto.getAllTreeNodeList = function getAllTreeNodeList() {
12974
+ var _this = this;
12975
+ var nodeList = [];
12976
+ Object.keys(this.tree2NodeList).forEach(function(key) {
12977
+ var _nodeList;
12978
+ (_nodeList = nodeList).push.apply(_nodeList, [].concat(_this.tree2NodeList[key]));
12979
+ });
12980
+ return nodeList;
12981
+ };
12982
+ _proto.getNodePath = function getNodePath(id) {
12983
+ return this.node2Path[id];
12984
+ };
12985
+ return TreeInfo;
12986
+ }();
12476
12987
  function getGeometryDataFromOptions(geomOptions) {
12477
12988
  var vertexCount = 0;
12478
12989
  var verticesType = spec.VertexFormatType.Float32;
@@ -12585,7 +13096,8 @@ function getGeometryDataFromPropsList(geomPropsList) {
12585
13096
  var scale = (_geomPropsList__indices_data_BYTES_PER_ELEMENT = (_geomPropsList__indices = geomPropsList[0].indices) == null ? void 0 : _geomPropsList__indices.data.BYTES_PER_ELEMENT) != null ? _geomPropsList__indices_data_BYTES_PER_ELEMENT : 1;
12586
13097
  subMeshes.push({
12587
13098
  offset: offset * scale,
12588
- count: count
13099
+ indexCount: count,
13100
+ vertexCount: count
12589
13101
  });
12590
13102
  if (i) {
12591
13103
  var geom0 = geomPropsList[0];
@@ -12832,7 +13344,9 @@ var vertexBufferSemanticMap = {
12832
13344
  a_Tangent: "TANGENT",
12833
13345
  a_Color: "COLOR",
12834
13346
  a_Joints: "JOINTS",
13347
+ a_Joint1: "JOINTS",
12835
13348
  a_Weights: "WEIGHTS",
13349
+ a_Weight1: "WEIGHTS",
12836
13350
  //
12837
13351
  a_Target_Position0: "POSITION_BS0",
12838
13352
  a_Target_Position1: "POSITION_BS1",
@@ -12854,8 +13368,11 @@ var vertexBufferSemanticMap = {
12854
13368
 
12855
13369
  registerPlugin("tree", ModelTreePlugin, VFXItem, true);
12856
13370
  registerPlugin("model", ModelPlugin, VFXItem);
12857
- var version = "2.0.0-alpha.12";
13371
+ var version = "2.0.0-alpha.13";
12858
13372
  logger.info("plugin model version: " + version);
13373
+ if (version !== version$1) {
13374
+ 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!");
13375
+ }
12859
13376
 
12860
- export { BoxMesh, CameraGestureHandlerImp, CameraGestureType, CheckerHelper, CompositionCache, CompositionHitTest, CullMode, FBOOptions, Float16ArrayWrapper, GeometryBoxProxy, HitTestingProxy, HookOGLFunc, InterpolationSampler, JSONConverter, LoaderHelper, LoaderImpl, MeshHelper, ModelCameraComponent, ModelLightComponent, ModelMeshComponent, ModelPlugin, ModelPluginComponent, ModelSkyboxComponent, ModelTreeComponent, ModelTreeItem, ModelTreePlugin, PAnimInterpType, PAnimPathType, PAnimTexture, PAnimTrack, PAnimation, PAnimationManager, PBRShaderGUID, PBlendMode, PCamera, PCameraManager, PCoordinate, PEntity, PFaceSideMode, PGeometry, PGlobalState, PLight, PLightManager, PLightType, PMaterialBase, PMaterialPBR, PMaterialSkyboxFilter, PMaterialType, PMaterialUnlit, PMesh, PMorph, PObject, PObjectType, PSceneManager, PShaderManager, PShadowType, PSkin, PSkybox, PSkyboxCreator, PSkyboxType, PSubMesh, PTextureType, PTransform, PluginHelper, RayBoxTesting, RayIntersectsBoxWithRotation, RayTriangleTesting, RenderType, TextureDataMode, ToggleItemBounding, TwoStatesSet, UnlitShaderGUID, VFX_ITEM_TYPE_3D, VertexAttribBuffer, WebGLHelper, WebHelper, createAnimationSampler, createPluginMaterial, fetchPBRShaderCode, fetchUnlitShaderCode, getDefaultEffectsGLTFLoader, getDiffuseOnlyShaderCode, getGaussianBlurShaderCodeV1, getGaussianBlurShaderCodeV2, getGeometryDataFromOptions, getGeometryDataFromPropsList, getKawaseBlurShaderCode, getNormalVisShaderCode, getPBRPassShaderCode, getPMeshList, getQuadFilterShaderCode, getRendererGPUInfo, getSceneManager, getShadowPassShaderCode, getSimpleFilterShaderCode, getSkyBoxShaderCode, getTransparecyBaseShader, getTransparecyFilterShader, setDefaultEffectsGLTFLoader, version };
13377
+ export { AnimationComponent, BoxMesh, CameraGestureHandlerImp, CameraGestureType, CheckerHelper, CompositionCache, CompositionHitTest, CullMode, FBOOptions, Float16ArrayWrapper, GeometryBoxProxy, HitTestingProxy, HookOGLFunc, InterpolationSampler, JSONConverter, LoaderHelper, LoaderImpl, MeshHelper, ModelCameraComponent, ModelLightComponent, ModelMeshComponent, ModelPlugin, ModelPluginComponent, ModelSkyboxComponent, ModelTreeComponent, ModelTreeItem, ModelTreePlugin, PAnimInterpType, PAnimPathType, PAnimTexture, PAnimTrack, PAnimation, PAnimationManager, PBRShaderGUID, PBlendMode, PCamera, PCameraManager, PCoordinate, PEntity, PFaceSideMode, PGeometry, PGlobalState, PLight, PLightManager, PLightType, PMaterialBase, PMaterialPBR, PMaterialSkyboxFilter, PMaterialType, PMaterialUnlit, PMesh, PMorph, PObject, PObjectType, PSceneManager, PShaderManager, PShadowType, PSkin, PSkybox, PSkyboxCreator, PSkyboxType, PSubMesh, PTextureType, PTransform, PluginHelper, RayBoxTesting, RayIntersectsBoxWithRotation, RayTriangleTesting, RenderType, TextureDataMode, ToggleItemBounding, TwoStatesSet, UnlitShaderGUID, VFX_ITEM_TYPE_3D, VertexAttribBuffer, WebGLHelper, WebHelper, createAnimationSampler, createPluginMaterial, fetchPBRShaderCode, fetchUnlitShaderCode, getDefaultEffectsGLTFLoader, getDiffuseOnlyShaderCode, getGaussianBlurShaderCodeV1, getGaussianBlurShaderCodeV2, getGeometryDataFromOptions, getGeometryDataFromPropsList, getKawaseBlurShaderCode, getNormalVisShaderCode, getPBRPassShaderCode, getPMeshList, getQuadFilterShaderCode, getRendererGPUInfo, getSceneManager, getShadowPassShaderCode, getSimpleFilterShaderCode, getSkyBoxShaderCode, getTransparecyBaseShader, getTransparecyFilterShader, setDefaultEffectsGLTFLoader, version };
12861
13378
  //# sourceMappingURL=index.mjs.map