@galacean/effects-plugin-model 2.10.4 → 2.11.0-alpha.1

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,15 +3,11 @@
3
3
  * Description: Galacean Effects player model plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 飂兮
6
- * Version: v2.10.4
6
+ * Version: v2.11.0-alpha.1
7
7
  */
8
8
 
9
9
  import * as EFFECTS from '@galacean/effects';
10
- import { math, spec, Transform, PLAYER_OPTIONS_ENV_EDITOR, RenderPassAttachmentStorageType, glContext, Material, Mesh, Geometry, VertexBuffer, ShaderFactory, effectsClass, HitTestType, RendererComponent, Behaviour, AnimationClip, TextureSourceType, Texture, DestroyOptions, RenderPassDestroyAttachmentType, GLSLVersion, Player, Renderer, getDefaultTextureFactory, loadImage, generateGUID, addItem, removeItem, VFXItem, Plugin, glType2VertexFormatType, Downloader, getStandardJSON, isObject, registerPlugin, logger } from '@galacean/effects';
11
-
12
- /**
13
- * Model 插件元素类型
14
- */ var VFX_ITEM_TYPE_3D = "PluginModel";
10
+ import { math, spec, Transform, PLAYER_OPTIONS_ENV_EDITOR, RenderPassAttachmentStorageType, glContext, Material, Mesh, Geometry, VertexElementType, ShaderFactory, effectsClass, HitTestType, RendererComponent, Behaviour, AnimationClip, TextureSourceType, Texture, DestroyOptions, RenderPassDestroyAttachmentType, GLSLVersion, Player, Renderer, getDefaultTextureFactory, loadImage, generateGUID, addItem, removeItem, VFXItem, Plugin, glType2VertexFormatType, Downloader, getStandardJSON, isObject, registerPlugin, logger } from '@galacean/effects';
15
11
 
