@galacean/effects-plugin-model 2.0.0-alpha.17 → 2.0.0-alpha.19
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/alipay.js +1648 -578
- package/dist/alipay.js.map +1 -1
- package/dist/alipay.mjs +1315 -271
- package/dist/alipay.mjs.map +1 -1
- package/dist/gltf/index.d.ts +1 -0
- package/dist/gltf/loader-ecs-ext.d.ts +4 -2
- package/dist/gltf/loader-ecs.d.ts +9 -3
- package/dist/gltf/loader-ext.d.ts +1 -1
- package/dist/gltf/protocol.d.ts +1 -1
- package/dist/index.js +1649 -579
- 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 +1316 -272
- package/dist/index.mjs.map +1 -1
- package/dist/loader.mjs +1316 -272
- package/dist/loader.mjs.map +1 -1
- package/dist/runtime/material.d.ts +11 -17
- package/dist/runtime/scene.d.ts +2 -1
- package/dist/utility/plugin-helper.d.ts +3 -3
- package/package.json +5 -5
package/dist/alipay.js
CHANGED
|
@@ -2,7 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var EFFECTS = require('@galacean/effects/alipay');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var EFFECTS__namespace = /*#__PURE__*/_interopNamespace(EFFECTS);
|
|
6
26
|
|
|
7
27
|
/**
|
|
8
28
|
* Model 插件元素类型
|
|
@@ -195,7 +215,7 @@ function _extends() {
|
|
|
195
215
|
return _extends.apply(this, arguments);
|
|
196
216
|
}
|
|
197
217
|
|
|
198
|
-
var Vector2 =
|
|
218
|
+
var Vector2 = EFFECTS.math.Vector2, Vector3 = EFFECTS.math.Vector3, Vector4 = EFFECTS.math.Vector4, Matrix3 = EFFECTS.math.Matrix3, Matrix4 = EFFECTS.math.Matrix4, Color = EFFECTS.math.Color, Euler = EFFECTS.math.Euler, EulerOrder = EFFECTS.math.EulerOrder, Quaternion = EFFECTS.math.Quaternion, Box3 = EFFECTS.math.Box3, Sphere = EFFECTS.math.Sphere, Ray = EFFECTS.math.Ray, DEG2RAD = EFFECTS.math.DEG2RAD;
|
|
199
219
|
|
|
200
220
|
exports.PObjectType = void 0;
|
|
201
221
|
(function(PObjectType) {
|
|
@@ -284,10 +304,10 @@ var UnlitShaderGUID = "unlit000000000000000000000000000";
|
|
|
284
304
|
* @param trans - GE 变换对象或数据
|
|
285
305
|
* @returns
|
|
286
306
|
*/ _proto.fromEffectsTransform = function fromEffectsTransform(trans) {
|
|
287
|
-
if (_instanceof1(trans,
|
|
307
|
+
if (_instanceof1(trans, EFFECTS.Transform)) {
|
|
288
308
|
this.setMatrix(trans.getWorldMatrix());
|
|
289
309
|
} else {
|
|
290
|
-
var effectsTrans = new
|
|
310
|
+
var effectsTrans = new EFFECTS.Transform(_extends({}, trans, {
|
|
291
311
|
valid: true
|
|
292
312
|
}));
|
|
293
313
|
effectsTrans.setValid(true);
|
|
@@ -462,10 +482,10 @@ var UnlitShaderGUID = "unlit000000000000000000000000000";
|
|
|
462
482
|
function PGlobalState() {
|
|
463
483
|
this.isWebGL2 = false;
|
|
464
484
|
this.shaderShared = true;
|
|
465
|
-
this.runtimeEnv =
|
|
485
|
+
this.runtimeEnv = EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
|
|
466
486
|
this.compatibleMode = "gltf";
|
|
467
487
|
this.visBoundingBox = false;
|
|
468
|
-
this.renderMode3D =
|
|
488
|
+
this.renderMode3D = EFFECTS.spec.RenderMode3D.none;
|
|
469
489
|
this.renderMode3DUVGridSize = 1 / 16;
|
|
470
490
|
}
|
|
471
491
|
var _proto = PGlobalState.prototype;
|
|
@@ -474,16 +494,16 @@ var UnlitShaderGUID = "unlit000000000000000000000000000";
|
|
|
474
494
|
*/ _proto.reset = function reset() {
|
|
475
495
|
this.isWebGL2 = false;
|
|
476
496
|
this.shaderShared = true;
|
|
477
|
-
this.runtimeEnv =
|
|
497
|
+
this.runtimeEnv = EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
|
|
478
498
|
this.compatibleMode = "gltf";
|
|
479
499
|
this.visBoundingBox = false;
|
|
480
|
-
this.renderMode3D =
|
|
500
|
+
this.renderMode3D = EFFECTS.spec.RenderMode3D.none;
|
|
481
501
|
this.renderMode3DUVGridSize = 1 / 16;
|
|
482
502
|
};
|
|
483
503
|
/**
|
|
484
504
|
* 是否可视化渲染中间结果
|
|
485
505
|
*/ _proto.hasRenderMode3D = function hasRenderMode3D() {
|
|
486
|
-
return this.renderMode3D !==
|
|
506
|
+
return this.renderMode3D !== EFFECTS.spec.RenderMode3D.none;
|
|
487
507
|
};
|
|
488
508
|
/**
|
|
489
509
|
* 获取单例
|
|
@@ -498,7 +518,7 @@ var UnlitShaderGUID = "unlit000000000000000000000000000";
|
|
|
498
518
|
get: /**
|
|
499
519
|
* 是否编辑器模式
|
|
500
520
|
*/ function get() {
|
|
501
|
-
return this.runtimeEnv ===
|
|
521
|
+
return this.runtimeEnv === EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
|
|
502
522
|
}
|
|
503
523
|
},
|
|
504
524
|
{
|
|
@@ -774,7 +794,7 @@ var ctrlMap = {
|
|
|
774
794
|
* @param binaries
|
|
775
795
|
* @param pointer
|
|
776
796
|
*/ function typedArrayFromBinary(binary, pointer) {
|
|
777
|
-
if (pointer.length != 2 || pointer[0] !==
|
|
797
|
+
if (pointer.length != 2 || pointer[0] !== EFFECTS.spec.ValueType.BINARY || !_instanceof1(pointer[1], Array)) {
|
|
778
798
|
// 不是BinaryPointer,可能已经创建,直接返回
|
|
779
799
|
return pointer;
|
|
780
800
|
}
|
|
@@ -1151,7 +1171,7 @@ exports.TextureDataMode = void 0;
|
|
|
1151
1171
|
var matList = props.inverseBindMatrices;
|
|
1152
1172
|
if (matList !== undefined && matList.length > 0) {
|
|
1153
1173
|
if (matList.length % 16 !== 0 || matList.length !== this.jointItem.length * 16) {
|
|
1154
|
-
throw new Error("Invalid array length, invert bind matrices " + matList.length + ", joint array " + this.jointItem.length);
|
|
1174
|
+
throw new Error("Invalid array length, invert bind matrices " + matList.length + ", joint array " + this.jointItem.length + ".");
|
|
1155
1175
|
}
|
|
1156
1176
|
var matrixCount = matList.length / 16;
|
|
1157
1177
|
for(var i = 0; i < matrixCount; i++){
|
|
@@ -1182,7 +1202,7 @@ exports.TextureDataMode = void 0;
|
|
|
1182
1202
|
});
|
|
1183
1203
|
} else {
|
|
1184
1204
|
this.animationMatrices = this.inverseBindMatrices;
|
|
1185
|
-
console.error("Some error occured, replace skin animation matrices by invert bind matrices");
|
|
1205
|
+
console.error("Some error occured, replace skin animation matrices by invert bind matrices.");
|
|
1186
1206
|
}
|
|
1187
1207
|
};
|
|
1188
1208
|
/**
|
|
@@ -1243,7 +1263,7 @@ exports.TextureDataMode = void 0;
|
|
|
1243
1263
|
} else if (detail.halfFloatTexture) {
|
|
1244
1264
|
return 2;
|
|
1245
1265
|
} else {
|
|
1246
|
-
throw new Error("Too many joint count " + jointCount + ", half float texture not support");
|
|
1266
|
+
throw new Error("Too many joint count " + jointCount + ", half float texture not support.");
|
|
1247
1267
|
}
|
|
1248
1268
|
} else {
|
|
1249
1269
|
return 0;
|
|
@@ -1256,7 +1276,7 @@ exports.TextureDataMode = void 0;
|
|
|
1256
1276
|
(_props_boneNames = props.boneNames) == null ? void 0 : _props_boneNames.forEach(function(boneName) {
|
|
1257
1277
|
var node = name2Item[boneName];
|
|
1258
1278
|
if (!node) {
|
|
1259
|
-
throw new Error("Can't find node of bone name " + boneName);
|
|
1279
|
+
throw new Error("Can't find node of bone name " + boneName + ".");
|
|
1260
1280
|
}
|
|
1261
1281
|
jointItems.push(node);
|
|
1262
1282
|
});
|
|
@@ -1353,19 +1373,19 @@ exports.TextureDataMode = void 0;
|
|
|
1353
1373
|
* 还要注意最大数目不能超过5,否则也直接报错。
|
|
1354
1374
|
* 后续考虑是否做个兼容,目前还是严格报错比较好。
|
|
1355
1375
|
*/ if (positionCount > 0 && positionCount != this.morphWeightsLength) {
|
|
1356
|
-
console.error("Position morph count mismatch: " + this.morphWeightsLength + ", " + positionCount);
|
|
1376
|
+
console.error("Position morph count mismatch: " + this.morphWeightsLength + ", " + positionCount + ".");
|
|
1357
1377
|
return false;
|
|
1358
1378
|
}
|
|
1359
1379
|
if (normalCount > 0 && normalCount != this.morphWeightsLength) {
|
|
1360
|
-
console.error("Normal morph count mismatch: " + this.morphWeightsLength + ", " + normalCount);
|
|
1380
|
+
console.error("Normal morph count mismatch: " + this.morphWeightsLength + ", " + normalCount + ".");
|
|
1361
1381
|
return false;
|
|
1362
1382
|
}
|
|
1363
1383
|
if (tangentCount > 0 && tangentCount != this.morphWeightsLength) {
|
|
1364
|
-
console.error("Tangent morph count mismatch: " + this.morphWeightsLength + ", " + tangentCount);
|
|
1384
|
+
console.error("Tangent morph count mismatch: " + this.morphWeightsLength + ", " + tangentCount + ".");
|
|
1365
1385
|
return false;
|
|
1366
1386
|
}
|
|
1367
1387
|
if (this.morphWeightsLength > 5) {
|
|
1368
|
-
console.error("Tangent morph count should not greater than 5, current " + this.morphWeightsLength);
|
|
1388
|
+
console.error("Tangent morph count should not greater than 5, current " + this.morphWeightsLength + ".");
|
|
1369
1389
|
return false;
|
|
1370
1390
|
}
|
|
1371
1391
|
return true;
|
|
@@ -1387,7 +1407,7 @@ exports.TextureDataMode = void 0;
|
|
|
1387
1407
|
_proto.updateWeights = function updateWeights(weights) {
|
|
1388
1408
|
var _this = this;
|
|
1389
1409
|
if (weights.length != this.morphWeightsArray.length) {
|
|
1390
|
-
console.error("Length of morph weights mismatch: input " + weights.length + ", internel " + this.morphWeightsArray.length);
|
|
1410
|
+
console.error("Length of morph weights mismatch: input " + weights.length + ", internel " + this.morphWeightsArray.length + ".");
|
|
1391
1411
|
return;
|
|
1392
1412
|
}
|
|
1393
1413
|
weights.forEach(function(value, index) {
|
|
@@ -1508,16 +1528,16 @@ exports.PAnimPathType = void 0;
|
|
|
1508
1528
|
this.component = this.dataArray.length / this.timeArray.length;
|
|
1509
1529
|
// special checker for weights animation
|
|
1510
1530
|
if (this.component <= 0) {
|
|
1511
|
-
console.error("Invalid weights component: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length);
|
|
1531
|
+
console.error("Invalid weights component: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length + ".");
|
|
1512
1532
|
} else if (this.timeArray.length * this.component != this.dataArray.length) {
|
|
1513
|
-
console.error("Invalid weights array length: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length);
|
|
1533
|
+
console.error("Invalid weights array length: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length + ".");
|
|
1514
1534
|
}
|
|
1515
1535
|
} else {
|
|
1516
1536
|
// should never happened
|
|
1517
|
-
console.error("Invalid path status: " + path);
|
|
1537
|
+
console.error("Invalid path status: " + path + ".");
|
|
1518
1538
|
}
|
|
1519
1539
|
if (this.timeArray.length * this.component > this.dataArray.length) {
|
|
1520
|
-
throw new Error("Data length mismatch: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length);
|
|
1540
|
+
throw new Error("Data length mismatch: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length + ".");
|
|
1521
1541
|
}
|
|
1522
1542
|
if (interpolation === "LINEAR") {
|
|
1523
1543
|
this.interp = 0;
|
|
@@ -1642,21 +1662,21 @@ exports.PAnimPathType = void 0;
|
|
|
1642
1662
|
}
|
|
1643
1663
|
var _this_buffer_data;
|
|
1644
1664
|
var data = (_this_buffer_data = (_this_buffer = this.buffer) == null ? void 0 : _this_buffer.data) != null ? _this_buffer_data : new Float32Array(this.getSize() * 4);
|
|
1645
|
-
var type = this.isHalfFloat ?
|
|
1646
|
-
this.texture =
|
|
1665
|
+
var type = this.isHalfFloat ? EFFECTS.glContext.HALF_FLOAT : EFFECTS.glContext.FLOAT;
|
|
1666
|
+
this.texture = EFFECTS.Texture.create(this.engine, {
|
|
1647
1667
|
name: name,
|
|
1648
1668
|
data: {
|
|
1649
1669
|
width: this.width,
|
|
1650
1670
|
height: this.height,
|
|
1651
1671
|
data: data
|
|
1652
1672
|
},
|
|
1653
|
-
target:
|
|
1654
|
-
format:
|
|
1673
|
+
target: EFFECTS.glContext.TEXTURE_2D,
|
|
1674
|
+
format: EFFECTS.glContext.RGBA,
|
|
1655
1675
|
type: type,
|
|
1656
|
-
wrapS:
|
|
1657
|
-
wrapT:
|
|
1658
|
-
minFilter:
|
|
1659
|
-
magFilter:
|
|
1676
|
+
wrapS: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
1677
|
+
wrapT: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
1678
|
+
minFilter: EFFECTS.glContext.NEAREST,
|
|
1679
|
+
magFilter: EFFECTS.glContext.NEAREST
|
|
1660
1680
|
});
|
|
1661
1681
|
};
|
|
1662
1682
|
/**
|
|
@@ -1670,13 +1690,13 @@ exports.PAnimPathType = void 0;
|
|
|
1670
1690
|
var _this_buffer;
|
|
1671
1691
|
var _this_buffer_data;
|
|
1672
1692
|
this.texture.updateSource({
|
|
1673
|
-
sourceType:
|
|
1693
|
+
sourceType: EFFECTS.TextureSourceType.data,
|
|
1674
1694
|
data: {
|
|
1675
1695
|
width: this.width,
|
|
1676
1696
|
height: this.height,
|
|
1677
1697
|
data: (_this_buffer_data = (_this_buffer = this.buffer) == null ? void 0 : _this_buffer.data) != null ? _this_buffer_data : buffer
|
|
1678
1698
|
},
|
|
1679
|
-
target:
|
|
1699
|
+
target: EFFECTS.glContext.TEXTURE_2D
|
|
1680
1700
|
});
|
|
1681
1701
|
}
|
|
1682
1702
|
};
|
|
@@ -1874,7 +1894,7 @@ var deg2rad = Math.PI / 180;
|
|
|
1874
1894
|
*/ _this.aspect = 1.0;
|
|
1875
1895
|
/**
|
|
1876
1896
|
* 剪裁模式,默认是剪裁左右
|
|
1877
|
-
*/ _this.clipMode =
|
|
1897
|
+
*/ _this.clipMode = EFFECTS.spec.CameraClipMode.landscape;
|
|
1878
1898
|
/**
|
|
1879
1899
|
* 投影矩阵
|
|
1880
1900
|
*/ _this.projectionMatrix = new Matrix4();
|
|
@@ -1897,7 +1917,7 @@ var deg2rad = Math.PI / 180;
|
|
|
1897
1917
|
var _data_aspect;
|
|
1898
1918
|
_this.aspect = (_data_aspect = data.aspect) != null ? _data_aspect : _this.width / _this.height;
|
|
1899
1919
|
var _data_clipMode;
|
|
1900
|
-
_this.clipMode = (_data_clipMode = data.clipMode) != null ? _data_clipMode :
|
|
1920
|
+
_this.clipMode = (_data_clipMode = data.clipMode) != null ? _data_clipMode : EFFECTS.spec.CameraClipMode.landscape;
|
|
1901
1921
|
_this.update();
|
|
1902
1922
|
return _this;
|
|
1903
1923
|
}
|
|
@@ -1908,7 +1928,7 @@ var deg2rad = Math.PI / 180;
|
|
|
1908
1928
|
if (this.owner !== undefined) {
|
|
1909
1929
|
this.transform.fromEffectsTransform(this.owner.transform);
|
|
1910
1930
|
}
|
|
1911
|
-
var reverse = this.clipMode ===
|
|
1931
|
+
var reverse = this.clipMode === EFFECTS.spec.CameraClipMode.portrait;
|
|
1912
1932
|
this.projectionMatrix.perspective(this.fov * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse);
|
|
1913
1933
|
this.viewMatrix = this.matrix.invert();
|
|
1914
1934
|
};
|
|
@@ -1917,7 +1937,7 @@ var deg2rad = Math.PI / 180;
|
|
|
1917
1937
|
* @param fov - 视角大小
|
|
1918
1938
|
* @returns 投影矩阵
|
|
1919
1939
|
*/ _proto.getNewProjectionMatrix = function getNewProjectionMatrix(fov) {
|
|
1920
|
-
var reverse = this.clipMode ===
|
|
1940
|
+
var reverse = this.clipMode === EFFECTS.spec.CameraClipMode.portrait;
|
|
1921
1941
|
return new Matrix4().perspective(Math.min(fov * 1.25, 140) * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse);
|
|
1922
1942
|
};
|
|
1923
1943
|
/**
|
|
@@ -1965,7 +1985,7 @@ var deg2rad = Math.PI / 180;
|
|
|
1965
1985
|
* 是否剪裁上下
|
|
1966
1986
|
* @returns
|
|
1967
1987
|
*/ _proto.isReversed = function isReversed() {
|
|
1968
|
-
return this.clipMode ===
|
|
1988
|
+
return this.clipMode === EFFECTS.spec.CameraClipMode.portrait;
|
|
1969
1989
|
};
|
|
1970
1990
|
/**
|
|
1971
1991
|
* 获取眼睛位置
|
|
@@ -1994,7 +2014,7 @@ var deg2rad = Math.PI / 180;
|
|
|
1994
2014
|
fov: 60,
|
|
1995
2015
|
far: 1000,
|
|
1996
2016
|
near: 0.001,
|
|
1997
|
-
clipMode:
|
|
2017
|
+
clipMode: EFFECTS.spec.CameraClipMode.portrait,
|
|
1998
2018
|
item: {
|
|
1999
2019
|
id: "0"
|
|
2000
2020
|
}
|
|
@@ -2147,11 +2167,11 @@ var deg2rad = Math.PI / 180;
|
|
|
2147
2167
|
var color = data.color;
|
|
2148
2168
|
_this.color = new Vector3(color.r, color.g, color.b);
|
|
2149
2169
|
_this.intensity = data.intensity;
|
|
2150
|
-
if (data.lightType ===
|
|
2170
|
+
if (data.lightType === EFFECTS.spec.LightType.point) {
|
|
2151
2171
|
_this.lightType = exports.PLightType.point;
|
|
2152
2172
|
var _data_range;
|
|
2153
2173
|
_this.range = (_data_range = data.range) != null ? _data_range : -1;
|
|
2154
|
-
} else if (data.lightType ===
|
|
2174
|
+
} else if (data.lightType === EFFECTS.spec.LightType.spot) {
|
|
2155
2175
|
_this.lightType = exports.PLightType.spot;
|
|
2156
2176
|
var _data_range1;
|
|
2157
2177
|
_this.range = (_data_range1 = data.range) != null ? _data_range1 : -1;
|
|
@@ -2159,7 +2179,7 @@ var deg2rad = Math.PI / 180;
|
|
|
2159
2179
|
_this.outerConeAngle = (_data_outerConeAngle = data.outerConeAngle) != null ? _data_outerConeAngle : Math.PI;
|
|
2160
2180
|
var _data_innerConeAngle;
|
|
2161
2181
|
_this.innerConeAngle = (_data_innerConeAngle = data.innerConeAngle) != null ? _data_innerConeAngle : 0;
|
|
2162
|
-
} else if (data.lightType ===
|
|
2182
|
+
} else if (data.lightType === EFFECTS.spec.LightType.directional) {
|
|
2163
2183
|
_this.lightType = exports.PLightType.directional;
|
|
2164
2184
|
} else {
|
|
2165
2185
|
_this.lightType = exports.PLightType.ambient;
|
|
@@ -2301,14 +2321,14 @@ function _assert_this_initialized(self) {
|
|
|
2301
2321
|
*/ _proto.addDepthAttachment = function addDepthAttachment(options) {
|
|
2302
2322
|
var _options_storageType;
|
|
2303
2323
|
this.depthAttachment = {
|
|
2304
|
-
storageType: (_options_storageType = options.storageType) != null ? _options_storageType :
|
|
2324
|
+
storageType: (_options_storageType = options.storageType) != null ? _options_storageType : EFFECTS.RenderPassAttachmentStorageType.depth_16_texture
|
|
2305
2325
|
};
|
|
2306
2326
|
};
|
|
2307
2327
|
/**
|
|
2308
2328
|
* 添加默认深度附件,数据格式是 depth_16_texture
|
|
2309
2329
|
*/ _proto.addDefaultDepthAttachment = function addDefaultDepthAttachment() {
|
|
2310
2330
|
this.depthAttachment = {
|
|
2311
|
-
storageType:
|
|
2331
|
+
storageType: EFFECTS.RenderPassAttachmentStorageType.depth_16_texture
|
|
2312
2332
|
};
|
|
2313
2333
|
};
|
|
2314
2334
|
/**
|
|
@@ -2323,10 +2343,10 @@ function _assert_this_initialized(self) {
|
|
|
2323
2343
|
var _options_format, _options_type, _options_filter, _options_filter1;
|
|
2324
2344
|
this.colorAttachments.push({
|
|
2325
2345
|
texture: {
|
|
2326
|
-
format: (_options_format = options.format) != null ? _options_format :
|
|
2327
|
-
type: (_options_type = options.type) != null ? _options_type :
|
|
2328
|
-
minFilter: (_options_filter = options.filter) != null ? _options_filter :
|
|
2329
|
-
magFilter: (_options_filter1 = options.filter) != null ? _options_filter1 :
|
|
2346
|
+
format: (_options_format = options.format) != null ? _options_format : EFFECTS.glContext.RGBA,
|
|
2347
|
+
type: (_options_type = options.type) != null ? _options_type : EFFECTS.glContext.HALF_FLOAT,
|
|
2348
|
+
minFilter: (_options_filter = options.filter) != null ? _options_filter : EFFECTS.glContext.LINEAR,
|
|
2349
|
+
magFilter: (_options_filter1 = options.filter) != null ? _options_filter1 : EFFECTS.glContext.LINEAR
|
|
2330
2350
|
}
|
|
2331
2351
|
});
|
|
2332
2352
|
};
|
|
@@ -2359,7 +2379,7 @@ function _assert_this_initialized(self) {
|
|
|
2359
2379
|
* 包围盒 Mesh 类,负责 3D Mesh 测试包围盒的显示
|
|
2360
2380
|
*/ var BoxMesh = /*#__PURE__*/ function() {
|
|
2361
2381
|
function BoxMesh(engine, priority) {
|
|
2362
|
-
var material =
|
|
2382
|
+
var material = EFFECTS.Material.create(engine, {
|
|
2363
2383
|
shader: {
|
|
2364
2384
|
vertex: this.vertexShader,
|
|
2365
2385
|
fragment: this.fragmentShader,
|
|
@@ -2368,10 +2388,10 @@ function _assert_this_initialized(self) {
|
|
|
2368
2388
|
});
|
|
2369
2389
|
material.depthTest = true;
|
|
2370
2390
|
material.depthMask = true;
|
|
2371
|
-
this.mesh =
|
|
2391
|
+
this.mesh = EFFECTS.Mesh.create(engine, {
|
|
2372
2392
|
name: "boxMesh",
|
|
2373
2393
|
material: material,
|
|
2374
|
-
geometry:
|
|
2394
|
+
geometry: EFFECTS.Geometry.create(engine, this.geometry),
|
|
2375
2395
|
priority: priority
|
|
2376
2396
|
});
|
|
2377
2397
|
}
|
|
@@ -2459,14 +2479,14 @@ function _assert_this_initialized(self) {
|
|
|
2459
2479
|
return {
|
|
2460
2480
|
attributes: {
|
|
2461
2481
|
aPos: {
|
|
2462
|
-
type:
|
|
2482
|
+
type: EFFECTS.glContext.FLOAT,
|
|
2463
2483
|
size: 1,
|
|
2464
2484
|
data: data,
|
|
2465
2485
|
stride: Float32Array.BYTES_PER_ELEMENT,
|
|
2466
2486
|
offset: 0
|
|
2467
2487
|
}
|
|
2468
2488
|
},
|
|
2469
|
-
mode:
|
|
2489
|
+
mode: EFFECTS.glContext.LINES,
|
|
2470
2490
|
indices: {
|
|
2471
2491
|
data: index
|
|
2472
2492
|
},
|
|
@@ -2537,7 +2557,7 @@ function _assert_this_initialized(self) {
|
|
|
2537
2557
|
_this.subMeshes.push(subMesh);
|
|
2538
2558
|
});
|
|
2539
2559
|
if (_this.subMeshes.length <= 0) {
|
|
2540
|
-
console.warn("No primitive inside mesh item " + name);
|
|
2560
|
+
console.warn("No primitive inside mesh item " + name + ".");
|
|
2541
2561
|
}
|
|
2542
2562
|
_this.boundingBox = _this.getItemBoundingBox(meshData.interaction);
|
|
2543
2563
|
return _this;
|
|
@@ -2625,7 +2645,7 @@ function _assert_this_initialized(self) {
|
|
|
2625
2645
|
return;
|
|
2626
2646
|
}
|
|
2627
2647
|
if (updatedArray.length != weightsArray.length) {
|
|
2628
|
-
throw new Error("
|
|
2648
|
+
throw new Error("Weight array length mismatch.");
|
|
2629
2649
|
}
|
|
2630
2650
|
for(var i = 0; i < updatedArray.length; i++){
|
|
2631
2651
|
updatedArray[i] = weightsArray[i];
|
|
@@ -2741,7 +2761,7 @@ function _assert_this_initialized(self) {
|
|
|
2741
2761
|
if (inBounding === undefined) {
|
|
2742
2762
|
return new Box3();
|
|
2743
2763
|
}
|
|
2744
|
-
if (inBounding.type ===
|
|
2764
|
+
if (inBounding.type === EFFECTS.spec.ModelBoundingType.box) {
|
|
2745
2765
|
var _inBounding_center;
|
|
2746
2766
|
var center = (_inBounding_center = inBounding.center) != null ? _inBounding_center : [
|
|
2747
2767
|
0,
|
|
@@ -2876,12 +2896,12 @@ function _assert_this_initialized(self) {
|
|
|
2876
2896
|
});
|
|
2877
2897
|
this.material.setMaterialStates(material);
|
|
2878
2898
|
} else {
|
|
2879
|
-
material =
|
|
2899
|
+
material = EFFECTS.Material.create(this.engine, {
|
|
2880
2900
|
shader: {
|
|
2881
2901
|
vertex: this.material.vertexShaderCode,
|
|
2882
2902
|
fragment: this.material.fragmentShaderCode,
|
|
2883
2903
|
shared: globalState.shaderShared,
|
|
2884
|
-
glslVersion: isWebGL2 ?
|
|
2904
|
+
glslVersion: isWebGL2 ? EFFECTS.GLSLVersion.GLSL3 : EFFECTS.GLSLVersion.GLSL1
|
|
2885
2905
|
},
|
|
2886
2906
|
uniformSemantics: newSemantics
|
|
2887
2907
|
});
|
|
@@ -3116,7 +3136,7 @@ function _assert_this_initialized(self) {
|
|
|
3116
3136
|
});
|
|
3117
3137
|
}
|
|
3118
3138
|
var proxy = new HitTestingProxy();
|
|
3119
|
-
var doubleSided = this.material.
|
|
3139
|
+
var doubleSided = this.material.isBothSide();
|
|
3120
3140
|
proxy.create(this.geometry.geometry, doubleSided, bindMatrices);
|
|
3121
3141
|
return proxy.getHitPoint(newOrigin, newDirection);
|
|
3122
3142
|
};
|
|
@@ -3147,21 +3167,21 @@ function _assert_this_initialized(self) {
|
|
|
3147
3167
|
* @returns 返回相应的宏定义
|
|
3148
3168
|
*/ _proto.getRenderMode3DDefine = function getRenderMode3DDefine(mode) {
|
|
3149
3169
|
switch(mode){
|
|
3150
|
-
case
|
|
3170
|
+
case EFFECTS.spec.RenderMode3D.uv:
|
|
3151
3171
|
return "DEBUG_UV";
|
|
3152
|
-
case
|
|
3172
|
+
case EFFECTS.spec.RenderMode3D.normal:
|
|
3153
3173
|
return "DEBUG_NORMAL";
|
|
3154
|
-
case
|
|
3174
|
+
case EFFECTS.spec.RenderMode3D.basecolor:
|
|
3155
3175
|
return "DEBUG_BASECOLOR";
|
|
3156
|
-
case
|
|
3176
|
+
case EFFECTS.spec.RenderMode3D.alpha:
|
|
3157
3177
|
return "DEBUG_ALPHA";
|
|
3158
|
-
case
|
|
3178
|
+
case EFFECTS.spec.RenderMode3D.metallic:
|
|
3159
3179
|
return "DEBUG_METALLIC";
|
|
3160
|
-
case
|
|
3180
|
+
case EFFECTS.spec.RenderMode3D.roughness:
|
|
3161
3181
|
return "DEBUG_ROUGHNESS";
|
|
3162
|
-
case
|
|
3182
|
+
case EFFECTS.spec.RenderMode3D.ao:
|
|
3163
3183
|
return "DEBUG_OCCLUSION";
|
|
3164
|
-
case
|
|
3184
|
+
case EFFECTS.spec.RenderMode3D.emissive:
|
|
3165
3185
|
return "DEBUG_EMISSIVE";
|
|
3166
3186
|
}
|
|
3167
3187
|
};
|
|
@@ -3257,8 +3277,7 @@ function _assert_this_initialized(self) {
|
|
|
3257
3277
|
material.setVector3("_shCoefficients." + n, Vector3.fromArray(coeffs[i]));
|
|
3258
3278
|
});
|
|
3259
3279
|
}
|
|
3260
|
-
|
|
3261
|
-
material.setInt("_MipCount", (_skybox_specularMipCount = skybox.specularMipCount) != null ? _skybox_specularMipCount : 1);
|
|
3280
|
+
material.setInt("_MipCount", skybox.specularMipCount - 1);
|
|
3262
3281
|
material.setTexture("_SpecularEnvSampler", skybox.specularImage);
|
|
3263
3282
|
}
|
|
3264
3283
|
}
|
|
@@ -3619,7 +3638,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3619
3638
|
this.brdfLUT = this.sceneCache.getBrdfLutTexture();
|
|
3620
3639
|
this.initGlobalState(opts);
|
|
3621
3640
|
if (this.maxLightCount > 8) {
|
|
3622
|
-
console.warn("Too many light items: " + this.maxLightCount + " light(s)");
|
|
3641
|
+
console.warn("Too many light items: " + this.maxLightCount + " light(s).");
|
|
3623
3642
|
}
|
|
3624
3643
|
};
|
|
3625
3644
|
_proto.initGlobalState = function initGlobalState(opts) {
|
|
@@ -3629,13 +3648,13 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3629
3648
|
globalState.isWebGL2 = capbility.level === 2;
|
|
3630
3649
|
var _opts_runtimeEnv;
|
|
3631
3650
|
//globalState.shaderShared = composition.env === PLAYER_OPTIONS_ENV_EDITOR;
|
|
3632
|
-
globalState.runtimeEnv = (_opts_runtimeEnv = opts.runtimeEnv) != null ? _opts_runtimeEnv :
|
|
3651
|
+
globalState.runtimeEnv = (_opts_runtimeEnv = opts.runtimeEnv) != null ? _opts_runtimeEnv : EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
|
|
3633
3652
|
var _opts_compatibleMode;
|
|
3634
3653
|
globalState.compatibleMode = (_opts_compatibleMode = opts.compatibleMode) != null ? _opts_compatibleMode : "gltf";
|
|
3635
3654
|
var _opts_visBoundingBox;
|
|
3636
3655
|
globalState.visBoundingBox = (_opts_visBoundingBox = opts.visBoundingBox) != null ? _opts_visBoundingBox : false;
|
|
3637
3656
|
var _opts_renderMode3D;
|
|
3638
|
-
globalState.renderMode3D = (_opts_renderMode3D = opts.renderMode3D) != null ? _opts_renderMode3D :
|
|
3657
|
+
globalState.renderMode3D = (_opts_renderMode3D = opts.renderMode3D) != null ? _opts_renderMode3D : EFFECTS.spec.RenderMode3D.none;
|
|
3639
3658
|
var _opts_renderMode3DUVGridSize;
|
|
3640
3659
|
globalState.renderMode3DUVGridSize = (_opts_renderMode3DUVGridSize = opts.renderMode3DUVGridSize) != null ? _opts_renderMode3DUVGridSize : 1 / 16;
|
|
3641
3660
|
};
|
|
@@ -3691,7 +3710,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3691
3710
|
if (mesh.parentItemId !== undefined) {
|
|
3692
3711
|
this.parentId2Mesh.set(mesh.parentItemId, mesh);
|
|
3693
3712
|
}
|
|
3694
|
-
|
|
3713
|
+
EFFECTS.addItem(this.meshList, mesh);
|
|
3695
3714
|
} else if (_instanceof1(item, PSkybox)) {
|
|
3696
3715
|
var skybox = item;
|
|
3697
3716
|
skybox.setup(this.brdfLUT);
|
|
@@ -3708,7 +3727,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3708
3727
|
} else {
|
|
3709
3728
|
this.cameraManager.insertCamera(item);
|
|
3710
3729
|
}
|
|
3711
|
-
|
|
3730
|
+
EFFECTS.addItem(this.itemList, item);
|
|
3712
3731
|
};
|
|
3713
3732
|
/**
|
|
3714
3733
|
* 从场景中删除插件元素
|
|
@@ -3719,7 +3738,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3719
3738
|
if (mesh.parentItemId !== undefined) {
|
|
3720
3739
|
this.parentId2Mesh.delete(mesh.parentItemId);
|
|
3721
3740
|
}
|
|
3722
|
-
|
|
3741
|
+
EFFECTS.removeItem(this.meshList, mesh);
|
|
3723
3742
|
} else if (_instanceof1(item, PSkybox)) {
|
|
3724
3743
|
this.skybox = undefined;
|
|
3725
3744
|
} else if (_instanceof1(item, PLight)) {
|
|
@@ -3727,13 +3746,13 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3727
3746
|
} else {
|
|
3728
3747
|
this.cameraManager.remove(item);
|
|
3729
3748
|
}
|
|
3730
|
-
|
|
3749
|
+
EFFECTS.removeItem(this.itemList, item);
|
|
3731
3750
|
};
|
|
3732
3751
|
/**
|
|
3733
3752
|
* 更新默认相机状态,根据传入的相机参数
|
|
3734
3753
|
* @param camera - 相机参数
|
|
3735
3754
|
*/ _proto.updateDefaultCamera = function updateDefaultCamera(camera) {
|
|
3736
|
-
var effectsTransfrom = new
|
|
3755
|
+
var effectsTransfrom = new EFFECTS.Transform(_extends({}, camera, {
|
|
3737
3756
|
valid: true
|
|
3738
3757
|
}));
|
|
3739
3758
|
var newTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
|
|
@@ -3764,9 +3783,9 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3764
3783
|
maxLightCount: this.maxLightCount,
|
|
3765
3784
|
skybox: this.skybox
|
|
3766
3785
|
};
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3786
|
+
if (this.enableDynamicSort) {
|
|
3787
|
+
this.dynamicSortMeshes(this.sceneStates);
|
|
3788
|
+
}
|
|
3770
3789
|
this.tickCount += 1;
|
|
3771
3790
|
this.lastTickSecond += deltaSeconds;
|
|
3772
3791
|
};
|
|
@@ -3775,12 +3794,14 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3775
3794
|
* 主要是为了和 Tiny 渲染对齐,正常渲染不进行调整
|
|
3776
3795
|
* @param states - 场景中的状态数据
|
|
3777
3796
|
*/ _proto.dynamicSortMeshes = function dynamicSortMeshes(states) {
|
|
3778
|
-
var
|
|
3797
|
+
var meshComponents = [];
|
|
3779
3798
|
var priorityList = [];
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3799
|
+
this.meshList.forEach(function(mesh) {
|
|
3800
|
+
if (mesh.owner && mesh.owner.enabled) {
|
|
3801
|
+
var component = mesh.owner;
|
|
3802
|
+
meshComponents.push(component);
|
|
3803
|
+
priorityList.push(component.priority);
|
|
3804
|
+
}
|
|
3784
3805
|
});
|
|
3785
3806
|
priorityList.sort(function(a, b) {
|
|
3786
3807
|
return a - b;
|
|
@@ -3788,26 +3809,30 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3788
3809
|
// 按照 Tiny 排序算法,对 Mesh 对象进行排序
|
|
3789
3810
|
// 将透明和不透明物体拆开,从而渲染正确
|
|
3790
3811
|
var viewMatrix = states.viewMatrix;
|
|
3791
|
-
|
|
3812
|
+
meshComponents.sort(function(a, b) {
|
|
3792
3813
|
var atransparent = WebGLHelper.isTransparentMesh(a);
|
|
3793
3814
|
var btransparent = WebGLHelper.isTransparentMesh(b);
|
|
3794
3815
|
if (atransparent && btransparent) {
|
|
3795
|
-
var aposition =
|
|
3796
|
-
var bposition =
|
|
3816
|
+
var aposition = a.transform.getWorldPosition();
|
|
3817
|
+
var bposition = b.transform.getWorldPosition();
|
|
3797
3818
|
var anewPos = viewMatrix.transformPoint(aposition);
|
|
3798
3819
|
var bnewPos = viewMatrix.transformPoint(bposition);
|
|
3799
|
-
|
|
3820
|
+
if (anewPos.z === bnewPos.z) {
|
|
3821
|
+
return a.priority - b.priority;
|
|
3822
|
+
} else {
|
|
3823
|
+
return anewPos.z - bnewPos.z;
|
|
3824
|
+
}
|
|
3800
3825
|
} else if (atransparent) {
|
|
3801
3826
|
return 1;
|
|
3802
3827
|
} else if (btransparent) {
|
|
3803
3828
|
return -1;
|
|
3804
3829
|
} else {
|
|
3805
|
-
return
|
|
3830
|
+
return a.priority - b.priority;
|
|
3806
3831
|
}
|
|
3807
3832
|
});
|
|
3808
3833
|
// 重新赋值渲染优先级
|
|
3809
|
-
for(var i = 0; i <
|
|
3810
|
-
var mesh =
|
|
3834
|
+
for(var i = 0; i < meshComponents.length; i++){
|
|
3835
|
+
var mesh = meshComponents[i];
|
|
3811
3836
|
var priority = priorityList[i];
|
|
3812
3837
|
mesh.priority = priority;
|
|
3813
3838
|
}
|
|
@@ -3952,7 +3977,7 @@ var StandardShaderSource;
|
|
|
3952
3977
|
if (isWebGL2) {
|
|
3953
3978
|
return "#version 300 es\n" + source;
|
|
3954
3979
|
} else {
|
|
3955
|
-
return
|
|
3980
|
+
return source;
|
|
3956
3981
|
}
|
|
3957
3982
|
}
|
|
3958
3983
|
/**
|
|
@@ -3969,9 +3994,8 @@ var StandardShaderSource;
|
|
|
3969
3994
|
}
|
|
3970
3995
|
if (isWebGL2) {
|
|
3971
3996
|
return "#version 300 es\n" + source;
|
|
3972
|
-
} else {
|
|
3973
|
-
return "#version 100\n" + source;
|
|
3974
3997
|
}
|
|
3998
|
+
return source;
|
|
3975
3999
|
}
|
|
3976
4000
|
StandardShaderSource.getSourceCode = getSourceCode;
|
|
3977
4001
|
})(StandardShaderSource || (StandardShaderSource = {}));
|
|
@@ -4249,7 +4273,7 @@ function getQuadFilterVS() {
|
|
|
4249
4273
|
if (func !== undefined) {
|
|
4250
4274
|
return func(context);
|
|
4251
4275
|
} else {
|
|
4252
|
-
throw new Error("Invalid material type " + materialType + ", shader content " + context);
|
|
4276
|
+
throw new Error("Invalid material type " + materialType + ", shader content " + context + ".");
|
|
4253
4277
|
}
|
|
4254
4278
|
};
|
|
4255
4279
|
/**
|
|
@@ -4377,12 +4401,12 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
4377
4401
|
var bounding = _this.bounding;
|
|
4378
4402
|
if (bounding && (force || Number.isInteger(bounding.behavior))) {
|
|
4379
4403
|
var type = bounding.type;
|
|
4380
|
-
if (type ===
|
|
4404
|
+
if (type === EFFECTS.spec.ModelBoundingType.box) {
|
|
4381
4405
|
if (_instanceof1(_this.content, PMesh)) {
|
|
4382
4406
|
var mesh = _this.content;
|
|
4383
4407
|
var customHitTest = {
|
|
4384
4408
|
behavior: bounding.behavior,
|
|
4385
|
-
type:
|
|
4409
|
+
type: EFFECTS.HitTestType.custom,
|
|
4386
4410
|
collect: function collect(ray, pointInCanvas) {
|
|
4387
4411
|
var result = mesh.hitTesting(ray.origin, ray.direction);
|
|
4388
4412
|
return result;
|
|
@@ -4393,7 +4417,7 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
4393
4417
|
var worldMatrixData = _this.transform.getWorldMatrix();
|
|
4394
4418
|
var customHitTest1 = {
|
|
4395
4419
|
behavior: bounding.behavior,
|
|
4396
|
-
type:
|
|
4420
|
+
type: EFFECTS.HitTestType.custom,
|
|
4397
4421
|
collect: function collect(ray, pointInCanvas) {
|
|
4398
4422
|
var result = RayIntersectsBoxWithRotation(ray, worldMatrixData, bounding);
|
|
4399
4423
|
return result;
|
|
@@ -4401,7 +4425,7 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
4401
4425
|
};
|
|
4402
4426
|
return customHitTest1;
|
|
4403
4427
|
}
|
|
4404
|
-
} else if (type ===
|
|
4428
|
+
} else if (type === EFFECTS.spec.ModelBoundingType.sphere) {
|
|
4405
4429
|
var pos = new Vector3();
|
|
4406
4430
|
_this.transform.assignWorldTRS(pos);
|
|
4407
4431
|
var center = new Vector3();
|
|
@@ -4508,7 +4532,7 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
4508
4532
|
var size = bbox.getSize(new Vector3());
|
|
4509
4533
|
this.bounding = {
|
|
4510
4534
|
behavior: (_this_bounding = this.bounding) == null ? void 0 : _this_bounding.behavior,
|
|
4511
|
-
type:
|
|
4535
|
+
type: EFFECTS.spec.ModelBoundingType.box,
|
|
4512
4536
|
center: [
|
|
4513
4537
|
center.x,
|
|
4514
4538
|
center.y,
|
|
@@ -4526,9 +4550,9 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
4526
4550
|
}
|
|
4527
4551
|
};
|
|
4528
4552
|
return ModelMeshComponent;
|
|
4529
|
-
}(
|
|
4553
|
+
}(EFFECTS.RendererComponent);
|
|
4530
4554
|
exports.ModelMeshComponent = __decorate([
|
|
4531
|
-
|
|
4555
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.MeshComponent)
|
|
4532
4556
|
], exports.ModelMeshComponent);
|
|
4533
4557
|
exports.ModelSkyboxComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
4534
4558
|
_inherits(ModelSkyboxComponent, RendererComponent);
|
|
@@ -4600,9 +4624,9 @@ exports.ModelSkyboxComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
4600
4624
|
return (_this_content_visible = (_this_content = this.content) == null ? void 0 : _this_content.visible) != null ? _this_content_visible : false;
|
|
4601
4625
|
};
|
|
4602
4626
|
return ModelSkyboxComponent;
|
|
4603
|
-
}(
|
|
4627
|
+
}(EFFECTS.RendererComponent);
|
|
4604
4628
|
exports.ModelSkyboxComponent = __decorate([
|
|
4605
|
-
|
|
4629
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.SkyboxComponent)
|
|
4606
4630
|
], exports.ModelSkyboxComponent);
|
|
4607
4631
|
exports.ModelLightComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
4608
4632
|
_inherits(ModelLightComponent, ItemBehaviour);
|
|
@@ -4665,9 +4689,9 @@ exports.ModelLightComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
4665
4689
|
return (_this_content_visible = (_this_content = this.content) == null ? void 0 : _this_content.visible) != null ? _this_content_visible : false;
|
|
4666
4690
|
};
|
|
4667
4691
|
return ModelLightComponent;
|
|
4668
|
-
}(
|
|
4692
|
+
}(EFFECTS.ItemBehaviour);
|
|
4669
4693
|
exports.ModelLightComponent = __decorate([
|
|
4670
|
-
|
|
4694
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.LightComponent)
|
|
4671
4695
|
], exports.ModelLightComponent);
|
|
4672
4696
|
exports.ModelCameraComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
4673
4697
|
_inherits(ModelCameraComponent, ItemBehaviour);
|
|
@@ -4699,7 +4723,8 @@ exports.ModelCameraComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
4699
4723
|
/**
|
|
4700
4724
|
* 组件销毁
|
|
4701
4725
|
*/ _proto.onDestroy = function onDestroy() {
|
|
4702
|
-
|
|
4726
|
+
var _this_content;
|
|
4727
|
+
(_this_content = this.content) == null ? void 0 : _this_content.dispose();
|
|
4703
4728
|
};
|
|
4704
4729
|
/**
|
|
4705
4730
|
* 反序列化,记录传入参数
|
|
@@ -4745,9 +4770,9 @@ exports.ModelCameraComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
4745
4770
|
this.updateMainCamera();
|
|
4746
4771
|
};
|
|
4747
4772
|
return ModelCameraComponent;
|
|
4748
|
-
}(
|
|
4773
|
+
}(EFFECTS.ItemBehaviour);
|
|
4749
4774
|
exports.ModelCameraComponent = __decorate([
|
|
4750
|
-
|
|
4775
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.CameraComponent)
|
|
4751
4776
|
], exports.ModelCameraComponent);
|
|
4752
4777
|
exports.AnimationComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
4753
4778
|
_inherits(AnimationComponent, ItemBehaviour);
|
|
@@ -4798,9 +4823,9 @@ exports.AnimationComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
4798
4823
|
});
|
|
4799
4824
|
};
|
|
4800
4825
|
return AnimationComponent;
|
|
4801
|
-
}(
|
|
4826
|
+
}(EFFECTS.ItemBehaviour);
|
|
4802
4827
|
exports.AnimationComponent = __decorate([
|
|
4803
|
-
|
|
4828
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.AnimationComponent)
|
|
4804
4829
|
], exports.AnimationComponent);
|
|
4805
4830
|
var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
|
|
4806
4831
|
_inherits(ModelAnimationClip, AnimationClip);
|
|
@@ -4816,29 +4841,25 @@ var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
|
|
|
4816
4841
|
var life = Math.max(0, time) % duration;
|
|
4817
4842
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.positionCurves), _step; !(_step = _iterator()).done;){
|
|
4818
4843
|
var curve = _step.value;
|
|
4819
|
-
var
|
|
4820
|
-
var value = curve.keyFrames.getValue(life % maxTime);
|
|
4844
|
+
var value = curve.keyFrames.getValue(life % this.duration);
|
|
4821
4845
|
var target = this.getTargetItem(vfxItem, curve.path);
|
|
4822
4846
|
target == null ? void 0 : target.transform.setPosition(value.x, value.y, value.z);
|
|
4823
4847
|
}
|
|
4824
4848
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.rotationCurves), _step1; !(_step1 = _iterator1()).done;){
|
|
4825
4849
|
var curve1 = _step1.value;
|
|
4826
|
-
var
|
|
4827
|
-
var value1 = curve1.keyFrames.getValue(life % maxTime1);
|
|
4850
|
+
var value1 = curve1.keyFrames.getValue(life % this.duration);
|
|
4828
4851
|
var target1 = this.getTargetItem(vfxItem, curve1.path);
|
|
4829
4852
|
target1 == null ? void 0 : target1.transform.setQuaternion(value1.x, value1.y, value1.z, value1.w);
|
|
4830
4853
|
}
|
|
4831
4854
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(this.scaleCurves), _step2; !(_step2 = _iterator2()).done;){
|
|
4832
4855
|
var curve2 = _step2.value;
|
|
4833
|
-
var
|
|
4834
|
-
var value2 = curve2.keyFrames.getValue(life % maxTime2);
|
|
4856
|
+
var value2 = curve2.keyFrames.getValue(life % this.duration);
|
|
4835
4857
|
var target2 = this.getTargetItem(vfxItem, curve2.path);
|
|
4836
4858
|
target2 == null ? void 0 : target2.transform.setScale(value2.x, value2.y, value2.z);
|
|
4837
4859
|
}
|
|
4838
4860
|
for(var _iterator3 = _create_for_of_iterator_helper_loose(this.floatCurves), _step3; !(_step3 = _iterator3()).done;){
|
|
4839
4861
|
var curve3 = _step3.value;
|
|
4840
|
-
var
|
|
4841
|
-
var value3 = curve3.keyFrames.getValue(life % maxTime3);
|
|
4862
|
+
var value3 = curve3.keyFrames.getValue(life % this.duration);
|
|
4842
4863
|
var target3 = this.getTargetItem(vfxItem, curve3.path);
|
|
4843
4864
|
if (curve3.className === "ModelMeshComponent") {
|
|
4844
4865
|
var component = target3 == null ? void 0 : target3.getComponent(exports.ModelMeshComponent);
|
|
@@ -4846,14 +4867,15 @@ var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
|
|
|
4846
4867
|
var properties = curve3.property.split(".");
|
|
4847
4868
|
setProperty(component, properties, value3);
|
|
4848
4869
|
} else {
|
|
4849
|
-
console.error("Can't find mesh component");
|
|
4870
|
+
console.error("Can't find mesh component.");
|
|
4850
4871
|
}
|
|
4851
4872
|
} else {
|
|
4852
|
-
console.warn("Ignore curve: className " + curve3.className);
|
|
4873
|
+
console.warn("Ignore curve: className " + curve3.className + ".");
|
|
4853
4874
|
}
|
|
4854
4875
|
}
|
|
4855
4876
|
};
|
|
4856
4877
|
_proto.setFromAnimationClip = function setFromAnimationClip(clip) {
|
|
4878
|
+
this.duration = clip.duration;
|
|
4857
4879
|
this.positionCurves = clip.positionCurves.slice();
|
|
4858
4880
|
this.rotationCurves = clip.rotationCurves.slice();
|
|
4859
4881
|
this.scaleCurves = clip.scaleCurves.slice();
|
|
@@ -4877,21 +4899,21 @@ var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
|
|
|
4877
4899
|
}
|
|
4878
4900
|
}
|
|
4879
4901
|
if (!findTag) {
|
|
4880
|
-
throw new Error("Can't find path in tree " + rootItem.id + ", " + path);
|
|
4902
|
+
throw new Error("Can't find path in tree " + rootItem.id + ", " + path + ".");
|
|
4881
4903
|
}
|
|
4882
4904
|
}
|
|
4883
4905
|
this.path2Node[path] = target;
|
|
4884
4906
|
return target;
|
|
4885
4907
|
};
|
|
4886
4908
|
return ModelAnimationClip;
|
|
4887
|
-
}(
|
|
4909
|
+
}(EFFECTS.AnimationClip);
|
|
4888
4910
|
function setProperty(obj, properties, value) {
|
|
4889
4911
|
var len = properties.length;
|
|
4890
4912
|
var current = obj;
|
|
4891
4913
|
for(var i = 0; i < len - 1; i++){
|
|
4892
4914
|
var propName = properties[i];
|
|
4893
4915
|
if (!(propName in current) || typeof current[propName] !== "object") {
|
|
4894
|
-
console.error("Invalid properties " + properties);
|
|
4916
|
+
console.error("Invalid properties " + properties + ".");
|
|
4895
4917
|
return;
|
|
4896
4918
|
}
|
|
4897
4919
|
current = current[propName];
|
|
@@ -5134,13 +5156,13 @@ var normal = new Vector3();
|
|
|
5134
5156
|
var blob, urlCreator, imageUrl, imageObj;
|
|
5135
5157
|
return __generator(this, function(_state) {
|
|
5136
5158
|
if (image.imageData === undefined) {
|
|
5137
|
-
console.error("createTexture2D: Invalid image data from " + image);
|
|
5159
|
+
console.error("createTexture2D: Invalid image data from " + image + ".");
|
|
5138
5160
|
// 这里不应该发生的,做个兜底
|
|
5139
5161
|
return [
|
|
5140
5162
|
2,
|
|
5141
|
-
|
|
5163
|
+
EFFECTS.Texture.create(engine, {
|
|
5142
5164
|
name: "createTexture2D",
|
|
5143
|
-
sourceType:
|
|
5165
|
+
sourceType: EFFECTS.TextureSourceType.data,
|
|
5144
5166
|
data: {
|
|
5145
5167
|
data: new Uint8Array([
|
|
5146
5168
|
255,
|
|
@@ -5168,34 +5190,34 @@ var normal = new Vector3();
|
|
|
5168
5190
|
new Promise(function(resolve, reject) {
|
|
5169
5191
|
imageObj.onload = function() {
|
|
5170
5192
|
var _texture_minFilter;
|
|
5171
|
-
var minFilter = (_texture_minFilter = texture.minFilter) != null ? _texture_minFilter :
|
|
5193
|
+
var minFilter = (_texture_minFilter = texture.minFilter) != null ? _texture_minFilter : EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
|
|
5172
5194
|
var premultiplyAlpha = false;
|
|
5173
5195
|
if (tiny3dMode) {
|
|
5174
5196
|
//if (minFilter === glContext.NEAREST_MIPMAP_LINEAR
|
|
5175
5197
|
// || minFilter === glContext.LINEAR_MIPMAP_NEAREST) {
|
|
5176
|
-
minFilter =
|
|
5198
|
+
minFilter = EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
|
|
5177
5199
|
//}
|
|
5178
5200
|
if (!WebGLHelper.isPow2(imageObj.width) || !WebGLHelper.isPow2(imageObj.height)) {
|
|
5179
|
-
minFilter =
|
|
5201
|
+
minFilter = EFFECTS.glContext.LINEAR;
|
|
5180
5202
|
}
|
|
5181
5203
|
//
|
|
5182
5204
|
premultiplyAlpha = isBaseColor ? false : true;
|
|
5183
5205
|
}
|
|
5184
5206
|
var generateMipmap = false;
|
|
5185
|
-
if (minFilter ==
|
|
5207
|
+
if (minFilter == EFFECTS.glContext.NEAREST_MIPMAP_NEAREST || minFilter == EFFECTS.glContext.LINEAR_MIPMAP_NEAREST || minFilter == EFFECTS.glContext.NEAREST_MIPMAP_LINEAR || minFilter == EFFECTS.glContext.LINEAR_MIPMAP_LINEAR) {
|
|
5186
5208
|
generateMipmap = true;
|
|
5187
5209
|
}
|
|
5188
5210
|
var _texture_wrapS, _texture_wrapT, _texture_magFilter;
|
|
5189
|
-
var res =
|
|
5211
|
+
var res = EFFECTS.Texture.create(engine, {
|
|
5190
5212
|
name: "createTexture2D",
|
|
5191
|
-
wrapS: (_texture_wrapS = texture.wrapS) != null ? _texture_wrapS :
|
|
5192
|
-
wrapT: (_texture_wrapT = texture.wrapT) != null ? _texture_wrapT :
|
|
5193
|
-
magFilter: (_texture_magFilter = texture.magFilter) != null ? _texture_magFilter :
|
|
5213
|
+
wrapS: (_texture_wrapS = texture.wrapS) != null ? _texture_wrapS : EFFECTS.glContext.REPEAT,
|
|
5214
|
+
wrapT: (_texture_wrapT = texture.wrapT) != null ? _texture_wrapT : EFFECTS.glContext.REPEAT,
|
|
5215
|
+
magFilter: (_texture_magFilter = texture.magFilter) != null ? _texture_magFilter : EFFECTS.glContext.LINEAR,
|
|
5194
5216
|
minFilter: minFilter,
|
|
5195
5217
|
anisotropic: 1,
|
|
5196
5218
|
//flipY: tex.flipY,
|
|
5197
5219
|
premultiplyAlpha: premultiplyAlpha,
|
|
5198
|
-
sourceType:
|
|
5220
|
+
sourceType: EFFECTS.TextureSourceType.image,
|
|
5199
5221
|
image: imageObj,
|
|
5200
5222
|
generateMipmap: generateMipmap
|
|
5201
5223
|
});
|
|
@@ -5361,9 +5383,9 @@ var normal = new Vector3();
|
|
|
5361
5383
|
case 0:
|
|
5362
5384
|
return [
|
|
5363
5385
|
4,
|
|
5364
|
-
|
|
5365
|
-
type:
|
|
5366
|
-
target:
|
|
5386
|
+
EFFECTS.getDefaultTextureFactory().loadSource({
|
|
5387
|
+
type: EFFECTS.TextureSourceType.image,
|
|
5388
|
+
target: EFFECTS.glContext.TEXTURE_CUBE_MAP,
|
|
5367
5389
|
map: cubeImage
|
|
5368
5390
|
}, _this.cubemapTexConfig)
|
|
5369
5391
|
];
|
|
@@ -5371,7 +5393,7 @@ var normal = new Vector3();
|
|
|
5371
5393
|
textureOptions = _state.sent();
|
|
5372
5394
|
return [
|
|
5373
5395
|
2,
|
|
5374
|
-
|
|
5396
|
+
EFFECTS.Texture.create(engine, textureOptions)
|
|
5375
5397
|
];
|
|
5376
5398
|
}
|
|
5377
5399
|
});
|
|
@@ -5391,9 +5413,9 @@ var normal = new Vector3();
|
|
|
5391
5413
|
case 0:
|
|
5392
5414
|
return [
|
|
5393
5415
|
4,
|
|
5394
|
-
|
|
5395
|
-
type:
|
|
5396
|
-
target:
|
|
5416
|
+
EFFECTS.getDefaultTextureFactory().loadSource({
|
|
5417
|
+
type: EFFECTS.TextureSourceType.mipmaps,
|
|
5418
|
+
target: EFFECTS.glContext.TEXTURE_CUBE_MAP,
|
|
5397
5419
|
maps: cubeImages
|
|
5398
5420
|
}, _this.cubemapMipTexConfig)
|
|
5399
5421
|
];
|
|
@@ -5401,7 +5423,7 @@ var normal = new Vector3();
|
|
|
5401
5423
|
textureOptions = _state.sent();
|
|
5402
5424
|
return [
|
|
5403
5425
|
2,
|
|
5404
|
-
|
|
5426
|
+
EFFECTS.Texture.create(engine, textureOptions)
|
|
5405
5427
|
];
|
|
5406
5428
|
}
|
|
5407
5429
|
});
|
|
@@ -5427,11 +5449,11 @@ var normal = new Vector3();
|
|
|
5427
5449
|
cubemap = _state.sent();
|
|
5428
5450
|
return [
|
|
5429
5451
|
2,
|
|
5430
|
-
|
|
5452
|
+
EFFECTS.Texture.create(engine, _extends({
|
|
5431
5453
|
name: "createTextureCubeFromBuffer",
|
|
5432
|
-
sourceType:
|
|
5454
|
+
sourceType: EFFECTS.TextureSourceType.image,
|
|
5433
5455
|
cube: cubemap,
|
|
5434
|
-
target:
|
|
5456
|
+
target: EFFECTS.glContext.TEXTURE_CUBE_MAP
|
|
5435
5457
|
}, _this.cubemapTexConfig))
|
|
5436
5458
|
];
|
|
5437
5459
|
}
|
|
@@ -5472,7 +5494,7 @@ var normal = new Vector3();
|
|
|
5472
5494
|
url = "https://gw.alipayobjects.com/zos/gltf-asset/67896749597915/img" + index + ".png";
|
|
5473
5495
|
return [
|
|
5474
5496
|
4,
|
|
5475
|
-
|
|
5497
|
+
EFFECTS.loadImage(url)
|
|
5476
5498
|
];
|
|
5477
5499
|
case 3:
|
|
5478
5500
|
imageData = _state.sent();
|
|
@@ -5491,11 +5513,11 @@ var normal = new Vector3();
|
|
|
5491
5513
|
case 4:
|
|
5492
5514
|
return [
|
|
5493
5515
|
2,
|
|
5494
|
-
|
|
5516
|
+
EFFECTS.Texture.create(engine, _extends({
|
|
5495
5517
|
name: "createTextureCubeMipmapFromBuffer",
|
|
5496
|
-
sourceType:
|
|
5518
|
+
sourceType: EFFECTS.TextureSourceType.mipmaps,
|
|
5497
5519
|
mipmaps: mipmaps,
|
|
5498
|
-
target:
|
|
5520
|
+
target: EFFECTS.glContext.TEXTURE_CUBE_MAP
|
|
5499
5521
|
}, _this.cubemapMipTexConfig))
|
|
5500
5522
|
];
|
|
5501
5523
|
}
|
|
@@ -5523,14 +5545,14 @@ var normal = new Vector3();
|
|
|
5523
5545
|
var options = {
|
|
5524
5546
|
name: "createTextureFromImage",
|
|
5525
5547
|
image: image,
|
|
5526
|
-
sourceType:
|
|
5548
|
+
sourceType: EFFECTS.TextureSourceType.image,
|
|
5527
5549
|
flipY: false,
|
|
5528
|
-
magFilter:
|
|
5529
|
-
minFilter:
|
|
5530
|
-
wrapT:
|
|
5531
|
-
wrapS:
|
|
5550
|
+
magFilter: EFFECTS.glContext.LINEAR,
|
|
5551
|
+
minFilter: EFFECTS.glContext.LINEAR,
|
|
5552
|
+
wrapT: EFFECTS.glContext.REPEAT,
|
|
5553
|
+
wrapS: EFFECTS.glContext.REPEAT
|
|
5532
5554
|
};
|
|
5533
|
-
return
|
|
5555
|
+
return EFFECTS.Texture.create(engine, options);
|
|
5534
5556
|
};
|
|
5535
5557
|
/**
|
|
5536
5558
|
* 创建渲染 Pass
|
|
@@ -5541,10 +5563,10 @@ var normal = new Vector3();
|
|
|
5541
5563
|
* @param fboOpts - FBO 参数
|
|
5542
5564
|
* @returns
|
|
5543
5565
|
*/ WebGLHelper.createRenderPass = function createRenderPass(renderer, name, priority, meshData, fboOpts) {
|
|
5544
|
-
var meshList = _instanceof1(meshData,
|
|
5566
|
+
var meshList = _instanceof1(meshData, EFFECTS.Mesh) ? [
|
|
5545
5567
|
meshData
|
|
5546
5568
|
] : meshData;
|
|
5547
|
-
return new
|
|
5569
|
+
return new EFFECTS.RenderPass(renderer, {
|
|
5548
5570
|
name: name,
|
|
5549
5571
|
priority: priority,
|
|
5550
5572
|
attachments: fboOpts.colorAttachments,
|
|
@@ -5558,8 +5580,8 @@ var normal = new Vector3();
|
|
|
5558
5580
|
0,
|
|
5559
5581
|
0
|
|
5560
5582
|
],
|
|
5561
|
-
colorAction:
|
|
5562
|
-
depthAction:
|
|
5583
|
+
colorAction: EFFECTS.TextureLoadAction.clear,
|
|
5584
|
+
depthAction: EFFECTS.TextureLoadAction.clear
|
|
5563
5585
|
},
|
|
5564
5586
|
// storeAction: {
|
|
5565
5587
|
// colorAction: TextureStoreAction.store,
|
|
@@ -5579,9 +5601,9 @@ var normal = new Vector3();
|
|
|
5579
5601
|
* @param mesh - Mesh 对象
|
|
5580
5602
|
*/ WebGLHelper.deleteMesh = function deleteMesh(mesh) {
|
|
5581
5603
|
mesh.dispose({
|
|
5582
|
-
geometries:
|
|
5604
|
+
geometries: EFFECTS.DestroyOptions.destroy,
|
|
5583
5605
|
material: {
|
|
5584
|
-
textures:
|
|
5606
|
+
textures: EFFECTS.DestroyOptions.destroy
|
|
5585
5607
|
}
|
|
5586
5608
|
});
|
|
5587
5609
|
};
|
|
@@ -5597,22 +5619,22 @@ var normal = new Vector3();
|
|
|
5597
5619
|
*/ WebGLHelper.deleteRenderPass = function deleteRenderPass(pass) {
|
|
5598
5620
|
pass.dispose({
|
|
5599
5621
|
meshes: {
|
|
5600
|
-
geometries:
|
|
5622
|
+
geometries: EFFECTS.DestroyOptions.destroy,
|
|
5601
5623
|
material: {
|
|
5602
|
-
textures:
|
|
5624
|
+
textures: EFFECTS.DestroyOptions.destroy
|
|
5603
5625
|
}
|
|
5604
5626
|
},
|
|
5605
|
-
depthStencilAttachment:
|
|
5606
|
-
colorAttachment:
|
|
5607
|
-
semantics:
|
|
5627
|
+
depthStencilAttachment: EFFECTS.RenderPassDestroyAttachmentType.force,
|
|
5628
|
+
colorAttachment: EFFECTS.RenderPassDestroyAttachmentType.force,
|
|
5629
|
+
semantics: EFFECTS.DestroyOptions.destroy
|
|
5608
5630
|
});
|
|
5609
5631
|
};
|
|
5610
5632
|
/**
|
|
5611
5633
|
* 返回 Mesh 是否半透明
|
|
5612
|
-
* @param
|
|
5634
|
+
* @param component - ModelMeshComponent 对象
|
|
5613
5635
|
* @return 是否半透明
|
|
5614
|
-
*/ WebGLHelper.isTransparentMesh = function isTransparentMesh(
|
|
5615
|
-
return
|
|
5636
|
+
*/ WebGLHelper.isTransparentMesh = function isTransparentMesh(component) {
|
|
5637
|
+
return component.material.blending === true;
|
|
5616
5638
|
};
|
|
5617
5639
|
/**
|
|
5618
5640
|
* renderer 是否支持 Float 纹理
|
|
@@ -5642,18 +5664,18 @@ var normal = new Vector3();
|
|
|
5642
5664
|
* 立方体纹理参数
|
|
5643
5665
|
*/ WebGLHelper.cubemapTexConfig = {
|
|
5644
5666
|
name: "cubemap texture",
|
|
5645
|
-
wrapS:
|
|
5646
|
-
wrapT:
|
|
5647
|
-
magFilter:
|
|
5648
|
-
minFilter:
|
|
5667
|
+
wrapS: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
5668
|
+
wrapT: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
5669
|
+
magFilter: EFFECTS.glContext.LINEAR,
|
|
5670
|
+
minFilter: EFFECTS.glContext.LINEAR
|
|
5649
5671
|
};
|
|
5650
5672
|
/**
|
|
5651
5673
|
* 立方体纹理参数,带 Mipmap 滤波
|
|
5652
5674
|
*/ WebGLHelper.cubemapMipTexConfig = {
|
|
5653
|
-
wrapS:
|
|
5654
|
-
wrapT:
|
|
5655
|
-
magFilter:
|
|
5656
|
-
minFilter:
|
|
5675
|
+
wrapS: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
5676
|
+
wrapT: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
5677
|
+
magFilter: EFFECTS.glContext.LINEAR,
|
|
5678
|
+
minFilter: EFFECTS.glContext.LINEAR_MIPMAP_LINEAR
|
|
5657
5679
|
};
|
|
5658
5680
|
/**
|
|
5659
5681
|
* Mesh 辅助类,负责 Mesh 相关的基础对象创建
|
|
@@ -5670,19 +5692,19 @@ var normal = new Vector3();
|
|
|
5670
5692
|
var globalState = PGlobalState.getInstance();
|
|
5671
5693
|
var vertexShader = material.vertexShaderCode;
|
|
5672
5694
|
var fragmentShader = material.fragmentShaderCode;
|
|
5673
|
-
var geometry =
|
|
5695
|
+
var geometry = EFFECTS.Geometry.create(engine, MeshHelper.getPlaneGeometry());
|
|
5674
5696
|
var isWebGL2 = engine.gpuCapability.level === 2;
|
|
5675
|
-
var effectsMaterial =
|
|
5697
|
+
var effectsMaterial = EFFECTS.Material.create(engine, {
|
|
5676
5698
|
shader: {
|
|
5677
5699
|
vertex: vertexShader,
|
|
5678
5700
|
fragment: fragmentShader,
|
|
5679
5701
|
shared: globalState.shaderShared,
|
|
5680
|
-
glslVersion: isWebGL2 ?
|
|
5702
|
+
glslVersion: isWebGL2 ? EFFECTS.GLSLVersion.GLSL3 : EFFECTS.GLSLVersion.GLSL1
|
|
5681
5703
|
},
|
|
5682
5704
|
uniformSemantics: uniformSemantics
|
|
5683
5705
|
});
|
|
5684
5706
|
material.setMaterialStates(effectsMaterial);
|
|
5685
|
-
return
|
|
5707
|
+
return EFFECTS.Mesh.create(engine, {
|
|
5686
5708
|
name: name,
|
|
5687
5709
|
worldMatrix: Matrix4.fromIdentity(),
|
|
5688
5710
|
material: effectsMaterial,
|
|
@@ -5697,21 +5719,21 @@ var normal = new Vector3();
|
|
|
5697
5719
|
return {
|
|
5698
5720
|
attributes: {
|
|
5699
5721
|
aPos: {
|
|
5700
|
-
type:
|
|
5722
|
+
type: EFFECTS.glContext.FLOAT,
|
|
5701
5723
|
size: 3,
|
|
5702
5724
|
data: data,
|
|
5703
5725
|
stride: Float32Array.BYTES_PER_ELEMENT * 8,
|
|
5704
5726
|
offset: 0
|
|
5705
5727
|
},
|
|
5706
5728
|
aUV: {
|
|
5707
|
-
type:
|
|
5729
|
+
type: EFFECTS.glContext.FLOAT,
|
|
5708
5730
|
size: 2,
|
|
5709
5731
|
stride: Float32Array.BYTES_PER_ELEMENT * 8,
|
|
5710
5732
|
offset: Float32Array.BYTES_PER_ELEMENT * 3,
|
|
5711
5733
|
dataSource: "aPos"
|
|
5712
5734
|
},
|
|
5713
5735
|
aNormal: {
|
|
5714
|
-
type:
|
|
5736
|
+
type: EFFECTS.glContext.FLOAT,
|
|
5715
5737
|
size: 3,
|
|
5716
5738
|
stride: Float32Array.BYTES_PER_ELEMENT * 8,
|
|
5717
5739
|
offset: Float32Array.BYTES_PER_ELEMENT * 5,
|
|
@@ -5990,7 +6012,7 @@ var normal = new Vector3();
|
|
|
5990
6012
|
rotationMat.transformPoint(deltaPos);
|
|
5991
6013
|
var newCamPos = deltaPos.clone().add(targetPos);
|
|
5992
6014
|
var viewMatrix = new Matrix4().lookAt(newCamPos, targetPos, new Vector3(0, 1, 0)).invert();
|
|
5993
|
-
var effectsTransform = new
|
|
6015
|
+
var effectsTransform = new EFFECTS.Transform();
|
|
5994
6016
|
effectsTransform.setValid(true);
|
|
5995
6017
|
effectsTransform.cloneFromMatrix(viewMatrix);
|
|
5996
6018
|
return effectsTransform;
|
|
@@ -6004,7 +6026,7 @@ var normal = new Vector3();
|
|
|
6004
6026
|
* @returns 场景信息描述
|
|
6005
6027
|
*/ PluginHelper.preprocessScene = function preprocessScene(scene, runtimeEnv, compatibleMode) {
|
|
6006
6028
|
var _this = this;
|
|
6007
|
-
var deviceEnv = runtimeEnv !==
|
|
6029
|
+
var deviceEnv = runtimeEnv !== EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
|
|
6008
6030
|
var tiny3dMode = compatibleMode === "tiny3d";
|
|
6009
6031
|
// 默认skybox如何处理需要讨论
|
|
6010
6032
|
var jsonScene = scene.jsonScene;
|
|
@@ -6029,7 +6051,7 @@ var normal = new Vector3();
|
|
|
6029
6051
|
_this.preprocessTextureOptions(dataMap, mat.textures["_EmissiveSampler"], false, tiny3dMode);
|
|
6030
6052
|
});
|
|
6031
6053
|
jsonScene.components.forEach(function(comp) {
|
|
6032
|
-
if (comp.dataType ===
|
|
6054
|
+
if (comp.dataType === EFFECTS.spec.DataType.SkyboxComponent) {
|
|
6033
6055
|
loadSkybox = true;
|
|
6034
6056
|
var skybox = comp;
|
|
6035
6057
|
if (skybox.diffuseImage) {
|
|
@@ -6069,29 +6091,36 @@ var normal = new Vector3();
|
|
|
6069
6091
|
if (!texOptions) {
|
|
6070
6092
|
return;
|
|
6071
6093
|
}
|
|
6072
|
-
if (texOptions.target === undefined || texOptions.target ===
|
|
6073
|
-
texOptions.wrapS =
|
|
6074
|
-
texOptions.wrapT =
|
|
6075
|
-
texOptions.magFilter =
|
|
6076
|
-
texOptions.minFilter =
|
|
6077
|
-
texOptions.generateMipmap = true;
|
|
6094
|
+
if (texOptions.target === undefined || texOptions.target === EFFECTS.glContext.TEXTURE_2D) {
|
|
6095
|
+
texOptions.wrapS = EFFECTS.glContext.REPEAT;
|
|
6096
|
+
texOptions.wrapT = EFFECTS.glContext.REPEAT;
|
|
6097
|
+
texOptions.magFilter = EFFECTS.glContext.LINEAR;
|
|
6098
|
+
texOptions.minFilter = EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
|
|
6078
6099
|
if (!isBaseColor) {
|
|
6079
6100
|
texOptions.premultiplyAlpha = true;
|
|
6080
6101
|
}
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6102
|
+
var newOptions = texOptions;
|
|
6103
|
+
newOptions.generateMipmap = true;
|
|
6104
|
+
var image = newOptions.image;
|
|
6105
|
+
if (image && image.width && image.height) {
|
|
6106
|
+
if (!WebGLHelper.isPow2(image.width) || !WebGLHelper.isPow2(image.height)) {
|
|
6107
|
+
texOptions.minFilter = EFFECTS.glContext.LINEAR;
|
|
6108
|
+
}
|
|
6109
|
+
}
|
|
6110
|
+
} else if (texOptions.target === EFFECTS.glContext.TEXTURE_CUBE_MAP) {
|
|
6111
|
+
texOptions.wrapS = EFFECTS.glContext.CLAMP_TO_EDGE;
|
|
6112
|
+
texOptions.wrapT = EFFECTS.glContext.CLAMP_TO_EDGE;
|
|
6084
6113
|
if (texOptions.mipmaps !== undefined) {
|
|
6085
6114
|
if (texOptions.mipmaps.length === 1) {
|
|
6086
|
-
texOptions.magFilter =
|
|
6087
|
-
texOptions.minFilter =
|
|
6115
|
+
texOptions.magFilter = EFFECTS.glContext.LINEAR;
|
|
6116
|
+
texOptions.minFilter = EFFECTS.glContext.LINEAR;
|
|
6088
6117
|
} else {
|
|
6089
|
-
texOptions.magFilter =
|
|
6090
|
-
texOptions.minFilter =
|
|
6118
|
+
texOptions.magFilter = EFFECTS.glContext.LINEAR;
|
|
6119
|
+
texOptions.minFilter = EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
|
|
6091
6120
|
}
|
|
6092
6121
|
} else {
|
|
6093
|
-
texOptions.magFilter =
|
|
6094
|
-
texOptions.minFilter =
|
|
6122
|
+
texOptions.magFilter = EFFECTS.glContext.LINEAR;
|
|
6123
|
+
texOptions.minFilter = EFFECTS.glContext.LINEAR;
|
|
6095
6124
|
}
|
|
6096
6125
|
}
|
|
6097
6126
|
};
|
|
@@ -6121,12 +6150,12 @@ var normal = new Vector3();
|
|
|
6121
6150
|
sceneComp.items.forEach(function(data) {
|
|
6122
6151
|
var itemId = data.id;
|
|
6123
6152
|
var item = composition.getEngine().jsonSceneData[itemId];
|
|
6124
|
-
if (item.type ===
|
|
6153
|
+
if (item.type === EFFECTS.spec.ItemType.mesh) {
|
|
6125
6154
|
var meshItem = item;
|
|
6126
6155
|
var skin = meshItem.content.options.skin;
|
|
6127
6156
|
var primitives = meshItem.content.options.primitives;
|
|
6128
6157
|
primitives.forEach(function(prim, primId) {
|
|
6129
|
-
if (_instanceof1(prim.geometry,
|
|
6158
|
+
if (_instanceof1(prim.geometry, EFFECTS.Geometry)) {
|
|
6130
6159
|
// 可能已经创建,直接返回
|
|
6131
6160
|
return;
|
|
6132
6161
|
}
|
|
@@ -6135,7 +6164,7 @@ var normal = new Vector3();
|
|
|
6135
6164
|
var studioPrim = prim;
|
|
6136
6165
|
studioPrim.geometry = riGeometry;
|
|
6137
6166
|
var material = prim.material;
|
|
6138
|
-
if (material.type ===
|
|
6167
|
+
if (material.type === EFFECTS.spec.MaterialType.pbr) {
|
|
6139
6168
|
var studioMat = studioPrim.material;
|
|
6140
6169
|
studioMat.baseColorTexture = _this.getTextureObj(composition.textures, material.baseColorTexture);
|
|
6141
6170
|
studioMat.metallicRoughnessTexture = _this.getTextureObj(composition.textures, material.metallicRoughnessTexture);
|
|
@@ -6153,10 +6182,10 @@ var normal = new Vector3();
|
|
|
6153
6182
|
if (_instanceof1(inverseBindMatrices, Float32Array)) {
|
|
6154
6183
|
studioSkin.inverseBindMatrices = inverseBindMatrices;
|
|
6155
6184
|
} else {
|
|
6156
|
-
console.error("setupItem3DOptions: Invalid inverseBindMatrices type, " + inverseBindMatrices);
|
|
6185
|
+
console.error("setupItem3DOptions: Invalid inverseBindMatrices type, " + inverseBindMatrices + ".");
|
|
6157
6186
|
}
|
|
6158
6187
|
}
|
|
6159
|
-
} else if (item.type ===
|
|
6188
|
+
} else if (item.type === EFFECTS.spec.ItemType.tree) {
|
|
6160
6189
|
var jsonItem = item;
|
|
6161
6190
|
var studioItem = item;
|
|
6162
6191
|
var jsonAnimations = jsonItem.content.options.tree.animations;
|
|
@@ -6171,24 +6200,24 @@ var normal = new Vector3();
|
|
|
6171
6200
|
if (_instanceof1(inputArray, Float32Array)) {
|
|
6172
6201
|
studioTrack.input = inputArray;
|
|
6173
6202
|
} else {
|
|
6174
|
-
console.error("setupItem3DOptions: Type of inputArray should be float32, " + inputArray);
|
|
6203
|
+
console.error("setupItem3DOptions: Type of inputArray should be float32, " + inputArray + ".");
|
|
6175
6204
|
}
|
|
6176
6205
|
if (_instanceof1(outputArray, Float32Array)) {
|
|
6177
6206
|
studioTrack.output = outputArray;
|
|
6178
6207
|
} else {
|
|
6179
|
-
console.error("setupItem3DOptions: Type of outputArray should be float32, " + outputArray);
|
|
6208
|
+
console.error("setupItem3DOptions: Type of outputArray should be float32, " + outputArray + ".");
|
|
6180
6209
|
}
|
|
6181
6210
|
});
|
|
6182
6211
|
});
|
|
6183
6212
|
}
|
|
6184
|
-
} else if (item.type ===
|
|
6213
|
+
} else if (item.type === EFFECTS.spec.ItemType.skybox) {
|
|
6185
6214
|
var skybox = item;
|
|
6186
6215
|
var studioSkybox = item;
|
|
6187
6216
|
var options = skybox.content.options;
|
|
6188
6217
|
var studioOptions = studioSkybox.content.options;
|
|
6189
6218
|
var specularImage = _this.getTextureObj(composition.textures, options.specularImage);
|
|
6190
6219
|
if (specularImage === undefined) {
|
|
6191
|
-
console.error("setupItem3DOptions: skybox specualrImage is undefined, " + CheckerHelper.stringify(options));
|
|
6220
|
+
console.error("setupItem3DOptions: skybox specualrImage is undefined, " + CheckerHelper.stringify(options) + ".");
|
|
6192
6221
|
}
|
|
6193
6222
|
studioOptions.specularImage = specularImage;
|
|
6194
6223
|
//
|
|
@@ -6216,7 +6245,7 @@ var normal = new Vector3();
|
|
|
6216
6245
|
attributes[name] = attribData;
|
|
6217
6246
|
}
|
|
6218
6247
|
geomOptions.attributes = attributes;
|
|
6219
|
-
return
|
|
6248
|
+
return EFFECTS.Geometry.create(engine, geomOptions);
|
|
6220
6249
|
};
|
|
6221
6250
|
/**
|
|
6222
6251
|
* 索引数组类型转换
|
|
@@ -6232,7 +6261,7 @@ var normal = new Vector3();
|
|
|
6232
6261
|
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
6233
6262
|
return array;
|
|
6234
6263
|
default:
|
|
6235
|
-
console.error("Invalid index attribute type " + type);
|
|
6264
|
+
console.error("Invalid index attribute type " + type + ".");
|
|
6236
6265
|
}
|
|
6237
6266
|
};
|
|
6238
6267
|
/**
|
|
@@ -6260,7 +6289,7 @@ var normal = new Vector3();
|
|
|
6260
6289
|
// aPos, aNormal, aTangent,
|
|
6261
6290
|
// aUV, aUV2, aJoints, aWeights
|
|
6262
6291
|
// aTargetXXX
|
|
6263
|
-
console.warn("Unknown attribute name: " + name);
|
|
6292
|
+
console.warn("Unknown attribute name: " + name + ".");
|
|
6264
6293
|
}
|
|
6265
6294
|
return name;
|
|
6266
6295
|
};
|
|
@@ -6274,7 +6303,7 @@ var normal = new Vector3();
|
|
|
6274
6303
|
return null;
|
|
6275
6304
|
}
|
|
6276
6305
|
if (index < 0 || index >= textures.length) {
|
|
6277
|
-
console.error("Invalid index for textures: " + index + ", " + textures.length);
|
|
6306
|
+
console.error("Invalid index for textures: " + index + ", " + textures.length + ".");
|
|
6278
6307
|
}
|
|
6279
6308
|
return textures[index];
|
|
6280
6309
|
};
|
|
@@ -6324,10 +6353,10 @@ var normal = new Vector3();
|
|
|
6324
6353
|
var canvas = document.createElement("canvas");
|
|
6325
6354
|
canvas.width = 512;
|
|
6326
6355
|
canvas.height = 512;
|
|
6327
|
-
return new
|
|
6356
|
+
return new EFFECTS.Player({
|
|
6328
6357
|
canvas: canvas,
|
|
6329
6358
|
renderFramework: "webgl2",
|
|
6330
|
-
env:
|
|
6359
|
+
env: EFFECTS.PLAYER_OPTIONS_ENV_EDITOR,
|
|
6331
6360
|
renderOptions: {
|
|
6332
6361
|
willCaptureImage: true
|
|
6333
6362
|
},
|
|
@@ -6359,7 +6388,7 @@ var normal = new Vector3();
|
|
|
6359
6388
|
return __generator(this, function(_state) {
|
|
6360
6389
|
return [
|
|
6361
6390
|
2,
|
|
6362
|
-
|
|
6391
|
+
EFFECTS.loadImage(new Blob([
|
|
6363
6392
|
image.imageData
|
|
6364
6393
|
], {
|
|
6365
6394
|
type: image.mimeType
|
|
@@ -6377,7 +6406,7 @@ var normal = new Vector3();
|
|
|
6377
6406
|
return __generator(this, function(_state) {
|
|
6378
6407
|
return [
|
|
6379
6408
|
2,
|
|
6380
|
-
|
|
6409
|
+
EFFECTS.loadImage(new Blob([
|
|
6381
6410
|
image.data
|
|
6382
6411
|
], {
|
|
6383
6412
|
type: image.mimeType
|
|
@@ -6400,7 +6429,7 @@ var normal = new Vector3();
|
|
|
6400
6429
|
if (b) {
|
|
6401
6430
|
resolve(b.arrayBuffer());
|
|
6402
6431
|
} else {
|
|
6403
|
-
reject(new Error("
|
|
6432
|
+
reject(new Error("No canvas blob."));
|
|
6404
6433
|
}
|
|
6405
6434
|
}, "image/png", 1);
|
|
6406
6435
|
})
|
|
@@ -6562,7 +6591,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
6562
6591
|
this.offset = (_inAttrib_offset = inAttrib.offset) != null ? _inAttrib_offset : 0;
|
|
6563
6592
|
if (this.offset > 0) {
|
|
6564
6593
|
if (this.offset % this.typeSize !== 0) {
|
|
6565
|
-
console.error("Invalid offset " + this.offset + ", type size " + this.typeSize);
|
|
6594
|
+
console.error("Invalid offset " + this.offset + ", type size " + this.typeSize + ".");
|
|
6566
6595
|
}
|
|
6567
6596
|
this.offset = this.offset / this.typeSize;
|
|
6568
6597
|
}
|
|
@@ -6571,7 +6600,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
6571
6600
|
this.stride = (_inAttrib_stride = inAttrib.stride) != null ? _inAttrib_stride : 0;
|
|
6572
6601
|
if (this.stride > 0) {
|
|
6573
6602
|
if (this.stride % this.typeSize !== 0) {
|
|
6574
|
-
console.error("Invalid stride " + this.stride + ", type size " + this.typeSize);
|
|
6603
|
+
console.error("Invalid stride " + this.stride + ", type size " + this.typeSize + ".");
|
|
6575
6604
|
}
|
|
6576
6605
|
this.stride = this.stride / this.typeSize;
|
|
6577
6606
|
} else {
|
|
@@ -7082,9 +7111,9 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7082
7111
|
* @param v - 纹理对象
|
|
7083
7112
|
* @returns
|
|
7084
7113
|
*/ CheckerHelper.checkTexture = function checkTexture(v) {
|
|
7085
|
-
if (_instanceof1(v,
|
|
7114
|
+
if (_instanceof1(v, EFFECTS.Texture)) {
|
|
7086
7115
|
if (v.isDestroyed) {
|
|
7087
|
-
console.error("Texture is destroyed, " + v.name);
|
|
7116
|
+
console.error("Texture is destroyed, " + v.name + ".");
|
|
7088
7117
|
}
|
|
7089
7118
|
return !v.isDestroyed;
|
|
7090
7119
|
} else {
|
|
@@ -7132,14 +7161,14 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7132
7161
|
* @param v - 材质混合参数或未定义
|
|
7133
7162
|
* @returns
|
|
7134
7163
|
*/ CheckerHelper.checkMatBlending = function checkMatBlending(v) {
|
|
7135
|
-
return v === undefined || v ===
|
|
7164
|
+
return v === undefined || v === EFFECTS.spec.MaterialBlending.opaque || v === EFFECTS.spec.MaterialBlending.masked || v === EFFECTS.spec.MaterialBlending.translucent || v === EFFECTS.spec.MaterialBlending.additive;
|
|
7136
7165
|
};
|
|
7137
7166
|
/**
|
|
7138
7167
|
* 检查材质单双面模式或未定义
|
|
7139
7168
|
* @param v - 材质单双面模式或未定义
|
|
7140
7169
|
* @returns
|
|
7141
7170
|
*/ CheckerHelper.checkMatSide = function checkMatSide(v) {
|
|
7142
|
-
return v === undefined || v ===
|
|
7171
|
+
return v === undefined || v === EFFECTS.spec.SideMode.BACK || v === EFFECTS.spec.SideMode.DOUBLE || v === EFFECTS.spec.SideMode.FRONT;
|
|
7143
7172
|
};
|
|
7144
7173
|
/**
|
|
7145
7174
|
* 检查动画路径模式
|
|
@@ -7160,15 +7189,15 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7160
7189
|
* @param v - 几何体
|
|
7161
7190
|
* @param s - 蒙皮参数
|
|
7162
7191
|
*/ CheckerHelper.assertGeometry = function assertGeometry(v, s) {
|
|
7163
|
-
if (!_instanceof1(v,
|
|
7164
|
-
console.error("Invalid geometry type " + this.stringify(v));
|
|
7192
|
+
if (!_instanceof1(v, EFFECTS.Geometry)) {
|
|
7193
|
+
console.error("Invalid geometry type " + this.stringify(v) + ".");
|
|
7165
7194
|
}
|
|
7166
7195
|
// @ts-expect-error
|
|
7167
7196
|
if (v.isDestroyed === true) {
|
|
7168
|
-
console.error("Geometry object is destroyed");
|
|
7197
|
+
console.error("Geometry object is destroyed.");
|
|
7169
7198
|
}
|
|
7170
7199
|
if (!this.checkNonnegative(v.getDrawStart())) {
|
|
7171
|
-
console.error("Invalid geometry draw start: " + v.getDrawStart() + ", " + this.stringify(v));
|
|
7200
|
+
console.error("Invalid geometry draw start: " + v.getDrawStart() + ", " + this.stringify(v) + ".");
|
|
7172
7201
|
}
|
|
7173
7202
|
// // drawCount不再为负
|
|
7174
7203
|
// if (!this.checkPositive(v.getDrawCount())) {
|
|
@@ -7227,7 +7256,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7227
7256
|
var attribArray = this.createAttributeArray(v, name);
|
|
7228
7257
|
if (attribArray !== undefined) {
|
|
7229
7258
|
if (attribArray.getLength() < drawCount) {
|
|
7230
|
-
console.error(name + " Length(" + attribArray.getLength() + ") is less than draw count(" + drawCount + "), " + this.stringify(v));
|
|
7259
|
+
console.error(name + " Length(" + attribArray.getLength() + ") is less than draw count(" + drawCount + "), " + this.stringify(v) + ".");
|
|
7231
7260
|
}
|
|
7232
7261
|
}
|
|
7233
7262
|
};
|
|
@@ -7260,24 +7289,24 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7260
7289
|
* @param v - 蒙皮参数
|
|
7261
7290
|
*/ CheckerHelper.assertModelSkinOptions = function assertModelSkinOptions(v) {
|
|
7262
7291
|
if (!this.checkStringUndef(v.name)) {
|
|
7263
|
-
console.error("Invalid skin name " + v.name + ", " + this.stringify(v));
|
|
7292
|
+
console.error("Invalid skin name " + v.name + ", " + this.stringify(v) + ".");
|
|
7264
7293
|
}
|
|
7265
7294
|
if (!this.checkNumberArray(v.joints)) {
|
|
7266
|
-
console.error("Invalid skin joints " + v.joints + ", " + this.stringify(v));
|
|
7295
|
+
console.error("Invalid skin joints " + v.joints + ", " + this.stringify(v) + ".");
|
|
7267
7296
|
}
|
|
7268
7297
|
if (!this.checkNumberUndef(v.skeleton)) {
|
|
7269
|
-
console.error("Invalid skin skeleton " + v.skeleton + ", " + this.stringify(v));
|
|
7298
|
+
console.error("Invalid skin skeleton " + v.skeleton + ", " + this.stringify(v) + ".");
|
|
7270
7299
|
}
|
|
7271
7300
|
if (!this.checkFloat32ArrayUndef(v.inverseBindMatrices)) {
|
|
7272
|
-
console.error("Invalid skin inverseBindMatrices " + v.inverseBindMatrices + ", " + this.stringify(v));
|
|
7301
|
+
console.error("Invalid skin inverseBindMatrices " + v.inverseBindMatrices + ", " + this.stringify(v) + ".");
|
|
7273
7302
|
}
|
|
7274
7303
|
//
|
|
7275
7304
|
if (v.inverseBindMatrices !== undefined) {
|
|
7276
7305
|
if (v.inverseBindMatrices.length <= 0 || v.inverseBindMatrices.length % 16 !== 0) {
|
|
7277
|
-
console.error("Invalid skin inverseBindMatrices length " + v.inverseBindMatrices + ", " + this.stringify(v));
|
|
7306
|
+
console.error("Invalid skin inverseBindMatrices length " + v.inverseBindMatrices + ", " + this.stringify(v) + ".");
|
|
7278
7307
|
}
|
|
7279
7308
|
if (v.joints.length * 16 !== v.inverseBindMatrices.length) {
|
|
7280
|
-
console.error("Mismatch: skin joints and inverseBindMatrices length, " + v.joints + ", " + v.inverseBindMatrices + ", " + this.stringify(v));
|
|
7309
|
+
console.error("Mismatch: skin joints and inverseBindMatrices length, " + v.joints + ", " + v.inverseBindMatrices + ", " + this.stringify(v) + ".");
|
|
7281
7310
|
}
|
|
7282
7311
|
var mat = new Matrix4();
|
|
7283
7312
|
for(var i = 0; i < v.inverseBindMatrices.length; i += 16){
|
|
@@ -7285,12 +7314,12 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7285
7314
|
mat.elements[j] = v.inverseBindMatrices[i + j];
|
|
7286
7315
|
}
|
|
7287
7316
|
if (Math.abs(mat.determinant()) < 1e-5) {
|
|
7288
|
-
console.error("Determinant of inverseBindMatrices is too small " + mat.determinant() + ", index " + i / 16 + ", " + this.stringify(v));
|
|
7317
|
+
console.error("Determinant of inverseBindMatrices is too small " + mat.determinant() + ", index " + i / 16 + ", " + this.stringify(v) + ".");
|
|
7289
7318
|
}
|
|
7290
7319
|
}
|
|
7291
7320
|
} else {
|
|
7292
7321
|
if (v.joints.length <= 0) {
|
|
7293
|
-
console.error("Invalid skin joints length " + v.joints + ", " + this.stringify(v));
|
|
7322
|
+
console.error("Invalid skin joints length " + v.joints + ", " + this.stringify(v) + ".");
|
|
7294
7323
|
}
|
|
7295
7324
|
}
|
|
7296
7325
|
};
|
|
@@ -7298,140 +7327,140 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7298
7327
|
* 检查材质参数
|
|
7299
7328
|
* @param v - 材质参数
|
|
7300
7329
|
*/ CheckerHelper.assertMatOptions = function assertMatOptions(v) {
|
|
7301
|
-
if (v.type ===
|
|
7330
|
+
if (v.type === EFFECTS.spec.MaterialType.unlit) {
|
|
7302
7331
|
if (!this.checkString(v.name)) {
|
|
7303
|
-
console.error("Invalid material name " + v.name + ", " + this.stringify(v));
|
|
7332
|
+
console.error("Invalid material name " + v.name + ", " + this.stringify(v) + ".");
|
|
7304
7333
|
}
|
|
7305
7334
|
//
|
|
7306
7335
|
if (!this.checkNonnegative4(v.baseColorFactor)) {
|
|
7307
|
-
console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v));
|
|
7336
|
+
console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v) + ".");
|
|
7308
7337
|
}
|
|
7309
7338
|
if (!this.checkTextureUndef(v.baseColorTexture)) {
|
|
7310
|
-
console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v));
|
|
7339
|
+
console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v) + ".");
|
|
7311
7340
|
}
|
|
7312
7341
|
if (!this.checkTexTransformUndef(v.baseColorTextureTransform)) {
|
|
7313
|
-
console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v));
|
|
7342
|
+
console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v) + ".");
|
|
7314
7343
|
}
|
|
7315
7344
|
if (!this.checkTexCoord(v.baseColorTextureCoordinate)) {
|
|
7316
|
-
console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v));
|
|
7345
|
+
console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7317
7346
|
}
|
|
7318
7347
|
//
|
|
7319
7348
|
if (!this.checkBooleanUndef(v.depthMask)) {
|
|
7320
|
-
console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v));
|
|
7349
|
+
console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v) + ".");
|
|
7321
7350
|
}
|
|
7322
7351
|
if (!this.checkMatBlending(v.blending)) {
|
|
7323
|
-
console.error("Invalid material blending " + v.blending + ", " + this.stringify(v));
|
|
7352
|
+
console.error("Invalid material blending " + v.blending + ", " + this.stringify(v) + ".");
|
|
7324
7353
|
}
|
|
7325
7354
|
if (!this.checkMatSide(v.side)) {
|
|
7326
|
-
console.error("Invalid material side " + v.side + ", " + this.stringify(v));
|
|
7355
|
+
console.error("Invalid material side " + v.side + ", " + this.stringify(v) + ".");
|
|
7327
7356
|
}
|
|
7328
|
-
if (v.blending ===
|
|
7357
|
+
if (v.blending === EFFECTS.spec.MaterialBlending.masked) {
|
|
7329
7358
|
if (v.alphaCutOff === undefined) {
|
|
7330
|
-
console.error("Material alphaCutOff is required for mask, " + this.stringify(v));
|
|
7359
|
+
console.error("Material alphaCutOff is required for mask, " + this.stringify(v) + ".");
|
|
7331
7360
|
}
|
|
7332
7361
|
}
|
|
7333
7362
|
if (!this.checkNumber01Undef(v.alphaCutOff)) {
|
|
7334
|
-
console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v));
|
|
7363
|
+
console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v) + ".");
|
|
7335
7364
|
}
|
|
7336
|
-
} else if (v.type ===
|
|
7365
|
+
} else if (v.type === EFFECTS.spec.MaterialType.pbr) {
|
|
7337
7366
|
if (!this.checkString(v.name)) {
|
|
7338
|
-
console.error("Invalid material name " + v.name + ", " + this.stringify(v));
|
|
7367
|
+
console.error("Invalid material name " + v.name + ", " + this.stringify(v) + ".");
|
|
7339
7368
|
}
|
|
7340
7369
|
//
|
|
7341
7370
|
if (!this.checkNonnegative4(v.baseColorFactor)) {
|
|
7342
|
-
console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v));
|
|
7371
|
+
console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v) + ".");
|
|
7343
7372
|
}
|
|
7344
7373
|
if (!this.checkTextureUndef(v.baseColorTexture)) {
|
|
7345
|
-
console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v));
|
|
7374
|
+
console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v) + ".");
|
|
7346
7375
|
}
|
|
7347
7376
|
if (!this.checkTexTransformUndef(v.baseColorTextureTransform)) {
|
|
7348
|
-
console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v));
|
|
7377
|
+
console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v) + ".");
|
|
7349
7378
|
}
|
|
7350
7379
|
if (!this.checkTexCoord(v.baseColorTextureCoordinate)) {
|
|
7351
|
-
console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v));
|
|
7380
|
+
console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7352
7381
|
}
|
|
7353
7382
|
//
|
|
7354
7383
|
if (!this.checkBooleanUndef(v.useSpecularAA)) {
|
|
7355
|
-
console.error("Invalid material useSpecularAA " + v.useSpecularAA + ", " + this.stringify(v));
|
|
7384
|
+
console.error("Invalid material useSpecularAA " + v.useSpecularAA + ", " + this.stringify(v) + ".");
|
|
7356
7385
|
}
|
|
7357
7386
|
if (!this.checkNumber01(v.metallicFactor)) {
|
|
7358
|
-
console.error("Invalid material metallicFactor " + v.metallicFactor + ", " + this.stringify(v));
|
|
7387
|
+
console.error("Invalid material metallicFactor " + v.metallicFactor + ", " + this.stringify(v) + ".");
|
|
7359
7388
|
}
|
|
7360
7389
|
if (!this.checkNonnegative(v.roughnessFactor)) {
|
|
7361
|
-
console.error("Invalid material roughnessFactor " + v.roughnessFactor + ", " + this.stringify(v));
|
|
7390
|
+
console.error("Invalid material roughnessFactor " + v.roughnessFactor + ", " + this.stringify(v) + ".");
|
|
7362
7391
|
}
|
|
7363
7392
|
if (!this.checkTextureUndef(v.metallicRoughnessTexture)) {
|
|
7364
|
-
console.error("Invalid material metallicRoughnessTexture " + v.metallicRoughnessTexture + ", " + this.stringify(v));
|
|
7393
|
+
console.error("Invalid material metallicRoughnessTexture " + v.metallicRoughnessTexture + ", " + this.stringify(v) + ".");
|
|
7365
7394
|
}
|
|
7366
7395
|
if (!this.checkTexTransformUndef(v.metallicRoughnessTextureTransform)) {
|
|
7367
|
-
console.error("Invalid material metallicRoughnessTextureTransform " + v.metallicRoughnessTextureTransform + ", " + this.stringify(v));
|
|
7396
|
+
console.error("Invalid material metallicRoughnessTextureTransform " + v.metallicRoughnessTextureTransform + ", " + this.stringify(v) + ".");
|
|
7368
7397
|
}
|
|
7369
7398
|
if (!this.checkTexCoord(v.metallicRoughnessTextureCoordinate)) {
|
|
7370
|
-
console.error("Invalid material metallicRoughnessTextureCoordinate " + v.metallicRoughnessTextureCoordinate + ", " + this.stringify(v));
|
|
7399
|
+
console.error("Invalid material metallicRoughnessTextureCoordinate " + v.metallicRoughnessTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7371
7400
|
}
|
|
7372
7401
|
//
|
|
7373
7402
|
if (!this.checkTextureUndef(v.normalTexture)) {
|
|
7374
|
-
console.error("Invalid material normalTexture " + v.normalTexture + ", " + this.stringify(v));
|
|
7403
|
+
console.error("Invalid material normalTexture " + v.normalTexture + ", " + this.stringify(v) + ".");
|
|
7375
7404
|
}
|
|
7376
7405
|
if (!this.checkNonnegativeUndef(v.normalTextureScale)) {
|
|
7377
|
-
console.error("Invalid material normalTextureScale " + v.normalTextureScale + ", " + this.stringify(v));
|
|
7406
|
+
console.error("Invalid material normalTextureScale " + v.normalTextureScale + ", " + this.stringify(v) + ".");
|
|
7378
7407
|
}
|
|
7379
7408
|
if (!this.checkTexTransformUndef(v.normalTextureTransform)) {
|
|
7380
|
-
console.error("Invalid material normalTextureTransform " + v.normalTextureTransform + ", " + this.stringify(v));
|
|
7409
|
+
console.error("Invalid material normalTextureTransform " + v.normalTextureTransform + ", " + this.stringify(v) + ".");
|
|
7381
7410
|
}
|
|
7382
7411
|
if (!this.checkTexCoord(v.normalTextureCoordinate)) {
|
|
7383
|
-
console.error("Invalid material normalTextureCoordinate " + v.normalTextureCoordinate + ", " + this.stringify(v));
|
|
7412
|
+
console.error("Invalid material normalTextureCoordinate " + v.normalTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7384
7413
|
}
|
|
7385
7414
|
//
|
|
7386
7415
|
if (!this.checkTextureUndef(v.occlusionTexture)) {
|
|
7387
|
-
console.error("Invalid material occlusionTexture " + v.occlusionTexture + ", " + this.stringify(v));
|
|
7416
|
+
console.error("Invalid material occlusionTexture " + v.occlusionTexture + ", " + this.stringify(v) + ".");
|
|
7388
7417
|
}
|
|
7389
7418
|
if (!this.checkNumber01Undef(v.occlusionTextureStrength)) {
|
|
7390
|
-
console.error("Invalid material occlusionTextureStrength " + v.occlusionTextureStrength + ", " + this.stringify(v));
|
|
7419
|
+
console.error("Invalid material occlusionTextureStrength " + v.occlusionTextureStrength + ", " + this.stringify(v) + ".");
|
|
7391
7420
|
}
|
|
7392
7421
|
if (!this.checkTexTransformUndef(v.occlusionTextureTransform)) {
|
|
7393
|
-
console.error("Invalid material occlusionTextureTransform " + v.occlusionTextureTransform + ", " + this.stringify(v));
|
|
7422
|
+
console.error("Invalid material occlusionTextureTransform " + v.occlusionTextureTransform + ", " + this.stringify(v) + ".");
|
|
7394
7423
|
}
|
|
7395
7424
|
if (!this.checkTexCoord(v.occlusionTextureCoordinate)) {
|
|
7396
|
-
console.error("Invalid material occlusionTextureCoordinate " + v.occlusionTextureCoordinate + ", " + this.stringify(v));
|
|
7425
|
+
console.error("Invalid material occlusionTextureCoordinate " + v.occlusionTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7397
7426
|
}
|
|
7398
7427
|
//
|
|
7399
7428
|
//
|
|
7400
7429
|
if (!this.checkNonnegative4(v.emissiveFactor)) {
|
|
7401
|
-
console.error("Invalid material emissiveFactor " + v.emissiveFactor + ", " + this.stringify(v));
|
|
7430
|
+
console.error("Invalid material emissiveFactor " + v.emissiveFactor + ", " + this.stringify(v) + ".");
|
|
7402
7431
|
}
|
|
7403
7432
|
if (!this.checkNonnegative(v.emissiveIntensity)) {
|
|
7404
|
-
console.error("Invalid material emissiveIntensity " + v.emissiveIntensity + ", " + this.stringify(v));
|
|
7433
|
+
console.error("Invalid material emissiveIntensity " + v.emissiveIntensity + ", " + this.stringify(v) + ".");
|
|
7405
7434
|
}
|
|
7406
7435
|
if (!this.checkTextureUndef(v.emissiveTexture)) {
|
|
7407
|
-
console.error("Invalid material emissiveTexture " + v.emissiveTexture + ", " + this.stringify(v));
|
|
7436
|
+
console.error("Invalid material emissiveTexture " + v.emissiveTexture + ", " + this.stringify(v) + ".");
|
|
7408
7437
|
}
|
|
7409
7438
|
if (!this.checkTexTransformUndef(v.emissiveTextureTransform)) {
|
|
7410
|
-
console.error("Invalid material emissiveTextureTransform " + v.emissiveTextureTransform + ", " + this.stringify(v));
|
|
7439
|
+
console.error("Invalid material emissiveTextureTransform " + v.emissiveTextureTransform + ", " + this.stringify(v) + ".");
|
|
7411
7440
|
}
|
|
7412
7441
|
if (!this.checkTexCoord(v.emissiveTextureCoordinate)) {
|
|
7413
|
-
console.error("Invalid material emissiveTextureCoordinate " + v.emissiveTextureCoordinate + ", " + this.stringify(v));
|
|
7442
|
+
console.error("Invalid material emissiveTextureCoordinate " + v.emissiveTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7414
7443
|
}
|
|
7415
7444
|
//
|
|
7416
7445
|
if (!this.checkBooleanUndef(v.depthMask)) {
|
|
7417
|
-
console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v));
|
|
7446
|
+
console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v) + ".");
|
|
7418
7447
|
}
|
|
7419
7448
|
if (!this.checkMatBlending(v.blending)) {
|
|
7420
|
-
console.error("Invalid material blending " + v.blending + ", " + this.stringify(v));
|
|
7449
|
+
console.error("Invalid material blending " + v.blending + ", " + this.stringify(v) + ".");
|
|
7421
7450
|
}
|
|
7422
7451
|
if (!this.checkMatSide(v.side)) {
|
|
7423
|
-
console.error("Invalid material side " + v.side + ", " + this.stringify(v));
|
|
7452
|
+
console.error("Invalid material side " + v.side + ", " + this.stringify(v) + ".");
|
|
7424
7453
|
}
|
|
7425
|
-
if (v.blending ===
|
|
7454
|
+
if (v.blending === EFFECTS.spec.MaterialBlending.masked) {
|
|
7426
7455
|
if (v.alphaCutOff === undefined) {
|
|
7427
|
-
console.error("Material alphaCutOff is required for mask, " + this.stringify(v));
|
|
7456
|
+
console.error("Material alphaCutOff is required for mask, " + this.stringify(v) + ".");
|
|
7428
7457
|
}
|
|
7429
7458
|
}
|
|
7430
7459
|
if (!this.checkNumber01Undef(v.alphaCutOff)) {
|
|
7431
|
-
console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v));
|
|
7460
|
+
console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v) + ".");
|
|
7432
7461
|
}
|
|
7433
7462
|
} else {
|
|
7434
|
-
console.error("Invalid material type " + this.stringify(v));
|
|
7463
|
+
console.error("Invalid material type " + this.stringify(v) + ".");
|
|
7435
7464
|
}
|
|
7436
7465
|
};
|
|
7437
7466
|
/**
|
|
@@ -7449,7 +7478,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7449
7478
|
* @param v - Model 插件 Mesh 参数
|
|
7450
7479
|
*/ CheckerHelper.assertModelMeshOptions = function assertModelMeshOptions(v) {
|
|
7451
7480
|
if (!this.checkParent(v.parent)) {
|
|
7452
|
-
console.error("Invalid mesh parent " + v.parent + ", " + this.stringify(v));
|
|
7481
|
+
console.error("Invalid mesh parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7453
7482
|
}
|
|
7454
7483
|
if (v.skin !== undefined) {
|
|
7455
7484
|
this.assertModelSkinOptions(v.skin);
|
|
@@ -7458,7 +7487,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7458
7487
|
for(var i = 0; i < v.primitives.length; i++){
|
|
7459
7488
|
var prim = v.primitives[i];
|
|
7460
7489
|
if (!this.assertPrimOptions(prim)) {
|
|
7461
|
-
console.error("Invalid primitive " + prim + ", " + this.stringify(v));
|
|
7490
|
+
console.error("Invalid primitive " + prim + ", " + this.stringify(v) + ".");
|
|
7462
7491
|
}
|
|
7463
7492
|
var morph = new PMorph();
|
|
7464
7493
|
morph.create(prim.geometry);
|
|
@@ -7468,11 +7497,11 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7468
7497
|
var morph0 = morphList[i1 - 1];
|
|
7469
7498
|
var morph1 = morphList[i1];
|
|
7470
7499
|
if (!morph0.equals(morph1)) {
|
|
7471
|
-
console.error("Morph states mismatch: " + this.stringify(morph0) + ", " + this.stringify(morph1) + ", " + this.stringify(v));
|
|
7500
|
+
console.error("Morph states mismatch: " + this.stringify(morph0) + ", " + this.stringify(morph1) + ", " + this.stringify(v) + ".");
|
|
7472
7501
|
}
|
|
7473
7502
|
}
|
|
7474
7503
|
if (!this.checkBooleanUndef(v.hide)) {
|
|
7475
|
-
console.error("Invalid mesh hide " + v.hide + ", " + this.stringify(v));
|
|
7504
|
+
console.error("Invalid mesh hide " + v.hide + ", " + this.stringify(v) + ".");
|
|
7476
7505
|
}
|
|
7477
7506
|
};
|
|
7478
7507
|
/**
|
|
@@ -7480,22 +7509,22 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7480
7509
|
* @param v - Model 插件相机参数
|
|
7481
7510
|
*/ CheckerHelper.assertModelCameraOptions = function assertModelCameraOptions(v) {
|
|
7482
7511
|
if (!this.checkParent(v.parent)) {
|
|
7483
|
-
console.error("Invalid camera parent " + v.parent + ", " + this.stringify(v));
|
|
7512
|
+
console.error("Invalid camera parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7484
7513
|
}
|
|
7485
7514
|
if (!this.checkNumberUndef(v.aspect)) {
|
|
7486
|
-
console.error("Invalid camera aspect " + v.aspect + ", " + this.stringify(v));
|
|
7515
|
+
console.error("Invalid camera aspect " + v.aspect + ", " + this.stringify(v) + ".");
|
|
7487
7516
|
}
|
|
7488
7517
|
if (!this.checkPositive(v.near)) {
|
|
7489
|
-
console.error("Invalid camera near " + v.near + ", " + this.stringify(v));
|
|
7518
|
+
console.error("Invalid camera near " + v.near + ", " + this.stringify(v) + ".");
|
|
7490
7519
|
}
|
|
7491
7520
|
if (!this.checkPositive(v.far) || v.far <= v.near) {
|
|
7492
|
-
console.error("Invalid camera far " + v.far + ", " + this.stringify(v));
|
|
7521
|
+
console.error("Invalid camera far " + v.far + ", " + this.stringify(v) + ".");
|
|
7493
7522
|
}
|
|
7494
7523
|
if (!this.checkPositive(v.fov)) {
|
|
7495
|
-
console.error("Invalid camera fov " + v.fov + ", " + this.stringify(v));
|
|
7524
|
+
console.error("Invalid camera fov " + v.fov + ", " + this.stringify(v) + ".");
|
|
7496
7525
|
}
|
|
7497
7526
|
if (!this.checkNumber01(v.clipMode)) {
|
|
7498
|
-
console.error("Invalid camera clipMode " + v.clipMode + ", " + this.stringify(v));
|
|
7527
|
+
console.error("Invalid camera clipMode " + v.clipMode + ", " + this.stringify(v) + ".");
|
|
7499
7528
|
}
|
|
7500
7529
|
};
|
|
7501
7530
|
/**
|
|
@@ -7504,58 +7533,58 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7504
7533
|
*/ CheckerHelper.assertModelLightOptions = function assertModelLightOptions(v) {
|
|
7505
7534
|
if (v.lightType === "directional") {
|
|
7506
7535
|
if (!this.checkParent(v.parent)) {
|
|
7507
|
-
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
|
|
7536
|
+
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7508
7537
|
}
|
|
7509
7538
|
if (!this.checkNonnegative4(v.color)) {
|
|
7510
|
-
console.error("Invalid light color " + v.color + ", " + this.stringify(v));
|
|
7539
|
+
console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
|
|
7511
7540
|
}
|
|
7512
7541
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7513
|
-
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
|
|
7542
|
+
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7514
7543
|
}
|
|
7515
7544
|
} else if (v.lightType === "point") {
|
|
7516
7545
|
if (!this.checkParent(v.parent)) {
|
|
7517
|
-
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
|
|
7546
|
+
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7518
7547
|
}
|
|
7519
7548
|
if (!this.checkNonnegative4(v.color)) {
|
|
7520
|
-
console.error("Invalid light color " + v.color + ", " + this.stringify(v));
|
|
7549
|
+
console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
|
|
7521
7550
|
}
|
|
7522
7551
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7523
|
-
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
|
|
7552
|
+
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7524
7553
|
}
|
|
7525
7554
|
if (!this.checkNonnegative(v.range)) {
|
|
7526
|
-
console.error("Invalid light range " + v.range + ", " + this.stringify(v));
|
|
7555
|
+
console.error("Invalid light range " + v.range + ", " + this.stringify(v) + ".");
|
|
7527
7556
|
}
|
|
7528
7557
|
} else if (v.lightType === "spot") {
|
|
7529
7558
|
if (!this.checkParent(v.parent)) {
|
|
7530
|
-
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
|
|
7559
|
+
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7531
7560
|
}
|
|
7532
7561
|
if (!this.checkNonnegative4(v.color)) {
|
|
7533
|
-
console.error("Invalid light color " + v.color + ", " + this.stringify(v));
|
|
7562
|
+
console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
|
|
7534
7563
|
}
|
|
7535
7564
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7536
|
-
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
|
|
7565
|
+
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7537
7566
|
}
|
|
7538
7567
|
if (!this.checkNonnegative(v.range)) {
|
|
7539
|
-
console.error("Invalid light range " + v.range + ", " + this.stringify(v));
|
|
7568
|
+
console.error("Invalid light range " + v.range + ", " + this.stringify(v) + ".");
|
|
7540
7569
|
}
|
|
7541
7570
|
if (!this.checkNonnegative(v.innerConeAngle)) {
|
|
7542
|
-
console.error("Invalid light innerConeAngle " + v.innerConeAngle + ", " + this.stringify(v));
|
|
7571
|
+
console.error("Invalid light innerConeAngle " + v.innerConeAngle + ", " + this.stringify(v) + ".");
|
|
7543
7572
|
}
|
|
7544
7573
|
if (!this.checkNonnegative(v.outerConeAngle)) {
|
|
7545
|
-
console.error("Invalid light outerConeAngle " + v.outerConeAngle + ", " + this.stringify(v));
|
|
7574
|
+
console.error("Invalid light outerConeAngle " + v.outerConeAngle + ", " + this.stringify(v) + ".");
|
|
7546
7575
|
}
|
|
7547
7576
|
} else if (v.lightType === "ambient") {
|
|
7548
7577
|
if (!this.checkParent(v.parent)) {
|
|
7549
|
-
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
|
|
7578
|
+
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7550
7579
|
}
|
|
7551
7580
|
if (!this.checkNonnegative4(v.color)) {
|
|
7552
|
-
console.error("Invalid light color " + v.color + ", " + this.stringify(v));
|
|
7581
|
+
console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
|
|
7553
7582
|
}
|
|
7554
7583
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7555
|
-
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
|
|
7584
|
+
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7556
7585
|
}
|
|
7557
7586
|
} else {
|
|
7558
|
-
console.error("Invalid light type " + this.stringify(v));
|
|
7587
|
+
console.error("Invalid light type " + this.stringify(v) + ".");
|
|
7559
7588
|
}
|
|
7560
7589
|
};
|
|
7561
7590
|
/**
|
|
@@ -7564,43 +7593,43 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7564
7593
|
*/ CheckerHelper.assertModelSkyboxOptions = function assertModelSkyboxOptions(v) {
|
|
7565
7594
|
var _this = this;
|
|
7566
7595
|
if (!this.checkBoolean(v.renderable)) {
|
|
7567
|
-
console.error("Invalid skybox renderable " + v.renderable + ", " + this.stringify(v));
|
|
7596
|
+
console.error("Invalid skybox renderable " + v.renderable + ", " + this.stringify(v) + ".");
|
|
7568
7597
|
}
|
|
7569
7598
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7570
|
-
console.error("Invalid skybox intensity " + v.intensity + ", " + this.stringify(v));
|
|
7599
|
+
console.error("Invalid skybox intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7571
7600
|
}
|
|
7572
7601
|
if (!this.checkNonnegative(v.reflectionsIntensity)) {
|
|
7573
|
-
console.error("Invalid skybox reflectionsIntensity " + v.reflectionsIntensity + ", " + this.stringify(v));
|
|
7602
|
+
console.error("Invalid skybox reflectionsIntensity " + v.reflectionsIntensity + ", " + this.stringify(v) + ".");
|
|
7574
7603
|
}
|
|
7575
7604
|
//
|
|
7576
7605
|
var c = v.irradianceCoeffs;
|
|
7577
7606
|
if (c !== undefined) {
|
|
7578
7607
|
if (!Array.isArray(c) || c.length != 9) {
|
|
7579
|
-
console.error("Invalid skybox irradianceCoeffs " + c + ", " + this.stringify(v));
|
|
7608
|
+
console.error("Invalid skybox irradianceCoeffs " + c + ", " + this.stringify(v) + ".");
|
|
7580
7609
|
}
|
|
7581
7610
|
c.forEach(function(v) {
|
|
7582
7611
|
if (!_this.checkVec3(v)) {
|
|
7583
|
-
console.error("Invalid skybox irradianceCoeffs " + c + ", " + _this.stringify(v));
|
|
7612
|
+
console.error("Invalid skybox irradianceCoeffs " + c + ", " + _this.stringify(v) + ".");
|
|
7584
7613
|
}
|
|
7585
7614
|
});
|
|
7586
7615
|
} else if (v.diffuseImage !== undefined) {
|
|
7587
7616
|
if (!this.checkTexture(v.diffuseImage)) {
|
|
7588
|
-
console.error("Invalid skybox diffuseImage " + v.diffuseImage + ", " + this.stringify(v));
|
|
7617
|
+
console.error("Invalid skybox diffuseImage " + v.diffuseImage + ", " + this.stringify(v) + ".");
|
|
7589
7618
|
}
|
|
7590
7619
|
} else {
|
|
7591
|
-
console.error("Invalid skybox, irradianceCoeffs or diffuseImage should give one, " + this.stringify(v));
|
|
7620
|
+
console.error("Invalid skybox, irradianceCoeffs or diffuseImage should give one, " + this.stringify(v) + ".");
|
|
7592
7621
|
}
|
|
7593
7622
|
if (!this.checkTexture(v.specularImage)) {
|
|
7594
|
-
console.error("Invalid skybox specularImage " + v.specularImage + ", " + this.stringify(v));
|
|
7623
|
+
console.error("Invalid skybox specularImage " + v.specularImage + ", " + this.stringify(v) + ".");
|
|
7595
7624
|
}
|
|
7596
7625
|
if (!this.checkPositive(v.specularImageSize)) {
|
|
7597
|
-
console.error("Invalid skybox specularImageSize " + v.specularImageSize + ", " + this.stringify(v));
|
|
7626
|
+
console.error("Invalid skybox specularImageSize " + v.specularImageSize + ", " + this.stringify(v) + ".");
|
|
7598
7627
|
}
|
|
7599
7628
|
if (!this.checkPositive(v.specularMipCount)) {
|
|
7600
|
-
console.error("Invalid skybox specularMipCount " + v.specularMipCount + ", " + this.stringify(v));
|
|
7629
|
+
console.error("Invalid skybox specularMipCount " + v.specularMipCount + ", " + this.stringify(v) + ".");
|
|
7601
7630
|
}
|
|
7602
7631
|
if (this.pow2(v.specularMipCount) > v.specularImageSize) {
|
|
7603
|
-
console.error("Invalid skybox specularMipCount or specularImageSize, " + this.stringify(v));
|
|
7632
|
+
console.error("Invalid skybox specularMipCount or specularImageSize, " + this.stringify(v) + ".");
|
|
7604
7633
|
}
|
|
7605
7634
|
};
|
|
7606
7635
|
/**
|
|
@@ -7636,14 +7665,14 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7636
7665
|
*/ CheckerHelper.assertModelAnimOptions = function assertModelAnimOptions(v) {
|
|
7637
7666
|
var _this = this;
|
|
7638
7667
|
if (!this.checkStringUndef(v.name)) {
|
|
7639
|
-
console.error("Invalid animation name " + v.name + ", " + this.stringify(v));
|
|
7668
|
+
console.error("Invalid animation name " + v.name + ", " + this.stringify(v) + ".");
|
|
7640
7669
|
}
|
|
7641
7670
|
if (!Array.isArray(v.tracks)) {
|
|
7642
|
-
console.error("Invalid animation tracks " + v.tracks + ", " + this.stringify(v));
|
|
7671
|
+
console.error("Invalid animation tracks " + v.tracks + ", " + this.stringify(v) + ".");
|
|
7643
7672
|
}
|
|
7644
7673
|
v.tracks.forEach(function(t) {
|
|
7645
7674
|
if (!_this.checkModelAnimTrackOptions(t)) {
|
|
7646
|
-
console.error("Invalid animation track " + t + ", " + _this.stringify(v));
|
|
7675
|
+
console.error("Invalid animation track " + t + ", " + _this.stringify(v) + ".");
|
|
7647
7676
|
}
|
|
7648
7677
|
});
|
|
7649
7678
|
};
|
|
@@ -7653,18 +7682,18 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7653
7682
|
*/ CheckerHelper.assertTreeOptions = function assertTreeOptions(v) {
|
|
7654
7683
|
var _this = this;
|
|
7655
7684
|
if (!this.checkNumberUndef(v.animation)) {
|
|
7656
|
-
console.error("Invalid tree animation " + v.animation + ", " + this.stringify(v));
|
|
7685
|
+
console.error("Invalid tree animation " + v.animation + ", " + this.stringify(v) + ".");
|
|
7657
7686
|
}
|
|
7658
7687
|
if (v.animations !== undefined) {
|
|
7659
7688
|
if (!Array.isArray(v.animations)) {
|
|
7660
|
-
console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v));
|
|
7689
|
+
console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v) + ".");
|
|
7661
7690
|
}
|
|
7662
7691
|
v.animations.forEach(function(anim) {
|
|
7663
7692
|
_this.assertModelAnimOptions(anim);
|
|
7664
7693
|
});
|
|
7665
7694
|
if (v.animation !== undefined) {
|
|
7666
7695
|
if (v.animation < -1 || v.animation >= v.animations.length) {
|
|
7667
|
-
console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v));
|
|
7696
|
+
console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v) + ".");
|
|
7668
7697
|
}
|
|
7669
7698
|
}
|
|
7670
7699
|
}
|
|
@@ -7685,15 +7714,15 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7685
7714
|
if (typeof object[prop] == "function") {
|
|
7686
7715
|
continue;
|
|
7687
7716
|
}
|
|
7688
|
-
if (_instanceof1(object[prop],
|
|
7717
|
+
if (_instanceof1(object[prop], EFFECTS.Texture)) {
|
|
7689
7718
|
simpleObject[prop] = object[prop].name;
|
|
7690
7719
|
continue;
|
|
7691
7720
|
}
|
|
7692
|
-
if (_instanceof1(object[prop],
|
|
7721
|
+
if (_instanceof1(object[prop], EFFECTS.Geometry)) {
|
|
7693
7722
|
simpleObject[prop] = object[prop].name;
|
|
7694
7723
|
continue;
|
|
7695
7724
|
}
|
|
7696
|
-
if (_instanceof1(object[prop],
|
|
7725
|
+
if (_instanceof1(object[prop], EFFECTS.Renderer)) {
|
|
7697
7726
|
continue;
|
|
7698
7727
|
}
|
|
7699
7728
|
simpleObject[prop] = object[prop];
|
|
@@ -7776,18 +7805,6 @@ var toHalf = function() {
|
|
|
7776
7805
|
};
|
|
7777
7806
|
}();
|
|
7778
7807
|
|
|
7779
|
-
exports.RenderType = void 0;
|
|
7780
|
-
(function(RenderType) {
|
|
7781
|
-
RenderType["Opaque"] = "Opaque";
|
|
7782
|
-
RenderType["Mask"] = "Mask";
|
|
7783
|
-
RenderType["Blend"] = "Blend";
|
|
7784
|
-
})(exports.RenderType || (exports.RenderType = {}));
|
|
7785
|
-
exports.CullMode = void 0;
|
|
7786
|
-
(function(CullMode) {
|
|
7787
|
-
CullMode["Front"] = "Front";
|
|
7788
|
-
CullMode["Back"] = "Back";
|
|
7789
|
-
CullMode["Double"] = "Double";
|
|
7790
|
-
})(exports.CullMode || (exports.CullMode = {}));
|
|
7791
7808
|
/**
|
|
7792
7809
|
* 3D 材质基础类,支持公共的材质功能
|
|
7793
7810
|
*/ var PMaterialBase = /*#__PURE__*/ function(PObject) {
|
|
@@ -7812,13 +7829,16 @@ exports.CullMode = void 0;
|
|
|
7812
7829
|
*/ _this.ZTest = true;
|
|
7813
7830
|
/**
|
|
7814
7831
|
* 渲染类型,默认是不透明
|
|
7815
|
-
*/ _this.renderType =
|
|
7832
|
+
*/ _this.renderType = EFFECTS.spec.RenderType.Opaque;
|
|
7833
|
+
/**
|
|
7834
|
+
* 是否 Alpha 裁剪,默认关闭
|
|
7835
|
+
*/ _this.alphaClip = false;
|
|
7816
7836
|
/**
|
|
7817
7837
|
* Alpha 测试截断值
|
|
7818
|
-
*/ _this.
|
|
7838
|
+
*/ _this.alphaCutoff = 0.5;
|
|
7819
7839
|
/**
|
|
7820
7840
|
* 面侧模式,默认是正面
|
|
7821
|
-
*/ _this.
|
|
7841
|
+
*/ _this.renderFace = EFFECTS.spec.RenderFace.Front;
|
|
7822
7842
|
return _this;
|
|
7823
7843
|
}
|
|
7824
7844
|
var _proto = PMaterialBase.prototype;
|
|
@@ -7827,28 +7847,28 @@ exports.CullMode = void 0;
|
|
|
7827
7847
|
* @returns 特性列表
|
|
7828
7848
|
*/ _proto.getShaderFeatures = function getShaderFeatures() {
|
|
7829
7849
|
var featureList = [];
|
|
7830
|
-
if (this.
|
|
7831
|
-
featureList.push("ALPHAMODE_OPAQUE 1");
|
|
7832
|
-
} else if (this.isMasked()) {
|
|
7850
|
+
if (this.isAlphaClip()) {
|
|
7833
7851
|
featureList.push("ALPHAMODE_MASK 1");
|
|
7852
|
+
} else if (this.isOpaque()) {
|
|
7853
|
+
featureList.push("ALPHAMODE_OPAQUE 1");
|
|
7834
7854
|
}
|
|
7835
|
-
if (this.
|
|
7855
|
+
if (this.renderFace === EFFECTS.spec.RenderFace.Both) {
|
|
7836
7856
|
featureList.push("DOUBLE_SIDED 1");
|
|
7837
7857
|
}
|
|
7838
7858
|
return featureList;
|
|
7839
7859
|
};
|
|
7840
7860
|
_proto.getShaderMacros = function getShaderMacros() {
|
|
7841
7861
|
var macroList = [];
|
|
7842
|
-
if (this.
|
|
7862
|
+
if (this.isAlphaClip()) {
|
|
7843
7863
|
macroList.push({
|
|
7844
|
-
name: "
|
|
7864
|
+
name: "ALPHAMODE_MASK"
|
|
7845
7865
|
});
|
|
7846
|
-
} else if (this.
|
|
7866
|
+
} else if (this.isOpaque()) {
|
|
7847
7867
|
macroList.push({
|
|
7848
|
-
name: "
|
|
7868
|
+
name: "ALPHAMODE_OPAQUE"
|
|
7849
7869
|
});
|
|
7850
7870
|
}
|
|
7851
|
-
if (this.
|
|
7871
|
+
if (this.renderFace === EFFECTS.spec.RenderFace.Both) {
|
|
7852
7872
|
macroList.push({
|
|
7853
7873
|
name: "DOUBLE_SIDED"
|
|
7854
7874
|
});
|
|
@@ -7861,7 +7881,7 @@ exports.CullMode = void 0;
|
|
|
7861
7881
|
*/ _proto.updateUniforms = function updateUniforms(material) {
|
|
7862
7882
|
// 渲染 UV 结果输出时,设置 uv 大小
|
|
7863
7883
|
var renderMode = PGlobalState.getInstance().renderMode3D;
|
|
7864
|
-
if (renderMode ===
|
|
7884
|
+
if (renderMode === EFFECTS.spec.RenderMode3D.uv) {
|
|
7865
7885
|
var debugUVGridSize = PGlobalState.getInstance().renderMode3DUVGridSize;
|
|
7866
7886
|
material.setFloat("_DebugUVGridSize", debugUVGridSize);
|
|
7867
7887
|
}
|
|
@@ -7931,19 +7951,19 @@ exports.CullMode = void 0;
|
|
|
7931
7951
|
* 设置材质状态,根据 GE 材质状态
|
|
7932
7952
|
* @param material - GE 材质
|
|
7933
7953
|
*/ _proto.setMaterialStates = function setMaterialStates(material) {
|
|
7934
|
-
if (this.renderType ===
|
|
7954
|
+
if (this.renderType === EFFECTS.spec.RenderType.Transparent) {
|
|
7935
7955
|
material.blending = true;
|
|
7936
7956
|
material.depthTest = this.ZTest;
|
|
7937
7957
|
material.depthMask = this.ZWrite;
|
|
7938
7958
|
material.blendEquation = [
|
|
7939
|
-
|
|
7940
|
-
|
|
7959
|
+
EFFECTS.glContext.FUNC_ADD,
|
|
7960
|
+
EFFECTS.glContext.FUNC_ADD
|
|
7941
7961
|
];
|
|
7942
7962
|
material.blendFunction = [
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7963
|
+
EFFECTS.glContext.ONE,
|
|
7964
|
+
EFFECTS.glContext.ONE_MINUS_SRC_ALPHA,
|
|
7965
|
+
EFFECTS.glContext.ONE,
|
|
7966
|
+
EFFECTS.glContext.ONE_MINUS_SRC_ALPHA
|
|
7947
7967
|
];
|
|
7948
7968
|
} else {
|
|
7949
7969
|
if (PGlobalState.getInstance().isTiny3dMode) {
|
|
@@ -7960,15 +7980,15 @@ exports.CullMode = void 0;
|
|
|
7960
7980
|
this.setFaceSideStates(material);
|
|
7961
7981
|
};
|
|
7962
7982
|
_proto.setFaceSideStates = function setFaceSideStates(material) {
|
|
7963
|
-
if (this.
|
|
7983
|
+
if (this.isBothSide()) {
|
|
7964
7984
|
material.culling = false;
|
|
7965
7985
|
} else if (this.isBackSide()) {
|
|
7966
|
-
material.cullFace =
|
|
7967
|
-
material.frontFace =
|
|
7986
|
+
material.cullFace = EFFECTS.glContext.FRONT;
|
|
7987
|
+
material.frontFace = EFFECTS.glContext.CCW;
|
|
7968
7988
|
material.culling = true;
|
|
7969
7989
|
} else {
|
|
7970
|
-
material.cullFace =
|
|
7971
|
-
material.frontFace =
|
|
7990
|
+
material.cullFace = EFFECTS.glContext.BACK;
|
|
7991
|
+
material.frontFace = EFFECTS.glContext.CCW;
|
|
7972
7992
|
material.culling = true;
|
|
7973
7993
|
}
|
|
7974
7994
|
};
|
|
@@ -7988,37 +8008,37 @@ exports.CullMode = void 0;
|
|
|
7988
8008
|
* 是否不透明
|
|
7989
8009
|
* @returns
|
|
7990
8010
|
*/ _proto.isOpaque = function isOpaque() {
|
|
7991
|
-
return this.renderType ===
|
|
8011
|
+
return this.renderType === EFFECTS.spec.RenderType.Opaque;
|
|
7992
8012
|
};
|
|
7993
8013
|
/**
|
|
7994
|
-
*
|
|
8014
|
+
* 是否 Alpha 裁剪
|
|
7995
8015
|
* @returns
|
|
7996
|
-
*/ _proto.
|
|
7997
|
-
return this.
|
|
8016
|
+
*/ _proto.isAlphaClip = function isAlphaClip() {
|
|
8017
|
+
return this.alphaClip;
|
|
7998
8018
|
};
|
|
7999
8019
|
/**
|
|
8000
8020
|
* 是否半透明
|
|
8001
8021
|
* @returns
|
|
8002
|
-
*/ _proto.
|
|
8003
|
-
return this.renderType ===
|
|
8022
|
+
*/ _proto.isTransparent = function isTransparent() {
|
|
8023
|
+
return this.renderType === EFFECTS.spec.RenderType.Transparent;
|
|
8004
8024
|
};
|
|
8005
8025
|
/**
|
|
8006
8026
|
* 是否正面模式
|
|
8007
8027
|
* @returns
|
|
8008
8028
|
*/ _proto.isFrontSide = function isFrontSide() {
|
|
8009
|
-
return this.
|
|
8029
|
+
return this.renderFace === EFFECTS.spec.RenderFace.Front;
|
|
8010
8030
|
};
|
|
8011
8031
|
/**
|
|
8012
8032
|
* 是否背面模式
|
|
8013
8033
|
* @returns
|
|
8014
8034
|
*/ _proto.isBackSide = function isBackSide() {
|
|
8015
|
-
return this.
|
|
8035
|
+
return this.renderFace === EFFECTS.spec.RenderFace.Back;
|
|
8016
8036
|
};
|
|
8017
8037
|
/**
|
|
8018
8038
|
* 是否双面模式
|
|
8019
8039
|
* @returns
|
|
8020
|
-
*/ _proto.
|
|
8021
|
-
return this.
|
|
8040
|
+
*/ _proto.isBothSide = function isBothSide() {
|
|
8041
|
+
return this.renderFace === EFFECTS.spec.RenderFace.Both;
|
|
8022
8042
|
};
|
|
8023
8043
|
return PMaterialBase;
|
|
8024
8044
|
}(PObject);
|
|
@@ -8050,14 +8070,15 @@ exports.CullMode = void 0;
|
|
|
8050
8070
|
var _material_getColor;
|
|
8051
8071
|
this.baseColorFactor = (_material_getColor = material.getColor("_BaseColorFactor")) != null ? _material_getColor : new Color(1.0, 1.0, 1.0, 1.0);
|
|
8052
8072
|
//
|
|
8053
|
-
this.ZWrite = material.
|
|
8054
|
-
this.ZTest = material.
|
|
8073
|
+
this.ZWrite = material.getFloat("ZWrite") !== 0;
|
|
8074
|
+
this.ZTest = material.getFloat("ZTest") !== 0;
|
|
8055
8075
|
var _material_stringTags_RenderType;
|
|
8056
|
-
this.renderType = (_material_stringTags_RenderType = material.stringTags["RenderType"]) != null ? _material_stringTags_RenderType :
|
|
8076
|
+
this.renderType = (_material_stringTags_RenderType = material.stringTags["RenderType"]) != null ? _material_stringTags_RenderType : EFFECTS.spec.RenderType.Opaque;
|
|
8077
|
+
this.alphaClip = material.getFloat("AlphaClip") === 1;
|
|
8057
8078
|
var _material_getFloat;
|
|
8058
|
-
this.
|
|
8059
|
-
var
|
|
8060
|
-
this.
|
|
8079
|
+
this.alphaCutoff = (_material_getFloat = material.getFloat("_AlphaCutoff")) != null ? _material_getFloat : 0;
|
|
8080
|
+
var _material_stringTags_RenderFace;
|
|
8081
|
+
this.renderFace = (_material_stringTags_RenderFace = material.stringTags["RenderFace"]) != null ? _material_stringTags_RenderFace : EFFECTS.spec.RenderFace.Front;
|
|
8061
8082
|
};
|
|
8062
8083
|
/**
|
|
8063
8084
|
* 销毁材质
|
|
@@ -8225,14 +8246,15 @@ exports.CullMode = void 0;
|
|
|
8225
8246
|
var _material_getFloat4;
|
|
8226
8247
|
this.emissiveIntensity = (_material_getFloat4 = material.getFloat("_EmissiveIntensity")) != null ? _material_getFloat4 : 1;
|
|
8227
8248
|
//
|
|
8228
|
-
this.ZWrite = material.
|
|
8229
|
-
this.ZTest = material.
|
|
8249
|
+
this.ZWrite = material.getFloat("ZWrite") !== 0;
|
|
8250
|
+
this.ZTest = material.getFloat("ZTest") !== 0;
|
|
8230
8251
|
var _material_stringTags_RenderType;
|
|
8231
|
-
this.renderType = (_material_stringTags_RenderType = material.stringTags["RenderType"]) != null ? _material_stringTags_RenderType :
|
|
8252
|
+
this.renderType = (_material_stringTags_RenderType = material.stringTags["RenderType"]) != null ? _material_stringTags_RenderType : EFFECTS.spec.RenderType.Opaque;
|
|
8253
|
+
this.alphaClip = material.getFloat("AlphaClip") === 1;
|
|
8232
8254
|
var _material_getFloat5;
|
|
8233
|
-
this.
|
|
8234
|
-
var
|
|
8235
|
-
this.
|
|
8255
|
+
this.alphaCutoff = (_material_getFloat5 = material.getFloat("_AlphaCutoff")) != null ? _material_getFloat5 : 0;
|
|
8256
|
+
var _material_stringTags_RenderFace;
|
|
8257
|
+
this.renderFace = (_material_stringTags_RenderFace = material.stringTags["RenderFace"]) != null ? _material_stringTags_RenderFace : EFFECTS.spec.RenderFace.Front;
|
|
8236
8258
|
};
|
|
8237
8259
|
/**
|
|
8238
8260
|
* 销毁材质
|
|
@@ -8679,7 +8701,7 @@ exports.CullMode = void 0;
|
|
|
8679
8701
|
if (this.irradianceCoeffs === undefined && this.diffuseImage === undefined) {
|
|
8680
8702
|
return false;
|
|
8681
8703
|
}
|
|
8682
|
-
return this.specularImage !== undefined && this.specularMipCount
|
|
8704
|
+
return this.specularImage !== undefined && this.specularMipCount >= 0;
|
|
8683
8705
|
}
|
|
8684
8706
|
},
|
|
8685
8707
|
{
|
|
@@ -8789,7 +8811,7 @@ exports.CullMode = void 0;
|
|
|
8789
8811
|
} else {
|
|
8790
8812
|
var coeffs = this.irradianceCoeffs;
|
|
8791
8813
|
if (coeffs === undefined || coeffs.length != 9) {
|
|
8792
|
-
throw new Error("Invalid skybox irradiance coeffs " + coeffs);
|
|
8814
|
+
throw new Error("Invalid skybox irradiance coeffs " + coeffs + ".");
|
|
8793
8815
|
}
|
|
8794
8816
|
var aliasName = [
|
|
8795
8817
|
"l00",
|
|
@@ -8806,7 +8828,7 @@ exports.CullMode = void 0;
|
|
|
8806
8828
|
material.setVector3("_shCoefficients." + n, Vector3.fromArray(coeffs[i]));
|
|
8807
8829
|
});
|
|
8808
8830
|
}
|
|
8809
|
-
material.setInt("_MipCount", this.specularMipCount);
|
|
8831
|
+
material.setInt("_MipCount", this.specularMipCount - 1);
|
|
8810
8832
|
material.setTexture("_SpecularEnvSampler", this.specularImage);
|
|
8811
8833
|
};
|
|
8812
8834
|
/**
|
|
@@ -8845,18 +8867,18 @@ exports.PSkyboxType = void 0;
|
|
|
8845
8867
|
];
|
|
8846
8868
|
return [
|
|
8847
8869
|
4,
|
|
8848
|
-
|
|
8870
|
+
EFFECTS.loadImage(imageList[i])
|
|
8849
8871
|
];
|
|
8850
8872
|
case 2:
|
|
8851
8873
|
image = _state.sent();
|
|
8852
8874
|
if (i > 0) {
|
|
8853
8875
|
if (i % 6 === 0) {
|
|
8854
8876
|
if (image.width * 2 !== lastImage.width || image.height * 2 !== lastImage.height) {
|
|
8855
|
-
throw new Error("Invalid cube map list1: index " + i + ", image0 " + lastImage + ", image1 " + image);
|
|
8877
|
+
throw new Error("Invalid cube map list1: index " + i + ", image0 " + lastImage + ", image1 " + image + ".");
|
|
8856
8878
|
}
|
|
8857
8879
|
} else {
|
|
8858
8880
|
if (image.width !== lastImage.width || image.height !== lastImage.height) {
|
|
8859
|
-
throw new Error("Invalid cube map list2: index " + i + ", image0 " + lastImage + ", image1 " + image);
|
|
8881
|
+
throw new Error("Invalid cube map list2: index " + i + ", image0 " + lastImage + ", image1 " + image + ".");
|
|
8860
8882
|
}
|
|
8861
8883
|
}
|
|
8862
8884
|
}
|
|
@@ -8893,18 +8915,18 @@ exports.PSkyboxType = void 0;
|
|
|
8893
8915
|
brdfURL = "https://gw.alipayobjects.com/zos/gltf-asset/61420044606400/lut-ggx.png";
|
|
8894
8916
|
return [
|
|
8895
8917
|
4,
|
|
8896
|
-
|
|
8918
|
+
EFFECTS.loadImage(brdfURL)
|
|
8897
8919
|
];
|
|
8898
8920
|
case 1:
|
|
8899
8921
|
brdfLutImage = _state.sent();
|
|
8900
8922
|
brdfLutOpts = {
|
|
8901
8923
|
name: "brdfLut",
|
|
8902
|
-
wrapS:
|
|
8903
|
-
wrapT:
|
|
8904
|
-
magFilter:
|
|
8905
|
-
minFilter:
|
|
8924
|
+
wrapS: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
8925
|
+
wrapT: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
8926
|
+
magFilter: EFFECTS.glContext.LINEAR,
|
|
8927
|
+
minFilter: EFFECTS.glContext.LINEAR,
|
|
8906
8928
|
anisotropic: 1,
|
|
8907
|
-
sourceType:
|
|
8929
|
+
sourceType: EFFECTS.TextureSourceType.image,
|
|
8908
8930
|
image: brdfLutImage,
|
|
8909
8931
|
generateMipmap: false,
|
|
8910
8932
|
flipY: false,
|
|
@@ -8935,7 +8957,7 @@ exports.PSkyboxType = void 0;
|
|
|
8935
8957
|
];
|
|
8936
8958
|
case 1:
|
|
8937
8959
|
brdfLutOpts = _state.sent();
|
|
8938
|
-
brdfLutTexture =
|
|
8960
|
+
brdfLutTexture = EFFECTS.Texture.create(engine, brdfLutOpts);
|
|
8939
8961
|
return [
|
|
8940
8962
|
2,
|
|
8941
8963
|
brdfLutTexture
|
|
@@ -9015,10 +9037,10 @@ exports.PSkyboxType = void 0;
|
|
|
9015
9037
|
id: specularCubeData.textureOptions.id
|
|
9016
9038
|
};
|
|
9017
9039
|
var componentData = {
|
|
9018
|
-
id:
|
|
9019
|
-
dataType:
|
|
9040
|
+
id: EFFECTS.generateGUID(),
|
|
9041
|
+
dataType: EFFECTS.spec.DataType.SkyboxComponent,
|
|
9020
9042
|
item: {
|
|
9021
|
-
id:
|
|
9043
|
+
id: EFFECTS.generateGUID()
|
|
9022
9044
|
},
|
|
9023
9045
|
renderable: renderable,
|
|
9024
9046
|
intensity: intensity,
|
|
@@ -9071,7 +9093,7 @@ exports.PSkyboxType = void 0;
|
|
|
9071
9093
|
params.specularImage.forEach(function(cubemap) {
|
|
9072
9094
|
var mipmap = [];
|
|
9073
9095
|
cubemap.forEach(function(image) {
|
|
9074
|
-
var imageId =
|
|
9096
|
+
var imageId = EFFECTS.generateGUID();
|
|
9075
9097
|
imageDatas.push({
|
|
9076
9098
|
id: imageId,
|
|
9077
9099
|
// @ts-expect-error
|
|
@@ -9084,10 +9106,10 @@ exports.PSkyboxType = void 0;
|
|
|
9084
9106
|
mipmaps.push(mipmap);
|
|
9085
9107
|
});
|
|
9086
9108
|
var textureOptions = _extends({
|
|
9087
|
-
id:
|
|
9088
|
-
dataType:
|
|
9089
|
-
sourceType:
|
|
9090
|
-
target:
|
|
9109
|
+
id: EFFECTS.generateGUID(),
|
|
9110
|
+
dataType: EFFECTS.spec.DataType.Texture,
|
|
9111
|
+
sourceType: EFFECTS.TextureSourceType.mipmaps,
|
|
9112
|
+
target: EFFECTS.glContext.TEXTURE_CUBE_MAP,
|
|
9091
9113
|
// @ts-expect-error
|
|
9092
9114
|
mipmaps: mipmaps
|
|
9093
9115
|
}, WebGLHelper.cubemapMipTexConfig);
|
|
@@ -9131,7 +9153,7 @@ exports.PSkyboxType = void 0;
|
|
|
9131
9153
|
var imageDatas = [];
|
|
9132
9154
|
var cubemap = [];
|
|
9133
9155
|
params.diffuseImage.forEach(function(image) {
|
|
9134
|
-
var imageId =
|
|
9156
|
+
var imageId = EFFECTS.generateGUID();
|
|
9135
9157
|
imageDatas.push({
|
|
9136
9158
|
id: imageId,
|
|
9137
9159
|
// @ts-expect-error
|
|
@@ -9142,10 +9164,10 @@ exports.PSkyboxType = void 0;
|
|
|
9142
9164
|
});
|
|
9143
9165
|
});
|
|
9144
9166
|
var textureOptions = _extends({
|
|
9145
|
-
id:
|
|
9146
|
-
dataType:
|
|
9147
|
-
sourceType:
|
|
9148
|
-
target:
|
|
9167
|
+
id: EFFECTS.generateGUID(),
|
|
9168
|
+
dataType: EFFECTS.spec.DataType.Texture,
|
|
9169
|
+
sourceType: EFFECTS.TextureSourceType.mipmaps,
|
|
9170
|
+
target: EFFECTS.glContext.TEXTURE_CUBE_MAP,
|
|
9149
9171
|
// @ts-expect-error
|
|
9150
9172
|
mipmaps: [
|
|
9151
9173
|
cubemap
|
|
@@ -9172,7 +9194,7 @@ exports.PSkyboxType = void 0;
|
|
|
9172
9194
|
diffuseImage: this.getDiffuseImageList(skyboxType, specularImage),
|
|
9173
9195
|
specularImage: specularImage,
|
|
9174
9196
|
specularImageSize: Math.pow(2, specularImage.length - 1),
|
|
9175
|
-
specularMipCount: specularImage.length
|
|
9197
|
+
specularMipCount: specularImage.length
|
|
9176
9198
|
};
|
|
9177
9199
|
return params;
|
|
9178
9200
|
};
|
|
@@ -9390,11 +9412,11 @@ exports.PSkyboxType = void 0;
|
|
|
9390
9412
|
this.loadSkybox = loadSkybox;
|
|
9391
9413
|
if (this.brdfLutTexture === undefined || this.brdfLutTexture.isDestroyed) {
|
|
9392
9414
|
if (CompositionCache.brdfLutTexOptions === undefined) {
|
|
9393
|
-
throw new Error("Please load brdfLutTexOptions at first");
|
|
9415
|
+
throw new Error("Please load brdfLutTexOptions at first.");
|
|
9394
9416
|
}
|
|
9395
9417
|
//
|
|
9396
9418
|
var brdfLutTextureName = "brdfLutTexture";
|
|
9397
|
-
this.brdfLutTexture =
|
|
9419
|
+
this.brdfLutTexture = EFFECTS.Texture.create(this.engine, CompositionCache.brdfLutTexOptions);
|
|
9398
9420
|
this.deleteTexture(brdfLutTextureName);
|
|
9399
9421
|
this.setTexture(brdfLutTextureName, this.brdfLutTexture);
|
|
9400
9422
|
}
|
|
@@ -9423,7 +9445,7 @@ exports.PSkyboxType = void 0;
|
|
|
9423
9445
|
if (tex !== undefined) {
|
|
9424
9446
|
return tex;
|
|
9425
9447
|
}
|
|
9426
|
-
var newTex =
|
|
9448
|
+
var newTex = EFFECTS.Texture.create(this.engine, options);
|
|
9427
9449
|
this.textureCache.set(name, newTex);
|
|
9428
9450
|
return newTex;
|
|
9429
9451
|
};
|
|
@@ -9638,9 +9660,9 @@ exports.PSkyboxType = void 0;
|
|
|
9638
9660
|
id: "ModelPluginItem",
|
|
9639
9661
|
name: "ModelPluginItem",
|
|
9640
9662
|
duration: 9999999,
|
|
9641
|
-
endBehavior:
|
|
9663
|
+
endBehavior: EFFECTS.spec.END_BEHAVIOR_FORWARD
|
|
9642
9664
|
};
|
|
9643
|
-
var item = new
|
|
9665
|
+
var item = new EFFECTS.VFXItem(composition.getEngine(), props);
|
|
9644
9666
|
composition.addItem(item);
|
|
9645
9667
|
//
|
|
9646
9668
|
var comp = item.addComponent(exports.ModelPluginComponent);
|
|
@@ -9710,33 +9732,33 @@ exports.PSkyboxType = void 0;
|
|
|
9710
9732
|
var pbrShaderData = {
|
|
9711
9733
|
id: PBRShaderGUID,
|
|
9712
9734
|
name: "PBR Shader",
|
|
9713
|
-
dataType:
|
|
9735
|
+
dataType: EFFECTS.spec.DataType.Shader,
|
|
9714
9736
|
fragment: pbrShaderCode.fragmentShaderCode,
|
|
9715
9737
|
vertex: pbrShaderCode.vertexShaderCode,
|
|
9716
9738
|
// @ts-expect-error
|
|
9717
|
-
glslVersion: isWebGL2 ?
|
|
9739
|
+
glslVersion: isWebGL2 ? EFFECTS.GLSLVersion.GLSL3 : EFFECTS.GLSLVersion.GLSL1
|
|
9718
9740
|
};
|
|
9719
9741
|
var unlitShaderData = {
|
|
9720
9742
|
id: UnlitShaderGUID,
|
|
9721
9743
|
name: "Unlit Shader",
|
|
9722
|
-
dataType:
|
|
9744
|
+
dataType: EFFECTS.spec.DataType.Shader,
|
|
9723
9745
|
fragment: unlitShaderCode.fragmentShaderCode,
|
|
9724
9746
|
vertex: unlitShaderCode.vertexShaderCode,
|
|
9725
9747
|
// @ts-expect-error
|
|
9726
|
-
glslVersion: isWebGL2 ?
|
|
9748
|
+
glslVersion: isWebGL2 ? EFFECTS.GLSLVersion.GLSL3 : EFFECTS.GLSLVersion.GLSL1
|
|
9727
9749
|
};
|
|
9728
9750
|
renderer.engine.addEffectsObjectData(pbrShaderData);
|
|
9729
9751
|
renderer.engine.addEffectsObjectData(unlitShaderData);
|
|
9730
9752
|
return Promise.resolve();
|
|
9731
9753
|
};
|
|
9732
9754
|
return ModelPlugin;
|
|
9733
|
-
}(
|
|
9755
|
+
}(EFFECTS.AbstractPlugin);
|
|
9734
9756
|
exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
9735
9757
|
_inherits(ModelPluginComponent, ItemBehaviour);
|
|
9736
9758
|
function ModelPluginComponent(engine, options) {
|
|
9737
9759
|
var _this;
|
|
9738
9760
|
_this = ItemBehaviour.call(this, engine) || this;
|
|
9739
|
-
_this.runtimeEnv =
|
|
9761
|
+
_this.runtimeEnv = EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
|
|
9740
9762
|
_this.compatibleMode = "gltf";
|
|
9741
9763
|
_this.renderSkybox = true;
|
|
9742
9764
|
_this.visBoundingBox = false;
|
|
@@ -9748,7 +9770,7 @@ exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
9748
9770
|
/**
|
|
9749
9771
|
* 3D 渲染模式,支持可视化渲染中间结果
|
|
9750
9772
|
* none 表示正常的渲染结果
|
|
9751
|
-
*/ _this.renderMode3D =
|
|
9773
|
+
*/ _this.renderMode3D = EFFECTS.spec.RenderMode3D.none;
|
|
9752
9774
|
/**
|
|
9753
9775
|
* UV 渲染模式中,指定棋盘格的大小,相对于大小为 1 的纹理
|
|
9754
9776
|
* 取值范围(0, 1)
|
|
@@ -9799,8 +9821,8 @@ exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
9799
9821
|
var newPosition = invWorldMatrix.transformPoint(position);
|
|
9800
9822
|
component.setTransform(newPosition);
|
|
9801
9823
|
// 正式版本不会走到这个流程,只在测试时使用
|
|
9802
|
-
console.info("Scene AABB [" + sceneAABB.min.toArray() + "], [" + sceneAABB.max.toArray() + "]");
|
|
9803
|
-
console.info("Update camera position [" + newPosition.toArray() + "]");
|
|
9824
|
+
console.info("Scene AABB [" + sceneAABB.min.toArray() + "], [" + sceneAABB.max.toArray() + "].");
|
|
9825
|
+
console.info("Update camera position [" + newPosition.toArray() + "].");
|
|
9804
9826
|
}
|
|
9805
9827
|
}
|
|
9806
9828
|
});
|
|
@@ -9884,9 +9906,9 @@ exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
9884
9906
|
return lightItemCount;
|
|
9885
9907
|
};
|
|
9886
9908
|
return ModelPluginComponent;
|
|
9887
|
-
}(
|
|
9909
|
+
}(EFFECTS.ItemBehaviour);
|
|
9888
9910
|
exports.ModelPluginComponent = __decorate([
|
|
9889
|
-
|
|
9911
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.ModelPluginComponent)
|
|
9890
9912
|
], exports.ModelPluginComponent);
|
|
9891
9913
|
/**
|
|
9892
9914
|
* 获取场景管理器,从合成中查找
|
|
@@ -9977,7 +9999,7 @@ exports.ModelPluginComponent = __decorate([
|
|
|
9977
9999
|
var nodes = options.nodes.map(function(node, i) {
|
|
9978
10000
|
return {
|
|
9979
10001
|
name: node.name || node.id || i + "",
|
|
9980
|
-
transform: new
|
|
10002
|
+
transform: new EFFECTS.Transform(_extends({}, node.transform, {
|
|
9981
10003
|
valid: true
|
|
9982
10004
|
}), topTransform),
|
|
9983
10005
|
id: "^" + (node.id || i),
|
|
@@ -10033,7 +10055,7 @@ exports.ModelTreeComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
10033
10055
|
/**
|
|
10034
10056
|
* 组件开始,查询合成中场景管理器并设置到动画管理器中
|
|
10035
10057
|
*/ _proto.start = function start() {
|
|
10036
|
-
this.item.type =
|
|
10058
|
+
this.item.type = EFFECTS.spec.ItemType.tree;
|
|
10037
10059
|
this.content.baseTransform.setValid(true);
|
|
10038
10060
|
var sceneManager = getSceneManager(this);
|
|
10039
10061
|
if (sceneManager) {
|
|
@@ -10080,9 +10102,9 @@ exports.ModelTreeComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
10080
10102
|
}
|
|
10081
10103
|
};
|
|
10082
10104
|
return ModelTreeComponent;
|
|
10083
|
-
}(
|
|
10105
|
+
}(EFFECTS.ItemBehaviour);
|
|
10084
10106
|
exports.ModelTreeComponent = __decorate([
|
|
10085
|
-
|
|
10107
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.TreeComponent)
|
|
10086
10108
|
], exports.ModelTreeComponent);
|
|
10087
10109
|
|
|
10088
10110
|
/**
|
|
@@ -10101,7 +10123,7 @@ exports.ModelTreeComponent = __decorate([
|
|
|
10101
10123
|
return _this;
|
|
10102
10124
|
}
|
|
10103
10125
|
return ModelTreePlugin;
|
|
10104
|
-
}(
|
|
10126
|
+
}(EFFECTS.AbstractPlugin);
|
|
10105
10127
|
|
|
10106
10128
|
exports.CameraGestureType = void 0;
|
|
10107
10129
|
(function(CameraGestureType) {
|
|
@@ -10150,11 +10172,11 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10150
10172
|
// can't find camera item, throw error message
|
|
10151
10173
|
var item = this.getItem();
|
|
10152
10174
|
if (item === undefined) {
|
|
10153
|
-
console.warn("
|
|
10175
|
+
console.warn("[CameraGestureHandlerImp] Unable to locate camera item with ID: " + this.startParams.target + ".");
|
|
10154
10176
|
return this.composition.camera.getOptions();
|
|
10155
10177
|
}
|
|
10156
10178
|
var camera = this.composition.camera;
|
|
10157
|
-
var effectsTransfrom = new
|
|
10179
|
+
var effectsTransfrom = new EFFECTS.Transform(_extends({}, camera.getOptions(), {
|
|
10158
10180
|
valid: true
|
|
10159
10181
|
}));
|
|
10160
10182
|
var cameraTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
|
|
@@ -10321,7 +10343,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10321
10343
|
this.startParams.type = exports.CameraGestureType.none;
|
|
10322
10344
|
var item = this.getItem();
|
|
10323
10345
|
if (item === undefined) {
|
|
10324
|
-
console.warn("
|
|
10346
|
+
console.warn("[CameraGestureHandlerImp] Can't find camera item.");
|
|
10325
10347
|
return;
|
|
10326
10348
|
}
|
|
10327
10349
|
this.setPosition(item, position);
|
|
@@ -10331,7 +10353,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10331
10353
|
this.startParams.type = exports.CameraGestureType.none;
|
|
10332
10354
|
var item = this.getItem();
|
|
10333
10355
|
if (item === undefined) {
|
|
10334
|
-
console.warn("
|
|
10356
|
+
console.warn("[CameraGestureHandlerImp] Can't find camera item.");
|
|
10335
10357
|
return;
|
|
10336
10358
|
}
|
|
10337
10359
|
this.setQuaternion(item, quat);
|
|
@@ -10341,7 +10363,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10341
10363
|
this.startParams.type = exports.CameraGestureType.none;
|
|
10342
10364
|
var item = this.getItem();
|
|
10343
10365
|
if (item === undefined) {
|
|
10344
|
-
console.warn("
|
|
10366
|
+
console.warn("[CameraGestureHandlerImp] Can't find camera item.");
|
|
10345
10367
|
return;
|
|
10346
10368
|
}
|
|
10347
10369
|
var newDistance = distance != null ? distance : 5;
|
|
@@ -10390,7 +10412,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10390
10412
|
};
|
|
10391
10413
|
_proto.getCameraTransform = function getCameraTransform() {
|
|
10392
10414
|
var camera = this.composition.camera;
|
|
10393
|
-
var transform = new
|
|
10415
|
+
var transform = new EFFECTS.Transform(camera.getOptions());
|
|
10394
10416
|
transform.setValid(true);
|
|
10395
10417
|
return transform;
|
|
10396
10418
|
};
|
|
@@ -10398,7 +10420,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10398
10420
|
this.startParams = args;
|
|
10399
10421
|
this.updateCameraTransform(this.composition.camera.getOptions());
|
|
10400
10422
|
if (!this.getItem()) {
|
|
10401
|
-
console.warn("
|
|
10423
|
+
console.warn("[CameraGestureHandlerImp] Invalid target specified in startGesture.");
|
|
10402
10424
|
}
|
|
10403
10425
|
return this.composition.camera.getOptions();
|
|
10404
10426
|
};
|
|
@@ -10406,7 +10428,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10406
10428
|
if (this.getCurrentType() === arg.type) {
|
|
10407
10429
|
var item = this.getItem();
|
|
10408
10430
|
if (item === undefined) {
|
|
10409
|
-
console.warn("
|
|
10431
|
+
console.warn("[CameraGestureHandlerImp] Can't find camera item.");
|
|
10410
10432
|
return this.composition.camera.getOptions();
|
|
10411
10433
|
}
|
|
10412
10434
|
var _arg_speed;
|
|
@@ -10460,10 +10482,10 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10460
10482
|
item.transform.setQuaternion(newRotation1.x, newRotation1.y, newRotation1.z, newRotation1.w);
|
|
10461
10483
|
this.setTransform(item, newPosition, item.transform.rotation);
|
|
10462
10484
|
} else {
|
|
10463
|
-
console.warn("not
|
|
10485
|
+
console.warn("[CameraGestureHandlerImp] Movement type not implemented.");
|
|
10464
10486
|
}
|
|
10465
10487
|
} else {
|
|
10466
|
-
console.warn("
|
|
10488
|
+
console.warn("[CameraGestureHandlerImp] Invalid move type specified: " + arg.type);
|
|
10467
10489
|
}
|
|
10468
10490
|
return this.composition.camera.getOptions();
|
|
10469
10491
|
};
|
|
@@ -10495,7 +10517,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10495
10517
|
this.startParams.target = "";
|
|
10496
10518
|
};
|
|
10497
10519
|
_proto.updateCameraTransform = function updateCameraTransform(cameraOptions) {
|
|
10498
|
-
var effectsTransfrom = new
|
|
10520
|
+
var effectsTransfrom = new EFFECTS.Transform(cameraOptions);
|
|
10499
10521
|
effectsTransfrom.setValid(true);
|
|
10500
10522
|
this.cameraTransform.fromEffectsTransform(effectsTransfrom);
|
|
10501
10523
|
this.cameraCoordiante.fromPTransform(this.cameraTransform);
|
|
@@ -10515,7 +10537,7 @@ var LoaderHelper = /*#__PURE__*/ function() {
|
|
|
10515
10537
|
};
|
|
10516
10538
|
};
|
|
10517
10539
|
LoaderHelper.getEffectsTransformFromMat4 = function getEffectsTransformFromMat4(mat) {
|
|
10518
|
-
var transform = new
|
|
10540
|
+
var transform = new EFFECTS.Transform({
|
|
10519
10541
|
valid: true
|
|
10520
10542
|
});
|
|
10521
10543
|
transform.cloneFromMatrix(mat);
|
|
@@ -10732,7 +10754,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10732
10754
|
var nodeList = scene.nodes.map(function(node, nodeIndex) {
|
|
10733
10755
|
var children = node.children.map(function(child) {
|
|
10734
10756
|
if (child.nodeIndex === undefined) {
|
|
10735
|
-
throw new Error("Undefined nodeIndex for child " + child);
|
|
10757
|
+
throw new Error("Undefined nodeIndex for child " + child + ".");
|
|
10736
10758
|
}
|
|
10737
10759
|
return child.nodeIndex;
|
|
10738
10760
|
});
|
|
@@ -10741,7 +10763,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10741
10763
|
var scale;
|
|
10742
10764
|
if (node.matrix !== undefined) {
|
|
10743
10765
|
if (node.matrix.length !== 16) {
|
|
10744
|
-
throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node);
|
|
10766
|
+
throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node + ".");
|
|
10745
10767
|
}
|
|
10746
10768
|
var mat = Matrix4.fromArray(node.matrix);
|
|
10747
10769
|
var transform = mat.getTransform();
|
|
@@ -10774,7 +10796,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10774
10796
|
});
|
|
10775
10797
|
var rootNodes = scene.rootNodes.map(function(root) {
|
|
10776
10798
|
if (root.nodeIndex === undefined) {
|
|
10777
|
-
throw new Error("Undefined nodeIndex for root " + root);
|
|
10799
|
+
throw new Error("Undefined nodeIndex for root " + root + ".");
|
|
10778
10800
|
}
|
|
10779
10801
|
return root.nodeIndex;
|
|
10780
10802
|
});
|
|
@@ -10819,18 +10841,18 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10819
10841
|
_proto.createTextureCube = function createTextureCube(cubeImages, level0Size) {
|
|
10820
10842
|
var _this = this;
|
|
10821
10843
|
if (cubeImages.length == 0) {
|
|
10822
|
-
throw new Error("createTextureCube: Invalid cubeImages length " + cubeImages);
|
|
10844
|
+
throw new Error("createTextureCube: Invalid cubeImages length " + cubeImages + ".");
|
|
10823
10845
|
}
|
|
10824
10846
|
var mipmaps = [];
|
|
10825
10847
|
cubeImages.forEach(function(cubeImage) {
|
|
10826
10848
|
if (cubeImage.length != 6) {
|
|
10827
|
-
throw new Error("createTextureCube: cubeimage count should always be 6, " + cubeImage);
|
|
10849
|
+
throw new Error("createTextureCube: cubeimage count should always be 6, " + cubeImage + ".");
|
|
10828
10850
|
}
|
|
10829
10851
|
//
|
|
10830
10852
|
var imgList = [];
|
|
10831
10853
|
cubeImage.forEach(function(img) {
|
|
10832
10854
|
if (img.imageData === undefined) {
|
|
10833
|
-
throw new Error("createTextureCube: Invalid image data from " + img);
|
|
10855
|
+
throw new Error("createTextureCube: Invalid image data from " + img + ".");
|
|
10834
10856
|
}
|
|
10835
10857
|
//
|
|
10836
10858
|
imgList.push({
|
|
@@ -10881,9 +10903,9 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10881
10903
|
}
|
|
10882
10904
|
return newImages;
|
|
10883
10905
|
});
|
|
10884
|
-
var specularMipCount = specularImages.length
|
|
10906
|
+
var specularMipCount = specularImages.length;
|
|
10885
10907
|
var _ibl_specularImageSize;
|
|
10886
|
-
var specularImageSize = (_ibl_specularImageSize = ibl.specularImageSize) != null ? _ibl_specularImageSize : Math.pow(2, specularMipCount);
|
|
10908
|
+
var specularImageSize = (_ibl_specularImageSize = ibl.specularImageSize) != null ? _ibl_specularImageSize : Math.pow(2, specularMipCount - 1);
|
|
10887
10909
|
var params = {
|
|
10888
10910
|
type: "buffer",
|
|
10889
10911
|
renderable: this.isSkyboxVis(),
|
|
@@ -10898,7 +10920,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10898
10920
|
};
|
|
10899
10921
|
_proto.createDefaultSkybox = function createDefaultSkybox(typeName) {
|
|
10900
10922
|
if (typeName !== "NFT" && typeName !== "FARM") {
|
|
10901
|
-
throw new Error("Invalid skybox type
|
|
10923
|
+
throw new Error("Invalid skybox type specified: '" + typeName + "'. Valid types are: 'NFT', 'FARM'.");
|
|
10902
10924
|
}
|
|
10903
10925
|
//
|
|
10904
10926
|
var typ = typeName === "NFT" ? exports.PSkyboxType.NFT : exports.PSkyboxType.FARM;
|
|
@@ -10929,7 +10951,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10929
10951
|
};
|
|
10930
10952
|
gltfResource = options.gltf.resource;
|
|
10931
10953
|
if (typeof gltfResource === "string" || _instanceof1(gltfResource, Uint8Array)) {
|
|
10932
|
-
throw new Error("Please load resource
|
|
10954
|
+
throw new Error("Please load the resource using GLTFTools first.");
|
|
10933
10955
|
}
|
|
10934
10956
|
_this._gltfScene = gltfResource.scenes[0];
|
|
10935
10957
|
_this._gltfSkins = _this._gltfScene.skins;
|
|
@@ -10977,7 +10999,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10977
10999
|
});
|
|
10978
11000
|
sceneAABB = new Box3();
|
|
10979
11001
|
_this._gltfScene.rootNodes.forEach(function(root) {
|
|
10980
|
-
var parentTransform = new
|
|
11002
|
+
var parentTransform = new EFFECTS.Transform({
|
|
10981
11003
|
valid: true
|
|
10982
11004
|
});
|
|
10983
11005
|
_this._computeSceneAABB(root, parentTransform, sceneAABB);
|
|
@@ -11140,7 +11162,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11140
11162
|
var texIndex = texInfo.index;
|
|
11141
11163
|
var tex = this.getTextureManager().getTexture(matIndex, texIndex, isBaseColor);
|
|
11142
11164
|
if (tex === undefined && noWarning !== true) {
|
|
11143
|
-
console.warn("Can't find texture for mat " + matIndex + ", tex " + JSON.stringify(texInfo) + ", basecolor " + isBaseColor);
|
|
11165
|
+
console.warn("Can't find texture for mat " + matIndex + ", tex " + JSON.stringify(texInfo) + ", basecolor " + isBaseColor + ".");
|
|
11144
11166
|
}
|
|
11145
11167
|
return tex;
|
|
11146
11168
|
};
|
|
@@ -11159,7 +11181,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11159
11181
|
name: scene.name,
|
|
11160
11182
|
duration: this.getItemDuration(),
|
|
11161
11183
|
endBehavior: this.getItemEndBehavior(),
|
|
11162
|
-
type:
|
|
11184
|
+
type: EFFECTS.spec.ItemType.tree,
|
|
11163
11185
|
content: {
|
|
11164
11186
|
options: {
|
|
11165
11187
|
tree: treeOptions
|
|
@@ -11172,7 +11194,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11172
11194
|
var _this = this;
|
|
11173
11195
|
var meshIndex = node.mesh;
|
|
11174
11196
|
if (meshIndex === undefined) {
|
|
11175
|
-
throw new Error("Invalid mesh index in node " + node);
|
|
11197
|
+
throw new Error("Invalid mesh index in node " + node + ".");
|
|
11176
11198
|
}
|
|
11177
11199
|
var skin;
|
|
11178
11200
|
if (node.skin !== undefined) {
|
|
@@ -11191,7 +11213,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11191
11213
|
var geometry = _this.createGeometry(prim, skin !== undefined);
|
|
11192
11214
|
var material = _this.createMaterial(mat);
|
|
11193
11215
|
material.baseColorTexture = _this.getTexture2D(matIndex, mat.baseColorTexture, true);
|
|
11194
|
-
if (material.type ===
|
|
11216
|
+
if (material.type === EFFECTS.spec.MaterialType.pbr) {
|
|
11195
11217
|
material.metallicRoughnessTexture = _this.getTexture2D(matIndex, mat.metallicRoughnessTexture, false);
|
|
11196
11218
|
material.normalTexture = _this.getTexture2D(matIndex, mat.normalTexture, false);
|
|
11197
11219
|
material.emissiveTexture = _this.getTexture2D(matIndex, mat.emissiveTexture, false);
|
|
@@ -11213,8 +11235,8 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11213
11235
|
var boxSize = aabb.getSize(new Vector3());
|
|
11214
11236
|
var boxCenter = aabb.getCenter(new Vector3());
|
|
11215
11237
|
var interaction = {
|
|
11216
|
-
behavior:
|
|
11217
|
-
type:
|
|
11238
|
+
behavior: EFFECTS.spec.InteractBehavior.NOTIFY,
|
|
11239
|
+
type: EFFECTS.spec.ModelBoundingType.box,
|
|
11218
11240
|
size: [
|
|
11219
11241
|
boxSize.x,
|
|
11220
11242
|
boxSize.y,
|
|
@@ -11233,7 +11255,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11233
11255
|
name: mesh.name,
|
|
11234
11256
|
duration: this.getItemDuration(),
|
|
11235
11257
|
endBehavior: this.getItemEndBehavior(),
|
|
11236
|
-
type:
|
|
11258
|
+
type: EFFECTS.spec.ItemType.mesh,
|
|
11237
11259
|
pluginName: "model",
|
|
11238
11260
|
content: {
|
|
11239
11261
|
options: meshOptions,
|
|
@@ -11256,7 +11278,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11256
11278
|
name: (_light_name = light.name) != null ? _light_name : "light",
|
|
11257
11279
|
duration: this.getItemDuration(),
|
|
11258
11280
|
endBehavior: this.getItemEndBehavior(),
|
|
11259
|
-
type:
|
|
11281
|
+
type: EFFECTS.spec.ItemType.light,
|
|
11260
11282
|
pluginName: "model",
|
|
11261
11283
|
content: {
|
|
11262
11284
|
options: lightOptions
|
|
@@ -11298,7 +11320,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11298
11320
|
name: "skybox",
|
|
11299
11321
|
duration: this.getItemDuration(),
|
|
11300
11322
|
endBehavior: this.getItemEndBehavior(),
|
|
11301
|
-
type:
|
|
11323
|
+
type: EFFECTS.spec.ItemType.skybox,
|
|
11302
11324
|
pluginName: "model",
|
|
11303
11325
|
content: {
|
|
11304
11326
|
options: this._skyboxOptions
|
|
@@ -11325,7 +11347,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11325
11347
|
transformData.scale = node.scale;
|
|
11326
11348
|
}
|
|
11327
11349
|
}
|
|
11328
|
-
var nodeTransform = new
|
|
11350
|
+
var nodeTransform = new EFFECTS.Transform(transformData, parentTransform);
|
|
11329
11351
|
nodeTransform.setValid(true);
|
|
11330
11352
|
//
|
|
11331
11353
|
if (node.mesh !== undefined) {
|
|
@@ -11416,7 +11438,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11416
11438
|
};
|
|
11417
11439
|
_proto.getItemEndBehavior = function getItemEndBehavior() {
|
|
11418
11440
|
var _this__sceneOptions_effects_endBehavior;
|
|
11419
|
-
return (_this__sceneOptions_effects_endBehavior = this._sceneOptions.effects.endBehavior) != null ? _this__sceneOptions_effects_endBehavior :
|
|
11441
|
+
return (_this__sceneOptions_effects_endBehavior = this._sceneOptions.effects.endBehavior) != null ? _this__sceneOptions_effects_endBehavior : EFFECTS.spec.ItemEndBehavior.loop;
|
|
11420
11442
|
};
|
|
11421
11443
|
_proto.getSkyboxType = function getSkyboxType() {
|
|
11422
11444
|
var typeName = this._sceneOptions.gltf.skyboxType;
|
|
@@ -11459,11 +11481,11 @@ var TextureManager = /*#__PURE__*/ function() {
|
|
|
11459
11481
|
this._textureMap.clear();
|
|
11460
11482
|
};
|
|
11461
11483
|
_proto.addTexture = function addTexture(matIndex, texIndex, tex, isBaseColor) {
|
|
11462
|
-
var index = isBaseColor ? matIndex * 100000 + texIndex : texIndex;
|
|
11484
|
+
var index = isBaseColor ? (matIndex + 1) * 100000 + texIndex : texIndex;
|
|
11463
11485
|
this._textureMap.set(index, tex);
|
|
11464
11486
|
};
|
|
11465
11487
|
_proto.getTexture = function getTexture(matIndex, texIndex, isBaseColor) {
|
|
11466
|
-
var index = isBaseColor ? matIndex * 100000 + texIndex : texIndex;
|
|
11488
|
+
var index = isBaseColor ? (matIndex + 1) * 100000 + texIndex : texIndex;
|
|
11467
11489
|
return this._textureMap.get(index);
|
|
11468
11490
|
};
|
|
11469
11491
|
return TextureManager;
|
|
@@ -11508,7 +11530,7 @@ var GeometryProxy = /*#__PURE__*/ function() {
|
|
|
11508
11530
|
var attrib = this.positionAttrib;
|
|
11509
11531
|
attributes["aPos"] = this._getBufferAttrib(attrib);
|
|
11510
11532
|
} else {
|
|
11511
|
-
throw new Error("Position attribute missing");
|
|
11533
|
+
throw new Error("Position attribute missing.");
|
|
11512
11534
|
}
|
|
11513
11535
|
if (this.hasNormal) {
|
|
11514
11536
|
var attrib1 = this.normalAttrib;
|
|
@@ -11555,21 +11577,21 @@ var GeometryProxy = /*#__PURE__*/ function() {
|
|
|
11555
11577
|
}
|
|
11556
11578
|
var indexArray = this.indexArray;
|
|
11557
11579
|
if (indexArray !== undefined) {
|
|
11558
|
-
return
|
|
11580
|
+
return EFFECTS.Geometry.create(this.engine, {
|
|
11559
11581
|
attributes: attributes,
|
|
11560
11582
|
indices: {
|
|
11561
11583
|
data: indexArray
|
|
11562
11584
|
},
|
|
11563
11585
|
drawStart: 0,
|
|
11564
11586
|
drawCount: indexArray.length,
|
|
11565
|
-
mode:
|
|
11587
|
+
mode: EFFECTS.glContext.TRIANGLES
|
|
11566
11588
|
});
|
|
11567
11589
|
} else {
|
|
11568
|
-
return
|
|
11590
|
+
return EFFECTS.Geometry.create(this.engine, {
|
|
11569
11591
|
attributes: attributes,
|
|
11570
11592
|
drawStart: 0,
|
|
11571
11593
|
drawCount: this.positionAttrib.array.length / 3,
|
|
11572
|
-
mode:
|
|
11594
|
+
mode: EFFECTS.glContext.TRIANGLES
|
|
11573
11595
|
});
|
|
11574
11596
|
}
|
|
11575
11597
|
}
|
|
@@ -11739,19 +11761,19 @@ var MaterialProxy = /*#__PURE__*/ function() {
|
|
|
11739
11761
|
get: function get() {
|
|
11740
11762
|
var mat = this.gltfMaterial;
|
|
11741
11763
|
var isUnlit = GLTFHelper.isUnlitMaterial(mat);
|
|
11742
|
-
var blending =
|
|
11764
|
+
var blending = EFFECTS.spec.MaterialBlending.opaque;
|
|
11743
11765
|
switch(mat.alphaMode){
|
|
11744
11766
|
case "OPAQUE":
|
|
11745
|
-
blending =
|
|
11767
|
+
blending = EFFECTS.spec.MaterialBlending.opaque;
|
|
11746
11768
|
break;
|
|
11747
11769
|
case "MASK":
|
|
11748
|
-
blending =
|
|
11770
|
+
blending = EFFECTS.spec.MaterialBlending.masked;
|
|
11749
11771
|
break;
|
|
11750
11772
|
case "BLEND":
|
|
11751
|
-
blending =
|
|
11773
|
+
blending = EFFECTS.spec.MaterialBlending.translucent;
|
|
11752
11774
|
break;
|
|
11753
11775
|
}
|
|
11754
|
-
var side = mat.doubleSided ?
|
|
11776
|
+
var side = mat.doubleSided ? EFFECTS.spec.SideMode.DOUBLE : EFFECTS.spec.SideMode.FRONT;
|
|
11755
11777
|
var enableShadow = false;
|
|
11756
11778
|
var _mat_alphaCutOff;
|
|
11757
11779
|
var alphaCutOff = (_mat_alphaCutOff = mat.alphaCutOff) != null ? _mat_alphaCutOff : 0.5;
|
|
@@ -11760,7 +11782,7 @@ var MaterialProxy = /*#__PURE__*/ function() {
|
|
|
11760
11782
|
var _mat_extras;
|
|
11761
11783
|
return {
|
|
11762
11784
|
name: name,
|
|
11763
|
-
type:
|
|
11785
|
+
type: EFFECTS.spec.MaterialType.unlit,
|
|
11764
11786
|
baseColorTexture: this.baseColorTextureObj,
|
|
11765
11787
|
baseColorTextureCoordinate: this.baseColorTextureCoord,
|
|
11766
11788
|
baseColorTextureTransform: this.baseColorTextureTransfrom,
|
|
@@ -11775,7 +11797,7 @@ var MaterialProxy = /*#__PURE__*/ function() {
|
|
|
11775
11797
|
var _mat_extras1;
|
|
11776
11798
|
return {
|
|
11777
11799
|
name: name,
|
|
11778
|
-
type:
|
|
11800
|
+
type: EFFECTS.spec.MaterialType.pbr,
|
|
11779
11801
|
baseColorTexture: this.baseColorTextureObj,
|
|
11780
11802
|
baseColorTextureCoordinate: this.baseColorTextureCoord,
|
|
11781
11803
|
baseColorTextureTransform: this.baseColorTextureTransfrom,
|
|
@@ -12005,7 +12027,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12005
12027
|
this.treeInfo = new TreeInfo();
|
|
12006
12028
|
this.engine = player.renderer.engine;
|
|
12007
12029
|
this.renderer = player.renderer;
|
|
12008
|
-
this.downloader = new
|
|
12030
|
+
this.downloader = new EFFECTS.Downloader();
|
|
12009
12031
|
}
|
|
12010
12032
|
var _proto = JSONConverter.prototype;
|
|
12011
12033
|
_proto.processScene = function processScene(sceneData) {
|
|
@@ -12015,7 +12037,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12015
12037
|
return __generator(this, function(_state) {
|
|
12016
12038
|
switch(_state.label){
|
|
12017
12039
|
case 0:
|
|
12018
|
-
if (!
|
|
12040
|
+
if (!EFFECTS.isObject(sceneData)) return [
|
|
12019
12041
|
3,
|
|
12020
12042
|
1
|
|
12021
12043
|
];
|
|
@@ -12040,7 +12062,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12040
12062
|
tex.source = 0;
|
|
12041
12063
|
}
|
|
12042
12064
|
});
|
|
12043
|
-
oldScene =
|
|
12065
|
+
oldScene = EFFECTS.getStandardJSON(sceneJSON);
|
|
12044
12066
|
binFiles = [];
|
|
12045
12067
|
if (!oldScene.bins) return [
|
|
12046
12068
|
3,
|
|
@@ -12152,7 +12174,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12152
12174
|
loadedMipmaps = _state.sent();
|
|
12153
12175
|
newMipmaps = loadedMipmaps.map(function(mipmaps) {
|
|
12154
12176
|
return mipmaps.map(function(img) {
|
|
12155
|
-
var id =
|
|
12177
|
+
var id = EFFECTS.generateGUID();
|
|
12156
12178
|
var sceneImage = {
|
|
12157
12179
|
url: img,
|
|
12158
12180
|
id: id
|
|
@@ -12170,7 +12192,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12170
12192
|
mipmaps: newMipmaps,
|
|
12171
12193
|
sourceFrom: {
|
|
12172
12194
|
target: target,
|
|
12173
|
-
type:
|
|
12195
|
+
type: EFFECTS.TextureSourceType.mipmaps,
|
|
12174
12196
|
mipmaps: mipmaps.map(function(mipmap) {
|
|
12175
12197
|
return mipmap.map(function(pointer) {
|
|
12176
12198
|
return [
|
|
@@ -12216,26 +12238,26 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12216
12238
|
var newComponents = newScene.components;
|
|
12217
12239
|
for(var _iterator = _create_for_of_iterator_helper_loose(oldScene.components), _step; !(_step = _iterator()).done;){
|
|
12218
12240
|
var comp = _step.value;
|
|
12219
|
-
if (comp.dataType ===
|
|
12241
|
+
if (comp.dataType === EFFECTS.spec.DataType.SkyboxComponent) {
|
|
12220
12242
|
newComponents.push(this.createSkyboxComponent(comp, newScene));
|
|
12221
|
-
} else if (comp.dataType ===
|
|
12243
|
+
} else if (comp.dataType === EFFECTS.spec.DataType.LightComponent) {
|
|
12222
12244
|
newComponents.push(this.createLightComponent(comp, newScene));
|
|
12223
|
-
} else if (comp.dataType ===
|
|
12245
|
+
} else if (comp.dataType === EFFECTS.spec.DataType.CameraComponent) {
|
|
12224
12246
|
newComponents.push(comp);
|
|
12225
|
-
console.warn("
|
|
12226
|
-
} else if (comp.dataType ===
|
|
12247
|
+
console.warn("Camera component found: " + comp + ".");
|
|
12248
|
+
} else if (comp.dataType === EFFECTS.spec.DataType.TreeComponent) {
|
|
12227
12249
|
var treeComp = comp;
|
|
12228
12250
|
this.createItemsFromTreeComponent(comp, newScene, oldScene);
|
|
12229
12251
|
treeComp.options.tree.animation = undefined;
|
|
12230
12252
|
treeComp.options.tree.animations = undefined;
|
|
12231
12253
|
newComponents.push(comp);
|
|
12232
|
-
} else if (comp.dataType !==
|
|
12254
|
+
} else if (comp.dataType !== EFFECTS.spec.DataType.MeshComponent) {
|
|
12233
12255
|
newComponents.push(comp);
|
|
12234
12256
|
}
|
|
12235
12257
|
}
|
|
12236
12258
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(oldScene.components), _step1; !(_step1 = _iterator1()).done;){
|
|
12237
12259
|
var comp1 = _step1.value;
|
|
12238
|
-
if (comp1.dataType ===
|
|
12260
|
+
if (comp1.dataType === EFFECTS.spec.DataType.MeshComponent) {
|
|
12239
12261
|
newComponents.push(this.createMeshComponent(comp1, newScene, oldScene));
|
|
12240
12262
|
}
|
|
12241
12263
|
}
|
|
@@ -12266,7 +12288,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12266
12288
|
2,
|
|
12267
12289
|
new Promise(function(resolve, reject) {
|
|
12268
12290
|
_this.downloader.downloadJSON(url, resolve, function(status, responseText) {
|
|
12269
|
-
reject(new Error("
|
|
12291
|
+
reject(new Error("Failed to load JSON from URL '" + url + "': status " + status + " - " + responseText + ". Please check the URL or network settings."));
|
|
12270
12292
|
});
|
|
12271
12293
|
})
|
|
12272
12294
|
];
|
|
@@ -12295,7 +12317,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12295
12317
|
_pointer_ = pointer[1], index = _pointer_[0], start = _pointer_[1], length = _pointer_[2];
|
|
12296
12318
|
bin = bins[index];
|
|
12297
12319
|
if (!bin) {
|
|
12298
|
-
throw new Error("
|
|
12320
|
+
throw new Error("Invalid bin pointer: " + JSON.stringify(pointer) + ".");
|
|
12299
12321
|
}
|
|
12300
12322
|
return [
|
|
12301
12323
|
2,
|
|
@@ -12337,7 +12359,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12337
12359
|
id: scene.textures[skyboxOptions.specularImage].id
|
|
12338
12360
|
},
|
|
12339
12361
|
specularImageSize: skyboxOptions.specularImageSize,
|
|
12340
|
-
specularMipCount: skyboxOptions.specularMipCount
|
|
12362
|
+
specularMipCount: skyboxOptions.specularMipCount + 1
|
|
12341
12363
|
};
|
|
12342
12364
|
return skyboxComponent;
|
|
12343
12365
|
};
|
|
@@ -12364,7 +12386,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12364
12386
|
});
|
|
12365
12387
|
var geometryData = getGeometryDataFromPropsList(geometryPropsList);
|
|
12366
12388
|
if (!geometryData) {
|
|
12367
|
-
throw new Error("
|
|
12389
|
+
throw new Error("No primitives available to process.");
|
|
12368
12390
|
}
|
|
12369
12391
|
newScene.geometries.push(geometryData);
|
|
12370
12392
|
(_newScene_materials = newScene.materials).push.apply(_newScene_materials, [].concat(materialDatas));
|
|
@@ -12391,12 +12413,12 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12391
12413
|
}
|
|
12392
12414
|
}
|
|
12393
12415
|
if (parentItemId === component.item.id) {
|
|
12394
|
-
throw new Error("Can't item " + component.item);
|
|
12416
|
+
throw new Error("Can't item " + component.item + ".");
|
|
12395
12417
|
}
|
|
12396
12418
|
var treeItem = this.treeInfo.getTreeItemByNodeId(parentItemId);
|
|
12397
12419
|
var treeNodeList = this.treeInfo.getTreeNodeListByNodeId(parentItemId);
|
|
12398
12420
|
if (!treeItem || !treeNodeList) {
|
|
12399
|
-
throw new Error("
|
|
12421
|
+
throw new Error("Failed to retrieve tree node list for item with ID " + component.item.id + ". Ensure the item exists and has a valid tree structure.");
|
|
12400
12422
|
}
|
|
12401
12423
|
var rootBoneItem = this.setupBoneData(geometryData, meshOptions.skin, oldScene, treeItem, treeNodeList);
|
|
12402
12424
|
meshComponent.rootBone = {
|
|
@@ -12424,13 +12446,13 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12424
12446
|
treeData.nodes.forEach(function(node, index) {
|
|
12425
12447
|
var _node_name;
|
|
12426
12448
|
var item = {
|
|
12427
|
-
id:
|
|
12449
|
+
id: EFFECTS.generateGUID(),
|
|
12428
12450
|
parentId: treeItem.id,
|
|
12429
12451
|
name: (_node_name = node.name) != null ? _node_name : "node" + index,
|
|
12430
12452
|
duration: treeItem.duration,
|
|
12431
12453
|
// @ts-expect-error
|
|
12432
12454
|
type: "ECS",
|
|
12433
|
-
dataType:
|
|
12455
|
+
dataType: EFFECTS.spec.DataType.VFXItemData,
|
|
12434
12456
|
visible: treeItem.visible,
|
|
12435
12457
|
endBehavior: treeItem.endBehavior,
|
|
12436
12458
|
delay: treeItem.delay,
|
|
@@ -12495,8 +12517,8 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12495
12517
|
var _this = this;
|
|
12496
12518
|
var animation = treeOptions.animation, animations = treeOptions.animations;
|
|
12497
12519
|
var animationComponent = {
|
|
12498
|
-
id:
|
|
12499
|
-
dataType:
|
|
12520
|
+
id: EFFECTS.generateGUID(),
|
|
12521
|
+
dataType: EFFECTS.spec.DataType.AnimationComponent,
|
|
12500
12522
|
item: {
|
|
12501
12523
|
id: treeItem.id
|
|
12502
12524
|
},
|
|
@@ -12508,9 +12530,9 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12508
12530
|
var bins = oldScene.bins;
|
|
12509
12531
|
animations.forEach(function(anim) {
|
|
12510
12532
|
var clipData = {
|
|
12511
|
-
id:
|
|
12533
|
+
id: EFFECTS.generateGUID(),
|
|
12512
12534
|
name: anim.name,
|
|
12513
|
-
dataType:
|
|
12535
|
+
dataType: EFFECTS.spec.DataType.AnimationClip,
|
|
12514
12536
|
positionCurves: [],
|
|
12515
12537
|
rotationCurves: [],
|
|
12516
12538
|
scaleCurves: [],
|
|
@@ -12525,13 +12547,13 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12525
12547
|
var inputArray = typedArrayFromBinary(bins, track.input);
|
|
12526
12548
|
var outputArray = typedArrayFromBinary(bins, track.output);
|
|
12527
12549
|
if (!_instanceof1(inputArray, Float32Array)) {
|
|
12528
|
-
throw new Error("Type of inputArray should be float32, " + inputArray);
|
|
12550
|
+
throw new Error("Type of inputArray should be float32, " + inputArray + ".");
|
|
12529
12551
|
}
|
|
12530
12552
|
if (!_instanceof1(outputArray, Float32Array)) {
|
|
12531
|
-
throw new Error("Type of outputArray should be float32, " + outputArray);
|
|
12553
|
+
throw new Error("Type of outputArray should be float32, " + outputArray + ".");
|
|
12532
12554
|
}
|
|
12533
12555
|
if (track.interpolation !== "LINEAR") {
|
|
12534
|
-
throw new Error("Invalid interpolation type " + track.interpolation);
|
|
12556
|
+
throw new Error("Invalid interpolation type " + track.interpolation + ".");
|
|
12535
12557
|
}
|
|
12536
12558
|
if (track.path === "rotation") {
|
|
12537
12559
|
var points = [];
|
|
@@ -12555,7 +12577,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12555
12577
|
controlPoints.push(p2.toArray());
|
|
12556
12578
|
}
|
|
12557
12579
|
lineValue.push([
|
|
12558
|
-
|
|
12580
|
+
EFFECTS.spec.BezierKeyframeType.LINE,
|
|
12559
12581
|
[
|
|
12560
12582
|
inputArray[i],
|
|
12561
12583
|
i
|
|
@@ -12565,7 +12587,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12565
12587
|
var node = _this.treeInfo.getTreeNode(treeItem.id, track.node);
|
|
12566
12588
|
var path = _this.treeInfo.getNodePath(node.id);
|
|
12567
12589
|
var keyFrames = [
|
|
12568
|
-
|
|
12590
|
+
EFFECTS.spec.ValueType.BEZIER_CURVE_QUAT,
|
|
12569
12591
|
[
|
|
12570
12592
|
lineValue,
|
|
12571
12593
|
points,
|
|
@@ -12593,7 +12615,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12593
12615
|
var lineValue1 = [];
|
|
12594
12616
|
for(var i2 = 0; i2 < inputArray.length; i2++){
|
|
12595
12617
|
lineValue1.push([
|
|
12596
|
-
|
|
12618
|
+
EFFECTS.spec.BezierKeyframeType.LINE,
|
|
12597
12619
|
[
|
|
12598
12620
|
inputArray[i2],
|
|
12599
12621
|
outputArray[i2 * component + c]
|
|
@@ -12601,7 +12623,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12601
12623
|
]);
|
|
12602
12624
|
}
|
|
12603
12625
|
var keyFrames1 = [
|
|
12604
|
-
|
|
12626
|
+
EFFECTS.spec.ValueType.BEZIER_CURVE,
|
|
12605
12627
|
lineValue1
|
|
12606
12628
|
];
|
|
12607
12629
|
clipData.floatCurves.push({
|
|
@@ -12630,7 +12652,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12630
12652
|
controlPoints1.push(p21.toArray());
|
|
12631
12653
|
}
|
|
12632
12654
|
lineValue2.push([
|
|
12633
|
-
|
|
12655
|
+
EFFECTS.spec.BezierKeyframeType.LINE,
|
|
12634
12656
|
[
|
|
12635
12657
|
inputArray[i3],
|
|
12636
12658
|
i3
|
|
@@ -12640,7 +12662,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12640
12662
|
var node2 = _this.treeInfo.getTreeNode(treeItem.id, track.node);
|
|
12641
12663
|
var path2 = _this.treeInfo.getNodePath(node2.id);
|
|
12642
12664
|
var keyFrames2 = [
|
|
12643
|
-
|
|
12665
|
+
EFFECTS.spec.ValueType.BEZIER_CURVE_PATH,
|
|
12644
12666
|
[
|
|
12645
12667
|
lineValue2,
|
|
12646
12668
|
points1,
|
|
@@ -12672,7 +12694,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12672
12694
|
newScene.components.push(animationComponent);
|
|
12673
12695
|
};
|
|
12674
12696
|
_proto.getMaterialData = function getMaterialData(material, scene) {
|
|
12675
|
-
if (material.type ===
|
|
12697
|
+
if (material.type === EFFECTS.spec.MaterialType.unlit) {
|
|
12676
12698
|
var floats = {};
|
|
12677
12699
|
if (material.alphaCutOff !== undefined) {
|
|
12678
12700
|
floats["_AlphaCutoff"] = material.alphaCutOff;
|
|
@@ -12685,9 +12707,9 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12685
12707
|
textures["_BaseColorSampler"] = this.getTextureData(scene, floats, material.baseColorTexture, material.baseColorTextureTransform);
|
|
12686
12708
|
}
|
|
12687
12709
|
var newMaterial = {
|
|
12688
|
-
id:
|
|
12710
|
+
id: EFFECTS.generateGUID(),
|
|
12689
12711
|
name: material.name,
|
|
12690
|
-
dataType:
|
|
12712
|
+
dataType: EFFECTS.spec.DataType.Material,
|
|
12691
12713
|
shader: {
|
|
12692
12714
|
id: UnlitShaderGUID
|
|
12693
12715
|
},
|
|
@@ -12742,9 +12764,9 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12742
12764
|
textures1["_EmissiveSampler"] = this.getTextureData(scene, floats1, material.emissiveTexture, material.emissiveTextureTransform);
|
|
12743
12765
|
}
|
|
12744
12766
|
var newMaterial1 = {
|
|
12745
|
-
id:
|
|
12767
|
+
id: EFFECTS.generateGUID(),
|
|
12746
12768
|
name: material.name,
|
|
12747
|
-
dataType:
|
|
12769
|
+
dataType: EFFECTS.spec.DataType.Material,
|
|
12748
12770
|
shader: {
|
|
12749
12771
|
id: PBRShaderGUID
|
|
12750
12772
|
},
|
|
@@ -12761,34 +12783,33 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12761
12783
|
}
|
|
12762
12784
|
};
|
|
12763
12785
|
_proto.setupMaterial = function setupMaterial(oldMat, newMat) {
|
|
12764
|
-
if (oldMat.blending ===
|
|
12765
|
-
newMat.stringTags["RenderType"] =
|
|
12786
|
+
if (oldMat.blending === EFFECTS.spec.MaterialBlending.translucent) {
|
|
12787
|
+
newMat.stringTags["RenderType"] = EFFECTS.spec.RenderType.Transparent;
|
|
12766
12788
|
} else {
|
|
12767
|
-
newMat.stringTags["RenderType"] =
|
|
12789
|
+
newMat.stringTags["RenderType"] = EFFECTS.spec.RenderType.Opaque;
|
|
12768
12790
|
}
|
|
12769
|
-
if (oldMat.blending ===
|
|
12791
|
+
if (oldMat.blending === EFFECTS.spec.MaterialBlending.masked) {
|
|
12770
12792
|
newMat.floats["AlphaClip"] = 1;
|
|
12771
12793
|
var _oldMat_alphaCutOff;
|
|
12772
|
-
newMat.floats["
|
|
12794
|
+
newMat.floats["_AlphaCutoff"] = (_oldMat_alphaCutOff = oldMat.alphaCutOff) != null ? _oldMat_alphaCutOff : 0;
|
|
12773
12795
|
} else {
|
|
12774
12796
|
newMat.floats["AlphaClip"] = 0;
|
|
12775
12797
|
}
|
|
12776
12798
|
switch(oldMat.side){
|
|
12777
|
-
case
|
|
12778
|
-
newMat.stringTags["RenderFace"] =
|
|
12799
|
+
case EFFECTS.spec.SideMode.BACK:
|
|
12800
|
+
newMat.stringTags["RenderFace"] = EFFECTS.spec.RenderFace.Back;
|
|
12779
12801
|
break;
|
|
12780
|
-
case
|
|
12781
|
-
newMat.stringTags["RenderFace"] =
|
|
12802
|
+
case EFFECTS.spec.SideMode.DOUBLE:
|
|
12803
|
+
newMat.stringTags["RenderFace"] = EFFECTS.spec.RenderFace.Both;
|
|
12782
12804
|
break;
|
|
12783
12805
|
default:
|
|
12784
|
-
newMat.stringTags["RenderFace"] =
|
|
12806
|
+
newMat.stringTags["RenderFace"] = EFFECTS.spec.RenderFace.Front;
|
|
12785
12807
|
}
|
|
12786
|
-
if (oldMat.type ===
|
|
12808
|
+
if (oldMat.type === EFFECTS.spec.MaterialType.pbr) {
|
|
12787
12809
|
newMat.floats["_SpecularAA"] = oldMat.useSpecularAA ? 1 : 0;
|
|
12788
12810
|
}
|
|
12789
|
-
|
|
12790
|
-
newMat.
|
|
12791
|
-
newMat.stringTags["ZTest"] = String(true);
|
|
12811
|
+
newMat.floats["ZWrite"] = oldMat.depthMask !== false ? 1 : 0;
|
|
12812
|
+
newMat.floats["ZTest"] = 1;
|
|
12792
12813
|
};
|
|
12793
12814
|
_proto.getTextureData = function getTextureData(scene, floats, texIndex, texTransform) {
|
|
12794
12815
|
var _scene_textures_texIndex_id;
|
|
@@ -12867,7 +12888,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12867
12888
|
var bins = oldScene.bins;
|
|
12868
12889
|
var joints = skin.joints, skeleton = skin.skeleton, inverseBindMatrices = skin.inverseBindMatrices;
|
|
12869
12890
|
if (!inverseBindMatrices) {
|
|
12870
|
-
throw new Error("inverseBindMatrices is undefined " + skin);
|
|
12891
|
+
throw new Error("'inverseBindMatrices' is undefined for the skin configuration: " + JSON.stringify(skin) + ". Ensure 'inverseBindMatrices' is properly defined in your skin data.");
|
|
12871
12892
|
}
|
|
12872
12893
|
var bindMatrixArray = typedArrayFromBinary(bins, inverseBindMatrices);
|
|
12873
12894
|
geom.inverseBindMatrices = Array.from(bindMatrixArray);
|
|
@@ -12876,12 +12897,12 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12876
12897
|
if (skeleton !== undefined) {
|
|
12877
12898
|
rootBoneItem = treeNodeList[skeleton];
|
|
12878
12899
|
} else {
|
|
12879
|
-
console.warn("Root bone is missing");
|
|
12900
|
+
console.warn("Root bone is missing for the skeleton. Defaulting to the primary tree item as the root bone.");
|
|
12880
12901
|
}
|
|
12881
12902
|
joints.forEach(function(joint) {
|
|
12882
12903
|
var node = treeNodeList[joint];
|
|
12883
12904
|
if (node !== rootBoneItem && node.parentId === rootBoneItem.parentId) {
|
|
12884
|
-
console.error("
|
|
12905
|
+
console.error("Invalid node detected for 'rootBoneItem'. Adjusting 'rootBoneItem' to the primary tree item. Please verify the tree structure.");
|
|
12885
12906
|
rootBoneItem = treeItem;
|
|
12886
12907
|
}
|
|
12887
12908
|
});
|
|
@@ -12919,12 +12940,12 @@ var TreeInfo = /*#__PURE__*/ function() {
|
|
|
12919
12940
|
_proto.add = function add(treeItem, treeNodeList) {
|
|
12920
12941
|
var _this = this;
|
|
12921
12942
|
if (this.tree2NodeList[treeItem.id]) {
|
|
12922
|
-
throw new Error("
|
|
12943
|
+
throw new Error("Duplicate treeItem ID detected: " + treeItem.id + ". Ensure each tree item has a unique ID.");
|
|
12923
12944
|
}
|
|
12924
12945
|
this.tree2NodeList[treeItem.id] = treeNodeList;
|
|
12925
12946
|
treeNodeList.forEach(function(node) {
|
|
12926
12947
|
if (_this.nodeList2Tree[node.id]) {
|
|
12927
|
-
throw new Error("
|
|
12948
|
+
throw new Error("Duplicate tree node ID found: " + node.id + ". Each node in the tree must have a unique ID.");
|
|
12928
12949
|
}
|
|
12929
12950
|
_this.nodeList2Tree[node.id] = treeItem;
|
|
12930
12951
|
_this.nodeId2Node[node.id] = node;
|
|
@@ -12953,7 +12974,7 @@ var TreeInfo = /*#__PURE__*/ function() {
|
|
|
12953
12974
|
_proto.getTreeNodeListByNodeId = function getTreeNodeListByNodeId(id) {
|
|
12954
12975
|
var treeItem = this.nodeList2Tree[id];
|
|
12955
12976
|
if (!treeItem) {
|
|
12956
|
-
throw new Error("Invalid id " + id);
|
|
12977
|
+
throw new Error("Invalid id " + id + ".");
|
|
12957
12978
|
}
|
|
12958
12979
|
return this.getTreeNodeListByTreeId(treeItem.id);
|
|
12959
12980
|
};
|
|
@@ -12980,11 +13001,11 @@ var TreeInfo = /*#__PURE__*/ function() {
|
|
|
12980
13001
|
}();
|
|
12981
13002
|
function getGeometryDataFromOptions(geomOptions) {
|
|
12982
13003
|
var vertexCount = 0;
|
|
12983
|
-
var verticesType =
|
|
13004
|
+
var verticesType = EFFECTS.spec.VertexFormatType.Float32;
|
|
12984
13005
|
var verticesNormalize = false;
|
|
12985
|
-
var uvsType =
|
|
13006
|
+
var uvsType = EFFECTS.spec.VertexFormatType.Float32;
|
|
12986
13007
|
var uvsNormalize = false;
|
|
12987
|
-
var normalsType =
|
|
13008
|
+
var normalsType = EFFECTS.spec.VertexFormatType.Float32;
|
|
12988
13009
|
var normalsNormalize = false;
|
|
12989
13010
|
var _geomOptions_name;
|
|
12990
13011
|
var modelData = {
|
|
@@ -13004,21 +13025,21 @@ function getGeometryDataFromOptions(geomOptions) {
|
|
|
13004
13025
|
var _attribData_normalize;
|
|
13005
13026
|
verticesNormalize = (_attribData_normalize = attribData.normalize) != null ? _attribData_normalize : false;
|
|
13006
13027
|
var _attribData_type;
|
|
13007
|
-
verticesType =
|
|
13028
|
+
verticesType = EFFECTS.glType2VertexFormatType((_attribData_type = attribData.type) != null ? _attribData_type : EFFECTS.glContext.FLOAT);
|
|
13008
13029
|
} else if (attrib === "aNormal") {
|
|
13009
13030
|
// @ts-expect-error
|
|
13010
13031
|
modelData.normals = attribData.data;
|
|
13011
13032
|
var _attribData_normalize1;
|
|
13012
13033
|
normalsNormalize = (_attribData_normalize1 = attribData.normalize) != null ? _attribData_normalize1 : false;
|
|
13013
13034
|
var _attribData_type1;
|
|
13014
|
-
normalsType =
|
|
13035
|
+
normalsType = EFFECTS.glType2VertexFormatType((_attribData_type1 = attribData.type) != null ? _attribData_type1 : EFFECTS.glContext.FLOAT);
|
|
13015
13036
|
} else if (attrib === "aUV1") {
|
|
13016
13037
|
// @ts-expect-error
|
|
13017
13038
|
modelData.uvs = attribData.data;
|
|
13018
13039
|
var _attribData_normalize2;
|
|
13019
13040
|
uvsNormalize = (_attribData_normalize2 = attribData.normalize) != null ? _attribData_normalize2 : false;
|
|
13020
13041
|
var _attribData_type2;
|
|
13021
|
-
uvsType =
|
|
13042
|
+
uvsType = EFFECTS.glType2VertexFormatType((_attribData_type2 = attribData.type) != null ? _attribData_type2 : EFFECTS.glContext.FLOAT);
|
|
13022
13043
|
}
|
|
13023
13044
|
}
|
|
13024
13045
|
var verticesOffset = getOffset(verticesType, 3, vertexCount);
|
|
@@ -13039,32 +13060,32 @@ function getGeometryDataFromOptions(geomOptions) {
|
|
|
13039
13060
|
}
|
|
13040
13061
|
modelData.indices = indices1;
|
|
13041
13062
|
}
|
|
13042
|
-
var indicesType =
|
|
13063
|
+
var indicesType = EFFECTS.spec.IndexFormatType.UInt16;
|
|
13043
13064
|
if (modelData.indices.BYTES_PER_ELEMENT === 4) {
|
|
13044
|
-
indicesType =
|
|
13065
|
+
indicesType = EFFECTS.spec.IndexFormatType.UInt32;
|
|
13045
13066
|
}
|
|
13046
13067
|
var geometryData = {
|
|
13047
|
-
id:
|
|
13048
|
-
dataType:
|
|
13068
|
+
id: EFFECTS.generateGUID(),
|
|
13069
|
+
dataType: EFFECTS.spec.DataType.Geometry,
|
|
13049
13070
|
vertexData: {
|
|
13050
13071
|
vertexCount: vertexCount,
|
|
13051
13072
|
channels: [
|
|
13052
13073
|
{
|
|
13053
|
-
semantic:
|
|
13074
|
+
semantic: EFFECTS.spec.VertexBufferSemantic.Position,
|
|
13054
13075
|
offset: 0,
|
|
13055
13076
|
format: verticesType,
|
|
13056
13077
|
dimension: 3,
|
|
13057
13078
|
normalize: verticesNormalize
|
|
13058
13079
|
},
|
|
13059
13080
|
{
|
|
13060
|
-
semantic:
|
|
13081
|
+
semantic: EFFECTS.spec.VertexBufferSemantic.Uv,
|
|
13061
13082
|
offset: verticesOffset,
|
|
13062
13083
|
format: uvsType,
|
|
13063
13084
|
dimension: 2,
|
|
13064
13085
|
normalize: uvsNormalize
|
|
13065
13086
|
},
|
|
13066
13087
|
{
|
|
13067
|
-
semantic:
|
|
13088
|
+
semantic: EFFECTS.spec.VertexBufferSemantic.Normal,
|
|
13068
13089
|
offset: verticesOffset + uvsOffset,
|
|
13069
13090
|
format: normalsType,
|
|
13070
13091
|
dimension: 3,
|
|
@@ -13073,7 +13094,7 @@ function getGeometryDataFromOptions(geomOptions) {
|
|
|
13073
13094
|
]
|
|
13074
13095
|
},
|
|
13075
13096
|
subMeshes: [],
|
|
13076
|
-
mode:
|
|
13097
|
+
mode: EFFECTS.spec.GeometryType.TRIANGLES,
|
|
13077
13098
|
indexFormat: indicesType,
|
|
13078
13099
|
indexOffset: verticesOffset + uvsOffset + normalsOffset,
|
|
13079
13100
|
buffer: encodeVertexData(modelData)
|
|
@@ -13139,11 +13160,11 @@ function getGeometryDataFromPropsList(geomPropsList) {
|
|
|
13139
13160
|
}
|
|
13140
13161
|
function getOffset(formatType, dimension, count) {
|
|
13141
13162
|
switch(formatType){
|
|
13142
|
-
case
|
|
13143
|
-
case
|
|
13163
|
+
case EFFECTS.spec.VertexFormatType.Int8:
|
|
13164
|
+
case EFFECTS.spec.VertexFormatType.UInt8:
|
|
13144
13165
|
return dimension * count;
|
|
13145
|
-
case
|
|
13146
|
-
case
|
|
13166
|
+
case EFFECTS.spec.VertexFormatType.Int16:
|
|
13167
|
+
case EFFECTS.spec.VertexFormatType.UInt16:
|
|
13147
13168
|
return dimension * count * 2;
|
|
13148
13169
|
default:
|
|
13149
13170
|
return dimension * count * 4;
|
|
@@ -13167,7 +13188,7 @@ function createGeometryData(props, subMeshes) {
|
|
|
13167
13188
|
var attribData1 = props.attributes[attrib1];
|
|
13168
13189
|
var semantic = vertexBufferSemanticMap[attrib1];
|
|
13169
13190
|
if (!semantic) {
|
|
13170
|
-
throw new Error("Invalid attrib " + attrib1);
|
|
13191
|
+
throw new Error("Invalid attrib " + attrib1 + ".");
|
|
13171
13192
|
}
|
|
13172
13193
|
// @ts-expect-error
|
|
13173
13194
|
vertexCount = attribData1.data.length / attribData1.size;
|
|
@@ -13175,7 +13196,7 @@ function createGeometryData(props, subMeshes) {
|
|
|
13175
13196
|
var vertexChannel = {
|
|
13176
13197
|
semantic: semantic,
|
|
13177
13198
|
offset: bufferOffset,
|
|
13178
|
-
format:
|
|
13199
|
+
format: EFFECTS.glType2VertexFormatType((_attribData_type = attribData1.type) != null ? _attribData_type : EFFECTS.glContext.FLOAT),
|
|
13179
13200
|
dimension: attribData1.size,
|
|
13180
13201
|
normalize: attribData1.normalize
|
|
13181
13202
|
};
|
|
@@ -13187,16 +13208,16 @@ function createGeometryData(props, subMeshes) {
|
|
|
13187
13208
|
bufferOffset += subBuffer.byteLength;
|
|
13188
13209
|
}
|
|
13189
13210
|
var geometryData = {
|
|
13190
|
-
id:
|
|
13191
|
-
dataType:
|
|
13211
|
+
id: EFFECTS.generateGUID(),
|
|
13212
|
+
dataType: EFFECTS.spec.DataType.Geometry,
|
|
13192
13213
|
vertexData: {
|
|
13193
13214
|
vertexCount: vertexCount,
|
|
13194
13215
|
channels: vertexChannels
|
|
13195
13216
|
},
|
|
13196
13217
|
subMeshes: subMeshes,
|
|
13197
|
-
mode:
|
|
13198
|
-
indexFormat:
|
|
13199
|
-
indexOffset:
|
|
13218
|
+
mode: EFFECTS.spec.GeometryType.TRIANGLES,
|
|
13219
|
+
indexFormat: EFFECTS.spec.IndexFormatType.None,
|
|
13220
|
+
indexOffset: 0,
|
|
13200
13221
|
buffer: ""
|
|
13201
13222
|
};
|
|
13202
13223
|
if (props.indices) {
|
|
@@ -13205,7 +13226,9 @@ function createGeometryData(props, subMeshes) {
|
|
|
13205
13226
|
buffer.set(subBuffer1, bufferOffset);
|
|
13206
13227
|
geometryData.indexOffset = bufferOffset;
|
|
13207
13228
|
if (_instanceof1(indices, Uint32Array)) {
|
|
13208
|
-
geometryData.indexFormat =
|
|
13229
|
+
geometryData.indexFormat = EFFECTS.spec.IndexFormatType.UInt32;
|
|
13230
|
+
} else {
|
|
13231
|
+
geometryData.indexFormat = EFFECTS.spec.IndexFormatType.UInt16;
|
|
13209
13232
|
}
|
|
13210
13233
|
}
|
|
13211
13234
|
geometryData.buffer = toBase64String(buffer);
|
|
@@ -13360,11 +13383,1051 @@ var vertexBufferSemanticMap = {
|
|
|
13360
13383
|
a_Target_Tangent3: "TANGENT_BS3"
|
|
13361
13384
|
};
|
|
13362
13385
|
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13386
|
+
var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
13387
|
+
function LoaderECSImpl(composition) {
|
|
13388
|
+
this.gltfSkins = [];
|
|
13389
|
+
this.gltfMeshs = [];
|
|
13390
|
+
this.gltfLights = [];
|
|
13391
|
+
this.gltfCameras = [];
|
|
13392
|
+
this.gltfImages = [];
|
|
13393
|
+
this.gltfTextures = [];
|
|
13394
|
+
this.gltfMaterials = [];
|
|
13395
|
+
this.gltfAnimations = [];
|
|
13396
|
+
this.gltfImageBasedLights = [];
|
|
13397
|
+
this.timelineAssetId = "";
|
|
13398
|
+
this.images = [];
|
|
13399
|
+
this.imageElements = [];
|
|
13400
|
+
this.textures = [];
|
|
13401
|
+
this.items = [];
|
|
13402
|
+
this.components = [];
|
|
13403
|
+
this.materials = [];
|
|
13404
|
+
this.shaders = [];
|
|
13405
|
+
this.geometries = [];
|
|
13406
|
+
this.animations = [];
|
|
13407
|
+
if (composition) {
|
|
13408
|
+
this.composition = composition;
|
|
13409
|
+
} else {
|
|
13410
|
+
this.timelineAssetId = EFFECTS.generateGUID();
|
|
13411
|
+
this.composition = {
|
|
13412
|
+
id: "1",
|
|
13413
|
+
name: "test1",
|
|
13414
|
+
duration: 9999,
|
|
13415
|
+
endBehavior: EFFECTS.spec.CompositionEndBehavior.restart,
|
|
13416
|
+
camera: {
|
|
13417
|
+
fov: 45,
|
|
13418
|
+
far: 2000,
|
|
13419
|
+
near: 0.001,
|
|
13420
|
+
position: [
|
|
13421
|
+
0,
|
|
13422
|
+
0,
|
|
13423
|
+
8
|
|
13424
|
+
],
|
|
13425
|
+
rotation: [
|
|
13426
|
+
0,
|
|
13427
|
+
0,
|
|
13428
|
+
0
|
|
13429
|
+
],
|
|
13430
|
+
clipMode: EFFECTS.spec.CameraClipMode.portrait
|
|
13431
|
+
},
|
|
13432
|
+
items: [],
|
|
13433
|
+
timelineAsset: {
|
|
13434
|
+
id: this.timelineAssetId
|
|
13435
|
+
},
|
|
13436
|
+
sceneBindings: []
|
|
13437
|
+
};
|
|
13438
|
+
}
|
|
13439
|
+
}
|
|
13440
|
+
var _proto = LoaderECSImpl.prototype;
|
|
13441
|
+
_proto.initial = function initial(engine, options) {
|
|
13442
|
+
this.engine = engine;
|
|
13443
|
+
this.loaderOptions = options != null ? options : {};
|
|
13444
|
+
};
|
|
13445
|
+
_proto.loadScene = function loadScene(options) {
|
|
13446
|
+
var _this = this;
|
|
13447
|
+
return _async_to_generator(function() {
|
|
13448
|
+
var _this_components, _this_components1, _this_components2, _this_items, _options_effects_renderer, gltfResource, gltfScene, component, clips, index;
|
|
13449
|
+
return __generator(this, function(_state) {
|
|
13450
|
+
switch(_state.label){
|
|
13451
|
+
case 0:
|
|
13452
|
+
_this.clear();
|
|
13453
|
+
_this.sceneOptions = options;
|
|
13454
|
+
_this.engine = (_options_effects_renderer = options.effects.renderer) == null ? void 0 : _options_effects_renderer.engine;
|
|
13455
|
+
_this.loaderOptions = {
|
|
13456
|
+
compatibleMode: options.gltf.compatibleMode
|
|
13457
|
+
};
|
|
13458
|
+
gltfResource = options.gltf.resource;
|
|
13459
|
+
if (typeof gltfResource === "string" || _instanceof1(gltfResource, Uint8Array)) {
|
|
13460
|
+
throw new Error("Please load the resource using GLTFTools first.");
|
|
13461
|
+
}
|
|
13462
|
+
_this.images = gltfResource.images.map(function(gltfImage) {
|
|
13463
|
+
var _gltfImage_mimeType;
|
|
13464
|
+
var blob = new Blob([
|
|
13465
|
+
gltfImage.imageData.buffer
|
|
13466
|
+
], {
|
|
13467
|
+
type: (_gltfImage_mimeType = gltfImage.mimeType) != null ? _gltfImage_mimeType : "image/png"
|
|
13468
|
+
});
|
|
13469
|
+
return {
|
|
13470
|
+
id: gltfImage.id,
|
|
13471
|
+
url: URL.createObjectURL(blob)
|
|
13472
|
+
};
|
|
13473
|
+
});
|
|
13474
|
+
return [
|
|
13475
|
+
4,
|
|
13476
|
+
Promise.all(_this.images.map(/*#__PURE__*/ _async_to_generator(function(image) {
|
|
13477
|
+
return __generator(this, function(_state) {
|
|
13478
|
+
return [
|
|
13479
|
+
2,
|
|
13480
|
+
EFFECTS.loadImage(image.url)
|
|
13481
|
+
];
|
|
13482
|
+
});
|
|
13483
|
+
})))
|
|
13484
|
+
];
|
|
13485
|
+
case 1:
|
|
13486
|
+
_this.imageElements = _state.sent();
|
|
13487
|
+
_this.processGLTFResource(gltfResource);
|
|
13488
|
+
_this.gltfScene = gltfResource.scenes[0];
|
|
13489
|
+
_this.gltfSkins = _this.gltfScene.skins;
|
|
13490
|
+
_this.gltfMeshs = gltfResource.meshes;
|
|
13491
|
+
_this.gltfLights = _this.gltfScene.lights;
|
|
13492
|
+
_this.gltfCameras = _this.gltfScene.cameras;
|
|
13493
|
+
_this.gltfImages = gltfResource.images;
|
|
13494
|
+
_this.gltfTextures = gltfResource.textures;
|
|
13495
|
+
_this.gltfMaterials = gltfResource.materials;
|
|
13496
|
+
_this.gltfAnimations = gltfResource.animations;
|
|
13497
|
+
_this.gltfImageBasedLights = gltfResource.imageBasedLights;
|
|
13498
|
+
_this.textures = _this.gltfTextures.map(function(texture) {
|
|
13499
|
+
var textureOptions = texture.textureOptions;
|
|
13500
|
+
var source = textureOptions.source;
|
|
13501
|
+
if (typeof source === "number") {
|
|
13502
|
+
// @ts-expect-error
|
|
13503
|
+
textureOptions.source = {
|
|
13504
|
+
id: _this.images[source].id
|
|
13505
|
+
};
|
|
13506
|
+
}
|
|
13507
|
+
return textureOptions;
|
|
13508
|
+
});
|
|
13509
|
+
_this.materials = _this.gltfMaterials.map(function(material) {
|
|
13510
|
+
return material.materialData;
|
|
13511
|
+
});
|
|
13512
|
+
gltfResource.meshes.forEach(function(mesh) {
|
|
13513
|
+
_this.geometries.push(mesh.geometryData);
|
|
13514
|
+
});
|
|
13515
|
+
gltfScene = gltfResource.scenes[0];
|
|
13516
|
+
gltfScene.meshesComponentData.forEach(function(mesh) {
|
|
13517
|
+
return _this.checkMeshComponentData(mesh, gltfResource);
|
|
13518
|
+
});
|
|
13519
|
+
(_this_components = _this.components).push.apply(_this_components, [].concat(gltfScene.camerasComponentData));
|
|
13520
|
+
(_this_components1 = _this.components).push.apply(_this_components1, [].concat(gltfScene.lightsComponentData));
|
|
13521
|
+
(_this_components2 = _this.components).push.apply(_this_components2, [].concat(gltfScene.meshesComponentData));
|
|
13522
|
+
if (gltfScene.animationsComponentData.length === 1) {
|
|
13523
|
+
component = gltfScene.animationsComponentData[0];
|
|
13524
|
+
if (!options.effects.playAllAnimation && options.effects.playAnimation !== undefined) {
|
|
13525
|
+
clips = component.animationClips;
|
|
13526
|
+
index = options.effects.playAnimation;
|
|
13527
|
+
if (index >= 0 && index < clips.length) {
|
|
13528
|
+
component.animationClips = [
|
|
13529
|
+
clips[index]
|
|
13530
|
+
];
|
|
13531
|
+
} else {
|
|
13532
|
+
component.animationClips = [];
|
|
13533
|
+
}
|
|
13534
|
+
}
|
|
13535
|
+
_this.components.push(component);
|
|
13536
|
+
} else if (gltfScene.animationsComponentData.length > 1) {
|
|
13537
|
+
throw new Error("Find many animation component data " + gltfScene.animationsComponentData.length);
|
|
13538
|
+
}
|
|
13539
|
+
_this.animations = [];
|
|
13540
|
+
_this.gltfAnimations.forEach(function(anim) {
|
|
13541
|
+
_this.animations.push(anim.animationClipData);
|
|
13542
|
+
});
|
|
13543
|
+
_this.items = [];
|
|
13544
|
+
return [
|
|
13545
|
+
4,
|
|
13546
|
+
_this.tryAddSkybox({
|
|
13547
|
+
skyboxType: options.gltf.skyboxType,
|
|
13548
|
+
renderable: options.gltf.skyboxVis
|
|
13549
|
+
})
|
|
13550
|
+
];
|
|
13551
|
+
case 2:
|
|
13552
|
+
_state.sent();
|
|
13553
|
+
(_this_items = _this.items).push.apply(_this_items, [].concat(gltfResource.scenes[0].vfxItemData));
|
|
13554
|
+
_this.items.forEach(function(item) {
|
|
13555
|
+
if (item.type === "root") {
|
|
13556
|
+
item.type = "ECS";
|
|
13557
|
+
}
|
|
13558
|
+
});
|
|
13559
|
+
return [
|
|
13560
|
+
2,
|
|
13561
|
+
_this.getLoadResult()
|
|
13562
|
+
];
|
|
13563
|
+
}
|
|
13564
|
+
});
|
|
13565
|
+
})();
|
|
13566
|
+
};
|
|
13567
|
+
_proto.checkMeshComponentData = function checkMeshComponentData(mesh, resource) {
|
|
13568
|
+
if (mesh.materials.length <= 0) {
|
|
13569
|
+
throw new Error("Submesh array is empty for mesh with ID: " + mesh.id + ".");
|
|
13570
|
+
}
|
|
13571
|
+
var geometryData;
|
|
13572
|
+
resource.meshes.forEach(function(meshData) {
|
|
13573
|
+
if (meshData.geometryData.id === mesh.geometry.id) {
|
|
13574
|
+
geometryData = meshData.geometryData;
|
|
13575
|
+
}
|
|
13576
|
+
});
|
|
13577
|
+
if (geometryData === undefined) {
|
|
13578
|
+
throw new Error("Unable to find geometry data for mesh with ID: " + mesh.geometry.id + ".");
|
|
13579
|
+
}
|
|
13580
|
+
if (geometryData.subMeshes.length !== mesh.materials.length) {
|
|
13581
|
+
throw new Error("Mismatch between submeshes count (" + geometryData.subMeshes.length + ") and materials count (" + mesh.materials.length + ").");
|
|
13582
|
+
}
|
|
13583
|
+
//mesh.materials.length !=
|
|
13584
|
+
};
|
|
13585
|
+
_proto.processGLTFResource = function processGLTFResource(resource) {
|
|
13586
|
+
var _loop = function() {
|
|
13587
|
+
var baseColorId = _step.value;
|
|
13588
|
+
if (emissiveIdSet.has(baseColorId)) {
|
|
13589
|
+
var texData = textures.find(function(tex) {
|
|
13590
|
+
return tex.textureOptions.id === baseColorId;
|
|
13591
|
+
});
|
|
13592
|
+
if (texData) {
|
|
13593
|
+
var newId = EFFECTS.generateGUID();
|
|
13594
|
+
// @ts-expect-error
|
|
13595
|
+
var newTexData = _extends({}, texData);
|
|
13596
|
+
newTexData.textureOptions = _extends({}, texData.textureOptions, {
|
|
13597
|
+
id: newId
|
|
13598
|
+
});
|
|
13599
|
+
textures.push(newTexData);
|
|
13600
|
+
dataMap[newId] = newTexData.textureOptions;
|
|
13601
|
+
textureIdMap[baseColorId] = newId;
|
|
13602
|
+
mapCount += 1;
|
|
13603
|
+
}
|
|
13604
|
+
}
|
|
13605
|
+
};
|
|
13606
|
+
var _this = this;
|
|
13607
|
+
var dataMap = {};
|
|
13608
|
+
var textures = resource.textures, materials = resource.materials, scenes = resource.scenes, imageBasedLights = resource.imageBasedLights;
|
|
13609
|
+
textures.forEach(function(tex) {
|
|
13610
|
+
var texData = tex.textureOptions;
|
|
13611
|
+
var texId = texData.id;
|
|
13612
|
+
if (texId) {
|
|
13613
|
+
if (dataMap[texId]) {
|
|
13614
|
+
console.error("Duplicate GUID found: " + texId + ", old " + dataMap[texId] + ", new " + texData + ".");
|
|
13615
|
+
}
|
|
13616
|
+
dataMap[texId] = texData;
|
|
13617
|
+
} else {
|
|
13618
|
+
console.error("No GUID in texture Data: " + texData + ".");
|
|
13619
|
+
}
|
|
13620
|
+
});
|
|
13621
|
+
var baseColorIdSet = new Set();
|
|
13622
|
+
var emissiveIdSet = new Set();
|
|
13623
|
+
materials.forEach(function(mat) {
|
|
13624
|
+
var _materialData_textures__BaseColorSampler, _materialData_textures__EmissiveSampler;
|
|
13625
|
+
var materialData = mat.materialData;
|
|
13626
|
+
var baseColorTexture = (_materialData_textures__BaseColorSampler = materialData.textures["_BaseColorSampler"]) == null ? void 0 : _materialData_textures__BaseColorSampler.texture;
|
|
13627
|
+
var emissiveTexture = (_materialData_textures__EmissiveSampler = materialData.textures["_EmissiveSampler"]) == null ? void 0 : _materialData_textures__EmissiveSampler.texture;
|
|
13628
|
+
if (baseColorTexture) {
|
|
13629
|
+
baseColorIdSet.add(baseColorTexture.id);
|
|
13630
|
+
}
|
|
13631
|
+
if (emissiveTexture) {
|
|
13632
|
+
emissiveIdSet.add(emissiveTexture.id);
|
|
13633
|
+
}
|
|
13634
|
+
});
|
|
13635
|
+
var mapCount = 0;
|
|
13636
|
+
var textureIdMap = {};
|
|
13637
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(baseColorIdSet), _step; !(_step = _iterator()).done;)_loop();
|
|
13638
|
+
if (mapCount > 0) {
|
|
13639
|
+
console.warn("Duplicate emissive texture " + mapCount);
|
|
13640
|
+
}
|
|
13641
|
+
materials.forEach(function(mat) {
|
|
13642
|
+
var _materialData_shader, _materialData_shader1;
|
|
13643
|
+
var materialData = mat.materialData;
|
|
13644
|
+
_this.processMaterialData(materialData);
|
|
13645
|
+
if (((_materialData_shader = materialData.shader) == null ? void 0 : _materialData_shader.id) === UnlitShaderGUID) {
|
|
13646
|
+
_this.processMaterialTexture(materialData, "_BaseColorSampler", true, dataMap);
|
|
13647
|
+
} else if (((_materialData_shader1 = materialData.shader) == null ? void 0 : _materialData_shader1.id) === PBRShaderGUID) {
|
|
13648
|
+
var _materialData_textures__EmissiveSampler;
|
|
13649
|
+
var emissiveTexture = (_materialData_textures__EmissiveSampler = materialData.textures["_EmissiveSampler"]) == null ? void 0 : _materialData_textures__EmissiveSampler.texture;
|
|
13650
|
+
if (emissiveTexture && textureIdMap[emissiveTexture.id]) {
|
|
13651
|
+
emissiveTexture.id = textureIdMap[emissiveTexture.id];
|
|
13652
|
+
}
|
|
13653
|
+
_this.processMaterialTexture(materialData, "_BaseColorSampler", true, dataMap);
|
|
13654
|
+
_this.processMaterialTexture(materialData, "_MetallicRoughnessSampler", false, dataMap);
|
|
13655
|
+
_this.processMaterialTexture(materialData, "_NormalSampler", false, dataMap);
|
|
13656
|
+
_this.processMaterialTexture(materialData, "_OcclusionSampler", false, dataMap);
|
|
13657
|
+
_this.processMaterialTexture(materialData, "_EmissiveSampler", false, dataMap);
|
|
13658
|
+
}
|
|
13659
|
+
});
|
|
13660
|
+
var gltfScene = scenes[0];
|
|
13661
|
+
gltfScene.camerasComponentData.forEach(function(comp) {
|
|
13662
|
+
return _this.processCameraComponentData(comp);
|
|
13663
|
+
});
|
|
13664
|
+
gltfScene.lightsComponentData.forEach(function(comp) {
|
|
13665
|
+
return _this.processLightComponentData(comp);
|
|
13666
|
+
});
|
|
13667
|
+
gltfScene.meshesComponentData.forEach(function(comp) {
|
|
13668
|
+
return _this.processMeshComponentData(comp);
|
|
13669
|
+
});
|
|
13670
|
+
var cubeTextures = [];
|
|
13671
|
+
imageBasedLights.forEach(function(ibl) {
|
|
13672
|
+
var data = ibl.imageBaseLightData;
|
|
13673
|
+
if (data.reflectionsIntensity === undefined) {
|
|
13674
|
+
data.reflectionsIntensity = data.intensity;
|
|
13675
|
+
}
|
|
13676
|
+
if (data.diffuseImage) {
|
|
13677
|
+
var diffuseTexture = dataMap[data.diffuseImage.id];
|
|
13678
|
+
EFFECTS.addItem(cubeTextures, diffuseTexture);
|
|
13679
|
+
}
|
|
13680
|
+
if (data.specularImage) {
|
|
13681
|
+
var specularImage = dataMap[data.specularImage.id];
|
|
13682
|
+
EFFECTS.addItem(cubeTextures, specularImage);
|
|
13683
|
+
}
|
|
13684
|
+
});
|
|
13685
|
+
cubeTextures.forEach(function(tex) {
|
|
13686
|
+
if (tex.target === EFFECTS.glContext.TEXTURE_CUBE_MAP) {
|
|
13687
|
+
var cube = tex;
|
|
13688
|
+
cube.mipmaps.forEach(function(mipmap) {
|
|
13689
|
+
var ref;
|
|
13690
|
+
ref = [
|
|
13691
|
+
mipmap[5],
|
|
13692
|
+
mipmap[4]
|
|
13693
|
+
], mipmap[4] = ref[0], mipmap[5] = ref[1];
|
|
13694
|
+
});
|
|
13695
|
+
if (cube.mipmaps.length === 1) {
|
|
13696
|
+
cube.minFilter = EFFECTS.glContext.LINEAR;
|
|
13697
|
+
cube.magFilter = EFFECTS.glContext.LINEAR;
|
|
13698
|
+
} else {
|
|
13699
|
+
cube.minFilter = EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
|
|
13700
|
+
cube.magFilter = EFFECTS.glContext.LINEAR;
|
|
13701
|
+
}
|
|
13702
|
+
}
|
|
13703
|
+
});
|
|
13704
|
+
};
|
|
13705
|
+
_proto.processComponentData = function processComponentData(components) {
|
|
13706
|
+
var _this = this;
|
|
13707
|
+
components.forEach(function(comp) {
|
|
13708
|
+
if (comp.dataType === EFFECTS.spec.DataType.LightComponent) {
|
|
13709
|
+
_this.processLightComponentData(comp);
|
|
13710
|
+
} else if (comp.dataType === EFFECTS.spec.DataType.CameraComponent) {
|
|
13711
|
+
_this.processCameraComponentData(comp);
|
|
13712
|
+
} else if (comp.dataType === EFFECTS.spec.DataType.MeshComponent) {
|
|
13713
|
+
_this.processMeshComponentData(comp);
|
|
13714
|
+
} else if (comp.dataType === EFFECTS.spec.DataType.SkyboxComponent) {
|
|
13715
|
+
_this.processSkyboxComponentData(comp);
|
|
13716
|
+
}
|
|
13717
|
+
});
|
|
13718
|
+
};
|
|
13719
|
+
_proto.processLightComponentData = function processLightComponentData(light) {
|
|
13720
|
+
if (!light.color) {
|
|
13721
|
+
light.color = {
|
|
13722
|
+
r: 1,
|
|
13723
|
+
g: 1,
|
|
13724
|
+
b: 1,
|
|
13725
|
+
a: 1
|
|
13726
|
+
};
|
|
13727
|
+
}
|
|
13728
|
+
if (!light.intensity) {
|
|
13729
|
+
light.intensity = 1;
|
|
13730
|
+
}
|
|
13731
|
+
if (light.lightType === EFFECTS.spec.LightType.point) {
|
|
13732
|
+
if (!light.range) {
|
|
13733
|
+
light.range = 0;
|
|
13734
|
+
}
|
|
13735
|
+
} else if (light.lightType === EFFECTS.spec.LightType.spot) {
|
|
13736
|
+
if (!light.range) {
|
|
13737
|
+
light.range = 0;
|
|
13738
|
+
}
|
|
13739
|
+
if (!light.innerConeAngle) {
|
|
13740
|
+
light.innerConeAngle = 0;
|
|
13741
|
+
}
|
|
13742
|
+
if (!light.outerConeAngle) {
|
|
13743
|
+
light.outerConeAngle = Math.PI / 4;
|
|
13744
|
+
}
|
|
13745
|
+
}
|
|
13746
|
+
};
|
|
13747
|
+
_proto.processCameraComponentData = function processCameraComponentData(camera) {
|
|
13748
|
+
if (camera.type === EFFECTS.spec.CameraType.perspective) {
|
|
13749
|
+
if (camera.fov) {
|
|
13750
|
+
camera.fov *= Math.PI / 180;
|
|
13751
|
+
}
|
|
13752
|
+
}
|
|
13753
|
+
};
|
|
13754
|
+
_proto.processMeshComponentData = function processMeshComponentData(mesh) {};
|
|
13755
|
+
_proto.processSkyboxComponentData = function processSkyboxComponentData(skybox) {
|
|
13756
|
+
if (skybox.intensity === undefined) {
|
|
13757
|
+
skybox.intensity = 1;
|
|
13758
|
+
}
|
|
13759
|
+
if (skybox.reflectionsIntensity === undefined) {
|
|
13760
|
+
skybox.reflectionsIntensity = 1;
|
|
13761
|
+
}
|
|
13762
|
+
};
|
|
13763
|
+
_proto.processMaterialData = function processMaterialData(material) {
|
|
13764
|
+
var _material_shader, _material_shader1;
|
|
13765
|
+
if (((_material_shader = material.shader) == null ? void 0 : _material_shader.id) === UnlitShaderGUID) {
|
|
13766
|
+
if (!material.colors["_BaseColorFactor"]) {
|
|
13767
|
+
material.colors["_BaseColorFactor"] = {
|
|
13768
|
+
r: 1,
|
|
13769
|
+
g: 1,
|
|
13770
|
+
b: 1,
|
|
13771
|
+
a: 1
|
|
13772
|
+
};
|
|
13773
|
+
}
|
|
13774
|
+
if (material.floats["_AlphaCutoff"] === undefined) {
|
|
13775
|
+
material.floats["_AlphaCutoff"] = 0;
|
|
13776
|
+
}
|
|
13777
|
+
if (material.floats["ZWrite"] === undefined) {
|
|
13778
|
+
material.floats["ZWrite"] = 1;
|
|
13779
|
+
}
|
|
13780
|
+
if (material.floats["ZTest"] === undefined) {
|
|
13781
|
+
material.floats["ZTest"] = 1;
|
|
13782
|
+
}
|
|
13783
|
+
if (!material.stringTags["RenderType"]) {
|
|
13784
|
+
material.stringTags["RenderType"] = EFFECTS.spec.RenderType.Opaque;
|
|
13785
|
+
}
|
|
13786
|
+
if (!material.stringTags["RenderFace"]) {
|
|
13787
|
+
material.stringTags["RenderFace"] = EFFECTS.spec.RenderFace.Front;
|
|
13788
|
+
}
|
|
13789
|
+
} else if (((_material_shader1 = material.shader) == null ? void 0 : _material_shader1.id) === PBRShaderGUID) {
|
|
13790
|
+
if (!material.colors["_BaseColorFactor"]) {
|
|
13791
|
+
material.colors["_BaseColorFactor"] = {
|
|
13792
|
+
r: 1,
|
|
13793
|
+
g: 1,
|
|
13794
|
+
b: 1,
|
|
13795
|
+
a: 1
|
|
13796
|
+
};
|
|
13797
|
+
}
|
|
13798
|
+
if (material.floats["_SpecularAA"] === undefined) {
|
|
13799
|
+
material.floats["_SpecularAA"] = 0;
|
|
13800
|
+
}
|
|
13801
|
+
if (material.floats["_MetallicFactor"] === undefined) {
|
|
13802
|
+
material.floats["_MetallicFactor"] = 1;
|
|
13803
|
+
}
|
|
13804
|
+
if (material.floats["_RoughnessFactor"] === undefined) {
|
|
13805
|
+
material.floats["_RoughnessFactor"] = 0;
|
|
13806
|
+
}
|
|
13807
|
+
if (material.floats["_NormalScale"] === undefined) {
|
|
13808
|
+
material.floats["_NormalScale"] = 1;
|
|
13809
|
+
}
|
|
13810
|
+
if (material.floats["_OcclusionStrength"] === undefined) {
|
|
13811
|
+
material.floats["_OcclusionStrength"] = this.isTiny3dMode() ? 0 : 1;
|
|
13812
|
+
}
|
|
13813
|
+
if (!material.colors["_EmissiveFactor"]) {
|
|
13814
|
+
material.colors["_EmissiveFactor"] = {
|
|
13815
|
+
r: 0,
|
|
13816
|
+
g: 0,
|
|
13817
|
+
b: 0,
|
|
13818
|
+
a: 1
|
|
13819
|
+
};
|
|
13820
|
+
}
|
|
13821
|
+
if (material.floats["_EmissiveIntensity"] === undefined) {
|
|
13822
|
+
material.floats["_EmissiveIntensity"] = 1;
|
|
13823
|
+
}
|
|
13824
|
+
if (material.floats["_AlphaCutoff"] === undefined) {
|
|
13825
|
+
material.floats["_AlphaCutoff"] = 0;
|
|
13826
|
+
}
|
|
13827
|
+
if (material.floats["ZWrite"] === undefined) {
|
|
13828
|
+
material.floats["ZWrite"] = 1;
|
|
13829
|
+
}
|
|
13830
|
+
if (material.floats["ZTest"] === undefined) {
|
|
13831
|
+
material.floats["ZTest"] = 1;
|
|
13832
|
+
}
|
|
13833
|
+
if (!material.stringTags["RenderType"]) {
|
|
13834
|
+
material.stringTags["RenderType"] = EFFECTS.spec.RenderType.Opaque;
|
|
13835
|
+
}
|
|
13836
|
+
if (!material.stringTags["RenderFace"]) {
|
|
13837
|
+
material.stringTags["RenderFace"] = EFFECTS.spec.RenderFace.Front;
|
|
13838
|
+
}
|
|
13839
|
+
} else {
|
|
13840
|
+
console.error("Encountered unknown shader ID in material with ID: " + material.id + ".");
|
|
13841
|
+
}
|
|
13842
|
+
};
|
|
13843
|
+
_proto.processTextureOptions = function processTextureOptions(options, isBaseColor, image) {
|
|
13844
|
+
var premultiplyAlpha = false;
|
|
13845
|
+
var _options_minFilter;
|
|
13846
|
+
var minFilter = (_options_minFilter = options.minFilter) != null ? _options_minFilter : EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
|
|
13847
|
+
if (this.isTiny3dMode()) {
|
|
13848
|
+
minFilter = EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
|
|
13849
|
+
if (image) {
|
|
13850
|
+
if (!WebGLHelper.isPow2(image.width) || !WebGLHelper.isPow2(image.height)) {
|
|
13851
|
+
minFilter = EFFECTS.glContext.LINEAR;
|
|
13852
|
+
}
|
|
13853
|
+
}
|
|
13854
|
+
premultiplyAlpha = isBaseColor ? false : true;
|
|
13855
|
+
}
|
|
13856
|
+
var generateMipmap = minFilter == EFFECTS.glContext.NEAREST_MIPMAP_NEAREST || minFilter == EFFECTS.glContext.LINEAR_MIPMAP_NEAREST || minFilter == EFFECTS.glContext.NEAREST_MIPMAP_LINEAR || minFilter == EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
|
|
13857
|
+
var _options_wrapS;
|
|
13858
|
+
options.wrapS = (_options_wrapS = options.wrapS) != null ? _options_wrapS : EFFECTS.glContext.REPEAT;
|
|
13859
|
+
var _options_wrapT;
|
|
13860
|
+
options.wrapT = (_options_wrapT = options.wrapT) != null ? _options_wrapT : EFFECTS.glContext.REPEAT;
|
|
13861
|
+
var _options_magFilter;
|
|
13862
|
+
options.magFilter = (_options_magFilter = options.magFilter) != null ? _options_magFilter : EFFECTS.glContext.LINEAR;
|
|
13863
|
+
options.minFilter = minFilter;
|
|
13864
|
+
options.anisotropic = 1;
|
|
13865
|
+
options.premultiplyAlpha = premultiplyAlpha;
|
|
13866
|
+
options.generateMipmap = generateMipmap;
|
|
13867
|
+
};
|
|
13868
|
+
_proto.processMaterialTexture = function processMaterialTexture(material, textureName, isBaseColor, dataMap) {
|
|
13869
|
+
var texture = material.textures[textureName];
|
|
13870
|
+
if (texture) {
|
|
13871
|
+
var id = texture.texture.id;
|
|
13872
|
+
var texData = dataMap[id];
|
|
13873
|
+
var imageObj;
|
|
13874
|
+
// @ts-expect-error
|
|
13875
|
+
if (typeof texData.source !== "number") {
|
|
13876
|
+
// @ts-expect-error
|
|
13877
|
+
throw new Error("Invalid texture option source data, " + texData.source);
|
|
13878
|
+
} else {
|
|
13879
|
+
// @ts-expect-error
|
|
13880
|
+
imageObj = this.imageElements[texData.source];
|
|
13881
|
+
}
|
|
13882
|
+
if (texData) {
|
|
13883
|
+
this.processTextureOptions(texData, isBaseColor, imageObj);
|
|
13884
|
+
}
|
|
13885
|
+
}
|
|
13886
|
+
};
|
|
13887
|
+
_proto.getLoadResult = function getLoadResult() {
|
|
13888
|
+
var itemIds = [];
|
|
13889
|
+
this.items.forEach(function(item) {
|
|
13890
|
+
return itemIds.push({
|
|
13891
|
+
id: item.id
|
|
13892
|
+
});
|
|
13893
|
+
});
|
|
13894
|
+
this.composition.items = itemIds;
|
|
13895
|
+
var jsonScene = {
|
|
13896
|
+
version: "3.0",
|
|
13897
|
+
playerVersion: {
|
|
13898
|
+
web: "2.0",
|
|
13899
|
+
native: "2.0"
|
|
13900
|
+
},
|
|
13901
|
+
type: "ge",
|
|
13902
|
+
compositionId: this.composition.id,
|
|
13903
|
+
compositions: [
|
|
13904
|
+
this.composition
|
|
13905
|
+
],
|
|
13906
|
+
images: this.images,
|
|
13907
|
+
shapes: [],
|
|
13908
|
+
plugins: [
|
|
13909
|
+
"model"
|
|
13910
|
+
],
|
|
13911
|
+
textures: this.textures,
|
|
13912
|
+
items: this.items,
|
|
13913
|
+
components: this.components,
|
|
13914
|
+
materials: this.materials,
|
|
13915
|
+
shaders: this.shaders,
|
|
13916
|
+
geometries: this.geometries,
|
|
13917
|
+
animations: this.animations,
|
|
13918
|
+
miscs: [
|
|
13919
|
+
{
|
|
13920
|
+
id: this.timelineAssetId,
|
|
13921
|
+
dataType: EFFECTS.spec.DataType.TimelineAsset
|
|
13922
|
+
}
|
|
13923
|
+
]
|
|
13924
|
+
};
|
|
13925
|
+
return {
|
|
13926
|
+
source: this.getRemarkString(),
|
|
13927
|
+
jsonScene: jsonScene,
|
|
13928
|
+
sceneAABB: {
|
|
13929
|
+
min: [
|
|
13930
|
+
-1,
|
|
13931
|
+
-1,
|
|
13932
|
+
-1
|
|
13933
|
+
],
|
|
13934
|
+
max: [
|
|
13935
|
+
1,
|
|
13936
|
+
1,
|
|
13937
|
+
1
|
|
13938
|
+
]
|
|
13939
|
+
}
|
|
13940
|
+
};
|
|
13941
|
+
};
|
|
13942
|
+
_proto.addLight = function addLight(data) {
|
|
13943
|
+
var itemId = EFFECTS.generateGUID();
|
|
13944
|
+
var component = {
|
|
13945
|
+
id: EFFECTS.generateGUID(),
|
|
13946
|
+
item: {
|
|
13947
|
+
id: itemId
|
|
13948
|
+
},
|
|
13949
|
+
dataType: EFFECTS.spec.DataType.LightComponent,
|
|
13950
|
+
//
|
|
13951
|
+
lightType: data.lightType,
|
|
13952
|
+
color: data.color,
|
|
13953
|
+
intensity: data.intensity,
|
|
13954
|
+
range: data.range,
|
|
13955
|
+
innerConeAngle: data.innerConeAngle,
|
|
13956
|
+
outerConeAngle: data.outerConeAngle
|
|
13957
|
+
};
|
|
13958
|
+
var item = {
|
|
13959
|
+
id: itemId,
|
|
13960
|
+
name: data.name,
|
|
13961
|
+
duration: data.duration,
|
|
13962
|
+
type: EFFECTS.spec.ItemType.light,
|
|
13963
|
+
pn: 0,
|
|
13964
|
+
visible: true,
|
|
13965
|
+
endBehavior: data.endBehavior,
|
|
13966
|
+
transform: {
|
|
13967
|
+
position: {
|
|
13968
|
+
x: data.position[0],
|
|
13969
|
+
y: data.position[1],
|
|
13970
|
+
z: data.position[2]
|
|
13971
|
+
},
|
|
13972
|
+
eulerHint: {
|
|
13973
|
+
x: data.rotation[0],
|
|
13974
|
+
y: data.rotation[1],
|
|
13975
|
+
z: data.rotation[2]
|
|
13976
|
+
},
|
|
13977
|
+
scale: {
|
|
13978
|
+
x: data.scale[0],
|
|
13979
|
+
y: data.scale[1],
|
|
13980
|
+
z: data.scale[2]
|
|
13981
|
+
}
|
|
13982
|
+
},
|
|
13983
|
+
components: [
|
|
13984
|
+
{
|
|
13985
|
+
id: component.id
|
|
13986
|
+
}
|
|
13987
|
+
],
|
|
13988
|
+
content: {},
|
|
13989
|
+
dataType: EFFECTS.spec.DataType.VFXItemData
|
|
13990
|
+
};
|
|
13991
|
+
this.items.push(item);
|
|
13992
|
+
this.components.push(component);
|
|
13993
|
+
};
|
|
13994
|
+
_proto.addCamera = function addCamera(camera) {
|
|
13995
|
+
var itemId = EFFECTS.generateGUID();
|
|
13996
|
+
var component = {
|
|
13997
|
+
id: EFFECTS.generateGUID(),
|
|
13998
|
+
item: {
|
|
13999
|
+
id: itemId
|
|
14000
|
+
},
|
|
14001
|
+
dataType: EFFECTS.spec.DataType.CameraComponent,
|
|
14002
|
+
fov: camera.fov,
|
|
14003
|
+
near: camera.near,
|
|
14004
|
+
far: camera.far,
|
|
14005
|
+
clipMode: camera.clipMode
|
|
14006
|
+
};
|
|
14007
|
+
var item = {
|
|
14008
|
+
id: itemId,
|
|
14009
|
+
name: camera.name,
|
|
14010
|
+
duration: camera.duration,
|
|
14011
|
+
// @ts-expect-error
|
|
14012
|
+
type: "camera",
|
|
14013
|
+
pn: 0,
|
|
14014
|
+
visible: true,
|
|
14015
|
+
endBehavior: camera.endBehavior,
|
|
14016
|
+
transform: {
|
|
14017
|
+
position: {
|
|
14018
|
+
x: camera.position[0],
|
|
14019
|
+
y: camera.position[1],
|
|
14020
|
+
z: camera.position[2]
|
|
14021
|
+
},
|
|
14022
|
+
eulerHint: {
|
|
14023
|
+
x: camera.rotation[0],
|
|
14024
|
+
y: camera.rotation[1],
|
|
14025
|
+
z: camera.rotation[2]
|
|
14026
|
+
},
|
|
14027
|
+
scale: {
|
|
14028
|
+
x: 1,
|
|
14029
|
+
y: 1,
|
|
14030
|
+
z: 1
|
|
14031
|
+
}
|
|
14032
|
+
},
|
|
14033
|
+
components: [
|
|
14034
|
+
{
|
|
14035
|
+
id: component.id
|
|
14036
|
+
}
|
|
14037
|
+
],
|
|
14038
|
+
content: {},
|
|
14039
|
+
dataType: EFFECTS.spec.DataType.VFXItemData
|
|
14040
|
+
};
|
|
14041
|
+
this.items.push(item);
|
|
14042
|
+
this.components.push(component);
|
|
14043
|
+
};
|
|
14044
|
+
_proto.tryAddSkybox = function tryAddSkybox(skybox) {
|
|
14045
|
+
var _this = this;
|
|
14046
|
+
return _async_to_generator(function() {
|
|
14047
|
+
var ibl, _this_images, // @ts-expect-error
|
|
14048
|
+
_this_textures, itemId, skyboxInfo, imageList, textureOptionsList, component, _skybox_renderable, _skybox_duration, item;
|
|
14049
|
+
return __generator(this, function(_state) {
|
|
14050
|
+
if (_this.gltfImageBasedLights.length > 0 && !_this.ignoreSkybox()) {
|
|
14051
|
+
ibl = _this.gltfImageBasedLights[0];
|
|
14052
|
+
_this.components.push(ibl.imageBaseLightData);
|
|
14053
|
+
} else if (skybox.skyboxType !== undefined) {
|
|
14054
|
+
itemId = EFFECTS.generateGUID();
|
|
14055
|
+
skyboxInfo = _this.createSkyboxComponentData(skybox.skyboxType);
|
|
14056
|
+
imageList = skyboxInfo.imageList, textureOptionsList = skyboxInfo.textureOptionsList, component = skyboxInfo.component;
|
|
14057
|
+
component.item.id = itemId;
|
|
14058
|
+
if (skybox.intensity !== undefined) {
|
|
14059
|
+
component.intensity = skybox.intensity;
|
|
14060
|
+
}
|
|
14061
|
+
if (skybox.reflectionsIntensity !== undefined) {
|
|
14062
|
+
component.reflectionsIntensity = skybox.reflectionsIntensity;
|
|
14063
|
+
}
|
|
14064
|
+
component.renderable = (_skybox_renderable = skybox.renderable) != null ? _skybox_renderable : false;
|
|
14065
|
+
item = {
|
|
14066
|
+
id: itemId,
|
|
14067
|
+
name: "Skybox-" + skybox.skyboxType,
|
|
14068
|
+
duration: (_skybox_duration = skybox.duration) != null ? _skybox_duration : 999,
|
|
14069
|
+
type: EFFECTS.spec.ItemType.skybox,
|
|
14070
|
+
pn: 0,
|
|
14071
|
+
visible: true,
|
|
14072
|
+
endBehavior: EFFECTS.spec.ItemEndBehavior.freeze,
|
|
14073
|
+
transform: {
|
|
14074
|
+
position: {
|
|
14075
|
+
x: 0,
|
|
14076
|
+
y: 0,
|
|
14077
|
+
z: 0
|
|
14078
|
+
},
|
|
14079
|
+
eulerHint: {
|
|
14080
|
+
x: 0,
|
|
14081
|
+
y: 0,
|
|
14082
|
+
z: 0
|
|
14083
|
+
},
|
|
14084
|
+
scale: {
|
|
14085
|
+
x: 1,
|
|
14086
|
+
y: 1,
|
|
14087
|
+
z: 1
|
|
14088
|
+
}
|
|
14089
|
+
},
|
|
14090
|
+
components: [
|
|
14091
|
+
{
|
|
14092
|
+
id: component.id
|
|
14093
|
+
}
|
|
14094
|
+
],
|
|
14095
|
+
content: {},
|
|
14096
|
+
dataType: EFFECTS.spec.DataType.VFXItemData
|
|
14097
|
+
};
|
|
14098
|
+
(_this_images = _this.images).push.apply(_this_images, [].concat(imageList));
|
|
14099
|
+
(_this_textures = _this.textures).push.apply(_this_textures, [].concat(textureOptionsList));
|
|
14100
|
+
_this.items.push(item);
|
|
14101
|
+
_this.components.push(component);
|
|
14102
|
+
}
|
|
14103
|
+
return [
|
|
14104
|
+
2
|
|
14105
|
+
];
|
|
14106
|
+
});
|
|
14107
|
+
})();
|
|
14108
|
+
};
|
|
14109
|
+
_proto.createTreeOptions = function createTreeOptions(scene) {
|
|
14110
|
+
var nodeList = scene.nodes.map(function(node, nodeIndex) {
|
|
14111
|
+
var children = node.children.map(function(child) {
|
|
14112
|
+
if (child.nodeIndex === undefined) {
|
|
14113
|
+
throw new Error("Undefined nodeIndex for child " + child + ".");
|
|
14114
|
+
}
|
|
14115
|
+
return child.nodeIndex;
|
|
14116
|
+
});
|
|
14117
|
+
var pos = [
|
|
14118
|
+
0,
|
|
14119
|
+
0,
|
|
14120
|
+
0
|
|
14121
|
+
];
|
|
14122
|
+
var quat = [
|
|
14123
|
+
0,
|
|
14124
|
+
0,
|
|
14125
|
+
0,
|
|
14126
|
+
0
|
|
14127
|
+
];
|
|
14128
|
+
var scale = [
|
|
14129
|
+
0,
|
|
14130
|
+
0,
|
|
14131
|
+
0
|
|
14132
|
+
];
|
|
14133
|
+
if (node.matrix !== undefined) {
|
|
14134
|
+
if (node.matrix.length !== 16) {
|
|
14135
|
+
throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node + ".");
|
|
14136
|
+
}
|
|
14137
|
+
var mat = Matrix4.fromArray(node.matrix);
|
|
14138
|
+
var transform = mat.getTransform();
|
|
14139
|
+
pos = transform.translation.toArray();
|
|
14140
|
+
quat = transform.rotation.toArray();
|
|
14141
|
+
scale = transform.scale.toArray();
|
|
14142
|
+
} else {
|
|
14143
|
+
if (node.translation !== undefined) {
|
|
14144
|
+
pos = node.translation;
|
|
14145
|
+
}
|
|
14146
|
+
if (node.rotation !== undefined) {
|
|
14147
|
+
quat = node.rotation;
|
|
14148
|
+
}
|
|
14149
|
+
if (node.scale !== undefined) {
|
|
14150
|
+
scale = node.scale;
|
|
14151
|
+
}
|
|
14152
|
+
}
|
|
14153
|
+
node.nodeIndex = nodeIndex;
|
|
14154
|
+
var treeNode = {
|
|
14155
|
+
name: node.name,
|
|
14156
|
+
transform: {
|
|
14157
|
+
position: pos,
|
|
14158
|
+
quat: quat,
|
|
14159
|
+
scale: scale
|
|
14160
|
+
},
|
|
14161
|
+
children: children,
|
|
14162
|
+
id: "" + node.nodeIndex
|
|
14163
|
+
};
|
|
14164
|
+
return treeNode;
|
|
14165
|
+
});
|
|
14166
|
+
var rootNodes = scene.rootNodes.map(function(root) {
|
|
14167
|
+
if (root.nodeIndex === undefined) {
|
|
14168
|
+
throw new Error("Undefined nodeIndex for root " + root + ".");
|
|
14169
|
+
}
|
|
14170
|
+
return root.nodeIndex;
|
|
14171
|
+
});
|
|
14172
|
+
var treeOptions = {
|
|
14173
|
+
nodes: nodeList,
|
|
14174
|
+
children: rootNodes,
|
|
14175
|
+
animation: -1,
|
|
14176
|
+
animations: []
|
|
14177
|
+
};
|
|
14178
|
+
return treeOptions;
|
|
14179
|
+
};
|
|
14180
|
+
_proto.createAnimations = function createAnimations(animations) {
|
|
14181
|
+
return animations.map(function(anim) {
|
|
14182
|
+
var tracks = anim.channels.map(function(channel) {
|
|
14183
|
+
var track = {
|
|
14184
|
+
input: channel.input.array,
|
|
14185
|
+
output: channel.output.array,
|
|
14186
|
+
node: channel.target.node,
|
|
14187
|
+
path: channel.target.path,
|
|
14188
|
+
interpolation: channel.interpolation
|
|
14189
|
+
};
|
|
14190
|
+
return track;
|
|
14191
|
+
});
|
|
14192
|
+
var newAnim = {
|
|
14193
|
+
name: anim.name,
|
|
14194
|
+
tracks: tracks
|
|
14195
|
+
};
|
|
14196
|
+
return newAnim;
|
|
14197
|
+
});
|
|
14198
|
+
};
|
|
14199
|
+
_proto.createTexture2D = function createTexture2D(image, texture, isBaseColor) {
|
|
14200
|
+
return WebGLHelper.createTexture2D(this.engine, image, texture, isBaseColor, this.isTiny3dMode());
|
|
14201
|
+
};
|
|
14202
|
+
_proto.createSkyboxComponentData = function createSkyboxComponentData(typeName) {
|
|
14203
|
+
if (typeName !== "NFT" && typeName !== "FARM") {
|
|
14204
|
+
throw new Error("Invalid skybox type specified: '" + typeName + "'. Valid types are: 'NFT', 'FARM'.");
|
|
14205
|
+
}
|
|
14206
|
+
//
|
|
14207
|
+
var typ = typeName === "NFT" ? exports.PSkyboxType.NFT : exports.PSkyboxType.FARM;
|
|
14208
|
+
var params = PSkyboxCreator.getSkyboxParams(typ);
|
|
14209
|
+
return PSkyboxCreator.createSkyboxComponentData(this.engine, params);
|
|
14210
|
+
};
|
|
14211
|
+
_proto.scaleColorVal = function scaleColorVal(val, fromGLTF) {
|
|
14212
|
+
return fromGLTF ? LoaderHelper.scaleTo255(val) : LoaderHelper.scaleTo1(val);
|
|
14213
|
+
};
|
|
14214
|
+
_proto.scaleColorVec = function scaleColorVec(vec, fromGLTF) {
|
|
14215
|
+
var _this = this;
|
|
14216
|
+
return vec.map(function(val) {
|
|
14217
|
+
return _this.scaleColorVal(val, fromGLTF);
|
|
14218
|
+
});
|
|
14219
|
+
};
|
|
14220
|
+
_proto.createLightOptions = function createLightOptions(light) {
|
|
14221
|
+
return PluginHelper.createLightOptions(light);
|
|
14222
|
+
};
|
|
14223
|
+
_proto.createCameraOptions = function createCameraOptions(camera) {
|
|
14224
|
+
var _PluginHelper_createCameraOptions;
|
|
14225
|
+
return (_PluginHelper_createCameraOptions = PluginHelper.createCameraOptions(camera)) != null ? _PluginHelper_createCameraOptions : {
|
|
14226
|
+
fov: 45,
|
|
14227
|
+
far: 1000,
|
|
14228
|
+
near: 0.01,
|
|
14229
|
+
clipMode: EFFECTS.spec.CameraClipMode.portrait
|
|
14230
|
+
};
|
|
14231
|
+
};
|
|
14232
|
+
_proto.clear = function clear() {
|
|
14233
|
+
this.images = [];
|
|
14234
|
+
this.textures = [];
|
|
14235
|
+
this.items = [];
|
|
14236
|
+
this.components = [];
|
|
14237
|
+
this.materials = [];
|
|
14238
|
+
this.shaders = [];
|
|
14239
|
+
this.geometries = [];
|
|
14240
|
+
};
|
|
14241
|
+
/**
|
|
14242
|
+
* 按照传入的动画播放参数,计算需要播放的动画索引
|
|
14243
|
+
*
|
|
14244
|
+
* @param treeOptions 节点树属性,需要初始化animations列表。
|
|
14245
|
+
* @returns 返回计算的动画索引,-1表示没有动画需要播放,-88888888表示播放所有动画。
|
|
14246
|
+
*/ _proto.getPlayAnimationIndex = function getPlayAnimationIndex(treeOptions) {
|
|
14247
|
+
var animations = treeOptions.animations;
|
|
14248
|
+
if (animations === undefined || animations.length <= 0) {
|
|
14249
|
+
// 硬编码,内部指定的不播放动画的索引值
|
|
14250
|
+
return -1;
|
|
14251
|
+
}
|
|
14252
|
+
if (this.isPlayAllAnimation()) {
|
|
14253
|
+
// 硬编码,内部指定的播放全部动画的索引值
|
|
14254
|
+
return -88888888;
|
|
14255
|
+
}
|
|
14256
|
+
var animationInfo = this.sceneOptions.effects.playAnimation;
|
|
14257
|
+
if (animationInfo === undefined) {
|
|
14258
|
+
return -1;
|
|
14259
|
+
}
|
|
14260
|
+
if (typeof animationInfo === "number") {
|
|
14261
|
+
if (animationInfo >= 0 && animationInfo < animations.length) {
|
|
14262
|
+
return animationInfo;
|
|
14263
|
+
} else {
|
|
14264
|
+
return -1;
|
|
14265
|
+
}
|
|
14266
|
+
} else {
|
|
14267
|
+
// typeof animationInfo === 'string'
|
|
14268
|
+
var animationIndex = -1;
|
|
14269
|
+
// 通过动画名字查找动画索引
|
|
14270
|
+
animations.forEach(function(anim, index) {
|
|
14271
|
+
if (anim.name === animationInfo) {
|
|
14272
|
+
animationIndex = index;
|
|
14273
|
+
}
|
|
14274
|
+
});
|
|
14275
|
+
return animationIndex;
|
|
14276
|
+
}
|
|
14277
|
+
};
|
|
14278
|
+
_proto.isPlayAnimation = function isPlayAnimation() {
|
|
14279
|
+
return this.sceneOptions.effects.playAnimation !== undefined;
|
|
14280
|
+
};
|
|
14281
|
+
_proto.isPlayAllAnimation = function isPlayAllAnimation() {
|
|
14282
|
+
return this.sceneOptions.effects.playAllAnimation === true;
|
|
14283
|
+
};
|
|
14284
|
+
_proto.getRemarkString = function getRemarkString() {
|
|
14285
|
+
var remark = this.sceneOptions.gltf.remark;
|
|
14286
|
+
if (remark === undefined) {
|
|
14287
|
+
return "Unknown";
|
|
14288
|
+
} else if (typeof remark === "string") {
|
|
14289
|
+
return remark;
|
|
14290
|
+
} else {
|
|
14291
|
+
return "BinaryBuffer";
|
|
14292
|
+
}
|
|
14293
|
+
};
|
|
14294
|
+
_proto.getCompositionDuration = function getCompositionDuration() {
|
|
14295
|
+
return this.composition.duration;
|
|
14296
|
+
};
|
|
14297
|
+
_proto.isTiny3dMode = function isTiny3dMode() {
|
|
14298
|
+
return this.loaderOptions.compatibleMode === "tiny3d";
|
|
14299
|
+
};
|
|
14300
|
+
_proto.getItemDuration = function getItemDuration() {
|
|
14301
|
+
var _this_sceneOptions_effects_duration;
|
|
14302
|
+
return (_this_sceneOptions_effects_duration = this.sceneOptions.effects.duration) != null ? _this_sceneOptions_effects_duration : 9999;
|
|
14303
|
+
};
|
|
14304
|
+
_proto.getItemEndBehavior = function getItemEndBehavior() {
|
|
14305
|
+
var _this_sceneOptions_effects_endBehavior;
|
|
14306
|
+
return (_this_sceneOptions_effects_endBehavior = this.sceneOptions.effects.endBehavior) != null ? _this_sceneOptions_effects_endBehavior : EFFECTS.spec.ItemEndBehavior.loop;
|
|
14307
|
+
};
|
|
14308
|
+
_proto.getSkyboxType = function getSkyboxType() {
|
|
14309
|
+
var typeName = this.sceneOptions.gltf.skyboxType;
|
|
14310
|
+
switch(typeName){
|
|
14311
|
+
case "NFT":
|
|
14312
|
+
return exports.PSkyboxType.NFT;
|
|
14313
|
+
case "FARM":
|
|
14314
|
+
return exports.PSkyboxType.FARM;
|
|
14315
|
+
}
|
|
14316
|
+
};
|
|
14317
|
+
_proto.isSkyboxVis = function isSkyboxVis() {
|
|
14318
|
+
return this.sceneOptions.gltf.skyboxVis === true;
|
|
14319
|
+
};
|
|
14320
|
+
_proto.ignoreSkybox = function ignoreSkybox() {
|
|
14321
|
+
return this.sceneOptions.gltf.ignoreSkybox === true;
|
|
14322
|
+
};
|
|
14323
|
+
_proto.isEnvironmentTest = function isEnvironmentTest() {
|
|
14324
|
+
if (typeof this.sceneOptions.gltf.remark === "string") {
|
|
14325
|
+
return this.sceneOptions.gltf.remark.includes("EnvironmentTest");
|
|
14326
|
+
} else {
|
|
14327
|
+
return false;
|
|
14328
|
+
}
|
|
14329
|
+
};
|
|
14330
|
+
return LoaderECSImpl;
|
|
14331
|
+
}();
|
|
14332
|
+
var globalLoader;
|
|
14333
|
+
function getDefaultEffectsGLTFLoaderECS(engine, options) {
|
|
14334
|
+
if (!globalLoader) {
|
|
14335
|
+
globalLoader = new LoaderECSImpl();
|
|
14336
|
+
}
|
|
14337
|
+
globalLoader.initial(engine, options);
|
|
14338
|
+
return globalLoader;
|
|
14339
|
+
}
|
|
14340
|
+
function setDefaultEffectsGLTFLoaderECS(loader) {
|
|
14341
|
+
globalLoader = loader;
|
|
14342
|
+
}
|
|
14343
|
+
function getPBRShaderProperties() {
|
|
14344
|
+
return '\n _BaseColorSampler ("基础贴图", 2D) = "" {}\n _BaseColorFactor ("基础颜色", Color) = (1, 1, 1, 1)\n _MetallicRoughnessSampler ("金属贴图", 2D) = "" {}\n _MetallicFactor ("金属度", Range(0, 1)) = 1\n _RoughnessFactor ("粗糙度", Range(0, 1)) = 1\n [Toggle] _SpecularAA ("高光抗锯齿", Float) = 0\n _NormalSampler ("法线贴图", 2D) = "" {}\n _NormalScale ("法线贴图强度", Range(0, 2)) = 1\n _OcclusionSampler ("AO贴图", 2D) = "" {}\n _OcclusionStrength ("AO贴图强度", Range(0, 1)) = 1\n _EmissiveSampler ("自发光贴图", 2D) = "" {}\n _EmissiveIntensity ("自发光贴图强度", Float) = 1\n _EmissiveFactor ("自发光颜色", Color) = (0, 0, 0, 1)\n _AlphaCutoff ("Alpha裁剪值", Range(0, 1)) = 0.5\n ';
|
|
14345
|
+
}
|
|
14346
|
+
function getUnlitShaderProperties() {
|
|
14347
|
+
return '\n _BaseColorSampler ("基础贴图", 2D) = "" {}\n _BaseColorFactor ("基础颜色", Color) = (1, 1, 1, 1)\n _AlphaCutoff ("Alpha裁剪值", Range(0, 1)) = 0.5\n ';
|
|
14348
|
+
}
|
|
14349
|
+
function getDefaultPBRMaterialData() {
|
|
14350
|
+
var material = {
|
|
14351
|
+
"id": "00000000000000000000000000000000",
|
|
14352
|
+
"name": "PBR Material",
|
|
14353
|
+
"dataType": EFFECTS.spec.DataType.Material,
|
|
14354
|
+
"stringTags": {
|
|
14355
|
+
"RenderType": EFFECTS.spec.RenderType.Opaque,
|
|
14356
|
+
"RenderFace": "Front"
|
|
14357
|
+
},
|
|
14358
|
+
"macros": [],
|
|
14359
|
+
"shader": {
|
|
14360
|
+
"id": "pbr00000000000000000000000000000"
|
|
14361
|
+
},
|
|
14362
|
+
"ints": {},
|
|
14363
|
+
"floats": {
|
|
14364
|
+
"ZWrite": 1,
|
|
14365
|
+
"ZTest": 1,
|
|
14366
|
+
"_SpecularAA": 0,
|
|
14367
|
+
"_MetallicFactor": 1,
|
|
14368
|
+
"_RoughnessFactor": 0.0,
|
|
14369
|
+
"_NormalScale": 1,
|
|
14370
|
+
"_OcclusionStrength": 1,
|
|
14371
|
+
"_EmissiveIntensity": 1,
|
|
14372
|
+
"_AlphaCutoff": 0.5
|
|
14373
|
+
},
|
|
14374
|
+
"vector4s": {},
|
|
14375
|
+
"colors": {
|
|
14376
|
+
"_BaseColorFactor": {
|
|
14377
|
+
"r": 1,
|
|
14378
|
+
"g": 1,
|
|
14379
|
+
"b": 1,
|
|
14380
|
+
"a": 1
|
|
14381
|
+
},
|
|
14382
|
+
"_EmissiveFactor": {
|
|
14383
|
+
"r": 0,
|
|
14384
|
+
"g": 0,
|
|
14385
|
+
"b": 0,
|
|
14386
|
+
"a": 1
|
|
14387
|
+
}
|
|
14388
|
+
},
|
|
14389
|
+
"textures": {}
|
|
14390
|
+
};
|
|
14391
|
+
return material;
|
|
14392
|
+
}
|
|
14393
|
+
function getDefaultUnlitMaterialData() {
|
|
14394
|
+
var material = {
|
|
14395
|
+
"id": "00000000000000000000000000000000",
|
|
14396
|
+
"name": "Unlit Material",
|
|
14397
|
+
"dataType": EFFECTS.spec.DataType.Material,
|
|
14398
|
+
"stringTags": {
|
|
14399
|
+
"ZWrite": "true",
|
|
14400
|
+
"ZTest": "true",
|
|
14401
|
+
"RenderType": EFFECTS.spec.RenderType.Opaque,
|
|
14402
|
+
"Cull": "Front"
|
|
14403
|
+
},
|
|
14404
|
+
"macros": [],
|
|
14405
|
+
"shader": {
|
|
14406
|
+
"id": "unlit000000000000000000000000000"
|
|
14407
|
+
},
|
|
14408
|
+
"ints": {},
|
|
14409
|
+
"floats": {
|
|
14410
|
+
"_AlphaCutoff": 0.5
|
|
14411
|
+
},
|
|
14412
|
+
"vector4s": {},
|
|
14413
|
+
"colors": {
|
|
14414
|
+
"_BaseColorFactor": {
|
|
14415
|
+
"r": 1,
|
|
14416
|
+
"g": 1,
|
|
14417
|
+
"b": 1,
|
|
14418
|
+
"a": 1
|
|
14419
|
+
}
|
|
14420
|
+
},
|
|
14421
|
+
"textures": {}
|
|
14422
|
+
};
|
|
14423
|
+
return material;
|
|
14424
|
+
}
|
|
14425
|
+
|
|
14426
|
+
EFFECTS.registerPlugin("tree", ModelTreePlugin, EFFECTS.VFXItem, true);
|
|
14427
|
+
EFFECTS.registerPlugin("model", ModelPlugin, EFFECTS.VFXItem);
|
|
14428
|
+
var version = "2.0.0-alpha.19";
|
|
14429
|
+
EFFECTS.logger.info("Plugin model version: " + version + ".");
|
|
14430
|
+
if (version !== EFFECTS__namespace.version) {
|
|
13368
14431
|
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!");
|
|
13369
14432
|
}
|
|
13370
14433
|
|
|
@@ -13385,6 +14448,7 @@ exports.HitTestingProxy = HitTestingProxy;
|
|
|
13385
14448
|
exports.HookOGLFunc = HookOGLFunc;
|
|
13386
14449
|
exports.InterpolationSampler = InterpolationSampler;
|
|
13387
14450
|
exports.JSONConverter = JSONConverter;
|
|
14451
|
+
exports.LoaderECSImpl = LoaderECSImpl;
|
|
13388
14452
|
exports.LoaderHelper = LoaderHelper;
|
|
13389
14453
|
exports.LoaderImpl = LoaderImpl;
|
|
13390
14454
|
exports.Matrix3 = Matrix3;
|
|
@@ -13442,6 +14506,9 @@ exports.createPluginMaterial = createPluginMaterial;
|
|
|
13442
14506
|
exports.fetchPBRShaderCode = fetchPBRShaderCode;
|
|
13443
14507
|
exports.fetchUnlitShaderCode = fetchUnlitShaderCode;
|
|
13444
14508
|
exports.getDefaultEffectsGLTFLoader = getDefaultEffectsGLTFLoader;
|
|
14509
|
+
exports.getDefaultEffectsGLTFLoaderECS = getDefaultEffectsGLTFLoaderECS;
|
|
14510
|
+
exports.getDefaultPBRMaterialData = getDefaultPBRMaterialData;
|
|
14511
|
+
exports.getDefaultUnlitMaterialData = getDefaultUnlitMaterialData;
|
|
13445
14512
|
exports.getDiffuseOnlyShaderCode = getDiffuseOnlyShaderCode;
|
|
13446
14513
|
exports.getGaussianBlurShaderCodeV1 = getGaussianBlurShaderCodeV1;
|
|
13447
14514
|
exports.getGaussianBlurShaderCodeV2 = getGaussianBlurShaderCodeV2;
|
|
@@ -13450,6 +14517,7 @@ exports.getGeometryDataFromPropsList = getGeometryDataFromPropsList;
|
|
|
13450
14517
|
exports.getKawaseBlurShaderCode = getKawaseBlurShaderCode;
|
|
13451
14518
|
exports.getNormalVisShaderCode = getNormalVisShaderCode;
|
|
13452
14519
|
exports.getPBRPassShaderCode = getPBRPassShaderCode;
|
|
14520
|
+
exports.getPBRShaderProperties = getPBRShaderProperties;
|
|
13453
14521
|
exports.getPMeshList = getPMeshList;
|
|
13454
14522
|
exports.getQuadFilterShaderCode = getQuadFilterShaderCode;
|
|
13455
14523
|
exports.getRendererGPUInfo = getRendererGPUInfo;
|
|
@@ -13459,6 +14527,8 @@ exports.getSimpleFilterShaderCode = getSimpleFilterShaderCode;
|
|
|
13459
14527
|
exports.getSkyBoxShaderCode = getSkyBoxShaderCode;
|
|
13460
14528
|
exports.getTransparecyBaseShader = getTransparecyBaseShader;
|
|
13461
14529
|
exports.getTransparecyFilterShader = getTransparecyFilterShader;
|
|
14530
|
+
exports.getUnlitShaderProperties = getUnlitShaderProperties;
|
|
13462
14531
|
exports.setDefaultEffectsGLTFLoader = setDefaultEffectsGLTFLoader;
|
|
14532
|
+
exports.setDefaultEffectsGLTFLoaderECS = setDefaultEffectsGLTFLoaderECS;
|
|
13463
14533
|
exports.version = version;
|
|
13464
14534
|
//# sourceMappingURL=alipay.js.map
|