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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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.10
6
+ * Version: v2.0.0-alpha.12
7
7
  */
8
8
 
9
- import { math, Transform, PLAYER_OPTIONS_ENV_EDITOR, spec, glContext, Texture, TextureSourceType, RenderPassAttachmentStorageType, Material, Mesh, Geometry, GLSLVersion, DestroyOptions, addItem, removeItem, effectsClass, RendererComponent, ItemBehaviour, TimelineComponent, HitTestType, RenderPass, TextureLoadAction, RenderPassDestroyAttachmentType, Player, Renderer, getDefaultTextureFactory, loadImage, VFXItem, AbstractPlugin, 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, TimelineComponent, HitTestType, RenderPass, TextureLoadAction, DestroyOptions, RenderPassDestroyAttachmentType, Player, Renderer, getDefaultTextureFactory, loadImage, generateGUID, VFXItem, AbstractPlugin, glType2VertexFormatType, Downloader, getStandardJSON, registerPlugin, logger } from '@galacean/effects';
10
10
 
11
11
  /**
12
12
  * Model 插件元素类型
@@ -1369,38 +1369,38 @@ var TextureDataMode;
1369
1369
  /**
1370
1370
  * Morph 动画中 Position 相关的 Attribute 名称
1371
1371
  */ PMorph.positionNameList = [
1372
- "a_Target_Position0",
1373
- "a_Target_Position1",
1374
- "a_Target_Position2",
1375
- "a_Target_Position3",
1376
- "a_Target_Position4",
1377
- "a_Target_Position5",
1378
- "a_Target_Position6",
1379
- "a_Target_Position7"
1372
+ "aTargetPosition0",
1373
+ "aTargetPosition1",
1374
+ "aTargetPosition2",
1375
+ "aTargetPosition3",
1376
+ "aTargetPosition4",
1377
+ "aTargetPosition5",
1378
+ "aTargetPosition6",
1379
+ "aTargetPosition7"
1380
1380
  ];
1381
1381
  /**
1382
1382
  * Morph 动画中 Normal 相关的 Attribute 名称
1383
1383
  */ PMorph.normalNameList = [
1384
- "a_Target_Normal0",
1385
- "a_Target_Normal1",
1386
- "a_Target_Normal2",
1387
- "a_Target_Normal3",
1388
- "a_Target_Normal4",
1389
- "a_Target_Normal5",
1390
- "a_Target_Normal6",
1391
- "a_Target_Normal7"
1384
+ "aTargetNormal0",
1385
+ "aTargetNormal1",
1386
+ "aTargetNormal2",
1387
+ "aTargetNormal3",
1388
+ "aTargetNormal4",
1389
+ "aTargetNormal5",
1390
+ "aTargetNormal6",
1391
+ "aTargetNormal7"
1392
1392
  ];
1393
1393
  /**
1394
1394
  * Morph 动画中 Tangent 相关的 Attribute 名称
1395
1395
  */ PMorph.tangentNameList = [
1396
- "a_Target_Tangent0",
1397
- "a_Target_Tangent1",
1398
- "a_Target_Tangent2",
1399
- "a_Target_Tangent3",
1400
- "a_Target_Tangent4",
1401
- "a_Target_Tangent5",
1402
- "a_Target_Tangent6",
1403
- "a_Target_Tangent7"
1396
+ "aTargetTangent0",
1397
+ "aTargetTangent1",
1398
+ "aTargetTangent2",
1399
+ "aTargetTangent3",
1400
+ "aTargetTangent4",
1401
+ "aTargetTangent5",
1402
+ "aTargetTangent6",
1403
+ "aTargetTangent7"
1404
1404
  ];
1405
1405
  var PAnimInterpType;