16
12
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
17
13
  try {
@@ -1256,11 +1252,11 @@ function GetNum2GLName(ctx) {
1256
1252
  var meshList = [];
1257
1253
  var composition = player.getCompositions()[0];
1258
1254
  composition == null ? void 0 : composition.items.forEach(function(item) {
1259
- if (item.type === VFX_ITEM_TYPE_3D) {
1260
- var meshComponent = item.getComponent(ModelMeshComponent);
1261
- if ((meshComponent == null ? void 0 : meshComponent.content.type) === PObjectType.mesh) {
1262
- meshList.push(meshComponent.content);
1263
- }
1255
+ var _meshComponent_content;
1256
+ var meshComponent = item.getComponent(ModelMeshComponent);
1257
+ // content 在组件 onStart 时创建,未开始前跳过
1258
+ if ((meshComponent == null ? void 0 : (_meshComponent_content = meshComponent.content) == null ? void 0 : _meshComponent_content.type) === PObjectType.mesh) {
1259
+ meshList.push(meshComponent.content);
1264
1260
  }
1265
1261
  });
1266
1262
  return meshList;
@@ -1439,7 +1435,7 @@ function GetNum2GLName(ctx) {
1439
1435
  ]);
1440
1436
  var _obj;
1441
1437
  return {
1442
- attributes: (_obj = {}, _obj[VertexBuffer.PositionKind] = {
1438
+ attributes: (_obj = {}, _obj[VertexElementType.Position] = {
1443
1439
  type: glContext.FLOAT,
1444
1440
  size: 1,
1445
1441
  data: data,
@@ -1886,7 +1882,6 @@ var ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
1886
1882
  var _this_sceneManager;
1887
1883
  this.sceneManager = getSceneManager(this);
1888
1884
  this.createContent();
1889
- this.item.type = VFX_ITEM_TYPE_3D;
1890
1885
  this.priority = this.item.renderOrder;
1891
1886
  (_this_sceneManager = this.sceneManager) == null ? void 0 : _this_sceneManager.addItem(this.content);
1892
1887
  if (this.item.parentId && this.item.parent) {
@@ -1943,11 +1938,11 @@ var ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
1943
1938
  this.data = _extends({}, data, {
1944
1939
  materials: []
1945
1940
  });
1946
- this.data.rootBone = data.rootBone ? this.engine.findObject(data.rootBone) : undefined;
1947
- this.data.geometry = this.engine.findObject(data.geometry);
1941
+ this.data.rootBone = data.rootBone ? this.findObject(data.rootBone) : undefined;
1942
+ this.data.geometry = this.findObject(data.geometry);
1948
1943
  if (data.materials) {
1949
1944
  for(var i = 0; i < data.materials.length; i++){
1950
- this.data.materials[i] = this.engine.findObject(data.materials[i]);
1945
+ this.data.materials[i] = this.findObject(data.materials[i]);
1951
1946
  }
1952
1947
  }
1953
1948
  };
@@ -2024,7 +2019,6 @@ var ModelSkyboxComponent = /*#__PURE__*/ function(RendererComponent) {
2024
2019
  */ _proto.onStart = function onStart() {
2025
2020
  var _this_sceneManager;
2026
2021
  this.createContent();
2027
- this.item.type = VFX_ITEM_TYPE_3D;
2028
2022
  this.priority = this.item.renderOrder;
2029
2023
  this.sceneManager = getSceneManager(this);
2030
2024
  (_this_sceneManager = this.sceneManager) == null ? void 0 : _this_sceneManager.addItem(this.content);
@@ -2059,8 +2053,8 @@ var ModelSkyboxComponent = /*#__PURE__*/ function(RendererComponent) {
2059
2053
  * @param data - 组件参数
2060
2054
  */ _proto.fromData = function fromData(data) {
2061
2055
  RendererComponent.prototype.fromData.call(this, data);
2062
- data.diffuseImage = data.diffuseImage ? this.engine.findObject(data.diffuseImage) : undefined;
2063
- data.specularImage = this.engine.findObject(data.specularImage);
2056
+ data.diffuseImage = data.diffuseImage ? this.findObject(data.diffuseImage) : undefined;
2057
+ data.specularImage = this.findObject(data.specularImage);
2064
2058
  this.data = data;
2065
2059
  };
2066
2060
  /**
@@ -2105,7 +2099,6 @@ var ModelLightComponent = /*#__PURE__*/ function(Behaviour) {
2105
2099
  * 组件开始,需要创建内部对象和添加到场景管理器中
2106
2100
  */ _proto.onStart = function onStart() {
2107
2101
  this.createContent();
2108
- this.item.type = VFX_ITEM_TYPE_3D;
2109
2102
  var scene = getSceneManager(this);
2110
2103
  scene == null ? void 0 : scene.addItem(this.content);
2111
2104
  this.setVisible(true);
@@ -2170,7 +2163,6 @@ var ModelCameraComponent = /*#__PURE__*/ function(Behaviour) {
2170
2163
  * 组件开始,需要创建内部对象和添加到场景管理器中
2171
2164
  */ _proto.onStart = function onStart() {
2172
2165
  this.createContent();
2173
- this.item.type = VFX_ITEM_TYPE_3D;
2174
2166
  var scene = getSceneManager(this);
2175
2167
  scene == null ? void 0 : scene.addItem(this.content);
2176
2168
  this.updateMainCamera();
@@ -2250,7 +2242,6 @@ var AnimationComponent = /*#__PURE__*/ function(Behaviour) {
2250
2242
  * 组件开始,需要创建内部对象和添加到场景管理器中
2251
2243
  */ _proto.onStart = function onStart() {
2252
2244
  this.elapsedTime = 0;
2253
- this.item.type = VFX_ITEM_TYPE_3D;
2254
2245
  };
2255
2246
  /**
2256
2247
  * 组件更新,更新内部对象状态
@@ -2279,7 +2270,7 @@ var AnimationComponent = /*#__PURE__*/ function(Behaviour) {
2279
2270
  this.clips = [];
2280
2271
  data.animationClips.forEach(function(clipData) {
2281
2272
  var clipObj = new ModelAnimationClip(_this.engine);
2282
- var animationClip = _this.engine.findObject(clipData);
2273
+ var animationClip = _this.findObject(clipData);
2283
2274
  clipObj.setFromAnimationClip(animationClip);
2284
2275
  _this.clips.push(clipObj);
2285
2276
  });
@@ -2587,15 +2578,14 @@ var normal = new Vector3();
2587
2578
  */ function ToggleItemBounding(composition, itemId) {
2588
2579
  var _composition_items;
2589
2580
  (_composition_items = composition.items) == null ? void 0 : _composition_items.forEach(function(item) {
2590
- if (item.type === VFX_ITEM_TYPE_3D) {
2591
- var meshComponent = item.getComponent(ModelMeshComponent);
2592
- if (meshComponent) {
2593
- var mesh = meshComponent.content;
2594
- if (item.id === itemId) {
2595
- mesh.visBoundingBox = true;
2596
- } else {
2597
- mesh.visBoundingBox = false;
2598
- }
2581
+ var _item_getComponent;
2582
+ // content 在组件 onStart 时创建,未开始前跳过
2583
+ var mesh = (_item_getComponent = item.getComponent(ModelMeshComponent)) == null ? void 0 : _item_getComponent.content;
2584
+ if (mesh) {
2585
+ if (item.id === itemId) {
2586
+ mesh.visBoundingBox = true;
2587
+ } else {
2588
+ mesh.visBoundingBox = false;
2599
2589
  }
2600
2590
  }
2601
2591
  });
@@ -3041,9 +3031,6 @@ var normal = new Vector3();
3041
3031
  * @param pass - 渲染 Pass
3042
3032
  */ WebGLHelper.deleteRenderPass = function deleteRenderPass(pass) {
3043
3033
  pass.dispose({
3044
- meshes: {
3045
- geometries: DestroyOptions.destroy
3046
- },
3047
3034
  depthStencilAttachment: RenderPassDestroyAttachmentType.force,
3048
3035
  colorAttachment: RenderPassDestroyAttachmentType.force
3049
3036
  });
@@ -3060,14 +3047,14 @@ var normal = new Vector3();
3060
3047
  * @param engine - 引擎对象
3061
3048
  * @returns
3062
3049
  */ WebGLHelper.isSupportFloatTexture = function isSupportFloatTexture(engine) {
3063
- var capability = engine.gpuCapability;
3050
+ var capability = engine.displayServer.renderingDevice.gpuCapability;
3064
3051
  return capability.detail.floatTexture !== 0;
3065
3052
  };
3066
3053
  /**
3067
3054
  * renderer 是否支持 HalfFloat 纹理
3068
3055
  * @returns
3069
3056
  */ WebGLHelper.isSupportHalfFloatTexture = function isSupportHalfFloatTexture(engine) {
3070
- var capability = engine.gpuCapability;
3057
+ var capability = engine.displayServer.renderingDevice.gpuCapability;
3071
3058
  return capability.detail.halfFloatTexture !== 0;
3072
3059
  };
3073
3060
  /**
@@ -3111,7 +3098,7 @@ var normal = new Vector3();
3111
3098
  var vertexShader = material.vertexShaderCode;
3112
3099
  var fragmentShader = material.fragmentShaderCode;
3113
3100
  var geometry = Geometry.create(engine, MeshHelper.getPlaneGeometry());
3114
- var isWebGL2 = engine.gpuCapability.level === 2;
3101
+ var isWebGL2 = engine.displayServer.renderingDevice.gpuCapability.level === 2;
3115
3102
  var effectsMaterial = Material.create(engine, {
3116
3103
  shader: {
3117
3104
  vertex: vertexShader,
@@ -3135,24 +3122,24 @@ var normal = new Vector3();
3135
3122
  var data = MeshHelper.getPlaneVertexArray();
3136
3123
  var _obj;
3137
3124
  return {
3138
- attributes: (_obj = {}, _obj[VertexBuffer.PositionKind] = {
3125
+ attributes: (_obj = {}, _obj[VertexElementType.Position] = {
3139
3126
  type: glContext.FLOAT,
3140
3127
  size: 3,
3141
3128
  data: data,
3142
3129
  stride: Float32Array.BYTES_PER_ELEMENT * 8,
3143
3130
  offset: 0
3144
- }, _obj[VertexBuffer.UVKind] = {
3131
+ }, _obj[VertexElementType.TexCoord0] = {
3145
3132
  type: glContext.FLOAT,
3146
3133
  size: 2,
3147
3134
  stride: Float32Array.BYTES_PER_ELEMENT * 8,
3148
3135
  offset: Float32Array.BYTES_PER_ELEMENT * 3,
3149
- dataSource: VertexBuffer.PositionKind
3150
- }, _obj[VertexBuffer.NormalKind] = {
3136
+ dataSource: VertexElementType.Position
3137
+ }, _obj[VertexElementType.Normal] = {
3151
3138
  type: glContext.FLOAT,
3152
3139
  size: 3,
3153
3140
  stride: Float32Array.BYTES_PER_ELEMENT * 8,
3154
3141
  offset: Float32Array.BYTES_PER_ELEMENT * 5,
3155
- dataSource: VertexBuffer.PositionKind
3142
+ dataSource: VertexElementType.Position
3156
3143
  }, _obj),
3157
3144
  drawStart: 0,
3158
3145
  drawCount: data.length / 8
@@ -3580,19 +3567,19 @@ var normal = new Vector3();
3580
3567
  */ PluginHelper.getAttributeName = function getAttributeName(name) {
3581
3568
  switch(name){
3582
3569
  case "POSITION":
3583
- return VertexBuffer.PositionKind;
3570
+ return VertexElementType.Position;
3584
3571
  case "NORMAL":
3585
- return VertexBuffer.NormalKind;
3572
+ return VertexElementType.Normal;
3586
3573
  case "TANGENT":
3587
- return VertexBuffer.TangentKind;
3574
+ return VertexElementType.Tangent;
3588
3575
  case "TEXCOORD_0":
3589
- return VertexBuffer.UVKind;
3576
+ return VertexElementType.TexCoord0;
3590
3577
  case "TEXCOORD_1":
3591
- return VertexBuffer.UV2Kind;
3578
+ return VertexElementType.TexCoord1;
3592
3579
  case "JOINTS_0":
3593
- return VertexBuffer.JointsKind;
3580
+ return VertexElementType.BlendIndices;
3594
3581
  case "WEIGHTS_0":
3595
- return VertexBuffer.WeightsKind;
3582
+ return VertexElementType.BlendWeights;
3596
3583
  }
3597
3584
  if (!name.startsWith("a")) {
3598
3585
  // aPos, aNormal, aTangent,
@@ -3986,16 +3973,16 @@ var AttributeArray = /*#__PURE__*/ function() {
3986
3973
  this.drawCount = Math.abs(geometry.getDrawCount());
3987
3974
  //
3988
3975
  this.index = geometry.getIndexData();
3989
- var positionAttrib = getAttributeLayout(geometry.getVertexBuffer(VertexBuffer.PositionKind));
3990
- var positionArray = geometry.getAttributeData(VertexBuffer.PositionKind);
3976
+ var positionAttrib = getAttributeLayout(geometry, VertexElementType.Position);
3977
+ var positionArray = geometry.getAttributeData(VertexElementType.Position);
3991
3978
  this.position = new AttributeArray();
3992
3979
  this.position.create(positionAttrib, positionArray);
3993
3980
  //
3994
- var jointAttrib = getAttributeLayout(geometry.getVertexBuffer(VertexBuffer.JointsKind));
3995
- var weightAttrib = getAttributeLayout(geometry.getVertexBuffer(VertexBuffer.WeightsKind));
3981
+ var jointAttrib = getAttributeLayout(geometry, VertexElementType.BlendIndices);
3982
+ var weightAttrib = getAttributeLayout(geometry, VertexElementType.BlendWeights);
3996
3983
  if (jointAttrib !== undefined && weightAttrib !== undefined) {
3997
- var jointArray = geometry.getAttributeData(VertexBuffer.JointsKind);
3998
- var weightArray = geometry.getAttributeData(VertexBuffer.WeightsKind);
3984
+ var jointArray = geometry.getAttributeData(VertexElementType.BlendIndices);
3985
+ var weightArray = geometry.getAttributeData(VertexElementType.BlendWeights);
3999
3986
  this.joint = new AttributeArray();
4000
3987
  this.joint.create(jointAttrib, jointArray);
4001
3988
  this.weight = new AttributeArray();
@@ -4097,16 +4084,16 @@ var AttributeArray = /*#__PURE__*/ function() {
4097
4084
  this.drawCount = Math.abs(geometry.getDrawCount());
4098
4085
  //
4099
4086
  this.index = geometry.getIndexData();
4100
- var positionAttrib = getAttributeLayout(geometry.getVertexBuffer(VertexBuffer.PositionKind));
4101
- var positionArray = geometry.getAttributeData(VertexBuffer.PositionKind);
4087
+ var positionAttrib = getAttributeLayout(geometry, VertexElementType.Position);
4088
+ var positionArray = geometry.getAttributeData(VertexElementType.Position);
4102
4089
  this.position = new AttributeArray();
4103
4090
  this.position.create(positionAttrib, positionArray);
4104
4091
  //
4105
- var jointAttrib = getAttributeLayout(geometry.getVertexBuffer(VertexBuffer.JointsKind));
4106
- var weightAttrib = getAttributeLayout(geometry.getVertexBuffer(VertexBuffer.WeightsKind));
4092
+ var jointAttrib = getAttributeLayout(geometry, VertexElementType.BlendIndices);
4093
+ var weightAttrib = getAttributeLayout(geometry, VertexElementType.BlendWeights);
4107
4094
  if (jointAttrib !== undefined && weightAttrib !== undefined) {
4108
- var jointArray = geometry.getAttributeData(VertexBuffer.JointsKind);
4109
- var weightArray = geometry.getAttributeData(VertexBuffer.WeightsKind);
4095
+ var jointArray = geometry.getAttributeData(VertexElementType.BlendIndices);
4096
+ var weightArray = geometry.getAttributeData(VertexElementType.BlendWeights);
4110
4097
  this.joint = new AttributeArray();
4111
4098
  this.joint.create(jointAttrib, jointArray);
4112
4099
  this.weight = new AttributeArray();
@@ -4568,7 +4555,7 @@ var AttributeArray = /*#__PURE__*/ function() {
4568
4555
  * @param name - 名称
4569
4556
  * @returns
4570
4557
  */ CheckerHelper.createAttributeArray = function createAttributeArray(v, name) {
4571
- var dataAttrib = getAttributeLayout(v.getVertexBuffer(name));
4558
+ var dataAttrib = getAttributeLayout(v, name);
4572
4559
  if (dataAttrib === undefined) {
4573
4560
  return;
4574
4561
  }
@@ -5039,15 +5026,16 @@ var AttributeArray = /*#__PURE__*/ function() {
5039
5026
  };
5040
5027
  return CheckerHelper;
5041
5028
  }();
5042
- function getAttributeLayout(vertexBuffer) {
5029
+ function getAttributeLayout(geometry, name) {
5030
+ var vertexBuffer = geometry.getVertexElement(name);
5043
5031
  if (!vertexBuffer) {
5044
5032
  return;
5045
5033
  }
5046
5034
  return {
5047
5035
  type: vertexBuffer.type,
5048
- size: vertexBuffer.getSize(),
5036
+ size: vertexBuffer.size,
5049
5037
  offset: vertexBuffer.byteOffset,
5050
- stride: vertexBuffer.byteStride,
5038
+ stride: geometry.getAttributeStride(name),
5051
5039
  normalize: vertexBuffer.normalized
5052
5040
  };
5053
5041
  }
@@ -5252,7 +5240,7 @@ var TextureDataMode;
5252
5240
  };
5253
5241
  _proto.getTextureDataMode = function getTextureDataMode(jointCount, engine) {
5254
5242
  var uniformsRequiredForMostFeatures = 25;
5255
- var detail = engine.gpuCapability.detail;
5243
+ var detail = engine.displayServer.renderingDevice.gpuCapability.detail;
5256
5244
  var availableJointUniforms = detail.maxVertexUniforms - uniformsRequiredForMostFeatures;
5257
5245
  var uniformsRequiredPerJoint = 8;
5258
5246
  if (jointCount > Math.floor(availableJointUniforms / uniformsRequiredPerJoint)) {
@@ -7858,12 +7846,12 @@ function _assert_this_initialized(self) {
7858
7846
  }
7859
7847
 
7860
7848
  var uvKinds = [
7861
- VertexBuffer.UVKind,
7862
- VertexBuffer.UV2Kind,
7863
- VertexBuffer.UV3Kind,
7864
- VertexBuffer.UV4Kind,
7865
- VertexBuffer.UV5Kind,
7866
- VertexBuffer.UV6Kind
7849
+ VertexElementType.TexCoord0,
7850
+ VertexElementType.TexCoord1,
7851
+ VertexElementType.TexCoord2,
7852
+ VertexElementType.TexCoord3,
7853
+ VertexElementType.TexCoord4,
7854
+ VertexElementType.TexCoord5
7867
7855
  ];
7868
7856
  /**
7869
7857
  * Mesh 类,负责 Mesh 相关的骨骼动画和 PBR 渲染
@@ -8774,7 +8762,7 @@ var uvKinds = [
8774
8762
  * 是否压缩格式
8775
8763
  * @returns
8776
8764
  */ _proto.isCompressed = function isCompressed() {
8777
- var positionAttrib = this.geometry.getAttributeData(VertexBuffer.PositionKind);
8765
+ var positionAttrib = this.geometry.getAttributeData(VertexElementType.Position);
8778
8766
  if (positionAttrib === undefined) {
8779
8767
  return false;
8780
8768
  }
@@ -8786,19 +8774,19 @@ var uvKinds = [
8786
8774
  * 是否有位置属性
8787
8775
  * @returns
8788
8776
  */ _proto.hasPositions = function hasPositions() {
8789
- return this.hasAttribute(VertexBuffer.PositionKind);
8777
+ return this.hasAttribute(VertexElementType.Position);
8790
8778
  };
8791
8779
  /**
8792
8780
  * 是否有法线属性
8793
8781
  * @returns
8794
8782
  */ _proto.hasNormals = function hasNormals() {
8795
- return this.hasAttribute(VertexBuffer.NormalKind);
8783
+ return this.hasAttribute(VertexElementType.Normal);
8796
8784
  };
8797
8785
  /**
8798
8786
  * 是否有切线属性
8799
8787
  * @returns
8800
8788
  */ _proto.hasTangents = function hasTangents() {
8801
- return this.hasAttribute(VertexBuffer.TangentKind);
8789
+ return this.hasAttribute(VertexElementType.Tangent);
8802
8790
  };
8803
8791
  /**
8804
8792
  * 是否有纹理坐标属性
@@ -8812,19 +8800,19 @@ var uvKinds = [
8812
8800
  * 是否有颜色属性
8813
8801
  * @returns
8814
8802
  */ _proto.hasColors = function hasColors() {
8815
- return this.hasAttribute(VertexBuffer.ColorKind);
8803
+ return this.hasAttribute(VertexElementType.Color);
8816
8804
  };
8817
8805
  /**
8818
8806
  * 是否有关节点属性
8819
8807
  * @returns
8820
8808
  */ _proto.hasJoints = function hasJoints() {
8821
- return this.hasAttribute(VertexBuffer.JointsKind);
8809
+ return this.hasAttribute(VertexElementType.BlendIndices);
8822
8810
  };
8823
8811
  /**
8824
8812
  * 是否有权重属性
8825
8813
  * @returns
8826
8814
  */ _proto.hasWeights = function hasWeights() {
8827
- return this.hasAttribute(VertexBuffer.WeightsKind);
8815
+ return this.hasAttribute(VertexElementType.BlendWeights);
8828
8816
  };
8829
8817
  return PGeometry;
8830
8818
  }();
@@ -8947,7 +8935,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
8947
8935
  }
8948
8936
  };
8949
8937
  _proto.initGlobalState = function initGlobalState(opts) {
8950
- var capbility = this.engine.gpuCapability;
8938
+ var capbility = this.engine.displayServer.renderingDevice.gpuCapability;
8951
8939
  var globalState = PGlobalState.getInstance();
8952
8940
  globalState.reset();
8953
8941
  globalState.isWebGL2 = capbility.level === 2;
@@ -9303,7 +9291,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
9303
9291
  //
9304
9292
  PluginHelper.preprocessScene(scene, runtimeEnv, compatibleMode);
9305
9293
  // Add PBR and Unlit shader data
9306
- var isWebGL2 = engine.gpuCapability.level === 2;
9294
+ var isWebGL2 = engine.displayServer.renderingDevice.gpuCapability.level === 2;
9307
9295
  var pbrShaderCode = fetchPBRShaderCode();
9308
9296
  var unlitShaderCode = fetchUnlitShaderCode();
9309
9297
  var pbrShaderData = {
@@ -9324,8 +9312,8 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
9324
9312
  // @ts-expect-error
9325
9313
  glslVersion: isWebGL2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1
9326
9314
  };
9327
- engine.addEffectsObjectData(pbrShaderData);
9328
- engine.addEffectsObjectData(unlitShaderData);
9315
+ engine.assetServer.addEffectsObjectData(pbrShaderData);
9316
+ engine.assetServer.addEffectsObjectData(unlitShaderData);
9329
9317
  };
9330
9318
  /**
9331
9319
  * 创建 3D 场景管理器和缓存器
@@ -9408,18 +9396,16 @@ var ModelPluginComponent = /*#__PURE__*/ function(Behaviour) {
9408
9396
  // 更新相机的位置,主要是composition的camera数据,以及camera item数据
9409
9397
  composition.camera.position = position;
9410
9398
  (_composition_items = composition.items) == null ? void 0 : _composition_items.forEach(function(item) {
9411
- if (item.type === VFX_ITEM_TYPE_3D) {
9412
- var component = item.getComponent(ModelCameraComponent);
9413
- if (component == null ? void 0 : component.content) {
9414
- var _item_transform_parentTransform;
9415
- var worldMatrix = ((_item_transform_parentTransform = item.transform.parentTransform) == null ? void 0 : _item_transform_parentTransform.getWorldMatrix()) || Matrix4.IDENTITY.clone();
9416
- var invWorldMatrix = worldMatrix.invert();
9417
- var newPosition = invWorldMatrix.transformPoint(position);
9418
- component.setTransform(newPosition);
9419
- // 正式版本不会走到这个流程,只在测试时使用
9420
- console.info("Scene AABB [" + sceneAABB.min.toArray() + "], [" + sceneAABB.max.toArray() + "].");
9421
- console.info("Update camera position [" + newPosition.toArray() + "].");
9422
- }
9399
+ var component = item.getComponent(ModelCameraComponent);
9400
+ if (component == null ? void 0 : component.content) {
9401
+ var _item_transform_parentTransform;
9402
+ var worldMatrix = ((_item_transform_parentTransform = item.transform.parentTransform) == null ? void 0 : _item_transform_parentTransform.getWorldMatrix()) || Matrix4.IDENTITY.clone();
9403
+ var invWorldMatrix = worldMatrix.invert();
9404
+ var newPosition = invWorldMatrix.transformPoint(position);
9405
+ component.setTransform(newPosition);
9406
+ // 正式版本不会走到这个流程,只在测试时使用
9407
+ console.info("Scene AABB [" + sceneAABB.min.toArray() + "], [" + sceneAABB.max.toArray() + "].");
9408
+ console.info("Update camera position [" + newPosition.toArray() + "].");
9423
9409
  }
9424
9410
  });
9425
9411
  }
@@ -10354,11 +10340,6 @@ var JSONConverter = /*#__PURE__*/ function() {
10354
10340
  (_newScene_items = newScene.items).push.apply(_newScene_items, [].concat(this.treeInfo.getAllTreeNodeList()));
10355
10341
  newScene.compositionId = oldScene.compositionId;
10356
10342
  newScene.compositions = oldScene.compositions;
10357
- newScene.items.forEach(function(item) {
10358
- if (item.type === "root") {
10359
- item.type = "ECS";
10360
- }
10361
- });
10362
10343
  //@ts-expect-error
10363
10344
  newScene.compositions[0].items = newScene.items.map(function(item) {
10364
10345
  return {
@@ -10537,8 +10518,7 @@ var JSONConverter = /*#__PURE__*/ function() {
10537
10518
  parentId: treeItem.id,
10538
10519
  name: (_node_name = node.name) != null ? _node_name : "node" + index,
10539
10520
  duration: treeItem.duration,
10540
- // @ts-expect-error
10541
- type: "ECS",
10521
+ type: spec.ItemType.tree,
10542
10522
  dataType: spec.DataType.VFXItemData,
10543
10523
  visible: treeItem.visible,
10544
10524
  endBehavior: treeItem.endBehavior,
@@ -11118,7 +11098,7 @@ function getGeometryDataFromOptions(geomOptions) {
11118
11098
  verticesNormalize = (_attribData_normalize = attribData.normalize) != null ? _attribData_normalize : false;
11119
11099
  var _attribData_type;
11120
11100
  verticesType = glType2VertexFormatType((_attribData_type = attribData.type) != null ? _attribData_type : glContext.FLOAT);
11121
- } else if (attrib === VertexBuffer.NormalKind) {
11101
+ } else if (attrib === VertexElementType.Normal) {
11122
11102
  // @ts-expect-error
11123
11103
  modelData.normals = attribData.data;
11124
11104
  var _attribData_normalize1;
@@ -11434,7 +11414,7 @@ function mergeTypedArray(array1, array2, offset) {
11434
11414
  }
11435
11415
  }
11436
11416
  var _obj;
11437
- var vertexBufferSemanticMap = (_obj = {}, _obj[VertexBuffer.PositionKind] = "POSITION", _obj[VertexBuffer.UVKind] = "TEXCOORD0", _obj[VertexBuffer.UV2Kind] = "TEXCOORD1", _obj[VertexBuffer.NormalKind] = "NORMAL", _obj[VertexBuffer.TangentKind] = "TANGENT", _obj[VertexBuffer.ColorKind] = "COLOR", _obj[VertexBuffer.JointsKind] = "JOINTS", _obj[VertexBuffer.WeightsKind] = "WEIGHTS", //
11417
+ var vertexBufferSemanticMap = (_obj = {}, _obj[VertexElementType.Position] = "POSITION", _obj[VertexElementType.TexCoord0] = "TEXCOORD0", _obj[VertexElementType.TexCoord1] = "TEXCOORD1", _obj[VertexElementType.Normal] = "NORMAL", _obj[VertexElementType.Tangent] = "TANGENT", _obj[VertexElementType.Color] = "COLOR", _obj[VertexElementType.BlendIndices] = "JOINTS", _obj[VertexElementType.BlendWeights] = "WEIGHTS", //
11438
11418
  _obj.a_Position = "POSITION", _obj.a_UV = "TEXCOORD0", _obj.a_UV1 = "TEXCOORD0", _obj.a_UV2 = "TEXCOORD1", _obj.a_Normal = "NORMAL", _obj.a_Tangent = "TANGENT", _obj.a_Color = "COLOR", _obj.a_Joints = "JOINTS", _obj.a_Joint1 = "JOINTS", _obj.a_Weights = "WEIGHTS", _obj.a_Weight1 = "WEIGHTS", //
11439
11419
  _obj.a_Target_Position0 = "POSITION_BS0", _obj.a_Target_Position1 = "POSITION_BS1", _obj.a_Target_Position2 = "POSITION_BS2", _obj.a_Target_Position3 = "POSITION_BS3", _obj.a_Target_Position4 = "POSITION_BS4", _obj.a_Target_Position5 = "POSITION_BS5", _obj.a_Target_Position6 = "POSITION_BS6", _obj.a_Target_Position7 = "POSITION_BS7", _obj.a_Target_Normal0 = "NORMAL_BS0", _obj.a_Target_Normal1 = "NORMAL_BS1", _obj.a_Target_Normal2 = "NORMAL_BS2", _obj.a_Target_Normal3 = "NORMAL_BS3", _obj.a_Target_Tangent0 = "TANGENT_BS0", _obj.a_Target_Tangent1 = "TANGENT_BS1", _obj.a_Target_Tangent2 = "TANGENT_BS2", _obj.a_Target_Tangent3 = "TANGENT_BS3", _obj);
11440
11420
 
@@ -11604,11 +11584,6 @@ var LoaderImpl = /*#__PURE__*/ function() {
11604
11584
  case 2:
11605
11585
  _state.sent();
11606
11586
  (_this_items = _this.items).push.apply(_this_items, [].concat(gltfResource.scenes[0].vfxItemData));
11607
- _this.items.forEach(function(item) {
11608
- if (item.type === "root") {
11609
- item.type = "ECS";
11610
- }
11611
- });
11612
11587
  return [
11613
11588
  2,
11614
11589
  _this.getLoadResult()
@@ -13163,11 +13138,11 @@ var GLTFHelper = /*#__PURE__*/ function() {
13163
13138
  registerPlugin("model", ModelPlugin);
13164
13139
  /**
13165
13140
  * 插件版本号
13166
- */ var version = "2.10.4";
13141
+ */ var version = "2.11.0-alpha.1";
13167
13142
  logger.info("Plugin model version: " + version + ".");
13168
13143
  if (version !== EFFECTS.version) {
13169
13144
  console.error("注意:请统一 Model 插件与 Player 版本,不统一的版本混用会有不可预知的后果!", "\nAttention: Please ensure the Model plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");
13170
13145
  }
13171
13146
 
13172
- export { AnimationComponent, Box3, BoxMesh, CameraGestureHandlerImp, CameraGestureType, CheckerHelper, Color, CompositionCache, CompositionHitTest, DEG2RAD, Euler, EulerOrder, FBOOptions, Float16ArrayWrapper, GeometryBoxProxy, HitTestingProxy, HookOGLFunc, InterpolationSampler, JSONConverter, LoaderHelper, LoaderImpl, Matrix3, Matrix4, MeshHelper, ModelCameraComponent, ModelLightComponent, ModelMeshComponent, ModelPlugin, ModelPluginComponent, ModelSkyboxComponent, ModelTreeComponent, PAnimInterpType, PAnimPathType, PAnimTexture, 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, Quaternion, Ray, RayBoxTesting, RayIntersectsBoxWithRotation, RayTriangleTesting, Sphere, TextureDataMode, ToggleItemBounding, TwoStatesSet, UnlitShaderGUID, VFX_ITEM_TYPE_3D, Vector2, Vector3, Vector4, VertexAttribBuffer, WebGLHelper, WebHelper, createAnimationSampler, createPluginMaterial, fetchPBRShaderCode, fetchUnlitShaderCode, getDefaultEffectsGLTFLoader, getDefaultPBRMaterialData, getDefaultUnlitMaterialData, getDiffuseOnlyShaderCode, getGaussianBlurShaderCodeV1, getGaussianBlurShaderCodeV2, getGeometryDataFromOptions, getGeometryDataFromPropsList, getKawaseBlurShaderCode, getNormalVisShaderCode, getPBRPassShaderCode, getPBRShaderProperties, getPMeshList, getQuadFilterShaderCode, getRendererGPUInfo, getSceneManager, getShadowPassShaderCode, getSimpleFilterShaderCode, getSkyBoxShaderCode, getTransparecyBaseShader, getTransparecyFilterShader, getUnlitShaderProperties, setDefaultEffectsGLTFLoader, version };
13147
+ export { AnimationComponent, Box3, BoxMesh, CameraGestureHandlerImp, CameraGestureType, CheckerHelper, Color, CompositionCache, CompositionHitTest, DEG2RAD, Euler, EulerOrder, FBOOptions, Float16ArrayWrapper, GeometryBoxProxy, HitTestingProxy, HookOGLFunc, InterpolationSampler, JSONConverter, LoaderHelper, LoaderImpl, Matrix3, Matrix4, MeshHelper, ModelCameraComponent, ModelLightComponent, ModelMeshComponent, ModelPlugin, ModelPluginComponent, ModelSkyboxComponent, ModelTreeComponent, PAnimInterpType, PAnimPathType, PAnimTexture, 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, Quaternion, Ray, RayBoxTesting, RayIntersectsBoxWithRotation, RayTriangleTesting, Sphere, TextureDataMode, ToggleItemBounding, TwoStatesSet, UnlitShaderGUID, Vector2, Vector3, Vector4, VertexAttribBuffer, WebGLHelper, WebHelper, createAnimationSampler, createPluginMaterial, fetchPBRShaderCode, fetchUnlitShaderCode, getDefaultEffectsGLTFLoader, getDefaultPBRMaterialData, getDefaultUnlitMaterialData, getDiffuseOnlyShaderCode, getGaussianBlurShaderCodeV1, getGaussianBlurShaderCodeV2, getGeometryDataFromOptions, getGeometryDataFromPropsList, getKawaseBlurShaderCode, getNormalVisShaderCode, getPBRPassShaderCode, getPBRShaderProperties, getPMeshList, getQuadFilterShaderCode, getRendererGPUInfo, getSceneManager, getShadowPassShaderCode, getSimpleFilterShaderCode, getSkyBoxShaderCode, getTransparecyBaseShader, getTransparecyFilterShader, getUnlitShaderProperties, setDefaultEffectsGLTFLoader, version };
13173
13148
  //# sourceMappingURL=index.mjs.map