@galacean/effects-plugin-model 2.0.0-alpha.17 → 2.0.0-alpha.18
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 +504 -485
- package/dist/alipay.js.map +1 -1
- package/dist/alipay.mjs +176 -176
- package/dist/alipay.mjs.map +1 -1
- package/dist/index.js +505 -486
- 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 +177 -177
- package/dist/index.mjs.map +1 -1
- package/dist/loader.mjs +177 -177
- package/dist/loader.mjs.map +1 -1
- package/package.json +4 -4
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
|
});
|
|
@@ -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
|
};
|
|
@@ -3619,7 +3639,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3619
3639
|
this.brdfLUT = this.sceneCache.getBrdfLutTexture();
|
|
3620
3640
|
this.initGlobalState(opts);
|
|
3621
3641
|
if (this.maxLightCount > 8) {
|
|
3622
|
-
console.warn("Too many light items: " + this.maxLightCount + " light(s)");
|
|
3642
|
+
console.warn("Too many light items: " + this.maxLightCount + " light(s).");
|
|
3623
3643
|
}
|
|
3624
3644
|
};
|
|
3625
3645
|
_proto.initGlobalState = function initGlobalState(opts) {
|
|
@@ -3629,13 +3649,13 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3629
3649
|
globalState.isWebGL2 = capbility.level === 2;
|
|
3630
3650
|
var _opts_runtimeEnv;
|
|
3631
3651
|
//globalState.shaderShared = composition.env === PLAYER_OPTIONS_ENV_EDITOR;
|
|
3632
|
-
globalState.runtimeEnv = (_opts_runtimeEnv = opts.runtimeEnv) != null ? _opts_runtimeEnv :
|
|
3652
|
+
globalState.runtimeEnv = (_opts_runtimeEnv = opts.runtimeEnv) != null ? _opts_runtimeEnv : EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
|
|
3633
3653
|
var _opts_compatibleMode;
|
|
3634
3654
|
globalState.compatibleMode = (_opts_compatibleMode = opts.compatibleMode) != null ? _opts_compatibleMode : "gltf";
|
|
3635
3655
|
var _opts_visBoundingBox;
|
|
3636
3656
|
globalState.visBoundingBox = (_opts_visBoundingBox = opts.visBoundingBox) != null ? _opts_visBoundingBox : false;
|
|
3637
3657
|
var _opts_renderMode3D;
|
|
3638
|
-
globalState.renderMode3D = (_opts_renderMode3D = opts.renderMode3D) != null ? _opts_renderMode3D :
|
|
3658
|
+
globalState.renderMode3D = (_opts_renderMode3D = opts.renderMode3D) != null ? _opts_renderMode3D : EFFECTS.spec.RenderMode3D.none;
|
|
3639
3659
|
var _opts_renderMode3DUVGridSize;
|
|
3640
3660
|
globalState.renderMode3DUVGridSize = (_opts_renderMode3DUVGridSize = opts.renderMode3DUVGridSize) != null ? _opts_renderMode3DUVGridSize : 1 / 16;
|
|
3641
3661
|
};
|
|
@@ -3691,7 +3711,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3691
3711
|
if (mesh.parentItemId !== undefined) {
|
|
3692
3712
|
this.parentId2Mesh.set(mesh.parentItemId, mesh);
|
|
3693
3713
|
}
|
|
3694
|
-
|
|
3714
|
+
EFFECTS.addItem(this.meshList, mesh);
|
|
3695
3715
|
} else if (_instanceof1(item, PSkybox)) {
|
|
3696
3716
|
var skybox = item;
|
|
3697
3717
|
skybox.setup(this.brdfLUT);
|
|
@@ -3708,7 +3728,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3708
3728
|
} else {
|
|
3709
3729
|
this.cameraManager.insertCamera(item);
|
|
3710
3730
|
}
|
|
3711
|
-
|
|
3731
|
+
EFFECTS.addItem(this.itemList, item);
|
|
3712
3732
|
};
|
|
3713
3733
|
/**
|
|
3714
3734
|
* 从场景中删除插件元素
|
|
@@ -3719,7 +3739,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3719
3739
|
if (mesh.parentItemId !== undefined) {
|
|
3720
3740
|
this.parentId2Mesh.delete(mesh.parentItemId);
|
|
3721
3741
|
}
|
|
3722
|
-
|
|
3742
|
+
EFFECTS.removeItem(this.meshList, mesh);
|
|
3723
3743
|
} else if (_instanceof1(item, PSkybox)) {
|
|
3724
3744
|
this.skybox = undefined;
|
|
3725
3745
|
} else if (_instanceof1(item, PLight)) {
|
|
@@ -3727,13 +3747,13 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3727
3747
|
} else {
|
|
3728
3748
|
this.cameraManager.remove(item);
|
|
3729
3749
|
}
|
|
3730
|
-
|
|
3750
|
+
EFFECTS.removeItem(this.itemList, item);
|
|
3731
3751
|
};
|
|
3732
3752
|
/**
|
|
3733
3753
|
* 更新默认相机状态,根据传入的相机参数
|
|
3734
3754
|
* @param camera - 相机参数
|
|
3735
3755
|
*/ _proto.updateDefaultCamera = function updateDefaultCamera(camera) {
|
|
3736
|
-
var effectsTransfrom = new
|
|
3756
|
+
var effectsTransfrom = new EFFECTS.Transform(_extends({}, camera, {
|
|
3737
3757
|
valid: true
|
|
3738
3758
|
}));
|
|
3739
3759
|
var newTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
|
|
@@ -3969,9 +3989,8 @@ var StandardShaderSource;
|
|
|
3969
3989
|
}
|
|
3970
3990
|
if (isWebGL2) {
|
|
3971
3991
|
return "#version 300 es\n" + source;
|
|
3972
|
-
} else {
|
|
3973
|
-
return "#version 100\n" + source;
|
|
3974
3992
|
}
|
|
3993
|
+
return "#version 100\n" + source;
|
|
3975
3994
|
}
|
|
3976
3995
|
StandardShaderSource.getSourceCode = getSourceCode;
|
|
3977
3996
|
})(StandardShaderSource || (StandardShaderSource = {}));
|
|
@@ -4249,7 +4268,7 @@ function getQuadFilterVS() {
|
|
|
4249
4268
|
if (func !== undefined) {
|
|
4250
4269
|
return func(context);
|
|
4251
4270
|
} else {
|
|
4252
|
-
throw new Error("Invalid material type " + materialType + ", shader content " + context);
|
|
4271
|
+
throw new Error("Invalid material type " + materialType + ", shader content " + context + ".");
|
|
4253
4272
|
}
|
|
4254
4273
|
};
|
|
4255
4274
|
/**
|
|
@@ -4377,12 +4396,12 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
4377
4396
|
var bounding = _this.bounding;
|
|
4378
4397
|
if (bounding && (force || Number.isInteger(bounding.behavior))) {
|
|
4379
4398
|
var type = bounding.type;
|
|
4380
|
-
if (type ===
|
|
4399
|
+
if (type === EFFECTS.spec.ModelBoundingType.box) {
|
|
4381
4400
|
if (_instanceof1(_this.content, PMesh)) {
|
|
4382
4401
|
var mesh = _this.content;
|
|
4383
4402
|
var customHitTest = {
|
|
4384
4403
|
behavior: bounding.behavior,
|
|
4385
|
-
type:
|
|
4404
|
+
type: EFFECTS.HitTestType.custom,
|
|
4386
4405
|
collect: function collect(ray, pointInCanvas) {
|
|
4387
4406
|
var result = mesh.hitTesting(ray.origin, ray.direction);
|
|
4388
4407
|
return result;
|
|
@@ -4393,7 +4412,7 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
4393
4412
|
var worldMatrixData = _this.transform.getWorldMatrix();
|
|
4394
4413
|
var customHitTest1 = {
|
|
4395
4414
|
behavior: bounding.behavior,
|
|
4396
|
-
type:
|
|
4415
|
+
type: EFFECTS.HitTestType.custom,
|
|
4397
4416
|
collect: function collect(ray, pointInCanvas) {
|
|
4398
4417
|
var result = RayIntersectsBoxWithRotation(ray, worldMatrixData, bounding);
|
|
4399
4418
|
return result;
|
|
@@ -4401,7 +4420,7 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
4401
4420
|
};
|
|
4402
4421
|
return customHitTest1;
|
|
4403
4422
|
}
|
|
4404
|
-
} else if (type ===
|
|
4423
|
+
} else if (type === EFFECTS.spec.ModelBoundingType.sphere) {
|
|
4405
4424
|
var pos = new Vector3();
|
|
4406
4425
|
_this.transform.assignWorldTRS(pos);
|
|
4407
4426
|
var center = new Vector3();
|
|
@@ -4508,7 +4527,7 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
4508
4527
|
var size = bbox.getSize(new Vector3());
|
|
4509
4528
|
this.bounding = {
|
|
4510
4529
|
behavior: (_this_bounding = this.bounding) == null ? void 0 : _this_bounding.behavior,
|
|
4511
|
-
type:
|
|
4530
|
+
type: EFFECTS.spec.ModelBoundingType.box,
|
|
4512
4531
|
center: [
|
|
4513
4532
|
center.x,
|
|
4514
4533
|
center.y,
|
|
@@ -4526,9 +4545,9 @@ exports.ModelMeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
4526
4545
|
}
|
|
4527
4546
|
};
|
|
4528
4547
|
return ModelMeshComponent;
|
|
4529
|
-
}(
|
|
4548
|
+
}(EFFECTS.RendererComponent);
|
|
4530
4549
|
exports.ModelMeshComponent = __decorate([
|
|
4531
|
-
|
|
4550
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.MeshComponent)
|
|
4532
4551
|
], exports.ModelMeshComponent);
|
|
4533
4552
|
exports.ModelSkyboxComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
4534
4553
|
_inherits(ModelSkyboxComponent, RendererComponent);
|
|
@@ -4600,9 +4619,9 @@ exports.ModelSkyboxComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
4600
4619
|
return (_this_content_visible = (_this_content = this.content) == null ? void 0 : _this_content.visible) != null ? _this_content_visible : false;
|
|
4601
4620
|
};
|
|
4602
4621
|
return ModelSkyboxComponent;
|
|
4603
|
-
}(
|
|
4622
|
+
}(EFFECTS.RendererComponent);
|
|
4604
4623
|
exports.ModelSkyboxComponent = __decorate([
|
|
4605
|
-
|
|
4624
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.SkyboxComponent)
|
|
4606
4625
|
], exports.ModelSkyboxComponent);
|
|
4607
4626
|
exports.ModelLightComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
4608
4627
|
_inherits(ModelLightComponent, ItemBehaviour);
|
|
@@ -4665,9 +4684,9 @@ exports.ModelLightComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
4665
4684
|
return (_this_content_visible = (_this_content = this.content) == null ? void 0 : _this_content.visible) != null ? _this_content_visible : false;
|
|
4666
4685
|
};
|
|
4667
4686
|
return ModelLightComponent;
|
|
4668
|
-
}(
|
|
4687
|
+
}(EFFECTS.ItemBehaviour);
|
|
4669
4688
|
exports.ModelLightComponent = __decorate([
|
|
4670
|
-
|
|
4689
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.LightComponent)
|
|
4671
4690
|
], exports.ModelLightComponent);
|
|
4672
4691
|
exports.ModelCameraComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
4673
4692
|
_inherits(ModelCameraComponent, ItemBehaviour);
|
|
@@ -4745,9 +4764,9 @@ exports.ModelCameraComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
4745
4764
|
this.updateMainCamera();
|
|
4746
4765
|
};
|
|
4747
4766
|
return ModelCameraComponent;
|
|
4748
|
-
}(
|
|
4767
|
+
}(EFFECTS.ItemBehaviour);
|
|
4749
4768
|
exports.ModelCameraComponent = __decorate([
|
|
4750
|
-
|
|
4769
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.CameraComponent)
|
|
4751
4770
|
], exports.ModelCameraComponent);
|
|
4752
4771
|
exports.AnimationComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
4753
4772
|
_inherits(AnimationComponent, ItemBehaviour);
|
|
@@ -4798,9 +4817,9 @@ exports.AnimationComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
4798
4817
|
});
|
|
4799
4818
|
};
|
|
4800
4819
|
return AnimationComponent;
|
|
4801
|
-
}(
|
|
4820
|
+
}(EFFECTS.ItemBehaviour);
|
|
4802
4821
|
exports.AnimationComponent = __decorate([
|
|
4803
|
-
|
|
4822
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.AnimationComponent)
|
|
4804
4823
|
], exports.AnimationComponent);
|
|
4805
4824
|
var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
|
|
4806
4825
|
_inherits(ModelAnimationClip, AnimationClip);
|
|
@@ -4846,10 +4865,10 @@ var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
|
|
|
4846
4865
|
var properties = curve3.property.split(".");
|
|
4847
4866
|
setProperty(component, properties, value3);
|
|
4848
4867
|
} else {
|
|
4849
|
-
console.error("Can't find mesh component");
|
|
4868
|
+
console.error("Can't find mesh component.");
|
|
4850
4869
|
}
|
|
4851
4870
|
} else {
|
|
4852
|
-
console.warn("Ignore curve: className " + curve3.className);
|
|
4871
|
+
console.warn("Ignore curve: className " + curve3.className + ".");
|
|
4853
4872
|
}
|
|
4854
4873
|
}
|
|
4855
4874
|
};
|
|
@@ -4877,21 +4896,21 @@ var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
|
|
|
4877
4896
|
}
|
|
4878
4897
|
}
|
|
4879
4898
|
if (!findTag) {
|
|
4880
|
-
throw new Error("Can't find path in tree " + rootItem.id + ", " + path);
|
|
4899
|
+
throw new Error("Can't find path in tree " + rootItem.id + ", " + path + ".");
|
|
4881
4900
|
}
|
|
4882
4901
|
}
|
|
4883
4902
|
this.path2Node[path] = target;
|
|
4884
4903
|
return target;
|
|
4885
4904
|
};
|
|
4886
4905
|
return ModelAnimationClip;
|
|
4887
|
-
}(
|
|
4906
|
+
}(EFFECTS.AnimationClip);
|
|
4888
4907
|
function setProperty(obj, properties, value) {
|
|
4889
4908
|
var len = properties.length;
|
|
4890
4909
|
var current = obj;
|
|
4891
4910
|
for(var i = 0; i < len - 1; i++){
|
|
4892
4911
|
var propName = properties[i];
|
|
4893
4912
|
if (!(propName in current) || typeof current[propName] !== "object") {
|
|
4894
|
-
console.error("Invalid properties " + properties);
|
|
4913
|
+
console.error("Invalid properties " + properties + ".");
|
|
4895
4914
|
return;
|
|
4896
4915
|
}
|
|
4897
4916
|
current = current[propName];
|
|
@@ -5134,13 +5153,13 @@ var normal = new Vector3();
|
|
|
5134
5153
|
var blob, urlCreator, imageUrl, imageObj;
|
|
5135
5154
|
return __generator(this, function(_state) {
|
|
5136
5155
|
if (image.imageData === undefined) {
|
|
5137
|
-
console.error("createTexture2D: Invalid image data from " + image);
|
|
5156
|
+
console.error("createTexture2D: Invalid image data from " + image + ".");
|
|
5138
5157
|
// 这里不应该发生的,做个兜底
|
|
5139
5158
|
return [
|
|
5140
5159
|
2,
|
|
5141
|
-
|
|
5160
|
+
EFFECTS.Texture.create(engine, {
|
|
5142
5161
|
name: "createTexture2D",
|
|
5143
|
-
sourceType:
|
|
5162
|
+
sourceType: EFFECTS.TextureSourceType.data,
|
|
5144
5163
|
data: {
|
|
5145
5164
|
data: new Uint8Array([
|
|
5146
5165
|
255,
|
|
@@ -5168,34 +5187,34 @@ var normal = new Vector3();
|
|
|
5168
5187
|
new Promise(function(resolve, reject) {
|
|
5169
5188
|
imageObj.onload = function() {
|
|
5170
5189
|
var _texture_minFilter;
|
|
5171
|
-
var minFilter = (_texture_minFilter = texture.minFilter) != null ? _texture_minFilter :
|
|
5190
|
+
var minFilter = (_texture_minFilter = texture.minFilter) != null ? _texture_minFilter : EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
|
|
5172
5191
|
var premultiplyAlpha = false;
|
|
5173
5192
|
if (tiny3dMode) {
|
|
5174
5193
|
//if (minFilter === glContext.NEAREST_MIPMAP_LINEAR
|
|
5175
5194
|
// || minFilter === glContext.LINEAR_MIPMAP_NEAREST) {
|
|
5176
|
-
minFilter =
|
|
5195
|
+
minFilter = EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
|
|
5177
5196
|
//}
|
|
5178
5197
|
if (!WebGLHelper.isPow2(imageObj.width) || !WebGLHelper.isPow2(imageObj.height)) {
|
|
5179
|
-
minFilter =
|
|
5198
|
+
minFilter = EFFECTS.glContext.LINEAR;
|
|
5180
5199
|
}
|
|
5181
5200
|
//
|
|
5182
5201
|
premultiplyAlpha = isBaseColor ? false : true;
|
|
5183
5202
|
}
|
|
5184
5203
|
var generateMipmap = false;
|
|
5185
|
-
if (minFilter ==
|
|
5204
|
+
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
5205
|
generateMipmap = true;
|
|
5187
5206
|
}
|
|
5188
5207
|
var _texture_wrapS, _texture_wrapT, _texture_magFilter;
|
|
5189
|
-
var res =
|
|
5208
|
+
var res = EFFECTS.Texture.create(engine, {
|
|
5190
5209
|
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 :
|
|
5210
|
+
wrapS: (_texture_wrapS = texture.wrapS) != null ? _texture_wrapS : EFFECTS.glContext.REPEAT,
|
|
5211
|
+
wrapT: (_texture_wrapT = texture.wrapT) != null ? _texture_wrapT : EFFECTS.glContext.REPEAT,
|
|
5212
|
+
magFilter: (_texture_magFilter = texture.magFilter) != null ? _texture_magFilter : EFFECTS.glContext.LINEAR,
|
|
5194
5213
|
minFilter: minFilter,
|
|
5195
5214
|
anisotropic: 1,
|
|
5196
5215
|
//flipY: tex.flipY,
|
|
5197
5216
|
premultiplyAlpha: premultiplyAlpha,
|
|
5198
|
-
sourceType:
|
|
5217
|
+
sourceType: EFFECTS.TextureSourceType.image,
|
|
5199
5218
|
image: imageObj,
|
|
5200
5219
|
generateMipmap: generateMipmap
|
|
5201
5220
|
});
|
|
@@ -5361,9 +5380,9 @@ var normal = new Vector3();
|
|
|
5361
5380
|
case 0:
|
|
5362
5381
|
return [
|
|
5363
5382
|
4,
|
|
5364
|
-
|
|
5365
|
-
type:
|
|
5366
|
-
target:
|
|
5383
|
+
EFFECTS.getDefaultTextureFactory().loadSource({
|
|
5384
|
+
type: EFFECTS.TextureSourceType.image,
|
|
5385
|
+
target: EFFECTS.glContext.TEXTURE_CUBE_MAP,
|
|
5367
5386
|
map: cubeImage
|
|
5368
5387
|
}, _this.cubemapTexConfig)
|
|
5369
5388
|
];
|
|
@@ -5371,7 +5390,7 @@ var normal = new Vector3();
|
|
|
5371
5390
|
textureOptions = _state.sent();
|
|
5372
5391
|
return [
|
|
5373
5392
|
2,
|
|
5374
|
-
|
|
5393
|
+
EFFECTS.Texture.create(engine, textureOptions)
|
|
5375
5394
|
];
|
|
5376
5395
|
}
|
|
5377
5396
|
});
|
|
@@ -5391,9 +5410,9 @@ var normal = new Vector3();
|
|
|
5391
5410
|
case 0:
|
|
5392
5411
|
return [
|
|
5393
5412
|
4,
|
|
5394
|
-
|
|
5395
|
-
type:
|
|
5396
|
-
target:
|
|
5413
|
+
EFFECTS.getDefaultTextureFactory().loadSource({
|
|
5414
|
+
type: EFFECTS.TextureSourceType.mipmaps,
|
|
5415
|
+
target: EFFECTS.glContext.TEXTURE_CUBE_MAP,
|
|
5397
5416
|
maps: cubeImages
|
|
5398
5417
|
}, _this.cubemapMipTexConfig)
|
|
5399
5418
|
];
|
|
@@ -5401,7 +5420,7 @@ var normal = new Vector3();
|
|
|
5401
5420
|
textureOptions = _state.sent();
|
|
5402
5421
|
return [
|
|
5403
5422
|
2,
|
|
5404
|
-
|
|
5423
|
+
EFFECTS.Texture.create(engine, textureOptions)
|
|
5405
5424
|
];
|
|
5406
5425
|
}
|
|
5407
5426
|
});
|
|
@@ -5427,11 +5446,11 @@ var normal = new Vector3();
|
|
|
5427
5446
|
cubemap = _state.sent();
|
|
5428
5447
|
return [
|
|
5429
5448
|
2,
|
|
5430
|
-
|
|
5449
|
+
EFFECTS.Texture.create(engine, _extends({
|
|
5431
5450
|
name: "createTextureCubeFromBuffer",
|
|
5432
|
-
sourceType:
|
|
5451
|
+
sourceType: EFFECTS.TextureSourceType.image,
|
|
5433
5452
|
cube: cubemap,
|
|
5434
|
-
target:
|
|
5453
|
+
target: EFFECTS.glContext.TEXTURE_CUBE_MAP
|
|
5435
5454
|
}, _this.cubemapTexConfig))
|
|
5436
5455
|
];
|
|
5437
5456
|
}
|
|
@@ -5472,7 +5491,7 @@ var normal = new Vector3();
|
|
|
5472
5491
|
url = "https://gw.alipayobjects.com/zos/gltf-asset/67896749597915/img" + index + ".png";
|
|
5473
5492
|
return [
|
|
5474
5493
|
4,
|
|
5475
|
-
|
|
5494
|
+
EFFECTS.loadImage(url)
|
|
5476
5495
|
];
|
|
5477
5496
|
case 3:
|
|
5478
5497
|
imageData = _state.sent();
|
|
@@ -5491,11 +5510,11 @@ var normal = new Vector3();
|
|
|
5491
5510
|
case 4:
|
|
5492
5511
|
return [
|
|
5493
5512
|
2,
|
|
5494
|
-
|
|
5513
|
+
EFFECTS.Texture.create(engine, _extends({
|
|
5495
5514
|
name: "createTextureCubeMipmapFromBuffer",
|
|
5496
|
-
sourceType:
|
|
5515
|
+
sourceType: EFFECTS.TextureSourceType.mipmaps,
|
|
5497
5516
|
mipmaps: mipmaps,
|
|
5498
|
-
target:
|
|
5517
|
+
target: EFFECTS.glContext.TEXTURE_CUBE_MAP
|
|
5499
5518
|
}, _this.cubemapMipTexConfig))
|
|
5500
5519
|
];
|
|
5501
5520
|
}
|
|
@@ -5523,14 +5542,14 @@ var normal = new Vector3();
|
|
|
5523
5542
|
var options = {
|
|
5524
5543
|
name: "createTextureFromImage",
|
|
5525
5544
|
image: image,
|
|
5526
|
-
sourceType:
|
|
5545
|
+
sourceType: EFFECTS.TextureSourceType.image,
|
|
5527
5546
|
flipY: false,
|
|
5528
|
-
magFilter:
|
|
5529
|
-
minFilter:
|
|
5530
|
-
wrapT:
|
|
5531
|
-
wrapS:
|
|
5547
|
+
magFilter: EFFECTS.glContext.LINEAR,
|
|
5548
|
+
minFilter: EFFECTS.glContext.LINEAR,
|
|
5549
|
+
wrapT: EFFECTS.glContext.REPEAT,
|
|
5550
|
+
wrapS: EFFECTS.glContext.REPEAT
|
|
5532
5551
|
};
|
|
5533
|
-
return
|
|
5552
|
+
return EFFECTS.Texture.create(engine, options);
|
|
5534
5553
|
};
|
|
5535
5554
|
/**
|
|
5536
5555
|
* 创建渲染 Pass
|
|
@@ -5541,10 +5560,10 @@ var normal = new Vector3();
|
|
|
5541
5560
|
* @param fboOpts - FBO 参数
|
|
5542
5561
|
* @returns
|
|
5543
5562
|
*/ WebGLHelper.createRenderPass = function createRenderPass(renderer, name, priority, meshData, fboOpts) {
|
|
5544
|
-
var meshList = _instanceof1(meshData,
|
|
5563
|
+
var meshList = _instanceof1(meshData, EFFECTS.Mesh) ? [
|
|
5545
5564
|
meshData
|
|
5546
5565
|
] : meshData;
|
|
5547
|
-
return new
|
|
5566
|
+
return new EFFECTS.RenderPass(renderer, {
|
|
5548
5567
|
name: name,
|
|
5549
5568
|
priority: priority,
|
|
5550
5569
|
attachments: fboOpts.colorAttachments,
|
|
@@ -5558,8 +5577,8 @@ var normal = new Vector3();
|
|
|
5558
5577
|
0,
|
|
5559
5578
|
0
|
|
5560
5579
|
],
|
|
5561
|
-
colorAction:
|
|
5562
|
-
depthAction:
|
|
5580
|
+
colorAction: EFFECTS.TextureLoadAction.clear,
|
|
5581
|
+
depthAction: EFFECTS.TextureLoadAction.clear
|
|
5563
5582
|
},
|
|
5564
5583
|
// storeAction: {
|
|
5565
5584
|
// colorAction: TextureStoreAction.store,
|
|
@@ -5579,9 +5598,9 @@ var normal = new Vector3();
|
|
|
5579
5598
|
* @param mesh - Mesh 对象
|
|
5580
5599
|
*/ WebGLHelper.deleteMesh = function deleteMesh(mesh) {
|
|
5581
5600
|
mesh.dispose({
|
|
5582
|
-
geometries:
|
|
5601
|
+
geometries: EFFECTS.DestroyOptions.destroy,
|
|
5583
5602
|
material: {
|
|
5584
|
-
textures:
|
|
5603
|
+
textures: EFFECTS.DestroyOptions.destroy
|
|
5585
5604
|
}
|
|
5586
5605
|
});
|
|
5587
5606
|
};
|
|
@@ -5597,14 +5616,14 @@ var normal = new Vector3();
|
|
|
5597
5616
|
*/ WebGLHelper.deleteRenderPass = function deleteRenderPass(pass) {
|
|
5598
5617
|
pass.dispose({
|
|
5599
5618
|
meshes: {
|
|
5600
|
-
geometries:
|
|
5619
|
+
geometries: EFFECTS.DestroyOptions.destroy,
|
|
5601
5620
|
material: {
|
|
5602
|
-
textures:
|
|
5621
|
+
textures: EFFECTS.DestroyOptions.destroy
|
|
5603
5622
|
}
|
|
5604
5623
|
},
|
|
5605
|
-
depthStencilAttachment:
|
|
5606
|
-
colorAttachment:
|
|
5607
|
-
semantics:
|
|
5624
|
+
depthStencilAttachment: EFFECTS.RenderPassDestroyAttachmentType.force,
|
|
5625
|
+
colorAttachment: EFFECTS.RenderPassDestroyAttachmentType.force,
|
|
5626
|
+
semantics: EFFECTS.DestroyOptions.destroy
|
|
5608
5627
|
});
|
|
5609
5628
|
};
|
|
5610
5629
|
/**
|
|
@@ -5642,18 +5661,18 @@ var normal = new Vector3();
|
|
|
5642
5661
|
* 立方体纹理参数
|
|
5643
5662
|
*/ WebGLHelper.cubemapTexConfig = {
|
|
5644
5663
|
name: "cubemap texture",
|
|
5645
|
-
wrapS:
|
|
5646
|
-
wrapT:
|
|
5647
|
-
magFilter:
|
|
5648
|
-
minFilter:
|
|
5664
|
+
wrapS: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
5665
|
+
wrapT: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
5666
|
+
magFilter: EFFECTS.glContext.LINEAR,
|
|
5667
|
+
minFilter: EFFECTS.glContext.LINEAR
|
|
5649
5668
|
};
|
|
5650
5669
|
/**
|
|
5651
5670
|
* 立方体纹理参数,带 Mipmap 滤波
|
|
5652
5671
|
*/ WebGLHelper.cubemapMipTexConfig = {
|
|
5653
|
-
wrapS:
|
|
5654
|
-
wrapT:
|
|
5655
|
-
magFilter:
|
|
5656
|
-
minFilter:
|
|
5672
|
+
wrapS: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
5673
|
+
wrapT: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
5674
|
+
magFilter: EFFECTS.glContext.LINEAR,
|
|
5675
|
+
minFilter: EFFECTS.glContext.LINEAR_MIPMAP_LINEAR
|
|
5657
5676
|
};
|
|
5658
5677
|
/**
|
|
5659
5678
|
* Mesh 辅助类,负责 Mesh 相关的基础对象创建
|
|
@@ -5670,19 +5689,19 @@ var normal = new Vector3();
|
|
|
5670
5689
|
var globalState = PGlobalState.getInstance();
|
|
5671
5690
|
var vertexShader = material.vertexShaderCode;
|
|
5672
5691
|
var fragmentShader = material.fragmentShaderCode;
|
|
5673
|
-
var geometry =
|
|
5692
|
+
var geometry = EFFECTS.Geometry.create(engine, MeshHelper.getPlaneGeometry());
|
|
5674
5693
|
var isWebGL2 = engine.gpuCapability.level === 2;
|
|
5675
|
-
var effectsMaterial =
|
|
5694
|
+
var effectsMaterial = EFFECTS.Material.create(engine, {
|
|
5676
5695
|
shader: {
|
|
5677
5696
|
vertex: vertexShader,
|
|
5678
5697
|
fragment: fragmentShader,
|
|
5679
5698
|
shared: globalState.shaderShared,
|
|
5680
|
-
glslVersion: isWebGL2 ?
|
|
5699
|
+
glslVersion: isWebGL2 ? EFFECTS.GLSLVersion.GLSL3 : EFFECTS.GLSLVersion.GLSL1
|
|
5681
5700
|
},
|
|
5682
5701
|
uniformSemantics: uniformSemantics
|
|
5683
5702
|
});
|
|
5684
5703
|
material.setMaterialStates(effectsMaterial);
|
|
5685
|
-
return
|
|
5704
|
+
return EFFECTS.Mesh.create(engine, {
|
|
5686
5705
|
name: name,
|
|
5687
5706
|
worldMatrix: Matrix4.fromIdentity(),
|
|
5688
5707
|
material: effectsMaterial,
|
|
@@ -5697,21 +5716,21 @@ var normal = new Vector3();
|
|
|
5697
5716
|
return {
|
|
5698
5717
|
attributes: {
|
|
5699
5718
|
aPos: {
|
|
5700
|
-
type:
|
|
5719
|
+
type: EFFECTS.glContext.FLOAT,
|
|
5701
5720
|
size: 3,
|
|
5702
5721
|
data: data,
|
|
5703
5722
|
stride: Float32Array.BYTES_PER_ELEMENT * 8,
|
|
5704
5723
|
offset: 0
|
|
5705
5724
|
},
|
|
5706
5725
|
aUV: {
|
|
5707
|
-
type:
|
|
5726
|
+
type: EFFECTS.glContext.FLOAT,
|
|
5708
5727
|
size: 2,
|
|
5709
5728
|
stride: Float32Array.BYTES_PER_ELEMENT * 8,
|
|
5710
5729
|
offset: Float32Array.BYTES_PER_ELEMENT * 3,
|
|
5711
5730
|
dataSource: "aPos"
|
|
5712
5731
|
},
|
|
5713
5732
|
aNormal: {
|
|
5714
|
-
type:
|
|
5733
|
+
type: EFFECTS.glContext.FLOAT,
|
|
5715
5734
|
size: 3,
|
|
5716
5735
|
stride: Float32Array.BYTES_PER_ELEMENT * 8,
|
|
5717
5736
|
offset: Float32Array.BYTES_PER_ELEMENT * 5,
|
|
@@ -5990,7 +6009,7 @@ var normal = new Vector3();
|
|
|
5990
6009
|
rotationMat.transformPoint(deltaPos);
|
|
5991
6010
|
var newCamPos = deltaPos.clone().add(targetPos);
|
|
5992
6011
|
var viewMatrix = new Matrix4().lookAt(newCamPos, targetPos, new Vector3(0, 1, 0)).invert();
|
|
5993
|
-
var effectsTransform = new
|
|
6012
|
+
var effectsTransform = new EFFECTS.Transform();
|
|
5994
6013
|
effectsTransform.setValid(true);
|
|
5995
6014
|
effectsTransform.cloneFromMatrix(viewMatrix);
|
|
5996
6015
|
return effectsTransform;
|
|
@@ -6004,7 +6023,7 @@ var normal = new Vector3();
|
|
|
6004
6023
|
* @returns 场景信息描述
|
|
6005
6024
|
*/ PluginHelper.preprocessScene = function preprocessScene(scene, runtimeEnv, compatibleMode) {
|
|
6006
6025
|
var _this = this;
|
|
6007
|
-
var deviceEnv = runtimeEnv !==
|
|
6026
|
+
var deviceEnv = runtimeEnv !== EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
|
|
6008
6027
|
var tiny3dMode = compatibleMode === "tiny3d";
|
|
6009
6028
|
// 默认skybox如何处理需要讨论
|
|
6010
6029
|
var jsonScene = scene.jsonScene;
|
|
@@ -6029,7 +6048,7 @@ var normal = new Vector3();
|
|
|
6029
6048
|
_this.preprocessTextureOptions(dataMap, mat.textures["_EmissiveSampler"], false, tiny3dMode);
|
|
6030
6049
|
});
|
|
6031
6050
|
jsonScene.components.forEach(function(comp) {
|
|
6032
|
-
if (comp.dataType ===
|
|
6051
|
+
if (comp.dataType === EFFECTS.spec.DataType.SkyboxComponent) {
|
|
6033
6052
|
loadSkybox = true;
|
|
6034
6053
|
var skybox = comp;
|
|
6035
6054
|
if (skybox.diffuseImage) {
|
|
@@ -6069,29 +6088,29 @@ var normal = new Vector3();
|
|
|
6069
6088
|
if (!texOptions) {
|
|
6070
6089
|
return;
|
|
6071
6090
|
}
|
|
6072
|
-
if (texOptions.target === undefined || texOptions.target ===
|
|
6073
|
-
texOptions.wrapS =
|
|
6074
|
-
texOptions.wrapT =
|
|
6075
|
-
texOptions.magFilter =
|
|
6076
|
-
texOptions.minFilter =
|
|
6091
|
+
if (texOptions.target === undefined || texOptions.target === EFFECTS.glContext.TEXTURE_2D) {
|
|
6092
|
+
texOptions.wrapS = EFFECTS.glContext.REPEAT;
|
|
6093
|
+
texOptions.wrapT = EFFECTS.glContext.REPEAT;
|
|
6094
|
+
texOptions.magFilter = EFFECTS.glContext.LINEAR;
|
|
6095
|
+
texOptions.minFilter = EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
|
|
6077
6096
|
texOptions.generateMipmap = true;
|
|
6078
6097
|
if (!isBaseColor) {
|
|
6079
6098
|
texOptions.premultiplyAlpha = true;
|
|
6080
6099
|
}
|
|
6081
|
-
} else if (texOptions.target ===
|
|
6082
|
-
texOptions.wrapS =
|
|
6083
|
-
texOptions.wrapT =
|
|
6100
|
+
} else if (texOptions.target === EFFECTS.glContext.TEXTURE_CUBE_MAP) {
|
|
6101
|
+
texOptions.wrapS = EFFECTS.glContext.CLAMP_TO_EDGE;
|
|
6102
|
+
texOptions.wrapT = EFFECTS.glContext.CLAMP_TO_EDGE;
|
|
6084
6103
|
if (texOptions.mipmaps !== undefined) {
|
|
6085
6104
|
if (texOptions.mipmaps.length === 1) {
|
|
6086
|
-
texOptions.magFilter =
|
|
6087
|
-
texOptions.minFilter =
|
|
6105
|
+
texOptions.magFilter = EFFECTS.glContext.LINEAR;
|
|
6106
|
+
texOptions.minFilter = EFFECTS.glContext.LINEAR;
|
|
6088
6107
|
} else {
|
|
6089
|
-
texOptions.magFilter =
|
|
6090
|
-
texOptions.minFilter =
|
|
6108
|
+
texOptions.magFilter = EFFECTS.glContext.LINEAR;
|
|
6109
|
+
texOptions.minFilter = EFFECTS.glContext.LINEAR_MIPMAP_LINEAR;
|
|
6091
6110
|
}
|
|
6092
6111
|
} else {
|
|
6093
|
-
texOptions.magFilter =
|
|
6094
|
-
texOptions.minFilter =
|
|
6112
|
+
texOptions.magFilter = EFFECTS.glContext.LINEAR;
|
|
6113
|
+
texOptions.minFilter = EFFECTS.glContext.LINEAR;
|
|
6095
6114
|
}
|
|
6096
6115
|
}
|
|
6097
6116
|
};
|
|
@@ -6121,12 +6140,12 @@ var normal = new Vector3();
|
|
|
6121
6140
|
sceneComp.items.forEach(function(data) {
|
|
6122
6141
|
var itemId = data.id;
|
|
6123
6142
|
var item = composition.getEngine().jsonSceneData[itemId];
|
|
6124
|
-
if (item.type ===
|
|
6143
|
+
if (item.type === EFFECTS.spec.ItemType.mesh) {
|
|
6125
6144
|
var meshItem = item;
|
|
6126
6145
|
var skin = meshItem.content.options.skin;
|
|
6127
6146
|
var primitives = meshItem.content.options.primitives;
|
|
6128
6147
|
primitives.forEach(function(prim, primId) {
|
|
6129
|
-
if (_instanceof1(prim.geometry,
|
|
6148
|
+
if (_instanceof1(prim.geometry, EFFECTS.Geometry)) {
|
|
6130
6149
|
// 可能已经创建,直接返回
|
|
6131
6150
|
return;
|
|
6132
6151
|
}
|
|
@@ -6135,7 +6154,7 @@ var normal = new Vector3();
|
|
|
6135
6154
|
var studioPrim = prim;
|
|
6136
6155
|
studioPrim.geometry = riGeometry;
|
|
6137
6156
|
var material = prim.material;
|
|
6138
|
-
if (material.type ===
|
|
6157
|
+
if (material.type === EFFECTS.spec.MaterialType.pbr) {
|
|
6139
6158
|
var studioMat = studioPrim.material;
|
|
6140
6159
|
studioMat.baseColorTexture = _this.getTextureObj(composition.textures, material.baseColorTexture);
|
|
6141
6160
|
studioMat.metallicRoughnessTexture = _this.getTextureObj(composition.textures, material.metallicRoughnessTexture);
|
|
@@ -6153,10 +6172,10 @@ var normal = new Vector3();
|
|
|
6153
6172
|
if (_instanceof1(inverseBindMatrices, Float32Array)) {
|
|
6154
6173
|
studioSkin.inverseBindMatrices = inverseBindMatrices;
|
|
6155
6174
|
} else {
|
|
6156
|
-
console.error("setupItem3DOptions: Invalid inverseBindMatrices type, " + inverseBindMatrices);
|
|
6175
|
+
console.error("setupItem3DOptions: Invalid inverseBindMatrices type, " + inverseBindMatrices + ".");
|
|
6157
6176
|
}
|
|
6158
6177
|
}
|
|
6159
|
-
} else if (item.type ===
|
|
6178
|
+
} else if (item.type === EFFECTS.spec.ItemType.tree) {
|
|
6160
6179
|
var jsonItem = item;
|
|
6161
6180
|
var studioItem = item;
|
|
6162
6181
|
var jsonAnimations = jsonItem.content.options.tree.animations;
|
|
@@ -6171,24 +6190,24 @@ var normal = new Vector3();
|
|
|
6171
6190
|
if (_instanceof1(inputArray, Float32Array)) {
|
|
6172
6191
|
studioTrack.input = inputArray;
|
|
6173
6192
|
} else {
|
|
6174
|
-
console.error("setupItem3DOptions: Type of inputArray should be float32, " + inputArray);
|
|
6193
|
+
console.error("setupItem3DOptions: Type of inputArray should be float32, " + inputArray + ".");
|
|
6175
6194
|
}
|
|
6176
6195
|
if (_instanceof1(outputArray, Float32Array)) {
|
|
6177
6196
|
studioTrack.output = outputArray;
|
|
6178
6197
|
} else {
|
|
6179
|
-
console.error("setupItem3DOptions: Type of outputArray should be float32, " + outputArray);
|
|
6198
|
+
console.error("setupItem3DOptions: Type of outputArray should be float32, " + outputArray + ".");
|
|
6180
6199
|
}
|
|
6181
6200
|
});
|
|
6182
6201
|
});
|
|
6183
6202
|
}
|
|
6184
|
-
} else if (item.type ===
|
|
6203
|
+
} else if (item.type === EFFECTS.spec.ItemType.skybox) {
|
|
6185
6204
|
var skybox = item;
|
|
6186
6205
|
var studioSkybox = item;
|
|
6187
6206
|
var options = skybox.content.options;
|
|
6188
6207
|
var studioOptions = studioSkybox.content.options;
|
|
6189
6208
|
var specularImage = _this.getTextureObj(composition.textures, options.specularImage);
|
|
6190
6209
|
if (specularImage === undefined) {
|
|
6191
|
-
console.error("setupItem3DOptions: skybox specualrImage is undefined, " + CheckerHelper.stringify(options));
|
|
6210
|
+
console.error("setupItem3DOptions: skybox specualrImage is undefined, " + CheckerHelper.stringify(options) + ".");
|
|
6192
6211
|
}
|
|
6193
6212
|
studioOptions.specularImage = specularImage;
|
|
6194
6213
|
//
|
|
@@ -6216,7 +6235,7 @@ var normal = new Vector3();
|
|
|
6216
6235
|
attributes[name] = attribData;
|
|
6217
6236
|
}
|
|
6218
6237
|
geomOptions.attributes = attributes;
|
|
6219
|
-
return
|
|
6238
|
+
return EFFECTS.Geometry.create(engine, geomOptions);
|
|
6220
6239
|
};
|
|
6221
6240
|
/**
|
|
6222
6241
|
* 索引数组类型转换
|
|
@@ -6232,7 +6251,7 @@ var normal = new Vector3();
|
|
|
6232
6251
|
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
6233
6252
|
return array;
|
|
6234
6253
|
default:
|
|
6235
|
-
console.error("Invalid index attribute type " + type);
|
|
6254
|
+
console.error("Invalid index attribute type " + type + ".");
|
|
6236
6255
|
}
|
|
6237
6256
|
};
|
|
6238
6257
|
/**
|
|
@@ -6260,7 +6279,7 @@ var normal = new Vector3();
|
|
|
6260
6279
|
// aPos, aNormal, aTangent,
|
|
6261
6280
|
// aUV, aUV2, aJoints, aWeights
|
|
6262
6281
|
// aTargetXXX
|
|
6263
|
-
console.warn("Unknown attribute name: " + name);
|
|
6282
|
+
console.warn("Unknown attribute name: " + name + ".");
|
|
6264
6283
|
}
|
|
6265
6284
|
return name;
|
|
6266
6285
|
};
|
|
@@ -6274,7 +6293,7 @@ var normal = new Vector3();
|
|
|
6274
6293
|
return null;
|
|
6275
6294
|
}
|
|
6276
6295
|
if (index < 0 || index >= textures.length) {
|
|
6277
|
-
console.error("Invalid index for textures: " + index + ", " + textures.length);
|
|
6296
|
+
console.error("Invalid index for textures: " + index + ", " + textures.length + ".");
|
|
6278
6297
|
}
|
|
6279
6298
|
return textures[index];
|
|
6280
6299
|
};
|
|
@@ -6324,10 +6343,10 @@ var normal = new Vector3();
|
|
|
6324
6343
|
var canvas = document.createElement("canvas");
|
|
6325
6344
|
canvas.width = 512;
|
|
6326
6345
|
canvas.height = 512;
|
|
6327
|
-
return new
|
|
6346
|
+
return new EFFECTS.Player({
|
|
6328
6347
|
canvas: canvas,
|
|
6329
6348
|
renderFramework: "webgl2",
|
|
6330
|
-
env:
|
|
6349
|
+
env: EFFECTS.PLAYER_OPTIONS_ENV_EDITOR,
|
|
6331
6350
|
renderOptions: {
|
|
6332
6351
|
willCaptureImage: true
|
|
6333
6352
|
},
|
|
@@ -6359,7 +6378,7 @@ var normal = new Vector3();
|
|
|
6359
6378
|
return __generator(this, function(_state) {
|
|
6360
6379
|
return [
|
|
6361
6380
|
2,
|
|
6362
|
-
|
|
6381
|
+
EFFECTS.loadImage(new Blob([
|
|
6363
6382
|
image.imageData
|
|
6364
6383
|
], {
|
|
6365
6384
|
type: image.mimeType
|
|
@@ -6377,7 +6396,7 @@ var normal = new Vector3();
|
|
|
6377
6396
|
return __generator(this, function(_state) {
|
|
6378
6397
|
return [
|
|
6379
6398
|
2,
|
|
6380
|
-
|
|
6399
|
+
EFFECTS.loadImage(new Blob([
|
|
6381
6400
|
image.data
|
|
6382
6401
|
], {
|
|
6383
6402
|
type: image.mimeType
|
|
@@ -6400,7 +6419,7 @@ var normal = new Vector3();
|
|
|
6400
6419
|
if (b) {
|
|
6401
6420
|
resolve(b.arrayBuffer());
|
|
6402
6421
|
} else {
|
|
6403
|
-
reject(new Error("
|
|
6422
|
+
reject(new Error("No canvas blob."));
|
|
6404
6423
|
}
|
|
6405
6424
|
}, "image/png", 1);
|
|
6406
6425
|
})
|
|
@@ -6562,7 +6581,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
6562
6581
|
this.offset = (_inAttrib_offset = inAttrib.offset) != null ? _inAttrib_offset : 0;
|
|
6563
6582
|
if (this.offset > 0) {
|
|
6564
6583
|
if (this.offset % this.typeSize !== 0) {
|
|
6565
|
-
console.error("Invalid offset " + this.offset + ", type size " + this.typeSize);
|
|
6584
|
+
console.error("Invalid offset " + this.offset + ", type size " + this.typeSize + ".");
|
|
6566
6585
|
}
|
|
6567
6586
|
this.offset = this.offset / this.typeSize;
|
|
6568
6587
|
}
|
|
@@ -6571,7 +6590,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
6571
6590
|
this.stride = (_inAttrib_stride = inAttrib.stride) != null ? _inAttrib_stride : 0;
|
|
6572
6591
|
if (this.stride > 0) {
|
|
6573
6592
|
if (this.stride % this.typeSize !== 0) {
|
|
6574
|
-
console.error("Invalid stride " + this.stride + ", type size " + this.typeSize);
|
|
6593
|
+
console.error("Invalid stride " + this.stride + ", type size " + this.typeSize + ".");
|
|
6575
6594
|
}
|
|
6576
6595
|
this.stride = this.stride / this.typeSize;
|
|
6577
6596
|
} else {
|
|
@@ -7082,9 +7101,9 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7082
7101
|
* @param v - 纹理对象
|
|
7083
7102
|
* @returns
|
|
7084
7103
|
*/ CheckerHelper.checkTexture = function checkTexture(v) {
|
|
7085
|
-
if (_instanceof1(v,
|
|
7104
|
+
if (_instanceof1(v, EFFECTS.Texture)) {
|
|
7086
7105
|
if (v.isDestroyed) {
|
|
7087
|
-
console.error("Texture is destroyed, " + v.name);
|
|
7106
|
+
console.error("Texture is destroyed, " + v.name + ".");
|
|
7088
7107
|
}
|
|
7089
7108
|
return !v.isDestroyed;
|
|
7090
7109
|
} else {
|
|
@@ -7132,14 +7151,14 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7132
7151
|
* @param v - 材质混合参数或未定义
|
|
7133
7152
|
* @returns
|
|
7134
7153
|
*/ CheckerHelper.checkMatBlending = function checkMatBlending(v) {
|
|
7135
|
-
return v === undefined || v ===
|
|
7154
|
+
return v === undefined || v === EFFECTS.spec.MaterialBlending.opaque || v === EFFECTS.spec.MaterialBlending.masked || v === EFFECTS.spec.MaterialBlending.translucent || v === EFFECTS.spec.MaterialBlending.additive;
|
|
7136
7155
|
};
|
|
7137
7156
|
/**
|
|
7138
7157
|
* 检查材质单双面模式或未定义
|
|
7139
7158
|
* @param v - 材质单双面模式或未定义
|
|
7140
7159
|
* @returns
|
|
7141
7160
|
*/ CheckerHelper.checkMatSide = function checkMatSide(v) {
|
|
7142
|
-
return v === undefined || v ===
|
|
7161
|
+
return v === undefined || v === EFFECTS.spec.SideMode.BACK || v === EFFECTS.spec.SideMode.DOUBLE || v === EFFECTS.spec.SideMode.FRONT;
|
|
7143
7162
|
};
|
|
7144
7163
|
/**
|
|
7145
7164
|
* 检查动画路径模式
|
|
@@ -7160,15 +7179,15 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7160
7179
|
* @param v - 几何体
|
|
7161
7180
|
* @param s - 蒙皮参数
|
|
7162
7181
|
*/ CheckerHelper.assertGeometry = function assertGeometry(v, s) {
|
|
7163
|
-
if (!_instanceof1(v,
|
|
7164
|
-
console.error("Invalid geometry type " + this.stringify(v));
|
|
7182
|
+
if (!_instanceof1(v, EFFECTS.Geometry)) {
|
|
7183
|
+
console.error("Invalid geometry type " + this.stringify(v) + ".");
|
|
7165
7184
|
}
|
|
7166
7185
|
// @ts-expect-error
|
|
7167
7186
|
if (v.isDestroyed === true) {
|
|
7168
|
-
console.error("Geometry object is destroyed");
|
|
7187
|
+
console.error("Geometry object is destroyed.");
|
|
7169
7188
|
}
|
|
7170
7189
|
if (!this.checkNonnegative(v.getDrawStart())) {
|
|
7171
|
-
console.error("Invalid geometry draw start: " + v.getDrawStart() + ", " + this.stringify(v));
|
|
7190
|
+
console.error("Invalid geometry draw start: " + v.getDrawStart() + ", " + this.stringify(v) + ".");
|
|
7172
7191
|
}
|
|
7173
7192
|
// // drawCount不再为负
|
|
7174
7193
|
// if (!this.checkPositive(v.getDrawCount())) {
|
|
@@ -7227,7 +7246,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7227
7246
|
var attribArray = this.createAttributeArray(v, name);
|
|
7228
7247
|
if (attribArray !== undefined) {
|
|
7229
7248
|
if (attribArray.getLength() < drawCount) {
|
|
7230
|
-
console.error(name + " Length(" + attribArray.getLength() + ") is less than draw count(" + drawCount + "), " + this.stringify(v));
|
|
7249
|
+
console.error(name + " Length(" + attribArray.getLength() + ") is less than draw count(" + drawCount + "), " + this.stringify(v) + ".");
|
|
7231
7250
|
}
|
|
7232
7251
|
}
|
|
7233
7252
|
};
|
|
@@ -7260,24 +7279,24 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7260
7279
|
* @param v - 蒙皮参数
|
|
7261
7280
|
*/ CheckerHelper.assertModelSkinOptions = function assertModelSkinOptions(v) {
|
|
7262
7281
|
if (!this.checkStringUndef(v.name)) {
|
|
7263
|
-
console.error("Invalid skin name " + v.name + ", " + this.stringify(v));
|
|
7282
|
+
console.error("Invalid skin name " + v.name + ", " + this.stringify(v) + ".");
|
|
7264
7283
|
}
|
|
7265
7284
|
if (!this.checkNumberArray(v.joints)) {
|
|
7266
|
-
console.error("Invalid skin joints " + v.joints + ", " + this.stringify(v));
|
|
7285
|
+
console.error("Invalid skin joints " + v.joints + ", " + this.stringify(v) + ".");
|
|
7267
7286
|
}
|
|
7268
7287
|
if (!this.checkNumberUndef(v.skeleton)) {
|
|
7269
|
-
console.error("Invalid skin skeleton " + v.skeleton + ", " + this.stringify(v));
|
|
7288
|
+
console.error("Invalid skin skeleton " + v.skeleton + ", " + this.stringify(v) + ".");
|
|
7270
7289
|
}
|
|
7271
7290
|
if (!this.checkFloat32ArrayUndef(v.inverseBindMatrices)) {
|
|
7272
|
-
console.error("Invalid skin inverseBindMatrices " + v.inverseBindMatrices + ", " + this.stringify(v));
|
|
7291
|
+
console.error("Invalid skin inverseBindMatrices " + v.inverseBindMatrices + ", " + this.stringify(v) + ".");
|
|
7273
7292
|
}
|
|
7274
7293
|
//
|
|
7275
7294
|
if (v.inverseBindMatrices !== undefined) {
|
|
7276
7295
|
if (v.inverseBindMatrices.length <= 0 || v.inverseBindMatrices.length % 16 !== 0) {
|
|
7277
|
-
console.error("Invalid skin inverseBindMatrices length " + v.inverseBindMatrices + ", " + this.stringify(v));
|
|
7296
|
+
console.error("Invalid skin inverseBindMatrices length " + v.inverseBindMatrices + ", " + this.stringify(v) + ".");
|
|
7278
7297
|
}
|
|
7279
7298
|
if (v.joints.length * 16 !== v.inverseBindMatrices.length) {
|
|
7280
|
-
console.error("Mismatch: skin joints and inverseBindMatrices length, " + v.joints + ", " + v.inverseBindMatrices + ", " + this.stringify(v));
|
|
7299
|
+
console.error("Mismatch: skin joints and inverseBindMatrices length, " + v.joints + ", " + v.inverseBindMatrices + ", " + this.stringify(v) + ".");
|
|
7281
7300
|
}
|
|
7282
7301
|
var mat = new Matrix4();
|
|
7283
7302
|
for(var i = 0; i < v.inverseBindMatrices.length; i += 16){
|
|
@@ -7285,12 +7304,12 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7285
7304
|
mat.elements[j] = v.inverseBindMatrices[i + j];
|
|
7286
7305
|
}
|
|
7287
7306
|
if (Math.abs(mat.determinant()) < 1e-5) {
|
|
7288
|
-
console.error("Determinant of inverseBindMatrices is too small " + mat.determinant() + ", index " + i / 16 + ", " + this.stringify(v));
|
|
7307
|
+
console.error("Determinant of inverseBindMatrices is too small " + mat.determinant() + ", index " + i / 16 + ", " + this.stringify(v) + ".");
|
|
7289
7308
|
}
|
|
7290
7309
|
}
|
|
7291
7310
|
} else {
|
|
7292
7311
|
if (v.joints.length <= 0) {
|
|
7293
|
-
console.error("Invalid skin joints length " + v.joints + ", " + this.stringify(v));
|
|
7312
|
+
console.error("Invalid skin joints length " + v.joints + ", " + this.stringify(v) + ".");
|
|
7294
7313
|
}
|
|
7295
7314
|
}
|
|
7296
7315
|
};
|
|
@@ -7298,140 +7317,140 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7298
7317
|
* 检查材质参数
|
|
7299
7318
|
* @param v - 材质参数
|
|
7300
7319
|
*/ CheckerHelper.assertMatOptions = function assertMatOptions(v) {
|
|
7301
|
-
if (v.type ===
|
|
7320
|
+
if (v.type === EFFECTS.spec.MaterialType.unlit) {
|
|
7302
7321
|
if (!this.checkString(v.name)) {
|
|
7303
|
-
console.error("Invalid material name " + v.name + ", " + this.stringify(v));
|
|
7322
|
+
console.error("Invalid material name " + v.name + ", " + this.stringify(v) + ".");
|
|
7304
7323
|
}
|
|
7305
7324
|
//
|
|
7306
7325
|
if (!this.checkNonnegative4(v.baseColorFactor)) {
|
|
7307
|
-
console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v));
|
|
7326
|
+
console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v) + ".");
|
|
7308
7327
|
}
|
|
7309
7328
|
if (!this.checkTextureUndef(v.baseColorTexture)) {
|
|
7310
|
-
console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v));
|
|
7329
|
+
console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v) + ".");
|
|
7311
7330
|
}
|
|
7312
7331
|
if (!this.checkTexTransformUndef(v.baseColorTextureTransform)) {
|
|
7313
|
-
console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v));
|
|
7332
|
+
console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v) + ".");
|
|
7314
7333
|
}
|
|
7315
7334
|
if (!this.checkTexCoord(v.baseColorTextureCoordinate)) {
|
|
7316
|
-
console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v));
|
|
7335
|
+
console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7317
7336
|
}
|
|
7318
7337
|
//
|
|
7319
7338
|
if (!this.checkBooleanUndef(v.depthMask)) {
|
|
7320
|
-
console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v));
|
|
7339
|
+
console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v) + ".");
|
|
7321
7340
|
}
|
|
7322
7341
|
if (!this.checkMatBlending(v.blending)) {
|
|
7323
|
-
console.error("Invalid material blending " + v.blending + ", " + this.stringify(v));
|
|
7342
|
+
console.error("Invalid material blending " + v.blending + ", " + this.stringify(v) + ".");
|
|
7324
7343
|
}
|
|
7325
7344
|
if (!this.checkMatSide(v.side)) {
|
|
7326
|
-
console.error("Invalid material side " + v.side + ", " + this.stringify(v));
|
|
7345
|
+
console.error("Invalid material side " + v.side + ", " + this.stringify(v) + ".");
|
|
7327
7346
|
}
|
|
7328
|
-
if (v.blending ===
|
|
7347
|
+
if (v.blending === EFFECTS.spec.MaterialBlending.masked) {
|
|
7329
7348
|
if (v.alphaCutOff === undefined) {
|
|
7330
|
-
console.error("Material alphaCutOff is required for mask, " + this.stringify(v));
|
|
7349
|
+
console.error("Material alphaCutOff is required for mask, " + this.stringify(v) + ".");
|
|
7331
7350
|
}
|
|
7332
7351
|
}
|
|
7333
7352
|
if (!this.checkNumber01Undef(v.alphaCutOff)) {
|
|
7334
|
-
console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v));
|
|
7353
|
+
console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v) + ".");
|
|
7335
7354
|
}
|
|
7336
|
-
} else if (v.type ===
|
|
7355
|
+
} else if (v.type === EFFECTS.spec.MaterialType.pbr) {
|
|
7337
7356
|
if (!this.checkString(v.name)) {
|
|
7338
|
-
console.error("Invalid material name " + v.name + ", " + this.stringify(v));
|
|
7357
|
+
console.error("Invalid material name " + v.name + ", " + this.stringify(v) + ".");
|
|
7339
7358
|
}
|
|
7340
7359
|
//
|
|
7341
7360
|
if (!this.checkNonnegative4(v.baseColorFactor)) {
|
|
7342
|
-
console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v));
|
|
7361
|
+
console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v) + ".");
|
|
7343
7362
|
}
|
|
7344
7363
|
if (!this.checkTextureUndef(v.baseColorTexture)) {
|
|
7345
|
-
console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v));
|
|
7364
|
+
console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v) + ".");
|
|
7346
7365
|
}
|
|
7347
7366
|
if (!this.checkTexTransformUndef(v.baseColorTextureTransform)) {
|
|
7348
|
-
console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v));
|
|
7367
|
+
console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v) + ".");
|
|
7349
7368
|
}
|
|
7350
7369
|
if (!this.checkTexCoord(v.baseColorTextureCoordinate)) {
|
|
7351
|
-
console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v));
|
|
7370
|
+
console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7352
7371
|
}
|
|
7353
7372
|
//
|
|
7354
7373
|
if (!this.checkBooleanUndef(v.useSpecularAA)) {
|
|
7355
|
-
console.error("Invalid material useSpecularAA " + v.useSpecularAA + ", " + this.stringify(v));
|
|
7374
|
+
console.error("Invalid material useSpecularAA " + v.useSpecularAA + ", " + this.stringify(v) + ".");
|
|
7356
7375
|
}
|
|
7357
7376
|
if (!this.checkNumber01(v.metallicFactor)) {
|
|
7358
|
-
console.error("Invalid material metallicFactor " + v.metallicFactor + ", " + this.stringify(v));
|
|
7377
|
+
console.error("Invalid material metallicFactor " + v.metallicFactor + ", " + this.stringify(v) + ".");
|
|
7359
7378
|
}
|
|
7360
7379
|
if (!this.checkNonnegative(v.roughnessFactor)) {
|
|
7361
|
-
console.error("Invalid material roughnessFactor " + v.roughnessFactor + ", " + this.stringify(v));
|
|
7380
|
+
console.error("Invalid material roughnessFactor " + v.roughnessFactor + ", " + this.stringify(v) + ".");
|
|
7362
7381
|
}
|
|
7363
7382
|
if (!this.checkTextureUndef(v.metallicRoughnessTexture)) {
|
|
7364
|
-
console.error("Invalid material metallicRoughnessTexture " + v.metallicRoughnessTexture + ", " + this.stringify(v));
|
|
7383
|
+
console.error("Invalid material metallicRoughnessTexture " + v.metallicRoughnessTexture + ", " + this.stringify(v) + ".");
|
|
7365
7384
|
}
|
|
7366
7385
|
if (!this.checkTexTransformUndef(v.metallicRoughnessTextureTransform)) {
|
|
7367
|
-
console.error("Invalid material metallicRoughnessTextureTransform " + v.metallicRoughnessTextureTransform + ", " + this.stringify(v));
|
|
7386
|
+
console.error("Invalid material metallicRoughnessTextureTransform " + v.metallicRoughnessTextureTransform + ", " + this.stringify(v) + ".");
|
|
7368
7387
|
}
|
|
7369
7388
|
if (!this.checkTexCoord(v.metallicRoughnessTextureCoordinate)) {
|
|
7370
|
-
console.error("Invalid material metallicRoughnessTextureCoordinate " + v.metallicRoughnessTextureCoordinate + ", " + this.stringify(v));
|
|
7389
|
+
console.error("Invalid material metallicRoughnessTextureCoordinate " + v.metallicRoughnessTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7371
7390
|
}
|
|
7372
7391
|
//
|
|
7373
7392
|
if (!this.checkTextureUndef(v.normalTexture)) {
|
|
7374
|
-
console.error("Invalid material normalTexture " + v.normalTexture + ", " + this.stringify(v));
|
|
7393
|
+
console.error("Invalid material normalTexture " + v.normalTexture + ", " + this.stringify(v) + ".");
|
|
7375
7394
|
}
|
|
7376
7395
|
if (!this.checkNonnegativeUndef(v.normalTextureScale)) {
|
|
7377
|
-
console.error("Invalid material normalTextureScale " + v.normalTextureScale + ", " + this.stringify(v));
|
|
7396
|
+
console.error("Invalid material normalTextureScale " + v.normalTextureScale + ", " + this.stringify(v) + ".");
|
|
7378
7397
|
}
|
|
7379
7398
|
if (!this.checkTexTransformUndef(v.normalTextureTransform)) {
|
|
7380
|
-
console.error("Invalid material normalTextureTransform " + v.normalTextureTransform + ", " + this.stringify(v));
|
|
7399
|
+
console.error("Invalid material normalTextureTransform " + v.normalTextureTransform + ", " + this.stringify(v) + ".");
|
|
7381
7400
|
}
|
|
7382
7401
|
if (!this.checkTexCoord(v.normalTextureCoordinate)) {
|
|
7383
|
-
console.error("Invalid material normalTextureCoordinate " + v.normalTextureCoordinate + ", " + this.stringify(v));
|
|
7402
|
+
console.error("Invalid material normalTextureCoordinate " + v.normalTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7384
7403
|
}
|
|
7385
7404
|
//
|
|
7386
7405
|
if (!this.checkTextureUndef(v.occlusionTexture)) {
|
|
7387
|
-
console.error("Invalid material occlusionTexture " + v.occlusionTexture + ", " + this.stringify(v));
|
|
7406
|
+
console.error("Invalid material occlusionTexture " + v.occlusionTexture + ", " + this.stringify(v) + ".");
|
|
7388
7407
|
}
|
|
7389
7408
|
if (!this.checkNumber01Undef(v.occlusionTextureStrength)) {
|
|
7390
|
-
console.error("Invalid material occlusionTextureStrength " + v.occlusionTextureStrength + ", " + this.stringify(v));
|
|
7409
|
+
console.error("Invalid material occlusionTextureStrength " + v.occlusionTextureStrength + ", " + this.stringify(v) + ".");
|
|
7391
7410
|
}
|
|
7392
7411
|
if (!this.checkTexTransformUndef(v.occlusionTextureTransform)) {
|
|
7393
|
-
console.error("Invalid material occlusionTextureTransform " + v.occlusionTextureTransform + ", " + this.stringify(v));
|
|
7412
|
+
console.error("Invalid material occlusionTextureTransform " + v.occlusionTextureTransform + ", " + this.stringify(v) + ".");
|
|
7394
7413
|
}
|
|
7395
7414
|
if (!this.checkTexCoord(v.occlusionTextureCoordinate)) {
|
|
7396
|
-
console.error("Invalid material occlusionTextureCoordinate " + v.occlusionTextureCoordinate + ", " + this.stringify(v));
|
|
7415
|
+
console.error("Invalid material occlusionTextureCoordinate " + v.occlusionTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7397
7416
|
}
|
|
7398
7417
|
//
|
|
7399
7418
|
//
|
|
7400
7419
|
if (!this.checkNonnegative4(v.emissiveFactor)) {
|
|
7401
|
-
console.error("Invalid material emissiveFactor " + v.emissiveFactor + ", " + this.stringify(v));
|
|
7420
|
+
console.error("Invalid material emissiveFactor " + v.emissiveFactor + ", " + this.stringify(v) + ".");
|
|
7402
7421
|
}
|
|
7403
7422
|
if (!this.checkNonnegative(v.emissiveIntensity)) {
|
|
7404
|
-
console.error("Invalid material emissiveIntensity " + v.emissiveIntensity + ", " + this.stringify(v));
|
|
7423
|
+
console.error("Invalid material emissiveIntensity " + v.emissiveIntensity + ", " + this.stringify(v) + ".");
|
|
7405
7424
|
}
|
|
7406
7425
|
if (!this.checkTextureUndef(v.emissiveTexture)) {
|
|
7407
|
-
console.error("Invalid material emissiveTexture " + v.emissiveTexture + ", " + this.stringify(v));
|
|
7426
|
+
console.error("Invalid material emissiveTexture " + v.emissiveTexture + ", " + this.stringify(v) + ".");
|
|
7408
7427
|
}
|
|
7409
7428
|
if (!this.checkTexTransformUndef(v.emissiveTextureTransform)) {
|
|
7410
|
-
console.error("Invalid material emissiveTextureTransform " + v.emissiveTextureTransform + ", " + this.stringify(v));
|
|
7429
|
+
console.error("Invalid material emissiveTextureTransform " + v.emissiveTextureTransform + ", " + this.stringify(v) + ".");
|
|
7411
7430
|
}
|
|
7412
7431
|
if (!this.checkTexCoord(v.emissiveTextureCoordinate)) {
|
|
7413
|
-
console.error("Invalid material emissiveTextureCoordinate " + v.emissiveTextureCoordinate + ", " + this.stringify(v));
|
|
7432
|
+
console.error("Invalid material emissiveTextureCoordinate " + v.emissiveTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7414
7433
|
}
|
|
7415
7434
|
//
|
|
7416
7435
|
if (!this.checkBooleanUndef(v.depthMask)) {
|
|
7417
|
-
console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v));
|
|
7436
|
+
console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v) + ".");
|
|
7418
7437
|
}
|
|
7419
7438
|
if (!this.checkMatBlending(v.blending)) {
|
|
7420
|
-
console.error("Invalid material blending " + v.blending + ", " + this.stringify(v));
|
|
7439
|
+
console.error("Invalid material blending " + v.blending + ", " + this.stringify(v) + ".");
|
|
7421
7440
|
}
|
|
7422
7441
|
if (!this.checkMatSide(v.side)) {
|
|
7423
|
-
console.error("Invalid material side " + v.side + ", " + this.stringify(v));
|
|
7442
|
+
console.error("Invalid material side " + v.side + ", " + this.stringify(v) + ".");
|
|
7424
7443
|
}
|
|
7425
|
-
if (v.blending ===
|
|
7444
|
+
if (v.blending === EFFECTS.spec.MaterialBlending.masked) {
|
|
7426
7445
|
if (v.alphaCutOff === undefined) {
|
|
7427
|
-
console.error("Material alphaCutOff is required for mask, " + this.stringify(v));
|
|
7446
|
+
console.error("Material alphaCutOff is required for mask, " + this.stringify(v) + ".");
|
|
7428
7447
|
}
|
|
7429
7448
|
}
|
|
7430
7449
|
if (!this.checkNumber01Undef(v.alphaCutOff)) {
|
|
7431
|
-
console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v));
|
|
7450
|
+
console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v) + ".");
|
|
7432
7451
|
}
|
|
7433
7452
|
} else {
|
|
7434
|
-
console.error("Invalid material type " + this.stringify(v));
|
|
7453
|
+
console.error("Invalid material type " + this.stringify(v) + ".");
|
|
7435
7454
|
}
|
|
7436
7455
|
};
|
|
7437
7456
|
/**
|
|
@@ -7449,7 +7468,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7449
7468
|
* @param v - Model 插件 Mesh 参数
|
|
7450
7469
|
*/ CheckerHelper.assertModelMeshOptions = function assertModelMeshOptions(v) {
|
|
7451
7470
|
if (!this.checkParent(v.parent)) {
|
|
7452
|
-
console.error("Invalid mesh parent " + v.parent + ", " + this.stringify(v));
|
|
7471
|
+
console.error("Invalid mesh parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7453
7472
|
}
|
|
7454
7473
|
if (v.skin !== undefined) {
|
|
7455
7474
|
this.assertModelSkinOptions(v.skin);
|
|
@@ -7458,7 +7477,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7458
7477
|
for(var i = 0; i < v.primitives.length; i++){
|
|
7459
7478
|
var prim = v.primitives[i];
|
|
7460
7479
|
if (!this.assertPrimOptions(prim)) {
|
|
7461
|
-
console.error("Invalid primitive " + prim + ", " + this.stringify(v));
|
|
7480
|
+
console.error("Invalid primitive " + prim + ", " + this.stringify(v) + ".");
|
|
7462
7481
|
}
|
|
7463
7482
|
var morph = new PMorph();
|
|
7464
7483
|
morph.create(prim.geometry);
|
|
@@ -7468,11 +7487,11 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7468
7487
|
var morph0 = morphList[i1 - 1];
|
|
7469
7488
|
var morph1 = morphList[i1];
|
|
7470
7489
|
if (!morph0.equals(morph1)) {
|
|
7471
|
-
console.error("Morph states mismatch: " + this.stringify(morph0) + ", " + this.stringify(morph1) + ", " + this.stringify(v));
|
|
7490
|
+
console.error("Morph states mismatch: " + this.stringify(morph0) + ", " + this.stringify(morph1) + ", " + this.stringify(v) + ".");
|
|
7472
7491
|
}
|
|
7473
7492
|
}
|
|
7474
7493
|
if (!this.checkBooleanUndef(v.hide)) {
|
|
7475
|
-
console.error("Invalid mesh hide " + v.hide + ", " + this.stringify(v));
|
|
7494
|
+
console.error("Invalid mesh hide " + v.hide + ", " + this.stringify(v) + ".");
|
|
7476
7495
|
}
|
|
7477
7496
|
};
|
|
7478
7497
|
/**
|
|
@@ -7480,22 +7499,22 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7480
7499
|
* @param v - Model 插件相机参数
|
|
7481
7500
|
*/ CheckerHelper.assertModelCameraOptions = function assertModelCameraOptions(v) {
|
|
7482
7501
|
if (!this.checkParent(v.parent)) {
|
|
7483
|
-
console.error("Invalid camera parent " + v.parent + ", " + this.stringify(v));
|
|
7502
|
+
console.error("Invalid camera parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7484
7503
|
}
|
|
7485
7504
|
if (!this.checkNumberUndef(v.aspect)) {
|
|
7486
|
-
console.error("Invalid camera aspect " + v.aspect + ", " + this.stringify(v));
|
|
7505
|
+
console.error("Invalid camera aspect " + v.aspect + ", " + this.stringify(v) + ".");
|
|
7487
7506
|
}
|
|
7488
7507
|
if (!this.checkPositive(v.near)) {
|
|
7489
|
-
console.error("Invalid camera near " + v.near + ", " + this.stringify(v));
|
|
7508
|
+
console.error("Invalid camera near " + v.near + ", " + this.stringify(v) + ".");
|
|
7490
7509
|
}
|
|
7491
7510
|
if (!this.checkPositive(v.far) || v.far <= v.near) {
|
|
7492
|
-
console.error("Invalid camera far " + v.far + ", " + this.stringify(v));
|
|
7511
|
+
console.error("Invalid camera far " + v.far + ", " + this.stringify(v) + ".");
|
|
7493
7512
|
}
|
|
7494
7513
|
if (!this.checkPositive(v.fov)) {
|
|
7495
|
-
console.error("Invalid camera fov " + v.fov + ", " + this.stringify(v));
|
|
7514
|
+
console.error("Invalid camera fov " + v.fov + ", " + this.stringify(v) + ".");
|
|
7496
7515
|
}
|
|
7497
7516
|
if (!this.checkNumber01(v.clipMode)) {
|
|
7498
|
-
console.error("Invalid camera clipMode " + v.clipMode + ", " + this.stringify(v));
|
|
7517
|
+
console.error("Invalid camera clipMode " + v.clipMode + ", " + this.stringify(v) + ".");
|
|
7499
7518
|
}
|
|
7500
7519
|
};
|
|
7501
7520
|
/**
|
|
@@ -7504,58 +7523,58 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7504
7523
|
*/ CheckerHelper.assertModelLightOptions = function assertModelLightOptions(v) {
|
|
7505
7524
|
if (v.lightType === "directional") {
|
|
7506
7525
|
if (!this.checkParent(v.parent)) {
|
|
7507
|
-
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
|
|
7526
|
+
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7508
7527
|
}
|
|
7509
7528
|
if (!this.checkNonnegative4(v.color)) {
|
|
7510
|
-
console.error("Invalid light color " + v.color + ", " + this.stringify(v));
|
|
7529
|
+
console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
|
|
7511
7530
|
}
|
|
7512
7531
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7513
|
-
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
|
|
7532
|
+
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7514
7533
|
}
|
|
7515
7534
|
} else if (v.lightType === "point") {
|
|
7516
7535
|
if (!this.checkParent(v.parent)) {
|
|
7517
|
-
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
|
|
7536
|
+
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7518
7537
|
}
|
|
7519
7538
|
if (!this.checkNonnegative4(v.color)) {
|
|
7520
|
-
console.error("Invalid light color " + v.color + ", " + this.stringify(v));
|
|
7539
|
+
console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
|
|
7521
7540
|
}
|
|
7522
7541
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7523
|
-
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
|
|
7542
|
+
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7524
7543
|
}
|
|
7525
7544
|
if (!this.checkNonnegative(v.range)) {
|
|
7526
|
-
console.error("Invalid light range " + v.range + ", " + this.stringify(v));
|
|
7545
|
+
console.error("Invalid light range " + v.range + ", " + this.stringify(v) + ".");
|
|
7527
7546
|
}
|
|
7528
7547
|
} else if (v.lightType === "spot") {
|
|
7529
7548
|
if (!this.checkParent(v.parent)) {
|
|
7530
|
-
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
|
|
7549
|
+
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7531
7550
|
}
|
|
7532
7551
|
if (!this.checkNonnegative4(v.color)) {
|
|
7533
|
-
console.error("Invalid light color " + v.color + ", " + this.stringify(v));
|
|
7552
|
+
console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
|
|
7534
7553
|
}
|
|
7535
7554
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7536
|
-
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
|
|
7555
|
+
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7537
7556
|
}
|
|
7538
7557
|
if (!this.checkNonnegative(v.range)) {
|
|
7539
|
-
console.error("Invalid light range " + v.range + ", " + this.stringify(v));
|
|
7558
|
+
console.error("Invalid light range " + v.range + ", " + this.stringify(v) + ".");
|
|
7540
7559
|
}
|
|
7541
7560
|
if (!this.checkNonnegative(v.innerConeAngle)) {
|
|
7542
|
-
console.error("Invalid light innerConeAngle " + v.innerConeAngle + ", " + this.stringify(v));
|
|
7561
|
+
console.error("Invalid light innerConeAngle " + v.innerConeAngle + ", " + this.stringify(v) + ".");
|
|
7543
7562
|
}
|
|
7544
7563
|
if (!this.checkNonnegative(v.outerConeAngle)) {
|
|
7545
|
-
console.error("Invalid light outerConeAngle " + v.outerConeAngle + ", " + this.stringify(v));
|
|
7564
|
+
console.error("Invalid light outerConeAngle " + v.outerConeAngle + ", " + this.stringify(v) + ".");
|
|
7546
7565
|
}
|
|
7547
7566
|
} else if (v.lightType === "ambient") {
|
|
7548
7567
|
if (!this.checkParent(v.parent)) {
|
|
7549
|
-
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
|
|
7568
|
+
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7550
7569
|
}
|
|
7551
7570
|
if (!this.checkNonnegative4(v.color)) {
|
|
7552
|
-
console.error("Invalid light color " + v.color + ", " + this.stringify(v));
|
|
7571
|
+
console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
|
|
7553
7572
|
}
|
|
7554
7573
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7555
|
-
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
|
|
7574
|
+
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7556
7575
|
}
|
|
7557
7576
|
} else {
|
|
7558
|
-
console.error("Invalid light type " + this.stringify(v));
|
|
7577
|
+
console.error("Invalid light type " + this.stringify(v) + ".");
|
|
7559
7578
|
}
|
|
7560
7579
|
};
|
|
7561
7580
|
/**
|
|
@@ -7564,43 +7583,43 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7564
7583
|
*/ CheckerHelper.assertModelSkyboxOptions = function assertModelSkyboxOptions(v) {
|
|
7565
7584
|
var _this = this;
|
|
7566
7585
|
if (!this.checkBoolean(v.renderable)) {
|
|
7567
|
-
console.error("Invalid skybox renderable " + v.renderable + ", " + this.stringify(v));
|
|
7586
|
+
console.error("Invalid skybox renderable " + v.renderable + ", " + this.stringify(v) + ".");
|
|
7568
7587
|
}
|
|
7569
7588
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7570
|
-
console.error("Invalid skybox intensity " + v.intensity + ", " + this.stringify(v));
|
|
7589
|
+
console.error("Invalid skybox intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7571
7590
|
}
|
|
7572
7591
|
if (!this.checkNonnegative(v.reflectionsIntensity)) {
|
|
7573
|
-
console.error("Invalid skybox reflectionsIntensity " + v.reflectionsIntensity + ", " + this.stringify(v));
|
|
7592
|
+
console.error("Invalid skybox reflectionsIntensity " + v.reflectionsIntensity + ", " + this.stringify(v) + ".");
|
|
7574
7593
|
}
|
|
7575
7594
|
//
|
|
7576
7595
|
var c = v.irradianceCoeffs;
|
|
7577
7596
|
if (c !== undefined) {
|
|
7578
7597
|
if (!Array.isArray(c) || c.length != 9) {
|
|
7579
|
-
console.error("Invalid skybox irradianceCoeffs " + c + ", " + this.stringify(v));
|
|
7598
|
+
console.error("Invalid skybox irradianceCoeffs " + c + ", " + this.stringify(v) + ".");
|
|
7580
7599
|
}
|
|
7581
7600
|
c.forEach(function(v) {
|
|
7582
7601
|
if (!_this.checkVec3(v)) {
|
|
7583
|
-
console.error("Invalid skybox irradianceCoeffs " + c + ", " + _this.stringify(v));
|
|
7602
|
+
console.error("Invalid skybox irradianceCoeffs " + c + ", " + _this.stringify(v) + ".");
|
|
7584
7603
|
}
|
|
7585
7604
|
});
|
|
7586
7605
|
} else if (v.diffuseImage !== undefined) {
|
|
7587
7606
|
if (!this.checkTexture(v.diffuseImage)) {
|
|
7588
|
-
console.error("Invalid skybox diffuseImage " + v.diffuseImage + ", " + this.stringify(v));
|
|
7607
|
+
console.error("Invalid skybox diffuseImage " + v.diffuseImage + ", " + this.stringify(v) + ".");
|
|
7589
7608
|
}
|
|
7590
7609
|
} else {
|
|
7591
|
-
console.error("Invalid skybox, irradianceCoeffs or diffuseImage should give one, " + this.stringify(v));
|
|
7610
|
+
console.error("Invalid skybox, irradianceCoeffs or diffuseImage should give one, " + this.stringify(v) + ".");
|
|
7592
7611
|
}
|
|
7593
7612
|
if (!this.checkTexture(v.specularImage)) {
|
|
7594
|
-
console.error("Invalid skybox specularImage " + v.specularImage + ", " + this.stringify(v));
|
|
7613
|
+
console.error("Invalid skybox specularImage " + v.specularImage + ", " + this.stringify(v) + ".");
|
|
7595
7614
|
}
|
|
7596
7615
|
if (!this.checkPositive(v.specularImageSize)) {
|
|
7597
|
-
console.error("Invalid skybox specularImageSize " + v.specularImageSize + ", " + this.stringify(v));
|
|
7616
|
+
console.error("Invalid skybox specularImageSize " + v.specularImageSize + ", " + this.stringify(v) + ".");
|
|
7598
7617
|
}
|
|
7599
7618
|
if (!this.checkPositive(v.specularMipCount)) {
|
|
7600
|
-
console.error("Invalid skybox specularMipCount " + v.specularMipCount + ", " + this.stringify(v));
|
|
7619
|
+
console.error("Invalid skybox specularMipCount " + v.specularMipCount + ", " + this.stringify(v) + ".");
|
|
7601
7620
|
}
|
|
7602
7621
|
if (this.pow2(v.specularMipCount) > v.specularImageSize) {
|
|
7603
|
-
console.error("Invalid skybox specularMipCount or specularImageSize, " + this.stringify(v));
|
|
7622
|
+
console.error("Invalid skybox specularMipCount or specularImageSize, " + this.stringify(v) + ".");
|
|
7604
7623
|
}
|
|
7605
7624
|
};
|
|
7606
7625
|
/**
|
|
@@ -7636,14 +7655,14 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7636
7655
|
*/ CheckerHelper.assertModelAnimOptions = function assertModelAnimOptions(v) {
|
|
7637
7656
|
var _this = this;
|
|
7638
7657
|
if (!this.checkStringUndef(v.name)) {
|
|
7639
|
-
console.error("Invalid animation name " + v.name + ", " + this.stringify(v));
|
|
7658
|
+
console.error("Invalid animation name " + v.name + ", " + this.stringify(v) + ".");
|
|
7640
7659
|
}
|
|
7641
7660
|
if (!Array.isArray(v.tracks)) {
|
|
7642
|
-
console.error("Invalid animation tracks " + v.tracks + ", " + this.stringify(v));
|
|
7661
|
+
console.error("Invalid animation tracks " + v.tracks + ", " + this.stringify(v) + ".");
|
|
7643
7662
|
}
|
|
7644
7663
|
v.tracks.forEach(function(t) {
|
|
7645
7664
|
if (!_this.checkModelAnimTrackOptions(t)) {
|
|
7646
|
-
console.error("Invalid animation track " + t + ", " + _this.stringify(v));
|
|
7665
|
+
console.error("Invalid animation track " + t + ", " + _this.stringify(v) + ".");
|
|
7647
7666
|
}
|
|
7648
7667
|
});
|
|
7649
7668
|
};
|
|
@@ -7653,18 +7672,18 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7653
7672
|
*/ CheckerHelper.assertTreeOptions = function assertTreeOptions(v) {
|
|
7654
7673
|
var _this = this;
|
|
7655
7674
|
if (!this.checkNumberUndef(v.animation)) {
|
|
7656
|
-
console.error("Invalid tree animation " + v.animation + ", " + this.stringify(v));
|
|
7675
|
+
console.error("Invalid tree animation " + v.animation + ", " + this.stringify(v) + ".");
|
|
7657
7676
|
}
|
|
7658
7677
|
if (v.animations !== undefined) {
|
|
7659
7678
|
if (!Array.isArray(v.animations)) {
|
|
7660
|
-
console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v));
|
|
7679
|
+
console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v) + ".");
|
|
7661
7680
|
}
|
|
7662
7681
|
v.animations.forEach(function(anim) {
|
|
7663
7682
|
_this.assertModelAnimOptions(anim);
|
|
7664
7683
|
});
|
|
7665
7684
|
if (v.animation !== undefined) {
|
|
7666
7685
|
if (v.animation < -1 || v.animation >= v.animations.length) {
|
|
7667
|
-
console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v));
|
|
7686
|
+
console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v) + ".");
|
|
7668
7687
|
}
|
|
7669
7688
|
}
|
|
7670
7689
|
}
|
|
@@ -7685,15 +7704,15 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7685
7704
|
if (typeof object[prop] == "function") {
|
|
7686
7705
|
continue;
|
|
7687
7706
|
}
|
|
7688
|
-
if (_instanceof1(object[prop],
|
|
7707
|
+
if (_instanceof1(object[prop], EFFECTS.Texture)) {
|
|
7689
7708
|
simpleObject[prop] = object[prop].name;
|
|
7690
7709
|
continue;
|
|
7691
7710
|
}
|
|
7692
|
-
if (_instanceof1(object[prop],
|
|
7711
|
+
if (_instanceof1(object[prop], EFFECTS.Geometry)) {
|
|
7693
7712
|
simpleObject[prop] = object[prop].name;
|
|
7694
7713
|
continue;
|
|
7695
7714
|
}
|
|
7696
|
-
if (_instanceof1(object[prop],
|
|
7715
|
+
if (_instanceof1(object[prop], EFFECTS.Renderer)) {
|
|
7697
7716
|
continue;
|
|
7698
7717
|
}
|
|
7699
7718
|
simpleObject[prop] = object[prop];
|
|
@@ -7861,7 +7880,7 @@ exports.CullMode = void 0;
|
|
|
7861
7880
|
*/ _proto.updateUniforms = function updateUniforms(material) {
|
|
7862
7881
|
// 渲染 UV 结果输出时,设置 uv 大小
|
|
7863
7882
|
var renderMode = PGlobalState.getInstance().renderMode3D;
|
|
7864
|
-
if (renderMode ===
|
|
7883
|
+
if (renderMode === EFFECTS.spec.RenderMode3D.uv) {
|
|
7865
7884
|
var debugUVGridSize = PGlobalState.getInstance().renderMode3DUVGridSize;
|
|
7866
7885
|
material.setFloat("_DebugUVGridSize", debugUVGridSize);
|
|
7867
7886
|
}
|
|
@@ -7936,14 +7955,14 @@ exports.CullMode = void 0;
|
|
|
7936
7955
|
material.depthTest = this.ZTest;
|
|
7937
7956
|
material.depthMask = this.ZWrite;
|
|
7938
7957
|
material.blendEquation = [
|
|
7939
|
-
|
|
7940
|
-
|
|
7958
|
+
EFFECTS.glContext.FUNC_ADD,
|
|
7959
|
+
EFFECTS.glContext.FUNC_ADD
|
|
7941
7960
|
];
|
|
7942
7961
|
material.blendFunction = [
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7962
|
+
EFFECTS.glContext.ONE,
|
|
7963
|
+
EFFECTS.glContext.ONE_MINUS_SRC_ALPHA,
|
|
7964
|
+
EFFECTS.glContext.ONE,
|
|
7965
|
+
EFFECTS.glContext.ONE_MINUS_SRC_ALPHA
|
|
7947
7966
|
];
|
|
7948
7967
|
} else {
|
|
7949
7968
|
if (PGlobalState.getInstance().isTiny3dMode) {
|
|
@@ -7963,12 +7982,12 @@ exports.CullMode = void 0;
|
|
|
7963
7982
|
if (this.isDoubleSide()) {
|
|
7964
7983
|
material.culling = false;
|
|
7965
7984
|
} else if (this.isBackSide()) {
|
|
7966
|
-
material.cullFace =
|
|
7967
|
-
material.frontFace =
|
|
7985
|
+
material.cullFace = EFFECTS.glContext.FRONT;
|
|
7986
|
+
material.frontFace = EFFECTS.glContext.CCW;
|
|
7968
7987
|
material.culling = true;
|
|
7969
7988
|
} else {
|
|
7970
|
-
material.cullFace =
|
|
7971
|
-
material.frontFace =
|
|
7989
|
+
material.cullFace = EFFECTS.glContext.BACK;
|
|
7990
|
+
material.frontFace = EFFECTS.glContext.CCW;
|
|
7972
7991
|
material.culling = true;
|
|
7973
7992
|
}
|
|
7974
7993
|
};
|
|
@@ -8789,7 +8808,7 @@ exports.CullMode = void 0;
|
|
|
8789
8808
|
} else {
|
|
8790
8809
|
var coeffs = this.irradianceCoeffs;
|
|
8791
8810
|
if (coeffs === undefined || coeffs.length != 9) {
|
|
8792
|
-
throw new Error("Invalid skybox irradiance coeffs " + coeffs);
|
|
8811
|
+
throw new Error("Invalid skybox irradiance coeffs " + coeffs + ".");
|
|
8793
8812
|
}
|
|
8794
8813
|
var aliasName = [
|
|
8795
8814
|
"l00",
|
|
@@ -8845,18 +8864,18 @@ exports.PSkyboxType = void 0;
|
|
|
8845
8864
|
];
|
|
8846
8865
|
return [
|
|
8847
8866
|
4,
|
|
8848
|
-
|
|
8867
|
+
EFFECTS.loadImage(imageList[i])
|
|
8849
8868
|
];
|
|
8850
8869
|
case 2:
|
|
8851
8870
|
image = _state.sent();
|
|
8852
8871
|
if (i > 0) {
|
|
8853
8872
|
if (i % 6 === 0) {
|
|
8854
8873
|
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);
|
|
8874
|
+
throw new Error("Invalid cube map list1: index " + i + ", image0 " + lastImage + ", image1 " + image + ".");
|
|
8856
8875
|
}
|
|
8857
8876
|
} else {
|
|
8858
8877
|
if (image.width !== lastImage.width || image.height !== lastImage.height) {
|
|
8859
|
-
throw new Error("Invalid cube map list2: index " + i + ", image0 " + lastImage + ", image1 " + image);
|
|
8878
|
+
throw new Error("Invalid cube map list2: index " + i + ", image0 " + lastImage + ", image1 " + image + ".");
|
|
8860
8879
|
}
|
|
8861
8880
|
}
|
|
8862
8881
|
}
|
|
@@ -8893,18 +8912,18 @@ exports.PSkyboxType = void 0;
|
|
|
8893
8912
|
brdfURL = "https://gw.alipayobjects.com/zos/gltf-asset/61420044606400/lut-ggx.png";
|
|
8894
8913
|
return [
|
|
8895
8914
|
4,
|
|
8896
|
-
|
|
8915
|
+
EFFECTS.loadImage(brdfURL)
|
|
8897
8916
|
];
|
|
8898
8917
|
case 1:
|
|
8899
8918
|
brdfLutImage = _state.sent();
|
|
8900
8919
|
brdfLutOpts = {
|
|
8901
8920
|
name: "brdfLut",
|
|
8902
|
-
wrapS:
|
|
8903
|
-
wrapT:
|
|
8904
|
-
magFilter:
|
|
8905
|
-
minFilter:
|
|
8921
|
+
wrapS: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
8922
|
+
wrapT: EFFECTS.glContext.CLAMP_TO_EDGE,
|
|
8923
|
+
magFilter: EFFECTS.glContext.LINEAR,
|
|
8924
|
+
minFilter: EFFECTS.glContext.LINEAR,
|
|
8906
8925
|
anisotropic: 1,
|
|
8907
|
-
sourceType:
|
|
8926
|
+
sourceType: EFFECTS.TextureSourceType.image,
|
|
8908
8927
|
image: brdfLutImage,
|
|
8909
8928
|
generateMipmap: false,
|
|
8910
8929
|
flipY: false,
|
|
@@ -8935,7 +8954,7 @@ exports.PSkyboxType = void 0;
|
|
|
8935
8954
|
];
|
|
8936
8955
|
case 1:
|
|
8937
8956
|
brdfLutOpts = _state.sent();
|
|
8938
|
-
brdfLutTexture =
|
|
8957
|
+
brdfLutTexture = EFFECTS.Texture.create(engine, brdfLutOpts);
|
|
8939
8958
|
return [
|
|
8940
8959
|
2,
|
|
8941
8960
|
brdfLutTexture
|
|
@@ -9015,10 +9034,10 @@ exports.PSkyboxType = void 0;
|
|
|
9015
9034
|
id: specularCubeData.textureOptions.id
|
|
9016
9035
|
};
|
|
9017
9036
|
var componentData = {
|
|
9018
|
-
id:
|
|
9019
|
-
dataType:
|
|
9037
|
+
id: EFFECTS.generateGUID(),
|
|
9038
|
+
dataType: EFFECTS.spec.DataType.SkyboxComponent,
|
|
9020
9039
|
item: {
|
|
9021
|
-
id:
|
|
9040
|
+
id: EFFECTS.generateGUID()
|
|
9022
9041
|
},
|
|
9023
9042
|
renderable: renderable,
|
|
9024
9043
|
intensity: intensity,
|
|
@@ -9071,7 +9090,7 @@ exports.PSkyboxType = void 0;
|
|
|
9071
9090
|
params.specularImage.forEach(function(cubemap) {
|
|
9072
9091
|
var mipmap = [];
|
|
9073
9092
|
cubemap.forEach(function(image) {
|
|
9074
|
-
var imageId =
|
|
9093
|
+
var imageId = EFFECTS.generateGUID();
|
|
9075
9094
|
imageDatas.push({
|
|
9076
9095
|
id: imageId,
|
|
9077
9096
|
// @ts-expect-error
|
|
@@ -9084,10 +9103,10 @@ exports.PSkyboxType = void 0;
|
|
|
9084
9103
|
mipmaps.push(mipmap);
|
|
9085
9104
|
});
|
|
9086
9105
|
var textureOptions = _extends({
|
|
9087
|
-
id:
|
|
9088
|
-
dataType:
|
|
9089
|
-
sourceType:
|
|
9090
|
-
target:
|
|
9106
|
+
id: EFFECTS.generateGUID(),
|
|
9107
|
+
dataType: EFFECTS.spec.DataType.Texture,
|
|
9108
|
+
sourceType: EFFECTS.TextureSourceType.mipmaps,
|
|
9109
|
+
target: EFFECTS.glContext.TEXTURE_CUBE_MAP,
|
|
9091
9110
|
// @ts-expect-error
|
|
9092
9111
|
mipmaps: mipmaps
|
|
9093
9112
|
}, WebGLHelper.cubemapMipTexConfig);
|
|
@@ -9131,7 +9150,7 @@ exports.PSkyboxType = void 0;
|
|
|
9131
9150
|
var imageDatas = [];
|
|
9132
9151
|
var cubemap = [];
|
|
9133
9152
|
params.diffuseImage.forEach(function(image) {
|
|
9134
|
-
var imageId =
|
|
9153
|
+
var imageId = EFFECTS.generateGUID();
|
|
9135
9154
|
imageDatas.push({
|
|
9136
9155
|
id: imageId,
|
|
9137
9156
|
// @ts-expect-error
|
|
@@ -9142,10 +9161,10 @@ exports.PSkyboxType = void 0;
|
|
|
9142
9161
|
});
|
|
9143
9162
|
});
|
|
9144
9163
|
var textureOptions = _extends({
|
|
9145
|
-
id:
|
|
9146
|
-
dataType:
|
|
9147
|
-
sourceType:
|
|
9148
|
-
target:
|
|
9164
|
+
id: EFFECTS.generateGUID(),
|
|
9165
|
+
dataType: EFFECTS.spec.DataType.Texture,
|
|
9166
|
+
sourceType: EFFECTS.TextureSourceType.mipmaps,
|
|
9167
|
+
target: EFFECTS.glContext.TEXTURE_CUBE_MAP,
|
|
9149
9168
|
// @ts-expect-error
|
|
9150
9169
|
mipmaps: [
|
|
9151
9170
|
cubemap
|
|
@@ -9390,11 +9409,11 @@ exports.PSkyboxType = void 0;
|
|
|
9390
9409
|
this.loadSkybox = loadSkybox;
|
|
9391
9410
|
if (this.brdfLutTexture === undefined || this.brdfLutTexture.isDestroyed) {
|
|
9392
9411
|
if (CompositionCache.brdfLutTexOptions === undefined) {
|
|
9393
|
-
throw new Error("Please load brdfLutTexOptions at first");
|
|
9412
|
+
throw new Error("Please load brdfLutTexOptions at first.");
|
|
9394
9413
|
}
|
|
9395
9414
|
//
|
|
9396
9415
|
var brdfLutTextureName = "brdfLutTexture";
|
|
9397
|
-
this.brdfLutTexture =
|
|
9416
|
+
this.brdfLutTexture = EFFECTS.Texture.create(this.engine, CompositionCache.brdfLutTexOptions);
|
|
9398
9417
|
this.deleteTexture(brdfLutTextureName);
|
|
9399
9418
|
this.setTexture(brdfLutTextureName, this.brdfLutTexture);
|
|
9400
9419
|
}
|
|
@@ -9423,7 +9442,7 @@ exports.PSkyboxType = void 0;
|
|
|
9423
9442
|
if (tex !== undefined) {
|
|
9424
9443
|
return tex;
|
|
9425
9444
|
}
|
|
9426
|
-
var newTex =
|
|
9445
|
+
var newTex = EFFECTS.Texture.create(this.engine, options);
|
|
9427
9446
|
this.textureCache.set(name, newTex);
|
|
9428
9447
|
return newTex;
|
|
9429
9448
|
};
|
|
@@ -9638,9 +9657,9 @@ exports.PSkyboxType = void 0;
|
|
|
9638
9657
|
id: "ModelPluginItem",
|
|
9639
9658
|
name: "ModelPluginItem",
|
|
9640
9659
|
duration: 9999999,
|
|
9641
|
-
endBehavior:
|
|
9660
|
+
endBehavior: EFFECTS.spec.END_BEHAVIOR_FORWARD
|
|
9642
9661
|
};
|
|
9643
|
-
var item = new
|
|
9662
|
+
var item = new EFFECTS.VFXItem(composition.getEngine(), props);
|
|
9644
9663
|
composition.addItem(item);
|
|
9645
9664
|
//
|
|
9646
9665
|
var comp = item.addComponent(exports.ModelPluginComponent);
|
|
@@ -9710,33 +9729,33 @@ exports.PSkyboxType = void 0;
|
|
|
9710
9729
|
var pbrShaderData = {
|
|
9711
9730
|
id: PBRShaderGUID,
|
|
9712
9731
|
name: "PBR Shader",
|
|
9713
|
-
dataType:
|
|
9732
|
+
dataType: EFFECTS.spec.DataType.Shader,
|
|
9714
9733
|
fragment: pbrShaderCode.fragmentShaderCode,
|
|
9715
9734
|
vertex: pbrShaderCode.vertexShaderCode,
|
|
9716
9735
|
// @ts-expect-error
|
|
9717
|
-
glslVersion: isWebGL2 ?
|
|
9736
|
+
glslVersion: isWebGL2 ? EFFECTS.GLSLVersion.GLSL3 : EFFECTS.GLSLVersion.GLSL1
|
|
9718
9737
|
};
|
|
9719
9738
|
var unlitShaderData = {
|
|
9720
9739
|
id: UnlitShaderGUID,
|
|
9721
9740
|
name: "Unlit Shader",
|
|
9722
|
-
dataType:
|
|
9741
|
+
dataType: EFFECTS.spec.DataType.Shader,
|
|
9723
9742
|
fragment: unlitShaderCode.fragmentShaderCode,
|
|
9724
9743
|
vertex: unlitShaderCode.vertexShaderCode,
|
|
9725
9744
|
// @ts-expect-error
|
|
9726
|
-
glslVersion: isWebGL2 ?
|
|
9745
|
+
glslVersion: isWebGL2 ? EFFECTS.GLSLVersion.GLSL3 : EFFECTS.GLSLVersion.GLSL1
|
|
9727
9746
|
};
|
|
9728
9747
|
renderer.engine.addEffectsObjectData(pbrShaderData);
|
|
9729
9748
|
renderer.engine.addEffectsObjectData(unlitShaderData);
|
|
9730
9749
|
return Promise.resolve();
|
|
9731
9750
|
};
|
|
9732
9751
|
return ModelPlugin;
|
|
9733
|
-
}(
|
|
9752
|
+
}(EFFECTS.AbstractPlugin);
|
|
9734
9753
|
exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
9735
9754
|
_inherits(ModelPluginComponent, ItemBehaviour);
|
|
9736
9755
|
function ModelPluginComponent(engine, options) {
|
|
9737
9756
|
var _this;
|
|
9738
9757
|
_this = ItemBehaviour.call(this, engine) || this;
|
|
9739
|
-
_this.runtimeEnv =
|
|
9758
|
+
_this.runtimeEnv = EFFECTS.PLAYER_OPTIONS_ENV_EDITOR;
|
|
9740
9759
|
_this.compatibleMode = "gltf";
|
|
9741
9760
|
_this.renderSkybox = true;
|
|
9742
9761
|
_this.visBoundingBox = false;
|
|
@@ -9748,7 +9767,7 @@ exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
9748
9767
|
/**
|
|
9749
9768
|
* 3D 渲染模式,支持可视化渲染中间结果
|
|
9750
9769
|
* none 表示正常的渲染结果
|
|
9751
|
-
*/ _this.renderMode3D =
|
|
9770
|
+
*/ _this.renderMode3D = EFFECTS.spec.RenderMode3D.none;
|
|
9752
9771
|
/**
|
|
9753
9772
|
* UV 渲染模式中,指定棋盘格的大小,相对于大小为 1 的纹理
|
|
9754
9773
|
* 取值范围(0, 1)
|
|
@@ -9799,8 +9818,8 @@ exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
9799
9818
|
var newPosition = invWorldMatrix.transformPoint(position);
|
|
9800
9819
|
component.setTransform(newPosition);
|
|
9801
9820
|
// 正式版本不会走到这个流程,只在测试时使用
|
|
9802
|
-
console.info("Scene AABB [" + sceneAABB.min.toArray() + "], [" + sceneAABB.max.toArray() + "]");
|
|
9803
|
-
console.info("Update camera position [" + newPosition.toArray() + "]");
|
|
9821
|
+
console.info("Scene AABB [" + sceneAABB.min.toArray() + "], [" + sceneAABB.max.toArray() + "].");
|
|
9822
|
+
console.info("Update camera position [" + newPosition.toArray() + "].");
|
|
9804
9823
|
}
|
|
9805
9824
|
}
|
|
9806
9825
|
});
|
|
@@ -9884,9 +9903,9 @@ exports.ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
9884
9903
|
return lightItemCount;
|
|
9885
9904
|
};
|
|
9886
9905
|
return ModelPluginComponent;
|
|
9887
|
-
}(
|
|
9906
|
+
}(EFFECTS.ItemBehaviour);
|
|
9888
9907
|
exports.ModelPluginComponent = __decorate([
|
|
9889
|
-
|
|
9908
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.ModelPluginComponent)
|
|
9890
9909
|
], exports.ModelPluginComponent);
|
|
9891
9910
|
/**
|
|
9892
9911
|
* 获取场景管理器,从合成中查找
|
|
@@ -9977,7 +9996,7 @@ exports.ModelPluginComponent = __decorate([
|
|
|
9977
9996
|
var nodes = options.nodes.map(function(node, i) {
|
|
9978
9997
|
return {
|
|
9979
9998
|
name: node.name || node.id || i + "",
|
|
9980
|
-
transform: new
|
|
9999
|
+
transform: new EFFECTS.Transform(_extends({}, node.transform, {
|
|
9981
10000
|
valid: true
|
|
9982
10001
|
}), topTransform),
|
|
9983
10002
|
id: "^" + (node.id || i),
|
|
@@ -10033,7 +10052,7 @@ exports.ModelTreeComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
10033
10052
|
/**
|
|
10034
10053
|
* 组件开始,查询合成中场景管理器并设置到动画管理器中
|
|
10035
10054
|
*/ _proto.start = function start() {
|
|
10036
|
-
this.item.type =
|
|
10055
|
+
this.item.type = EFFECTS.spec.ItemType.tree;
|
|
10037
10056
|
this.content.baseTransform.setValid(true);
|
|
10038
10057
|
var sceneManager = getSceneManager(this);
|
|
10039
10058
|
if (sceneManager) {
|
|
@@ -10080,9 +10099,9 @@ exports.ModelTreeComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
10080
10099
|
}
|
|
10081
10100
|
};
|
|
10082
10101
|
return ModelTreeComponent;
|
|
10083
|
-
}(
|
|
10102
|
+
}(EFFECTS.ItemBehaviour);
|
|
10084
10103
|
exports.ModelTreeComponent = __decorate([
|
|
10085
|
-
|
|
10104
|
+
EFFECTS.effectsClass(EFFECTS.spec.DataType.TreeComponent)
|
|
10086
10105
|
], exports.ModelTreeComponent);
|
|
10087
10106
|
|
|
10088
10107
|
/**
|
|
@@ -10101,7 +10120,7 @@ exports.ModelTreeComponent = __decorate([
|
|
|
10101
10120
|
return _this;
|
|
10102
10121
|
}
|
|
10103
10122
|
return ModelTreePlugin;
|
|
10104
|
-
}(
|
|
10123
|
+
}(EFFECTS.AbstractPlugin);
|
|
10105
10124
|
|
|
10106
10125
|
exports.CameraGestureType = void 0;
|
|
10107
10126
|
(function(CameraGestureType) {
|
|
@@ -10150,11 +10169,11 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10150
10169
|
// can't find camera item, throw error message
|
|
10151
10170
|
var item = this.getItem();
|
|
10152
10171
|
if (item === undefined) {
|
|
10153
|
-
console.warn("
|
|
10172
|
+
console.warn("[CameraGestureHandlerImp] Unable to locate camera item with ID: " + this.startParams.target + ".");
|
|
10154
10173
|
return this.composition.camera.getOptions();
|
|
10155
10174
|
}
|
|
10156
10175
|
var camera = this.composition.camera;
|
|
10157
|
-
var effectsTransfrom = new
|
|
10176
|
+
var effectsTransfrom = new EFFECTS.Transform(_extends({}, camera.getOptions(), {
|
|
10158
10177
|
valid: true
|
|
10159
10178
|
}));
|
|
10160
10179
|
var cameraTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
|
|
@@ -10321,7 +10340,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10321
10340
|
this.startParams.type = exports.CameraGestureType.none;
|
|
10322
10341
|
var item = this.getItem();
|
|
10323
10342
|
if (item === undefined) {
|
|
10324
|
-
console.warn("
|
|
10343
|
+
console.warn("[CameraGestureHandlerImp] Can't find camera item.");
|
|
10325
10344
|
return;
|
|
10326
10345
|
}
|
|
10327
10346
|
this.setPosition(item, position);
|
|
@@ -10331,7 +10350,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10331
10350
|
this.startParams.type = exports.CameraGestureType.none;
|
|
10332
10351
|
var item = this.getItem();
|
|
10333
10352
|
if (item === undefined) {
|
|
10334
|
-
console.warn("
|
|
10353
|
+
console.warn("[CameraGestureHandlerImp] Can't find camera item.");
|
|
10335
10354
|
return;
|
|
10336
10355
|
}
|
|
10337
10356
|
this.setQuaternion(item, quat);
|
|
@@ -10341,7 +10360,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10341
10360
|
this.startParams.type = exports.CameraGestureType.none;
|
|
10342
10361
|
var item = this.getItem();
|
|
10343
10362
|
if (item === undefined) {
|
|
10344
|
-
console.warn("
|
|
10363
|
+
console.warn("[CameraGestureHandlerImp] Can't find camera item.");
|
|
10345
10364
|
return;
|
|
10346
10365
|
}
|
|
10347
10366
|
var newDistance = distance != null ? distance : 5;
|
|
@@ -10390,7 +10409,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10390
10409
|
};
|
|
10391
10410
|
_proto.getCameraTransform = function getCameraTransform() {
|
|
10392
10411
|
var camera = this.composition.camera;
|
|
10393
|
-
var transform = new
|
|
10412
|
+
var transform = new EFFECTS.Transform(camera.getOptions());
|
|
10394
10413
|
transform.setValid(true);
|
|
10395
10414
|
return transform;
|
|
10396
10415
|
};
|
|
@@ -10398,7 +10417,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10398
10417
|
this.startParams = args;
|
|
10399
10418
|
this.updateCameraTransform(this.composition.camera.getOptions());
|
|
10400
10419
|
if (!this.getItem()) {
|
|
10401
|
-
console.warn("
|
|
10420
|
+
console.warn("[CameraGestureHandlerImp] Invalid target specified in startGesture.");
|
|
10402
10421
|
}
|
|
10403
10422
|
return this.composition.camera.getOptions();
|
|
10404
10423
|
};
|
|
@@ -10406,7 +10425,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10406
10425
|
if (this.getCurrentType() === arg.type) {
|
|
10407
10426
|
var item = this.getItem();
|
|
10408
10427
|
if (item === undefined) {
|
|
10409
|
-
console.warn("
|
|
10428
|
+
console.warn("[CameraGestureHandlerImp] Can't find camera item.");
|
|
10410
10429
|
return this.composition.camera.getOptions();
|
|
10411
10430
|
}
|
|
10412
10431
|
var _arg_speed;
|
|
@@ -10460,10 +10479,10 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10460
10479
|
item.transform.setQuaternion(newRotation1.x, newRotation1.y, newRotation1.z, newRotation1.w);
|
|
10461
10480
|
this.setTransform(item, newPosition, item.transform.rotation);
|
|
10462
10481
|
} else {
|
|
10463
|
-
console.warn("not
|
|
10482
|
+
console.warn("[CameraGestureHandlerImp] Movement type not implemented.");
|
|
10464
10483
|
}
|
|
10465
10484
|
} else {
|
|
10466
|
-
console.warn("
|
|
10485
|
+
console.warn("[CameraGestureHandlerImp] Invalid move type specified: " + arg.type);
|
|
10467
10486
|
}
|
|
10468
10487
|
return this.composition.camera.getOptions();
|
|
10469
10488
|
};
|
|
@@ -10495,7 +10514,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10495
10514
|
this.startParams.target = "";
|
|
10496
10515
|
};
|
|
10497
10516
|
_proto.updateCameraTransform = function updateCameraTransform(cameraOptions) {
|
|
10498
|
-
var effectsTransfrom = new
|
|
10517
|
+
var effectsTransfrom = new EFFECTS.Transform(cameraOptions);
|
|
10499
10518
|
effectsTransfrom.setValid(true);
|
|
10500
10519
|
this.cameraTransform.fromEffectsTransform(effectsTransfrom);
|
|
10501
10520
|
this.cameraCoordiante.fromPTransform(this.cameraTransform);
|
|
@@ -10515,7 +10534,7 @@ var LoaderHelper = /*#__PURE__*/ function() {
|
|
|
10515
10534
|
};
|
|
10516
10535
|
};
|
|
10517
10536
|
LoaderHelper.getEffectsTransformFromMat4 = function getEffectsTransformFromMat4(mat) {
|
|
10518
|
-
var transform = new
|
|
10537
|
+
var transform = new EFFECTS.Transform({
|
|
10519
10538
|
valid: true
|
|
10520
10539
|
});
|
|
10521
10540
|
transform.cloneFromMatrix(mat);
|
|
@@ -10732,7 +10751,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10732
10751
|
var nodeList = scene.nodes.map(function(node, nodeIndex) {
|
|
10733
10752
|
var children = node.children.map(function(child) {
|
|
10734
10753
|
if (child.nodeIndex === undefined) {
|
|
10735
|
-
throw new Error("Undefined nodeIndex for child " + child);
|
|
10754
|
+
throw new Error("Undefined nodeIndex for child " + child + ".");
|
|
10736
10755
|
}
|
|
10737
10756
|
return child.nodeIndex;
|
|
10738
10757
|
});
|
|
@@ -10741,7 +10760,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10741
10760
|
var scale;
|
|
10742
10761
|
if (node.matrix !== undefined) {
|
|
10743
10762
|
if (node.matrix.length !== 16) {
|
|
10744
|
-
throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node);
|
|
10763
|
+
throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node + ".");
|
|
10745
10764
|
}
|
|
10746
10765
|
var mat = Matrix4.fromArray(node.matrix);
|
|
10747
10766
|
var transform = mat.getTransform();
|
|
@@ -10774,7 +10793,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10774
10793
|
});
|
|
10775
10794
|
var rootNodes = scene.rootNodes.map(function(root) {
|
|
10776
10795
|
if (root.nodeIndex === undefined) {
|
|
10777
|
-
throw new Error("Undefined nodeIndex for root " + root);
|
|
10796
|
+
throw new Error("Undefined nodeIndex for root " + root + ".");
|
|
10778
10797
|
}
|
|
10779
10798
|
return root.nodeIndex;
|
|
10780
10799
|
});
|
|
@@ -10819,18 +10838,18 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10819
10838
|
_proto.createTextureCube = function createTextureCube(cubeImages, level0Size) {
|
|
10820
10839
|
var _this = this;
|
|
10821
10840
|
if (cubeImages.length == 0) {
|
|
10822
|
-
throw new Error("createTextureCube: Invalid cubeImages length " + cubeImages);
|
|
10841
|
+
throw new Error("createTextureCube: Invalid cubeImages length " + cubeImages + ".");
|
|
10823
10842
|
}
|
|
10824
10843
|
var mipmaps = [];
|
|
10825
10844
|
cubeImages.forEach(function(cubeImage) {
|
|
10826
10845
|
if (cubeImage.length != 6) {
|
|
10827
|
-
throw new Error("createTextureCube: cubeimage count should always be 6, " + cubeImage);
|
|
10846
|
+
throw new Error("createTextureCube: cubeimage count should always be 6, " + cubeImage + ".");
|
|
10828
10847
|
}
|
|
10829
10848
|
//
|
|
10830
10849
|
var imgList = [];
|
|
10831
10850
|
cubeImage.forEach(function(img) {
|
|
10832
10851
|
if (img.imageData === undefined) {
|
|
10833
|
-
throw new Error("createTextureCube: Invalid image data from " + img);
|
|
10852
|
+
throw new Error("createTextureCube: Invalid image data from " + img + ".");
|
|
10834
10853
|
}
|
|
10835
10854
|
//
|
|
10836
10855
|
imgList.push({
|
|
@@ -10898,7 +10917,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10898
10917
|
};
|
|
10899
10918
|
_proto.createDefaultSkybox = function createDefaultSkybox(typeName) {
|
|
10900
10919
|
if (typeName !== "NFT" && typeName !== "FARM") {
|
|
10901
|
-
throw new Error("Invalid skybox type
|
|
10920
|
+
throw new Error("Invalid skybox type specified: '" + typeName + "'. Valid types are: 'NFT', 'FARM'.");
|
|
10902
10921
|
}
|
|
10903
10922
|
//
|
|
10904
10923
|
var typ = typeName === "NFT" ? exports.PSkyboxType.NFT : exports.PSkyboxType.FARM;
|
|
@@ -10929,7 +10948,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10929
10948
|
};
|
|
10930
10949
|
gltfResource = options.gltf.resource;
|
|
10931
10950
|
if (typeof gltfResource === "string" || _instanceof1(gltfResource, Uint8Array)) {
|
|
10932
|
-
throw new Error("Please load resource
|
|
10951
|
+
throw new Error("Please load the resource using GLTFTools first.");
|
|
10933
10952
|
}
|
|
10934
10953
|
_this._gltfScene = gltfResource.scenes[0];
|
|
10935
10954
|
_this._gltfSkins = _this._gltfScene.skins;
|
|
@@ -10977,7 +10996,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10977
10996
|
});
|
|
10978
10997
|
sceneAABB = new Box3();
|
|
10979
10998
|
_this._gltfScene.rootNodes.forEach(function(root) {
|
|
10980
|
-
var parentTransform = new
|
|
10999
|
+
var parentTransform = new EFFECTS.Transform({
|
|
10981
11000
|
valid: true
|
|
10982
11001
|
});
|
|
10983
11002
|
_this._computeSceneAABB(root, parentTransform, sceneAABB);
|
|
@@ -11140,7 +11159,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11140
11159
|
var texIndex = texInfo.index;
|
|
11141
11160
|
var tex = this.getTextureManager().getTexture(matIndex, texIndex, isBaseColor);
|
|
11142
11161
|
if (tex === undefined && noWarning !== true) {
|
|
11143
|
-
console.warn("Can't find texture for mat " + matIndex + ", tex " + JSON.stringify(texInfo) + ", basecolor " + isBaseColor);
|
|
11162
|
+
console.warn("Can't find texture for mat " + matIndex + ", tex " + JSON.stringify(texInfo) + ", basecolor " + isBaseColor + ".");
|
|
11144
11163
|
}
|
|
11145
11164
|
return tex;
|
|
11146
11165
|
};
|
|
@@ -11159,7 +11178,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11159
11178
|
name: scene.name,
|
|
11160
11179
|
duration: this.getItemDuration(),
|
|
11161
11180
|
endBehavior: this.getItemEndBehavior(),
|
|
11162
|
-
type:
|
|
11181
|
+
type: EFFECTS.spec.ItemType.tree,
|
|
11163
11182
|
content: {
|
|
11164
11183
|
options: {
|
|
11165
11184
|
tree: treeOptions
|
|
@@ -11172,7 +11191,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11172
11191
|
var _this = this;
|
|
11173
11192
|
var meshIndex = node.mesh;
|
|
11174
11193
|
if (meshIndex === undefined) {
|
|
11175
|
-
throw new Error("Invalid mesh index in node " + node);
|
|
11194
|
+
throw new Error("Invalid mesh index in node " + node + ".");
|
|
11176
11195
|
}
|
|
11177
11196
|
var skin;
|
|
11178
11197
|
if (node.skin !== undefined) {
|
|
@@ -11191,7 +11210,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11191
11210
|
var geometry = _this.createGeometry(prim, skin !== undefined);
|
|
11192
11211
|
var material = _this.createMaterial(mat);
|
|
11193
11212
|
material.baseColorTexture = _this.getTexture2D(matIndex, mat.baseColorTexture, true);
|
|
11194
|
-
if (material.type ===
|
|
11213
|
+
if (material.type === EFFECTS.spec.MaterialType.pbr) {
|
|
11195
11214
|
material.metallicRoughnessTexture = _this.getTexture2D(matIndex, mat.metallicRoughnessTexture, false);
|
|
11196
11215
|
material.normalTexture = _this.getTexture2D(matIndex, mat.normalTexture, false);
|
|
11197
11216
|
material.emissiveTexture = _this.getTexture2D(matIndex, mat.emissiveTexture, false);
|
|
@@ -11213,8 +11232,8 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11213
11232
|
var boxSize = aabb.getSize(new Vector3());
|
|
11214
11233
|
var boxCenter = aabb.getCenter(new Vector3());
|
|
11215
11234
|
var interaction = {
|
|
11216
|
-
behavior:
|
|
11217
|
-
type:
|
|
11235
|
+
behavior: EFFECTS.spec.InteractBehavior.NOTIFY,
|
|
11236
|
+
type: EFFECTS.spec.ModelBoundingType.box,
|
|
11218
11237
|
size: [
|
|
11219
11238
|
boxSize.x,
|
|
11220
11239
|
boxSize.y,
|
|
@@ -11233,7 +11252,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11233
11252
|
name: mesh.name,
|
|
11234
11253
|
duration: this.getItemDuration(),
|
|
11235
11254
|
endBehavior: this.getItemEndBehavior(),
|
|
11236
|
-
type:
|
|
11255
|
+
type: EFFECTS.spec.ItemType.mesh,
|
|
11237
11256
|
pluginName: "model",
|
|
11238
11257
|
content: {
|
|
11239
11258
|
options: meshOptions,
|
|
@@ -11256,7 +11275,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11256
11275
|
name: (_light_name = light.name) != null ? _light_name : "light",
|
|
11257
11276
|
duration: this.getItemDuration(),
|
|
11258
11277
|
endBehavior: this.getItemEndBehavior(),
|
|
11259
|
-
type:
|
|
11278
|
+
type: EFFECTS.spec.ItemType.light,
|
|
11260
11279
|
pluginName: "model",
|
|
11261
11280
|
content: {
|
|
11262
11281
|
options: lightOptions
|
|
@@ -11298,7 +11317,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11298
11317
|
name: "skybox",
|
|
11299
11318
|
duration: this.getItemDuration(),
|
|
11300
11319
|
endBehavior: this.getItemEndBehavior(),
|
|
11301
|
-
type:
|
|
11320
|
+
type: EFFECTS.spec.ItemType.skybox,
|
|
11302
11321
|
pluginName: "model",
|
|
11303
11322
|
content: {
|
|
11304
11323
|
options: this._skyboxOptions
|
|
@@ -11325,7 +11344,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11325
11344
|
transformData.scale = node.scale;
|
|
11326
11345
|
}
|
|
11327
11346
|
}
|
|
11328
|
-
var nodeTransform = new
|
|
11347
|
+
var nodeTransform = new EFFECTS.Transform(transformData, parentTransform);
|
|
11329
11348
|
nodeTransform.setValid(true);
|
|
11330
11349
|
//
|
|
11331
11350
|
if (node.mesh !== undefined) {
|
|
@@ -11416,7 +11435,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11416
11435
|
};
|
|
11417
11436
|
_proto.getItemEndBehavior = function getItemEndBehavior() {
|
|
11418
11437
|
var _this__sceneOptions_effects_endBehavior;
|
|
11419
|
-
return (_this__sceneOptions_effects_endBehavior = this._sceneOptions.effects.endBehavior) != null ? _this__sceneOptions_effects_endBehavior :
|
|
11438
|
+
return (_this__sceneOptions_effects_endBehavior = this._sceneOptions.effects.endBehavior) != null ? _this__sceneOptions_effects_endBehavior : EFFECTS.spec.ItemEndBehavior.loop;
|
|
11420
11439
|
};
|
|
11421
11440
|
_proto.getSkyboxType = function getSkyboxType() {
|
|
11422
11441
|
var typeName = this._sceneOptions.gltf.skyboxType;
|
|
@@ -11508,7 +11527,7 @@ var GeometryProxy = /*#__PURE__*/ function() {
|
|
|
11508
11527
|
var attrib = this.positionAttrib;
|
|
11509
11528
|
attributes["aPos"] = this._getBufferAttrib(attrib);
|
|
11510
11529
|
} else {
|
|
11511
|
-
throw new Error("Position attribute missing");
|
|
11530
|
+
throw new Error("Position attribute missing.");
|
|
11512
11531
|
}
|
|
11513
11532
|
if (this.hasNormal) {
|
|
11514
11533
|
var attrib1 = this.normalAttrib;
|
|
@@ -11555,21 +11574,21 @@ var GeometryProxy = /*#__PURE__*/ function() {
|
|
|
11555
11574
|
}
|
|
11556
11575
|
var indexArray = this.indexArray;
|
|
11557
11576
|
if (indexArray !== undefined) {
|
|
11558
|
-
return
|
|
11577
|
+
return EFFECTS.Geometry.create(this.engine, {
|
|
11559
11578
|
attributes: attributes,
|
|
11560
11579
|
indices: {
|
|
11561
11580
|
data: indexArray
|
|
11562
11581
|
},
|
|
11563
11582
|
drawStart: 0,
|
|
11564
11583
|
drawCount: indexArray.length,
|
|
11565
|
-
mode:
|
|
11584
|
+
mode: EFFECTS.glContext.TRIANGLES
|
|
11566
11585
|
});
|
|
11567
11586
|
} else {
|
|
11568
|
-
return
|
|
11587
|
+
return EFFECTS.Geometry.create(this.engine, {
|
|
11569
11588
|
attributes: attributes,
|
|
11570
11589
|
drawStart: 0,
|
|
11571
11590
|
drawCount: this.positionAttrib.array.length / 3,
|
|
11572
|
-
mode:
|
|
11591
|
+
mode: EFFECTS.glContext.TRIANGLES
|
|
11573
11592
|
});
|
|
11574
11593
|
}
|
|
11575
11594
|
}
|
|
@@ -11739,19 +11758,19 @@ var MaterialProxy = /*#__PURE__*/ function() {
|
|
|
11739
11758
|
get: function get() {
|
|
11740
11759
|
var mat = this.gltfMaterial;
|
|
11741
11760
|
var isUnlit = GLTFHelper.isUnlitMaterial(mat);
|
|
11742
|
-
var blending =
|
|
11761
|
+
var blending = EFFECTS.spec.MaterialBlending.opaque;
|
|
11743
11762
|
switch(mat.alphaMode){
|
|
11744
11763
|
case "OPAQUE":
|
|
11745
|
-
blending =
|
|
11764
|
+
blending = EFFECTS.spec.MaterialBlending.opaque;
|
|
11746
11765
|
break;
|
|
11747
11766
|
case "MASK":
|
|
11748
|
-
blending =
|
|
11767
|
+
blending = EFFECTS.spec.MaterialBlending.masked;
|
|
11749
11768
|
break;
|
|
11750
11769
|
case "BLEND":
|
|
11751
|
-
blending =
|
|
11770
|
+
blending = EFFECTS.spec.MaterialBlending.translucent;
|
|
11752
11771
|
break;
|
|
11753
11772
|
}
|
|
11754
|
-
var side = mat.doubleSided ?
|
|
11773
|
+
var side = mat.doubleSided ? EFFECTS.spec.SideMode.DOUBLE : EFFECTS.spec.SideMode.FRONT;
|
|
11755
11774
|
var enableShadow = false;
|
|
11756
11775
|
var _mat_alphaCutOff;
|
|
11757
11776
|
var alphaCutOff = (_mat_alphaCutOff = mat.alphaCutOff) != null ? _mat_alphaCutOff : 0.5;
|
|
@@ -11760,7 +11779,7 @@ var MaterialProxy = /*#__PURE__*/ function() {
|
|
|
11760
11779
|
var _mat_extras;
|
|
11761
11780
|
return {
|
|
11762
11781
|
name: name,
|
|
11763
|
-
type:
|
|
11782
|
+
type: EFFECTS.spec.MaterialType.unlit,
|
|
11764
11783
|
baseColorTexture: this.baseColorTextureObj,
|
|
11765
11784
|
baseColorTextureCoordinate: this.baseColorTextureCoord,
|
|
11766
11785
|
baseColorTextureTransform: this.baseColorTextureTransfrom,
|
|
@@ -11775,7 +11794,7 @@ var MaterialProxy = /*#__PURE__*/ function() {
|
|
|
11775
11794
|
var _mat_extras1;
|
|
11776
11795
|
return {
|
|
11777
11796
|
name: name,
|
|
11778
|
-
type:
|
|
11797
|
+
type: EFFECTS.spec.MaterialType.pbr,
|
|
11779
11798
|
baseColorTexture: this.baseColorTextureObj,
|
|
11780
11799
|
baseColorTextureCoordinate: this.baseColorTextureCoord,
|
|
11781
11800
|
baseColorTextureTransform: this.baseColorTextureTransfrom,
|
|
@@ -12005,7 +12024,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12005
12024
|
this.treeInfo = new TreeInfo();
|
|
12006
12025
|
this.engine = player.renderer.engine;
|
|
12007
12026
|
this.renderer = player.renderer;
|
|
12008
|
-
this.downloader = new
|
|
12027
|
+
this.downloader = new EFFECTS.Downloader();
|
|
12009
12028
|
}
|
|
12010
12029
|
var _proto = JSONConverter.prototype;
|
|
12011
12030
|
_proto.processScene = function processScene(sceneData) {
|
|
@@ -12015,7 +12034,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12015
12034
|
return __generator(this, function(_state) {
|
|
12016
12035
|
switch(_state.label){
|
|
12017
12036
|
case 0:
|
|
12018
|
-
if (!
|
|
12037
|
+
if (!EFFECTS.isObject(sceneData)) return [
|
|
12019
12038
|
3,
|
|
12020
12039
|
1
|
|
12021
12040
|
];
|
|
@@ -12040,7 +12059,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12040
12059
|
tex.source = 0;
|
|
12041
12060
|
}
|
|
12042
12061
|
});
|
|
12043
|
-
oldScene =
|
|
12062
|
+
oldScene = EFFECTS.getStandardJSON(sceneJSON);
|
|
12044
12063
|
binFiles = [];
|
|
12045
12064
|
if (!oldScene.bins) return [
|
|
12046
12065
|
3,
|
|
@@ -12152,7 +12171,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12152
12171
|
loadedMipmaps = _state.sent();
|
|
12153
12172
|
newMipmaps = loadedMipmaps.map(function(mipmaps) {
|
|
12154
12173
|
return mipmaps.map(function(img) {
|
|
12155
|
-
var id =
|
|
12174
|
+
var id = EFFECTS.generateGUID();
|
|
12156
12175
|
var sceneImage = {
|
|
12157
12176
|
url: img,
|
|
12158
12177
|
id: id
|
|
@@ -12170,7 +12189,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12170
12189
|
mipmaps: newMipmaps,
|
|
12171
12190
|
sourceFrom: {
|
|
12172
12191
|
target: target,
|
|
12173
|
-
type:
|
|
12192
|
+
type: EFFECTS.TextureSourceType.mipmaps,
|
|
12174
12193
|
mipmaps: mipmaps.map(function(mipmap) {
|
|
12175
12194
|
return mipmap.map(function(pointer) {
|
|
12176
12195
|
return [
|
|
@@ -12216,26 +12235,26 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12216
12235
|
var newComponents = newScene.components;
|
|
12217
12236
|
for(var _iterator = _create_for_of_iterator_helper_loose(oldScene.components), _step; !(_step = _iterator()).done;){
|
|
12218
12237
|
var comp = _step.value;
|
|
12219
|
-
if (comp.dataType ===
|
|
12238
|
+
if (comp.dataType === EFFECTS.spec.DataType.SkyboxComponent) {
|
|
12220
12239
|
newComponents.push(this.createSkyboxComponent(comp, newScene));
|
|
12221
|
-
} else if (comp.dataType ===
|
|
12240
|
+
} else if (comp.dataType === EFFECTS.spec.DataType.LightComponent) {
|
|
12222
12241
|
newComponents.push(this.createLightComponent(comp, newScene));
|
|
12223
|
-
} else if (comp.dataType ===
|
|
12242
|
+
} else if (comp.dataType === EFFECTS.spec.DataType.CameraComponent) {
|
|
12224
12243
|
newComponents.push(comp);
|
|
12225
|
-
console.warn("
|
|
12226
|
-
} else if (comp.dataType ===
|
|
12244
|
+
console.warn("Camera component found: " + comp + ".");
|
|
12245
|
+
} else if (comp.dataType === EFFECTS.spec.DataType.TreeComponent) {
|
|
12227
12246
|
var treeComp = comp;
|
|
12228
12247
|
this.createItemsFromTreeComponent(comp, newScene, oldScene);
|
|
12229
12248
|
treeComp.options.tree.animation = undefined;
|
|
12230
12249
|
treeComp.options.tree.animations = undefined;
|
|
12231
12250
|
newComponents.push(comp);
|
|
12232
|
-
} else if (comp.dataType !==
|
|
12251
|
+
} else if (comp.dataType !== EFFECTS.spec.DataType.MeshComponent) {
|
|
12233
12252
|
newComponents.push(comp);
|
|
12234
12253
|
}
|
|
12235
12254
|
}
|
|
12236
12255
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(oldScene.components), _step1; !(_step1 = _iterator1()).done;){
|
|
12237
12256
|
var comp1 = _step1.value;
|
|
12238
|
-
if (comp1.dataType ===
|
|
12257
|
+
if (comp1.dataType === EFFECTS.spec.DataType.MeshComponent) {
|
|
12239
12258
|
newComponents.push(this.createMeshComponent(comp1, newScene, oldScene));
|
|
12240
12259
|
}
|
|
12241
12260
|
}
|
|
@@ -12266,7 +12285,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12266
12285
|
2,
|
|
12267
12286
|
new Promise(function(resolve, reject) {
|
|
12268
12287
|
_this.downloader.downloadJSON(url, resolve, function(status, responseText) {
|
|
12269
|
-
reject(new Error("
|
|
12288
|
+
reject(new Error("Failed to load JSON from URL '" + url + "': status " + status + " - " + responseText + ". Please check the URL or network settings."));
|
|
12270
12289
|
});
|
|
12271
12290
|
})
|
|
12272
12291
|
];
|
|
@@ -12295,7 +12314,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12295
12314
|
_pointer_ = pointer[1], index = _pointer_[0], start = _pointer_[1], length = _pointer_[2];
|
|
12296
12315
|
bin = bins[index];
|
|
12297
12316
|
if (!bin) {
|
|
12298
|
-
throw new Error("
|
|
12317
|
+
throw new Error("Invalid bin pointer: " + JSON.stringify(pointer) + ".");
|
|
12299
12318
|
}
|
|
12300
12319
|
return [
|
|
12301
12320
|
2,
|
|
@@ -12364,7 +12383,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12364
12383
|
});
|
|
12365
12384
|
var geometryData = getGeometryDataFromPropsList(geometryPropsList);
|
|
12366
12385
|
if (!geometryData) {
|
|
12367
|
-
throw new Error("
|
|
12386
|
+
throw new Error("No primitives available to process.");
|
|
12368
12387
|
}
|
|
12369
12388
|
newScene.geometries.push(geometryData);
|
|
12370
12389
|
(_newScene_materials = newScene.materials).push.apply(_newScene_materials, [].concat(materialDatas));
|
|
@@ -12391,12 +12410,12 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12391
12410
|
}
|
|
12392
12411
|
}
|
|
12393
12412
|
if (parentItemId === component.item.id) {
|
|
12394
|
-
throw new Error("Can't item " + component.item);
|
|
12413
|
+
throw new Error("Can't item " + component.item + ".");
|
|
12395
12414
|
}
|
|
12396
12415
|
var treeItem = this.treeInfo.getTreeItemByNodeId(parentItemId);
|
|
12397
12416
|
var treeNodeList = this.treeInfo.getTreeNodeListByNodeId(parentItemId);
|
|
12398
12417
|
if (!treeItem || !treeNodeList) {
|
|
12399
|
-
throw new Error("
|
|
12418
|
+
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
12419
|
}
|
|
12401
12420
|
var rootBoneItem = this.setupBoneData(geometryData, meshOptions.skin, oldScene, treeItem, treeNodeList);
|
|
12402
12421
|
meshComponent.rootBone = {
|
|
@@ -12424,13 +12443,13 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12424
12443
|
treeData.nodes.forEach(function(node, index) {
|
|
12425
12444
|
var _node_name;
|
|
12426
12445
|
var item = {
|
|
12427
|
-
id:
|
|
12446
|
+
id: EFFECTS.generateGUID(),
|
|
12428
12447
|
parentId: treeItem.id,
|
|
12429
12448
|
name: (_node_name = node.name) != null ? _node_name : "node" + index,
|
|
12430
12449
|
duration: treeItem.duration,
|
|
12431
12450
|
// @ts-expect-error
|
|
12432
12451
|
type: "ECS",
|
|
12433
|
-
dataType:
|
|
12452
|
+
dataType: EFFECTS.spec.DataType.VFXItemData,
|
|
12434
12453
|
visible: treeItem.visible,
|
|
12435
12454
|
endBehavior: treeItem.endBehavior,
|
|
12436
12455
|
delay: treeItem.delay,
|
|
@@ -12495,8 +12514,8 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12495
12514
|
var _this = this;
|
|
12496
12515
|
var animation = treeOptions.animation, animations = treeOptions.animations;
|
|
12497
12516
|
var animationComponent = {
|
|
12498
|
-
id:
|
|
12499
|
-
dataType:
|
|
12517
|
+
id: EFFECTS.generateGUID(),
|
|
12518
|
+
dataType: EFFECTS.spec.DataType.AnimationComponent,
|
|
12500
12519
|
item: {
|
|
12501
12520
|
id: treeItem.id
|
|
12502
12521
|
},
|
|
@@ -12508,9 +12527,9 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12508
12527
|
var bins = oldScene.bins;
|
|
12509
12528
|
animations.forEach(function(anim) {
|
|
12510
12529
|
var clipData = {
|
|
12511
|
-
id:
|
|
12530
|
+
id: EFFECTS.generateGUID(),
|
|
12512
12531
|
name: anim.name,
|
|
12513
|
-
dataType:
|
|
12532
|
+
dataType: EFFECTS.spec.DataType.AnimationClip,
|
|
12514
12533
|
positionCurves: [],
|
|
12515
12534
|
rotationCurves: [],
|
|
12516
12535
|
scaleCurves: [],
|
|
@@ -12525,13 +12544,13 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12525
12544
|
var inputArray = typedArrayFromBinary(bins, track.input);
|
|
12526
12545
|
var outputArray = typedArrayFromBinary(bins, track.output);
|
|
12527
12546
|
if (!_instanceof1(inputArray, Float32Array)) {
|
|
12528
|
-
throw new Error("Type of inputArray should be float32, " + inputArray);
|
|
12547
|
+
throw new Error("Type of inputArray should be float32, " + inputArray + ".");
|
|
12529
12548
|
}
|
|
12530
12549
|
if (!_instanceof1(outputArray, Float32Array)) {
|
|
12531
|
-
throw new Error("Type of outputArray should be float32, " + outputArray);
|
|
12550
|
+
throw new Error("Type of outputArray should be float32, " + outputArray + ".");
|
|
12532
12551
|
}
|
|
12533
12552
|
if (track.interpolation !== "LINEAR") {
|
|
12534
|
-
throw new Error("Invalid interpolation type " + track.interpolation);
|
|
12553
|
+
throw new Error("Invalid interpolation type " + track.interpolation + ".");
|
|
12535
12554
|
}
|
|
12536
12555
|
if (track.path === "rotation") {
|
|
12537
12556
|
var points = [];
|
|
@@ -12555,7 +12574,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12555
12574
|
controlPoints.push(p2.toArray());
|
|
12556
12575
|
}
|
|
12557
12576
|
lineValue.push([
|
|
12558
|
-
|
|
12577
|
+
EFFECTS.spec.BezierKeyframeType.LINE,
|
|
12559
12578
|
[
|
|
12560
12579
|
inputArray[i],
|
|
12561
12580
|
i
|
|
@@ -12565,7 +12584,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12565
12584
|
var node = _this.treeInfo.getTreeNode(treeItem.id, track.node);
|
|
12566
12585
|
var path = _this.treeInfo.getNodePath(node.id);
|
|
12567
12586
|
var keyFrames = [
|
|
12568
|
-
|
|
12587
|
+
EFFECTS.spec.ValueType.BEZIER_CURVE_QUAT,
|
|
12569
12588
|
[
|
|
12570
12589
|
lineValue,
|
|
12571
12590
|
points,
|
|
@@ -12593,7 +12612,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12593
12612
|
var lineValue1 = [];
|
|
12594
12613
|
for(var i2 = 0; i2 < inputArray.length; i2++){
|
|
12595
12614
|
lineValue1.push([
|
|
12596
|
-
|
|
12615
|
+
EFFECTS.spec.BezierKeyframeType.LINE,
|
|
12597
12616
|
[
|
|
12598
12617
|
inputArray[i2],
|
|
12599
12618
|
outputArray[i2 * component + c]
|
|
@@ -12601,7 +12620,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12601
12620
|
]);
|
|
12602
12621
|
}
|
|
12603
12622
|
var keyFrames1 = [
|
|
12604
|
-
|
|
12623
|
+
EFFECTS.spec.ValueType.BEZIER_CURVE,
|
|
12605
12624
|
lineValue1
|
|
12606
12625
|
];
|
|
12607
12626
|
clipData.floatCurves.push({
|
|
@@ -12630,7 +12649,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12630
12649
|
controlPoints1.push(p21.toArray());
|
|
12631
12650
|
}
|
|
12632
12651
|
lineValue2.push([
|
|
12633
|
-
|
|
12652
|
+
EFFECTS.spec.BezierKeyframeType.LINE,
|
|
12634
12653
|
[
|
|
12635
12654
|
inputArray[i3],
|
|
12636
12655
|
i3
|
|
@@ -12640,7 +12659,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12640
12659
|
var node2 = _this.treeInfo.getTreeNode(treeItem.id, track.node);
|
|
12641
12660
|
var path2 = _this.treeInfo.getNodePath(node2.id);
|
|
12642
12661
|
var keyFrames2 = [
|
|
12643
|
-
|
|
12662
|
+
EFFECTS.spec.ValueType.BEZIER_CURVE_PATH,
|
|
12644
12663
|
[
|
|
12645
12664
|
lineValue2,
|
|
12646
12665
|
points1,
|
|
@@ -12672,7 +12691,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12672
12691
|
newScene.components.push(animationComponent);
|
|
12673
12692
|
};
|
|
12674
12693
|
_proto.getMaterialData = function getMaterialData(material, scene) {
|
|
12675
|
-
if (material.type ===
|
|
12694
|
+
if (material.type === EFFECTS.spec.MaterialType.unlit) {
|
|
12676
12695
|
var floats = {};
|
|
12677
12696
|
if (material.alphaCutOff !== undefined) {
|
|
12678
12697
|
floats["_AlphaCutoff"] = material.alphaCutOff;
|
|
@@ -12685,9 +12704,9 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12685
12704
|
textures["_BaseColorSampler"] = this.getTextureData(scene, floats, material.baseColorTexture, material.baseColorTextureTransform);
|
|
12686
12705
|
}
|
|
12687
12706
|
var newMaterial = {
|
|
12688
|
-
id:
|
|
12707
|
+
id: EFFECTS.generateGUID(),
|
|
12689
12708
|
name: material.name,
|
|
12690
|
-
dataType:
|
|
12709
|
+
dataType: EFFECTS.spec.DataType.Material,
|
|
12691
12710
|
shader: {
|
|
12692
12711
|
id: UnlitShaderGUID
|
|
12693
12712
|
},
|
|
@@ -12742,9 +12761,9 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12742
12761
|
textures1["_EmissiveSampler"] = this.getTextureData(scene, floats1, material.emissiveTexture, material.emissiveTextureTransform);
|
|
12743
12762
|
}
|
|
12744
12763
|
var newMaterial1 = {
|
|
12745
|
-
id:
|
|
12764
|
+
id: EFFECTS.generateGUID(),
|
|
12746
12765
|
name: material.name,
|
|
12747
|
-
dataType:
|
|
12766
|
+
dataType: EFFECTS.spec.DataType.Material,
|
|
12748
12767
|
shader: {
|
|
12749
12768
|
id: PBRShaderGUID
|
|
12750
12769
|
},
|
|
@@ -12761,12 +12780,12 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12761
12780
|
}
|
|
12762
12781
|
};
|
|
12763
12782
|
_proto.setupMaterial = function setupMaterial(oldMat, newMat) {
|
|
12764
|
-
if (oldMat.blending ===
|
|
12765
|
-
newMat.stringTags["RenderType"] =
|
|
12783
|
+
if (oldMat.blending === EFFECTS.spec.MaterialBlending.translucent) {
|
|
12784
|
+
newMat.stringTags["RenderType"] = EFFECTS.spec.RenderType.Transparent;
|
|
12766
12785
|
} else {
|
|
12767
|
-
newMat.stringTags["RenderType"] =
|
|
12786
|
+
newMat.stringTags["RenderType"] = EFFECTS.spec.RenderType.Opaque;
|
|
12768
12787
|
}
|
|
12769
|
-
if (oldMat.blending ===
|
|
12788
|
+
if (oldMat.blending === EFFECTS.spec.MaterialBlending.masked) {
|
|
12770
12789
|
newMat.floats["AlphaClip"] = 1;
|
|
12771
12790
|
var _oldMat_alphaCutOff;
|
|
12772
12791
|
newMat.floats["_Cutoff"] = (_oldMat_alphaCutOff = oldMat.alphaCutOff) != null ? _oldMat_alphaCutOff : 0;
|
|
@@ -12774,16 +12793,16 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12774
12793
|
newMat.floats["AlphaClip"] = 0;
|
|
12775
12794
|
}
|
|
12776
12795
|
switch(oldMat.side){
|
|
12777
|
-
case
|
|
12778
|
-
newMat.stringTags["RenderFace"] =
|
|
12796
|
+
case EFFECTS.spec.SideMode.BACK:
|
|
12797
|
+
newMat.stringTags["RenderFace"] = EFFECTS.spec.RenderFace.Back;
|
|
12779
12798
|
break;
|
|
12780
|
-
case
|
|
12781
|
-
newMat.stringTags["RenderFace"] =
|
|
12799
|
+
case EFFECTS.spec.SideMode.DOUBLE:
|
|
12800
|
+
newMat.stringTags["RenderFace"] = EFFECTS.spec.RenderFace.Both;
|
|
12782
12801
|
break;
|
|
12783
12802
|
default:
|
|
12784
|
-
newMat.stringTags["RenderFace"] =
|
|
12803
|
+
newMat.stringTags["RenderFace"] = EFFECTS.spec.RenderFace.Front;
|
|
12785
12804
|
}
|
|
12786
|
-
if (oldMat.type ===
|
|
12805
|
+
if (oldMat.type === EFFECTS.spec.MaterialType.pbr) {
|
|
12787
12806
|
newMat.floats["_SpecularAA"] = oldMat.useSpecularAA ? 1 : 0;
|
|
12788
12807
|
}
|
|
12789
12808
|
var _oldMat_depthMask;
|
|
@@ -12867,7 +12886,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12867
12886
|
var bins = oldScene.bins;
|
|
12868
12887
|
var joints = skin.joints, skeleton = skin.skeleton, inverseBindMatrices = skin.inverseBindMatrices;
|
|
12869
12888
|
if (!inverseBindMatrices) {
|
|
12870
|
-
throw new Error("inverseBindMatrices is undefined " + skin);
|
|
12889
|
+
throw new Error("'inverseBindMatrices' is undefined for the skin configuration: " + JSON.stringify(skin) + ". Ensure 'inverseBindMatrices' is properly defined in your skin data.");
|
|
12871
12890
|
}
|
|
12872
12891
|
var bindMatrixArray = typedArrayFromBinary(bins, inverseBindMatrices);
|
|
12873
12892
|
geom.inverseBindMatrices = Array.from(bindMatrixArray);
|
|
@@ -12876,12 +12895,12 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12876
12895
|
if (skeleton !== undefined) {
|
|
12877
12896
|
rootBoneItem = treeNodeList[skeleton];
|
|
12878
12897
|
} else {
|
|
12879
|
-
console.warn("Root bone is missing");
|
|
12898
|
+
console.warn("Root bone is missing for the skeleton. Defaulting to the primary tree item as the root bone.");
|
|
12880
12899
|
}
|
|
12881
12900
|
joints.forEach(function(joint) {
|
|
12882
12901
|
var node = treeNodeList[joint];
|
|
12883
12902
|
if (node !== rootBoneItem && node.parentId === rootBoneItem.parentId) {
|
|
12884
|
-
console.error("
|
|
12903
|
+
console.error("Invalid node detected for 'rootBoneItem'. Adjusting 'rootBoneItem' to the primary tree item. Please verify the tree structure.");
|
|
12885
12904
|
rootBoneItem = treeItem;
|
|
12886
12905
|
}
|
|
12887
12906
|
});
|
|
@@ -12919,12 +12938,12 @@ var TreeInfo = /*#__PURE__*/ function() {
|
|
|
12919
12938
|
_proto.add = function add(treeItem, treeNodeList) {
|
|
12920
12939
|
var _this = this;
|
|
12921
12940
|
if (this.tree2NodeList[treeItem.id]) {
|
|
12922
|
-
throw new Error("
|
|
12941
|
+
throw new Error("Duplicate treeItem ID detected: " + treeItem.id + ". Ensure each tree item has a unique ID.");
|
|
12923
12942
|
}
|
|
12924
12943
|
this.tree2NodeList[treeItem.id] = treeNodeList;
|
|
12925
12944
|
treeNodeList.forEach(function(node) {
|
|
12926
12945
|
if (_this.nodeList2Tree[node.id]) {
|
|
12927
|
-
throw new Error("
|
|
12946
|
+
throw new Error("Duplicate tree node ID found: " + node.id + ". Each node in the tree must have a unique ID.");
|
|
12928
12947
|
}
|
|
12929
12948
|
_this.nodeList2Tree[node.id] = treeItem;
|
|
12930
12949
|
_this.nodeId2Node[node.id] = node;
|
|
@@ -12953,7 +12972,7 @@ var TreeInfo = /*#__PURE__*/ function() {
|
|
|
12953
12972
|
_proto.getTreeNodeListByNodeId = function getTreeNodeListByNodeId(id) {
|
|
12954
12973
|
var treeItem = this.nodeList2Tree[id];
|
|
12955
12974
|
if (!treeItem) {
|
|
12956
|
-
throw new Error("Invalid id " + id);
|
|
12975
|
+
throw new Error("Invalid id " + id + ".");
|
|
12957
12976
|
}
|
|
12958
12977
|
return this.getTreeNodeListByTreeId(treeItem.id);
|
|
12959
12978
|
};
|
|
@@ -12980,11 +12999,11 @@ var TreeInfo = /*#__PURE__*/ function() {
|
|
|
12980
12999
|
}();
|
|
12981
13000
|
function getGeometryDataFromOptions(geomOptions) {
|
|
12982
13001
|
var vertexCount = 0;
|
|
12983
|
-
var verticesType =
|
|
13002
|
+
var verticesType = EFFECTS.spec.VertexFormatType.Float32;
|
|
12984
13003
|
var verticesNormalize = false;
|
|
12985
|
-
var uvsType =
|
|
13004
|
+
var uvsType = EFFECTS.spec.VertexFormatType.Float32;
|
|
12986
13005
|
var uvsNormalize = false;
|
|
12987
|
-
var normalsType =
|
|
13006
|
+
var normalsType = EFFECTS.spec.VertexFormatType.Float32;
|
|
12988
13007
|
var normalsNormalize = false;
|
|
12989
13008
|
var _geomOptions_name;
|
|
12990
13009
|
var modelData = {
|
|
@@ -13004,21 +13023,21 @@ function getGeometryDataFromOptions(geomOptions) {
|
|
|
13004
13023
|
var _attribData_normalize;
|
|
13005
13024
|
verticesNormalize = (_attribData_normalize = attribData.normalize) != null ? _attribData_normalize : false;
|
|
13006
13025
|
var _attribData_type;
|
|
13007
|
-
verticesType =
|
|
13026
|
+
verticesType = EFFECTS.glType2VertexFormatType((_attribData_type = attribData.type) != null ? _attribData_type : EFFECTS.glContext.FLOAT);
|
|
13008
13027
|
} else if (attrib === "aNormal") {
|
|
13009
13028
|
// @ts-expect-error
|
|
13010
13029
|
modelData.normals = attribData.data;
|
|
13011
13030
|
var _attribData_normalize1;
|
|
13012
13031
|
normalsNormalize = (_attribData_normalize1 = attribData.normalize) != null ? _attribData_normalize1 : false;
|
|
13013
13032
|
var _attribData_type1;
|
|
13014
|
-
normalsType =
|
|
13033
|
+
normalsType = EFFECTS.glType2VertexFormatType((_attribData_type1 = attribData.type) != null ? _attribData_type1 : EFFECTS.glContext.FLOAT);
|
|
13015
13034
|
} else if (attrib === "aUV1") {
|
|
13016
13035
|
// @ts-expect-error
|
|
13017
13036
|
modelData.uvs = attribData.data;
|
|
13018
13037
|
var _attribData_normalize2;
|
|
13019
13038
|
uvsNormalize = (_attribData_normalize2 = attribData.normalize) != null ? _attribData_normalize2 : false;
|
|
13020
13039
|
var _attribData_type2;
|
|
13021
|
-
uvsType =
|
|
13040
|
+
uvsType = EFFECTS.glType2VertexFormatType((_attribData_type2 = attribData.type) != null ? _attribData_type2 : EFFECTS.glContext.FLOAT);
|
|
13022
13041
|
}
|
|
13023
13042
|
}
|
|
13024
13043
|
var verticesOffset = getOffset(verticesType, 3, vertexCount);
|
|
@@ -13039,32 +13058,32 @@ function getGeometryDataFromOptions(geomOptions) {
|
|
|
13039
13058
|
}
|
|
13040
13059
|
modelData.indices = indices1;
|
|
13041
13060
|
}
|
|
13042
|
-
var indicesType =
|
|
13061
|
+
var indicesType = EFFECTS.spec.IndexFormatType.UInt16;
|
|
13043
13062
|
if (modelData.indices.BYTES_PER_ELEMENT === 4) {
|
|
13044
|
-
indicesType =
|
|
13063
|
+
indicesType = EFFECTS.spec.IndexFormatType.UInt32;
|
|
13045
13064
|
}
|
|
13046
13065
|
var geometryData = {
|
|
13047
|
-
id:
|
|
13048
|
-
dataType:
|
|
13066
|
+
id: EFFECTS.generateGUID(),
|
|
13067
|
+
dataType: EFFECTS.spec.DataType.Geometry,
|
|
13049
13068
|
vertexData: {
|
|
13050
13069
|
vertexCount: vertexCount,
|
|
13051
13070
|
channels: [
|
|
13052
13071
|
{
|
|
13053
|
-
semantic:
|
|
13072
|
+
semantic: EFFECTS.spec.VertexBufferSemantic.Position,
|
|
13054
13073
|
offset: 0,
|
|
13055
13074
|
format: verticesType,
|
|
13056
13075
|
dimension: 3,
|
|
13057
13076
|
normalize: verticesNormalize
|
|
13058
13077
|
},
|
|
13059
13078
|
{
|
|
13060
|
-
semantic:
|
|
13079
|
+
semantic: EFFECTS.spec.VertexBufferSemantic.Uv,
|
|
13061
13080
|
offset: verticesOffset,
|
|
13062
13081
|
format: uvsType,
|
|
13063
13082
|
dimension: 2,
|
|
13064
13083
|
normalize: uvsNormalize
|
|
13065
13084
|
},
|
|
13066
13085
|
{
|
|
13067
|
-
semantic:
|
|
13086
|
+
semantic: EFFECTS.spec.VertexBufferSemantic.Normal,
|
|
13068
13087
|
offset: verticesOffset + uvsOffset,
|
|
13069
13088
|
format: normalsType,
|
|
13070
13089
|
dimension: 3,
|
|
@@ -13073,7 +13092,7 @@ function getGeometryDataFromOptions(geomOptions) {
|
|
|
13073
13092
|
]
|
|
13074
13093
|
},
|
|
13075
13094
|
subMeshes: [],
|
|
13076
|
-
mode:
|
|
13095
|
+
mode: EFFECTS.spec.GeometryType.TRIANGLES,
|
|
13077
13096
|
indexFormat: indicesType,
|
|
13078
13097
|
indexOffset: verticesOffset + uvsOffset + normalsOffset,
|
|
13079
13098
|
buffer: encodeVertexData(modelData)
|
|
@@ -13139,11 +13158,11 @@ function getGeometryDataFromPropsList(geomPropsList) {
|
|
|
13139
13158
|
}
|
|
13140
13159
|
function getOffset(formatType, dimension, count) {
|
|
13141
13160
|
switch(formatType){
|
|
13142
|
-
case
|
|
13143
|
-
case
|
|
13161
|
+
case EFFECTS.spec.VertexFormatType.Int8:
|
|
13162
|
+
case EFFECTS.spec.VertexFormatType.UInt8:
|
|
13144
13163
|
return dimension * count;
|
|
13145
|
-
case
|
|
13146
|
-
case
|
|
13164
|
+
case EFFECTS.spec.VertexFormatType.Int16:
|
|
13165
|
+
case EFFECTS.spec.VertexFormatType.UInt16:
|
|
13147
13166
|
return dimension * count * 2;
|
|
13148
13167
|
default:
|
|
13149
13168
|
return dimension * count * 4;
|
|
@@ -13167,7 +13186,7 @@ function createGeometryData(props, subMeshes) {
|
|
|
13167
13186
|
var attribData1 = props.attributes[attrib1];
|
|
13168
13187
|
var semantic = vertexBufferSemanticMap[attrib1];
|
|
13169
13188
|
if (!semantic) {
|
|
13170
|
-
throw new Error("Invalid attrib " + attrib1);
|
|
13189
|
+
throw new Error("Invalid attrib " + attrib1 + ".");
|
|
13171
13190
|
}
|
|
13172
13191
|
// @ts-expect-error
|
|
13173
13192
|
vertexCount = attribData1.data.length / attribData1.size;
|
|
@@ -13175,7 +13194,7 @@ function createGeometryData(props, subMeshes) {
|
|
|
13175
13194
|
var vertexChannel = {
|
|
13176
13195
|
semantic: semantic,
|
|
13177
13196
|
offset: bufferOffset,
|
|
13178
|
-
format:
|
|
13197
|
+
format: EFFECTS.glType2VertexFormatType((_attribData_type = attribData1.type) != null ? _attribData_type : EFFECTS.glContext.FLOAT),
|
|
13179
13198
|
dimension: attribData1.size,
|
|
13180
13199
|
normalize: attribData1.normalize
|
|
13181
13200
|
};
|
|
@@ -13187,15 +13206,15 @@ function createGeometryData(props, subMeshes) {
|
|
|
13187
13206
|
bufferOffset += subBuffer.byteLength;
|
|
13188
13207
|
}
|
|
13189
13208
|
var geometryData = {
|
|
13190
|
-
id:
|
|
13191
|
-
dataType:
|
|
13209
|
+
id: EFFECTS.generateGUID(),
|
|
13210
|
+
dataType: EFFECTS.spec.DataType.Geometry,
|
|
13192
13211
|
vertexData: {
|
|
13193
13212
|
vertexCount: vertexCount,
|
|
13194
13213
|
channels: vertexChannels
|
|
13195
13214
|
},
|
|
13196
13215
|
subMeshes: subMeshes,
|
|
13197
|
-
mode:
|
|
13198
|
-
indexFormat:
|
|
13216
|
+
mode: EFFECTS.spec.GeometryType.TRIANGLES,
|
|
13217
|
+
indexFormat: EFFECTS.spec.IndexFormatType.UInt16,
|
|
13199
13218
|
indexOffset: -1,
|
|
13200
13219
|
buffer: ""
|
|
13201
13220
|
};
|
|
@@ -13205,7 +13224,7 @@ function createGeometryData(props, subMeshes) {
|
|
|
13205
13224
|
buffer.set(subBuffer1, bufferOffset);
|
|
13206
13225
|
geometryData.indexOffset = bufferOffset;
|
|
13207
13226
|
if (_instanceof1(indices, Uint32Array)) {
|
|
13208
|
-
geometryData.indexFormat =
|
|
13227
|
+
geometryData.indexFormat = EFFECTS.spec.IndexFormatType.UInt32;
|
|
13209
13228
|
}
|
|
13210
13229
|
}
|
|
13211
13230
|
geometryData.buffer = toBase64String(buffer);
|
|
@@ -13360,11 +13379,11 @@ var vertexBufferSemanticMap = {
|
|
|
13360
13379
|
a_Target_Tangent3: "TANGENT_BS3"
|
|
13361
13380
|
};
|
|
13362
13381
|
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
var version = "2.0.0-alpha.
|
|
13366
|
-
|
|
13367
|
-
if (version !==
|
|
13382
|
+
EFFECTS.registerPlugin("tree", ModelTreePlugin, EFFECTS.VFXItem, true);
|
|
13383
|
+
EFFECTS.registerPlugin("model", ModelPlugin, EFFECTS.VFXItem);
|
|
13384
|
+
var version = "2.0.0-alpha.18";
|
|
13385
|
+
EFFECTS.logger.info("Plugin model version: " + version + ".");
|
|
13386
|
+
if (version !== EFFECTS__namespace.version) {
|
|
13368
13387
|
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
13388
|
}
|
|
13370
13389
|
|