1406
1406
  (function(PAnimInterpType) {
@@ -2429,7 +2429,7 @@ function _assert_this_initialized(self) {
2429
2429
  */ parentIndex = -1;
2430
2430
  _this./**
2431
2431
  * primitive 对象数组
2432
- */ primitives = [];
2432
+ */ subMeshes = [];
2433
2433
  _this./**
2434
2434
  * 是否隐藏,默认是隐藏
2435
2435
  */ hide = true;
@@ -2462,13 +2462,16 @@ function _assert_this_initialized(self) {
2462
2462
  _this.hide = proxy.isHide();
2463
2463
  _this.priority = (owner == null ? void 0 : (_owner_item = owner.item) == null ? void 0 : _owner_item.listIndex) || 0;
2464
2464
  //
2465
- _this.primitives = [];
2466
- proxy.getPrimitives().forEach(function(primOpts) {
2467
- var primObj = new PPrimitive(_this.engine);
2468
- primObj.create(primOpts, _assert_this_initialized(_this));
2469
- _this.primitives.push(primObj);
2465
+ _this.subMeshes = [];
2466
+ var geometry = proxy.getGeometry();
2467
+ var _owner_materials;
2468
+ var materials = (_owner_materials = owner == null ? void 0 : owner.materials) != null ? _owner_materials : [];
2469
+ materials.forEach(function(material) {
2470
+ var subMesh = new PSubMesh(_this.engine);
2471
+ subMesh.create(geometry, material, _assert_this_initialized(_this));
2472
+ _this.subMeshes.push(subMesh);
2470
2473
  });
2471
- if (_this.primitives.length <= 0) {
2474
+ if (_this.subMeshes.length <= 0) {
2472
2475
  console.warn("No primitive inside mesh item " + name);
2473
2476
  }
2474
2477
  _this.boundingBox = _this.getItemBoundingBox(meshData.interaction);
@@ -2484,7 +2487,7 @@ function _assert_this_initialized(self) {
2484
2487
  return;
2485
2488
  }
2486
2489
  this.isBuilt = true;
2487
- this.primitives.forEach(function(prim) {
2490
+ this.subMeshes.forEach(function(prim) {
2488
2491
  prim.build(scene.maxLightCount, {}, scene.skybox);
2489
2492
  });
2490
2493
  if (PGlobalState.getInstance().visBoundingBox) {
@@ -2506,9 +2509,8 @@ function _assert_this_initialized(self) {
2506
2509
  var _this_skin;
2507
2510
  (_this_skin = this.skin) == null ? void 0 : _this_skin.updateSkinMatrices();
2508
2511
  this.updateMaterial(scene);
2509
- this.primitives.forEach(function(prim) {
2510
- var mesh = prim.effectsMesh;
2511
- renderer.drawGeometry(mesh.geometry, mesh.material);
2512
+ this.subMeshes.forEach(function(subMesh, index) {
2513
+ renderer.drawGeometry(subMesh.getEffectsGeometry(), subMesh.getEffectsMaterial(), index);
2512
2514
  });
2513
2515
  if (this.visBoundingBox && this.boundingBoxMesh !== undefined) {
2514
2516
  var mesh = this.boundingBoxMesh.mesh;
@@ -2533,10 +2535,10 @@ function _assert_this_initialized(self) {
2533
2535
  this.skin = undefined;
2534
2536
  (_this_morph = this.morph) == null ? void 0 : _this_morph.dispose();
2535
2537
  this.morph = undefined;
2536
- this.primitives.forEach(function(prim) {
2538
+ this.subMeshes.forEach(function(prim) {
2537
2539
  prim.dispose();
2538
2540
  });
2539
- this.primitives = [];
2541
+ this.subMeshes = [];
2540
2542
  (_this_boundingBoxMesh = this.boundingBoxMesh) == null ? void 0 : _this_boundingBoxMesh.dispose();
2541
2543
  this.boundingBoxMesh = undefined;
2542
2544
  };
@@ -2579,7 +2581,7 @@ function _assert_this_initialized(self) {
2579
2581
  var worldMatrix = this.matrix;
2580
2582
  var normalMatrix = worldMatrix.clone().invert().transpose();
2581
2583
  var sceneStates = scene.sceneStates;
2582
- this.primitives.forEach(function(prim) {
2584
+ this.subMeshes.forEach(function(prim) {
2583
2585
  prim.updateMaterial(worldMatrix, normalMatrix, sceneStates);
2584
2586
  });
2585
2587
  if (this.boundingBoxMesh !== undefined) {
@@ -2633,7 +2635,7 @@ function _assert_this_initialized(self) {
2633
2635
  }
2634
2636
  var mint;
2635
2637
  if (PGlobalState.getInstance().isEditorEnv) {
2636
- this.primitives.forEach(function(prim) {
2638
+ this.subMeshes.forEach(function(prim) {
2637
2639
  var primt = prim.hitTesting(newOrigin, newDirection, worldMatrix, invWorldMatrix);
2638
2640
  if (primt !== undefined) {
2639
2641
  if (mint === undefined || mint > primt) {
@@ -2661,7 +2663,7 @@ function _assert_this_initialized(self) {
2661
2663
  */ _proto.computeBoundingBox = function computeBoundingBox(worldMatrix) {
2662
2664
  var box = this.boundingBox.makeEmpty();
2663
2665
  var inverseWorldMatrix = worldMatrix.clone().invert();
2664
- this.primitives.forEach(function(prim) {
2666
+ this.subMeshes.forEach(function(prim) {
2665
2667
  var subbox = prim.computeBoundingBox(inverseWorldMatrix);
2666
2668
  box.union(subbox);
2667
2669
  });
@@ -2718,24 +2720,14 @@ function _assert_this_initialized(self) {
2718
2720
  */ function get() {
2719
2721
  return this.skin !== undefined;
2720
2722
  }
2721
- },
2722
- {
2723
- key: "mriMeshs",
2724
- get: /**
2725
- * 获取 GE Mesh 数组
2726
- */ function get() {
2727
- return this.primitives.map(function(prim) {
2728
- return prim.effectsMesh;
2729
- });
2730
- }
2731
2723
  }
2732
2724
  ]);
2733
2725
  return PMesh;
2734
2726
  }(PEntity);
2735
2727
  /**
2736
- * Primitive 类,负责 Sub Mesh相关的功能,支持骨骼动画和 PBR 渲染
2737
- */ var PPrimitive = /*#__PURE__*/ function() {
2738
- function PPrimitive(engine) {
2728
+ * PSubMesh 类,负责 Sub Mesh相关的功能,支持骨骼动画和 PBR 渲染
2729
+ */ var PSubMesh = /*#__PURE__*/ function() {
2730
+ function PSubMesh(engine) {
2739
2731
  this.engine = engine;
2740
2732
  this./**
2741
2733
  * 名称
@@ -2750,17 +2742,17 @@ function _assert_this_initialized(self) {
2750
2742
  * 是否压缩,模式不压缩
2751
2743
  */ isCompressed = false;
2752
2744
  }
2753
- var _proto = PPrimitive.prototype;
2745
+ var _proto = PSubMesh.prototype;
2754
2746
  /**
2755
2747
  * 创建 Primitive 对象
2756
2748
  * @param data - Primitive 参数
2757
2749
  * @param parent - 所属 Mesh 对象
2758
- */ _proto.create = function create(data, parent) {
2750
+ */ _proto.create = function create(geometry, material, parent) {
2759
2751
  this.parent = parent;
2760
2752
  this.skin = parent.skin;
2761
2753
  this.morph = parent.morph;
2762
- this.setGeometry(data.geometry);
2763
- this.setMaterial(data.material);
2754
+ this.setGeometry(geometry);
2755
+ this.setMaterial(material);
2764
2756
  this.name = parent.name;
2765
2757
  this.effectsPriority = parent.priority;
2766
2758
  this.geometry.setHide(parent.hide);
@@ -2798,6 +2790,7 @@ function _assert_this_initialized(self) {
2798
2790
  var primitiveMacroList = this.getMacroList(lightCount, true, skybox);
2799
2791
  var materialMacroList = this.material.getMacroList(primitiveMacroList);
2800
2792
  var newSemantics = uniformSemantics != null ? uniformSemantics : {};
2793
+ // FIXME: Semantics整体移除
2801
2794
  newSemantics["_ViewProjectionMatrix"] = "VIEWPROJECTION";
2802
2795
  //newSemantics["uView"] = 'VIEWINVERSE';
2803
2796
  newSemantics["_ModelMatrix"] = "MODEL";
@@ -2806,6 +2799,7 @@ function _assert_this_initialized(self) {
2806
2799
  var isWebGL2 = PGlobalState.getInstance().isWebGL2;
2807
2800
  if (this.material.effectMaterial) {
2808
2801
  material = this.material.effectMaterial;
2802
+ // FIXME: Semantics整体移除
2809
2803
  // @ts-expect-error
2810
2804
  material.uniformSemantics = newSemantics;
2811
2805
  materialMacroList.forEach(function(macro) {
@@ -2823,18 +2817,8 @@ function _assert_this_initialized(self) {
2823
2817
  },
2824
2818
  uniformSemantics: newSemantics
2825
2819
  });
2820
+ this.material.setMaterialStates(material);
2826
2821
  }
2827
- var mesh = Mesh.create(this.engine, {
2828
- name: this.name,
2829
- material: material,
2830
- geometry: this.getEffectsGeometry(),
2831
- priority: this.effectsPriority
2832
- });
2833
- if (this.effectsMesh !== undefined) {
2834
- this.effectsMesh.dispose();
2835
- }
2836
- this.effectsMesh = mesh;
2837
- this.material.setMaterialStates(material);
2838
2822
  };
2839
2823
  _proto.getFeatureList = function getFeatureList(lightCount, pbrPass, skybox) {
2840
2824
  var featureList = [];
@@ -3032,12 +3016,6 @@ function _assert_this_initialized(self) {
3032
3016
  this.jointMatrixTexture = undefined;
3033
3017
  (_this_jointNormalMatTexture = this.jointNormalMatTexture) == null ? void 0 : _this_jointNormalMatTexture.dispose();
3034
3018
  this.jointNormalMatTexture = undefined;
3035
- this.effectsMesh.dispose({
3036
- geometries: DestroyOptions.keep,
3037
- material: DestroyOptions.keep
3038
- });
3039
- // @ts-expect-error
3040
- this.effectsMesh = undefined;
3041
3019
  };
3042
3020
  /**
3043
3021
  * 更新内部 GE 材质着色器 Uniform 数据,根据场景状态
@@ -3047,7 +3025,7 @@ function _assert_this_initialized(self) {
3047
3025
  */ _proto.updateMaterial = function updateMaterial(worldMatrix, nomralMatrix, sceneStates) {
3048
3026
  this.updateUniformsByAnimation(worldMatrix, nomralMatrix);
3049
3027
  this.updateUniformsByScene(sceneStates);
3050
- this.material.updateUniforms(this.getModelMaterial());
3028
+ this.material.updateUniforms(this.getEffectsMaterial());
3051
3029
  };
3052
3030
  /**
3053
3031
  * 点击测试,先进行简单的包围合测试,然后再计算精准的点击测试,这个测试非常耗时不要在移动端上使用
@@ -3120,7 +3098,7 @@ function _assert_this_initialized(self) {
3120
3098
  }
3121
3099
  };
3122
3100
  _proto.updateUniformsByAnimation = function updateUniformsByAnimation(worldMatrix, normalMatrix) {
3123
- var material = this.getModelMaterial();
3101
+ var material = this.getEffectsMaterial();
3124
3102
  material.setMatrix("_ModelMatrix", worldMatrix);
3125
3103
  material.setMatrix("_NormalMatrix", normalMatrix);
3126
3104
  //
@@ -3161,7 +3139,7 @@ function _assert_this_initialized(self) {
3161
3139
  }
3162
3140
  };
3163
3141
  _proto.updateUniformsByScene = function updateUniformsByScene(sceneStates) {
3164
- var material = this.getModelMaterial();
3142
+ var material = this.getEffectsMaterial();
3165
3143
  material.setMatrix("_ViewProjectionMatrix", sceneStates.viewProjectionMatrix);
3166
3144
  material.setVector3("_Camera", sceneStates.cameraPosition);
3167
3145
  //
@@ -3258,8 +3236,8 @@ function _assert_this_initialized(self) {
3258
3236
  /**
3259
3237
  * 获取 GE 材质
3260
3238
  * @returns
3261
- */ _proto.getModelMaterial = function getModelMaterial() {
3262
- return this.effectsMesh.material;
3239
+ */ _proto.getEffectsMaterial = function getEffectsMaterial() {
3240
+ return this.material.effectMaterial;
3263
3241
  };
3264
3242
  /**
3265
3243
  * 是否无光照材质
@@ -3294,7 +3272,7 @@ function _assert_this_initialized(self) {
3294
3272
  return this.boundingBox.clone().applyMatrix4(matrix);
3295
3273
  }
3296
3274
  };
3297
- return PPrimitive;
3275
+ return PSubMesh;
3298
3276
  }();
3299
3277
  /**
3300
3278
  * 3D 几何类
@@ -3370,7 +3348,7 @@ function _assert_this_initialized(self) {
3370
3348
  * 是否有切线属性
3371
3349
  * @returns
3372
3350
  */ _proto.hasTangents = function hasTangents() {
3373
- return this.hasAttribute("a_Tangent");
3351
+ return this.hasAttribute("aTangent");
3374
3352
  };
3375
3353
  /**
3376
3354
  * 是否有纹理坐标属性
@@ -3387,19 +3365,19 @@ function _assert_this_initialized(self) {
3387
3365
  * 是否有颜色属性
3388
3366
  * @returns
3389
3367
  */ _proto.hasColors = function hasColors() {
3390
- return this.hasAttribute("a_Color");
3368
+ return this.hasAttribute("aColor");
3391
3369
  };
3392
3370
  /**
3393
3371
  * 是否有关节点属性
3394
3372
  * @returns
3395
3373
  */ _proto.hasJoints = function hasJoints() {
3396
- return this.hasAttribute("a_Joint1");
3374
+ return this.hasAttribute("aJoints");
3397
3375
  };
3398
3376
  /**
3399
3377
  * 是否有权重属性
3400
3378
  * @returns
3401
3379
  */ _proto.hasWeights = function hasWeights() {
3402
- return this.hasAttribute("a_Weight1");
3380
+ return this.hasAttribute("aWeights");
3403
3381
  };
3404
3382
  return PGeometry;
3405
3383
  }();
@@ -3408,35 +3386,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3408
3386
  this.itemData = itemData;
3409
3387
  this.parentItem = parentItem;
3410
3388
  this.data = itemData;
3411
- // Morph 对象创建,需要为每个 Primitive 中 Geometry 对象创建 Morph
3412
- // 并且要求创建的 Morph 对象状态是相同的,否则就报错
3413
- var isSuccess = true;
3414
- var morphObj = new PMorph();
3415
- var _this_data = this.data, primitives = _this_data.primitives, morph = _this_data.morph;
3416
- primitives.forEach(function(prim, idx) {
3417
- if (idx === 0) {
3418
- morphObj.create(prim.geometry);
3419
- } else {
3420
- var tempMorph = new PMorph();
3421
- if (!tempMorph.create(prim.geometry)) {
3422
- isSuccess = false;
3423
- } else {
3424
- if (!morphObj.equals(tempMorph)) {
3425
- isSuccess = false;
3426
- console.error("Morpth target mismatch between primtives: " + JSON.stringify(morphObj) + ", " + JSON.stringify(tempMorph));
3427
- }
3428
- }
3429
- }
3430
- });
3431
- if (isSuccess) {
3432
- // 设置初始权重数组
3433
- if ((morph == null ? void 0 : morph.weights) !== undefined) {
3434
- morphObj.initWeights(morph.weights);
3435
- }
3436
- this.morphObj = morphObj;
3437
- } else {
3438
- this.morphObj = new PMorph();
3439
- }
3389
+ this.morphObj = new PMorph();
3440
3390
  }
3441
3391
  var _proto = EffectsMeshProxy.prototype;
3442
3392
  _proto.hasMorphTarget = function hasMorphTarget() {
@@ -3468,11 +3418,14 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3468
3418
  _proto.getParentIndex = function getParentIndex() {
3469
3419
  return -1;
3470
3420
  };
3471
- _proto.getPrimitives = function getPrimitives() {
3472
- return this.data.primitives;
3421
+ _proto.getGeometry = function getGeometry() {
3422
+ return this.data.geometry;
3423
+ };
3424
+ _proto.getMaterials = function getMaterials() {
3425
+ return this.data.materials;
3473
3426
  };
3474
- _proto.getPrimitiveCount = function getPrimitiveCount() {
3475
- return this.data.primitives.length;
3427
+ _proto.getMaterialCount = function getMaterialCount() {
3428
+ return this.data.materials.length;
3476
3429
  };
3477
3430
  _proto.hasSkin = function hasSkin() {
3478
3431
  // FIXME: skin
@@ -3878,7 +3831,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
3878
3831
  return PSceneManager;
3879
3832
  }();
3880
3833
 
3881
- var primitiveVert = "precision highp float;\n#define FEATURES\n#include <webglCompatibility.glsl>\n#include <animation.vert.glsl>\nvsIn vec4 aPos;vsOut vec3 v_Position;\n#ifdef HAS_NORMALS\nvsIn vec4 aNormal;\n#endif\n#ifdef HAS_TANGENTS\nvsIn vec4 a_Tangent;\n#endif\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nvsOut mat3 v_TBN;\n#else\nvsOut vec3 v_Normal;\n#endif\n#endif\n#ifdef HAS_UV_SET1\nvsIn vec2 aUV;\n#endif\n#ifdef HAS_UV_SET2\nvsIn vec2 aUV2;\n#endif\nvsOut vec2 v_UVCoord1;\n#ifdef HAS_UV_SET2\nvsOut vec2 v_UVCoord2;\n#endif\n#ifdef HAS_VERTEX_COLOR_VEC3\nvsIn vec3 a_Color;vsOut vec3 v_Color;\n#endif\n#ifdef HAS_VERTEX_COLOR_VEC4\nvsIn vec4 a_Color;vsOut vec4 v_Color;\n#endif\nuniform mat4 _ViewProjectionMatrix;uniform mat4 _ModelMatrix;uniform mat4 _NormalMatrix;\n#ifdef EDITOR_TRANSFORM\nuniform vec4 uEditorTransform;\n#endif\n#ifdef USE_SHADOW_MAPPING\nuniform mat4 _LightViewProjectionMatrix;uniform float _DeltaSceneSize;vsOut vec4 v_PositionLightSpace;vsOut vec4 v_dPositionLightSpace;\n#endif\nvec4 getPosition(){vec4 pos=vec4(aPos.xyz,1.0);\n#ifdef USE_MORPHING\npos+=getTargetPosition();\n#endif\n#ifdef USE_SKINNING\npos=getSkinningMatrix()*pos;\n#endif\nreturn pos;}\n#ifdef HAS_NORMALS\nvec4 getNormal(){vec4 normal=aNormal;\n#ifdef USE_MORPHING\nnormal+=getTargetNormal();\n#endif\n#ifdef USE_SKINNING\nnormal=getSkinningNormalMatrix()*normal;\n#endif\nreturn normalize(normal);}\n#endif\n#ifdef HAS_TANGENTS\nvec4 getTangent(){vec4 tangent=a_Tangent;\n#ifdef USE_MORPHING\ntangent+=getTargetTangent();\n#endif\n#ifdef USE_SKINNING\ntangent=getSkinningMatrix()*tangent;\n#endif\nreturn normalize(tangent);}\n#endif\nvoid main(){vec4 pos=_ModelMatrix*getPosition();v_Position=vec3(pos.xyz)/pos.w;\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nvec4 tangent=getTangent();vec3 normalW=normalize(vec3(_NormalMatrix*vec4(getNormal().xyz,0.0)));vec3 tangentW=normalize(vec3(_ModelMatrix*vec4(tangent.xyz,0.0)));vec3 bitangentW=cross(normalW,tangentW)*tangent.w;v_TBN=mat3(tangentW,bitangentW,normalW);\n#else\nv_Normal=normalize(vec3(_NormalMatrix*vec4(getNormal().xyz,0.0)));\n#endif\n#endif\nv_UVCoord1=vec2(0.0,0.0);\n#ifdef HAS_UV_SET1\nv_UVCoord1=aUV;\n#endif\n#ifdef HAS_UV_SET2\nv_UVCoord2=aUV2;\n#endif\n#if defined(HAS_VERTEX_COLOR_VEC3) || defined(HAS_VERTEX_COLOR_VEC4)\nv_Color=a_Color;\n#endif\n#ifdef USE_SHADOW_MAPPING\nv_PositionLightSpace=_LightViewProjectionMatrix*pos;vec3 dpos=vec3(_DeltaSceneSize);v_dPositionLightSpace=_LightViewProjectionMatrix*(pos+vec4(dpos,0));\n#endif\ngl_Position=_ViewProjectionMatrix*pos;\n#ifdef EDITOR_TRANSFORM\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
3834
+ var primitiveVert = "precision highp float;\n#define FEATURES\n#include <webglCompatibility.glsl>\n#include <animation.vert.glsl>\nvsIn vec4 aPos;vsOut vec3 v_Position;\n#ifdef HAS_NORMALS\nvsIn vec4 aNormal;\n#endif\n#ifdef HAS_TANGENTS\nvsIn vec4 aTangent;\n#endif\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nvsOut mat3 v_TBN;\n#else\nvsOut vec3 v_Normal;\n#endif\n#endif\n#ifdef HAS_UV_SET1\nvsIn vec2 aUV;\n#endif\n#ifdef HAS_UV_SET2\nvsIn vec2 aUV2;\n#endif\nvsOut vec2 v_UVCoord1;\n#ifdef HAS_UV_SET2\nvsOut vec2 v_UVCoord2;\n#endif\n#ifdef HAS_VERTEX_COLOR_VEC3\nvsIn vec3 aColor;vsOut vec3 v_Color;\n#endif\n#ifdef HAS_VERTEX_COLOR_VEC4\nvsIn vec4 aColor;vsOut vec4 v_Color;\n#endif\nuniform mat4 _ViewProjectionMatrix;uniform mat4 _ModelMatrix;uniform mat4 _NormalMatrix;\n#ifdef EDITOR_TRANSFORM\nuniform vec4 uEditorTransform;\n#endif\n#ifdef USE_SHADOW_MAPPING\nuniform mat4 _LightViewProjectionMatrix;uniform float _DeltaSceneSize;vsOut vec4 v_PositionLightSpace;vsOut vec4 v_dPositionLightSpace;\n#endif\nvec4 getPosition(){vec4 pos=vec4(aPos.xyz,1.0);\n#ifdef USE_MORPHING\npos+=getTargetPosition();\n#endif\n#ifdef USE_SKINNING\npos=getSkinningMatrix()*pos;\n#endif\nreturn pos;}\n#ifdef HAS_NORMALS\nvec4 getNormal(){vec4 normal=aNormal;\n#ifdef USE_MORPHING\nnormal+=getTargetNormal();\n#endif\n#ifdef USE_SKINNING\nnormal=getSkinningNormalMatrix()*normal;\n#endif\nreturn normalize(normal);}\n#endif\n#ifdef HAS_TANGENTS\nvec4 getTangent(){vec4 tangent=aTangent;\n#ifdef USE_MORPHING\ntangent+=getTargetTangent();\n#endif\n#ifdef USE_SKINNING\ntangent=getSkinningMatrix()*tangent;\n#endif\nreturn normalize(tangent);}\n#endif\nvoid main(){vec4 pos=_ModelMatrix*getPosition();v_Position=vec3(pos.xyz)/pos.w;\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nvec4 tangent=getTangent();vec3 normalW=normalize(vec3(_NormalMatrix*vec4(getNormal().xyz,0.0)));vec3 tangentW=normalize(vec3(_ModelMatrix*vec4(tangent.xyz,0.0)));vec3 bitangentW=cross(normalW,tangentW)*tangent.w;v_TBN=mat3(tangentW,bitangentW,normalW);\n#else\nv_Normal=normalize(vec3(_NormalMatrix*vec4(getNormal().xyz,0.0)));\n#endif\n#endif\nv_UVCoord1=vec2(0.0,0.0);\n#ifdef HAS_UV_SET1\nv_UVCoord1=aUV;\n#endif\n#ifdef HAS_UV_SET2\nv_UVCoord2=aUV2;\n#endif\n#if defined(HAS_VERTEX_COLOR_VEC3) || defined(HAS_VERTEX_COLOR_VEC4)\nv_Color=aColor;\n#endif\n#ifdef USE_SHADOW_MAPPING\nv_PositionLightSpace=_LightViewProjectionMatrix*pos;vec3 dpos=vec3(_DeltaSceneSize);v_dPositionLightSpace=_LightViewProjectionMatrix*(pos+vec4(dpos,0));\n#endif\ngl_Position=_ViewProjectionMatrix*pos;\n#ifdef EDITOR_TRANSFORM\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
3882
3835
 
3883
3836
  var metallicRoughnessFrag = "\n#define FEATURES\n#ifndef WEBGL2\n#extension GL_OES_standard_derivatives : enable\n#endif\n#if !defined(WEBGL2) && defined(USE_TEX_LOD)\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#ifdef USE_HDR\n#extension GL_OES_texture_float : enable\n#extension GL_OES_texture_float_linear : enable\n#endif\n#if !defined(WEBGL2) && defined(USE_WBOIT)\n#extension GL_EXT_draw_buffers: require\n#endif\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#ifdef WEBGL2\n#ifdef USE_WBOIT\nlayout(location=0)out vec4 outFragColor0;layout(location=1)out vec4 outFragColor1;\n#else\nout vec4 outFragColor;\n#endif\n#else\n#ifdef USE_WBOIT\n#define outFragColor0 gl_FragData[0]\n#define outFragColor1 gl_FragData[1]\n#else\n#define outFragColor gl_FragColor\n#endif\n#endif\n#include <webglCompatibility.glsl>\n#include <extensions.frag.glsl>\n#include <tonemapping.frag.glsl>\n#include <textures.vert.glsl>\n#include <functions.frag.glsl>\n#include <shadowCommon.vert.glsl>\n#include <shadow.frag.glsl>\nstruct Light{vec3 direction;float range;vec3 color;float intensity;vec3 position;float innerConeCos;float outerConeCos;int type;vec2 padding;};const int LightType_Directional=0;const int LightType_Point=1;const int LightType_Spot=2;const int LightType_Ambient=3;\n#ifdef USE_PUNCTUAL\nuniform Light _Lights[LIGHT_COUNT];\n#endif\n#if defined(MATERIAL_SPECULARGLOSSINESS) || defined(MATERIAL_METALLICROUGHNESS)\nuniform float _MetallicFactor;uniform float _RoughnessFactor;uniform vec4 _BaseColorFactor;\n#endif\n#ifdef MATERIAL_SPECULARGLOSSINESS\nuniform vec3 _SpecularFactor;uniform vec4 _DiffuseFactor;uniform float _GlossinessFactor;\n#endif\n#ifdef ALPHAMODE_MASK\nuniform float _AlphaCutoff;\n#endif\n#ifdef ADD_FOG\nuniform vec4 _FogColor;\n#ifdef LINEAR_FOG\nuniform float _FogNear;uniform float _FogFar;\n#endif\n#ifdef EXP_FOG\nuniform float _FogDensity;\n#endif\n#endif\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\nuniform vec3 _Camera;uniform int _MipCount;struct MaterialInfo{float perceptualRoughness;vec3 reflectance0;float alphaRoughness;vec3 diffuseColor;vec3 reflectance90;vec3 specularColor;};\n#ifdef ADD_FOG\nvec3 getMixFogColor(vec3 baseColor){vec3 distance=_Camera-v_Position;float fogAmount=0.0;\n#ifdef LINEAR_FOG\nfogAmount=smoothstep(_FogNear,_FogFar,distance[2]);\n#endif\n#ifdef EXP_FOG\n#define LOG2 1.442695\nfogAmount=1.-exp2(-_FogDensity*_FogDensity*distance[2]*distance[2]*LOG2);fogAmount=clamp(fogAmount,0.,1.);\n#endif\nvec3 mixColor=baseColor.rgb+(vec3(_FogColor)-baseColor.rgb)*fogAmount;return mixColor;}\n#endif\n#ifdef IRRADIANCE_COEFFICIENTS\nvec3 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\n#ifdef USE_IBL\nvec3 getIBLContribution(MaterialInfo materialInfo,vec3 n,vec3 v){float NdotV=clamp(dot(n,v),0.0,1.0);float lod=clamp(materialInfo.perceptualRoughness*float(_MipCount),0.0,float(_MipCount));vec3 reflection=normalize(reflect(-v,n));vec2 brdfSamplePoint=clamp(vec2(NdotV,materialInfo.perceptualRoughness),vec2(0.0,0.0),vec2(1.0,1.0));vec2 brdf=texture2D(_brdfLUT,brdfSamplePoint).rg;vec4 diffuseColor=vec4(1.0,0.0,0.0,1.0);\n#ifdef IRRADIANCE_COEFFICIENTS\nvec3 irradiance=getIrradiance(n,_shCoefficients);diffuseColor=vec4(irradiance,1.0);\n#else\ndiffuseColor=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\n#ifdef USE_HDR\nvec3 diffuseLight=diffuseColor.rgb;vec3 specularLight=specularSample.rgb;\n#else\nvec3 diffuseLight=SRGBtoLINEAR(diffuseColor).rgb;vec3 specularLight=SRGBtoLINEAR(specularSample).rgb;\n#endif\nvec3 diffuse=diffuseLight*materialInfo.diffuseColor;vec3 specular=specularLight*(materialInfo.specularColor*brdf.x+brdf.y);return diffuse*_IblIntensity[0]+specular*_IblIntensity[1];}\n#endif\nvec3 diffuse(MaterialInfo materialInfo){return materialInfo.diffuseColor/M_PI;}vec3 specularReflection(MaterialInfo materialInfo,AngularInfo angularInfo){return materialInfo.reflectance0+(materialInfo.reflectance90-materialInfo.reflectance0)*pow(clamp(1.0-angularInfo.VdotH,0.0,1.0),5.0);}float visibilityOcclusion(MaterialInfo materialInfo,AngularInfo angularInfo){float NdotL=angularInfo.NdotL;float NdotV=angularInfo.NdotV;float alphaRoughnessSq=materialInfo.alphaRoughness*materialInfo.alphaRoughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-alphaRoughnessSq)+alphaRoughnessSq);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-alphaRoughnessSq)+alphaRoughnessSq);float GGX=GGXV+GGXL;if(GGX>0.0){return 0.5/GGX;}return 0.0;}float microfacetDistribution(MaterialInfo materialInfo,AngularInfo angularInfo){float alphaRoughnessSq=materialInfo.alphaRoughness*materialInfo.alphaRoughness;float f=(angularInfo.NdotH*alphaRoughnessSq-angularInfo.NdotH)*angularInfo.NdotH+1.0;return alphaRoughnessSq/(M_PI*f*f);}vec3 getPointShade(vec3 pointToLight,MaterialInfo materialInfo,vec3 normal,vec3 view){AngularInfo angularInfo=getAngularInfo(pointToLight,normal,view);if(angularInfo.NdotL>0.0||angularInfo.NdotV>0.0){vec3 F=specularReflection(materialInfo,angularInfo);float Vis=visibilityOcclusion(materialInfo,angularInfo);float D=microfacetDistribution(materialInfo,angularInfo);vec3 diffuseContrib=(1.0-F)*diffuse(materialInfo);vec3 specContrib=F*Vis*D;return angularInfo.NdotL*(diffuseContrib+specContrib);}return vec3(0.0,0.0,0.0);}float getRangeAttenuation(float range,float distance){if(range<=0.0){return 1.0;}return 1.0/(pow(5.0*distance/range,2.0)+1.0);}float getSpotAttenuation(vec3 pointToLight,vec3 spotDirection,float outerConeCos,float innerConeCos){float actualCos=dot(normalize(spotDirection),normalize(-pointToLight));if(actualCos>outerConeCos){if(actualCos<innerConeCos){return smoothstep(outerConeCos,innerConeCos,actualCos);}return 1.0;}return 0.0;}vec3 applyDirectionalLight(Light light,MaterialInfo materialInfo,vec3 normal,vec3 view,float shadow){vec3 pointToLight=-light.direction;vec3 shade=getPointShade(pointToLight,materialInfo,normal,view)*shadow;return light.intensity*light.color*shade;}vec3 applyPointLight(Light light,MaterialInfo materialInfo,vec3 normal,vec3 view){vec3 pointToLight=light.position-v_Position;float distance=length(pointToLight);float attenuation=getRangeAttenuation(light.range,distance);vec3 shade=getPointShade(pointToLight,materialInfo,normal,view);return light.color*shade*attenuation*light.intensity;}vec3 applySpotLight(Light light,MaterialInfo materialInfo,vec3 normal,vec3 view,float shadow){vec3 pointToLight=light.position-v_Position;float distance=length(pointToLight);float rangeAttenuation=getRangeAttenuation(light.range,distance);float spotAttenuation=getSpotAttenuation(pointToLight,light.direction,light.outerConeCos,light.innerConeCos);vec3 shade=getPointShade(pointToLight,materialInfo,normal,view)*shadow;return rangeAttenuation*spotAttenuation*light.intensity*light.color*shade;}vec3 applyAmbientLight(Light light,MaterialInfo materialInfo){return light.intensity*light.color*diffuse(materialInfo);}float weight(float z,float a){return clamp(pow(min(1.0,a*10.0)+0.01,3.0)*1e8*pow(1.0-z*0.9,3.0),1e-2,3e3);}void writeFragmentColor(vec4 fragColor){\n#if !defined(ALPHAMODE_OPAQUE) && defined(USE_WBOIT)\nfloat w=weight(gl_FragCoord.z,fragColor.a);fragColor.rgb*=fragColor.a;outFragColor0=vec4(fragColor.rgb*w,fragColor.a);outFragColor1=vec4(fragColor.a*w);\n#else\noutFragColor=fragColor;\n#endif\n}void main(){float perceptualRoughness=0.0;float metallic=0.0;vec4 baseColor=vec4(0.0,0.0,0.0,1.0);vec3 diffuseColor=vec3(0.0);vec3 specularColor=vec3(0.0);vec3 f0=vec3(0.04);\n#ifdef PREVIEW_BORDER\nwriteFragmentColor(uPreviewColor);return;\n#endif\n#ifdef MATERIAL_SPECULARGLOSSINESS\n#ifdef HAS_SPECULAR_GLOSSINESS_MAP\nvec4 sgSample=SRGBtoLINEAR(texture2D(_SpecularGlossinessSampler,getSpecularGlossinessUV()));perceptualRoughness=(1.0-sgSample.a*_GlossinessFactor);f0=sgSample.rgb*_SpecularFactor;\n#else\nf0=_SpecularFactor;perceptualRoughness=1.0-_GlossinessFactor;\n#endif\n#ifdef HAS_DIFFUSE_MAP\nbaseColor=SRGBtoLINEAR(texture2D(_DiffuseSampler,getDiffuseUV()))*_DiffuseFactor;\n#else\nbaseColor=SRGBtoLINEAR(_DiffuseFactor);\n#endif\nbaseColor*=getVertexColor();specularColor=f0;float oneMinusSpecularStrength=1.0-max(max(f0.r,f0.g),f0.b);diffuseColor=baseColor.rgb*oneMinusSpecularStrength;\n#ifdef DEBUG_METALLIC\nmetallic=solveMetallic(baseColor.rgb,specularColor,oneMinusSpecularStrength);\n#endif\n#endif\n#ifdef MATERIAL_METALLICROUGHNESS\n#ifdef HAS_METALLIC_ROUGHNESS_MAP\nvec4 mrSample=texture2D(_MetallicRoughnessSampler,getMetallicRoughnessUV());perceptualRoughness=mrSample.g*_RoughnessFactor;metallic=mrSample.b*_MetallicFactor;\n#else\nmetallic=_MetallicFactor;perceptualRoughness=_RoughnessFactor;\n#endif\n#ifdef HAS_BASE_COLOR_MAP\nbaseColor=SRGBtoLINEAR(texture2D(_BaseColorSampler,getBaseColorUV()))*_BaseColorFactor;\n#else\nbaseColor=SRGBtoLINEAR(_BaseColorFactor);\n#endif\nbaseColor*=getVertexColor();diffuseColor=baseColor.rgb*(vec3(1.0)-f0)*(1.0-metallic);specularColor=mix(f0,baseColor.rgb,metallic);\n#endif\n#ifdef ALPHAMODE_MASK\nif(baseColor.a<_AlphaCutoff){discard;}baseColor.a=1.0;\n#endif\n#ifdef ALPHAMODE_OPAQUE\nbaseColor.a=1.0;\n#endif\n#ifdef MATERIAL_UNLIT\n#ifndef DEBUG_OUTPUT\n#ifdef ADD_FOG\nvec3 mixColor=getMixFogColor(baseColor.rgb);vec4 fragColorUnlit=vec4(LINEARtoSRGB(mixColor)*baseColor.a,baseColor.a);\n#else\nvec4 fragColorUnlit=vec4(LINEARtoSRGB(baseColor.rgb)*baseColor.a,baseColor.a);\n#endif\nwriteFragmentColor(fragColorUnlit);\n#else\n#ifdef DEBUG_UV\noutFragColor.rgb=vec3(getDebugUVColor(getBaseColorUV(),getNormal()));\n#endif\n#ifdef DEBUG_METALLIC\noutFragColor.rgb=vec3(metallic);\n#endif\n#ifdef DEBUG_ROUGHNESS\noutFragColor.rgb=vec3(perceptualRoughness);\n#endif\n#ifdef DEBUG_NORMAL\noutFragColor.rgb=getNormal()*0.5+0.5;\n#endif\n#ifdef DEBUG_BASECOLOR\noutFragColor.rgb=LINEARtoSRGB(baseColor.rgb);\n#endif\n#ifdef DEBUG_OCCLUSION\noutFragColor.rgb=vec3(1.0);\n#endif\n#ifdef DEBUG_EMISSIVE\noutFragColor.rgb=vec3(0.0);\n#endif\n#ifdef DEBUG_ALPHA\noutFragColor.rgb=vec3(baseColor.a);\n#endif\noutFragColor.a=1.0;\n#endif\nreturn;\n#endif\nmetallic=clamp(metallic,0.0,1.0);float alphaRoughness=perceptualRoughness*perceptualRoughness;vec3 normal=getNormal();\n#ifdef USE_SPECULAR_AA\nfloat AARoughnessFactor=getAARoughnessFactor(normal);perceptualRoughness+=AARoughnessFactor;alphaRoughness+=AARoughnessFactor;\n#endif\nperceptualRoughness=clamp(perceptualRoughness,0.04,1.0);alphaRoughness=clamp(alphaRoughness,0.04,1.0);float reflectance=max(max(specularColor.r,specularColor.g),specularColor.b);vec3 specularEnvironmentR0=specularColor.rgb;vec3 specularEnvironmentR90=vec3(clamp(reflectance*50.0,0.0,1.0));MaterialInfo materialInfo=MaterialInfo(perceptualRoughness,specularEnvironmentR0,alphaRoughness,diffuseColor,specularEnvironmentR90,specularColor);vec3 color=vec3(0.0,0.0,0.0);vec3 view=normalize(_Camera-v_Position);float shadow=1.0;\n#ifdef USE_SHADOW_MAPPING\nshadow=getShadowContribution();\n#endif\n#ifdef USE_PUNCTUAL\nfor(int i=0;i<LIGHT_COUNT;++i){Light light=_Lights[i];if(light.type==LightType_Directional){color+=applyDirectionalLight(light,materialInfo,normal,view,shadow);}else if(light.type==LightType_Point){color+=applyPointLight(light,materialInfo,normal,view);}else if(light.type==LightType_Spot){color+=applySpotLight(light,materialInfo,normal,view,shadow);}else if(light.type==LightType_Ambient){color+=applyAmbientLight(light,materialInfo);}}\n#endif\n#ifdef USE_IBL\ncolor+=getIBLContribution(materialInfo,normal,view);\n#endif\nfloat ao=1.0;\n#ifdef HAS_OCCLUSION_MAP\nao=texture2D(_OcclusionSampler,getOcclusionUV()).r;color=mix(color,color*ao,_OcclusionStrength);\n#endif\nvec3 emissive=vec3(0);\n#ifndef DEBUG_OUTPUT\n#ifdef ADD_FOG\nvec4 toneMapColor=SRGBtoLINEAR(vec4(toneMap(color),baseColor.a));color=getMixFogColor(toneMapColor.rgb);vec4 fragColorOut=vec4(LINEARtoSRGB(color.rgb)*baseColor.a,baseColor.a);\n#else\ncolor=toneMap(color)*baseColor.a;\n#ifdef HAS_EMISSIVE\ncolor+=_EmissiveFactor.rgb*_EmissiveIntensity;\n#endif\n#ifdef HAS_EMISSIVE_MAP\nemissive=SRGBtoLINEAR(texture2D(_EmissiveSampler,getEmissiveUV())).rgb*_EmissiveFactor.rgb*_EmissiveIntensity;color+=emissive;\n#endif\nvec4 fragColorOut=vec4(color,baseColor.a);\n#endif\nwriteFragmentColor(fragColorOut);\n#else\n#ifdef DEBUG_UV\noutFragColor.rgb=vec3(getDebugUVColor(getBaseColorUV(),normal));\n#endif\n#ifdef DEBUG_METALLIC\noutFragColor.rgb=vec3(metallic);\n#endif\n#ifdef DEBUG_ROUGHNESS\noutFragColor.rgb=vec3(perceptualRoughness);\n#endif\n#ifdef DEBUG_NORMAL\noutFragColor.rgb=normal*0.5+0.5;\n#endif\n#ifdef DEBUG_BASECOLOR\noutFragColor.rgb=LINEARtoSRGB(baseColor.rgb);\n#endif\n#ifdef DEBUG_OCCLUSION\n#ifdef HAS_OCCLUSION_MAP\noutFragColor.rgb=vec3(mix(1.0,ao,_OcclusionStrength));\n#else\noutFragColor.rgb=vec3(1.0);\n#endif\n#endif\n#ifdef DEBUG_EMISSIVE\n#ifdef HAS_EMISSIVE\nemissive=_EmissiveFactor.rgb*_EmissiveIntensity;\n#endif\n#ifdef HAS_EMISSIVE_MAP\nemissive=SRGBtoLINEAR(texture2D(_EmissiveSampler,getEmissiveUV())).rgb*_EmissiveFactor.rgb*_EmissiveIntensity;\n#endif\noutFragColor.rgb=LINEARtoSRGB(emissive);\n#endif\n#ifdef DEBUG_F0\noutFragColor.rgb=vec3(f0);\n#endif\n#ifdef DEBUG_ALPHA\noutFragColor.rgb=vec3(baseColor.a);\n#endif\noutFragColor.a=1.0;\n#endif\n}";
3884
3837
 
@@ -3888,7 +3841,7 @@ var skyboxVert = "precision highp float;\n#define FEATURES\n#include <webglCompa
3888
3841
 
3889
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);}";
3890
3843
 
3891
- var animationVertGLSL = "#ifdef HAS_TARGET_POSITION0\nvsIn vec3 a_Target_Position0;\n#endif\n#ifdef HAS_TARGET_POSITION1\nvsIn vec3 a_Target_Position1;\n#endif\n#ifdef HAS_TARGET_POSITION2\nvsIn vec3 a_Target_Position2;\n#endif\n#ifdef HAS_TARGET_POSITION3\nvsIn vec3 a_Target_Position3;\n#endif\n#ifdef HAS_TARGET_POSITION4\nvsIn vec3 a_Target_Position4;\n#endif\n#ifdef HAS_TARGET_POSITION5\nvsIn vec3 a_Target_Position5;\n#endif\n#ifdef HAS_TARGET_POSITION6\nvsIn vec3 a_Target_Position6;\n#endif\n#ifdef HAS_TARGET_POSITION7\nvsIn vec3 a_Target_Position7;\n#endif\n#ifdef HAS_TARGET_NORMAL0\nvsIn vec3 a_Target_Normal0;\n#endif\n#ifdef HAS_TARGET_NORMAL1\nvsIn vec3 a_Target_Normal1;\n#endif\n#ifdef HAS_TARGET_NORMAL2\nvsIn vec3 a_Target_Normal2;\n#endif\n#ifdef HAS_TARGET_NORMAL3\nvsIn vec3 a_Target_Normal3;\n#endif\n#ifdef HAS_TARGET_NORMAL4\nvsIn vec3 a_Target_Normal4;\n#endif\n#ifdef HAS_TARGET_TANGENT0\nvsIn vec3 a_Target_Tangent0;\n#endif\n#ifdef HAS_TARGET_TANGENT1\nvsIn vec3 a_Target_Tangent1;\n#endif\n#ifdef HAS_TARGET_TANGENT2\nvsIn vec3 a_Target_Tangent2;\n#endif\n#ifdef HAS_TARGET_TANGENT3\nvsIn vec3 a_Target_Tangent3;\n#endif\n#ifdef HAS_TARGET_TANGENT4\nvsIn vec3 a_Target_Tangent4;\n#endif\n#ifdef USE_MORPHING\nuniform float _morphWeights[WEIGHT_COUNT];\n#endif\n#ifdef HAS_JOINT_SET1\nvsIn vec4 a_Joint1;\n#endif\n#ifdef HAS_JOINT_SET2\nvsIn vec4 a_Joint2;\n#endif\n#ifdef HAS_WEIGHT_SET1\nvsIn vec4 a_Weight1;\n#endif\n#ifdef HAS_WEIGHT_SET2\nvsIn vec4 a_Weight2;\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+=a_Weight1.x*getJointMatrix(a_Joint1.x)+a_Weight1.y*getJointMatrix(a_Joint1.y)+a_Weight1.z*getJointMatrix(a_Joint1.z)+a_Weight1.w*getJointMatrix(a_Joint1.w);\n#endif\nreturn skin;}mat4 getSkinningNormalMatrix(){mat4 skin=mat4(0);\n#if defined(HAS_WEIGHT_SET1) && defined(HAS_JOINT_SET1)\nskin+=a_Weight1.x*getJointNormalMatrix(a_Joint1.x)+a_Weight1.y*getJointNormalMatrix(a_Joint1.y)+a_Weight1.z*getJointNormalMatrix(a_Joint1.z)+a_Weight1.w*getJointNormalMatrix(a_Joint1.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]*a_Target_Position0;\n#endif\n#ifdef HAS_TARGET_POSITION1\npos.xyz+=_morphWeights[1]*a_Target_Position1;\n#endif\n#ifdef HAS_TARGET_POSITION2\npos.xyz+=_morphWeights[2]*a_Target_Position2;\n#endif\n#ifdef HAS_TARGET_POSITION3\npos.xyz+=_morphWeights[3]*a_Target_Position3;\n#endif\n#ifdef HAS_TARGET_POSITION4\npos.xyz+=_morphWeights[4]*a_Target_Position4;\n#endif\nreturn pos;}vec4 getTargetNormal(){vec4 normal=vec4(0);\n#ifdef HAS_TARGET_NORMAL0\nnormal.xyz+=_morphWeights[0]*a_Target_Normal0;\n#endif\n#ifdef HAS_TARGET_NORMAL1\nnormal.xyz+=_morphWeights[1]*a_Target_Normal1;\n#endif\n#ifdef HAS_TARGET_NORMAL2\nnormal.xyz+=_morphWeights[2]*a_Target_Normal2;\n#endif\n#ifdef HAS_TARGET_NORMAL3\nnormal.xyz+=_morphWeights[3]*a_Target_Normal3;\n#endif\n#ifdef HAS_TARGET_NORMAL4\nnormal.xyz+=_morphWeights[4]*a_Target_Normal4;\n#endif\nreturn normal;}vec4 getTargetTangent(){vec4 tangent=vec4(0);\n#ifdef HAS_TARGET_TANGENT0\ntangent.xyz+=_morphWeights[0]*a_Target_Tangent0;\n#endif\n#ifdef HAS_TARGET_TANGENT1\ntangent.xyz+=_morphWeights[1]*a_Target_Tangent1;\n#endif\n#ifdef HAS_TARGET_TANGENT2\ntangent.xyz+=_morphWeights[2]*a_Target_Tangent2;\n#endif\n#ifdef HAS_TARGET_TANGENT3\ntangent.xyz+=_morphWeights[3]*a_Target_Tangent3;\n#endif\n#ifdef HAS_TARGET_TANGENT4\ntangent.xyz+=_morphWeights[4]*a_Target_Tangent4;\n#endif\nreturn tangent;}\n#endif\n";
3844
+ 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";
3892
3845
 
3893
3846
  var extensionsFragGLSL = "vec3 _dFdx(vec3 coord){\n#if defined(GL_OES_standard_derivatives) || defined(WEBGL2)\nreturn dFdx(coord);\n#endif\nreturn vec3(0.0);}vec3 _dFdy(vec3 coord){\n#if defined(GL_OES_standard_derivatives) || defined(WEBGL2)\nreturn dFdy(coord);\n#endif\nreturn vec3(0.0);}\n#ifdef USE_TEX_LOD\nvec4 _textureCubeLodEXT(samplerCube sampler,vec3 coord,float lod){\n#if defined(WEBGL2) || defined(GL_EXT_shader_texture_lod)\nreturn textureCubeLodEXT(sampler,coord,lod);\n#else\nreturn textureCube(sampler,coord,lod);\n#endif\n}\n#endif\n";
3894
3847
 
@@ -4660,6 +4613,7 @@ var ModelCameraComponent = /*#__PURE__*/ function(ItemBehaviour) {
4660
4613
  this.timeline = this.item.getComponent(TimelineComponent);
4661
4614
  var scene = getSceneManager(this);
4662
4615
  scene == null ? void 0 : scene.addItem(this.content);
4616
+ this.updateMainCamera();
4663
4617
  };
4664
4618
  /**
4665
4619
  * 组件更新,更新内部对象状态
@@ -5833,132 +5787,42 @@ var normal = new Vector3();
5833
5787
  * @param compatibleMode - 兼容模式
5834
5788
  * @param autoAdjustScene - 是否自动调整
5835
5789
  * @returns 场景信息描述
5836
- */ PluginHelper.preprocessScene = function preprocessScene(scene, runtimeEnv, compatibleMode, autoAdjustScene) {
5790
+ */ PluginHelper.preprocessScene = function preprocessScene(scene, runtimeEnv, compatibleMode) {
5837
5791
  var _this = this;
5838
5792
  var deviceEnv = runtimeEnv !== PLAYER_OPTIONS_ENV_EDITOR;
5839
5793
  var tiny3dMode = compatibleMode === "tiny3d";
5840
5794
  // 默认skybox如何处理需要讨论
5841
5795
  var jsonScene = scene.jsonScene;
5842
- if (jsonScene === undefined || jsonScene.compositions === undefined) {
5796
+ if (!(jsonScene && jsonScene.textures && jsonScene.materials)) {
5843
5797
  // 安全检查
5844
5798
  return {};
5845
5799
  }
5800
+ var dataMap = {};
5801
+ scene.textureOptions.forEach(function(tex) {
5802
+ var id = tex.id;
5803
+ if (id) {
5804
+ dataMap[id] = tex;
5805
+ }
5806
+ });
5846
5807
  var loadSkybox = false;
5847
5808
  if (deviceEnv) {
5848
- var textures = scene.textureOptions;
5849
- jsonScene.compositions.forEach(function(comp) {
5850
- comp.items.forEach(function(item) {
5851
- if (item.type === spec.ItemType.mesh) {
5852
- var meshItem = item;
5853
- var primitives = meshItem.content.options.primitives;
5854
- primitives.forEach(function(prim) {
5855
- var mat = prim.material;
5856
- if (mat.type === spec.MaterialType.pbr) {
5857
- if (mat.baseColorTexture !== undefined) {
5858
- _this.preprocessTextureOptions(mat.baseColorTexture, textures, true, tiny3dMode);
5859
- }
5860
- if (mat.metallicRoughnessTexture !== undefined) {
5861
- _this.preprocessTextureOptions(mat.metallicRoughnessTexture, textures, false, tiny3dMode);
5862
- }
5863
- if (mat.normalTexture !== undefined) {
5864
- _this.preprocessTextureOptions(mat.normalTexture, textures, false, tiny3dMode);
5865
- }
5866
- if (mat.occlusionTexture !== undefined) {
5867
- _this.preprocessTextureOptions(mat.occlusionTexture, textures, false, tiny3dMode);
5868
- }
5869
- if (mat.emissiveTexture !== undefined) {
5870
- _this.preprocessTextureOptions(mat.emissiveTexture, textures, false, tiny3dMode);
5871
- }
5872
- } else {
5873
- if (mat.baseColorTexture !== undefined) {
5874
- _this.preprocessTextureOptions(mat.baseColorTexture, textures, true, tiny3dMode);
5875
- }
5876
- }
5877
- });
5878
- } else if (item.type === spec.ItemType.skybox) {
5879
- loadSkybox = true;
5880
- //
5881
- var skyboxItem = item;
5882
- var options = skyboxItem.content.options;
5883
- _this.preprocessTextureOptions(options.specularImage, textures, false, tiny3dMode);
5884
- if (options.diffuseImage !== undefined) {
5885
- _this.preprocessTextureOptions(options.diffuseImage, textures, false, tiny3dMode);
5886
- }
5887
- }
5888
- });
5809
+ jsonScene.materials.forEach(function(mat) {
5810
+ _this.preprocessTextureOptions(dataMap, mat.textures["_BaseColorSampler"], true, tiny3dMode);
5811
+ _this.preprocessTextureOptions(dataMap, mat.textures["_MetallicRoughnessSampler"], false, tiny3dMode);
5812
+ _this.preprocessTextureOptions(dataMap, mat.textures["_NormalSampler"], false, tiny3dMode);
5813
+ _this.preprocessTextureOptions(dataMap, mat.textures["_OcclusionSampler"], false, tiny3dMode);
5814
+ _this.preprocessTextureOptions(dataMap, mat.textures["_EmissiveSampler"], false, tiny3dMode);
5889
5815
  });
5890
- } else {
5891
- jsonScene.compositions.forEach(function(comp) {
5892
- comp.items.forEach(function(item) {
5893
- if (item.type === spec.ItemType.skybox) {
5894
- loadSkybox = true;
5816
+ jsonScene.components.forEach(function(comp) {
5817
+ if (comp.dataType === spec.DataType.SkyboxComponent) {
5818
+ loadSkybox = true;
5819
+ var skybox = comp;
5820
+ if (skybox.diffuseImage) {
5821
+ _this.preprocessTextureOptions(dataMap, skybox.diffuseImage, false, tiny3dMode);
5895
5822
  }
5896
- });
5897
- });
5898
- }
5899
- if (autoAdjustScene) {
5900
- jsonScene.compositions.forEach(function(comp) {
5901
- var lightCount = 0;
5902
- comp.items.forEach(function(item) {
5903
- if (item.type === spec.ItemType.light || item.type === spec.ItemType.skybox) {
5904
- ++lightCount;
5823
+ if (skybox.specularImage) {
5824
+ _this.preprocessTextureOptions(dataMap, skybox.specularImage, false, tiny3dMode);
5905
5825
  }
5906
- });
5907
- if (lightCount == 0) {
5908
- comp.items.push({
5909
- id: "dir-light1",
5910
- duration: 100,
5911
- name: "dir-light1",
5912
- type: spec.ItemType.light,
5913
- transform: {
5914
- rotation: [
5915
- 45,
5916
- -45,
5917
- 0
5918
- ]
5919
- },
5920
- pluginName: "model",
5921
- endBehavior: 0,
5922
- content: {
5923
- options: {
5924
- lightType: "directional",
5925
- color: [
5926
- 255,
5927
- 255,
5928
- 255,
5929
- 255
5930
- ],
5931
- intensity: 1.5
5932
- }
5933
- }
5934
- });
5935
- comp.items.push({
5936
- id: "dir-light2",
5937
- duration: 100,
5938
- name: "dir-light2",
5939
- type: spec.ItemType.light,
5940
- transform: {
5941
- rotation: [
5942
- 0,
5943
- 90,
5944
- 0
5945
- ]
5946
- },
5947
- pluginName: "model",
5948
- endBehavior: 0,
5949
- content: {
5950
- options: {
5951
- lightType: "directional",
5952
- color: [
5953
- 255,
5954
- 255,
5955
- 255,
5956
- 255
5957
- ],
5958
- intensity: 0.2
5959
- }
5960
- }
5961
- });
5962
5826
  }
5963
5827
  });
5964
5828
  }
@@ -5973,31 +5837,46 @@ var normal = new Vector3();
5973
5837
  * @param isBaseColor - 是否基础颜色
5974
5838
  * @param tiny3dMode - 是否 Tiny3d 模式
5975
5839
  * @returns
5976
- */ PluginHelper.preprocessTextureOptions = function preprocessTextureOptions(index, textures, isBaseColor, tiny3dMode) {
5977
- if (index < 0 || index >= textures.length) {
5840
+ */ PluginHelper.preprocessTextureOptions = function preprocessTextureOptions(dataMap, textureInfo, isBaseColor, tiny3dMode) {
5841
+ if (!tiny3dMode || !textureInfo) {
5978
5842
  return;
5979
5843
  }
5980
- var texOptions = textures[index];
5981
- if (tiny3dMode && texOptions !== undefined) {
5982
- if (texOptions.target === undefined || texOptions.target === glContext.TEXTURE_2D) {
5983
- texOptions.wrapS = glContext.REPEAT;
5984
- texOptions.wrapT = glContext.REPEAT;
5985
- texOptions.magFilter = glContext.LINEAR;
5986
- texOptions.minFilter = glContext.LINEAR_MIPMAP_LINEAR;
5987
- texOptions.generateMipmap = true;
5988
- if (!isBaseColor) {
5989
- texOptions.premultiplyAlpha = true;
5990
- }
5991
- } else if (texOptions.target === glContext.TEXTURE_CUBE_MAP) {
5992
- texOptions.wrapS = glContext.CLAMP_TO_EDGE;
5993
- texOptions.wrapT = glContext.CLAMP_TO_EDGE;
5994
- if (texOptions.mipmaps !== undefined) {
5844
+ var texId;
5845
+ if ("texture" in textureInfo) {
5846
+ texId = textureInfo.texture.id;
5847
+ } else {
5848
+ texId = textureInfo.id;
5849
+ }
5850
+ if (!texId) {
5851
+ return;
5852
+ }
5853
+ var texOptions = dataMap[texId];
5854
+ if (!texOptions) {
5855
+ return;
5856
+ }
5857
+ if (texOptions.target === undefined || texOptions.target === glContext.TEXTURE_2D) {
5858
+ texOptions.wrapS = glContext.REPEAT;
5859
+ texOptions.wrapT = glContext.REPEAT;
5860
+ texOptions.magFilter = glContext.LINEAR;
5861
+ texOptions.minFilter = glContext.LINEAR_MIPMAP_LINEAR;
5862
+ texOptions.generateMipmap = true;
5863
+ if (!isBaseColor) {
5864
+ texOptions.premultiplyAlpha = true;
5865
+ }
5866
+ } else if (texOptions.target === glContext.TEXTURE_CUBE_MAP) {
5867
+ texOptions.wrapS = glContext.CLAMP_TO_EDGE;
5868
+ texOptions.wrapT = glContext.CLAMP_TO_EDGE;
5869
+ if (texOptions.mipmaps !== undefined) {
5870
+ if (texOptions.mipmaps.length === 1) {
5995
5871
  texOptions.magFilter = glContext.LINEAR;
5996
- texOptions.minFilter = glContext.LINEAR_MIPMAP_LINEAR;
5872
+ texOptions.minFilter = glContext.LINEAR;
5997
5873
  } else {
5998
5874
  texOptions.magFilter = glContext.LINEAR;
5999
- texOptions.minFilter = glContext.LINEAR;
5875
+ texOptions.minFilter = glContext.LINEAR_MIPMAP_LINEAR;
6000
5876
  }
5877
+ } else {
5878
+ texOptions.magFilter = glContext.LINEAR;
5879
+ texOptions.minFilter = glContext.LINEAR;
6001
5880
  }
6002
5881
  }
6003
5882
  };
@@ -6152,20 +6031,20 @@ var normal = new Vector3();
6152
6031
  case "NORMAL":
6153
6032
  return "aNormal";
6154
6033
  case "TANGENT":
6155
- return "a_Tangent";
6034
+ return "aTangent";
6156
6035
  case "TEXCOORD_0":
6157
6036
  return "aUV";
6158
6037
  case "TEXCOORD_1":
6159
6038
  return "aUV2";
6160
6039
  case "JOINTS_0":
6161
- return "a_Joint1";
6040
+ return "aJoints";
6162
6041
  case "WEIGHTS_0":
6163
- return "a_Weight1";
6042
+ return "aWeights";
6164
6043
  }
6165
- if (!name.startsWith("a_")) {
6166
- // aPos, aNormal, a_Tangent,
6167
- // aUV, aUV2, a_Joint1, a_Weight1
6168
- // a_Target_XXX
6044
+ if (!name.startsWith("a")) {
6045
+ // aPos, aNormal, aTangent,
6046
+ // aUV, aUV2, aJoints, aWeights
6047
+ // aTargetXXX
6169
6048
  console.warn("Unknown attribute name: " + name);
6170
6049
  }
6171
6050
  return name;
@@ -6234,7 +6113,9 @@ var normal = new Vector3();
6234
6113
  canvas: canvas,
6235
6114
  renderFramework: "webgl2",
6236
6115
  env: PLAYER_OPTIONS_ENV_EDITOR,
6237
- willCaptureImage: true,
6116
+ renderOptions: {
6117
+ willCaptureImage: true
6118
+ },
6238
6119
  manualRender: manualRender
6239
6120
  });
6240
6121
  };
@@ -6560,11 +6441,11 @@ var AttributeArray = /*#__PURE__*/ function() {
6560
6441
  this.position = new AttributeArray();
6561
6442
  this.position.create(positionAttrib, positionArray);
6562
6443
  //
6563
- var jointAttrib = attributes["a_Joint1"];
6564
- var weightAttrib = attributes["a_Weight1"];
6444
+ var jointAttrib = attributes["aJoints"];
6445
+ var weightAttrib = attributes["aWeights"];
6565
6446
  if (jointAttrib !== undefined && weightAttrib !== undefined) {
6566
- var jointArray = geometry.getAttributeData("a_Joint1");
6567
- var weightArray = geometry.getAttributeData("a_Weight1");
6447
+ var jointArray = geometry.getAttributeData("aJoints");
6448
+ var weightArray = geometry.getAttributeData("aWeights");
6568
6449
  this.joint = new AttributeArray();
6569
6450
  this.joint.create(jointAttrib, jointArray);
6570
6451
  this.weight = new AttributeArray();
@@ -6674,11 +6555,11 @@ var AttributeArray = /*#__PURE__*/ function() {
6674
6555
  this.position = new AttributeArray();
6675
6556
  this.position.create(positionAttrib, positionArray);
6676
6557
  //
6677
- var jointAttrib = attributes["a_Joint1"];
6678
- var weightAttrib = attributes["a_Weight1"];
6558
+ var jointAttrib = attributes["aJoints"];
6559
+ var weightAttrib = attributes["aWeights"];
6679
6560
  if (jointAttrib !== undefined && weightAttrib !== undefined) {
6680
- var jointArray = geometry.getAttributeData("a_Joint1");
6681
- var weightArray = geometry.getAttributeData("a_Weight1");
6561
+ var jointArray = geometry.getAttributeData("aJoints");
6562
+ var weightArray = geometry.getAttributeData("aWeights");
6682
6563
  this.joint = new AttributeArray();
6683
6564
  this.joint.create(jointAttrib, jointArray);
6684
6565
  this.weight = new AttributeArray();
@@ -7100,15 +6981,15 @@ var AttributeArray = /*#__PURE__*/ function() {
7100
6981
  // }
7101
6982
  // this.assertGeometryBuffer(v, 'aPos', maxLength);
7102
6983
  // this.assertGeometryBuffer(v, 'aNormal', maxLength);
7103
- // this.assertGeometryBuffer(v, 'a_Tangent', maxLength);
6984
+ // this.assertGeometryBuffer(v, 'aTangent', maxLength);
7104
6985
  // this.assertGeometryBuffer(v, 'aUV', maxLength);
7105
- // this.assertGeometryBuffer(v, 'a_Joint1', maxLength);
7106
- // this.assertGeometryBuffer(v, 'a_Weight1', maxLength);
6986
+ // this.assertGeometryBuffer(v, 'aJoints', maxLength);
6987
+ // this.assertGeometryBuffer(v, 'aWeights', maxLength);
7107
6988
  // // 索引检查
7108
6989
  // if(s !== undefined){
7109
6990
  // const matLen = s.inverseBindMatrices?.length ?? 0;
7110
6991
  // if(matLen > 0){
7111
- // const jointArray = this.createAttributeArray(v, "a_Joint1");
6992
+ // const jointArray = this.createAttributeArray(v, "aJoints");
7112
6993
  // if(jointArray !== undefined){
7113
6994
  // for(let i = 0; i < maxLength; i++){
7114
6995
  // const data = jointArray.getData(i);
@@ -7837,7 +7718,8 @@ var CullMode;
7837
7718
  */ _proto.setMaterialStates = function setMaterialStates(material) {
7838
7719
  if (this.renderType === "Blend") {
7839
7720
  material.blending = true;
7840
- material.depthTest = true;
7721
+ material.depthTest = this.ZTest;
7722
+ material.depthMask = this.ZWrite;
7841
7723
  material.blendEquation = [
7842
7724
  glContext.FUNC_ADD,
7843
7725
  glContext.FUNC_ADD
@@ -7848,7 +7730,6 @@ var CullMode;
7848
7730
  glContext.ONE,
7849
7731
  glContext.ONE_MINUS_SRC_ALPHA
7850
7732
  ];
7851
- material.depthMask = this.ZWrite;
7852
7733
  } else {
7853
7734
  if (PGlobalState.getInstance().isTiny3dMode) {
7854
7735
  material.blending = false;
@@ -8877,6 +8758,7 @@ var PSkyboxType;
8877
8758
  renderable: renderable,
8878
8759
  intensity: intensity,
8879
8760
  reflectionsIntensity: reflectionsIntensity,
8761
+ // @ts-expect-error
8880
8762
  irradianceCoeffs: irradianceCoeffs,
8881
8763
  diffuseImage: diffuseImage,
8882
8764
  specularImage: specularImage,
@@ -8892,6 +8774,55 @@ var PSkyboxType;
8892
8774
  })();
8893
8775
  };
8894
8776
  /**
8777
+ * 创建天空盒选项
8778
+ * @param engine - 引擎
8779
+ * @param params - 天空盒参数
8780
+ * @returns 天空盒选项
8781
+ */ PSkyboxCreator.createSkyboxComponentData = function createSkyboxComponentData(engine, params) {
8782
+ var _imageList;
8783
+ var specularCubeData = this.getSpecularCubeMapData(engine, params);
8784
+ var diffuseCubeData = this.getDiffuseCubeMapData(engine, params);
8785
+ var renderable = params.renderable, intensity = params.intensity, reflectionsIntensity = params.reflectionsIntensity, irradianceCoeffs = params.irradianceCoeffs, specularImageSize = params.specularImageSize, specularMipCount = params.specularMipCount;
8786
+ var diffuseImage;
8787
+ var imageList = [];
8788
+ var textureOptionsList = [];
8789
+ if (diffuseCubeData) {
8790
+ var _imageList1;
8791
+ (_imageList1 = imageList).push.apply(_imageList1, [].concat(diffuseCubeData.images));
8792
+ textureOptionsList.push(diffuseCubeData.textureOptions);
8793
+ diffuseImage = {
8794
+ id: diffuseCubeData.textureOptions.id
8795
+ };
8796
+ }
8797
+ (_imageList = imageList).push.apply(_imageList, [].concat(specularCubeData.images));
8798
+ textureOptionsList.push(specularCubeData.textureOptions);
8799
+ var specularImage = {
8800
+ id: specularCubeData.textureOptions.id
8801
+ };
8802
+ var componentData = {
8803
+ id: generateGUID(),
8804
+ dataType: spec.DataType.SkyboxComponent,
8805
+ item: {
8806
+ id: generateGUID()
8807
+ },
8808
+ renderable: renderable,
8809
+ intensity: intensity,
8810
+ reflectionsIntensity: reflectionsIntensity,
8811
+ irradianceCoeffs: irradianceCoeffs,
8812
+ // @ts-expect-error
8813
+ diffuseImage: diffuseImage,
8814
+ // @ts-expect-error
8815
+ specularImage: specularImage,
8816
+ specularImageSize: specularImageSize,
8817
+ specularMipCount: specularMipCount
8818
+ };
8819
+ return {
8820
+ imageList: imageList,
8821
+ textureOptionsList: textureOptionsList,
8822
+ component: componentData
8823
+ };
8824
+ };
8825
+ /**
8895
8826
  * 创建高光 Cube Map 纹理
8896
8827
  * @param engine - 引擎
8897
8828
  * @param params - 天空盒参数
@@ -8919,6 +8850,37 @@ var PSkyboxType;
8919
8850
  });
8920
8851
  })();
8921
8852
  };
8853
+ PSkyboxCreator.getSpecularCubeMapData = function getSpecularCubeMapData(engine, params) {
8854
+ var imageDatas = [];
8855
+ var mipmaps = [];
8856
+ params.specularImage.forEach(function(cubemap) {
8857
+ var mipmap = [];
8858
+ cubemap.forEach(function(image) {
8859
+ var imageId = generateGUID();
8860
+ imageDatas.push({
8861
+ id: imageId,
8862
+ // @ts-expect-error
8863
+ url: image
8864
+ });
8865
+ mipmap.push({
8866
+ id: imageId
8867
+ });
8868
+ });
8869
+ mipmaps.push(mipmap);
8870
+ });
8871
+ var textureOptions = _extends({
8872
+ id: generateGUID(),
8873
+ dataType: spec.DataType.Texture,
8874
+ sourceType: TextureSourceType.mipmaps,
8875
+ target: glContext.TEXTURE_CUBE_MAP,
8876
+ // @ts-expect-error
8877
+ mipmaps: mipmaps
8878
+ }, WebGLHelper.cubemapMipTexConfig);
8879
+ return {
8880
+ images: imageDatas,
8881
+ textureOptions: textureOptions
8882
+ };
8883
+ };
8922
8884
  /**
8923
8885
  * 创建漫反射纹理
8924
8886
  * @param engine - 引擎
@@ -8947,6 +8909,38 @@ var PSkyboxType;
8947
8909
  });
8948
8910
  })();
8949
8911
  };
8912
+ PSkyboxCreator.getDiffuseCubeMapData = function getDiffuseCubeMapData(engine, params) {
8913
+ if (params.diffuseImage === undefined) {
8914
+ return;
8915
+ }
8916
+ var imageDatas = [];
8917
+ var cubemap = [];
8918
+ params.diffuseImage.forEach(function(image) {
8919
+ var imageId = generateGUID();
8920
+ imageDatas.push({
8921
+ id: imageId,
8922
+ // @ts-expect-error
8923
+ url: image
8924
+ });
8925
+ cubemap.push({
8926
+ id: imageId
8927
+ });
8928
+ });
8929
+ var textureOptions = _extends({
8930
+ id: generateGUID(),
8931
+ dataType: spec.DataType.Texture,
8932
+ sourceType: TextureSourceType.mipmaps,
8933
+ target: glContext.TEXTURE_CUBE_MAP,
8934
+ // @ts-expect-error
8935
+ mipmaps: [
8936
+ cubemap
8937
+ ]
8938
+ }, WebGLHelper.cubemapTexConfig);
8939
+ return {
8940
+ images: imageDatas,
8941
+ textureOptions: textureOptions
8942
+ };
8943
+ };
8950
8944
  /**
8951
8945
  * 创建天空盒参数
8952
8946
  * @param skyboxType - 天空盒类型
@@ -9037,15 +9031,7 @@ var PSkyboxType;
9037
9031
  ];
9038
9032
  break;
9039
9033
  }
9040
- var returnArray = [];
9041
- for(var i = 0; i < dataArray.length; i += 3){
9042
- returnArray.push([
9043
- dataArray[i],
9044
- dataArray[i + 1],
9045
- dataArray[i + 2]
9046
- ]);
9047
- }
9048
- return returnArray;
9034
+ return dataArray;
9049
9035
  };
9050
9036
  PSkyboxCreator.getDiffuseImageList = function getDiffuseImageList(skyboxType, images) {
9051
9037
  if (skyboxType == 0) {
@@ -9425,7 +9411,8 @@ var PSkyboxType;
9425
9411
  var engine = composition.renderer.engine;
9426
9412
  this.cache = new CompositionCache(engine);
9427
9413
  this.cache.setup(false);
9428
- PluginHelper.setupItem3DOptions(scene, this.cache, composition);
9414
+ // FIXME: 先注释元素参数的配置
9415
+ //PluginHelper.setupItem3DOptions(scene, this.cache, composition);
9429
9416
  };
9430
9417
  /**
9431
9418
  * 每次播放都会执行,包括重播,所以这里执行“小的销毁”和新的初始化
@@ -9463,7 +9450,7 @@ var PSkyboxType;
9463
9450
  * @param options - 加载选项
9464
9451
  */ ModelPlugin.prepareResource = function prepareResource(scene, options) {
9465
9452
  return _async_to_generator(function() {
9466
- var keyList, pluginData, _options_env, runtimeEnv;
9453
+ var _options_pluginData, keyList, pluginData, _options_env, runtimeEnv, _options_pluginData_compatibleMode, compatibleMode;
9467
9454
  return __generator(this, function(_state) {
9468
9455
  switch(_state.label){
9469
9456
  case 0:
@@ -9485,10 +9472,9 @@ var PSkyboxType;
9485
9472
  //
9486
9473
  runtimeEnv = (_options_env = options.env) != null ? _options_env : "";
9487
9474
  scene.storage["runtimeEnv"] = runtimeEnv;
9488
- // const compatibleMode = options.pluginData?.['compatibleMode'] ?? 'gltf';
9489
- // const autoAdjustScene = options.pluginData?.['autoAdjustScene'] ?? false;
9475
+ compatibleMode = (_options_pluginData_compatibleMode = (_options_pluginData = options.pluginData) == null ? void 0 : _options_pluginData["compatibleMode"]) != null ? _options_pluginData_compatibleMode : "gltf";
9490
9476
  //
9491
- //PluginHelper.preprocessScene(scene, runtimeEnv, compatibleMode, autoAdjustScene);
9477
+ PluginHelper.preprocessScene(scene, runtimeEnv, compatibleMode);
9492
9478
  return [
9493
9479
  4,
9494
9480
  CompositionCache.loadStaticResources()
@@ -11318,7 +11304,7 @@ var GeometryProxy = /*#__PURE__*/ function() {
11318
11304
  if (this.hasTangent) {
11319
11305
  var attrib2 = this.tangentAttrib;
11320
11306
  if (attrib2 !== undefined) {
11321
- attributes["a_Tangent"] = this._getBufferAttrib(attrib2);
11307
+ attributes["aTangent"] = this._getBufferAttrib(attrib2);
11322
11308
  }
11323
11309
  }
11324
11310
  this.texCoordList.forEach(function(val) {
@@ -11329,11 +11315,11 @@ var GeometryProxy = /*#__PURE__*/ function() {
11329
11315
  if (this.hasSkinAnimation) {
11330
11316
  var jointAttrib = this.jointAttribute;
11331
11317
  if (jointAttrib !== undefined) {
11332
- attributes["a_Joint1"] = this._getBufferAttrib(jointAttrib);
11318
+ attributes["aJoints"] = this._getBufferAttrib(jointAttrib);
11333
11319
  }
11334
11320
  var weightAttrib = this.weightAttribute;
11335
11321
  if (weightAttrib !== undefined) {
11336
- attributes["a_Weight1"] = this._getBufferAttrib(weightAttrib);
11322
+ attributes["aWeights"] = this._getBufferAttrib(weightAttrib);
11337
11323
  }
11338
11324
  }
11339
11325
  /**
@@ -11341,15 +11327,15 @@ var GeometryProxy = /*#__PURE__*/ function() {
11341
11327
  */ for(var i = 0; i < 8; i++){
11342
11328
  var positionAttrib = this.getTargetPosition(i);
11343
11329
  if (positionAttrib !== undefined) {
11344
- attributes["a_Target_Position" + i] = this._getBufferAttrib(positionAttrib);
11330
+ attributes["aTargetPosition" + i] = this._getBufferAttrib(positionAttrib);
11345
11331
  }
11346
11332
  var normalAttrib = this.getTargetNormal(i);
11347
11333
  if (normalAttrib !== undefined) {
11348
- attributes["a_Target_Normal" + i] = this._getBufferAttrib(normalAttrib);
11334
+ attributes["aTargetNormal" + i] = this._getBufferAttrib(normalAttrib);
11349
11335
  }
11350
11336
  var tangentAttrib = this.getTargetTangent(i);
11351
11337
  if (tangentAttrib !== undefined) {
11352
- attributes["a_Target_Tangent" + i] = this._getBufferAttrib(tangentAttrib);
11338
+ attributes["aTargetTangent" + i] = this._getBufferAttrib(tangentAttrib);
11353
11339
  }
11354
11340
  }
11355
11341
  var indexArray = this.indexArray;
@@ -11799,10 +11785,1077 @@ var GLTFHelper = /*#__PURE__*/ function() {
11799
11785
  return GLTFHelper;
11800
11786
  }();
11801
11787
 
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
+ var JSONConverter = /*#__PURE__*/ function() {
11824
+ function JSONConverter(player) {
11825
+ this.treeItemList = [];
11826
+ this.engine = player.renderer.engine;
11827
+ this.renderer = player.renderer;
11828
+ this.downloader = new Downloader();
11829
+ }
11830
+ var _proto = JSONConverter.prototype;
11831
+ _proto.processScene = function processScene(sceneData) {
11832
+ var _this = this;
11833
+ return _async_to_generator(function() {
11834
+ var sceneJSON, oldScene, binFiles, _iterator, _step, bin, _, newScene;
11835
+ return __generator(this, function(_state) {
11836
+ switch(_state.label){
11837
+ case 0:
11838
+ if (!_instanceof1(sceneData, Object)) return [
11839
+ 3,
11840
+ 1
11841
+ ];
11842
+ sceneJSON = sceneData;
11843
+ return [
11844
+ 3,
11845
+ 3
11846
+ ];
11847
+ case 1:
11848
+ return [
11849
+ 4,
11850
+ _this.loadJSON(sceneData)
11851
+ ];
11852
+ case 2:
11853
+ sceneJSON = _state.sent();
11854
+ _state.label = 3;
11855
+ case 3:
11856
+ // @ts-expect-error
11857
+ sceneJSON.textures.forEach(function(tex) {
11858
+ if (tex.source === undefined) {
11859
+ tex.source = 0;
11860
+ }
11861
+ });
11862
+ oldScene = getStandardJSON(sceneJSON);
11863
+ binFiles = [];
11864
+ if (!oldScene.bins) return [
11865
+ 3,
11866
+ 7
11867
+ ];
11868
+ _iterator = _create_for_of_iterator_helper_loose(oldScene.bins);
11869
+ _state.label = 4;
11870
+ case 4:
11871
+ if (!!(_step = _iterator()).done) return [
11872
+ 3,
11873
+ 7
11874
+ ];
11875
+ bin = _step.value;
11876
+ _ = binFiles.push;
11877
+ return [
11878
+ 4,
11879
+ _this.loadBins(bin.url)
11880
+ ];
11881
+ case 5:
11882
+ _.apply(binFiles, [
11883
+ _state.sent()
11884
+ ]);
11885
+ _state.label = 6;
11886
+ case 6:
11887
+ return [
11888
+ 3,
11889
+ 4
11890
+ ];
11891
+ case 7:
11892
+ // @ts-expect-error
11893
+ oldScene.bins = binFiles;
11894
+ newScene = {
11895
+ version: "3.0",
11896
+ playerVersion: {
11897
+ web: "3.0",
11898
+ native: "3.0"
11899
+ },
11900
+ type: "ge",
11901
+ compositions: [],
11902
+ compositionId: oldScene.compositionId,
11903
+ images: [],
11904
+ shapes: oldScene.shapes,
11905
+ plugins: oldScene.plugins,
11906
+ textures: [],
11907
+ items: [],
11908
+ components: [],
11909
+ materials: [],
11910
+ shaders: [],
11911
+ geometries: []
11912
+ };
11913
+ _this.treeItemList = [];
11914
+ _this.setImage(newScene, oldScene);
11915
+ return [
11916
+ 4,
11917
+ _this.setTexture(newScene, oldScene)
11918
+ ];
11919
+ case 8:
11920
+ _state.sent();
11921
+ _this.setComponent(newScene, oldScene);
11922
+ _this.setItem(newScene, oldScene);
11923
+ _this.setComposition(newScene, oldScene);
11924
+ return [
11925
+ 2,
11926
+ newScene
11927
+ ];
11928
+ }
11929
+ });
11930
+ })();
11931
+ };
11932
+ _proto.setImage = function setImage(newScene, oldScene) {
11933
+ var newImages = [];
11934
+ oldScene.images.forEach(function(image) {
11935
+ newImages.push(image);
11936
+ });
11937
+ newScene.images = newImages;
11938
+ };
11939
+ _proto.setTexture = function setTexture(newScene, oldScene) {
11940
+ var _this = this;
11941
+ return _async_to_generator(function() {
11942
+ var newTextures, bins, _iterator, _step, tex, mipmaps, target, jobs, loadedMipmaps, newMipmaps, newTex, source;
11943
+ return __generator(this, function(_state) {
11944
+ switch(_state.label){
11945
+ case 0:
11946
+ newTextures = [];
11947
+ bins = oldScene.bins;
11948
+ if (!oldScene.textures) return [
11949
+ 3,
11950
+ 5
11951
+ ];
11952
+ _iterator = _create_for_of_iterator_helper_loose(oldScene.textures);
11953
+ _state.label = 1;
11954
+ case 1:
11955
+ if (!!(_step = _iterator()).done) return [
11956
+ 3,
11957
+ 5
11958
+ ];
11959
+ tex = _step.value;
11960
+ if (!(tex.target === 34067)) return [
11961
+ 3,
11962
+ 3
11963
+ ];
11964
+ mipmaps = tex.mipmaps, target = tex.target;
11965
+ jobs = mipmaps.map(function(mipmap) {
11966
+ return Promise.all(mipmap.map(function(pointer) {
11967
+ return _this.loadMipmapImage(pointer, bins);
11968
+ }));
11969
+ });
11970
+ return [
11971
+ 4,
11972
+ Promise.all(jobs)
11973
+ ];
11974
+ case 2:
11975
+ loadedMipmaps = _state.sent();
11976
+ newMipmaps = loadedMipmaps.map(function(mipmaps) {
11977
+ return mipmaps.map(function(img) {
11978
+ var id = generateGUID();
11979
+ var sceneImage = {
11980
+ url: img,
11981
+ id: id
11982
+ };
11983
+ newScene.images.push(sceneImage);
11984
+ var dataPath = {
11985
+ id: id
11986
+ };
11987
+ return dataPath;
11988
+ });
11989
+ });
11990
+ newTex = _extends({
11991
+ keepImageSource: false
11992
+ }, tex, {
11993
+ mipmaps: newMipmaps,
11994
+ sourceFrom: {
11995
+ target: target,
11996
+ type: TextureSourceType.mipmaps,
11997
+ mipmaps: mipmaps.map(function(mipmap) {
11998
+ return mipmap.map(function(pointer) {
11999
+ return [
12000
+ pointer[1][1],
12001
+ pointer[1][2]
12002
+ ];
12003
+ });
12004
+ })
12005
+ }
12006
+ });
12007
+ // @ts-expect-error
12008
+ newTextures.push(newTex);
12009
+ return [
12010
+ 3,
12011
+ 4
12012
+ ];
12013
+ case 3:
12014
+ // @ts-expect-error
12015
+ source = tex.source;
12016
+ if (typeof source === "number") {
12017
+ // @ts-expect-error
12018
+ tex.source = {
12019
+ id: newScene.images[source].id
12020
+ };
12021
+ }
12022
+ newTextures.push(tex);
12023
+ _state.label = 4;
12024
+ case 4:
12025
+ return [
12026
+ 3,
12027
+ 1
12028
+ ];
12029
+ case 5:
12030
+ newScene.textures = newTextures;
12031
+ return [
12032
+ 2
12033
+ ];
12034
+ }
12035
+ });
12036
+ })();
12037
+ };
12038
+ _proto.setComponent = function setComponent(newScene, oldScene) {
12039
+ var newComponents = newScene.components;
12040
+ for(var _iterator = _create_for_of_iterator_helper_loose(oldScene.components), _step; !(_step = _iterator()).done;){
12041
+ var comp = _step.value;
12042
+ if (comp.dataType === spec.DataType.SkyboxComponent) {
12043
+ newComponents.push(this.createSkyboxComponent(comp, newScene));
12044
+ } else if (comp.dataType === spec.DataType.MeshComponent) {
12045
+ newComponents.push(this.createMeshComponent(comp, newScene, oldScene));
12046
+ } else if (comp.dataType === spec.DataType.LightComponent) {
12047
+ newComponents.push(this.createLightComponent(comp, newScene));
12048
+ } else if (comp.dataType === spec.DataType.CameraComponent) {
12049
+ newComponents.push(comp);
12050
+ console.warn("Find camera component", comp);
12051
+ } else if (comp.dataType === spec.DataType.TreeComponent) {
12052
+ var treeComp = comp;
12053
+ this.createItemsFromTreeComponent(comp, newScene, oldScene);
12054
+ treeComp.options.tree.animation = undefined;
12055
+ treeComp.options.tree.animations = undefined;
12056
+ newComponents.push(comp);
12057
+ } else {
12058
+ newComponents.push(comp);
12059
+ }
12060
+ }
12061
+ };
12062
+ _proto.setItem = function setItem(newScene, oldScene) {};
12063
+ _proto.setComposition = function setComposition(newScene, oldScene) {
12064
+ var _newScene_items;
12065
+ newScene.items = oldScene.items;
12066
+ (_newScene_items = newScene.items).push.apply(_newScene_items, [].concat(this.treeItemList));
12067
+ newScene.compositionId = oldScene.compositionId;
12068
+ newScene.compositions = oldScene.compositions;
12069
+ newScene.items.forEach(function(item) {
12070
+ // @ts-expect-error
12071
+ if (item.type === "root") {
12072
+ // @ts-expect-error
12073
+ item.type = "ECS";
12074
+ }
12075
+ });
12076
+ // @ts-expect-error
12077
+ newScene.compositions[0].items = newScene.items.map(function(item) {
12078
+ return {
12079
+ id: item.id
12080
+ };
12081
+ });
12082
+ };
12083
+ _proto.loadJSON = function loadJSON(url) {
12084
+ var _this = this;
12085
+ return _async_to_generator(function() {
12086
+ return __generator(this, function(_state) {
12087
+ return [
12088
+ 2,
12089
+ new Promise(function(resolve, reject) {
12090
+ _this.downloader.downloadJSON(url, resolve, function(status, responseText) {
12091
+ reject(new Error("Couldn't load JSON " + JSON.stringify(url) + ": status " + status + ", " + responseText));
12092
+ });
12093
+ })
12094
+ ];
12095
+ });
12096
+ })();
12097
+ };
12098
+ _proto.loadBins = function loadBins(url) {
12099
+ var _this = this;
12100
+ return _async_to_generator(function() {
12101
+ return __generator(this, function(_state) {
12102
+ return [
12103
+ 2,
12104
+ new Promise(function(resolve, reject) {
12105
+ _this.downloader.downloadBinary(url, resolve, function(status, responseText) {
12106
+ reject("Couldn't load bins " + JSON.stringify(url) + ": status " + status + ", " + responseText);
12107
+ });
12108
+ })
12109
+ ];
12110
+ });
12111
+ })();
12112
+ };
12113
+ _proto.loadMipmapImage = function loadMipmapImage(pointer, bins) {
12114
+ return _async_to_generator(function() {
12115
+ var _pointer_, index, start, length, bin;
12116
+ return __generator(this, function(_state) {
12117
+ _pointer_ = pointer[1], index = _pointer_[0], start = _pointer_[1], length = _pointer_[2];
12118
+ bin = bins[index];
12119
+ if (!bin) {
12120
+ throw new Error("invalid bin pointer: " + JSON.stringify(pointer));
12121
+ }
12122
+ return [
12123
+ 2,
12124
+ URL.createObjectURL(new Blob([
12125
+ new Uint8Array(bin, start, length)
12126
+ ]))
12127
+ ];
12128
+ });
12129
+ })();
12130
+ };
12131
+ _proto.createSkyboxComponent = function createSkyboxComponent(component, scene) {
12132
+ var skyboxOptions = component.options;
12133
+ var irradianceCoeffs;
12134
+ if (skyboxOptions.irradianceCoeffs) {
12135
+ var _irradianceCoeffs;
12136
+ irradianceCoeffs = [];
12137
+ skyboxOptions.irradianceCoeffs.forEach(function(coeffs) {
12138
+ return (_irradianceCoeffs = irradianceCoeffs).push.apply(_irradianceCoeffs, [].concat(coeffs));
12139
+ });
12140
+ }
12141
+ var diffuseImage;
12142
+ if (skyboxOptions.diffuseImage) {
12143
+ // @ts-expect-error
12144
+ diffuseImage = {
12145
+ id: scene.textures[skyboxOptions.diffuseImage].id
12146
+ };
12147
+ }
12148
+ var skyboxComponent = {
12149
+ id: component.id,
12150
+ dataType: component.dataType,
12151
+ item: component.item,
12152
+ renderable: skyboxOptions.renderable,
12153
+ intensity: skyboxOptions.intensity,
12154
+ reflectionsIntensity: skyboxOptions.reflectionsIntensity,
12155
+ irradianceCoeffs: irradianceCoeffs,
12156
+ diffuseImage: diffuseImage,
12157
+ specularImage: {
12158
+ // @ts-expect-error
12159
+ id: scene.textures[skyboxOptions.specularImage].id
12160
+ },
12161
+ specularImageSize: skyboxOptions.specularImageSize,
12162
+ specularMipCount: skyboxOptions.specularMipCount
12163
+ };
12164
+ return skyboxComponent;
12165
+ };
12166
+ _proto.createMeshComponent = function createMeshComponent(component, newScene, oldScene) {
12167
+ var _this = this;
12168
+ var _newScene_materials;
12169
+ var meshOptions = component.options;
12170
+ var geometryPropsList = [];
12171
+ var materialDatas = [];
12172
+ meshOptions.primitives.forEach(function(prim) {
12173
+ var _geomProps_indices;
12174
+ var geomProps = deserializeGeometry(prim.geometry, oldScene.bins);
12175
+ var material = _this.getMaterialData(prim.material, oldScene);
12176
+ if (_instanceof1((_geomProps_indices = geomProps.indices) == null ? void 0 : _geomProps_indices.data, Uint8Array)) {
12177
+ var oldIndices = geomProps.indices.data;
12178
+ var newIndices = new Uint16Array(oldIndices.length);
12179
+ for(var i = 0; i < oldIndices.length; i++){
12180
+ newIndices[i] = oldIndices[i];
12181
+ }
12182
+ geomProps.indices.data = newIndices;
12183
+ }
12184
+ geometryPropsList.push(geomProps);
12185
+ materialDatas.push(material);
12186
+ });
12187
+ var geometryData = getGeometryDataFromPropsList(geometryPropsList);
12188
+ if (!geometryData) {
12189
+ throw new Error("no primitives");
12190
+ }
12191
+ newScene.geometries.push(geometryData);
12192
+ (_newScene_materials = newScene.materials).push.apply(_newScene_materials, [].concat(materialDatas));
12193
+ var meshComponent = {
12194
+ id: component.id,
12195
+ dataType: component.dataType,
12196
+ item: component.item,
12197
+ geometry: {
12198
+ id: geometryData.id
12199
+ },
12200
+ materials: materialDatas.map(function(mat) {
12201
+ var data = {
12202
+ id: mat.id
12203
+ };
12204
+ return data;
12205
+ }),
12206
+ rootBone: {
12207
+ id: ""
12208
+ }
12209
+ };
12210
+ return meshComponent;
12211
+ };
12212
+ _proto.createItemsFromTreeComponent = function createItemsFromTreeComponent(component, newScene, oldScene) {
12213
+ var _this = this;
12214
+ var _this_treeItemList;
12215
+ var treeItem = oldScene.items[0];
12216
+ oldScene.items.forEach(function(item) {
12217
+ if (item.id === component.item.id) {
12218
+ treeItem = item;
12219
+ }
12220
+ });
12221
+ var treeComp = component;
12222
+ var treeData = treeComp.options.tree;
12223
+ var treeItemList = [];
12224
+ treeData.nodes.forEach(function(node) {
12225
+ var _node_name;
12226
+ var item = {
12227
+ id: generateGUID(),
12228
+ parentId: treeItem.id,
12229
+ name: (_node_name = node.name) != null ? _node_name : "<unnamed>",
12230
+ duration: treeItem.duration,
12231
+ // @ts-expect-error
12232
+ type: "ECS",
12233
+ dataType: spec.DataType.VFXItemData,
12234
+ visible: treeItem.visible,
12235
+ endBehavior: treeItem.endBehavior,
12236
+ delay: treeItem.delay,
12237
+ content: {},
12238
+ renderLevel: treeItem.renderLevel,
12239
+ pn: treeItem.pn,
12240
+ pluginName: treeItem.pluginName,
12241
+ transform: _this.getTransformData(node.transform),
12242
+ components: []
12243
+ };
12244
+ treeItemList.push(item);
12245
+ newScene.items.push(item);
12246
+ });
12247
+ treeData.nodes.forEach(function(node, index) {
12248
+ var _node_children;
12249
+ var item = treeItemList[index];
12250
+ (_node_children = node.children) == null ? void 0 : _node_children.forEach(function(child) {
12251
+ var childItem = treeItemList[child];
12252
+ childItem.parentId = item.id;
12253
+ });
12254
+ });
12255
+ oldScene.items.forEach(function(item) {
12256
+ if (item.parentId) {
12257
+ var index = item.parentId.indexOf("^");
12258
+ if (index >= 0) {
12259
+ var parentId = item.parentId.substring(0, index);
12260
+ var subIndex = +item.parentId.substring(index + 1);
12261
+ if (parentId === treeItem.id) {
12262
+ item.parentId = treeItemList[subIndex].id;
12263
+ }
12264
+ }
12265
+ }
12266
+ });
12267
+ (_this_treeItemList = this.treeItemList).push.apply(_this_treeItemList, [].concat(treeItemList));
12268
+ };
12269
+ _proto.createLightComponent = function createLightComponent(component, scene) {
12270
+ var lightOptions = component.options;
12271
+ var lightComponent = {
12272
+ id: component.id,
12273
+ dataType: component.dataType,
12274
+ item: component.item,
12275
+ lightType: lightOptions.lightType,
12276
+ color: {
12277
+ r: lightOptions.color[0] / 255.0,
12278
+ g: lightOptions.color[1] / 255.0,
12279
+ b: lightOptions.color[2] / 255.0,
12280
+ a: lightOptions.color[3] / 255.0
12281
+ },
12282
+ intensity: lightOptions.intensity
12283
+ };
12284
+ if (lightOptions.lightType === "point") {
12285
+ lightComponent.range = lightOptions.range;
12286
+ } else if (lightOptions.lightType === "spot") {
12287
+ lightComponent.range = lightOptions.range;
12288
+ lightComponent.innerConeAngle = lightOptions.innerConeAngle;
12289
+ lightComponent.outerConeAngle = lightOptions.outerConeAngle;
12290
+ }
12291
+ return lightComponent;
12292
+ };
12293
+ _proto.getMaterialData = function getMaterialData(material, scene) {
12294
+ if (material.type === spec.MaterialType.unlit) {
12295
+ var floats = {};
12296
+ if (material.alphaCutOff !== undefined) {
12297
+ floats["_AlphaCutoff"] = material.alphaCutOff;
12298
+ }
12299
+ var colors = {
12300
+ "_BaseColorFactor": new Color(material.baseColorFactor[0], material.baseColorFactor[1], material.baseColorFactor[2], material.baseColorFactor[3]).divide(255)
12301
+ };
12302
+ var textures = {};
12303
+ if (material.baseColorTexture) {
12304
+ textures["_BaseColorSampler"] = this.getTextureData(scene, floats, material.baseColorTexture, material.baseColorTextureTransform);
12305
+ }
12306
+ var newMaterial = {
12307
+ id: generateGUID(),
12308
+ name: material.name,
12309
+ dataType: spec.DataType.Material,
12310
+ shader: {
12311
+ id: UnlitShaderGUID
12312
+ },
12313
+ stringTags: this.getStringTags(material),
12314
+ macros: [],
12315
+ ints: {},
12316
+ floats: floats,
12317
+ vector4s: {},
12318
+ colors: colors,
12319
+ textures: textures
12320
+ };
12321
+ return newMaterial;
12322
+ } else {
12323
+ var floats1 = {
12324
+ "_MetallicFactor": material.metallicFactor,
12325
+ "_RoughnessFactor": material.roughnessFactor
12326
+ };
12327
+ if (material.useSpecularAA !== undefined) {
12328
+ floats1["_SpecularAA"] = material.useSpecularAA ? 1 : 0;
12329
+ }
12330
+ if (material.normalTextureScale !== undefined) {
12331
+ floats1["_NormalScale"] = material.normalTextureScale;
12332
+ }
12333
+ if (material.occlusionTextureStrength !== undefined) {
12334
+ floats1["_OcclusionStrength"] = material.occlusionTextureStrength;
12335
+ }
12336
+ if (material.emissiveIntensity !== undefined) {
12337
+ floats1["_EmissiveIntensity"] = material.emissiveIntensity;
12338
+ }
12339
+ if (material.alphaCutOff !== undefined) {
12340
+ floats1["_AlphaCutoff"] = material.alphaCutOff;
12341
+ }
12342
+ var colors1 = {
12343
+ "_BaseColorFactor": new Color(material.baseColorFactor[0], material.baseColorFactor[1], material.baseColorFactor[2], material.baseColorFactor[3]).divide(255),
12344
+ "_EmissiveFactor": new Color(material.emissiveFactor[0], material.emissiveFactor[1], material.emissiveFactor[2], material.emissiveFactor[3]).divide(255)
12345
+ };
12346
+ var textures1 = {};
12347
+ if (material.baseColorTexture) {
12348
+ textures1["_BaseColorSampler"] = this.getTextureData(scene, floats1, material.baseColorTexture, material.baseColorTextureTransform);
12349
+ }
12350
+ if (material.metallicRoughnessTexture) {
12351
+ textures1["_MetallicRoughnessSampler"] = this.getTextureData(scene, floats1, material.metallicRoughnessTexture, material.metallicRoughnessTextureTransform);
12352
+ }
12353
+ if (material.normalTexture) {
12354
+ textures1["_NormalSampler"] = this.getTextureData(scene, floats1, material.normalTexture, material.normalTextureTransform);
12355
+ }
12356
+ if (material.occlusionTexture) {
12357
+ textures1["_OcclusionSampler"] = this.getTextureData(scene, floats1, material.occlusionTexture, material.occlusionTextureTransform);
12358
+ }
12359
+ if (material.emissiveTexture) {
12360
+ textures1["_EmissiveSampler"] = this.getTextureData(scene, floats1, material.emissiveTexture, material.emissiveTextureTransform);
12361
+ }
12362
+ var newMaterial1 = {
12363
+ id: generateGUID(),
12364
+ name: material.name,
12365
+ dataType: spec.DataType.Material,
12366
+ shader: {
12367
+ id: PBRShaderGUID
12368
+ },
12369
+ stringTags: this.getStringTags(material),
12370
+ macros: [],
12371
+ ints: {},
12372
+ floats: floats1,
12373
+ vector4s: {},
12374
+ colors: colors1,
12375
+ textures: textures1
12376
+ };
12377
+ return newMaterial1;
12378
+ }
12379
+ };
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;
12389
+ } else {
12390
+ stringTags["RenderType"] = RenderType.Opaque;
12391
+ }
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;
12396
+ } else {
12397
+ stringTags["Cull"] = CullMode.Front;
12398
+ }
12399
+ return stringTags;
12400
+ };
12401
+ _proto.getTextureData = function getTextureData(scene, floats, texIndex, texTransform) {
12402
+ var _scene_textures_texIndex_id;
12403
+ var id = (_scene_textures_texIndex_id = scene.textures[texIndex].id) != null ? _scene_textures_texIndex_id : "0";
12404
+ var texProperty = {
12405
+ texture: {
12406
+ id: id
12407
+ }
12408
+ };
12409
+ if (texTransform) {
12410
+ if (texTransform.scale) {
12411
+ texProperty.scale = {
12412
+ x: texTransform.scale[0],
12413
+ y: texTransform.scale[1]
12414
+ };
12415
+ }
12416
+ if (texTransform.offset) {
12417
+ texProperty.offset = {
12418
+ x: texTransform.offset[0],
12419
+ y: texTransform.offset[1]
12420
+ };
12421
+ }
12422
+ if (texTransform.rotation) {
12423
+ floats["_BaseColorRotation"] = texTransform.rotation;
12424
+ }
12425
+ }
12426
+ return texProperty;
12427
+ };
12428
+ _proto.getTransformData = function getTransformData(transform) {
12429
+ var result = {
12430
+ position: {
12431
+ x: 0,
12432
+ y: 0,
12433
+ z: 0
12434
+ },
12435
+ eulerHint: {
12436
+ x: 0,
12437
+ y: 0,
12438
+ z: 0
12439
+ },
12440
+ scale: {
12441
+ x: 1,
12442
+ y: 1,
12443
+ z: 1
12444
+ }
12445
+ };
12446
+ if (transform == null ? void 0 : transform.position) {
12447
+ result.position.x = transform.position[0];
12448
+ result.position.y = transform.position[1];
12449
+ result.position.z = transform.position[2];
12450
+ }
12451
+ if (transform == null ? void 0 : transform.quat) {
12452
+ // @ts-expect-error
12453
+ result.quat = {};
12454
+ // @ts-expect-error
12455
+ result.quat.x = transform.quat[0];
12456
+ // @ts-expect-error
12457
+ result.quat.y = transform.quat[1];
12458
+ // @ts-expect-error
12459
+ result.quat.z = transform.quat[2];
12460
+ // @ts-expect-error
12461
+ result.quat.w = transform.quat[3];
12462
+ } else if (transform == null ? void 0 : transform.rotation) {
12463
+ result.eulerHint.x = transform.rotation[0];
12464
+ result.eulerHint.y = transform.rotation[1];
12465
+ result.eulerHint.z = transform.rotation[2];
12466
+ }
12467
+ if (transform == null ? void 0 : transform.scale) {
12468
+ result.scale.x = transform.scale[0];
12469
+ result.scale.y = transform.scale[1];
12470
+ result.scale.z = transform.scale[2];
12471
+ }
12472
+ return result;
12473
+ };
12474
+ return JSONConverter;
12475
+ }();
12476
+ function getGeometryDataFromOptions(geomOptions) {
12477
+ var vertexCount = 0;
12478
+ var verticesType = spec.VertexFormatType.Float32;
12479
+ var verticesNormalize = false;
12480
+ var uvsType = spec.VertexFormatType.Float32;
12481
+ var uvsNormalize = false;
12482
+ var normalsType = spec.VertexFormatType.Float32;
12483
+ var normalsNormalize = false;
12484
+ var _geomOptions_name;
12485
+ var modelData = {
12486
+ vertices: new Float32Array(),
12487
+ uvs: new Float32Array(),
12488
+ normals: new Float32Array(),
12489
+ indices: new Float32Array(),
12490
+ name: (_geomOptions_name = geomOptions.name) != null ? _geomOptions_name : "<empty>"
12491
+ };
12492
+ for(var attrib in geomOptions.attributes){
12493
+ var attribData = geomOptions.attributes[attrib];
12494
+ if (attrib === "aPosition") {
12495
+ // @ts-expect-error
12496
+ vertexCount = attribData.data.length / attribData.size;
12497
+ // @ts-expect-error
12498
+ modelData.vertices = attribData.data;
12499
+ var _attribData_normalize;
12500
+ verticesNormalize = (_attribData_normalize = attribData.normalize) != null ? _attribData_normalize : false;
12501
+ var _attribData_type;
12502
+ verticesType = glType2VertexFormatType((_attribData_type = attribData.type) != null ? _attribData_type : glContext.FLOAT);
12503
+ } else if (attrib === "aNormal") {
12504
+ // @ts-expect-error
12505
+ modelData.normals = attribData.data;
12506
+ var _attribData_normalize1;
12507
+ normalsNormalize = (_attribData_normalize1 = attribData.normalize) != null ? _attribData_normalize1 : false;
12508
+ var _attribData_type1;
12509
+ normalsType = glType2VertexFormatType((_attribData_type1 = attribData.type) != null ? _attribData_type1 : glContext.FLOAT);
12510
+ } else if (attrib === "aUV1") {
12511
+ // @ts-expect-error
12512
+ modelData.uvs = attribData.data;
12513
+ var _attribData_normalize2;
12514
+ uvsNormalize = (_attribData_normalize2 = attribData.normalize) != null ? _attribData_normalize2 : false;
12515
+ var _attribData_type2;
12516
+ uvsType = glType2VertexFormatType((_attribData_type2 = attribData.type) != null ? _attribData_type2 : glContext.FLOAT);
12517
+ }
12518
+ }
12519
+ var verticesOffset = getOffset(verticesType, 3, vertexCount);
12520
+ var uvsOffset = getOffset(uvsType, 2, vertexCount);
12521
+ var normalsOffset = getOffset(normalsType, 3, vertexCount);
12522
+ if (geomOptions.indices) {
12523
+ modelData.indices = geomOptions.indices.data;
12524
+ } else if (vertexCount <= 65535) {
12525
+ var indices = new Uint16Array(vertexCount);
12526
+ for(var i = 0; i < vertexCount; i++){
12527
+ indices[i] = i;
12528
+ }
12529
+ modelData.indices = indices;
12530
+ } else {
12531
+ var indices1 = new Uint32Array(vertexCount);
12532
+ for(var i1 = 0; i1 < vertexCount; i1++){
12533
+ indices1[i1] = i1;
12534
+ }
12535
+ modelData.indices = indices1;
12536
+ }
12537
+ var indicesType = spec.IndexFormatType.UInt16;
12538
+ if (modelData.indices.BYTES_PER_ELEMENT === 4) {
12539
+ indicesType = spec.IndexFormatType.UInt32;
12540
+ }
12541
+ var geometryData = {
12542
+ id: generateGUID(),
12543
+ dataType: spec.DataType.Geometry,
12544
+ vertexData: {
12545
+ vertexCount: vertexCount,
12546
+ channels: [
12547
+ {
12548
+ semantic: spec.VertexBufferSemantic.Position,
12549
+ offset: 0,
12550
+ format: verticesType,
12551
+ dimension: 3,
12552
+ normalize: verticesNormalize
12553
+ },
12554
+ {
12555
+ semantic: spec.VertexBufferSemantic.Uv,
12556
+ offset: verticesOffset,
12557
+ format: uvsType,
12558
+ dimension: 2,
12559
+ normalize: uvsNormalize
12560
+ },
12561
+ {
12562
+ semantic: spec.VertexBufferSemantic.Normal,
12563
+ offset: verticesOffset + uvsOffset,
12564
+ format: normalsType,
12565
+ dimension: 3,
12566
+ normalize: normalsNormalize
12567
+ }
12568
+ ]
12569
+ },
12570
+ subMeshes: [],
12571
+ mode: spec.GeometryType.TRIANGLES,
12572
+ indexFormat: indicesType,
12573
+ indexOffset: verticesOffset + uvsOffset + normalsOffset,
12574
+ buffer: encodeVertexData(modelData)
12575
+ };
12576
+ return geometryData;
12577
+ }
12578
+ function getGeometryDataFromPropsList(geomPropsList) {
12579
+ var _loop = function(i) {
12580
+ var _geomPropsList__indices;
12581
+ var count = getDrawCount(geomPropsList[i]);
12582
+ var _geomPropsList_i_drawStart;
12583
+ var offset = totalCount + ((_geomPropsList_i_drawStart = geomPropsList[i].drawStart) != null ? _geomPropsList_i_drawStart : 0);
12584
+ var _geomPropsList__indices_data_BYTES_PER_ELEMENT;
12585
+ 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
+ subMeshes.push({
12587
+ offset: offset * scale,
12588
+ count: count
12589
+ });
12590
+ if (i) {
12591
+ var geom0 = geomPropsList[0];
12592
+ var geom1 = geomPropsList[i];
12593
+ var isSame = true;
12594
+ Object.keys(geom0.attributes).forEach(function(name) {
12595
+ var attrib = geom0.attributes[name];
12596
+ // @ts-expect-error
12597
+ var array1 = attrib.data;
12598
+ // @ts-expect-error
12599
+ var array2 = geom1.attributes[name].data;
12600
+ if (array1.length !== array2.length || array1[0] !== array2[0]) {
12601
+ isSame = false;
12602
+ }
12603
+ });
12604
+ if (isSame) {
12605
+ if (geom0.indices && geom1.indices) {
12606
+ geom0.indices.data = mergeTypedArray(geom0.indices.data, geom1.indices.data);
12607
+ }
12608
+ } else {
12609
+ if (geom0.indices && geom1.indices) {
12610
+ var vertexCount = getVertexCount(geom0);
12611
+ geom0.indices.data = mergeTypedArray(geom0.indices.data, geom1.indices.data, vertexCount);
12612
+ }
12613
+ Object.keys(geom0.attributes).forEach(function(name) {
12614
+ var attrib = geom0.attributes[name];
12615
+ // @ts-expect-error
12616
+ var array1 = attrib.data;
12617
+ // @ts-expect-error
12618
+ var array2 = geom1.attributes[name].data;
12619
+ // @ts-expect-error
12620
+ attrib.data = mergeTypedArray(array1, array2);
12621
+ });
12622
+ }
12623
+ }
12624
+ totalCount = offset + count;
12625
+ };
12626
+ if (geomPropsList.length <= 0) {
12627
+ return;
12628
+ }
12629
+ var totalCount = 0;
12630
+ var subMeshes = [];
12631
+ for(var i = 0; i < geomPropsList.length; i++)_loop(i);
12632
+ return createGeometryData(geomPropsList[0], subMeshes);
12633
+ }
12634
+ function getOffset(formatType, dimension, count) {
12635
+ switch(formatType){
12636
+ case spec.VertexFormatType.Int8:
12637
+ case spec.VertexFormatType.UInt8:
12638
+ return dimension * count;
12639
+ case spec.VertexFormatType.Int16:
12640
+ case spec.VertexFormatType.UInt16:
12641
+ return dimension * count * 2;
12642
+ default:
12643
+ return dimension * count * 4;
12644
+ }
12645
+ }
12646
+ function createGeometryData(props, subMeshes) {
12647
+ var totalByteLength = 0;
12648
+ for(var attrib in props.attributes){
12649
+ var attribData = props.attributes[attrib];
12650
+ // @ts-expect-error
12651
+ totalByteLength += attribData.data.byteLength;
12652
+ }
12653
+ if (props.indices) {
12654
+ totalByteLength += props.indices.data.byteLength;
12655
+ }
12656
+ var vertexCount = 0;
12657
+ var bufferOffset = 0;
12658
+ var buffer = new Uint8Array(totalByteLength);
12659
+ var vertexChannels = [];
12660
+ for(var attrib1 in props.attributes){
12661
+ var attribData1 = props.attributes[attrib1];
12662
+ var semantic = vertexBufferSemanticMap[attrib1];
12663
+ if (!semantic) {
12664
+ throw new Error("Invalid attrib " + attrib1);
12665
+ }
12666
+ // @ts-expect-error
12667
+ vertexCount = attribData1.data.length / attribData1.size;
12668
+ var _attribData_type;
12669
+ var vertexChannel = {
12670
+ semantic: semantic,
12671
+ offset: bufferOffset,
12672
+ format: glType2VertexFormatType((_attribData_type = attribData1.type) != null ? _attribData_type : glContext.FLOAT),
12673
+ dimension: attribData1.size,
12674
+ normalize: attribData1.normalize
12675
+ };
12676
+ vertexChannels.push(vertexChannel);
12677
+ // @ts-expect-error
12678
+ var data = attribData1.data;
12679
+ var subBuffer = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
12680
+ buffer.set(subBuffer, bufferOffset);
12681
+ bufferOffset += subBuffer.byteLength;
12682
+ }
12683
+ var geometryData = {
12684
+ id: generateGUID(),
12685
+ dataType: spec.DataType.Geometry,
12686
+ vertexData: {
12687
+ vertexCount: vertexCount,
12688
+ channels: vertexChannels
12689
+ },
12690
+ subMeshes: subMeshes,
12691
+ mode: spec.GeometryType.TRIANGLES,
12692
+ indexFormat: spec.IndexFormatType.UInt16,
12693
+ indexOffset: -1,
12694
+ buffer: ""
12695
+ };
12696
+ if (props.indices) {
12697
+ var indices = props.indices.data;
12698
+ var subBuffer1 = new Uint8Array(indices.buffer, indices.byteOffset, indices.byteLength);
12699
+ buffer.set(subBuffer1, bufferOffset);
12700
+ geometryData.indexOffset = bufferOffset;
12701
+ if (_instanceof1(indices, Uint32Array)) {
12702
+ geometryData.indexFormat = spec.IndexFormatType.UInt32;
12703
+ }
12704
+ }
12705
+ geometryData.buffer = toBase64String(buffer);
12706
+ return geometryData;
12707
+ }
12708
+ function encodeVertexData(modelData) {
12709
+ var vertices = new Uint8Array(modelData.vertices.buffer, modelData.vertices.byteOffset, modelData.vertices.byteLength);
12710
+ var uvs = new Uint8Array(modelData.uvs.buffer, modelData.uvs.byteOffset, modelData.uvs.byteLength);
12711
+ var normals = new Uint8Array(modelData.normals.buffer, modelData.normals.byteOffset, modelData.normals.byteLength);
12712
+ var indices = new Uint8Array(modelData.indices.buffer, modelData.indices.byteOffset, modelData.indices.byteLength);
12713
+ // 计算新 ArrayBuffer 的总大小(以字节为单位)
12714
+ var totalSize = vertices.byteLength + uvs.byteLength + normals.byteLength + indices.byteLength;
12715
+ // 创建一个足够大的 ArrayBuffer 来存储两个数组的数据
12716
+ var buffer = new ArrayBuffer(totalSize);
12717
+ // 创建一个视图来按照 Float32 格式写入数据
12718
+ var floatView = new Uint8Array(buffer, 0, vertices.byteLength);
12719
+ floatView.set(vertices);
12720
+ floatView = new Uint8Array(buffer, vertices.byteLength, uvs.byteLength);
12721
+ floatView.set(uvs);
12722
+ floatView = new Uint8Array(buffer, vertices.byteLength + uvs.byteLength, normals.byteLength);
12723
+ floatView.set(normals);
12724
+ // 创建一个视图来按照 Uint16 格式写入数据,紧接着 Float32 数据之后
12725
+ var uint16View = new Uint8Array(buffer, vertices.byteLength + uvs.byteLength + normals.byteLength, indices.byteLength);
12726
+ uint16View.set(indices);
12727
+ // 创建一个 Uint8Array 视图以便逐字节访问 ArrayBuffer 的数据
12728
+ var uint8View = new Uint8Array(buffer);
12729
+ // 将 Uint8Array 转换为二进制字符串
12730
+ var binaryString = "";
12731
+ for(var i = 0; i < uint8View.length; i++){
12732
+ binaryString += String.fromCharCode(uint8View[i]);
12733
+ }
12734
+ // 使用 btoa 函数将二进制字符串转换为 Base64 编码的字符串
12735
+ return btoa(binaryString);
12736
+ }
12737
+ function toBase64String(array) {
12738
+ // 将 Uint8Array 转换为二进制字符串
12739
+ var binaryString = "";
12740
+ for(var i = 0; i < array.length; i++){
12741
+ binaryString += String.fromCharCode(array[i]);
12742
+ }
12743
+ // 使用 btoa 函数将二进制字符串转换为 Base64 编码的字符串
12744
+ return btoa(binaryString);
12745
+ }
12746
+ function getDrawCount(geomProps) {
12747
+ if (geomProps.drawCount) {
12748
+ return geomProps.drawCount;
12749
+ } else if (geomProps.indices) {
12750
+ return geomProps.indices.data.length;
12751
+ } else {
12752
+ var drawCount = 0;
12753
+ // @ts-expect-error
12754
+ geomProps.attributes.forEach(function(attrib) {
12755
+ drawCount = attrib.data.length / attrib.size;
12756
+ });
12757
+ return drawCount;
12758
+ }
12759
+ }
12760
+ function getVertexCount(geomProps) {
12761
+ var vertexCount = 0;
12762
+ Object.keys(geomProps.attributes).forEach(function(name) {
12763
+ var attrib = geomProps.attributes[name];
12764
+ // @ts-expect-error
12765
+ vertexCount = attrib.data.length / attrib.size;
12766
+ });
12767
+ return vertexCount;
12768
+ }
12769
+ function mergeTypedArray(array1, array2, offset) {
12770
+ if (_instanceof1(array1, Float32Array)) {
12771
+ var result = new Float32Array(array1.length + array2.length);
12772
+ result.set(array1);
12773
+ result.set(array2, array1.length);
12774
+ return result;
12775
+ } else if (_instanceof1(array1, Int32Array)) {
12776
+ var result1 = new Int32Array(array1.length + array2.length);
12777
+ result1.set(array1);
12778
+ result1.set(array2, array1.length);
12779
+ return result1;
12780
+ } else if (_instanceof1(array1, Uint32Array)) {
12781
+ var result2 = new Uint32Array(array1.length + array2.length);
12782
+ result2.set(array1);
12783
+ result2.set(array2, array1.length);
12784
+ if (offset) {
12785
+ for(var i = 0; i < array2.length; i++){
12786
+ result2[array1.length + i] += offset;
12787
+ }
12788
+ }
12789
+ return result2;
12790
+ } else if (_instanceof1(array1, Int16Array)) {
12791
+ var result3 = new Int16Array(array1.length + array2.length);
12792
+ result3.set(array1);
12793
+ result3.set(array2, array1.length);
12794
+ return result3;
12795
+ } else if (_instanceof1(array1, Uint16Array)) {
12796
+ var result4 = new Uint16Array(array1.length + array2.length);
12797
+ result4.set(array1);
12798
+ result4.set(array2, array1.length);
12799
+ if (offset) {
12800
+ for(var i1 = 0; i1 < array2.length; i1++){
12801
+ result4[array1.length + i1] += offset;
12802
+ }
12803
+ }
12804
+ return result4;
12805
+ } else if (_instanceof1(array1, Int8Array)) {
12806
+ var result5 = new Int8Array(array1.length + array2.length);
12807
+ result5.set(array1);
12808
+ result5.set(array2, array1.length);
12809
+ return result5;
12810
+ } else {
12811
+ var result6 = new Uint8Array(array1.length + array2.length);
12812
+ result6.set(array1);
12813
+ result6.set(array2, array1.length);
12814
+ return result6;
12815
+ }
12816
+ }
12817
+ var vertexBufferSemanticMap = {
12818
+ aPos: "POSITION",
12819
+ aUV: "TEXCOORD0",
12820
+ aUV2: "TEXCOORD1",
12821
+ aNormal: "NORMAL",
12822
+ aTangent: "TANGENT",
12823
+ aColor: "COLOR",
12824
+ aJoints: "JOINTS",
12825
+ aWeights: "WEIGHTS",
12826
+ //
12827
+ a_Position: "POSITION",
12828
+ a_UV: "TEXCOORD0",
12829
+ a_UV1: "TEXCOORD0",
12830
+ a_UV2: "TEXCOORD1",
12831
+ a_Normal: "NORMAL",
12832
+ a_Tangent: "TANGENT",
12833
+ a_Color: "COLOR",
12834
+ a_Joints: "JOINTS",
12835
+ a_Weights: "WEIGHTS",
12836
+ //
12837
+ a_Target_Position0: "POSITION_BS0",
12838
+ a_Target_Position1: "POSITION_BS1",
12839
+ a_Target_Position2: "POSITION_BS2",
12840
+ a_Target_Position3: "POSITION_BS3",
12841
+ a_Target_Position4: "POSITION_BS4",
12842
+ a_Target_Position5: "POSITION_BS5",
12843
+ a_Target_Position6: "POSITION_BS6",
12844
+ a_Target_Position7: "POSITION_BS7",
12845
+ a_Target_Normal0: "NORMAL_BS0",
12846
+ a_Target_Normal1: "NORMAL_BS1",
12847
+ a_Target_Normal2: "NORMAL_BS2",
12848
+ a_Target_Normal3: "NORMAL_BS3",
12849
+ a_Target_Tangent0: "TANGENT_BS0",
12850
+ a_Target_Tangent1: "TANGENT_BS1",
12851
+ a_Target_Tangent2: "TANGENT_BS2",
12852
+ a_Target_Tangent3: "TANGENT_BS3"
12853
+ };
12854
+
11802
12855
  registerPlugin("tree", ModelTreePlugin, VFXItem, true);
11803
12856
  registerPlugin("model", ModelPlugin, VFXItem);
11804
- var version = "2.0.0-alpha.10";
12857
+ var version = "2.0.0-alpha.12";
11805
12858
  logger.info("plugin model version: " + version);
11806
12859
 
11807
- export { BoxMesh, CameraGestureHandlerImp, CameraGestureType, CheckerHelper, CompositionCache, CompositionHitTest, CullMode, FBOOptions, Float16ArrayWrapper, GeometryBoxProxy, HitTestingProxy, HookOGLFunc, InterpolationSampler, 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, PPrimitive, PSceneManager, PShaderManager, PShadowType, PSkin, PSkybox, PSkyboxCreator, PSkyboxType, 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, getKawaseBlurShaderCode, getNormalVisShaderCode, getPBRPassShaderCode, getPMeshList, getQuadFilterShaderCode, getRendererGPUInfo, getSceneManager, getShadowPassShaderCode, getSimpleFilterShaderCode, getSkyBoxShaderCode, getTransparecyBaseShader, getTransparecyFilterShader, setDefaultEffectsGLTFLoader, version };
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 };
11808
12861
  //# sourceMappingURL=index.mjs.map