@galacean/effects-plugin-model 2.0.0-alpha.17 → 2.0.0-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alipay.js +1648 -578
- package/dist/alipay.js.map +1 -1
- package/dist/alipay.mjs +1315 -271
- package/dist/alipay.mjs.map +1 -1
- package/dist/gltf/index.d.ts +1 -0
- package/dist/gltf/loader-ecs-ext.d.ts +4 -2
- package/dist/gltf/loader-ecs.d.ts +9 -3
- package/dist/gltf/loader-ext.d.ts +1 -1
- package/dist/gltf/protocol.d.ts +1 -1
- package/dist/index.js +1649 -579
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +1316 -272
- package/dist/index.mjs.map +1 -1
- package/dist/loader.mjs +1316 -272
- package/dist/loader.mjs.map +1 -1
- package/dist/runtime/material.d.ts +11 -17
- package/dist/runtime/scene.d.ts +2 -1
- package/dist/utility/plugin-helper.d.ts +3 -3
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Description: Galacean Effects player model plugin
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 飂兮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.19
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import * as EFFECTS from '@galacean/effects';
|
|
10
|
+
import { math, Transform, PLAYER_OPTIONS_ENV_EDITOR, spec, glContext, Texture, TextureSourceType, RenderPassAttachmentStorageType, Material, Mesh, Geometry, GLSLVersion, addItem, removeItem, effectsClass, RendererComponent, ItemBehaviour, HitTestType, AnimationClip, RenderPass, TextureLoadAction, DestroyOptions, RenderPassDestroyAttachmentType, Player, Renderer, getDefaultTextureFactory, loadImage, generateGUID, VFXItem, AbstractPlugin, glType2VertexFormatType, Downloader, getStandardJSON, isObject, registerPlugin, logger } from '@galacean/effects';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Model 插件元素类型
|
|
@@ -1155,7 +1156,7 @@ var TextureDataMode;
|
|
|
1155
1156
|
var matList = props.inverseBindMatrices;
|
|
1156
1157
|
if (matList !== undefined && matList.length > 0) {
|
|
1157
1158
|
if (matList.length % 16 !== 0 || matList.length !== this.jointItem.length * 16) {
|
|
1158
|
-
throw new Error("Invalid array length, invert bind matrices " + matList.length + ", joint array " + this.jointItem.length);
|
|
1159
|
+
throw new Error("Invalid array length, invert bind matrices " + matList.length + ", joint array " + this.jointItem.length + ".");
|
|
1159
1160
|
}
|
|
1160
1161
|
var matrixCount = matList.length / 16;
|
|
1161
1162
|
for(var i = 0; i < matrixCount; i++){
|
|
@@ -1186,7 +1187,7 @@ var TextureDataMode;
|
|
|
1186
1187
|
});
|
|
1187
1188
|
} else {
|
|
1188
1189
|
this.animationMatrices = this.inverseBindMatrices;
|
|
1189
|
-
console.error("Some error occured, replace skin animation matrices by invert bind matrices");
|
|
1190
|
+
console.error("Some error occured, replace skin animation matrices by invert bind matrices.");
|
|
1190
1191
|
}
|
|
1191
1192
|
};
|
|
1192
1193
|
/**
|
|
@@ -1247,7 +1248,7 @@ var TextureDataMode;
|
|
|
1247
1248
|
} else if (detail.halfFloatTexture) {
|
|
1248
1249
|
return 2;
|
|
1249
1250
|
} else {
|
|
1250
|
-
throw new Error("Too many joint count " + jointCount + ", half float texture not support");
|
|
1251
|
+
throw new Error("Too many joint count " + jointCount + ", half float texture not support.");
|
|
1251
1252
|
}
|
|
1252
1253
|
} else {
|
|
1253
1254
|
return 0;
|
|
@@ -1260,7 +1261,7 @@ var TextureDataMode;
|
|
|
1260
1261
|
(_props_boneNames = props.boneNames) == null ? void 0 : _props_boneNames.forEach(function(boneName) {
|
|
1261
1262
|
var node = name2Item[boneName];
|
|
1262
1263
|
if (!node) {
|
|
1263
|
-
throw new Error("Can't find node of bone name " + boneName);
|
|
1264
|
+
throw new Error("Can't find node of bone name " + boneName + ".");
|
|
1264
1265
|
}
|
|
1265
1266
|
jointItems.push(node);
|
|
1266
1267
|
});
|
|
@@ -1357,19 +1358,19 @@ var TextureDataMode;
|
|
|
1357
1358
|
* 还要注意最大数目不能超过5,否则也直接报错。
|
|
1358
1359
|
* 后续考虑是否做个兼容,目前还是严格报错比较好。
|
|
1359
1360
|
*/ if (positionCount > 0 && positionCount != this.morphWeightsLength) {
|
|
1360
|
-
console.error("Position morph count mismatch: " + this.morphWeightsLength + ", " + positionCount);
|
|
1361
|
+
console.error("Position morph count mismatch: " + this.morphWeightsLength + ", " + positionCount + ".");
|
|
1361
1362
|
return false;
|
|
1362
1363
|
}
|
|
1363
1364
|
if (normalCount > 0 && normalCount != this.morphWeightsLength) {
|
|
1364
|
-
console.error("Normal morph count mismatch: " + this.morphWeightsLength + ", " + normalCount);
|
|
1365
|
+
console.error("Normal morph count mismatch: " + this.morphWeightsLength + ", " + normalCount + ".");
|
|
1365
1366
|
return false;
|
|
1366
1367
|
}
|
|
1367
1368
|
if (tangentCount > 0 && tangentCount != this.morphWeightsLength) {
|
|
1368
|
-
console.error("Tangent morph count mismatch: " + this.morphWeightsLength + ", " + tangentCount);
|
|
1369
|
+
console.error("Tangent morph count mismatch: " + this.morphWeightsLength + ", " + tangentCount + ".");
|
|
1369
1370
|
return false;
|
|
1370
1371
|
}
|
|
1371
1372
|
if (this.morphWeightsLength > 5) {
|
|
1372
|
-
console.error("Tangent morph count should not greater than 5, current " + this.morphWeightsLength);
|
|
1373
|
+
console.error("Tangent morph count should not greater than 5, current " + this.morphWeightsLength + ".");
|
|
1373
1374
|
return false;
|
|
1374
1375
|
}
|
|
1375
1376
|
return true;
|
|
@@ -1391,7 +1392,7 @@ var TextureDataMode;
|
|
|
1391
1392
|
_proto.updateWeights = function updateWeights(weights) {
|
|
1392
1393
|
var _this = this;
|
|
1393
1394
|
if (weights.length != this.morphWeightsArray.length) {
|
|
1394
|
-
console.error("Length of morph weights mismatch: input " + weights.length + ", internel " + this.morphWeightsArray.length);
|
|
1395
|
+
console.error("Length of morph weights mismatch: input " + weights.length + ", internel " + this.morphWeightsArray.length + ".");
|
|
1395
1396
|
return;
|
|
1396
1397
|
}
|
|
1397
1398
|
weights.forEach(function(value, index) {
|
|
@@ -1512,16 +1513,16 @@ var PAnimPathType;
|
|
|
1512
1513
|
this.component = this.dataArray.length / this.timeArray.length;
|
|
1513
1514
|
// special checker for weights animation
|
|
1514
1515
|
if (this.component <= 0) {
|
|
1515
|
-
console.error("Invalid weights component: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length);
|
|
1516
|
+
console.error("Invalid weights component: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length + ".");
|
|
1516
1517
|
} else if (this.timeArray.length * this.component != this.dataArray.length) {
|
|
1517
|
-
console.error("Invalid weights array length: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length);
|
|
1518
|
+
console.error("Invalid weights array length: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length + ".");
|
|
1518
1519
|
}
|
|
1519
1520
|
} else {
|
|
1520
1521
|
// should never happened
|
|
1521
|
-
console.error("Invalid path status: " + path);
|
|
1522
|
+
console.error("Invalid path status: " + path + ".");
|
|
1522
1523
|
}
|
|
1523
1524
|
if (this.timeArray.length * this.component > this.dataArray.length) {
|
|
1524
|
-
throw new Error("Data length mismatch: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length);
|
|
1525
|
+
throw new Error("Data length mismatch: " + this.timeArray.length + ", " + this.component + ", " + this.dataArray.length + ".");
|
|
1525
1526
|
}
|
|
1526
1527
|
if (interpolation === "LINEAR") {
|
|
1527
1528
|
this.interp = 0;
|
|
@@ -2541,7 +2542,7 @@ function _assert_this_initialized(self) {
|
|
|
2541
2542
|
_this.subMeshes.push(subMesh);
|
|
2542
2543
|
});
|
|
2543
2544
|
if (_this.subMeshes.length <= 0) {
|
|
2544
|
-
console.warn("No primitive inside mesh item " + name);
|
|
2545
|
+
console.warn("No primitive inside mesh item " + name + ".");
|
|
2545
2546
|
}
|
|
2546
2547
|
_this.boundingBox = _this.getItemBoundingBox(meshData.interaction);
|
|
2547
2548
|
return _this;
|
|
@@ -2629,7 +2630,7 @@ function _assert_this_initialized(self) {
|
|
|
2629
2630
|
return;
|
|
2630
2631
|
}
|
|
2631
2632
|
if (updatedArray.length != weightsArray.length) {
|
|
2632
|
-
throw new Error("
|
|
2633
|
+
throw new Error("Weight array length mismatch.");
|
|
2633
2634
|
}
|
|
2634
2635
|
for(var i = 0; i < updatedArray.length; i++){
|
|
2635
2636
|
updatedArray[i] = weightsArray[i];
|
|
@@ -3120,7 +3121,7 @@ function _assert_this_initialized(self) {
|
|
|
3120
3121
|
});
|
|
3121
3122
|
}
|
|
3122
3123
|
var proxy = new HitTestingProxy();
|
|
3123
|
-
var doubleSided = this.material.
|
|
3124
|
+
var doubleSided = this.material.isBothSide();
|
|
3124
3125
|
proxy.create(this.geometry.geometry, doubleSided, bindMatrices);
|
|
3125
3126
|
return proxy.getHitPoint(newOrigin, newDirection);
|
|
3126
3127
|
};
|
|
@@ -3261,8 +3262,7 @@ function _assert_this_initialized(self) {
|
|
|
3261
3262
|
material.setVector3("_shCoefficients." + n, Vector3.fromArray(coeffs[i]));
|
|
3262
3263
|
});
|
|
3263
3264
|
}
|
|
3264
|
-
|
|
3265
|
-
material.setInt("_MipCount", (_skybox_specularMipCount = skybox.specularMipCount) != null ? _skybox_specularMipCount : 1);
|
|
3265
|
+
material.setInt("_MipCount", skybox.specularMipCount - 1);
|
|
3266
3266
|
material.setTexture("_SpecularEnvSampler", skybox.specularImage);
|
|
3267
3267
|
}
|
|
3268
3268
|
}
|
|
@@ -3623,7 +3623,7 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3623
3623
|
this.brdfLUT = this.sceneCache.getBrdfLutTexture();
|
|
3624
3624
|
this.initGlobalState(opts);
|
|
3625
3625
|
if (this.maxLightCount > 8) {
|
|
3626
|
-
console.warn("Too many light items: " + this.maxLightCount + " light(s)");
|
|
3626
|
+
console.warn("Too many light items: " + this.maxLightCount + " light(s).");
|
|
3627
3627
|
}
|
|
3628
3628
|
};
|
|
3629
3629
|
_proto.initGlobalState = function initGlobalState(opts) {
|
|
@@ -3768,9 +3768,9 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3768
3768
|
maxLightCount: this.maxLightCount,
|
|
3769
3769
|
skybox: this.skybox
|
|
3770
3770
|
};
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3771
|
+
if (this.enableDynamicSort) {
|
|
3772
|
+
this.dynamicSortMeshes(this.sceneStates);
|
|
3773
|
+
}
|
|
3774
3774
|
this.tickCount += 1;
|
|
3775
3775
|
this.lastTickSecond += deltaSeconds;
|
|
3776
3776
|
};
|
|
@@ -3779,12 +3779,14 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3779
3779
|
* 主要是为了和 Tiny 渲染对齐,正常渲染不进行调整
|
|
3780
3780
|
* @param states - 场景中的状态数据
|
|
3781
3781
|
*/ _proto.dynamicSortMeshes = function dynamicSortMeshes(states) {
|
|
3782
|
-
var
|
|
3782
|
+
var meshComponents = [];
|
|
3783
3783
|
var priorityList = [];
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3784
|
+
this.meshList.forEach(function(mesh) {
|
|
3785
|
+
if (mesh.owner && mesh.owner.enabled) {
|
|
3786
|
+
var component = mesh.owner;
|
|
3787
|
+
meshComponents.push(component);
|
|
3788
|
+
priorityList.push(component.priority);
|
|
3789
|
+
}
|
|
3788
3790
|
});
|
|
3789
3791
|
priorityList.sort(function(a, b) {
|
|
3790
3792
|
return a - b;
|
|
@@ -3792,26 +3794,30 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3792
3794
|
// 按照 Tiny 排序算法,对 Mesh 对象进行排序
|
|
3793
3795
|
// 将透明和不透明物体拆开,从而渲染正确
|
|
3794
3796
|
var viewMatrix = states.viewMatrix;
|
|
3795
|
-
|
|
3797
|
+
meshComponents.sort(function(a, b) {
|
|
3796
3798
|
var atransparent = WebGLHelper.isTransparentMesh(a);
|
|
3797
3799
|
var btransparent = WebGLHelper.isTransparentMesh(b);
|
|
3798
3800
|
if (atransparent && btransparent) {
|
|
3799
|
-
var aposition =
|
|
3800
|
-
var bposition =
|
|
3801
|
+
var aposition = a.transform.getWorldPosition();
|
|
3802
|
+
var bposition = b.transform.getWorldPosition();
|
|
3801
3803
|
var anewPos = viewMatrix.transformPoint(aposition);
|
|
3802
3804
|
var bnewPos = viewMatrix.transformPoint(bposition);
|
|
3803
|
-
|
|
3805
|
+
if (anewPos.z === bnewPos.z) {
|
|
3806
|
+
return a.priority - b.priority;
|
|
3807
|
+
} else {
|
|
3808
|
+
return anewPos.z - bnewPos.z;
|
|
3809
|
+
}
|
|
3804
3810
|
} else if (atransparent) {
|
|
3805
3811
|
return 1;
|
|
3806
3812
|
} else if (btransparent) {
|
|
3807
3813
|
return -1;
|
|
3808
3814
|
} else {
|
|
3809
|
-
return
|
|
3815
|
+
return a.priority - b.priority;
|
|
3810
3816
|
}
|
|
3811
3817
|
});
|
|
3812
3818
|
// 重新赋值渲染优先级
|
|
3813
|
-
for(var i = 0; i <
|
|
3814
|
-
var mesh =
|
|
3819
|
+
for(var i = 0; i < meshComponents.length; i++){
|
|
3820
|
+
var mesh = meshComponents[i];
|
|
3815
3821
|
var priority = priorityList[i];
|
|
3816
3822
|
mesh.priority = priority;
|
|
3817
3823
|
}
|
|
@@ -3956,7 +3962,7 @@ var StandardShaderSource;
|
|
|
3956
3962
|
if (isWebGL2) {
|
|
3957
3963
|
return "#version 300 es\n" + source;
|
|
3958
3964
|
} else {
|
|
3959
|
-
return
|
|
3965
|
+
return source;
|
|
3960
3966
|
}
|
|
3961
3967
|
}
|
|
3962
3968
|
/**
|
|
@@ -3973,9 +3979,8 @@ var StandardShaderSource;
|
|
|
3973
3979
|
}
|
|
3974
3980
|
if (isWebGL2) {
|
|
3975
3981
|
return "#version 300 es\n" + source;
|
|
3976
|
-
} else {
|
|
3977
|
-
return "#version 100\n" + source;
|
|
3978
3982
|
}
|
|
3983
|
+
return source;
|
|
3979
3984
|
}
|
|
3980
3985
|
StandardShaderSource.getSourceCode = getSourceCode;
|
|
3981
3986
|
})(StandardShaderSource || (StandardShaderSource = {}));
|
|
@@ -4253,7 +4258,7 @@ function getQuadFilterVS() {
|
|
|
4253
4258
|
if (func !== undefined) {
|
|
4254
4259
|
return func(context);
|
|
4255
4260
|
} else {
|
|
4256
|
-
throw new Error("Invalid material type " + materialType + ", shader content " + context);
|
|
4261
|
+
throw new Error("Invalid material type " + materialType + ", shader content " + context + ".");
|
|
4257
4262
|
}
|
|
4258
4263
|
};
|
|
4259
4264
|
/**
|
|
@@ -4703,7 +4708,8 @@ var ModelCameraComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
4703
4708
|
/**
|
|
4704
4709
|
* 组件销毁
|
|
4705
4710
|
*/ _proto.onDestroy = function onDestroy() {
|
|
4706
|
-
|
|
4711
|
+
var _this_content;
|
|
4712
|
+
(_this_content = this.content) == null ? void 0 : _this_content.dispose();
|
|
4707
4713
|
};
|
|
4708
4714
|
/**
|
|
4709
4715
|
* 反序列化,记录传入参数
|
|
@@ -4820,29 +4826,25 @@ var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
|
|
|
4820
4826
|
var life = Math.max(0, time) % duration;
|
|
4821
4827
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.positionCurves), _step; !(_step = _iterator()).done;){
|
|
4822
4828
|
var curve = _step.value;
|
|
4823
|
-
var
|
|
4824
|
-
var value = curve.keyFrames.getValue(life % maxTime);
|
|
4829
|
+
var value = curve.keyFrames.getValue(life % this.duration);
|
|
4825
4830
|
var target = this.getTargetItem(vfxItem, curve.path);
|
|
4826
4831
|
target == null ? void 0 : target.transform.setPosition(value.x, value.y, value.z);
|
|
4827
4832
|
}
|
|
4828
4833
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.rotationCurves), _step1; !(_step1 = _iterator1()).done;){
|
|
4829
4834
|
var curve1 = _step1.value;
|
|
4830
|
-
var
|
|
4831
|
-
var value1 = curve1.keyFrames.getValue(life % maxTime1);
|
|
4835
|
+
var value1 = curve1.keyFrames.getValue(life % this.duration);
|
|
4832
4836
|
var target1 = this.getTargetItem(vfxItem, curve1.path);
|
|
4833
4837
|
target1 == null ? void 0 : target1.transform.setQuaternion(value1.x, value1.y, value1.z, value1.w);
|
|
4834
4838
|
}
|
|
4835
4839
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(this.scaleCurves), _step2; !(_step2 = _iterator2()).done;){
|
|
4836
4840
|
var curve2 = _step2.value;
|
|
4837
|
-
var
|
|
4838
|
-
var value2 = curve2.keyFrames.getValue(life % maxTime2);
|
|
4841
|
+
var value2 = curve2.keyFrames.getValue(life % this.duration);
|
|
4839
4842
|
var target2 = this.getTargetItem(vfxItem, curve2.path);
|
|
4840
4843
|
target2 == null ? void 0 : target2.transform.setScale(value2.x, value2.y, value2.z);
|
|
4841
4844
|
}
|
|
4842
4845
|
for(var _iterator3 = _create_for_of_iterator_helper_loose(this.floatCurves), _step3; !(_step3 = _iterator3()).done;){
|
|
4843
4846
|
var curve3 = _step3.value;
|
|
4844
|
-
var
|
|
4845
|
-
var value3 = curve3.keyFrames.getValue(life % maxTime3);
|
|
4847
|
+
var value3 = curve3.keyFrames.getValue(life % this.duration);
|
|
4846
4848
|
var target3 = this.getTargetItem(vfxItem, curve3.path);
|
|
4847
4849
|
if (curve3.className === "ModelMeshComponent") {
|
|
4848
4850
|
var component = target3 == null ? void 0 : target3.getComponent(ModelMeshComponent);
|
|
@@ -4850,14 +4852,15 @@ var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
|
|
|
4850
4852
|
var properties = curve3.property.split(".");
|
|
4851
4853
|
setProperty(component, properties, value3);
|
|
4852
4854
|
} else {
|
|
4853
|
-
console.error("Can't find mesh component");
|
|
4855
|
+
console.error("Can't find mesh component.");
|
|
4854
4856
|
}
|
|
4855
4857
|
} else {
|
|
4856
|
-
console.warn("Ignore curve: className " + curve3.className);
|
|
4858
|
+
console.warn("Ignore curve: className " + curve3.className + ".");
|
|
4857
4859
|
}
|
|
4858
4860
|
}
|
|
4859
4861
|
};
|
|
4860
4862
|
_proto.setFromAnimationClip = function setFromAnimationClip(clip) {
|
|
4863
|
+
this.duration = clip.duration;
|
|
4861
4864
|
this.positionCurves = clip.positionCurves.slice();
|
|
4862
4865
|
this.rotationCurves = clip.rotationCurves.slice();
|
|
4863
4866
|
this.scaleCurves = clip.scaleCurves.slice();
|
|
@@ -4881,7 +4884,7 @@ var ModelAnimationClip = /*#__PURE__*/ function(AnimationClip) {
|
|
|
4881
4884
|
}
|
|
4882
4885
|
}
|
|
4883
4886
|
if (!findTag) {
|
|
4884
|
-
throw new Error("Can't find path in tree " + rootItem.id + ", " + path);
|
|
4887
|
+
throw new Error("Can't find path in tree " + rootItem.id + ", " + path + ".");
|
|
4885
4888
|
}
|
|
4886
4889
|
}
|
|
4887
4890
|
this.path2Node[path] = target;
|
|
@@ -4895,7 +4898,7 @@ function setProperty(obj, properties, value) {
|
|
|
4895
4898
|
for(var i = 0; i < len - 1; i++){
|
|
4896
4899
|
var propName = properties[i];
|
|
4897
4900
|
if (!(propName in current) || typeof current[propName] !== "object") {
|
|
4898
|
-
console.error("Invalid properties " + properties);
|
|
4901
|
+
console.error("Invalid properties " + properties + ".");
|
|
4899
4902
|
return;
|
|
4900
4903
|
}
|
|
4901
4904
|
current = current[propName];
|
|
@@ -5138,7 +5141,7 @@ var normal = new Vector3();
|
|
|
5138
5141
|
var blob, urlCreator, imageUrl, imageObj;
|
|
5139
5142
|
return __generator(this, function(_state) {
|
|
5140
5143
|
if (image.imageData === undefined) {
|
|
5141
|
-
console.error("createTexture2D: Invalid image data from " + image);
|
|
5144
|
+
console.error("createTexture2D: Invalid image data from " + image + ".");
|
|
5142
5145
|
// 这里不应该发生的,做个兜底
|
|
5143
5146
|
return [
|
|
5144
5147
|
2,
|
|
@@ -5613,10 +5616,10 @@ var normal = new Vector3();
|
|
|
5613
5616
|
};
|
|
5614
5617
|
/**
|
|
5615
5618
|
* 返回 Mesh 是否半透明
|
|
5616
|
-
* @param
|
|
5619
|
+
* @param component - ModelMeshComponent 对象
|
|
5617
5620
|
* @return 是否半透明
|
|
5618
|
-
*/ WebGLHelper.isTransparentMesh = function isTransparentMesh(
|
|
5619
|
-
return
|
|
5621
|
+
*/ WebGLHelper.isTransparentMesh = function isTransparentMesh(component) {
|
|
5622
|
+
return component.material.blending === true;
|
|
5620
5623
|
};
|
|
5621
5624
|
/**
|
|
5622
5625
|
* renderer 是否支持 Float 纹理
|
|
@@ -6078,10 +6081,17 @@ var normal = new Vector3();
|
|
|
6078
6081
|
texOptions.wrapT = glContext.REPEAT;
|
|
6079
6082
|
texOptions.magFilter = glContext.LINEAR;
|
|
6080
6083
|
texOptions.minFilter = glContext.LINEAR_MIPMAP_LINEAR;
|
|
6081
|
-
texOptions.generateMipmap = true;
|
|
6082
6084
|
if (!isBaseColor) {
|
|
6083
6085
|
texOptions.premultiplyAlpha = true;
|
|
6084
6086
|
}
|
|
6087
|
+
var newOptions = texOptions;
|
|
6088
|
+
newOptions.generateMipmap = true;
|
|
6089
|
+
var image = newOptions.image;
|
|
6090
|
+
if (image && image.width && image.height) {
|
|
6091
|
+
if (!WebGLHelper.isPow2(image.width) || !WebGLHelper.isPow2(image.height)) {
|
|
6092
|
+
texOptions.minFilter = glContext.LINEAR;
|
|
6093
|
+
}
|
|
6094
|
+
}
|
|
6085
6095
|
} else if (texOptions.target === glContext.TEXTURE_CUBE_MAP) {
|
|
6086
6096
|
texOptions.wrapS = glContext.CLAMP_TO_EDGE;
|
|
6087
6097
|
texOptions.wrapT = glContext.CLAMP_TO_EDGE;
|
|
@@ -6157,7 +6167,7 @@ var normal = new Vector3();
|
|
|
6157
6167
|
if (_instanceof1(inverseBindMatrices, Float32Array)) {
|
|
6158
6168
|
studioSkin.inverseBindMatrices = inverseBindMatrices;
|
|
6159
6169
|
} else {
|
|
6160
|
-
console.error("setupItem3DOptions: Invalid inverseBindMatrices type, " + inverseBindMatrices);
|
|
6170
|
+
console.error("setupItem3DOptions: Invalid inverseBindMatrices type, " + inverseBindMatrices + ".");
|
|
6161
6171
|
}
|
|
6162
6172
|
}
|
|
6163
6173
|
} else if (item.type === spec.ItemType.tree) {
|
|
@@ -6175,12 +6185,12 @@ var normal = new Vector3();
|
|
|
6175
6185
|
if (_instanceof1(inputArray, Float32Array)) {
|
|
6176
6186
|
studioTrack.input = inputArray;
|
|
6177
6187
|
} else {
|
|
6178
|
-
console.error("setupItem3DOptions: Type of inputArray should be float32, " + inputArray);
|
|
6188
|
+
console.error("setupItem3DOptions: Type of inputArray should be float32, " + inputArray + ".");
|
|
6179
6189
|
}
|
|
6180
6190
|
if (_instanceof1(outputArray, Float32Array)) {
|
|
6181
6191
|
studioTrack.output = outputArray;
|
|
6182
6192
|
} else {
|
|
6183
|
-
console.error("setupItem3DOptions: Type of outputArray should be float32, " + outputArray);
|
|
6193
|
+
console.error("setupItem3DOptions: Type of outputArray should be float32, " + outputArray + ".");
|
|
6184
6194
|
}
|
|
6185
6195
|
});
|
|
6186
6196
|
});
|
|
@@ -6192,7 +6202,7 @@ var normal = new Vector3();
|
|
|
6192
6202
|
var studioOptions = studioSkybox.content.options;
|
|
6193
6203
|
var specularImage = _this.getTextureObj(composition.textures, options.specularImage);
|
|
6194
6204
|
if (specularImage === undefined) {
|
|
6195
|
-
console.error("setupItem3DOptions: skybox specualrImage is undefined, " + CheckerHelper.stringify(options));
|
|
6205
|
+
console.error("setupItem3DOptions: skybox specualrImage is undefined, " + CheckerHelper.stringify(options) + ".");
|
|
6196
6206
|
}
|
|
6197
6207
|
studioOptions.specularImage = specularImage;
|
|
6198
6208
|
//
|
|
@@ -6236,7 +6246,7 @@ var normal = new Vector3();
|
|
|
6236
6246
|
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
6237
6247
|
return array;
|
|
6238
6248
|
default:
|
|
6239
|
-
console.error("Invalid index attribute type " + type);
|
|
6249
|
+
console.error("Invalid index attribute type " + type + ".");
|
|
6240
6250
|
}
|
|
6241
6251
|
};
|
|
6242
6252
|
/**
|
|
@@ -6264,7 +6274,7 @@ var normal = new Vector3();
|
|
|
6264
6274
|
// aPos, aNormal, aTangent,
|
|
6265
6275
|
// aUV, aUV2, aJoints, aWeights
|
|
6266
6276
|
// aTargetXXX
|
|
6267
|
-
console.warn("Unknown attribute name: " + name);
|
|
6277
|
+
console.warn("Unknown attribute name: " + name + ".");
|
|
6268
6278
|
}
|
|
6269
6279
|
return name;
|
|
6270
6280
|
};
|
|
@@ -6278,7 +6288,7 @@ var normal = new Vector3();
|
|
|
6278
6288
|
return null;
|
|
6279
6289
|
}
|
|
6280
6290
|
if (index < 0 || index >= textures.length) {
|
|
6281
|
-
console.error("Invalid index for textures: " + index + ", " + textures.length);
|
|
6291
|
+
console.error("Invalid index for textures: " + index + ", " + textures.length + ".");
|
|
6282
6292
|
}
|
|
6283
6293
|
return textures[index];
|
|
6284
6294
|
};
|
|
@@ -6404,7 +6414,7 @@ var normal = new Vector3();
|
|
|
6404
6414
|
if (b) {
|
|
6405
6415
|
resolve(b.arrayBuffer());
|
|
6406
6416
|
} else {
|
|
6407
|
-
reject(new Error("
|
|
6417
|
+
reject(new Error("No canvas blob."));
|
|
6408
6418
|
}
|
|
6409
6419
|
}, "image/png", 1);
|
|
6410
6420
|
})
|
|
@@ -6566,7 +6576,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
6566
6576
|
this.offset = (_inAttrib_offset = inAttrib.offset) != null ? _inAttrib_offset : 0;
|
|
6567
6577
|
if (this.offset > 0) {
|
|
6568
6578
|
if (this.offset % this.typeSize !== 0) {
|
|
6569
|
-
console.error("Invalid offset " + this.offset + ", type size " + this.typeSize);
|
|
6579
|
+
console.error("Invalid offset " + this.offset + ", type size " + this.typeSize + ".");
|
|
6570
6580
|
}
|
|
6571
6581
|
this.offset = this.offset / this.typeSize;
|
|
6572
6582
|
}
|
|
@@ -6575,7 +6585,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
6575
6585
|
this.stride = (_inAttrib_stride = inAttrib.stride) != null ? _inAttrib_stride : 0;
|
|
6576
6586
|
if (this.stride > 0) {
|
|
6577
6587
|
if (this.stride % this.typeSize !== 0) {
|
|
6578
|
-
console.error("Invalid stride " + this.stride + ", type size " + this.typeSize);
|
|
6588
|
+
console.error("Invalid stride " + this.stride + ", type size " + this.typeSize + ".");
|
|
6579
6589
|
}
|
|
6580
6590
|
this.stride = this.stride / this.typeSize;
|
|
6581
6591
|
} else {
|
|
@@ -7088,7 +7098,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7088
7098
|
*/ CheckerHelper.checkTexture = function checkTexture(v) {
|
|
7089
7099
|
if (_instanceof1(v, Texture)) {
|
|
7090
7100
|
if (v.isDestroyed) {
|
|
7091
|
-
console.error("Texture is destroyed, " + v.name);
|
|
7101
|
+
console.error("Texture is destroyed, " + v.name + ".");
|
|
7092
7102
|
}
|
|
7093
7103
|
return !v.isDestroyed;
|
|
7094
7104
|
} else {
|
|
@@ -7165,14 +7175,14 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7165
7175
|
* @param s - 蒙皮参数
|
|
7166
7176
|
*/ CheckerHelper.assertGeometry = function assertGeometry(v, s) {
|
|
7167
7177
|
if (!_instanceof1(v, Geometry)) {
|
|
7168
|
-
console.error("Invalid geometry type " + this.stringify(v));
|
|
7178
|
+
console.error("Invalid geometry type " + this.stringify(v) + ".");
|
|
7169
7179
|
}
|
|
7170
7180
|
// @ts-expect-error
|
|
7171
7181
|
if (v.isDestroyed === true) {
|
|
7172
|
-
console.error("Geometry object is destroyed");
|
|
7182
|
+
console.error("Geometry object is destroyed.");
|
|
7173
7183
|
}
|
|
7174
7184
|
if (!this.checkNonnegative(v.getDrawStart())) {
|
|
7175
|
-
console.error("Invalid geometry draw start: " + v.getDrawStart() + ", " + this.stringify(v));
|
|
7185
|
+
console.error("Invalid geometry draw start: " + v.getDrawStart() + ", " + this.stringify(v) + ".");
|
|
7176
7186
|
}
|
|
7177
7187
|
// // drawCount不再为负
|
|
7178
7188
|
// if (!this.checkPositive(v.getDrawCount())) {
|
|
@@ -7231,7 +7241,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7231
7241
|
var attribArray = this.createAttributeArray(v, name);
|
|
7232
7242
|
if (attribArray !== undefined) {
|
|
7233
7243
|
if (attribArray.getLength() < drawCount) {
|
|
7234
|
-
console.error(name + " Length(" + attribArray.getLength() + ") is less than draw count(" + drawCount + "), " + this.stringify(v));
|
|
7244
|
+
console.error(name + " Length(" + attribArray.getLength() + ") is less than draw count(" + drawCount + "), " + this.stringify(v) + ".");
|
|
7235
7245
|
}
|
|
7236
7246
|
}
|
|
7237
7247
|
};
|
|
@@ -7264,24 +7274,24 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7264
7274
|
* @param v - 蒙皮参数
|
|
7265
7275
|
*/ CheckerHelper.assertModelSkinOptions = function assertModelSkinOptions(v) {
|
|
7266
7276
|
if (!this.checkStringUndef(v.name)) {
|
|
7267
|
-
console.error("Invalid skin name " + v.name + ", " + this.stringify(v));
|
|
7277
|
+
console.error("Invalid skin name " + v.name + ", " + this.stringify(v) + ".");
|
|
7268
7278
|
}
|
|
7269
7279
|
if (!this.checkNumberArray(v.joints)) {
|
|
7270
|
-
console.error("Invalid skin joints " + v.joints + ", " + this.stringify(v));
|
|
7280
|
+
console.error("Invalid skin joints " + v.joints + ", " + this.stringify(v) + ".");
|
|
7271
7281
|
}
|
|
7272
7282
|
if (!this.checkNumberUndef(v.skeleton)) {
|
|
7273
|
-
console.error("Invalid skin skeleton " + v.skeleton + ", " + this.stringify(v));
|
|
7283
|
+
console.error("Invalid skin skeleton " + v.skeleton + ", " + this.stringify(v) + ".");
|
|
7274
7284
|
}
|
|
7275
7285
|
if (!this.checkFloat32ArrayUndef(v.inverseBindMatrices)) {
|
|
7276
|
-
console.error("Invalid skin inverseBindMatrices " + v.inverseBindMatrices + ", " + this.stringify(v));
|
|
7286
|
+
console.error("Invalid skin inverseBindMatrices " + v.inverseBindMatrices + ", " + this.stringify(v) + ".");
|
|
7277
7287
|
}
|
|
7278
7288
|
//
|
|
7279
7289
|
if (v.inverseBindMatrices !== undefined) {
|
|
7280
7290
|
if (v.inverseBindMatrices.length <= 0 || v.inverseBindMatrices.length % 16 !== 0) {
|
|
7281
|
-
console.error("Invalid skin inverseBindMatrices length " + v.inverseBindMatrices + ", " + this.stringify(v));
|
|
7291
|
+
console.error("Invalid skin inverseBindMatrices length " + v.inverseBindMatrices + ", " + this.stringify(v) + ".");
|
|
7282
7292
|
}
|
|
7283
7293
|
if (v.joints.length * 16 !== v.inverseBindMatrices.length) {
|
|
7284
|
-
console.error("Mismatch: skin joints and inverseBindMatrices length, " + v.joints + ", " + v.inverseBindMatrices + ", " + this.stringify(v));
|
|
7294
|
+
console.error("Mismatch: skin joints and inverseBindMatrices length, " + v.joints + ", " + v.inverseBindMatrices + ", " + this.stringify(v) + ".");
|
|
7285
7295
|
}
|
|
7286
7296
|
var mat = new Matrix4();
|
|
7287
7297
|
for(var i = 0; i < v.inverseBindMatrices.length; i += 16){
|
|
@@ -7289,12 +7299,12 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7289
7299
|
mat.elements[j] = v.inverseBindMatrices[i + j];
|
|
7290
7300
|
}
|
|
7291
7301
|
if (Math.abs(mat.determinant()) < 1e-5) {
|
|
7292
|
-
console.error("Determinant of inverseBindMatrices is too small " + mat.determinant() + ", index " + i / 16 + ", " + this.stringify(v));
|
|
7302
|
+
console.error("Determinant of inverseBindMatrices is too small " + mat.determinant() + ", index " + i / 16 + ", " + this.stringify(v) + ".");
|
|
7293
7303
|
}
|
|
7294
7304
|
}
|
|
7295
7305
|
} else {
|
|
7296
7306
|
if (v.joints.length <= 0) {
|
|
7297
|
-
console.error("Invalid skin joints length " + v.joints + ", " + this.stringify(v));
|
|
7307
|
+
console.error("Invalid skin joints length " + v.joints + ", " + this.stringify(v) + ".");
|
|
7298
7308
|
}
|
|
7299
7309
|
}
|
|
7300
7310
|
};
|
|
@@ -7304,138 +7314,138 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7304
7314
|
*/ CheckerHelper.assertMatOptions = function assertMatOptions(v) {
|
|
7305
7315
|
if (v.type === spec.MaterialType.unlit) {
|
|
7306
7316
|
if (!this.checkString(v.name)) {
|
|
7307
|
-
console.error("Invalid material name " + v.name + ", " + this.stringify(v));
|
|
7317
|
+
console.error("Invalid material name " + v.name + ", " + this.stringify(v) + ".");
|
|
7308
7318
|
}
|
|
7309
7319
|
//
|
|
7310
7320
|
if (!this.checkNonnegative4(v.baseColorFactor)) {
|
|
7311
|
-
console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v));
|
|
7321
|
+
console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v) + ".");
|
|
7312
7322
|
}
|
|
7313
7323
|
if (!this.checkTextureUndef(v.baseColorTexture)) {
|
|
7314
|
-
console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v));
|
|
7324
|
+
console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v) + ".");
|
|
7315
7325
|
}
|
|
7316
7326
|
if (!this.checkTexTransformUndef(v.baseColorTextureTransform)) {
|
|
7317
|
-
console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v));
|
|
7327
|
+
console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v) + ".");
|
|
7318
7328
|
}
|
|
7319
7329
|
if (!this.checkTexCoord(v.baseColorTextureCoordinate)) {
|
|
7320
|
-
console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v));
|
|
7330
|
+
console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7321
7331
|
}
|
|
7322
7332
|
//
|
|
7323
7333
|
if (!this.checkBooleanUndef(v.depthMask)) {
|
|
7324
|
-
console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v));
|
|
7334
|
+
console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v) + ".");
|
|
7325
7335
|
}
|
|
7326
7336
|
if (!this.checkMatBlending(v.blending)) {
|
|
7327
|
-
console.error("Invalid material blending " + v.blending + ", " + this.stringify(v));
|
|
7337
|
+
console.error("Invalid material blending " + v.blending + ", " + this.stringify(v) + ".");
|
|
7328
7338
|
}
|
|
7329
7339
|
if (!this.checkMatSide(v.side)) {
|
|
7330
|
-
console.error("Invalid material side " + v.side + ", " + this.stringify(v));
|
|
7340
|
+
console.error("Invalid material side " + v.side + ", " + this.stringify(v) + ".");
|
|
7331
7341
|
}
|
|
7332
7342
|
if (v.blending === spec.MaterialBlending.masked) {
|
|
7333
7343
|
if (v.alphaCutOff === undefined) {
|
|
7334
|
-
console.error("Material alphaCutOff is required for mask, " + this.stringify(v));
|
|
7344
|
+
console.error("Material alphaCutOff is required for mask, " + this.stringify(v) + ".");
|
|
7335
7345
|
}
|
|
7336
7346
|
}
|
|
7337
7347
|
if (!this.checkNumber01Undef(v.alphaCutOff)) {
|
|
7338
|
-
console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v));
|
|
7348
|
+
console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v) + ".");
|
|
7339
7349
|
}
|
|
7340
7350
|
} else if (v.type === spec.MaterialType.pbr) {
|
|
7341
7351
|
if (!this.checkString(v.name)) {
|
|
7342
|
-
console.error("Invalid material name " + v.name + ", " + this.stringify(v));
|
|
7352
|
+
console.error("Invalid material name " + v.name + ", " + this.stringify(v) + ".");
|
|
7343
7353
|
}
|
|
7344
7354
|
//
|
|
7345
7355
|
if (!this.checkNonnegative4(v.baseColorFactor)) {
|
|
7346
|
-
console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v));
|
|
7356
|
+
console.error("Invalid material baseColorFactor " + v.baseColorFactor + ", " + this.stringify(v) + ".");
|
|
7347
7357
|
}
|
|
7348
7358
|
if (!this.checkTextureUndef(v.baseColorTexture)) {
|
|
7349
|
-
console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v));
|
|
7359
|
+
console.error("Invalid material baseColorTexture " + v.baseColorTexture + ", " + this.stringify(v) + ".");
|
|
7350
7360
|
}
|
|
7351
7361
|
if (!this.checkTexTransformUndef(v.baseColorTextureTransform)) {
|
|
7352
|
-
console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v));
|
|
7362
|
+
console.error("Invalid material baseColorTextureTransform " + v.baseColorTextureTransform + ", " + this.stringify(v) + ".");
|
|
7353
7363
|
}
|
|
7354
7364
|
if (!this.checkTexCoord(v.baseColorTextureCoordinate)) {
|
|
7355
|
-
console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v));
|
|
7365
|
+
console.error("Invalid material baseColorTextureCoordinate " + v.baseColorTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7356
7366
|
}
|
|
7357
7367
|
//
|
|
7358
7368
|
if (!this.checkBooleanUndef(v.useSpecularAA)) {
|
|
7359
|
-
console.error("Invalid material useSpecularAA " + v.useSpecularAA + ", " + this.stringify(v));
|
|
7369
|
+
console.error("Invalid material useSpecularAA " + v.useSpecularAA + ", " + this.stringify(v) + ".");
|
|
7360
7370
|
}
|
|
7361
7371
|
if (!this.checkNumber01(v.metallicFactor)) {
|
|
7362
|
-
console.error("Invalid material metallicFactor " + v.metallicFactor + ", " + this.stringify(v));
|
|
7372
|
+
console.error("Invalid material metallicFactor " + v.metallicFactor + ", " + this.stringify(v) + ".");
|
|
7363
7373
|
}
|
|
7364
7374
|
if (!this.checkNonnegative(v.roughnessFactor)) {
|
|
7365
|
-
console.error("Invalid material roughnessFactor " + v.roughnessFactor + ", " + this.stringify(v));
|
|
7375
|
+
console.error("Invalid material roughnessFactor " + v.roughnessFactor + ", " + this.stringify(v) + ".");
|
|
7366
7376
|
}
|
|
7367
7377
|
if (!this.checkTextureUndef(v.metallicRoughnessTexture)) {
|
|
7368
|
-
console.error("Invalid material metallicRoughnessTexture " + v.metallicRoughnessTexture + ", " + this.stringify(v));
|
|
7378
|
+
console.error("Invalid material metallicRoughnessTexture " + v.metallicRoughnessTexture + ", " + this.stringify(v) + ".");
|
|
7369
7379
|
}
|
|
7370
7380
|
if (!this.checkTexTransformUndef(v.metallicRoughnessTextureTransform)) {
|
|
7371
|
-
console.error("Invalid material metallicRoughnessTextureTransform " + v.metallicRoughnessTextureTransform + ", " + this.stringify(v));
|
|
7381
|
+
console.error("Invalid material metallicRoughnessTextureTransform " + v.metallicRoughnessTextureTransform + ", " + this.stringify(v) + ".");
|
|
7372
7382
|
}
|
|
7373
7383
|
if (!this.checkTexCoord(v.metallicRoughnessTextureCoordinate)) {
|
|
7374
|
-
console.error("Invalid material metallicRoughnessTextureCoordinate " + v.metallicRoughnessTextureCoordinate + ", " + this.stringify(v));
|
|
7384
|
+
console.error("Invalid material metallicRoughnessTextureCoordinate " + v.metallicRoughnessTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7375
7385
|
}
|
|
7376
7386
|
//
|
|
7377
7387
|
if (!this.checkTextureUndef(v.normalTexture)) {
|
|
7378
|
-
console.error("Invalid material normalTexture " + v.normalTexture + ", " + this.stringify(v));
|
|
7388
|
+
console.error("Invalid material normalTexture " + v.normalTexture + ", " + this.stringify(v) + ".");
|
|
7379
7389
|
}
|
|
7380
7390
|
if (!this.checkNonnegativeUndef(v.normalTextureScale)) {
|
|
7381
|
-
console.error("Invalid material normalTextureScale " + v.normalTextureScale + ", " + this.stringify(v));
|
|
7391
|
+
console.error("Invalid material normalTextureScale " + v.normalTextureScale + ", " + this.stringify(v) + ".");
|
|
7382
7392
|
}
|
|
7383
7393
|
if (!this.checkTexTransformUndef(v.normalTextureTransform)) {
|
|
7384
|
-
console.error("Invalid material normalTextureTransform " + v.normalTextureTransform + ", " + this.stringify(v));
|
|
7394
|
+
console.error("Invalid material normalTextureTransform " + v.normalTextureTransform + ", " + this.stringify(v) + ".");
|
|
7385
7395
|
}
|
|
7386
7396
|
if (!this.checkTexCoord(v.normalTextureCoordinate)) {
|
|
7387
|
-
console.error("Invalid material normalTextureCoordinate " + v.normalTextureCoordinate + ", " + this.stringify(v));
|
|
7397
|
+
console.error("Invalid material normalTextureCoordinate " + v.normalTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7388
7398
|
}
|
|
7389
7399
|
//
|
|
7390
7400
|
if (!this.checkTextureUndef(v.occlusionTexture)) {
|
|
7391
|
-
console.error("Invalid material occlusionTexture " + v.occlusionTexture + ", " + this.stringify(v));
|
|
7401
|
+
console.error("Invalid material occlusionTexture " + v.occlusionTexture + ", " + this.stringify(v) + ".");
|
|
7392
7402
|
}
|
|
7393
7403
|
if (!this.checkNumber01Undef(v.occlusionTextureStrength)) {
|
|
7394
|
-
console.error("Invalid material occlusionTextureStrength " + v.occlusionTextureStrength + ", " + this.stringify(v));
|
|
7404
|
+
console.error("Invalid material occlusionTextureStrength " + v.occlusionTextureStrength + ", " + this.stringify(v) + ".");
|
|
7395
7405
|
}
|
|
7396
7406
|
if (!this.checkTexTransformUndef(v.occlusionTextureTransform)) {
|
|
7397
|
-
console.error("Invalid material occlusionTextureTransform " + v.occlusionTextureTransform + ", " + this.stringify(v));
|
|
7407
|
+
console.error("Invalid material occlusionTextureTransform " + v.occlusionTextureTransform + ", " + this.stringify(v) + ".");
|
|
7398
7408
|
}
|
|
7399
7409
|
if (!this.checkTexCoord(v.occlusionTextureCoordinate)) {
|
|
7400
|
-
console.error("Invalid material occlusionTextureCoordinate " + v.occlusionTextureCoordinate + ", " + this.stringify(v));
|
|
7410
|
+
console.error("Invalid material occlusionTextureCoordinate " + v.occlusionTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7401
7411
|
}
|
|
7402
7412
|
//
|
|
7403
7413
|
//
|
|
7404
7414
|
if (!this.checkNonnegative4(v.emissiveFactor)) {
|
|
7405
|
-
console.error("Invalid material emissiveFactor " + v.emissiveFactor + ", " + this.stringify(v));
|
|
7415
|
+
console.error("Invalid material emissiveFactor " + v.emissiveFactor + ", " + this.stringify(v) + ".");
|
|
7406
7416
|
}
|
|
7407
7417
|
if (!this.checkNonnegative(v.emissiveIntensity)) {
|
|
7408
|
-
console.error("Invalid material emissiveIntensity " + v.emissiveIntensity + ", " + this.stringify(v));
|
|
7418
|
+
console.error("Invalid material emissiveIntensity " + v.emissiveIntensity + ", " + this.stringify(v) + ".");
|
|
7409
7419
|
}
|
|
7410
7420
|
if (!this.checkTextureUndef(v.emissiveTexture)) {
|
|
7411
|
-
console.error("Invalid material emissiveTexture " + v.emissiveTexture + ", " + this.stringify(v));
|
|
7421
|
+
console.error("Invalid material emissiveTexture " + v.emissiveTexture + ", " + this.stringify(v) + ".");
|
|
7412
7422
|
}
|
|
7413
7423
|
if (!this.checkTexTransformUndef(v.emissiveTextureTransform)) {
|
|
7414
|
-
console.error("Invalid material emissiveTextureTransform " + v.emissiveTextureTransform + ", " + this.stringify(v));
|
|
7424
|
+
console.error("Invalid material emissiveTextureTransform " + v.emissiveTextureTransform + ", " + this.stringify(v) + ".");
|
|
7415
7425
|
}
|
|
7416
7426
|
if (!this.checkTexCoord(v.emissiveTextureCoordinate)) {
|
|
7417
|
-
console.error("Invalid material emissiveTextureCoordinate " + v.emissiveTextureCoordinate + ", " + this.stringify(v));
|
|
7427
|
+
console.error("Invalid material emissiveTextureCoordinate " + v.emissiveTextureCoordinate + ", " + this.stringify(v) + ".");
|
|
7418
7428
|
}
|
|
7419
7429
|
//
|
|
7420
7430
|
if (!this.checkBooleanUndef(v.depthMask)) {
|
|
7421
|
-
console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v));
|
|
7431
|
+
console.error("Invalid material depthMask " + v.depthMask + ", " + this.stringify(v) + ".");
|
|
7422
7432
|
}
|
|
7423
7433
|
if (!this.checkMatBlending(v.blending)) {
|
|
7424
|
-
console.error("Invalid material blending " + v.blending + ", " + this.stringify(v));
|
|
7434
|
+
console.error("Invalid material blending " + v.blending + ", " + this.stringify(v) + ".");
|
|
7425
7435
|
}
|
|
7426
7436
|
if (!this.checkMatSide(v.side)) {
|
|
7427
|
-
console.error("Invalid material side " + v.side + ", " + this.stringify(v));
|
|
7437
|
+
console.error("Invalid material side " + v.side + ", " + this.stringify(v) + ".");
|
|
7428
7438
|
}
|
|
7429
7439
|
if (v.blending === spec.MaterialBlending.masked) {
|
|
7430
7440
|
if (v.alphaCutOff === undefined) {
|
|
7431
|
-
console.error("Material alphaCutOff is required for mask, " + this.stringify(v));
|
|
7441
|
+
console.error("Material alphaCutOff is required for mask, " + this.stringify(v) + ".");
|
|
7432
7442
|
}
|
|
7433
7443
|
}
|
|
7434
7444
|
if (!this.checkNumber01Undef(v.alphaCutOff)) {
|
|
7435
|
-
console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v));
|
|
7445
|
+
console.error("Invalid material alphaCutOff " + v.alphaCutOff + ", " + this.stringify(v) + ".");
|
|
7436
7446
|
}
|
|
7437
7447
|
} else {
|
|
7438
|
-
console.error("Invalid material type " + this.stringify(v));
|
|
7448
|
+
console.error("Invalid material type " + this.stringify(v) + ".");
|
|
7439
7449
|
}
|
|
7440
7450
|
};
|
|
7441
7451
|
/**
|
|
@@ -7453,7 +7463,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7453
7463
|
* @param v - Model 插件 Mesh 参数
|
|
7454
7464
|
*/ CheckerHelper.assertModelMeshOptions = function assertModelMeshOptions(v) {
|
|
7455
7465
|
if (!this.checkParent(v.parent)) {
|
|
7456
|
-
console.error("Invalid mesh parent " + v.parent + ", " + this.stringify(v));
|
|
7466
|
+
console.error("Invalid mesh parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7457
7467
|
}
|
|
7458
7468
|
if (v.skin !== undefined) {
|
|
7459
7469
|
this.assertModelSkinOptions(v.skin);
|
|
@@ -7462,7 +7472,7 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7462
7472
|
for(var i = 0; i < v.primitives.length; i++){
|
|
7463
7473
|
var prim = v.primitives[i];
|
|
7464
7474
|
if (!this.assertPrimOptions(prim)) {
|
|
7465
|
-
console.error("Invalid primitive " + prim + ", " + this.stringify(v));
|
|
7475
|
+
console.error("Invalid primitive " + prim + ", " + this.stringify(v) + ".");
|
|
7466
7476
|
}
|
|
7467
7477
|
var morph = new PMorph();
|
|
7468
7478
|
morph.create(prim.geometry);
|
|
@@ -7472,11 +7482,11 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7472
7482
|
var morph0 = morphList[i1 - 1];
|
|
7473
7483
|
var morph1 = morphList[i1];
|
|
7474
7484
|
if (!morph0.equals(morph1)) {
|
|
7475
|
-
console.error("Morph states mismatch: " + this.stringify(morph0) + ", " + this.stringify(morph1) + ", " + this.stringify(v));
|
|
7485
|
+
console.error("Morph states mismatch: " + this.stringify(morph0) + ", " + this.stringify(morph1) + ", " + this.stringify(v) + ".");
|
|
7476
7486
|
}
|
|
7477
7487
|
}
|
|
7478
7488
|
if (!this.checkBooleanUndef(v.hide)) {
|
|
7479
|
-
console.error("Invalid mesh hide " + v.hide + ", " + this.stringify(v));
|
|
7489
|
+
console.error("Invalid mesh hide " + v.hide + ", " + this.stringify(v) + ".");
|
|
7480
7490
|
}
|
|
7481
7491
|
};
|
|
7482
7492
|
/**
|
|
@@ -7484,22 +7494,22 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7484
7494
|
* @param v - Model 插件相机参数
|
|
7485
7495
|
*/ CheckerHelper.assertModelCameraOptions = function assertModelCameraOptions(v) {
|
|
7486
7496
|
if (!this.checkParent(v.parent)) {
|
|
7487
|
-
console.error("Invalid camera parent " + v.parent + ", " + this.stringify(v));
|
|
7497
|
+
console.error("Invalid camera parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7488
7498
|
}
|
|
7489
7499
|
if (!this.checkNumberUndef(v.aspect)) {
|
|
7490
|
-
console.error("Invalid camera aspect " + v.aspect + ", " + this.stringify(v));
|
|
7500
|
+
console.error("Invalid camera aspect " + v.aspect + ", " + this.stringify(v) + ".");
|
|
7491
7501
|
}
|
|
7492
7502
|
if (!this.checkPositive(v.near)) {
|
|
7493
|
-
console.error("Invalid camera near " + v.near + ", " + this.stringify(v));
|
|
7503
|
+
console.error("Invalid camera near " + v.near + ", " + this.stringify(v) + ".");
|
|
7494
7504
|
}
|
|
7495
7505
|
if (!this.checkPositive(v.far) || v.far <= v.near) {
|
|
7496
|
-
console.error("Invalid camera far " + v.far + ", " + this.stringify(v));
|
|
7506
|
+
console.error("Invalid camera far " + v.far + ", " + this.stringify(v) + ".");
|
|
7497
7507
|
}
|
|
7498
7508
|
if (!this.checkPositive(v.fov)) {
|
|
7499
|
-
console.error("Invalid camera fov " + v.fov + ", " + this.stringify(v));
|
|
7509
|
+
console.error("Invalid camera fov " + v.fov + ", " + this.stringify(v) + ".");
|
|
7500
7510
|
}
|
|
7501
7511
|
if (!this.checkNumber01(v.clipMode)) {
|
|
7502
|
-
console.error("Invalid camera clipMode " + v.clipMode + ", " + this.stringify(v));
|
|
7512
|
+
console.error("Invalid camera clipMode " + v.clipMode + ", " + this.stringify(v) + ".");
|
|
7503
7513
|
}
|
|
7504
7514
|
};
|
|
7505
7515
|
/**
|
|
@@ -7508,58 +7518,58 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7508
7518
|
*/ CheckerHelper.assertModelLightOptions = function assertModelLightOptions(v) {
|
|
7509
7519
|
if (v.lightType === "directional") {
|
|
7510
7520
|
if (!this.checkParent(v.parent)) {
|
|
7511
|
-
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
|
|
7521
|
+
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7512
7522
|
}
|
|
7513
7523
|
if (!this.checkNonnegative4(v.color)) {
|
|
7514
|
-
console.error("Invalid light color " + v.color + ", " + this.stringify(v));
|
|
7524
|
+
console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
|
|
7515
7525
|
}
|
|
7516
7526
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7517
|
-
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
|
|
7527
|
+
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7518
7528
|
}
|
|
7519
7529
|
} else if (v.lightType === "point") {
|
|
7520
7530
|
if (!this.checkParent(v.parent)) {
|
|
7521
|
-
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
|
|
7531
|
+
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7522
7532
|
}
|
|
7523
7533
|
if (!this.checkNonnegative4(v.color)) {
|
|
7524
|
-
console.error("Invalid light color " + v.color + ", " + this.stringify(v));
|
|
7534
|
+
console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
|
|
7525
7535
|
}
|
|
7526
7536
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7527
|
-
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
|
|
7537
|
+
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7528
7538
|
}
|
|
7529
7539
|
if (!this.checkNonnegative(v.range)) {
|
|
7530
|
-
console.error("Invalid light range " + v.range + ", " + this.stringify(v));
|
|
7540
|
+
console.error("Invalid light range " + v.range + ", " + this.stringify(v) + ".");
|
|
7531
7541
|
}
|
|
7532
7542
|
} else if (v.lightType === "spot") {
|
|
7533
7543
|
if (!this.checkParent(v.parent)) {
|
|
7534
|
-
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
|
|
7544
|
+
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7535
7545
|
}
|
|
7536
7546
|
if (!this.checkNonnegative4(v.color)) {
|
|
7537
|
-
console.error("Invalid light color " + v.color + ", " + this.stringify(v));
|
|
7547
|
+
console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
|
|
7538
7548
|
}
|
|
7539
7549
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7540
|
-
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
|
|
7550
|
+
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7541
7551
|
}
|
|
7542
7552
|
if (!this.checkNonnegative(v.range)) {
|
|
7543
|
-
console.error("Invalid light range " + v.range + ", " + this.stringify(v));
|
|
7553
|
+
console.error("Invalid light range " + v.range + ", " + this.stringify(v) + ".");
|
|
7544
7554
|
}
|
|
7545
7555
|
if (!this.checkNonnegative(v.innerConeAngle)) {
|
|
7546
|
-
console.error("Invalid light innerConeAngle " + v.innerConeAngle + ", " + this.stringify(v));
|
|
7556
|
+
console.error("Invalid light innerConeAngle " + v.innerConeAngle + ", " + this.stringify(v) + ".");
|
|
7547
7557
|
}
|
|
7548
7558
|
if (!this.checkNonnegative(v.outerConeAngle)) {
|
|
7549
|
-
console.error("Invalid light outerConeAngle " + v.outerConeAngle + ", " + this.stringify(v));
|
|
7559
|
+
console.error("Invalid light outerConeAngle " + v.outerConeAngle + ", " + this.stringify(v) + ".");
|
|
7550
7560
|
}
|
|
7551
7561
|
} else if (v.lightType === "ambient") {
|
|
7552
7562
|
if (!this.checkParent(v.parent)) {
|
|
7553
|
-
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v));
|
|
7563
|
+
console.error("Invalid light parent " + v.parent + ", " + this.stringify(v) + ".");
|
|
7554
7564
|
}
|
|
7555
7565
|
if (!this.checkNonnegative4(v.color)) {
|
|
7556
|
-
console.error("Invalid light color " + v.color + ", " + this.stringify(v));
|
|
7566
|
+
console.error("Invalid light color " + v.color + ", " + this.stringify(v) + ".");
|
|
7557
7567
|
}
|
|
7558
7568
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7559
|
-
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v));
|
|
7569
|
+
console.error("Invalid light intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7560
7570
|
}
|
|
7561
7571
|
} else {
|
|
7562
|
-
console.error("Invalid light type " + this.stringify(v));
|
|
7572
|
+
console.error("Invalid light type " + this.stringify(v) + ".");
|
|
7563
7573
|
}
|
|
7564
7574
|
};
|
|
7565
7575
|
/**
|
|
@@ -7568,43 +7578,43 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7568
7578
|
*/ CheckerHelper.assertModelSkyboxOptions = function assertModelSkyboxOptions(v) {
|
|
7569
7579
|
var _this = this;
|
|
7570
7580
|
if (!this.checkBoolean(v.renderable)) {
|
|
7571
|
-
console.error("Invalid skybox renderable " + v.renderable + ", " + this.stringify(v));
|
|
7581
|
+
console.error("Invalid skybox renderable " + v.renderable + ", " + this.stringify(v) + ".");
|
|
7572
7582
|
}
|
|
7573
7583
|
if (!this.checkNonnegative(v.intensity)) {
|
|
7574
|
-
console.error("Invalid skybox intensity " + v.intensity + ", " + this.stringify(v));
|
|
7584
|
+
console.error("Invalid skybox intensity " + v.intensity + ", " + this.stringify(v) + ".");
|
|
7575
7585
|
}
|
|
7576
7586
|
if (!this.checkNonnegative(v.reflectionsIntensity)) {
|
|
7577
|
-
console.error("Invalid skybox reflectionsIntensity " + v.reflectionsIntensity + ", " + this.stringify(v));
|
|
7587
|
+
console.error("Invalid skybox reflectionsIntensity " + v.reflectionsIntensity + ", " + this.stringify(v) + ".");
|
|
7578
7588
|
}
|
|
7579
7589
|
//
|
|
7580
7590
|
var c = v.irradianceCoeffs;
|
|
7581
7591
|
if (c !== undefined) {
|
|
7582
7592
|
if (!Array.isArray(c) || c.length != 9) {
|
|
7583
|
-
console.error("Invalid skybox irradianceCoeffs " + c + ", " + this.stringify(v));
|
|
7593
|
+
console.error("Invalid skybox irradianceCoeffs " + c + ", " + this.stringify(v) + ".");
|
|
7584
7594
|
}
|
|
7585
7595
|
c.forEach(function(v) {
|
|
7586
7596
|
if (!_this.checkVec3(v)) {
|
|
7587
|
-
console.error("Invalid skybox irradianceCoeffs " + c + ", " + _this.stringify(v));
|
|
7597
|
+
console.error("Invalid skybox irradianceCoeffs " + c + ", " + _this.stringify(v) + ".");
|
|
7588
7598
|
}
|
|
7589
7599
|
});
|
|
7590
7600
|
} else if (v.diffuseImage !== undefined) {
|
|
7591
7601
|
if (!this.checkTexture(v.diffuseImage)) {
|
|
7592
|
-
console.error("Invalid skybox diffuseImage " + v.diffuseImage + ", " + this.stringify(v));
|
|
7602
|
+
console.error("Invalid skybox diffuseImage " + v.diffuseImage + ", " + this.stringify(v) + ".");
|
|
7593
7603
|
}
|
|
7594
7604
|
} else {
|
|
7595
|
-
console.error("Invalid skybox, irradianceCoeffs or diffuseImage should give one, " + this.stringify(v));
|
|
7605
|
+
console.error("Invalid skybox, irradianceCoeffs or diffuseImage should give one, " + this.stringify(v) + ".");
|
|
7596
7606
|
}
|
|
7597
7607
|
if (!this.checkTexture(v.specularImage)) {
|
|
7598
|
-
console.error("Invalid skybox specularImage " + v.specularImage + ", " + this.stringify(v));
|
|
7608
|
+
console.error("Invalid skybox specularImage " + v.specularImage + ", " + this.stringify(v) + ".");
|
|
7599
7609
|
}
|
|
7600
7610
|
if (!this.checkPositive(v.specularImageSize)) {
|
|
7601
|
-
console.error("Invalid skybox specularImageSize " + v.specularImageSize + ", " + this.stringify(v));
|
|
7611
|
+
console.error("Invalid skybox specularImageSize " + v.specularImageSize + ", " + this.stringify(v) + ".");
|
|
7602
7612
|
}
|
|
7603
7613
|
if (!this.checkPositive(v.specularMipCount)) {
|
|
7604
|
-
console.error("Invalid skybox specularMipCount " + v.specularMipCount + ", " + this.stringify(v));
|
|
7614
|
+
console.error("Invalid skybox specularMipCount " + v.specularMipCount + ", " + this.stringify(v) + ".");
|
|
7605
7615
|
}
|
|
7606
7616
|
if (this.pow2(v.specularMipCount) > v.specularImageSize) {
|
|
7607
|
-
console.error("Invalid skybox specularMipCount or specularImageSize, " + this.stringify(v));
|
|
7617
|
+
console.error("Invalid skybox specularMipCount or specularImageSize, " + this.stringify(v) + ".");
|
|
7608
7618
|
}
|
|
7609
7619
|
};
|
|
7610
7620
|
/**
|
|
@@ -7640,14 +7650,14 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7640
7650
|
*/ CheckerHelper.assertModelAnimOptions = function assertModelAnimOptions(v) {
|
|
7641
7651
|
var _this = this;
|
|
7642
7652
|
if (!this.checkStringUndef(v.name)) {
|
|
7643
|
-
console.error("Invalid animation name " + v.name + ", " + this.stringify(v));
|
|
7653
|
+
console.error("Invalid animation name " + v.name + ", " + this.stringify(v) + ".");
|
|
7644
7654
|
}
|
|
7645
7655
|
if (!Array.isArray(v.tracks)) {
|
|
7646
|
-
console.error("Invalid animation tracks " + v.tracks + ", " + this.stringify(v));
|
|
7656
|
+
console.error("Invalid animation tracks " + v.tracks + ", " + this.stringify(v) + ".");
|
|
7647
7657
|
}
|
|
7648
7658
|
v.tracks.forEach(function(t) {
|
|
7649
7659
|
if (!_this.checkModelAnimTrackOptions(t)) {
|
|
7650
|
-
console.error("Invalid animation track " + t + ", " + _this.stringify(v));
|
|
7660
|
+
console.error("Invalid animation track " + t + ", " + _this.stringify(v) + ".");
|
|
7651
7661
|
}
|
|
7652
7662
|
});
|
|
7653
7663
|
};
|
|
@@ -7657,18 +7667,18 @@ var AttributeArray = /*#__PURE__*/ function() {
|
|
|
7657
7667
|
*/ CheckerHelper.assertTreeOptions = function assertTreeOptions(v) {
|
|
7658
7668
|
var _this = this;
|
|
7659
7669
|
if (!this.checkNumberUndef(v.animation)) {
|
|
7660
|
-
console.error("Invalid tree animation " + v.animation + ", " + this.stringify(v));
|
|
7670
|
+
console.error("Invalid tree animation " + v.animation + ", " + this.stringify(v) + ".");
|
|
7661
7671
|
}
|
|
7662
7672
|
if (v.animations !== undefined) {
|
|
7663
7673
|
if (!Array.isArray(v.animations)) {
|
|
7664
|
-
console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v));
|
|
7674
|
+
console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v) + ".");
|
|
7665
7675
|
}
|
|
7666
7676
|
v.animations.forEach(function(anim) {
|
|
7667
7677
|
_this.assertModelAnimOptions(anim);
|
|
7668
7678
|
});
|
|
7669
7679
|
if (v.animation !== undefined) {
|
|
7670
7680
|
if (v.animation < -1 || v.animation >= v.animations.length) {
|
|
7671
|
-
console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v));
|
|
7681
|
+
console.error("Invalid tree animations " + v.animations + ", " + this.stringify(v) + ".");
|
|
7672
7682
|
}
|
|
7673
7683
|
}
|
|
7674
7684
|
}
|
|
@@ -7780,18 +7790,6 @@ var toHalf = function() {
|
|
|
7780
7790
|
};
|
|
7781
7791
|
}();
|
|
7782
7792
|
|
|
7783
|
-
var RenderType;
|
|
7784
|
-
(function(RenderType) {
|
|
7785
|
-
RenderType["Opaque"] = "Opaque";
|
|
7786
|
-
RenderType["Mask"] = "Mask";
|
|
7787
|
-
RenderType["Blend"] = "Blend";
|
|
7788
|
-
})(RenderType || (RenderType = {}));
|
|
7789
|
-
var CullMode;
|
|
7790
|
-
(function(CullMode) {
|
|
7791
|
-
CullMode["Front"] = "Front";
|
|
7792
|
-
CullMode["Back"] = "Back";
|
|
7793
|
-
CullMode["Double"] = "Double";
|
|
7794
|
-
})(CullMode || (CullMode = {}));
|
|
7795
7793
|
/**
|
|
7796
7794
|
* 3D 材质基础类,支持公共的材质功能
|
|
7797
7795
|
*/ var PMaterialBase = /*#__PURE__*/ function(PObject) {
|
|
@@ -7816,13 +7814,16 @@ var CullMode;
|
|
|
7816
7814
|
*/ _this.ZTest = true;
|
|
7817
7815
|
/**
|
|
7818
7816
|
* 渲染类型,默认是不透明
|
|
7819
|
-
*/ _this.renderType =
|
|
7817
|
+
*/ _this.renderType = spec.RenderType.Opaque;
|
|
7818
|
+
/**
|
|
7819
|
+
* 是否 Alpha 裁剪,默认关闭
|
|
7820
|
+
*/ _this.alphaClip = false;
|
|
7820
7821
|
/**
|
|
7821
7822
|
* Alpha 测试截断值
|
|
7822
|
-
*/ _this.
|
|
7823
|
+
*/ _this.alphaCutoff = 0.5;
|
|
7823
7824
|
/**
|
|
7824
7825
|
* 面侧模式,默认是正面
|
|
7825
|
-
*/ _this.
|
|
7826
|
+
*/ _this.renderFace = spec.RenderFace.Front;
|
|
7826
7827
|
return _this;
|
|
7827
7828
|
}
|
|
7828
7829
|
var _proto = PMaterialBase.prototype;
|
|
@@ -7831,28 +7832,28 @@ var CullMode;
|
|
|
7831
7832
|
* @returns 特性列表
|
|
7832
7833
|
*/ _proto.getShaderFeatures = function getShaderFeatures() {
|
|
7833
7834
|
var featureList = [];
|
|
7834
|
-
if (this.
|
|
7835
|
-
featureList.push("ALPHAMODE_OPAQUE 1");
|
|
7836
|
-
} else if (this.isMasked()) {
|
|
7835
|
+
if (this.isAlphaClip()) {
|
|
7837
7836
|
featureList.push("ALPHAMODE_MASK 1");
|
|
7837
|
+
} else if (this.isOpaque()) {
|
|
7838
|
+
featureList.push("ALPHAMODE_OPAQUE 1");
|
|
7838
7839
|
}
|
|
7839
|
-
if (this.
|
|
7840
|
+
if (this.renderFace === spec.RenderFace.Both) {
|
|
7840
7841
|
featureList.push("DOUBLE_SIDED 1");
|
|
7841
7842
|
}
|
|
7842
7843
|
return featureList;
|
|
7843
7844
|
};
|
|
7844
7845
|
_proto.getShaderMacros = function getShaderMacros() {
|
|
7845
7846
|
var macroList = [];
|
|
7846
|
-
if (this.
|
|
7847
|
+
if (this.isAlphaClip()) {
|
|
7847
7848
|
macroList.push({
|
|
7848
|
-
name: "
|
|
7849
|
+
name: "ALPHAMODE_MASK"
|
|
7849
7850
|
});
|
|
7850
|
-
} else if (this.
|
|
7851
|
+
} else if (this.isOpaque()) {
|
|
7851
7852
|
macroList.push({
|
|
7852
|
-
name: "
|
|
7853
|
+
name: "ALPHAMODE_OPAQUE"
|
|
7853
7854
|
});
|
|
7854
7855
|
}
|
|
7855
|
-
if (this.
|
|
7856
|
+
if (this.renderFace === spec.RenderFace.Both) {
|
|
7856
7857
|
macroList.push({
|
|
7857
7858
|
name: "DOUBLE_SIDED"
|
|
7858
7859
|
});
|
|
@@ -7935,7 +7936,7 @@ var CullMode;
|
|
|
7935
7936
|
* 设置材质状态,根据 GE 材质状态
|
|
7936
7937
|
* @param material - GE 材质
|
|
7937
7938
|
*/ _proto.setMaterialStates = function setMaterialStates(material) {
|
|
7938
|
-
if (this.renderType ===
|
|
7939
|
+
if (this.renderType === spec.RenderType.Transparent) {
|
|
7939
7940
|
material.blending = true;
|
|
7940
7941
|
material.depthTest = this.ZTest;
|
|
7941
7942
|
material.depthMask = this.ZWrite;
|
|
@@ -7964,7 +7965,7 @@ var CullMode;
|
|
|
7964
7965
|
this.setFaceSideStates(material);
|
|
7965
7966
|
};
|
|
7966
7967
|
_proto.setFaceSideStates = function setFaceSideStates(material) {
|
|
7967
|
-
if (this.
|
|
7968
|
+
if (this.isBothSide()) {
|
|
7968
7969
|
material.culling = false;
|
|
7969
7970
|
} else if (this.isBackSide()) {
|
|
7970
7971
|
material.cullFace = glContext.FRONT;
|
|
@@ -7992,37 +7993,37 @@ var CullMode;
|
|
|
7992
7993
|
* 是否不透明
|
|
7993
7994
|
* @returns
|
|
7994
7995
|
*/ _proto.isOpaque = function isOpaque() {
|
|
7995
|
-
return this.renderType ===
|
|
7996
|
+
return this.renderType === spec.RenderType.Opaque;
|
|
7996
7997
|
};
|
|
7997
7998
|
/**
|
|
7998
|
-
*
|
|
7999
|
+
* 是否 Alpha 裁剪
|
|
7999
8000
|
* @returns
|
|
8000
|
-
*/ _proto.
|
|
8001
|
-
return this.
|
|
8001
|
+
*/ _proto.isAlphaClip = function isAlphaClip() {
|
|
8002
|
+
return this.alphaClip;
|
|
8002
8003
|
};
|
|
8003
8004
|
/**
|
|
8004
8005
|
* 是否半透明
|
|
8005
8006
|
* @returns
|
|
8006
|
-
*/ _proto.
|
|
8007
|
-
return this.renderType ===
|
|
8007
|
+
*/ _proto.isTransparent = function isTransparent() {
|
|
8008
|
+
return this.renderType === spec.RenderType.Transparent;
|
|
8008
8009
|
};
|
|
8009
8010
|
/**
|
|
8010
8011
|
* 是否正面模式
|
|
8011
8012
|
* @returns
|
|
8012
8013
|
*/ _proto.isFrontSide = function isFrontSide() {
|
|
8013
|
-
return this.
|
|
8014
|
+
return this.renderFace === spec.RenderFace.Front;
|
|
8014
8015
|
};
|
|
8015
8016
|
/**
|
|
8016
8017
|
* 是否背面模式
|
|
8017
8018
|
* @returns
|
|
8018
8019
|
*/ _proto.isBackSide = function isBackSide() {
|
|
8019
|
-
return this.
|
|
8020
|
+
return this.renderFace === spec.RenderFace.Back;
|
|
8020
8021
|
};
|
|
8021
8022
|
/**
|
|
8022
8023
|
* 是否双面模式
|
|
8023
8024
|
* @returns
|
|
8024
|
-
*/ _proto.
|
|
8025
|
-
return this.
|
|
8025
|
+
*/ _proto.isBothSide = function isBothSide() {
|
|
8026
|
+
return this.renderFace === spec.RenderFace.Both;
|
|
8026
8027
|
};
|
|
8027
8028
|
return PMaterialBase;
|
|
8028
8029
|
}(PObject);
|
|
@@ -8054,14 +8055,15 @@ var CullMode;
|
|
|
8054
8055
|
var _material_getColor;
|
|
8055
8056
|
this.baseColorFactor = (_material_getColor = material.getColor("_BaseColorFactor")) != null ? _material_getColor : new Color(1.0, 1.0, 1.0, 1.0);
|
|
8056
8057
|
//
|
|
8057
|
-
this.ZWrite = material.
|
|
8058
|
-
this.ZTest = material.
|
|
8058
|
+
this.ZWrite = material.getFloat("ZWrite") !== 0;
|
|
8059
|
+
this.ZTest = material.getFloat("ZTest") !== 0;
|
|
8059
8060
|
var _material_stringTags_RenderType;
|
|
8060
|
-
this.renderType = (_material_stringTags_RenderType = material.stringTags["RenderType"]) != null ? _material_stringTags_RenderType :
|
|
8061
|
+
this.renderType = (_material_stringTags_RenderType = material.stringTags["RenderType"]) != null ? _material_stringTags_RenderType : spec.RenderType.Opaque;
|
|
8062
|
+
this.alphaClip = material.getFloat("AlphaClip") === 1;
|
|
8061
8063
|
var _material_getFloat;
|
|
8062
|
-
this.
|
|
8063
|
-
var
|
|
8064
|
-
this.
|
|
8064
|
+
this.alphaCutoff = (_material_getFloat = material.getFloat("_AlphaCutoff")) != null ? _material_getFloat : 0;
|
|
8065
|
+
var _material_stringTags_RenderFace;
|
|
8066
|
+
this.renderFace = (_material_stringTags_RenderFace = material.stringTags["RenderFace"]) != null ? _material_stringTags_RenderFace : spec.RenderFace.Front;
|
|
8065
8067
|
};
|
|
8066
8068
|
/**
|
|
8067
8069
|
* 销毁材质
|
|
@@ -8229,14 +8231,15 @@ var CullMode;
|
|
|
8229
8231
|
var _material_getFloat4;
|
|
8230
8232
|
this.emissiveIntensity = (_material_getFloat4 = material.getFloat("_EmissiveIntensity")) != null ? _material_getFloat4 : 1;
|
|
8231
8233
|
//
|
|
8232
|
-
this.ZWrite = material.
|
|
8233
|
-
this.ZTest = material.
|
|
8234
|
+
this.ZWrite = material.getFloat("ZWrite") !== 0;
|
|
8235
|
+
this.ZTest = material.getFloat("ZTest") !== 0;
|
|
8234
8236
|
var _material_stringTags_RenderType;
|
|
8235
|
-
this.renderType = (_material_stringTags_RenderType = material.stringTags["RenderType"]) != null ? _material_stringTags_RenderType :
|
|
8237
|
+
this.renderType = (_material_stringTags_RenderType = material.stringTags["RenderType"]) != null ? _material_stringTags_RenderType : spec.RenderType.Opaque;
|
|
8238
|
+
this.alphaClip = material.getFloat("AlphaClip") === 1;
|
|
8236
8239
|
var _material_getFloat5;
|
|
8237
|
-
this.
|
|
8238
|
-
var
|
|
8239
|
-
this.
|
|
8240
|
+
this.alphaCutoff = (_material_getFloat5 = material.getFloat("_AlphaCutoff")) != null ? _material_getFloat5 : 0;
|
|
8241
|
+
var _material_stringTags_RenderFace;
|
|
8242
|
+
this.renderFace = (_material_stringTags_RenderFace = material.stringTags["RenderFace"]) != null ? _material_stringTags_RenderFace : spec.RenderFace.Front;
|
|
8240
8243
|
};
|
|
8241
8244
|
/**
|
|
8242
8245
|
* 销毁材质
|
|
@@ -8683,7 +8686,7 @@ var CullMode;
|
|
|
8683
8686
|
if (this.irradianceCoeffs === undefined && this.diffuseImage === undefined) {
|
|
8684
8687
|
return false;
|
|
8685
8688
|
}
|
|
8686
|
-
return this.specularImage !== undefined && this.specularMipCount
|
|
8689
|
+
return this.specularImage !== undefined && this.specularMipCount >= 0;
|
|
8687
8690
|
}
|
|
8688
8691
|
},
|
|
8689
8692
|
{
|
|
@@ -8793,7 +8796,7 @@ var CullMode;
|
|
|
8793
8796
|
} else {
|
|
8794
8797
|
var coeffs = this.irradianceCoeffs;
|
|
8795
8798
|
if (coeffs === undefined || coeffs.length != 9) {
|
|
8796
|
-
throw new Error("Invalid skybox irradiance coeffs " + coeffs);
|
|
8799
|
+
throw new Error("Invalid skybox irradiance coeffs " + coeffs + ".");
|
|
8797
8800
|
}
|
|
8798
8801
|
var aliasName = [
|
|
8799
8802
|
"l00",
|
|
@@ -8810,7 +8813,7 @@ var CullMode;
|
|
|
8810
8813
|
material.setVector3("_shCoefficients." + n, Vector3.fromArray(coeffs[i]));
|
|
8811
8814
|
});
|
|
8812
8815
|
}
|
|
8813
|
-
material.setInt("_MipCount", this.specularMipCount);
|
|
8816
|
+
material.setInt("_MipCount", this.specularMipCount - 1);
|
|
8814
8817
|
material.setTexture("_SpecularEnvSampler", this.specularImage);
|
|
8815
8818
|
};
|
|
8816
8819
|
/**
|
|
@@ -8856,11 +8859,11 @@ var PSkyboxType;
|
|
|
8856
8859
|
if (i > 0) {
|
|
8857
8860
|
if (i % 6 === 0) {
|
|
8858
8861
|
if (image.width * 2 !== lastImage.width || image.height * 2 !== lastImage.height) {
|
|
8859
|
-
throw new Error("Invalid cube map list1: index " + i + ", image0 " + lastImage + ", image1 " + image);
|
|
8862
|
+
throw new Error("Invalid cube map list1: index " + i + ", image0 " + lastImage + ", image1 " + image + ".");
|
|
8860
8863
|
}
|
|
8861
8864
|
} else {
|
|
8862
8865
|
if (image.width !== lastImage.width || image.height !== lastImage.height) {
|
|
8863
|
-
throw new Error("Invalid cube map list2: index " + i + ", image0 " + lastImage + ", image1 " + image);
|
|
8866
|
+
throw new Error("Invalid cube map list2: index " + i + ", image0 " + lastImage + ", image1 " + image + ".");
|
|
8864
8867
|
}
|
|
8865
8868
|
}
|
|
8866
8869
|
}
|
|
@@ -9176,7 +9179,7 @@ var PSkyboxType;
|
|
|
9176
9179
|
diffuseImage: this.getDiffuseImageList(skyboxType, specularImage),
|
|
9177
9180
|
specularImage: specularImage,
|
|
9178
9181
|
specularImageSize: Math.pow(2, specularImage.length - 1),
|
|
9179
|
-
specularMipCount: specularImage.length
|
|
9182
|
+
specularMipCount: specularImage.length
|
|
9180
9183
|
};
|
|
9181
9184
|
return params;
|
|
9182
9185
|
};
|
|
@@ -9394,7 +9397,7 @@ var PSkyboxType;
|
|
|
9394
9397
|
this.loadSkybox = loadSkybox;
|
|
9395
9398
|
if (this.brdfLutTexture === undefined || this.brdfLutTexture.isDestroyed) {
|
|
9396
9399
|
if (CompositionCache.brdfLutTexOptions === undefined) {
|
|
9397
|
-
throw new Error("Please load brdfLutTexOptions at first");
|
|
9400
|
+
throw new Error("Please load brdfLutTexOptions at first.");
|
|
9398
9401
|
}
|
|
9399
9402
|
//
|
|
9400
9403
|
var brdfLutTextureName = "brdfLutTexture";
|
|
@@ -9803,8 +9806,8 @@ var ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
9803
9806
|
var newPosition = invWorldMatrix.transformPoint(position);
|
|
9804
9807
|
component.setTransform(newPosition);
|
|
9805
9808
|
// 正式版本不会走到这个流程,只在测试时使用
|
|
9806
|
-
console.info("Scene AABB [" + sceneAABB.min.toArray() + "], [" + sceneAABB.max.toArray() + "]");
|
|
9807
|
-
console.info("Update camera position [" + newPosition.toArray() + "]");
|
|
9809
|
+
console.info("Scene AABB [" + sceneAABB.min.toArray() + "], [" + sceneAABB.max.toArray() + "].");
|
|
9810
|
+
console.info("Update camera position [" + newPosition.toArray() + "].");
|
|
9808
9811
|
}
|
|
9809
9812
|
}
|
|
9810
9813
|
});
|
|
@@ -10154,7 +10157,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10154
10157
|
// can't find camera item, throw error message
|
|
10155
10158
|
var item = this.getItem();
|
|
10156
10159
|
if (item === undefined) {
|
|
10157
|
-
console.warn("
|
|
10160
|
+
console.warn("[CameraGestureHandlerImp] Unable to locate camera item with ID: " + this.startParams.target + ".");
|
|
10158
10161
|
return this.composition.camera.getOptions();
|
|
10159
10162
|
}
|
|
10160
10163
|
var camera = this.composition.camera;
|
|
@@ -10325,7 +10328,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10325
10328
|
this.startParams.type = CameraGestureType.none;
|
|
10326
10329
|
var item = this.getItem();
|
|
10327
10330
|
if (item === undefined) {
|
|
10328
|
-
console.warn("
|
|
10331
|
+
console.warn("[CameraGestureHandlerImp] Can't find camera item.");
|
|
10329
10332
|
return;
|
|
10330
10333
|
}
|
|
10331
10334
|
this.setPosition(item, position);
|
|
@@ -10335,7 +10338,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10335
10338
|
this.startParams.type = CameraGestureType.none;
|
|
10336
10339
|
var item = this.getItem();
|
|
10337
10340
|
if (item === undefined) {
|
|
10338
|
-
console.warn("
|
|
10341
|
+
console.warn("[CameraGestureHandlerImp] Can't find camera item.");
|
|
10339
10342
|
return;
|
|
10340
10343
|
}
|
|
10341
10344
|
this.setQuaternion(item, quat);
|
|
@@ -10345,7 +10348,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10345
10348
|
this.startParams.type = CameraGestureType.none;
|
|
10346
10349
|
var item = this.getItem();
|
|
10347
10350
|
if (item === undefined) {
|
|
10348
|
-
console.warn("
|
|
10351
|
+
console.warn("[CameraGestureHandlerImp] Can't find camera item.");
|
|
10349
10352
|
return;
|
|
10350
10353
|
}
|
|
10351
10354
|
var newDistance = distance != null ? distance : 5;
|
|
@@ -10402,7 +10405,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10402
10405
|
this.startParams = args;
|
|
10403
10406
|
this.updateCameraTransform(this.composition.camera.getOptions());
|
|
10404
10407
|
if (!this.getItem()) {
|
|
10405
|
-
console.warn("
|
|
10408
|
+
console.warn("[CameraGestureHandlerImp] Invalid target specified in startGesture.");
|
|
10406
10409
|
}
|
|
10407
10410
|
return this.composition.camera.getOptions();
|
|
10408
10411
|
};
|
|
@@ -10410,7 +10413,7 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10410
10413
|
if (this.getCurrentType() === arg.type) {
|
|
10411
10414
|
var item = this.getItem();
|
|
10412
10415
|
if (item === undefined) {
|
|
10413
|
-
console.warn("
|
|
10416
|
+
console.warn("[CameraGestureHandlerImp] Can't find camera item.");
|
|
10414
10417
|
return this.composition.camera.getOptions();
|
|
10415
10418
|
}
|
|
10416
10419
|
var _arg_speed;
|
|
@@ -10464,10 +10467,10 @@ var CameraGestureHandlerImp = /*#__PURE__*/ function() {
|
|
|
10464
10467
|
item.transform.setQuaternion(newRotation1.x, newRotation1.y, newRotation1.z, newRotation1.w);
|
|
10465
10468
|
this.setTransform(item, newPosition, item.transform.rotation);
|
|
10466
10469
|
} else {
|
|
10467
|
-
console.warn("not
|
|
10470
|
+
console.warn("[CameraGestureHandlerImp] Movement type not implemented.");
|
|
10468
10471
|
}
|
|
10469
10472
|
} else {
|
|
10470
|
-
console.warn("
|
|
10473
|
+
console.warn("[CameraGestureHandlerImp] Invalid move type specified: " + arg.type);
|
|
10471
10474
|
}
|
|
10472
10475
|
return this.composition.camera.getOptions();
|
|
10473
10476
|
};
|
|
@@ -10736,7 +10739,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10736
10739
|
var nodeList = scene.nodes.map(function(node, nodeIndex) {
|
|
10737
10740
|
var children = node.children.map(function(child) {
|
|
10738
10741
|
if (child.nodeIndex === undefined) {
|
|
10739
|
-
throw new Error("Undefined nodeIndex for child " + child);
|
|
10742
|
+
throw new Error("Undefined nodeIndex for child " + child + ".");
|
|
10740
10743
|
}
|
|
10741
10744
|
return child.nodeIndex;
|
|
10742
10745
|
});
|
|
@@ -10745,7 +10748,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10745
10748
|
var scale;
|
|
10746
10749
|
if (node.matrix !== undefined) {
|
|
10747
10750
|
if (node.matrix.length !== 16) {
|
|
10748
|
-
throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node);
|
|
10751
|
+
throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node + ".");
|
|
10749
10752
|
}
|
|
10750
10753
|
var mat = Matrix4.fromArray(node.matrix);
|
|
10751
10754
|
var transform = mat.getTransform();
|
|
@@ -10778,7 +10781,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10778
10781
|
});
|
|
10779
10782
|
var rootNodes = scene.rootNodes.map(function(root) {
|
|
10780
10783
|
if (root.nodeIndex === undefined) {
|
|
10781
|
-
throw new Error("Undefined nodeIndex for root " + root);
|
|
10784
|
+
throw new Error("Undefined nodeIndex for root " + root + ".");
|
|
10782
10785
|
}
|
|
10783
10786
|
return root.nodeIndex;
|
|
10784
10787
|
});
|
|
@@ -10823,18 +10826,18 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10823
10826
|
_proto.createTextureCube = function createTextureCube(cubeImages, level0Size) {
|
|
10824
10827
|
var _this = this;
|
|
10825
10828
|
if (cubeImages.length == 0) {
|
|
10826
|
-
throw new Error("createTextureCube: Invalid cubeImages length " + cubeImages);
|
|
10829
|
+
throw new Error("createTextureCube: Invalid cubeImages length " + cubeImages + ".");
|
|
10827
10830
|
}
|
|
10828
10831
|
var mipmaps = [];
|
|
10829
10832
|
cubeImages.forEach(function(cubeImage) {
|
|
10830
10833
|
if (cubeImage.length != 6) {
|
|
10831
|
-
throw new Error("createTextureCube: cubeimage count should always be 6, " + cubeImage);
|
|
10834
|
+
throw new Error("createTextureCube: cubeimage count should always be 6, " + cubeImage + ".");
|
|
10832
10835
|
}
|
|
10833
10836
|
//
|
|
10834
10837
|
var imgList = [];
|
|
10835
10838
|
cubeImage.forEach(function(img) {
|
|
10836
10839
|
if (img.imageData === undefined) {
|
|
10837
|
-
throw new Error("createTextureCube: Invalid image data from " + img);
|
|
10840
|
+
throw new Error("createTextureCube: Invalid image data from " + img + ".");
|
|
10838
10841
|
}
|
|
10839
10842
|
//
|
|
10840
10843
|
imgList.push({
|
|
@@ -10885,9 +10888,9 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10885
10888
|
}
|
|
10886
10889
|
return newImages;
|
|
10887
10890
|
});
|
|
10888
|
-
var specularMipCount = specularImages.length
|
|
10891
|
+
var specularMipCount = specularImages.length;
|
|
10889
10892
|
var _ibl_specularImageSize;
|
|
10890
|
-
var specularImageSize = (_ibl_specularImageSize = ibl.specularImageSize) != null ? _ibl_specularImageSize : Math.pow(2, specularMipCount);
|
|
10893
|
+
var specularImageSize = (_ibl_specularImageSize = ibl.specularImageSize) != null ? _ibl_specularImageSize : Math.pow(2, specularMipCount - 1);
|
|
10891
10894
|
var params = {
|
|
10892
10895
|
type: "buffer",
|
|
10893
10896
|
renderable: this.isSkyboxVis(),
|
|
@@ -10902,7 +10905,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10902
10905
|
};
|
|
10903
10906
|
_proto.createDefaultSkybox = function createDefaultSkybox(typeName) {
|
|
10904
10907
|
if (typeName !== "NFT" && typeName !== "FARM") {
|
|
10905
|
-
throw new Error("Invalid skybox type
|
|
10908
|
+
throw new Error("Invalid skybox type specified: '" + typeName + "'. Valid types are: 'NFT', 'FARM'.");
|
|
10906
10909
|
}
|
|
10907
10910
|
//
|
|
10908
10911
|
var typ = typeName === "NFT" ? PSkyboxType.NFT : PSkyboxType.FARM;
|
|
@@ -10933,7 +10936,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
10933
10936
|
};
|
|
10934
10937
|
gltfResource = options.gltf.resource;
|
|
10935
10938
|
if (typeof gltfResource === "string" || _instanceof1(gltfResource, Uint8Array)) {
|
|
10936
|
-
throw new Error("Please load resource
|
|
10939
|
+
throw new Error("Please load the resource using GLTFTools first.");
|
|
10937
10940
|
}
|
|
10938
10941
|
_this._gltfScene = gltfResource.scenes[0];
|
|
10939
10942
|
_this._gltfSkins = _this._gltfScene.skins;
|
|
@@ -11144,7 +11147,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11144
11147
|
var texIndex = texInfo.index;
|
|
11145
11148
|
var tex = this.getTextureManager().getTexture(matIndex, texIndex, isBaseColor);
|
|
11146
11149
|
if (tex === undefined && noWarning !== true) {
|
|
11147
|
-
console.warn("Can't find texture for mat " + matIndex + ", tex " + JSON.stringify(texInfo) + ", basecolor " + isBaseColor);
|
|
11150
|
+
console.warn("Can't find texture for mat " + matIndex + ", tex " + JSON.stringify(texInfo) + ", basecolor " + isBaseColor + ".");
|
|
11148
11151
|
}
|
|
11149
11152
|
return tex;
|
|
11150
11153
|
};
|
|
@@ -11176,7 +11179,7 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
11176
11179
|
var _this = this;
|
|
11177
11180
|
var meshIndex = node.mesh;
|
|
11178
11181
|
if (meshIndex === undefined) {
|
|
11179
|
-
throw new Error("Invalid mesh index in node " + node);
|
|
11182
|
+
throw new Error("Invalid mesh index in node " + node + ".");
|
|
11180
11183
|
}
|
|
11181
11184
|
var skin;
|
|
11182
11185
|
if (node.skin !== undefined) {
|
|
@@ -11463,11 +11466,11 @@ var TextureManager = /*#__PURE__*/ function() {
|
|
|
11463
11466
|
this._textureMap.clear();
|
|
11464
11467
|
};
|
|
11465
11468
|
_proto.addTexture = function addTexture(matIndex, texIndex, tex, isBaseColor) {
|
|
11466
|
-
var index = isBaseColor ? matIndex * 100000 + texIndex : texIndex;
|
|
11469
|
+
var index = isBaseColor ? (matIndex + 1) * 100000 + texIndex : texIndex;
|
|
11467
11470
|
this._textureMap.set(index, tex);
|
|
11468
11471
|
};
|
|
11469
11472
|
_proto.getTexture = function getTexture(matIndex, texIndex, isBaseColor) {
|
|
11470
|
-
var index = isBaseColor ? matIndex * 100000 + texIndex : texIndex;
|
|
11473
|
+
var index = isBaseColor ? (matIndex + 1) * 100000 + texIndex : texIndex;
|
|
11471
11474
|
return this._textureMap.get(index);
|
|
11472
11475
|
};
|
|
11473
11476
|
return TextureManager;
|
|
@@ -11512,7 +11515,7 @@ var GeometryProxy = /*#__PURE__*/ function() {
|
|
|
11512
11515
|
var attrib = this.positionAttrib;
|
|
11513
11516
|
attributes["aPos"] = this._getBufferAttrib(attrib);
|
|
11514
11517
|
} else {
|
|
11515
|
-
throw new Error("Position attribute missing");
|
|
11518
|
+
throw new Error("Position attribute missing.");
|
|
11516
11519
|
}
|
|
11517
11520
|
if (this.hasNormal) {
|
|
11518
11521
|
var attrib1 = this.normalAttrib;
|
|
@@ -12226,7 +12229,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12226
12229
|
newComponents.push(this.createLightComponent(comp, newScene));
|
|
12227
12230
|
} else if (comp.dataType === spec.DataType.CameraComponent) {
|
|
12228
12231
|
newComponents.push(comp);
|
|
12229
|
-
console.warn("
|
|
12232
|
+
console.warn("Camera component found: " + comp + ".");
|
|
12230
12233
|
} else if (comp.dataType === spec.DataType.TreeComponent) {
|
|
12231
12234
|
var treeComp = comp;
|
|
12232
12235
|
this.createItemsFromTreeComponent(comp, newScene, oldScene);
|
|
@@ -12270,7 +12273,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12270
12273
|
2,
|
|
12271
12274
|
new Promise(function(resolve, reject) {
|
|
12272
12275
|
_this.downloader.downloadJSON(url, resolve, function(status, responseText) {
|
|
12273
|
-
reject(new Error("
|
|
12276
|
+
reject(new Error("Failed to load JSON from URL '" + url + "': status " + status + " - " + responseText + ". Please check the URL or network settings."));
|
|
12274
12277
|
});
|
|
12275
12278
|
})
|
|
12276
12279
|
];
|
|
@@ -12299,7 +12302,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12299
12302
|
_pointer_ = pointer[1], index = _pointer_[0], start = _pointer_[1], length = _pointer_[2];
|
|
12300
12303
|
bin = bins[index];
|
|
12301
12304
|
if (!bin) {
|
|
12302
|
-
throw new Error("
|
|
12305
|
+
throw new Error("Invalid bin pointer: " + JSON.stringify(pointer) + ".");
|
|
12303
12306
|
}
|
|
12304
12307
|
return [
|
|
12305
12308
|
2,
|
|
@@ -12341,7 +12344,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12341
12344
|
id: scene.textures[skyboxOptions.specularImage].id
|
|
12342
12345
|
},
|
|
12343
12346
|
specularImageSize: skyboxOptions.specularImageSize,
|
|
12344
|
-
specularMipCount: skyboxOptions.specularMipCount
|
|
12347
|
+
specularMipCount: skyboxOptions.specularMipCount + 1
|
|
12345
12348
|
};
|
|
12346
12349
|
return skyboxComponent;
|
|
12347
12350
|
};
|
|
@@ -12368,7 +12371,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12368
12371
|
});
|
|
12369
12372
|
var geometryData = getGeometryDataFromPropsList(geometryPropsList);
|
|
12370
12373
|
if (!geometryData) {
|
|
12371
|
-
throw new Error("
|
|
12374
|
+
throw new Error("No primitives available to process.");
|
|
12372
12375
|
}
|
|
12373
12376
|
newScene.geometries.push(geometryData);
|
|
12374
12377
|
(_newScene_materials = newScene.materials).push.apply(_newScene_materials, [].concat(materialDatas));
|
|
@@ -12395,12 +12398,12 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12395
12398
|
}
|
|
12396
12399
|
}
|
|
12397
12400
|
if (parentItemId === component.item.id) {
|
|
12398
|
-
throw new Error("Can't item " + component.item);
|
|
12401
|
+
throw new Error("Can't item " + component.item + ".");
|
|
12399
12402
|
}
|
|
12400
12403
|
var treeItem = this.treeInfo.getTreeItemByNodeId(parentItemId);
|
|
12401
12404
|
var treeNodeList = this.treeInfo.getTreeNodeListByNodeId(parentItemId);
|
|
12402
12405
|
if (!treeItem || !treeNodeList) {
|
|
12403
|
-
throw new Error("
|
|
12406
|
+
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.");
|
|
12404
12407
|
}
|
|
12405
12408
|
var rootBoneItem = this.setupBoneData(geometryData, meshOptions.skin, oldScene, treeItem, treeNodeList);
|
|
12406
12409
|
meshComponent.rootBone = {
|
|
@@ -12529,13 +12532,13 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12529
12532
|
var inputArray = typedArrayFromBinary(bins, track.input);
|
|
12530
12533
|
var outputArray = typedArrayFromBinary(bins, track.output);
|
|
12531
12534
|
if (!_instanceof1(inputArray, Float32Array)) {
|
|
12532
|
-
throw new Error("Type of inputArray should be float32, " + inputArray);
|
|
12535
|
+
throw new Error("Type of inputArray should be float32, " + inputArray + ".");
|
|
12533
12536
|
}
|
|
12534
12537
|
if (!_instanceof1(outputArray, Float32Array)) {
|
|
12535
|
-
throw new Error("Type of outputArray should be float32, " + outputArray);
|
|
12538
|
+
throw new Error("Type of outputArray should be float32, " + outputArray + ".");
|
|
12536
12539
|
}
|
|
12537
12540
|
if (track.interpolation !== "LINEAR") {
|
|
12538
|
-
throw new Error("Invalid interpolation type " + track.interpolation);
|
|
12541
|
+
throw new Error("Invalid interpolation type " + track.interpolation + ".");
|
|
12539
12542
|
}
|
|
12540
12543
|
if (track.path === "rotation") {
|
|
12541
12544
|
var points = [];
|
|
@@ -12773,7 +12776,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12773
12776
|
if (oldMat.blending === spec.MaterialBlending.masked) {
|
|
12774
12777
|
newMat.floats["AlphaClip"] = 1;
|
|
12775
12778
|
var _oldMat_alphaCutOff;
|
|
12776
|
-
newMat.floats["
|
|
12779
|
+
newMat.floats["_AlphaCutoff"] = (_oldMat_alphaCutOff = oldMat.alphaCutOff) != null ? _oldMat_alphaCutOff : 0;
|
|
12777
12780
|
} else {
|
|
12778
12781
|
newMat.floats["AlphaClip"] = 0;
|
|
12779
12782
|
}
|
|
@@ -12790,9 +12793,8 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12790
12793
|
if (oldMat.type === spec.MaterialType.pbr) {
|
|
12791
12794
|
newMat.floats["_SpecularAA"] = oldMat.useSpecularAA ? 1 : 0;
|
|
12792
12795
|
}
|
|
12793
|
-
|
|
12794
|
-
newMat.
|
|
12795
|
-
newMat.stringTags["ZTest"] = String(true);
|
|
12796
|
+
newMat.floats["ZWrite"] = oldMat.depthMask !== false ? 1 : 0;
|
|
12797
|
+
newMat.floats["ZTest"] = 1;
|
|
12796
12798
|
};
|
|
12797
12799
|
_proto.getTextureData = function getTextureData(scene, floats, texIndex, texTransform) {
|
|
12798
12800
|
var _scene_textures_texIndex_id;
|
|
@@ -12871,7 +12873,7 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12871
12873
|
var bins = oldScene.bins;
|
|
12872
12874
|
var joints = skin.joints, skeleton = skin.skeleton, inverseBindMatrices = skin.inverseBindMatrices;
|
|
12873
12875
|
if (!inverseBindMatrices) {
|
|
12874
|
-
throw new Error("inverseBindMatrices is undefined " + skin);
|
|
12876
|
+
throw new Error("'inverseBindMatrices' is undefined for the skin configuration: " + JSON.stringify(skin) + ". Ensure 'inverseBindMatrices' is properly defined in your skin data.");
|
|
12875
12877
|
}
|
|
12876
12878
|
var bindMatrixArray = typedArrayFromBinary(bins, inverseBindMatrices);
|
|
12877
12879
|
geom.inverseBindMatrices = Array.from(bindMatrixArray);
|
|
@@ -12880,12 +12882,12 @@ var JSONConverter = /*#__PURE__*/ function() {
|
|
|
12880
12882
|
if (skeleton !== undefined) {
|
|
12881
12883
|
rootBoneItem = treeNodeList[skeleton];
|
|
12882
12884
|
} else {
|
|
12883
|
-
console.warn("Root bone is missing");
|
|
12885
|
+
console.warn("Root bone is missing for the skeleton. Defaulting to the primary tree item as the root bone.");
|
|
12884
12886
|
}
|
|
12885
12887
|
joints.forEach(function(joint) {
|
|
12886
12888
|
var node = treeNodeList[joint];
|
|
12887
12889
|
if (node !== rootBoneItem && node.parentId === rootBoneItem.parentId) {
|
|
12888
|
-
console.error("
|
|
12890
|
+
console.error("Invalid node detected for 'rootBoneItem'. Adjusting 'rootBoneItem' to the primary tree item. Please verify the tree structure.");
|
|
12889
12891
|
rootBoneItem = treeItem;
|
|
12890
12892
|
}
|
|
12891
12893
|
});
|
|
@@ -12923,12 +12925,12 @@ var TreeInfo = /*#__PURE__*/ function() {
|
|
|
12923
12925
|
_proto.add = function add(treeItem, treeNodeList) {
|
|
12924
12926
|
var _this = this;
|
|
12925
12927
|
if (this.tree2NodeList[treeItem.id]) {
|
|
12926
|
-
throw new Error("
|
|
12928
|
+
throw new Error("Duplicate treeItem ID detected: " + treeItem.id + ". Ensure each tree item has a unique ID.");
|
|
12927
12929
|
}
|
|
12928
12930
|
this.tree2NodeList[treeItem.id] = treeNodeList;
|
|
12929
12931
|
treeNodeList.forEach(function(node) {
|
|
12930
12932
|
if (_this.nodeList2Tree[node.id]) {
|
|
12931
|
-
throw new Error("
|
|
12933
|
+
throw new Error("Duplicate tree node ID found: " + node.id + ". Each node in the tree must have a unique ID.");
|
|
12932
12934
|
}
|
|
12933
12935
|
_this.nodeList2Tree[node.id] = treeItem;
|
|
12934
12936
|
_this.nodeId2Node[node.id] = node;
|
|
@@ -12957,7 +12959,7 @@ var TreeInfo = /*#__PURE__*/ function() {
|
|
|
12957
12959
|
_proto.getTreeNodeListByNodeId = function getTreeNodeListByNodeId(id) {
|
|
12958
12960
|
var treeItem = this.nodeList2Tree[id];
|
|
12959
12961
|
if (!treeItem) {
|
|
12960
|
-
throw new Error("Invalid id " + id);
|
|
12962
|
+
throw new Error("Invalid id " + id + ".");
|
|
12961
12963
|
}
|
|
12962
12964
|
return this.getTreeNodeListByTreeId(treeItem.id);
|
|
12963
12965
|
};
|
|
@@ -13171,7 +13173,7 @@ function createGeometryData(props, subMeshes) {
|
|
|
13171
13173
|
var attribData1 = props.attributes[attrib1];
|
|
13172
13174
|
var semantic = vertexBufferSemanticMap[attrib1];
|
|
13173
13175
|
if (!semantic) {
|
|
13174
|
-
throw new Error("Invalid attrib " + attrib1);
|
|
13176
|
+
throw new Error("Invalid attrib " + attrib1 + ".");
|
|
13175
13177
|
}
|
|
13176
13178
|
// @ts-expect-error
|
|
13177
13179
|
vertexCount = attribData1.data.length / attribData1.size;
|
|
@@ -13199,8 +13201,8 @@ function createGeometryData(props, subMeshes) {
|
|
|
13199
13201
|
},
|
|
13200
13202
|
subMeshes: subMeshes,
|
|
13201
13203
|
mode: spec.GeometryType.TRIANGLES,
|
|
13202
|
-
indexFormat: spec.IndexFormatType.
|
|
13203
|
-
indexOffset:
|
|
13204
|
+
indexFormat: spec.IndexFormatType.None,
|
|
13205
|
+
indexOffset: 0,
|
|
13204
13206
|
buffer: ""
|
|
13205
13207
|
};
|
|
13206
13208
|
if (props.indices) {
|
|
@@ -13210,6 +13212,8 @@ function createGeometryData(props, subMeshes) {
|
|
|
13210
13212
|
geometryData.indexOffset = bufferOffset;
|
|
13211
13213
|
if (_instanceof1(indices, Uint32Array)) {
|
|
13212
13214
|
geometryData.indexFormat = spec.IndexFormatType.UInt32;
|
|
13215
|
+
} else {
|
|
13216
|
+
geometryData.indexFormat = spec.IndexFormatType.UInt16;
|
|
13213
13217
|
}
|
|
13214
13218
|
}
|
|
13215
13219
|
geometryData.buffer = toBase64String(buffer);
|
|
@@ -13364,13 +13368,1053 @@ var vertexBufferSemanticMap = {
|
|
|
13364
13368
|
a_Target_Tangent3: "TANGENT_BS3"
|
|
13365
13369
|
};
|
|
13366
13370
|
|
|
13371
|
+
var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
13372
|
+
function LoaderECSImpl(composition) {
|
|
13373
|
+
this.gltfSkins = [];
|
|
13374
|
+
this.gltfMeshs = [];
|
|
13375
|
+
this.gltfLights = [];
|
|
13376
|
+
this.gltfCameras = [];
|
|
13377
|
+
this.gltfImages = [];
|
|
13378
|
+
this.gltfTextures = [];
|
|
13379
|
+
this.gltfMaterials = [];
|
|
13380
|
+
this.gltfAnimations = [];
|
|
13381
|
+
this.gltfImageBasedLights = [];
|
|
13382
|
+
this.timelineAssetId = "";
|
|
13383
|
+
this.images = [];
|
|
13384
|
+
this.imageElements = [];
|
|
13385
|
+
this.textures = [];
|
|
13386
|
+
this.items = [];
|
|
13387
|
+
this.components = [];
|
|
13388
|
+
this.materials = [];
|
|
13389
|
+
this.shaders = [];
|
|
13390
|
+
this.geometries = [];
|
|
13391
|
+
this.animations = [];
|
|
13392
|
+
if (composition) {
|
|
13393
|
+
this.composition = composition;
|
|
13394
|
+
} else {
|
|
13395
|
+
this.timelineAssetId = generateGUID();
|
|
13396
|
+
this.composition = {
|
|
13397
|
+
id: "1",
|
|
13398
|
+
name: "test1",
|
|
13399
|
+
duration: 9999,
|
|
13400
|
+
endBehavior: spec.CompositionEndBehavior.restart,
|
|
13401
|
+
camera: {
|
|
13402
|
+
fov: 45,
|
|
13403
|
+
far: 2000,
|
|
13404
|
+
near: 0.001,
|
|
13405
|
+
position: [
|
|
13406
|
+
0,
|
|
13407
|
+
0,
|
|
13408
|
+
8
|
|
13409
|
+
],
|
|
13410
|
+
rotation: [
|
|
13411
|
+
0,
|
|
13412
|
+
0,
|
|
13413
|
+
0
|
|
13414
|
+
],
|
|
13415
|
+
clipMode: spec.CameraClipMode.portrait
|
|
13416
|
+
},
|
|
13417
|
+
items: [],
|
|
13418
|
+
timelineAsset: {
|
|
13419
|
+
id: this.timelineAssetId
|
|
13420
|
+
},
|
|
13421
|
+
sceneBindings: []
|
|
13422
|
+
};
|
|
13423
|
+
}
|
|
13424
|
+
}
|
|
13425
|
+
var _proto = LoaderECSImpl.prototype;
|
|
13426
|
+
_proto.initial = function initial(engine, options) {
|
|
13427
|
+
this.engine = engine;
|
|
13428
|
+
this.loaderOptions = options != null ? options : {};
|
|
13429
|
+
};
|
|
13430
|
+
_proto.loadScene = function loadScene(options) {
|
|
13431
|
+
var _this = this;
|
|
13432
|
+
return _async_to_generator(function() {
|
|
13433
|
+
var _this_components, _this_components1, _this_components2, _this_items, _options_effects_renderer, gltfResource, gltfScene, component, clips, index;
|
|
13434
|
+
return __generator(this, function(_state) {
|
|
13435
|
+
switch(_state.label){
|
|
13436
|
+
case 0:
|
|
13437
|
+
_this.clear();
|
|
13438
|
+
_this.sceneOptions = options;
|
|
13439
|
+
_this.engine = (_options_effects_renderer = options.effects.renderer) == null ? void 0 : _options_effects_renderer.engine;
|
|
13440
|
+
_this.loaderOptions = {
|
|
13441
|
+
compatibleMode: options.gltf.compatibleMode
|
|
13442
|
+
};
|
|
13443
|
+
gltfResource = options.gltf.resource;
|
|
13444
|
+
if (typeof gltfResource === "string" || _instanceof1(gltfResource, Uint8Array)) {
|
|
13445
|
+
throw new Error("Please load the resource using GLTFTools first.");
|
|
13446
|
+
}
|
|
13447
|
+
_this.images = gltfResource.images.map(function(gltfImage) {
|
|
13448
|
+
var _gltfImage_mimeType;
|
|
13449
|
+
var blob = new Blob([
|
|
13450
|
+
gltfImage.imageData.buffer
|
|
13451
|
+
], {
|
|
13452
|
+
type: (_gltfImage_mimeType = gltfImage.mimeType) != null ? _gltfImage_mimeType : "image/png"
|
|
13453
|
+
});
|
|
13454
|
+
return {
|
|
13455
|
+
id: gltfImage.id,
|
|
13456
|
+
url: URL.createObjectURL(blob)
|
|
13457
|
+
};
|
|
13458
|
+
});
|
|
13459
|
+
return [
|
|
13460
|
+
4,
|
|
13461
|
+
Promise.all(_this.images.map(/*#__PURE__*/ _async_to_generator(function(image) {
|
|
13462
|
+
return __generator(this, function(_state) {
|
|
13463
|
+
return [
|
|
13464
|
+
2,
|
|
13465
|
+
loadImage(image.url)
|
|
13466
|
+
];
|
|
13467
|
+
});
|
|
13468
|
+
})))
|
|
13469
|
+
];
|
|
13470
|
+
case 1:
|
|
13471
|
+
_this.imageElements = _state.sent();
|
|
13472
|
+
_this.processGLTFResource(gltfResource);
|
|
13473
|
+
_this.gltfScene = gltfResource.scenes[0];
|
|
13474
|
+
_this.gltfSkins = _this.gltfScene.skins;
|
|
13475
|
+
_this.gltfMeshs = gltfResource.meshes;
|
|
13476
|
+
_this.gltfLights = _this.gltfScene.lights;
|
|
13477
|
+
_this.gltfCameras = _this.gltfScene.cameras;
|
|
13478
|
+
_this.gltfImages = gltfResource.images;
|
|
13479
|
+
_this.gltfTextures = gltfResource.textures;
|
|
13480
|
+
_this.gltfMaterials = gltfResource.materials;
|
|
13481
|
+
_this.gltfAnimations = gltfResource.animations;
|
|
13482
|
+
_this.gltfImageBasedLights = gltfResource.imageBasedLights;
|
|
13483
|
+
_this.textures = _this.gltfTextures.map(function(texture) {
|
|
13484
|
+
var textureOptions = texture.textureOptions;
|
|
13485
|
+
var source = textureOptions.source;
|
|
13486
|
+
if (typeof source === "number") {
|
|
13487
|
+
// @ts-expect-error
|
|
13488
|
+
textureOptions.source = {
|
|
13489
|
+
id: _this.images[source].id
|
|
13490
|
+
};
|
|
13491
|
+
}
|
|
13492
|
+
return textureOptions;
|
|
13493
|
+
});
|
|
13494
|
+
_this.materials = _this.gltfMaterials.map(function(material) {
|
|
13495
|
+
return material.materialData;
|
|
13496
|
+
});
|
|
13497
|
+
gltfResource.meshes.forEach(function(mesh) {
|
|
13498
|
+
_this.geometries.push(mesh.geometryData);
|
|
13499
|
+
});
|
|
13500
|
+
gltfScene = gltfResource.scenes[0];
|
|
13501
|
+
gltfScene.meshesComponentData.forEach(function(mesh) {
|
|
13502
|
+
return _this.checkMeshComponentData(mesh, gltfResource);
|
|
13503
|
+
});
|
|
13504
|
+
(_this_components = _this.components).push.apply(_this_components, [].concat(gltfScene.camerasComponentData));
|
|
13505
|
+
(_this_components1 = _this.components).push.apply(_this_components1, [].concat(gltfScene.lightsComponentData));
|
|
13506
|
+
(_this_components2 = _this.components).push.apply(_this_components2, [].concat(gltfScene.meshesComponentData));
|
|
13507
|
+
if (gltfScene.animationsComponentData.length === 1) {
|
|
13508
|
+
component = gltfScene.animationsComponentData[0];
|
|
13509
|
+
if (!options.effects.playAllAnimation && options.effects.playAnimation !== undefined) {
|
|
13510
|
+
clips = component.animationClips;
|
|
13511
|
+
index = options.effects.playAnimation;
|
|
13512
|
+
if (index >= 0 && index < clips.length) {
|
|
13513
|
+
component.animationClips = [
|
|
13514
|
+
clips[index]
|
|
13515
|
+
];
|
|
13516
|
+
} else {
|
|
13517
|
+
component.animationClips = [];
|
|
13518
|
+
}
|
|
13519
|
+
}
|
|
13520
|
+
_this.components.push(component);
|
|
13521
|
+
} else if (gltfScene.animationsComponentData.length > 1) {
|
|
13522
|
+
throw new Error("Find many animation component data " + gltfScene.animationsComponentData.length);
|
|
13523
|
+
}
|
|
13524
|
+
_this.animations = [];
|
|
13525
|
+
_this.gltfAnimations.forEach(function(anim) {
|
|
13526
|
+
_this.animations.push(anim.animationClipData);
|
|
13527
|
+
});
|
|
13528
|
+
_this.items = [];
|
|
13529
|
+
return [
|
|
13530
|
+
4,
|
|
13531
|
+
_this.tryAddSkybox({
|
|
13532
|
+
skyboxType: options.gltf.skyboxType,
|
|
13533
|
+
renderable: options.gltf.skyboxVis
|
|
13534
|
+
})
|
|
13535
|
+
];
|
|
13536
|
+
case 2:
|
|
13537
|
+
_state.sent();
|
|
13538
|
+
(_this_items = _this.items).push.apply(_this_items, [].concat(gltfResource.scenes[0].vfxItemData));
|
|
13539
|
+
_this.items.forEach(function(item) {
|
|
13540
|
+
if (item.type === "root") {
|
|
13541
|
+
item.type = "ECS";
|
|
13542
|
+
}
|
|
13543
|
+
});
|
|
13544
|
+
return [
|
|
13545
|
+
2,
|
|
13546
|
+
_this.getLoadResult()
|
|
13547
|
+
];
|
|
13548
|
+
}
|
|
13549
|
+
});
|
|
13550
|
+
})();
|
|
13551
|
+
};
|
|
13552
|
+
_proto.checkMeshComponentData = function checkMeshComponentData(mesh, resource) {
|
|
13553
|
+
if (mesh.materials.length <= 0) {
|
|
13554
|
+
throw new Error("Submesh array is empty for mesh with ID: " + mesh.id + ".");
|
|
13555
|
+
}
|
|
13556
|
+
var geometryData;
|
|
13557
|
+
resource.meshes.forEach(function(meshData) {
|
|
13558
|
+
if (meshData.geometryData.id === mesh.geometry.id) {
|
|
13559
|
+
geometryData = meshData.geometryData;
|
|
13560
|
+
}
|
|
13561
|
+
});
|
|
13562
|
+
if (geometryData === undefined) {
|
|
13563
|
+
throw new Error("Unable to find geometry data for mesh with ID: " + mesh.geometry.id + ".");
|
|
13564
|
+
}
|
|
13565
|
+
if (geometryData.subMeshes.length !== mesh.materials.length) {
|
|
13566
|
+
throw new Error("Mismatch between submeshes count (" + geometryData.subMeshes.length + ") and materials count (" + mesh.materials.length + ").");
|
|
13567
|
+
}
|
|
13568
|
+
//mesh.materials.length !=
|
|
13569
|
+
};
|
|
13570
|
+
_proto.processGLTFResource = function processGLTFResource(resource) {
|
|
13571
|
+
var _loop = function() {
|
|
13572
|
+
var baseColorId = _step.value;
|
|
13573
|
+
if (emissiveIdSet.has(baseColorId)) {
|
|
13574
|
+
var texData = textures.find(function(tex) {
|
|
13575
|
+
return tex.textureOptions.id === baseColorId;
|
|
13576
|
+
});
|
|
13577
|
+
if (texData) {
|
|
13578
|
+
var newId = generateGUID();
|
|
13579
|
+
// @ts-expect-error
|
|
13580
|
+
var newTexData = _extends({}, texData);
|
|
13581
|
+
newTexData.textureOptions = _extends({}, texData.textureOptions, {
|
|
13582
|
+
id: newId
|
|
13583
|
+
});
|
|
13584
|
+
textures.push(newTexData);
|
|
13585
|
+
dataMap[newId] = newTexData.textureOptions;
|
|
13586
|
+
textureIdMap[baseColorId] = newId;
|
|
13587
|
+
mapCount += 1;
|
|
13588
|
+
}
|
|
13589
|
+
}
|
|
13590
|
+
};
|
|
13591
|
+
var _this = this;
|
|
13592
|
+
var dataMap = {};
|
|
13593
|
+
var textures = resource.textures, materials = resource.materials, scenes = resource.scenes, imageBasedLights = resource.imageBasedLights;
|
|
13594
|
+
textures.forEach(function(tex) {
|
|
13595
|
+
var texData = tex.textureOptions;
|
|
13596
|
+
var texId = texData.id;
|
|
13597
|
+
if (texId) {
|
|
13598
|
+
if (dataMap[texId]) {
|
|
13599
|
+
console.error("Duplicate GUID found: " + texId + ", old " + dataMap[texId] + ", new " + texData + ".");
|
|
13600
|
+
}
|
|
13601
|
+
dataMap[texId] = texData;
|
|
13602
|
+
} else {
|
|
13603
|
+
console.error("No GUID in texture Data: " + texData + ".");
|
|
13604
|
+
}
|
|
13605
|
+
});
|
|
13606
|
+
var baseColorIdSet = new Set();
|
|
13607
|
+
var emissiveIdSet = new Set();
|
|
13608
|
+
materials.forEach(function(mat) {
|
|
13609
|
+
var _materialData_textures__BaseColorSampler, _materialData_textures__EmissiveSampler;
|
|
13610
|
+
var materialData = mat.materialData;
|
|
13611
|
+
var baseColorTexture = (_materialData_textures__BaseColorSampler = materialData.textures["_BaseColorSampler"]) == null ? void 0 : _materialData_textures__BaseColorSampler.texture;
|
|
13612
|
+
var emissiveTexture = (_materialData_textures__EmissiveSampler = materialData.textures["_EmissiveSampler"]) == null ? void 0 : _materialData_textures__EmissiveSampler.texture;
|
|
13613
|
+
if (baseColorTexture) {
|
|
13614
|
+
baseColorIdSet.add(baseColorTexture.id);
|
|
13615
|
+
}
|
|
13616
|
+
if (emissiveTexture) {
|
|
13617
|
+
emissiveIdSet.add(emissiveTexture.id);
|
|
13618
|
+
}
|
|
13619
|
+
});
|
|
13620
|
+
var mapCount = 0;
|
|
13621
|
+
var textureIdMap = {};
|
|
13622
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(baseColorIdSet), _step; !(_step = _iterator()).done;)_loop();
|
|
13623
|
+
if (mapCount > 0) {
|
|
13624
|
+
console.warn("Duplicate emissive texture " + mapCount);
|
|
13625
|
+
}
|
|
13626
|
+
materials.forEach(function(mat) {
|
|
13627
|
+
var _materialData_shader, _materialData_shader1;
|
|
13628
|
+
var materialData = mat.materialData;
|
|
13629
|
+
_this.processMaterialData(materialData);
|
|
13630
|
+
if (((_materialData_shader = materialData.shader) == null ? void 0 : _materialData_shader.id) === UnlitShaderGUID) {
|
|
13631
|
+
_this.processMaterialTexture(materialData, "_BaseColorSampler", true, dataMap);
|
|
13632
|
+
} else if (((_materialData_shader1 = materialData.shader) == null ? void 0 : _materialData_shader1.id) === PBRShaderGUID) {
|
|
13633
|
+
var _materialData_textures__EmissiveSampler;
|
|
13634
|
+
var emissiveTexture = (_materialData_textures__EmissiveSampler = materialData.textures["_EmissiveSampler"]) == null ? void 0 : _materialData_textures__EmissiveSampler.texture;
|
|
13635
|
+
if (emissiveTexture && textureIdMap[emissiveTexture.id]) {
|
|
13636
|
+
emissiveTexture.id = textureIdMap[emissiveTexture.id];
|
|
13637
|
+
}
|
|
13638
|
+
_this.processMaterialTexture(materialData, "_BaseColorSampler", true, dataMap);
|
|
13639
|
+
_this.processMaterialTexture(materialData, "_MetallicRoughnessSampler", false, dataMap);
|
|
13640
|
+
_this.processMaterialTexture(materialData, "_NormalSampler", false, dataMap);
|
|
13641
|
+
_this.processMaterialTexture(materialData, "_OcclusionSampler", false, dataMap);
|
|
13642
|
+
_this.processMaterialTexture(materialData, "_EmissiveSampler", false, dataMap);
|
|
13643
|
+
}
|
|
13644
|
+
});
|
|
13645
|
+
var gltfScene = scenes[0];
|
|
13646
|
+
gltfScene.camerasComponentData.forEach(function(comp) {
|
|
13647
|
+
return _this.processCameraComponentData(comp);
|
|
13648
|
+
});
|
|
13649
|
+
gltfScene.lightsComponentData.forEach(function(comp) {
|
|
13650
|
+
return _this.processLightComponentData(comp);
|
|
13651
|
+
});
|
|
13652
|
+
gltfScene.meshesComponentData.forEach(function(comp) {
|
|
13653
|
+
return _this.processMeshComponentData(comp);
|
|
13654
|
+
});
|
|
13655
|
+
var cubeTextures = [];
|
|
13656
|
+
imageBasedLights.forEach(function(ibl) {
|
|
13657
|
+
var data = ibl.imageBaseLightData;
|
|
13658
|
+
if (data.reflectionsIntensity === undefined) {
|
|
13659
|
+
data.reflectionsIntensity = data.intensity;
|
|
13660
|
+
}
|
|
13661
|
+
if (data.diffuseImage) {
|
|
13662
|
+
var diffuseTexture = dataMap[data.diffuseImage.id];
|
|
13663
|
+
addItem(cubeTextures, diffuseTexture);
|
|
13664
|
+
}
|
|
13665
|
+
if (data.specularImage) {
|
|
13666
|
+
var specularImage = dataMap[data.specularImage.id];
|
|
13667
|
+
addItem(cubeTextures, specularImage);
|
|
13668
|
+
}
|
|
13669
|
+
});
|
|
13670
|
+
cubeTextures.forEach(function(tex) {
|
|
13671
|
+
if (tex.target === glContext.TEXTURE_CUBE_MAP) {
|
|
13672
|
+
var cube = tex;
|
|
13673
|
+
cube.mipmaps.forEach(function(mipmap) {
|
|
13674
|
+
var ref;
|
|
13675
|
+
ref = [
|
|
13676
|
+
mipmap[5],
|
|
13677
|
+
mipmap[4]
|
|
13678
|
+
], mipmap[4] = ref[0], mipmap[5] = ref[1];
|
|
13679
|
+
});
|
|
13680
|
+
if (cube.mipmaps.length === 1) {
|
|
13681
|
+
cube.minFilter = glContext.LINEAR;
|
|
13682
|
+
cube.magFilter = glContext.LINEAR;
|
|
13683
|
+
} else {
|
|
13684
|
+
cube.minFilter = glContext.LINEAR_MIPMAP_LINEAR;
|
|
13685
|
+
cube.magFilter = glContext.LINEAR;
|
|
13686
|
+
}
|
|
13687
|
+
}
|
|
13688
|
+
});
|
|
13689
|
+
};
|
|
13690
|
+
_proto.processComponentData = function processComponentData(components) {
|
|
13691
|
+
var _this = this;
|
|
13692
|
+
components.forEach(function(comp) {
|
|
13693
|
+
if (comp.dataType === spec.DataType.LightComponent) {
|
|
13694
|
+
_this.processLightComponentData(comp);
|
|
13695
|
+
} else if (comp.dataType === spec.DataType.CameraComponent) {
|
|
13696
|
+
_this.processCameraComponentData(comp);
|
|
13697
|
+
} else if (comp.dataType === spec.DataType.MeshComponent) {
|
|
13698
|
+
_this.processMeshComponentData(comp);
|
|
13699
|
+
} else if (comp.dataType === spec.DataType.SkyboxComponent) {
|
|
13700
|
+
_this.processSkyboxComponentData(comp);
|
|
13701
|
+
}
|
|
13702
|
+
});
|
|
13703
|
+
};
|
|
13704
|
+
_proto.processLightComponentData = function processLightComponentData(light) {
|
|
13705
|
+
if (!light.color) {
|
|
13706
|
+
light.color = {
|
|
13707
|
+
r: 1,
|
|
13708
|
+
g: 1,
|
|
13709
|
+
b: 1,
|
|
13710
|
+
a: 1
|
|
13711
|
+
};
|
|
13712
|
+
}
|
|
13713
|
+
if (!light.intensity) {
|
|
13714
|
+
light.intensity = 1;
|
|
13715
|
+
}
|
|
13716
|
+
if (light.lightType === spec.LightType.point) {
|
|
13717
|
+
if (!light.range) {
|
|
13718
|
+
light.range = 0;
|
|
13719
|
+
}
|
|
13720
|
+
} else if (light.lightType === spec.LightType.spot) {
|
|
13721
|
+
if (!light.range) {
|
|
13722
|
+
light.range = 0;
|
|
13723
|
+
}
|
|
13724
|
+
if (!light.innerConeAngle) {
|
|
13725
|
+
light.innerConeAngle = 0;
|
|
13726
|
+
}
|
|
13727
|
+
if (!light.outerConeAngle) {
|
|
13728
|
+
light.outerConeAngle = Math.PI / 4;
|
|
13729
|
+
}
|
|
13730
|
+
}
|
|
13731
|
+
};
|
|
13732
|
+
_proto.processCameraComponentData = function processCameraComponentData(camera) {
|
|
13733
|
+
if (camera.type === spec.CameraType.perspective) {
|
|
13734
|
+
if (camera.fov) {
|
|
13735
|
+
camera.fov *= Math.PI / 180;
|
|
13736
|
+
}
|
|
13737
|
+
}
|
|
13738
|
+
};
|
|
13739
|
+
_proto.processMeshComponentData = function processMeshComponentData(mesh) {};
|
|
13740
|
+
_proto.processSkyboxComponentData = function processSkyboxComponentData(skybox) {
|
|
13741
|
+
if (skybox.intensity === undefined) {
|
|
13742
|
+
skybox.intensity = 1;
|
|
13743
|
+
}
|
|
13744
|
+
if (skybox.reflectionsIntensity === undefined) {
|
|
13745
|
+
skybox.reflectionsIntensity = 1;
|
|
13746
|
+
}
|
|
13747
|
+
};
|
|
13748
|
+
_proto.processMaterialData = function processMaterialData(material) {
|
|
13749
|
+
var _material_shader, _material_shader1;
|
|
13750
|
+
if (((_material_shader = material.shader) == null ? void 0 : _material_shader.id) === UnlitShaderGUID) {
|
|
13751
|
+
if (!material.colors["_BaseColorFactor"]) {
|
|
13752
|
+
material.colors["_BaseColorFactor"] = {
|
|
13753
|
+
r: 1,
|
|
13754
|
+
g: 1,
|
|
13755
|
+
b: 1,
|
|
13756
|
+
a: 1
|
|
13757
|
+
};
|
|
13758
|
+
}
|
|
13759
|
+
if (material.floats["_AlphaCutoff"] === undefined) {
|
|
13760
|
+
material.floats["_AlphaCutoff"] = 0;
|
|
13761
|
+
}
|
|
13762
|
+
if (material.floats["ZWrite"] === undefined) {
|
|
13763
|
+
material.floats["ZWrite"] = 1;
|
|
13764
|
+
}
|
|
13765
|
+
if (material.floats["ZTest"] === undefined) {
|
|
13766
|
+
material.floats["ZTest"] = 1;
|
|
13767
|
+
}
|
|
13768
|
+
if (!material.stringTags["RenderType"]) {
|
|
13769
|
+
material.stringTags["RenderType"] = spec.RenderType.Opaque;
|
|
13770
|
+
}
|
|
13771
|
+
if (!material.stringTags["RenderFace"]) {
|
|
13772
|
+
material.stringTags["RenderFace"] = spec.RenderFace.Front;
|
|
13773
|
+
}
|
|
13774
|
+
} else if (((_material_shader1 = material.shader) == null ? void 0 : _material_shader1.id) === PBRShaderGUID) {
|
|
13775
|
+
if (!material.colors["_BaseColorFactor"]) {
|
|
13776
|
+
material.colors["_BaseColorFactor"] = {
|
|
13777
|
+
r: 1,
|
|
13778
|
+
g: 1,
|
|
13779
|
+
b: 1,
|
|
13780
|
+
a: 1
|
|
13781
|
+
};
|
|
13782
|
+
}
|
|
13783
|
+
if (material.floats["_SpecularAA"] === undefined) {
|
|
13784
|
+
material.floats["_SpecularAA"] = 0;
|
|
13785
|
+
}
|
|
13786
|
+
if (material.floats["_MetallicFactor"] === undefined) {
|
|
13787
|
+
material.floats["_MetallicFactor"] = 1;
|
|
13788
|
+
}
|
|
13789
|
+
if (material.floats["_RoughnessFactor"] === undefined) {
|
|
13790
|
+
material.floats["_RoughnessFactor"] = 0;
|
|
13791
|
+
}
|
|
13792
|
+
if (material.floats["_NormalScale"] === undefined) {
|
|
13793
|
+
material.floats["_NormalScale"] = 1;
|
|
13794
|
+
}
|
|
13795
|
+
if (material.floats["_OcclusionStrength"] === undefined) {
|
|
13796
|
+
material.floats["_OcclusionStrength"] = this.isTiny3dMode() ? 0 : 1;
|
|
13797
|
+
}
|
|
13798
|
+
if (!material.colors["_EmissiveFactor"]) {
|
|
13799
|
+
material.colors["_EmissiveFactor"] = {
|
|
13800
|
+
r: 0,
|
|
13801
|
+
g: 0,
|
|
13802
|
+
b: 0,
|
|
13803
|
+
a: 1
|
|
13804
|
+
};
|
|
13805
|
+
}
|
|
13806
|
+
if (material.floats["_EmissiveIntensity"] === undefined) {
|
|
13807
|
+
material.floats["_EmissiveIntensity"] = 1;
|
|
13808
|
+
}
|
|
13809
|
+
if (material.floats["_AlphaCutoff"] === undefined) {
|
|
13810
|
+
material.floats["_AlphaCutoff"] = 0;
|
|
13811
|
+
}
|
|
13812
|
+
if (material.floats["ZWrite"] === undefined) {
|
|
13813
|
+
material.floats["ZWrite"] = 1;
|
|
13814
|
+
}
|
|
13815
|
+
if (material.floats["ZTest"] === undefined) {
|
|
13816
|
+
material.floats["ZTest"] = 1;
|
|
13817
|
+
}
|
|
13818
|
+
if (!material.stringTags["RenderType"]) {
|
|
13819
|
+
material.stringTags["RenderType"] = spec.RenderType.Opaque;
|
|
13820
|
+
}
|
|
13821
|
+
if (!material.stringTags["RenderFace"]) {
|
|
13822
|
+
material.stringTags["RenderFace"] = spec.RenderFace.Front;
|
|
13823
|
+
}
|
|
13824
|
+
} else {
|
|
13825
|
+
console.error("Encountered unknown shader ID in material with ID: " + material.id + ".");
|
|
13826
|
+
}
|
|
13827
|
+
};
|
|
13828
|
+
_proto.processTextureOptions = function processTextureOptions(options, isBaseColor, image) {
|
|
13829
|
+
var premultiplyAlpha = false;
|
|
13830
|
+
var _options_minFilter;
|
|
13831
|
+
var minFilter = (_options_minFilter = options.minFilter) != null ? _options_minFilter : glContext.LINEAR_MIPMAP_LINEAR;
|
|
13832
|
+
if (this.isTiny3dMode()) {
|
|
13833
|
+
minFilter = glContext.LINEAR_MIPMAP_LINEAR;
|
|
13834
|
+
if (image) {
|
|
13835
|
+
if (!WebGLHelper.isPow2(image.width) || !WebGLHelper.isPow2(image.height)) {
|
|
13836
|
+
minFilter = glContext.LINEAR;
|
|
13837
|
+
}
|
|
13838
|
+
}
|
|
13839
|
+
premultiplyAlpha = isBaseColor ? false : true;
|
|
13840
|
+
}
|
|
13841
|
+
var generateMipmap = minFilter == glContext.NEAREST_MIPMAP_NEAREST || minFilter == glContext.LINEAR_MIPMAP_NEAREST || minFilter == glContext.NEAREST_MIPMAP_LINEAR || minFilter == glContext.LINEAR_MIPMAP_LINEAR;
|
|
13842
|
+
var _options_wrapS;
|
|
13843
|
+
options.wrapS = (_options_wrapS = options.wrapS) != null ? _options_wrapS : glContext.REPEAT;
|
|
13844
|
+
var _options_wrapT;
|
|
13845
|
+
options.wrapT = (_options_wrapT = options.wrapT) != null ? _options_wrapT : glContext.REPEAT;
|
|
13846
|
+
var _options_magFilter;
|
|
13847
|
+
options.magFilter = (_options_magFilter = options.magFilter) != null ? _options_magFilter : glContext.LINEAR;
|
|
13848
|
+
options.minFilter = minFilter;
|
|
13849
|
+
options.anisotropic = 1;
|
|
13850
|
+
options.premultiplyAlpha = premultiplyAlpha;
|
|
13851
|
+
options.generateMipmap = generateMipmap;
|
|
13852
|
+
};
|
|
13853
|
+
_proto.processMaterialTexture = function processMaterialTexture(material, textureName, isBaseColor, dataMap) {
|
|
13854
|
+
var texture = material.textures[textureName];
|
|
13855
|
+
if (texture) {
|
|
13856
|
+
var id = texture.texture.id;
|
|
13857
|
+
var texData = dataMap[id];
|
|
13858
|
+
var imageObj;
|
|
13859
|
+
// @ts-expect-error
|
|
13860
|
+
if (typeof texData.source !== "number") {
|
|
13861
|
+
// @ts-expect-error
|
|
13862
|
+
throw new Error("Invalid texture option source data, " + texData.source);
|
|
13863
|
+
} else {
|
|
13864
|
+
// @ts-expect-error
|
|
13865
|
+
imageObj = this.imageElements[texData.source];
|
|
13866
|
+
}
|
|
13867
|
+
if (texData) {
|
|
13868
|
+
this.processTextureOptions(texData, isBaseColor, imageObj);
|
|
13869
|
+
}
|
|
13870
|
+
}
|
|
13871
|
+
};
|
|
13872
|
+
_proto.getLoadResult = function getLoadResult() {
|
|
13873
|
+
var itemIds = [];
|
|
13874
|
+
this.items.forEach(function(item) {
|
|
13875
|
+
return itemIds.push({
|
|
13876
|
+
id: item.id
|
|
13877
|
+
});
|
|
13878
|
+
});
|
|
13879
|
+
this.composition.items = itemIds;
|
|
13880
|
+
var jsonScene = {
|
|
13881
|
+
version: "3.0",
|
|
13882
|
+
playerVersion: {
|
|
13883
|
+
web: "2.0",
|
|
13884
|
+
native: "2.0"
|
|
13885
|
+
},
|
|
13886
|
+
type: "ge",
|
|
13887
|
+
compositionId: this.composition.id,
|
|
13888
|
+
compositions: [
|
|
13889
|
+
this.composition
|
|
13890
|
+
],
|
|
13891
|
+
images: this.images,
|
|
13892
|
+
shapes: [],
|
|
13893
|
+
plugins: [
|
|
13894
|
+
"model"
|
|
13895
|
+
],
|
|
13896
|
+
textures: this.textures,
|
|
13897
|
+
items: this.items,
|
|
13898
|
+
components: this.components,
|
|
13899
|
+
materials: this.materials,
|
|
13900
|
+
shaders: this.shaders,
|
|
13901
|
+
geometries: this.geometries,
|
|
13902
|
+
animations: this.animations,
|
|
13903
|
+
miscs: [
|
|
13904
|
+
{
|
|
13905
|
+
id: this.timelineAssetId,
|
|
13906
|
+
dataType: spec.DataType.TimelineAsset
|
|
13907
|
+
}
|
|
13908
|
+
]
|
|
13909
|
+
};
|
|
13910
|
+
return {
|
|
13911
|
+
source: this.getRemarkString(),
|
|
13912
|
+
jsonScene: jsonScene,
|
|
13913
|
+
sceneAABB: {
|
|
13914
|
+
min: [
|
|
13915
|
+
-1,
|
|
13916
|
+
-1,
|
|
13917
|
+
-1
|
|
13918
|
+
],
|
|
13919
|
+
max: [
|
|
13920
|
+
1,
|
|
13921
|
+
1,
|
|
13922
|
+
1
|
|
13923
|
+
]
|
|
13924
|
+
}
|
|
13925
|
+
};
|
|
13926
|
+
};
|
|
13927
|
+
_proto.addLight = function addLight(data) {
|
|
13928
|
+
var itemId = generateGUID();
|
|
13929
|
+
var component = {
|
|
13930
|
+
id: generateGUID(),
|
|
13931
|
+
item: {
|
|
13932
|
+
id: itemId
|
|
13933
|
+
},
|
|
13934
|
+
dataType: spec.DataType.LightComponent,
|
|
13935
|
+
//
|
|
13936
|
+
lightType: data.lightType,
|
|
13937
|
+
color: data.color,
|
|
13938
|
+
intensity: data.intensity,
|
|
13939
|
+
range: data.range,
|
|
13940
|
+
innerConeAngle: data.innerConeAngle,
|
|
13941
|
+
outerConeAngle: data.outerConeAngle
|
|
13942
|
+
};
|
|
13943
|
+
var item = {
|
|
13944
|
+
id: itemId,
|
|
13945
|
+
name: data.name,
|
|
13946
|
+
duration: data.duration,
|
|
13947
|
+
type: spec.ItemType.light,
|
|
13948
|
+
pn: 0,
|
|
13949
|
+
visible: true,
|
|
13950
|
+
endBehavior: data.endBehavior,
|
|
13951
|
+
transform: {
|
|
13952
|
+
position: {
|
|
13953
|
+
x: data.position[0],
|
|
13954
|
+
y: data.position[1],
|
|
13955
|
+
z: data.position[2]
|
|
13956
|
+
},
|
|
13957
|
+
eulerHint: {
|
|
13958
|
+
x: data.rotation[0],
|
|
13959
|
+
y: data.rotation[1],
|
|
13960
|
+
z: data.rotation[2]
|
|
13961
|
+
},
|
|
13962
|
+
scale: {
|
|
13963
|
+
x: data.scale[0],
|
|
13964
|
+
y: data.scale[1],
|
|
13965
|
+
z: data.scale[2]
|
|
13966
|
+
}
|
|
13967
|
+
},
|
|
13968
|
+
components: [
|
|
13969
|
+
{
|
|
13970
|
+
id: component.id
|
|
13971
|
+
}
|
|
13972
|
+
],
|
|
13973
|
+
content: {},
|
|
13974
|
+
dataType: spec.DataType.VFXItemData
|
|
13975
|
+
};
|
|
13976
|
+
this.items.push(item);
|
|
13977
|
+
this.components.push(component);
|
|
13978
|
+
};
|
|
13979
|
+
_proto.addCamera = function addCamera(camera) {
|
|
13980
|
+
var itemId = generateGUID();
|
|
13981
|
+
var component = {
|
|
13982
|
+
id: generateGUID(),
|
|
13983
|
+
item: {
|
|
13984
|
+
id: itemId
|
|
13985
|
+
},
|
|
13986
|
+
dataType: spec.DataType.CameraComponent,
|
|
13987
|
+
fov: camera.fov,
|
|
13988
|
+
near: camera.near,
|
|
13989
|
+
far: camera.far,
|
|
13990
|
+
clipMode: camera.clipMode
|
|
13991
|
+
};
|
|
13992
|
+
var item = {
|
|
13993
|
+
id: itemId,
|
|
13994
|
+
name: camera.name,
|
|
13995
|
+
duration: camera.duration,
|
|
13996
|
+
// @ts-expect-error
|
|
13997
|
+
type: "camera",
|
|
13998
|
+
pn: 0,
|
|
13999
|
+
visible: true,
|
|
14000
|
+
endBehavior: camera.endBehavior,
|
|
14001
|
+
transform: {
|
|
14002
|
+
position: {
|
|
14003
|
+
x: camera.position[0],
|
|
14004
|
+
y: camera.position[1],
|
|
14005
|
+
z: camera.position[2]
|
|
14006
|
+
},
|
|
14007
|
+
eulerHint: {
|
|
14008
|
+
x: camera.rotation[0],
|
|
14009
|
+
y: camera.rotation[1],
|
|
14010
|
+
z: camera.rotation[2]
|
|
14011
|
+
},
|
|
14012
|
+
scale: {
|
|
14013
|
+
x: 1,
|
|
14014
|
+
y: 1,
|
|
14015
|
+
z: 1
|
|
14016
|
+
}
|
|
14017
|
+
},
|
|
14018
|
+
components: [
|
|
14019
|
+
{
|
|
14020
|
+
id: component.id
|
|
14021
|
+
}
|
|
14022
|
+
],
|
|
14023
|
+
content: {},
|
|
14024
|
+
dataType: spec.DataType.VFXItemData
|
|
14025
|
+
};
|
|
14026
|
+
this.items.push(item);
|
|
14027
|
+
this.components.push(component);
|
|
14028
|
+
};
|
|
14029
|
+
_proto.tryAddSkybox = function tryAddSkybox(skybox) {
|
|
14030
|
+
var _this = this;
|
|
14031
|
+
return _async_to_generator(function() {
|
|
14032
|
+
var ibl, _this_images, // @ts-expect-error
|
|
14033
|
+
_this_textures, itemId, skyboxInfo, imageList, textureOptionsList, component, _skybox_renderable, _skybox_duration, item;
|
|
14034
|
+
return __generator(this, function(_state) {
|
|
14035
|
+
if (_this.gltfImageBasedLights.length > 0 && !_this.ignoreSkybox()) {
|
|
14036
|
+
ibl = _this.gltfImageBasedLights[0];
|
|
14037
|
+
_this.components.push(ibl.imageBaseLightData);
|
|
14038
|
+
} else if (skybox.skyboxType !== undefined) {
|
|
14039
|
+
itemId = generateGUID();
|
|
14040
|
+
skyboxInfo = _this.createSkyboxComponentData(skybox.skyboxType);
|
|
14041
|
+
imageList = skyboxInfo.imageList, textureOptionsList = skyboxInfo.textureOptionsList, component = skyboxInfo.component;
|
|
14042
|
+
component.item.id = itemId;
|
|
14043
|
+
if (skybox.intensity !== undefined) {
|
|
14044
|
+
component.intensity = skybox.intensity;
|
|
14045
|
+
}
|
|
14046
|
+
if (skybox.reflectionsIntensity !== undefined) {
|
|
14047
|
+
component.reflectionsIntensity = skybox.reflectionsIntensity;
|
|
14048
|
+
}
|
|
14049
|
+
component.renderable = (_skybox_renderable = skybox.renderable) != null ? _skybox_renderable : false;
|
|
14050
|
+
item = {
|
|
14051
|
+
id: itemId,
|
|
14052
|
+
name: "Skybox-" + skybox.skyboxType,
|
|
14053
|
+
duration: (_skybox_duration = skybox.duration) != null ? _skybox_duration : 999,
|
|
14054
|
+
type: spec.ItemType.skybox,
|
|
14055
|
+
pn: 0,
|
|
14056
|
+
visible: true,
|
|
14057
|
+
endBehavior: spec.ItemEndBehavior.freeze,
|
|
14058
|
+
transform: {
|
|
14059
|
+
position: {
|
|
14060
|
+
x: 0,
|
|
14061
|
+
y: 0,
|
|
14062
|
+
z: 0
|
|
14063
|
+
},
|
|
14064
|
+
eulerHint: {
|
|
14065
|
+
x: 0,
|
|
14066
|
+
y: 0,
|
|
14067
|
+
z: 0
|
|
14068
|
+
},
|
|
14069
|
+
scale: {
|
|
14070
|
+
x: 1,
|
|
14071
|
+
y: 1,
|
|
14072
|
+
z: 1
|
|
14073
|
+
}
|
|
14074
|
+
},
|
|
14075
|
+
components: [
|
|
14076
|
+
{
|
|
14077
|
+
id: component.id
|
|
14078
|
+
}
|
|
14079
|
+
],
|
|
14080
|
+
content: {},
|
|
14081
|
+
dataType: spec.DataType.VFXItemData
|
|
14082
|
+
};
|
|
14083
|
+
(_this_images = _this.images).push.apply(_this_images, [].concat(imageList));
|
|
14084
|
+
(_this_textures = _this.textures).push.apply(_this_textures, [].concat(textureOptionsList));
|
|
14085
|
+
_this.items.push(item);
|
|
14086
|
+
_this.components.push(component);
|
|
14087
|
+
}
|
|
14088
|
+
return [
|
|
14089
|
+
2
|
|
14090
|
+
];
|
|
14091
|
+
});
|
|
14092
|
+
})();
|
|
14093
|
+
};
|
|
14094
|
+
_proto.createTreeOptions = function createTreeOptions(scene) {
|
|
14095
|
+
var nodeList = scene.nodes.map(function(node, nodeIndex) {
|
|
14096
|
+
var children = node.children.map(function(child) {
|
|
14097
|
+
if (child.nodeIndex === undefined) {
|
|
14098
|
+
throw new Error("Undefined nodeIndex for child " + child + ".");
|
|
14099
|
+
}
|
|
14100
|
+
return child.nodeIndex;
|
|
14101
|
+
});
|
|
14102
|
+
var pos = [
|
|
14103
|
+
0,
|
|
14104
|
+
0,
|
|
14105
|
+
0
|
|
14106
|
+
];
|
|
14107
|
+
var quat = [
|
|
14108
|
+
0,
|
|
14109
|
+
0,
|
|
14110
|
+
0,
|
|
14111
|
+
0
|
|
14112
|
+
];
|
|
14113
|
+
var scale = [
|
|
14114
|
+
0,
|
|
14115
|
+
0,
|
|
14116
|
+
0
|
|
14117
|
+
];
|
|
14118
|
+
if (node.matrix !== undefined) {
|
|
14119
|
+
if (node.matrix.length !== 16) {
|
|
14120
|
+
throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node + ".");
|
|
14121
|
+
}
|
|
14122
|
+
var mat = Matrix4.fromArray(node.matrix);
|
|
14123
|
+
var transform = mat.getTransform();
|
|
14124
|
+
pos = transform.translation.toArray();
|
|
14125
|
+
quat = transform.rotation.toArray();
|
|
14126
|
+
scale = transform.scale.toArray();
|
|
14127
|
+
} else {
|
|
14128
|
+
if (node.translation !== undefined) {
|
|
14129
|
+
pos = node.translation;
|
|
14130
|
+
}
|
|
14131
|
+
if (node.rotation !== undefined) {
|
|
14132
|
+
quat = node.rotation;
|
|
14133
|
+
}
|
|
14134
|
+
if (node.scale !== undefined) {
|
|
14135
|
+
scale = node.scale;
|
|
14136
|
+
}
|
|
14137
|
+
}
|
|
14138
|
+
node.nodeIndex = nodeIndex;
|
|
14139
|
+
var treeNode = {
|
|
14140
|
+
name: node.name,
|
|
14141
|
+
transform: {
|
|
14142
|
+
position: pos,
|
|
14143
|
+
quat: quat,
|
|
14144
|
+
scale: scale
|
|
14145
|
+
},
|
|
14146
|
+
children: children,
|
|
14147
|
+
id: "" + node.nodeIndex
|
|
14148
|
+
};
|
|
14149
|
+
return treeNode;
|
|
14150
|
+
});
|
|
14151
|
+
var rootNodes = scene.rootNodes.map(function(root) {
|
|
14152
|
+
if (root.nodeIndex === undefined) {
|
|
14153
|
+
throw new Error("Undefined nodeIndex for root " + root + ".");
|
|
14154
|
+
}
|
|
14155
|
+
return root.nodeIndex;
|
|
14156
|
+
});
|
|
14157
|
+
var treeOptions = {
|
|
14158
|
+
nodes: nodeList,
|
|
14159
|
+
children: rootNodes,
|
|
14160
|
+
animation: -1,
|
|
14161
|
+
animations: []
|
|
14162
|
+
};
|
|
14163
|
+
return treeOptions;
|
|
14164
|
+
};
|
|
14165
|
+
_proto.createAnimations = function createAnimations(animations) {
|
|
14166
|
+
return animations.map(function(anim) {
|
|
14167
|
+
var tracks = anim.channels.map(function(channel) {
|
|
14168
|
+
var track = {
|
|
14169
|
+
input: channel.input.array,
|
|
14170
|
+
output: channel.output.array,
|
|
14171
|
+
node: channel.target.node,
|
|
14172
|
+
path: channel.target.path,
|
|
14173
|
+
interpolation: channel.interpolation
|
|
14174
|
+
};
|
|
14175
|
+
return track;
|
|
14176
|
+
});
|
|
14177
|
+
var newAnim = {
|
|
14178
|
+
name: anim.name,
|
|
14179
|
+
tracks: tracks
|
|
14180
|
+
};
|
|
14181
|
+
return newAnim;
|
|
14182
|
+
});
|
|
14183
|
+
};
|
|
14184
|
+
_proto.createTexture2D = function createTexture2D(image, texture, isBaseColor) {
|
|
14185
|
+
return WebGLHelper.createTexture2D(this.engine, image, texture, isBaseColor, this.isTiny3dMode());
|
|
14186
|
+
};
|
|
14187
|
+
_proto.createSkyboxComponentData = function createSkyboxComponentData(typeName) {
|
|
14188
|
+
if (typeName !== "NFT" && typeName !== "FARM") {
|
|
14189
|
+
throw new Error("Invalid skybox type specified: '" + typeName + "'. Valid types are: 'NFT', 'FARM'.");
|
|
14190
|
+
}
|
|
14191
|
+
//
|
|
14192
|
+
var typ = typeName === "NFT" ? PSkyboxType.NFT : PSkyboxType.FARM;
|
|
14193
|
+
var params = PSkyboxCreator.getSkyboxParams(typ);
|
|
14194
|
+
return PSkyboxCreator.createSkyboxComponentData(this.engine, params);
|
|
14195
|
+
};
|
|
14196
|
+
_proto.scaleColorVal = function scaleColorVal(val, fromGLTF) {
|
|
14197
|
+
return fromGLTF ? LoaderHelper.scaleTo255(val) : LoaderHelper.scaleTo1(val);
|
|
14198
|
+
};
|
|
14199
|
+
_proto.scaleColorVec = function scaleColorVec(vec, fromGLTF) {
|
|
14200
|
+
var _this = this;
|
|
14201
|
+
return vec.map(function(val) {
|
|
14202
|
+
return _this.scaleColorVal(val, fromGLTF);
|
|
14203
|
+
});
|
|
14204
|
+
};
|
|
14205
|
+
_proto.createLightOptions = function createLightOptions(light) {
|
|
14206
|
+
return PluginHelper.createLightOptions(light);
|
|
14207
|
+
};
|
|
14208
|
+
_proto.createCameraOptions = function createCameraOptions(camera) {
|
|
14209
|
+
var _PluginHelper_createCameraOptions;
|
|
14210
|
+
return (_PluginHelper_createCameraOptions = PluginHelper.createCameraOptions(camera)) != null ? _PluginHelper_createCameraOptions : {
|
|
14211
|
+
fov: 45,
|
|
14212
|
+
far: 1000,
|
|
14213
|
+
near: 0.01,
|
|
14214
|
+
clipMode: spec.CameraClipMode.portrait
|
|
14215
|
+
};
|
|
14216
|
+
};
|
|
14217
|
+
_proto.clear = function clear() {
|
|
14218
|
+
this.images = [];
|
|
14219
|
+
this.textures = [];
|
|
14220
|
+
this.items = [];
|
|
14221
|
+
this.components = [];
|
|
14222
|
+
this.materials = [];
|
|
14223
|
+
this.shaders = [];
|
|
14224
|
+
this.geometries = [];
|
|
14225
|
+
};
|
|
14226
|
+
/**
|
|
14227
|
+
* 按照传入的动画播放参数,计算需要播放的动画索引
|
|
14228
|
+
*
|
|
14229
|
+
* @param treeOptions 节点树属性,需要初始化animations列表。
|
|
14230
|
+
* @returns 返回计算的动画索引,-1表示没有动画需要播放,-88888888表示播放所有动画。
|
|
14231
|
+
*/ _proto.getPlayAnimationIndex = function getPlayAnimationIndex(treeOptions) {
|
|
14232
|
+
var animations = treeOptions.animations;
|
|
14233
|
+
if (animations === undefined || animations.length <= 0) {
|
|
14234
|
+
// 硬编码,内部指定的不播放动画的索引值
|
|
14235
|
+
return -1;
|
|
14236
|
+
}
|
|
14237
|
+
if (this.isPlayAllAnimation()) {
|
|
14238
|
+
// 硬编码,内部指定的播放全部动画的索引值
|
|
14239
|
+
return -88888888;
|
|
14240
|
+
}
|
|
14241
|
+
var animationInfo = this.sceneOptions.effects.playAnimation;
|
|
14242
|
+
if (animationInfo === undefined) {
|
|
14243
|
+
return -1;
|
|
14244
|
+
}
|
|
14245
|
+
if (typeof animationInfo === "number") {
|
|
14246
|
+
if (animationInfo >= 0 && animationInfo < animations.length) {
|
|
14247
|
+
return animationInfo;
|
|
14248
|
+
} else {
|
|
14249
|
+
return -1;
|
|
14250
|
+
}
|
|
14251
|
+
} else {
|
|
14252
|
+
// typeof animationInfo === 'string'
|
|
14253
|
+
var animationIndex = -1;
|
|
14254
|
+
// 通过动画名字查找动画索引
|
|
14255
|
+
animations.forEach(function(anim, index) {
|
|
14256
|
+
if (anim.name === animationInfo) {
|
|
14257
|
+
animationIndex = index;
|
|
14258
|
+
}
|
|
14259
|
+
});
|
|
14260
|
+
return animationIndex;
|
|
14261
|
+
}
|
|
14262
|
+
};
|
|
14263
|
+
_proto.isPlayAnimation = function isPlayAnimation() {
|
|
14264
|
+
return this.sceneOptions.effects.playAnimation !== undefined;
|
|
14265
|
+
};
|
|
14266
|
+
_proto.isPlayAllAnimation = function isPlayAllAnimation() {
|
|
14267
|
+
return this.sceneOptions.effects.playAllAnimation === true;
|
|
14268
|
+
};
|
|
14269
|
+
_proto.getRemarkString = function getRemarkString() {
|
|
14270
|
+
var remark = this.sceneOptions.gltf.remark;
|
|
14271
|
+
if (remark === undefined) {
|
|
14272
|
+
return "Unknown";
|
|
14273
|
+
} else if (typeof remark === "string") {
|
|
14274
|
+
return remark;
|
|
14275
|
+
} else {
|
|
14276
|
+
return "BinaryBuffer";
|
|
14277
|
+
}
|
|
14278
|
+
};
|
|
14279
|
+
_proto.getCompositionDuration = function getCompositionDuration() {
|
|
14280
|
+
return this.composition.duration;
|
|
14281
|
+
};
|
|
14282
|
+
_proto.isTiny3dMode = function isTiny3dMode() {
|
|
14283
|
+
return this.loaderOptions.compatibleMode === "tiny3d";
|
|
14284
|
+
};
|
|
14285
|
+
_proto.getItemDuration = function getItemDuration() {
|
|
14286
|
+
var _this_sceneOptions_effects_duration;
|
|
14287
|
+
return (_this_sceneOptions_effects_duration = this.sceneOptions.effects.duration) != null ? _this_sceneOptions_effects_duration : 9999;
|
|
14288
|
+
};
|
|
14289
|
+
_proto.getItemEndBehavior = function getItemEndBehavior() {
|
|
14290
|
+
var _this_sceneOptions_effects_endBehavior;
|
|
14291
|
+
return (_this_sceneOptions_effects_endBehavior = this.sceneOptions.effects.endBehavior) != null ? _this_sceneOptions_effects_endBehavior : spec.ItemEndBehavior.loop;
|
|
14292
|
+
};
|
|
14293
|
+
_proto.getSkyboxType = function getSkyboxType() {
|
|
14294
|
+
var typeName = this.sceneOptions.gltf.skyboxType;
|
|
14295
|
+
switch(typeName){
|
|
14296
|
+
case "NFT":
|
|
14297
|
+
return PSkyboxType.NFT;
|
|
14298
|
+
case "FARM":
|
|
14299
|
+
return PSkyboxType.FARM;
|
|
14300
|
+
}
|
|
14301
|
+
};
|
|
14302
|
+
_proto.isSkyboxVis = function isSkyboxVis() {
|
|
14303
|
+
return this.sceneOptions.gltf.skyboxVis === true;
|
|
14304
|
+
};
|
|
14305
|
+
_proto.ignoreSkybox = function ignoreSkybox() {
|
|
14306
|
+
return this.sceneOptions.gltf.ignoreSkybox === true;
|
|
14307
|
+
};
|
|
14308
|
+
_proto.isEnvironmentTest = function isEnvironmentTest() {
|
|
14309
|
+
if (typeof this.sceneOptions.gltf.remark === "string") {
|
|
14310
|
+
return this.sceneOptions.gltf.remark.includes("EnvironmentTest");
|
|
14311
|
+
} else {
|
|
14312
|
+
return false;
|
|
14313
|
+
}
|
|
14314
|
+
};
|
|
14315
|
+
return LoaderECSImpl;
|
|
14316
|
+
}();
|
|
14317
|
+
var globalLoader;
|
|
14318
|
+
function getDefaultEffectsGLTFLoaderECS(engine, options) {
|
|
14319
|
+
if (!globalLoader) {
|
|
14320
|
+
globalLoader = new LoaderECSImpl();
|
|
14321
|
+
}
|
|
14322
|
+
globalLoader.initial(engine, options);
|
|
14323
|
+
return globalLoader;
|
|
14324
|
+
}
|
|
14325
|
+
function setDefaultEffectsGLTFLoaderECS(loader) {
|
|
14326
|
+
globalLoader = loader;
|
|
14327
|
+
}
|
|
14328
|
+
function getPBRShaderProperties() {
|
|
14329
|
+
return '\n _BaseColorSampler ("基础贴图", 2D) = "" {}\n _BaseColorFactor ("基础颜色", Color) = (1, 1, 1, 1)\n _MetallicRoughnessSampler ("金属贴图", 2D) = "" {}\n _MetallicFactor ("金属度", Range(0, 1)) = 1\n _RoughnessFactor ("粗糙度", Range(0, 1)) = 1\n [Toggle] _SpecularAA ("高光抗锯齿", Float) = 0\n _NormalSampler ("法线贴图", 2D) = "" {}\n _NormalScale ("法线贴图强度", Range(0, 2)) = 1\n _OcclusionSampler ("AO贴图", 2D) = "" {}\n _OcclusionStrength ("AO贴图强度", Range(0, 1)) = 1\n _EmissiveSampler ("自发光贴图", 2D) = "" {}\n _EmissiveIntensity ("自发光贴图强度", Float) = 1\n _EmissiveFactor ("自发光颜色", Color) = (0, 0, 0, 1)\n _AlphaCutoff ("Alpha裁剪值", Range(0, 1)) = 0.5\n ';
|
|
14330
|
+
}
|
|
14331
|
+
function getUnlitShaderProperties() {
|
|
14332
|
+
return '\n _BaseColorSampler ("基础贴图", 2D) = "" {}\n _BaseColorFactor ("基础颜色", Color) = (1, 1, 1, 1)\n _AlphaCutoff ("Alpha裁剪值", Range(0, 1)) = 0.5\n ';
|
|
14333
|
+
}
|
|
14334
|
+
function getDefaultPBRMaterialData() {
|
|
14335
|
+
var material = {
|
|
14336
|
+
"id": "00000000000000000000000000000000",
|
|
14337
|
+
"name": "PBR Material",
|
|
14338
|
+
"dataType": spec.DataType.Material,
|
|
14339
|
+
"stringTags": {
|
|
14340
|
+
"RenderType": spec.RenderType.Opaque,
|
|
14341
|
+
"RenderFace": "Front"
|
|
14342
|
+
},
|
|
14343
|
+
"macros": [],
|
|
14344
|
+
"shader": {
|
|
14345
|
+
"id": "pbr00000000000000000000000000000"
|
|
14346
|
+
},
|
|
14347
|
+
"ints": {},
|
|
14348
|
+
"floats": {
|
|
14349
|
+
"ZWrite": 1,
|
|
14350
|
+
"ZTest": 1,
|
|
14351
|
+
"_SpecularAA": 0,
|
|
14352
|
+
"_MetallicFactor": 1,
|
|
14353
|
+
"_RoughnessFactor": 0.0,
|
|
14354
|
+
"_NormalScale": 1,
|
|
14355
|
+
"_OcclusionStrength": 1,
|
|
14356
|
+
"_EmissiveIntensity": 1,
|
|
14357
|
+
"_AlphaCutoff": 0.5
|
|
14358
|
+
},
|
|
14359
|
+
"vector4s": {},
|
|
14360
|
+
"colors": {
|
|
14361
|
+
"_BaseColorFactor": {
|
|
14362
|
+
"r": 1,
|
|
14363
|
+
"g": 1,
|
|
14364
|
+
"b": 1,
|
|
14365
|
+
"a": 1
|
|
14366
|
+
},
|
|
14367
|
+
"_EmissiveFactor": {
|
|
14368
|
+
"r": 0,
|
|
14369
|
+
"g": 0,
|
|
14370
|
+
"b": 0,
|
|
14371
|
+
"a": 1
|
|
14372
|
+
}
|
|
14373
|
+
},
|
|
14374
|
+
"textures": {}
|
|
14375
|
+
};
|
|
14376
|
+
return material;
|
|
14377
|
+
}
|
|
14378
|
+
function getDefaultUnlitMaterialData() {
|
|
14379
|
+
var material = {
|
|
14380
|
+
"id": "00000000000000000000000000000000",
|
|
14381
|
+
"name": "Unlit Material",
|
|
14382
|
+
"dataType": spec.DataType.Material,
|
|
14383
|
+
"stringTags": {
|
|
14384
|
+
"ZWrite": "true",
|
|
14385
|
+
"ZTest": "true",
|
|
14386
|
+
"RenderType": spec.RenderType.Opaque,
|
|
14387
|
+
"Cull": "Front"
|
|
14388
|
+
},
|
|
14389
|
+
"macros": [],
|
|
14390
|
+
"shader": {
|
|
14391
|
+
"id": "unlit000000000000000000000000000"
|
|
14392
|
+
},
|
|
14393
|
+
"ints": {},
|
|
14394
|
+
"floats": {
|
|
14395
|
+
"_AlphaCutoff": 0.5
|
|
14396
|
+
},
|
|
14397
|
+
"vector4s": {},
|
|
14398
|
+
"colors": {
|
|
14399
|
+
"_BaseColorFactor": {
|
|
14400
|
+
"r": 1,
|
|
14401
|
+
"g": 1,
|
|
14402
|
+
"b": 1,
|
|
14403
|
+
"a": 1
|
|
14404
|
+
}
|
|
14405
|
+
},
|
|
14406
|
+
"textures": {}
|
|
14407
|
+
};
|
|
14408
|
+
return material;
|
|
14409
|
+
}
|
|
14410
|
+
|
|
13367
14411
|
registerPlugin("tree", ModelTreePlugin, VFXItem, true);
|
|
13368
14412
|
registerPlugin("model", ModelPlugin, VFXItem);
|
|
13369
|
-
var version = "2.0.0-alpha.
|
|
13370
|
-
logger.info("
|
|
13371
|
-
if (version !== version
|
|
14413
|
+
var version = "2.0.0-alpha.19";
|
|
14414
|
+
logger.info("Plugin model version: " + version + ".");
|
|
14415
|
+
if (version !== EFFECTS.version) {
|
|
13372
14416
|
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!");
|
|
13373
14417
|
}
|
|
13374
14418
|
|
|
13375
|
-
export { AnimationComponent, Box3, BoxMesh, CameraGestureHandlerImp, CameraGestureType, CheckerHelper, Color, CompositionCache, CompositionHitTest,
|
|
14419
|
+
export { AnimationComponent, Box3, BoxMesh, CameraGestureHandlerImp, CameraGestureType, CheckerHelper, Color, CompositionCache, CompositionHitTest, DEG2RAD, Euler, EulerOrder, FBOOptions, Float16ArrayWrapper, GeometryBoxProxy, HitTestingProxy, HookOGLFunc, InterpolationSampler, JSONConverter, LoaderECSImpl, LoaderHelper, LoaderImpl, Matrix3, Matrix4, MeshHelper, ModelCameraComponent, ModelLightComponent, ModelMeshComponent, ModelPlugin, ModelPluginComponent, ModelSkyboxComponent, ModelTreeComponent, ModelTreeItem, ModelTreePlugin, PAnimInterpType, PAnimPathType, PAnimTexture, PAnimTrack, PAnimation, PAnimationManager, PBRShaderGUID, PBlendMode, PCamera, PCameraManager, PCoordinate, PEntity, PFaceSideMode, PGeometry, PGlobalState, PLight, PLightManager, PLightType, PMaterialBase, PMaterialPBR, PMaterialSkyboxFilter, PMaterialType, PMaterialUnlit, PMesh, PMorph, PObject, PObjectType, PSceneManager, PShaderManager, PShadowType, PSkin, PSkybox, PSkyboxCreator, PSkyboxType, PSubMesh, PTextureType, PTransform, PluginHelper, Quaternion, Ray, RayBoxTesting, RayIntersectsBoxWithRotation, RayTriangleTesting, Sphere, TextureDataMode, ToggleItemBounding, TwoStatesSet, UnlitShaderGUID, VFX_ITEM_TYPE_3D, Vector2, Vector3, Vector4, VertexAttribBuffer, WebGLHelper, WebHelper, createAnimationSampler, createPluginMaterial, fetchPBRShaderCode, fetchUnlitShaderCode, getDefaultEffectsGLTFLoader, getDefaultEffectsGLTFLoaderECS, getDefaultPBRMaterialData, getDefaultUnlitMaterialData, getDiffuseOnlyShaderCode, getGaussianBlurShaderCodeV1, getGaussianBlurShaderCodeV2, getGeometryDataFromOptions, getGeometryDataFromPropsList, getKawaseBlurShaderCode, getNormalVisShaderCode, getPBRPassShaderCode, getPBRShaderProperties, getPMeshList, getQuadFilterShaderCode, getRendererGPUInfo, getSceneManager, getShadowPassShaderCode, getSimpleFilterShaderCode, getSkyBoxShaderCode, getTransparecyBaseShader, getTransparecyFilterShader, getUnlitShaderProperties, setDefaultEffectsGLTFLoader, setDefaultEffectsGLTFLoaderECS, version };
|
|
13376
14420
|
//# sourceMappingURL=index.mjs.map
|