@galacean/effects-plugin-model 2.3.0-beta.0 → 2.3.0-beta.2

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/loader.mjs CHANGED
@@ -3,11 +3,11 @@
3
3
  * Description: Galacean Effects player model plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 飂兮
6
- * Version: v2.3.0-beta.0
6
+ * Version: v2.3.0-beta.2
7
7
  */
8
8
 
9
9
  import * as EFFECTS from '@galacean/effects';
10
- import { math, Transform, spec, PLAYER_OPTIONS_ENV_EDITOR, glContext, Material, Mesh, Geometry, ShaderFactory, effectsClass, VFXItem, GLSLVersion, Behaviour, AbstractPlugin, registerPlugin, logger, RendererComponent, HitTestType, AnimationClip, TextureSourceType, Texture, RenderPass, TextureLoadAction, DestroyOptions, RenderPassDestroyAttachmentType, getDefaultTextureFactory, Player, loadImage, generateGUID, addItem, removeItem, glType2VertexFormatType, Downloader, getStandardJSON, isObject } from '@galacean/effects';
10
+ import { math, Transform, spec, PLAYER_OPTIONS_ENV_EDITOR, glContext, Material, Mesh, Geometry, ShaderFactory, effectsClass, GLSLVersion, VFXItem, Behaviour, AbstractPlugin, registerPlugin, logger, RendererComponent, HitTestType, AnimationClip, TextureSourceType, Texture, RenderPass, TextureLoadAction, DestroyOptions, RenderPassDestroyAttachmentType, getDefaultTextureFactory, Player, loadImage, generateGUID, addItem, removeItem, glType2VertexFormatType, Downloader, getStandardJSON, isObject } from '@galacean/effects';
11
11
 
12
12
  var Vector2 = math.Vector2, Vector3 = math.Vector3, Vector4 = math.Vector4, Matrix3 = math.Matrix3, Matrix4 = math.Matrix4, Color = math.Color, Euler = math.Euler, EulerOrder = math.EulerOrder, Quaternion = math.Quaternion, Box3 = math.Box3; math.Sphere; math.Ray; var DEG2RAD = math.DEG2RAD;
13
13
 
@@ -1361,6 +1361,32 @@ function getQuadFilterVS() {
1361
1361
  return _this;
1362
1362
  }
1363
1363
  var _proto = ModelPlugin.prototype;
1364
+ _proto.precompile = function precompile(compositions, renderer) {
1365
+ var isWebGL2 = renderer.engine.gpuCapability.level === 2;
1366
+ var pbrShaderCode = fetchPBRShaderCode();
1367
+ var unlitShaderCode = fetchUnlitShaderCode();
1368
+ var pbrShaderData = {
1369
+ id: PBRShaderGUID,
1370
+ name: "PBR Shader",
1371
+ dataType: spec.DataType.Shader,
1372
+ fragment: pbrShaderCode.fragmentShaderCode,
1373
+ vertex: pbrShaderCode.vertexShaderCode,
1374
+ // @ts-expect-error
1375
+ glslVersion: isWebGL2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1
1376
+ };
1377
+ var unlitShaderData = {
1378
+ id: UnlitShaderGUID,
1379
+ name: "Unlit Shader",
1380
+ dataType: spec.DataType.Shader,
1381
+ fragment: unlitShaderCode.fragmentShaderCode,
1382
+ vertex: unlitShaderCode.vertexShaderCode,
1383
+ // @ts-expect-error
1384
+ glslVersion: isWebGL2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1
1385
+ };
1386
+ renderer.engine.addEffectsObjectData(pbrShaderData);
1387
+ renderer.engine.addEffectsObjectData(unlitShaderData);
1388
+ return Promise.resolve();
1389
+ };
1364
1390
  /**
1365
1391
  * 创建 3D 场景管理器和缓存器
1366
1392
  * @param composition - 合成
@@ -1445,32 +1471,6 @@ function getQuadFilterVS() {
1445
1471
  });
1446
1472
  })();
1447
1473
  };
1448
- ModelPlugin.precompile = function precompile(compositions, renderer) {
1449
- var isWebGL2 = renderer.engine.gpuCapability.level === 2;
1450
- var pbrShaderCode = fetchPBRShaderCode();
1451
- var unlitShaderCode = fetchUnlitShaderCode();
1452
- var pbrShaderData = {
1453
- id: PBRShaderGUID,
1454
- name: "PBR Shader",
1455
- dataType: spec.DataType.Shader,
1456
- fragment: pbrShaderCode.fragmentShaderCode,
1457
- vertex: pbrShaderCode.vertexShaderCode,
1458
- // @ts-expect-error
1459
- glslVersion: isWebGL2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1
1460
- };
1461
- var unlitShaderData = {
1462
- id: UnlitShaderGUID,
1463
- name: "Unlit Shader",
1464
- dataType: spec.DataType.Shader,
1465
- fragment: unlitShaderCode.fragmentShaderCode,
1466
- vertex: unlitShaderCode.vertexShaderCode,
1467
- // @ts-expect-error
1468
- glslVersion: isWebGL2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1
1469
- };
1470
- renderer.engine.addEffectsObjectData(pbrShaderData);
1471
- renderer.engine.addEffectsObjectData(unlitShaderData);
1472
- return Promise.resolve();
1473
- };
1474
1474
  return ModelPlugin;
1475
1475
  }(AbstractPlugin);
1476
1476
  var ModelPluginComponent = /*#__PURE__*/ function(Behaviour) {
@@ -2096,7 +2096,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
2096
2096
  registerPlugin("model", ModelPlugin, VFXItem);
2097
2097
  /**
2098
2098
  * 插件版本号
2099
- */ var version = "2.3.0-beta.0";
2099
+ */ var version = "2.3.0-beta.2";
2100
2100
  logger.info("Plugin model version: " + version + ".");
2101
2101
  if (version !== EFFECTS.version) {
2102
2102
  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!");
@@ -2473,11 +2473,10 @@ var ModelCameraComponent = /*#__PURE__*/ function(Behaviour) {
2473
2473
  this.content.matrix = this.transform.getWorldMatrix();
2474
2474
  var composition = this.item.composition;
2475
2475
  if (composition) {
2476
- composition.camera.position = this.transform.position.clone();
2477
- composition.camera.setQuat(this.transform.quat);
2478
2476
  composition.camera.near = this.content.nearPlane;
2479
2477
  composition.camera.far = this.content.farPlane;
2480
2478
  composition.camera.fov = this.content.fov;
2479
+ composition.camera.setTransform(this.transform);
2481
2480
  }
2482
2481
  };
2483
2482
  /**