@galacean/effects-threejs 2.5.0-alpha.2 → 2.5.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.5.0-alpha.2
6
+ * Version: v2.5.0-alpha.4
7
7
  */
8
8
 
9
9
  'use strict';
@@ -12893,25 +12893,47 @@ var singleSplits = [
12893
12893
  };
12894
12894
  this.configureMaterial(this.renderer);
12895
12895
  if (baseRenderComponentData.geometry) {
12896
- this.geometry = this.engine.findObject(baseRenderComponentData.geometry);
12896
+ var baseGeometry = this.engine.findObject(baseRenderComponentData.geometry);
12897
12897
  var uvTransform = baseRenderComponentData.splits && !baseRenderComponentData.textureSheetAnimation ? baseRenderComponentData.splits[0] : singleSplits[0];
12898
12898
  var x = uvTransform[0];
12899
12899
  var y = uvTransform[1];
12900
12900
  var isRotate90 = uvTransform[4];
12901
12901
  var width = isRotate90 ? uvTransform[3] : uvTransform[2];
12902
12902
  var height = isRotate90 ? uvTransform[2] : uvTransform[3];
12903
- var aUV = this.geometry.getAttributeData("aUV");
12904
- var aPos = this.geometry.getAttributeData("aPos");
12905
- if (aUV && aPos) {
12903
+ var angle = isRotate90 === 0 ? 0 : -Math.PI / 2;
12904
+ var aUV = baseGeometry.getAttributeData("aUV");
12905
+ var aPos = baseGeometry.getAttributeData("aPos");
12906
+ var indices = baseGeometry.getIndexData();
12907
+ var tempPosition = [
12908
+ 0,
12909
+ 0
12910
+ ];
12911
+ if (aUV && aPos && indices) {
12906
12912
  var vertexCount = aUV.length / 2;
12907
12913
  for(var i = 0; i < vertexCount; i++){
12908
12914
  var positionOffset = i * 3;
12909
12915
  var uvOffset = i * 2;
12910
12916
  var positionX = aPos[positionOffset];
12911
12917
  var positionY = aPos[positionOffset + 1];
12912
- aUV[uvOffset] = (positionX + 0.5) * width + x;
12913
- aUV[uvOffset + 1] = (positionY + 0.5) * height + y;
12918
+ tempPosition[0] = positionX;
12919
+ tempPosition[1] = positionY;
12920
+ rotateVec2(tempPosition, tempPosition, angle);
12921
+ aUV[uvOffset] = (tempPosition[0] + 0.5) * width + x;
12922
+ aUV[uvOffset + 1] = (tempPosition[1] + 0.5) * height + y;
12914
12923
  }
12924
+ this.geometry.setAttributeData("aPos", aPos.slice());
12925
+ this.geometry.setAttributeData("aUV", aUV.slice());
12926
+ this.geometry.setIndexData(indices.slice());
12927
+ this.geometry.setDrawCount(indices.length);
12928
+ }
12929
+ this.geometry.subMeshes.length = 0;
12930
+ for(var _iterator = _create_for_of_iterator_helper_loose(baseGeometry.subMeshes), _step; !(_step = _iterator()).done;){
12931
+ var subMesh = _step.value;
12932
+ this.geometry.subMeshes.push({
12933
+ offset: subMesh.offset,
12934
+ indexCount: subMesh.indexCount,
12935
+ vertexCount: subMesh.vertexCount
12936
+ });
12915
12937
  }
12916
12938
  } else {
12917
12939
  this.geometry = this.defaultGeometry;
@@ -21270,7 +21292,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
21270
21292
  /**
21271
21293
  * 合成暂停/播放 标识
21272
21294
  */ _this.paused = false;
21273
- _this.lastVideoUpdateTime = 0;
21274
21295
  _this.isEndCalled = false;
21275
21296
  _this._textures = [];
21276
21297
  var _props_reusable = props.reusable, reusable = _props_reusable === void 0 ? false : _props_reusable, _props_speed = props.speed, speed = _props_speed === void 0 ? 1 : _props_speed, _props_baseRenderOrder = props.baseRenderOrder, baseRenderOrder = _props_baseRenderOrder === void 0 ? 0 : _props_baseRenderOrder, renderer = props.renderer, event = props.event, width = props.width, height = props.height, handleItemMessage = props.handleItemMessage;
@@ -21512,7 +21533,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
21512
21533
  var previousCompositionTime = this.time;
21513
21534
  this.updateCompositionTime(deltaTime * this.speed / 1000);
21514
21535
  var deltaTimeInMs = (this.time - previousCompositionTime) * 1000;
21515
- this.updateVideo();
21516
21536
  // 更新 model-tree-plugin
21517
21537
  this.updatePluginLoaders(deltaTimeInMs);
21518
21538
  this.sceneTicking.update.tick(deltaTimeInMs);
@@ -21546,20 +21566,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
21546
21566
  }
21547
21567
  };
