@galacean/effects-threejs 0.0.0-experimental-20250807 → 0.0.0-experimental-20250828
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 +54 -17
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +54 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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: v0.0.0-experimental-
|
|
6
|
+
* Version: v0.0.0-experimental-20250828
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -817,6 +817,28 @@ function noop() {}
|
|
|
817
817
|
*/ function isObject(obj) {
|
|
818
818
|
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
819
819
|
}
|
|
820
|
+
/**
|
|
821
|
+
* 判断对象是否是`Plain Object`类型
|
|
822
|
+
*
|
|
823
|
+
* @param obj - 要判断的对象
|
|
824
|
+
* @returns
|
|
825
|
+
*/ function isPlainObject(obj) {
|
|
826
|
+
if (obj === null || typeof obj !== "object") {
|
|
827
|
+
return false;
|
|
828
|
+
}
|
|
829
|
+
// 先排除 Array/Date/Map/Set/RegExp 等
|
|
830
|
+
if (Object.prototype.toString.call(obj) !== "[object Object]") {
|
|
831
|
+
return false;
|
|
832
|
+
}
|
|
833
|
+
var proto = Object.getPrototypeOf(obj);
|
|
834
|
+
if (proto === null) {
|
|
835
|
+
return true;
|
|
836
|
+
} // Object.create(null)
|
|
837
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
838
|
+
var Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
|
|
839
|
+
// 构造器需要是 Object(跨 realm 用函数源码比对)
|
|
840
|
+
return typeof Ctor === "function" && Function.prototype.toString.call(Ctor) === Function.prototype.toString.call(Object);
|
|
841
|
+
}
|
|
820
842
|
function isCanvas(canvas) {
|
|
821
843
|
var _canvas_tagName;
|
|
822
844
|
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
@@ -8626,7 +8648,7 @@ exports.TextureSourceType = void 0;
|
|
|
8626
8648
|
_this.finish(url, xhr.status, xhr.response);
|
|
8627
8649
|
};
|
|
8628
8650
|
var handleLoad = function() {
|
|
8629
|
-
if (xhr.status == 200
|
|
8651
|
+
if (xhr.status == 200) {
|
|
8630
8652
|
_this.finish(url, 200, xhr.response);
|
|
8631
8653
|
} else {
|
|
8632
8654
|
handleError();
|
|
@@ -8652,7 +8674,7 @@ exports.TextureSourceType = void 0;
|
|
|
8652
8674
|
_proto.finish = function finish(url, status, data) {
|
|
8653
8675
|
var callbacks = this.callbacks[url];
|
|
8654
8676
|
delete this.callbacks[url];
|
|
8655
|
-
var args = status == 200
|
|
8677
|
+
var args = status == 200 ? [
|
|
8656
8678
|
data
|
|
8657
8679
|
] : [
|
|
8658
8680
|
status,
|
|
@@ -8664,11 +8686,6 @@ exports.TextureSourceType = void 0;
|
|
|
8664
8686
|
};
|
|
8665
8687
|
return Downloader;
|
|
8666
8688
|
}();
|
|
8667
|
-
/**
|
|
8668
|
-
* 是否信任 XMLHttpRequest 的状态码为 0 的响应
|
|
8669
|
-
* 某些浏览器在本地文件协议(file://)下会返回状态码 0,但实际上请求是成功的
|
|
8670
|
-
* 设置为 true 可以让 Downloader 将状态码 0 视为成功
|
|
8671
|
-
*/ Downloader.trustXHRStatusZero = false;
|
|
8672
8689
|
var webPFailed = false;
|
|
8673
8690
|
var avifFailed = false;
|
|
8674
8691
|
/**
|
|
@@ -23926,9 +23943,17 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
23926
23943
|
*/ _this.paused = false;
|
|
23927
23944
|
_this.isEndCalled = false;
|
|
23928
23945
|
_this._textures = [];
|
|
23946
|
+
_this.videos = [];
|
|
23929
23947
|
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;
|
|
23930
23948
|
_this.renderer = renderer;
|
|
23931
23949
|
_this._textures = scene.textures;
|
|
23950
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(scene.assets)), _step; !(_step = _iterator()).done;){
|
|
23951
|
+
var key = _step.value;
|
|
23952
|
+
var videoAsset = scene.assets[key];
|
|
23953
|
+
if (_instanceof1(videoAsset, HTMLVideoElement)) {
|
|
23954
|
+
_this.videos.push(videoAsset);
|
|
23955
|
+
}
|
|
23956
|
+
}
|
|
23932
23957
|
var _scene_jsonScene_renderSettings_postProcessingEnabled;
|
|
23933
23958
|
_this.postProcessingEnabled = (_scene_jsonScene_renderSettings_postProcessingEnabled = (_scene_jsonScene_renderSettings = scene.jsonScene.renderSettings) == null ? void 0 : _scene_jsonScene_renderSettings.postProcessingEnabled) != null ? _scene_jsonScene_renderSettings_postProcessingEnabled : false;
|
|
23934
23959
|
_this.getEngine().renderLevel = scene.renderLevel;
|
|
@@ -23937,8 +23962,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
23937
23962
|
scene.consumed = true;
|
|
23938
23963
|
}
|
|
23939
23964
|
var sourceContent = scene.jsonScene.compositions[0];
|
|
23940
|
-
for(var
|
|
23941
|
-
var composition =
|
|
23965
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(scene.jsonScene.compositions), _step1; !(_step1 = _iterator1()).done;){
|
|
23966
|
+
var composition = _step1.value;
|
|
23942
23967
|
if (composition.id === scene.jsonScene.compositionId) {
|
|
23943
23968
|
sourceContent = composition;
|
|
23944
23969
|
}
|
|
@@ -23953,8 +23978,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
23953
23978
|
// Create rootItem components
|
|
23954
23979
|
//@ts-expect-error TODO update spec.
|
|
23955
23980
|
var componentPaths = sourceContent.components;
|
|
23956
|
-
for(var
|
|
23957
|
-
var componentPath =
|
|
23981
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(componentPaths), _step2; !(_step2 = _iterator2()).done;){
|
|
23982
|
+
var componentPath = _step2.value;
|
|
23958
23983
|
var component = _this.getEngine().findObject(componentPath);
|
|
23959
23984
|
_this.rootItem.components.push(component);
|
|
23960
23985
|
component.item = _this.rootItem;
|
|
@@ -24414,6 +24439,13 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24414
24439
|
});
|
|
24415
24440
|
}
|
|
24416
24441
|
}
|
|
24442
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.videos), _step; !(_step = _iterator()).done;){
|
|
24443
|
+
var video = _step.value;
|
|
24444
|
+
video.pause();
|
|
24445
|
+
video.removeAttribute("src");
|
|
24446
|
+
video.load();
|
|
24447
|
+
}
|
|
24448
|
+
this.videos = [];
|
|
24417
24449
|
this.rootItem.dispose();
|
|
24418
24450
|
// FIXME: 注意这里增加了renderFrame销毁
|
|
24419
24451
|
this.renderFrame.dispose();
|
|
@@ -29455,7 +29487,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
29455
29487
|
} else if (SerializationHelper.checkDataPath(property)) {
|
|
29456
29488
|
var referenceObject = engine.findObject(property);
|
|
29457
29489
|
return overrideDataPath ? referenceObject : property;
|
|
29458
|
-
} else if (
|
|
29490
|
+
} else if (isPlainObject(property)) {
|
|
29459
29491
|
var res1;
|
|
29460
29492
|
if (type) {
|
|
29461
29493
|
res1 = new type();
|
|
@@ -31126,7 +31158,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31126
31158
|
return ret;
|
|
31127
31159
|
}
|
|
31128
31160
|
|
|
31129
|
-
var version$2 = "0.0.0-experimental-
|
|
31161
|
+
var version$2 = "0.0.0-experimental-20250828";
|
|
31130
31162
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31131
31163
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31132
31164
|
var reverseParticle = false;
|
|
@@ -31714,6 +31746,10 @@ var seed$1 = 1;
|
|
|
31714
31746
|
];
|
|
31715
31747
|
case 1:
|
|
31716
31748
|
rawJSON = _state.sent();
|
|
31749
|
+
// 小程序环境下,如果产物是相对路径,adapter 返回的是字符串,需要兼容
|
|
31750
|
+
if (isString(rawJSON)) {
|
|
31751
|
+
rawJSON = JSON.parse(rawJSON);
|
|
31752
|
+
}
|
|
31717
31753
|
return [
|
|
31718
31754
|
3,
|
|
31719
31755
|
3
|
|
@@ -34036,7 +34072,7 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
34036
34072
|
* @ignore
|
|
34037
34073
|
*/ _proto.findObject = function findObject(guid) {
|
|
34038
34074
|
// 编辑器可能传 Class 对象,这边判断处理一下直接返回原对象。
|
|
34039
|
-
if (!(
|
|
34075
|
+
if (!isPlainObject(guid)) {
|
|
34040
34076
|
return guid;
|
|
34041
34077
|
}
|
|
34042
34078
|
if (this.objectInstance[guid.id]) {
|
|
@@ -34376,7 +34412,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
|
|
|
34376
34412
|
registerPlugin("particle", ParticleLoader, exports.VFXItem);
|
|
34377
34413
|
registerPlugin("cal", CalculateLoader, exports.VFXItem);
|
|
34378
34414
|
registerPlugin("interact", InteractLoader, exports.VFXItem);
|
|
34379
|
-
var version$1 = "0.0.0-experimental-
|
|
34415
|
+
var version$1 = "0.0.0-experimental-20250828";
|
|
34380
34416
|
logger.info("Core version: " + version$1 + ".");
|
|
34381
34417
|
|
|
34382
34418
|
var _obj;
|
|
@@ -35981,7 +36017,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
35981
36017
|
*/ Mesh.create = function(engine, props) {
|
|
35982
36018
|
return new ThreeMesh(engine, props);
|
|
35983
36019
|
};
|
|
35984
|
-
var version = "0.0.0-experimental-
|
|
36020
|
+
var version = "0.0.0-experimental-20250828";
|
|
35985
36021
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
35986
36022
|
|
|
35987
36023
|
exports.AbstractPlugin = AbstractPlugin;
|
|
@@ -36219,6 +36255,7 @@ exports.isIOSByUA = isIOSByUA;
|
|
|
36219
36255
|
exports.isMiniProgram = isMiniProgram;
|
|
36220
36256
|
exports.isObject = isObject;
|
|
36221
36257
|
exports.isOpenHarmony = isOpenHarmony;
|
|
36258
|
+
exports.isPlainObject = isPlainObject;
|
|
36222
36259
|
exports.isSimulatorCellPhone = isSimulatorCellPhone;
|
|
36223
36260
|
exports.isString = isString;
|
|
36224
36261
|
exports.isUniformStruct = isUniformStruct;
|