21548
21568
  /**
21549
- * 更新视频数据到纹理
21550
- * @override
21551
- */ _proto.updateVideo = function updateVideo() {
21552
- var now = performance.now();
21553
- // 视频固定30帧更新
21554
- if (now - this.lastVideoUpdateTime > 33) {
21555
- var _this_textures;
21556
- ((_this_textures = this.textures) != null ? _this_textures : []).forEach(function(tex) {
21557
- return tex == null ? void 0 : tex.uploadCurrentVideoFrame();
21558
- });
21559
- this.lastVideoUpdateTime = now;
21560
- }
21561
- };
21562
- /**
21563
21569
  * 更新相机
21564
21570
  * @override
21565
21571
  */ _proto.updateCamera = function updateCamera() {
@@ -22819,6 +22825,7 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
22819
22825
  _this.engine.renderErrors.add(e);
22820
22826
  });
22821
22827
  }
22828
+ this.renderer.texture.uploadCurrentVideoFrame();
22822
22829
  }
22823
22830
  if (ta) {
22824
22831
  var _this_material_getVector4;
@@ -26832,10 +26839,10 @@ var SerializationHelper = /*#__PURE__*/ function() {
26832
26839
  }
26833
26840
  var _proto = AssetLoader.prototype;
26834
26841
  _proto.loadGUID = function loadGUID(dataPath) {
26835
- var guid = dataPath.id;
26836
26842
  if (!dataPath) {
26837
26843
  return null;
26838
26844
  }
26845
+ var guid = dataPath.id;
26839
26846
  var effectsObjectData = this.findData(guid);
26840
26847
  var effectsObject;
26841
26848
  if (!effectsObjectData) {
@@ -28415,7 +28422,7 @@ function getStandardSpriteContent(sprite, transform) {
28415
28422
  return ret;
28416
28423
  }
28417
28424
 
28418
- var version$2 = "2.5.0-alpha.2";
28425
+ var version$2 = "2.5.0-alpha.4";
28419
28426
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
28420
28427
  var standardVersion = /^(\d+)\.(\d+)$/;
28421
28428
  var reverseParticle = false;
@@ -31665,7 +31672,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
31665
31672
  registerPlugin("particle", ParticleLoader, exports.VFXItem);
31666
31673
  registerPlugin("cal", CalculateLoader, exports.VFXItem);
31667
31674
  registerPlugin("interact", InteractLoader, exports.VFXItem);
31668
- var version$1 = "2.5.0-alpha.2";
31675
+ var version$1 = "2.5.0-alpha.4";
31669
31676
  logger.info("Core version: " + version$1 + ".");
31670
31677
 
31671
31678
  var _obj;
@@ -33267,7 +33274,7 @@ setMaxSpriteMeshItemCount(8);
33267
33274
  */ Mesh.create = function(engine, props) {
33268
33275
  return new ThreeMesh(engine, props);
33269
33276
  };
33270
- var version = "2.5.0-alpha.2";
33277
+ var version = "2.5.0-alpha.4";
33271
33278
  logger.info("THREEJS plugin version: " + version + ".");
33272
33279
 
33273
33280
  exports.AbstractPlugin = AbstractPlugin;