@galacean/effects-plugin-model 2.0.0-alpha.20 → 2.0.0-alpha.22
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 +197 -1663
- package/dist/alipay.js.map +1 -1
- package/dist/alipay.mjs +198 -1661
- package/dist/alipay.mjs.map +1 -1
- package/dist/gltf/index.d.ts +1 -2
- package/dist/gltf/loader-ext.d.ts +5 -36
- package/dist/gltf/loader-impl.d.ts +61 -63
- package/dist/gltf/protocol.d.ts +42 -38
- package/dist/helper/index.d.ts +0 -1
- package/dist/index.js +198 -1664
- 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 +199 -1662
- package/dist/index.mjs.map +1 -1
- package/dist/loader.mjs +9032 -10495
- package/dist/loader.mjs.map +1 -1
- package/dist/runtime/skybox.d.ts +3 -3
- package/package.json +5 -5
- package/dist/gltf/loader-ecs-ext.d.ts +0 -18
- package/dist/gltf/loader-ecs.d.ts +0 -121
package/dist/alipay.js
CHANGED
|
@@ -2424,7 +2424,7 @@ function _assert_this_initialized(self) {
|
|
|
2424
2424
|
get: /**
|
|
2425
2425
|
* 获取顶点着色器代码
|
|
2426
2426
|
*/ function get() {
|
|
2427
|
-
return "\n
|
|
2427
|
+
return "\n precision highp float;\n\n uniform mat4 _ModelMatrix;\n uniform mat4 _ViewProjectionMatrix;\n uniform vec3 _PositionList[8];\n attribute vec3 aPos;\n void main(){\n int index = int(aPos.x + 0.5);\n vec4 pos = _ModelMatrix * vec4(_PositionList[index], 1);\n gl_Position = _ViewProjectionMatrix * pos;\n }\n ";
|
|
2428
2428
|
}
|
|
2429
2429
|
},
|
|
2430
2430
|
{
|
|
@@ -2432,7 +2432,7 @@ function _assert_this_initialized(self) {
|
|
|
2432
2432
|
get: /**
|
|
2433
2433
|
* 获取片段着色器代码
|
|
2434
2434
|
*/ function get() {
|
|
2435
|
-
return "\n
|
|
2435
|
+
return "\n precision highp float;\n\n uniform vec3 _LineColor;\n void main(){\n gl_FragColor = vec4(_LineColor, 1);\n }\n ";
|
|
2436
2436
|
}
|
|
2437
2437
|
},
|
|
2438
2438
|
{
|
|
@@ -3830,11 +3830,18 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3830
3830
|
return a.priority - b.priority;
|
|
3831
3831
|
}
|
|
3832
3832
|
});
|
|
3833
|
+
var prePriority = -99999;
|
|
3833
3834
|
// 重新赋值渲染优先级
|
|
3834
3835
|
for(var i = 0; i < meshComponents.length; i++){
|
|
3835
3836
|
var mesh = meshComponents[i];
|
|
3836
3837
|
var priority = priorityList[i];
|
|
3837
|
-
|
|
3838
|
+
if (prePriority < priority) {
|
|
3839
|
+
prePriority = priority;
|
|
3840
|
+
mesh.priority = priority;
|
|
3841
|
+
} else {
|
|
3842
|
+
prePriority += 0.1;
|
|
3843
|
+
mesh.priority = prePriority;
|
|
3844
|
+
}
|
|
3838
3845
|
}
|
|
3839
3846
|
};
|
|
3840
3847
|
/**
|
|
@@ -9015,10 +9022,10 @@ exports.PSkyboxType = void 0;
|
|
|
9015
9022
|
* @param engine - 引擎
|
|
9016
9023
|
* @param params - 天空盒参数
|
|
9017
9024
|
* @returns 天空盒选项
|
|
9018
|
-
*/ PSkyboxCreator.createSkyboxComponentData = function createSkyboxComponentData(
|
|
9025
|
+
*/ PSkyboxCreator.createSkyboxComponentData = function createSkyboxComponentData(params) {
|
|
9019
9026
|
var _imageList;
|
|
9020
|
-
var specularCubeData =
|
|
9021
|
-
var diffuseCubeData =
|
|
9027
|
+
var specularCubeData = PSkyboxCreator.getSpecularCubeMapData(params);
|
|
9028
|
+
var diffuseCubeData = PSkyboxCreator.getDiffuseCubeMapData(params);
|
|
9022
9029
|
var renderable = params.renderable, intensity = params.intensity, reflectionsIntensity = params.reflectionsIntensity, irradianceCoeffs = params.irradianceCoeffs, specularImageSize = params.specularImageSize, specularMipCount = params.specularMipCount;
|
|
9023
9030
|
var diffuseImage;
|
|
9024
9031
|
var imageList = [];
|
|
@@ -9087,7 +9094,7 @@ exports.PSkyboxType = void 0;
|
|
|
9087
9094
|
});
|
|
9088
9095
|
})();
|
|
9089
9096
|
};
|
|
9090
|
-
PSkyboxCreator.getSpecularCubeMapData = function getSpecularCubeMapData(
|
|
9097
|
+
PSkyboxCreator.getSpecularCubeMapData = function getSpecularCubeMapData(params) {
|
|
9091
9098
|
var imageDatas = [];
|
|
9092
9099
|
var mipmaps = [];
|
|
9093
9100
|
params.specularImage.forEach(function(cubemap) {
|
|
@@ -9146,7 +9153,7 @@ exports.PSkyboxType = void 0;
|
|
|
9146
9153
|
});
|
|
9147
9154
|
})();
|
|
9148
9155
|
};
|
|
9149
|
-
PSkyboxCreator.getDiffuseCubeMapData = function getDiffuseCubeMapData(
|
|
9156
|
+
PSkyboxCreator.getDiffuseCubeMapData = function getDiffuseCubeMapData(params) {
|
|
9150
9157
|
if (params.diffuseImage === undefined) {
|
|
9151
9158
|
return;
|
|
9152
9159
|
}
|
|
@@ -10645,1497 +10652,120 @@ var LoaderHelper = /*#__PURE__*/ function() {
|
|
|
10645
10652
|
return LoaderHelper;
|
|
10646
10653
|
}();
|
|
10647
10654
|
|
|
10648
|
-
var
|
|
10649
|
-
function
|
|
10650
|
-
|
|
10651
|
-
|
|
10655
|
+
var JSONConverter = /*#__PURE__*/ function() {
|
|
10656
|
+
function JSONConverter(player) {
|
|
10657
|
+
this.treeInfo = new TreeInfo();
|
|
10658
|
+
this.engine = player.renderer.engine;
|
|
10659
|
+
this.renderer = player.renderer;
|
|
10660
|
+
this.downloader = new EFFECTS.Downloader();
|
|
10652
10661
|
}
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
}
|
|
10656
|
-
function setDefaultEffectsGLTFLoader(loader) {
|
|
10657
|
-
globalGLTFLoader = loader;
|
|
10658
|
-
}
|
|
10659
|
-
var LoaderImpl = /*#__PURE__*/ function() {
|
|
10660
|
-
function LoaderImpl() {}
|
|
10661
|
-
var _proto = LoaderImpl.prototype;
|
|
10662
|
-
_proto.initial = function initial(engine, options) {
|
|
10663
|
-
this.engine = engine;
|
|
10664
|
-
this._loaderOptions = options != null ? options : {};
|
|
10665
|
-
};
|
|
10666
|
-
_proto.processLight = function processLight(lights, fromGLTF) {
|
|
10667
|
-
var _this = this;
|
|
10668
|
-
lights.forEach(function(l) {
|
|
10669
|
-
if (l.color === undefined) {
|
|
10670
|
-
if (fromGLTF) {
|
|
10671
|
-
l.color = [
|
|
10672
|
-
255,
|
|
10673
|
-
255,
|
|
10674
|
-
255,
|
|
10675
|
-
255
|
|
10676
|
-
];
|
|
10677
|
-
} else {
|
|
10678
|
-
l.color = [
|
|
10679
|
-
1,
|
|
10680
|
-
1,
|
|
10681
|
-
1,
|
|
10682
|
-
1
|
|
10683
|
-
];
|
|
10684
|
-
}
|
|
10685
|
-
} else {
|
|
10686
|
-
l.color[0] = _this.scaleColorVal(l.color[0], fromGLTF);
|
|
10687
|
-
l.color[1] = _this.scaleColorVal(l.color[1], fromGLTF);
|
|
10688
|
-
l.color[2] = _this.scaleColorVal(l.color[2], fromGLTF);
|
|
10689
|
-
l.color[3] = _this.scaleColorVal(l.color[3], fromGLTF);
|
|
10690
|
-
}
|
|
10691
|
-
});
|
|
10692
|
-
};
|
|
10693
|
-
_proto.processCamera = function processCamera(cameras, fromGLTF) {
|
|
10694
|
-
var scale = fromGLTF ? 180.0 / Math.PI : Math.PI / 180.0;
|
|
10695
|
-
cameras.forEach(function(camera) {
|
|
10696
|
-
if (camera.perspective !== undefined) {
|
|
10697
|
-
camera.perspective.yfov *= scale;
|
|
10698
|
-
}
|
|
10699
|
-
});
|
|
10700
|
-
};
|
|
10701
|
-
_proto.processMaterial = function processMaterial(materials, fromGLTF) {
|
|
10702
|
-
var _this = this;
|
|
10703
|
-
materials.forEach(function(mat) {
|
|
10704
|
-
if (mat.baseColorFactor === undefined) {
|
|
10705
|
-
if (fromGLTF) {
|
|
10706
|
-
mat.baseColorFactor = [
|
|
10707
|
-
255,
|
|
10708
|
-
255,
|
|
10709
|
-
255,
|
|
10710
|
-
255
|
|
10711
|
-
];
|
|
10712
|
-
} else {
|
|
10713
|
-
mat.baseColorFactor = [
|
|
10714
|
-
1,
|
|
10715
|
-
1,
|
|
10716
|
-
1,
|
|
10717
|
-
1
|
|
10718
|
-
];
|
|
10719
|
-
}
|
|
10720
|
-
} else {
|
|
10721
|
-
mat.baseColorFactor[0] = _this.scaleColorVal(mat.baseColorFactor[0], fromGLTF);
|
|
10722
|
-
mat.baseColorFactor[1] = _this.scaleColorVal(mat.baseColorFactor[1], fromGLTF);
|
|
10723
|
-
mat.baseColorFactor[2] = _this.scaleColorVal(mat.baseColorFactor[2], fromGLTF);
|
|
10724
|
-
mat.baseColorFactor[3] = _this.scaleColorVal(mat.baseColorFactor[3], fromGLTF);
|
|
10725
|
-
}
|
|
10726
|
-
if (mat.emissiveFactor === undefined) {
|
|
10727
|
-
if (fromGLTF) {
|
|
10728
|
-
mat.emissiveFactor = [
|
|
10729
|
-
255,
|
|
10730
|
-
255,
|
|
10731
|
-
255,
|
|
10732
|
-
255
|
|
10733
|
-
];
|
|
10734
|
-
} else {
|
|
10735
|
-
mat.emissiveFactor = [
|
|
10736
|
-
1,
|
|
10737
|
-
1,
|
|
10738
|
-
1,
|
|
10739
|
-
1
|
|
10740
|
-
];
|
|
10741
|
-
}
|
|
10742
|
-
} else {
|
|
10743
|
-
mat.emissiveFactor[0] = _this.scaleColorVal(mat.emissiveFactor[0], fromGLTF);
|
|
10744
|
-
mat.emissiveFactor[1] = _this.scaleColorVal(mat.emissiveFactor[1], fromGLTF);
|
|
10745
|
-
mat.emissiveFactor[2] = _this.scaleColorVal(mat.emissiveFactor[2], fromGLTF);
|
|
10746
|
-
mat.emissiveFactor[3] = _this.scaleColorVal(mat.emissiveFactor[3], fromGLTF);
|
|
10747
|
-
}
|
|
10748
|
-
if (fromGLTF && mat.occlusionTexture !== undefined && mat.occlusionTexture.strength === undefined) {
|
|
10749
|
-
mat.occlusionTexture.strength = _this.isTiny3dMode() ? 0 : 1;
|
|
10750
|
-
}
|
|
10751
|
-
});
|
|
10752
|
-
};
|
|
10753
|
-
_proto.createTreeOptions = function createTreeOptions(scene) {
|
|
10754
|
-
var nodeList = scene.nodes.map(function(node, nodeIndex) {
|
|
10755
|
-
var children = node.children.map(function(child) {
|
|
10756
|
-
if (child.nodeIndex === undefined) {
|
|
10757
|
-
throw new Error("Undefined nodeIndex for child " + child + ".");
|
|
10758
|
-
}
|
|
10759
|
-
return child.nodeIndex;
|
|
10760
|
-
});
|
|
10761
|
-
var pos;
|
|
10762
|
-
var quat;
|
|
10763
|
-
var scale;
|
|
10764
|
-
if (node.matrix !== undefined) {
|
|
10765
|
-
if (node.matrix.length !== 16) {
|
|
10766
|
-
throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node + ".");
|
|
10767
|
-
}
|
|
10768
|
-
var mat = Matrix4.fromArray(node.matrix);
|
|
10769
|
-
var transform = mat.getTransform();
|
|
10770
|
-
pos = transform.translation.toArray();
|
|
10771
|
-
quat = transform.rotation.toArray();
|
|
10772
|
-
scale = transform.scale.toArray();
|
|
10773
|
-
} else {
|
|
10774
|
-
if (node.translation !== undefined) {
|
|
10775
|
-
pos = node.translation;
|
|
10776
|
-
}
|
|
10777
|
-
if (node.rotation !== undefined) {
|
|
10778
|
-
quat = node.rotation;
|
|
10779
|
-
}
|
|
10780
|
-
if (node.scale !== undefined) {
|
|
10781
|
-
scale = node.scale;
|
|
10782
|
-
}
|
|
10783
|
-
}
|
|
10784
|
-
node.nodeIndex = nodeIndex;
|
|
10785
|
-
var treeNode = {
|
|
10786
|
-
name: node.name,
|
|
10787
|
-
transform: {
|
|
10788
|
-
position: pos,
|
|
10789
|
-
quat: quat,
|
|
10790
|
-
scale: scale
|
|
10791
|
-
},
|
|
10792
|
-
children: children,
|
|
10793
|
-
id: "" + node.nodeIndex
|
|
10794
|
-
};
|
|
10795
|
-
return treeNode;
|
|
10796
|
-
});
|
|
10797
|
-
var rootNodes = scene.rootNodes.map(function(root) {
|
|
10798
|
-
if (root.nodeIndex === undefined) {
|
|
10799
|
-
throw new Error("Undefined nodeIndex for root " + root + ".");
|
|
10800
|
-
}
|
|
10801
|
-
return root.nodeIndex;
|
|
10802
|
-
});
|
|
10803
|
-
var treeOptions = {
|
|
10804
|
-
nodes: nodeList,
|
|
10805
|
-
children: rootNodes,
|
|
10806
|
-
animation: -1,
|
|
10807
|
-
animations: []
|
|
10808
|
-
};
|
|
10809
|
-
return treeOptions;
|
|
10810
|
-
};
|
|
10811
|
-
_proto.createAnimations = function createAnimations(animations) {
|
|
10812
|
-
return animations.map(function(anim) {
|
|
10813
|
-
var tracks = anim.channels.map(function(channel) {
|
|
10814
|
-
var track = {
|
|
10815
|
-
input: channel.input.array,
|
|
10816
|
-
output: channel.output.array,
|
|
10817
|
-
node: channel.target.node,
|
|
10818
|
-
path: channel.target.path,
|
|
10819
|
-
interpolation: channel.interpolation
|
|
10820
|
-
};
|
|
10821
|
-
return track;
|
|
10822
|
-
});
|
|
10823
|
-
var newAnim = {
|
|
10824
|
-
name: anim.name,
|
|
10825
|
-
tracks: tracks
|
|
10826
|
-
};
|
|
10827
|
-
return newAnim;
|
|
10828
|
-
});
|
|
10829
|
-
};
|
|
10830
|
-
_proto.createGeometry = function createGeometry(primitive, hasSkinAnim) {
|
|
10831
|
-
var proxy = new GeometryProxy(this.engine, primitive, hasSkinAnim);
|
|
10832
|
-
return proxy.geometry;
|
|
10833
|
-
};
|
|
10834
|
-
_proto.createMaterial = function createMaterial(material) {
|
|
10835
|
-
var proxy = new MaterialProxy(material, [], this.isTiny3dMode());
|
|
10836
|
-
return proxy.material;
|
|
10837
|
-
};
|
|
10838
|
-
_proto.createTexture2D = function createTexture2D(image, texture, isBaseColor) {
|
|
10839
|
-
return WebGLHelper.createTexture2D(this.engine, image, texture, isBaseColor, this.isTiny3dMode());
|
|
10840
|
-
};
|
|
10841
|
-
_proto.createTextureCube = function createTextureCube(cubeImages, level0Size) {
|
|
10842
|
-
var _this = this;
|
|
10843
|
-
if (cubeImages.length == 0) {
|
|
10844
|
-
throw new Error("createTextureCube: Invalid cubeImages length " + cubeImages + ".");
|
|
10845
|
-
}
|
|
10846
|
-
var mipmaps = [];
|
|
10847
|
-
cubeImages.forEach(function(cubeImage) {
|
|
10848
|
-
if (cubeImage.length != 6) {
|
|
10849
|
-
throw new Error("createTextureCube: cubeimage count should always be 6, " + cubeImage + ".");
|
|
10850
|
-
}
|
|
10851
|
-
//
|
|
10852
|
-
var imgList = [];
|
|
10853
|
-
cubeImage.forEach(function(img) {
|
|
10854
|
-
if (img.imageData === undefined) {
|
|
10855
|
-
throw new Error("createTextureCube: Invalid image data from " + img + ".");
|
|
10856
|
-
}
|
|
10857
|
-
//
|
|
10858
|
-
imgList.push({
|
|
10859
|
-
type: "buffer",
|
|
10860
|
-
data: img.imageData,
|
|
10861
|
-
mimeType: img.mimeType
|
|
10862
|
-
});
|
|
10863
|
-
});
|
|
10864
|
-
if (_this.isTiny3dMode()) {
|
|
10865
|
-
var ref;
|
|
10866
|
-
ref = [
|
|
10867
|
-
imgList[5],
|
|
10868
|
-
imgList[4]
|
|
10869
|
-
], imgList[4] = ref[0], imgList[5] = ref[1];
|
|
10870
|
-
}
|
|
10871
|
-
mipmaps.push(imgList);
|
|
10872
|
-
});
|
|
10873
|
-
//
|
|
10874
|
-
if (mipmaps.length == 1) {
|
|
10875
|
-
// no mipmaps
|
|
10876
|
-
return WebGLHelper.createTextureCubeFromBuffer(this.engine, mipmaps[0]);
|
|
10877
|
-
} else {
|
|
10878
|
-
// has mipmaps
|
|
10879
|
-
return WebGLHelper.createTextureCubeMipmapFromBuffer(this.engine, mipmaps, level0Size != null ? level0Size : Math.pow(2, mipmaps.length - 1));
|
|
10880
|
-
}
|
|
10881
|
-
};
|
|
10882
|
-
_proto.createSkybox = function createSkybox(ibl) {
|
|
10883
|
-
var _this = this;
|
|
10884
|
-
var _ibl_reflectionsIntensity;
|
|
10885
|
-
var reflectionsIntensity = (_ibl_reflectionsIntensity = ibl.reflectionsIntensity) != null ? _ibl_reflectionsIntensity : ibl.intensity;
|
|
10886
|
-
var irradianceCoeffs = ibl.irradianceCoefficients;
|
|
10887
|
-
var inSpecularImages = ibl.specularImages;
|
|
10888
|
-
var specularImages = inSpecularImages.map(function(images) {
|
|
10889
|
-
var newImages = images.map(function(img) {
|
|
10890
|
-
var outImg = {
|
|
10891
|
-
type: "buffer",
|
|
10892
|
-
data: img.imageData,
|
|
10893
|
-
mimeType: img.mimeType
|
|
10894
|
-
};
|
|
10895
|
-
return outImg;
|
|
10896
|
-
});
|
|
10897
|
-
if (_this.isTiny3dMode()) {
|
|
10898
|
-
var ref;
|
|
10899
|
-
ref = [
|
|
10900
|
-
newImages[5],
|
|
10901
|
-
newImages[4]
|
|
10902
|
-
], newImages[4] = ref[0], newImages[5] = ref[1];
|
|
10903
|
-
}
|
|
10904
|
-
return newImages;
|
|
10905
|
-
});
|
|
10906
|
-
var specularMipCount = specularImages.length;
|
|
10907
|
-
var _ibl_specularImageSize;
|
|
10908
|
-
var specularImageSize = (_ibl_specularImageSize = ibl.specularImageSize) != null ? _ibl_specularImageSize : Math.pow(2, specularMipCount - 1);
|
|
10909
|
-
var params = {
|
|
10910
|
-
type: "buffer",
|
|
10911
|
-
renderable: this.isSkyboxVis(),
|
|
10912
|
-
intensity: ibl.intensity,
|
|
10913
|
-
reflectionsIntensity: reflectionsIntensity,
|
|
10914
|
-
irradianceCoeffs: irradianceCoeffs,
|
|
10915
|
-
specularImage: specularImages,
|
|
10916
|
-
specularMipCount: specularMipCount,
|
|
10917
|
-
specularImageSize: specularImageSize
|
|
10918
|
-
};
|
|
10919
|
-
return PSkyboxCreator.createSkyboxOptions(this.engine, params);
|
|
10920
|
-
};
|
|
10921
|
-
_proto.createDefaultSkybox = function createDefaultSkybox(typeName) {
|
|
10922
|
-
if (typeName !== "NFT" && typeName !== "FARM") {
|
|
10923
|
-
throw new Error("Invalid skybox type specified: '" + typeName + "'. Valid types are: 'NFT', 'FARM'.");
|
|
10924
|
-
}
|
|
10925
|
-
//
|
|
10926
|
-
var typ = typeName === "NFT" ? exports.PSkyboxType.NFT : exports.PSkyboxType.FARM;
|
|
10927
|
-
var params = PSkyboxCreator.getSkyboxParams(typ);
|
|
10928
|
-
return PSkyboxCreator.createSkyboxOptions(this.engine, params);
|
|
10929
|
-
};
|
|
10930
|
-
_proto.scaleColorVal = function scaleColorVal(val, fromGLTF) {
|
|
10931
|
-
return fromGLTF ? LoaderHelper.scaleTo255(val) : LoaderHelper.scaleTo1(val);
|
|
10932
|
-
};
|
|
10933
|
-
_proto.scaleColorVec = function scaleColorVec(vec, fromGLTF) {
|
|
10934
|
-
var _this = this;
|
|
10935
|
-
return vec.map(function(val) {
|
|
10936
|
-
return _this.scaleColorVal(val, fromGLTF);
|
|
10937
|
-
});
|
|
10938
|
-
};
|
|
10939
|
-
_proto.loadScene = function loadScene(options) {
|
|
10662
|
+
var _proto = JSONConverter.prototype;
|
|
10663
|
+
_proto.processScene = function processScene(sceneData) {
|
|
10940
10664
|
var _this = this;
|
|
10941
10665
|
return _async_to_generator(function() {
|
|
10942
|
-
var
|
|
10666
|
+
var sceneJSON, _tmp, oldScene, binFiles, _iterator, _step, bin, _, newScene;
|
|
10943
10667
|
return __generator(this, function(_state) {
|
|
10944
10668
|
switch(_state.label){
|
|
10945
10669
|
case 0:
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
_this._loaderOptions = {
|
|
10950
|
-
compatibleMode: options.gltf.compatibleMode
|
|
10951
|
-
};
|
|
10952
|
-
gltfResource = options.gltf.resource;
|
|
10953
|
-
if (typeof gltfResource === "string" || _instanceof1(gltfResource, Uint8Array)) {
|
|
10954
|
-
throw new Error("Please load the resource using GLTFTools first.");
|
|
10955
|
-
}
|
|
10956
|
-
_this._gltfScene = gltfResource.scenes[0];
|
|
10957
|
-
_this._gltfSkins = _this._gltfScene.skins;
|
|
10958
|
-
_this._gltfMeshs = gltfResource.meshes;
|
|
10959
|
-
_this._gltfLights = _this._gltfScene.lights;
|
|
10960
|
-
_this._gltfCameras = _this._gltfScene.cameras;
|
|
10961
|
-
_this._gltfImages = gltfResource.images;
|
|
10962
|
-
_this._gltfTextures = gltfResource.textures;
|
|
10963
|
-
_this._gltfMaterials = gltfResource.materials;
|
|
10964
|
-
_this._gltfAnimations = gltfResource.animations;
|
|
10965
|
-
_this._gltfImageBasedLights = gltfResource.imageBasedLights;
|
|
10966
|
-
return [
|
|
10967
|
-
4,
|
|
10968
|
-
_this._preprocess()
|
|
10670
|
+
if (!EFFECTS.isObject(sceneData)) return [
|
|
10671
|
+
3,
|
|
10672
|
+
1
|
|
10969
10673
|
];
|
|
10970
|
-
|
|
10971
|
-
_state.sent();
|
|
10972
|
-
modelItems = [];
|
|
10973
|
-
treeId = "sceneTree";
|
|
10974
|
-
modelItems.push(_this._createItemTree(treeId, _this._gltfScene));
|
|
10975
|
-
//
|
|
10976
|
-
itemSkybox = _this._createItemSkybox();
|
|
10977
|
-
if (itemSkybox !== undefined) {
|
|
10978
|
-
modelItems.push(itemSkybox);
|
|
10979
|
-
}
|
|
10980
|
-
_this._gltfScene.nodes.forEach(function(node) {
|
|
10981
|
-
if (node.mesh !== undefined) {
|
|
10982
|
-
var itemMesh = _this._createItemMesh(node, treeId);
|
|
10983
|
-
if (itemMesh !== undefined) {
|
|
10984
|
-
modelItems.push(itemMesh);
|
|
10985
|
-
}
|
|
10986
|
-
}
|
|
10987
|
-
if (node.light !== undefined) {
|
|
10988
|
-
var itemLight = _this._createItemLight(node, treeId);
|
|
10989
|
-
if (itemLight !== undefined) {
|
|
10990
|
-
modelItems.push(itemLight);
|
|
10991
|
-
}
|
|
10992
|
-
}
|
|
10993
|
-
if (node.camera !== undefined) {
|
|
10994
|
-
var itemCamera = _this._createItemCamera(node, treeId);
|
|
10995
|
-
if (itemCamera !== undefined) {
|
|
10996
|
-
modelItems.push(itemCamera);
|
|
10997
|
-
}
|
|
10998
|
-
}
|
|
10999
|
-
});
|
|
11000
|
-
sceneAABB = new Box3();
|
|
11001
|
-
_this._gltfScene.rootNodes.forEach(function(root) {
|
|
11002
|
-
var parentTransform = new EFFECTS.Transform({
|
|
11003
|
-
valid: true
|
|
11004
|
-
});
|
|
11005
|
-
_this._computeSceneAABB(root, parentTransform, sceneAABB);
|
|
11006
|
-
});
|
|
10674
|
+
_tmp = sceneData;
|
|
11007
10675
|
return [
|
|
11008
|
-
2,
|
|
11009
|
-
{
|
|
11010
|
-
source: _this.getRemarkString(),
|
|
11011
|
-
items: modelItems,
|
|
11012
|
-
sceneAABB: {
|
|
11013
|
-
min: sceneAABB.min.toArray(),
|
|
11014
|
-
max: sceneAABB.max.toArray()
|
|
11015
|
-
}
|
|
11016
|
-
}
|
|
11017
|
-
];
|
|
11018
|
-
}
|
|
11019
|
-
});
|
|
11020
|
-
})();
|
|
11021
|
-
};
|
|
11022
|
-
_proto._preprocess = function _preprocess() {
|
|
11023
|
-
var _this = this;
|
|
11024
|
-
return _async_to_generator(function() {
|
|
11025
|
-
var i, mat, ibl, inSpecularImages, skyboxType, typeName;
|
|
11026
|
-
return __generator(this, function(_state) {
|
|
11027
|
-
switch(_state.label){
|
|
11028
|
-
case 0:
|
|
11029
|
-
_this.getTextureManager().initial(_this._gltfImages, _this._gltfTextures);
|
|
11030
|
-
i = 0;
|
|
11031
|
-
_state.label = 1;
|
|
11032
|
-
case 1:
|
|
11033
|
-
if (!(i < _this._gltfMaterials.length)) return [
|
|
11034
10676
|
3,
|
|
11035
|
-
|
|
10677
|
+
3
|
|
11036
10678
|
];
|
|
11037
|
-
|
|
10679
|
+
case 1:
|
|
11038
10680
|
return [
|
|
11039
10681
|
4,
|
|
11040
|
-
_this.
|
|
10682
|
+
_this.loadJSON(sceneData)
|
|
11041
10683
|
];
|
|
11042
10684
|
case 2:
|
|
11043
|
-
_state.sent();
|
|
11044
|
-
|
|
10685
|
+
_tmp = _state.sent();
|
|
10686
|
+
_state.label = 3;
|
|
10687
|
+
case 3:
|
|
10688
|
+
sceneJSON = _tmp;
|
|
10689
|
+
// @ts-expect-error
|
|
10690
|
+
sceneJSON.textures.forEach(function(tex) {
|
|
10691
|
+
if (tex.source === undefined) {
|
|
10692
|
+
tex.source = 0;
|
|
10693
|
+
}
|
|
10694
|
+
});
|
|
10695
|
+
oldScene = EFFECTS.getStandardJSON(sceneJSON);
|
|
10696
|
+
binFiles = [];
|
|
10697
|
+
if (!oldScene.bins) return [
|
|
11045
10698
|
3,
|
|
11046
10699
|
7
|
|
11047
10700
|
];
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
_this.tryAddTexture2D(i, mat.metallicRoughnessTexture, false)
|
|
11051
|
-
];
|
|
11052
|
-
case 3:
|
|
11053
|
-
_state.sent();
|
|
11054
|
-
return [
|
|
11055
|
-
4,
|
|
11056
|
-
_this.tryAddTexture2D(i, mat.normalTexture, false)
|
|
11057
|
-
];
|
|
10701
|
+
_iterator = _create_for_of_iterator_helper_loose(oldScene.bins);
|
|
10702
|
+
_state.label = 4;
|
|
11058
10703
|
case 4:
|
|
11059
|
-
|
|
11060
|
-
return [
|
|
11061
|
-
4,
|
|
11062
|
-
_this.tryAddTexture2D(i, mat.emissiveTexture, false)
|
|
11063
|
-
];
|
|
11064
|
-
case 5:
|
|
11065
|
-
_state.sent();
|
|
11066
|
-
return [
|
|
11067
|
-
4,
|
|
11068
|
-
_this.tryAddTexture2D(i, mat.occlusionTexture, false)
|
|
11069
|
-
];
|
|
11070
|
-
case 6:
|
|
11071
|
-
_state.sent();
|
|
11072
|
-
_state.label = 7;
|
|
11073
|
-
case 7:
|
|
11074
|
-
i++;
|
|
11075
|
-
return [
|
|
11076
|
-
3,
|
|
11077
|
-
1
|
|
11078
|
-
];
|
|
11079
|
-
case 8:
|
|
11080
|
-
if (!(_this._gltfImageBasedLights.length > 0 && !_this.ignoreSkybox())) return [
|
|
10704
|
+
if (!!(_step = _iterator()).done) return [
|
|
11081
10705
|
3,
|
|
11082
|
-
|
|
10706
|
+
7
|
|
11083
10707
|
];
|
|
11084
|
-
|
|
11085
|
-
|
|
11086
|
-
inSpecularImages = ibl.specularImages;
|
|
11087
|
-
inSpecularImages.forEach(function(images) {
|
|
11088
|
-
if (_this.isTiny3dMode()) {
|
|
11089
|
-
var ref;
|
|
11090
|
-
ref = [
|
|
11091
|
-
images[5],
|
|
11092
|
-
images[4]
|
|
11093
|
-
], images[4] = ref[0], images[5] = ref[1];
|
|
11094
|
-
}
|
|
11095
|
-
var ref1;
|
|
11096
|
-
ref1 = [
|
|
11097
|
-
images[3],
|
|
11098
|
-
images[2]
|
|
11099
|
-
], images[2] = ref1[0], images[3] = ref1[1];
|
|
11100
|
-
});
|
|
11101
|
-
}
|
|
10708
|
+
bin = _step.value;
|
|
10709
|
+
_ = binFiles.push;
|
|
11102
10710
|
return [
|
|
11103
10711
|
4,
|
|
11104
|
-
_this.
|
|
10712
|
+
_this.loadBins(bin.url)
|
|
11105
10713
|
];
|
|
11106
|
-
case
|
|
11107
|
-
|
|
10714
|
+
case 5:
|
|
10715
|
+
_.apply(binFiles, [
|
|
10716
|
+
_state.sent()
|
|
10717
|
+
]);
|
|
10718
|
+
_state.label = 6;
|
|
10719
|
+
case 6:
|
|
11108
10720
|
return [
|
|
11109
10721
|
3,
|
|
11110
|
-
|
|
11111
|
-
];
|
|
11112
|
-
case 10:
|
|
11113
|
-
skyboxType = _this.getSkyboxType();
|
|
11114
|
-
if (!(skyboxType !== undefined)) return [
|
|
11115
|
-
3,
|
|
11116
|
-
12
|
|
10722
|
+
4
|
|
11117
10723
|
];
|
|
11118
|
-
|
|
10724
|
+
case 7:
|
|
10725
|
+
// @ts-expect-error
|
|
10726
|
+
oldScene.bins = binFiles;
|
|
10727
|
+
newScene = _extends({}, oldScene, {
|
|
10728
|
+
version: "3.0",
|
|
10729
|
+
playerVersion: {
|
|
10730
|
+
web: "3.0",
|
|
10731
|
+
native: "3.0"
|
|
10732
|
+
},
|
|
10733
|
+
type: "ge",
|
|
10734
|
+
compositions: [],
|
|
10735
|
+
images: [],
|
|
10736
|
+
textures: [],
|
|
10737
|
+
items: [],
|
|
10738
|
+
components: [],
|
|
10739
|
+
materials: [],
|
|
10740
|
+
shaders: [],
|
|
10741
|
+
geometries: []
|
|
10742
|
+
});
|
|
10743
|
+
_this.setImage(newScene, oldScene);
|
|
11119
10744
|
return [
|
|
11120
10745
|
4,
|
|
11121
|
-
_this.
|
|
10746
|
+
_this.setTexture(newScene, oldScene)
|
|
11122
10747
|
];
|
|
11123
|
-
case
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
_this._skyboxOptions.renderable = _this.isSkyboxVis();
|
|
11129
|
-
}
|
|
11130
|
-
//
|
|
11131
|
-
_this._gltfData2PlayerData(_this._gltfScene, _this._gltfMaterials);
|
|
10748
|
+
case 8:
|
|
10749
|
+
_state.sent();
|
|
10750
|
+
_this.setComponent(newScene, oldScene);
|
|
10751
|
+
_this.setItem(newScene, oldScene);
|
|
10752
|
+
_this.setComposition(newScene, oldScene);
|
|
11132
10753
|
return [
|
|
11133
|
-
2
|
|
10754
|
+
2,
|
|
10755
|
+
newScene
|
|
11134
10756
|
];
|
|
11135
10757
|
}
|
|
11136
10758
|
});
|
|
11137
10759
|
})();
|
|
11138
10760
|
};
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
return;
|
|
11144
|
-
}
|
|
11145
|
-
var cacheTex = this.getTexture2D(matIndex, texInfo, isBaseColor, true);
|
|
11146
|
-
if (cacheTex !== undefined) {
|
|
11147
|
-
return;
|
|
11148
|
-
}
|
|
11149
|
-
//
|
|
11150
|
-
var texIndex = texInfo.index;
|
|
11151
|
-
var tex = this._gltfTextures[texIndex];
|
|
11152
|
-
var img = this._gltfImages[tex.source];
|
|
11153
|
-
return WebGLHelper.createTexture2D(this.engine, img, tex, isBaseColor, this.isTiny3dMode()).then(function(tex) {
|
|
11154
|
-
_this.getTextureManager().addTexture(matIndex, texIndex, tex, isBaseColor);
|
|
10761
|
+
_proto.setImage = function setImage(newScene, oldScene) {
|
|
10762
|
+
var newImages = [];
|
|
10763
|
+
oldScene.images.forEach(function(image) {
|
|
10764
|
+
newImages.push(image);
|
|
11155
10765
|
});
|
|
10766
|
+
newScene.images = newImages;
|
|
11156
10767
|
};
|
|
11157
|
-
|
|
11158
|
-
_proto.getTexture2D = function getTexture2D(matIndex, texInfo, isBaseColor, noWarning) {
|
|
11159
|
-
if (texInfo === undefined) {
|
|
11160
|
-
return;
|
|
11161
|
-
}
|
|
11162
|
-
var texIndex = texInfo.index;
|
|
11163
|
-
var tex = this.getTextureManager().getTexture(matIndex, texIndex, isBaseColor);
|
|
11164
|
-
if (tex === undefined && noWarning !== true) {
|
|
11165
|
-
console.warn("Can't find texture for mat " + matIndex + ", tex " + JSON.stringify(texInfo) + ", basecolor " + isBaseColor + ".");
|
|
11166
|
-
}
|
|
11167
|
-
return tex;
|
|
11168
|
-
};
|
|
11169
|
-
_proto._gltfData2PlayerData = function _gltfData2PlayerData(scene, materials) {
|
|
11170
|
-
this.processCamera(scene.cameras, true);
|
|
11171
|
-
this.processLight(scene.lights, true);
|
|
11172
|
-
this.processMaterial(materials, true);
|
|
11173
|
-
};
|
|
11174
|
-
_proto._createItemTree = function _createItemTree(treeId, scene) {
|
|
11175
|
-
var treeOptions = this.createTreeOptions(scene);
|
|
11176
|
-
var animOptions = this.createAnimations(this._gltfAnimations);
|
|
11177
|
-
treeOptions.animations = animOptions;
|
|
11178
|
-
treeOptions.animation = this.getPlayAnimationIndex(treeOptions);
|
|
11179
|
-
var itemTree = {
|
|
11180
|
-
id: treeId,
|
|
11181
|
-
name: scene.name,
|
|
11182
|
-
duration: this.getItemDuration(),
|
|
11183
|
-
endBehavior: this.getItemEndBehavior(),
|
|
11184
|
-
type: EFFECTS.spec.ItemType.tree,
|
|
11185
|
-
content: {
|
|
11186
|
-
options: {
|
|
11187
|
-
tree: treeOptions
|
|
11188
|
-
}
|
|
11189
|
-
}
|
|
11190
|
-
};
|
|
11191
|
-
return itemTree;
|
|
11192
|
-
};
|
|
11193
|
-
_proto._createItemMesh = function _createItemMesh(node, parentId) {
|
|
11194
|
-
var _this = this;
|
|
11195
|
-
var meshIndex = node.mesh;
|
|
11196
|
-
if (meshIndex === undefined) {
|
|
11197
|
-
throw new Error("Invalid mesh index in node " + node + ".");
|
|
11198
|
-
}
|
|
11199
|
-
var skin;
|
|
11200
|
-
if (node.skin !== undefined) {
|
|
11201
|
-
var gltfSkin = this._gltfSkins[node.skin];
|
|
11202
|
-
skin = {
|
|
11203
|
-
name: gltfSkin.name,
|
|
11204
|
-
joints: gltfSkin.jointIndexList,
|
|
11205
|
-
skeleton: gltfSkin.skeleton,
|
|
11206
|
-
inverseBindMatrices: gltfSkin.inverseBindMatrices
|
|
11207
|
-
};
|
|
11208
|
-
}
|
|
11209
|
-
var mesh = this._gltfMeshs[meshIndex];
|
|
11210
|
-
var primitiveList = mesh.primitives.map(function(prim) {
|
|
11211
|
-
var matIndex = prim.material;
|
|
11212
|
-
var mat = _this._gltfMaterials[matIndex];
|
|
11213
|
-
var geometry = _this.createGeometry(prim, skin !== undefined);
|
|
11214
|
-
var material = _this.createMaterial(mat);
|
|
11215
|
-
material.baseColorTexture = _this.getTexture2D(matIndex, mat.baseColorTexture, true);
|
|
11216
|
-
if (material.type === EFFECTS.spec.MaterialType.pbr) {
|
|
11217
|
-
material.metallicRoughnessTexture = _this.getTexture2D(matIndex, mat.metallicRoughnessTexture, false);
|
|
11218
|
-
material.normalTexture = _this.getTexture2D(matIndex, mat.normalTexture, false);
|
|
11219
|
-
material.emissiveTexture = _this.getTexture2D(matIndex, mat.emissiveTexture, false);
|
|
11220
|
-
material.occlusionTexture = _this.getTexture2D(matIndex, mat.occlusionTexture, false);
|
|
11221
|
-
}
|
|
11222
|
-
var primitiveOptions = {
|
|
11223
|
-
geometry: geometry,
|
|
11224
|
-
material: material
|
|
11225
|
-
};
|
|
11226
|
-
return primitiveOptions;
|
|
11227
|
-
});
|
|
11228
|
-
var meshOptions = {
|
|
11229
|
-
parent: node.nodeIndex,
|
|
11230
|
-
skin: skin,
|
|
11231
|
-
primitives: primitiveList,
|
|
11232
|
-
weights: mesh.weights
|
|
11233
|
-
};
|
|
11234
|
-
var aabb = GLTFHelper.createBoxFromGLTFBound(mesh.bounds);
|
|
11235
|
-
var boxSize = aabb.getSize(new Vector3());
|
|
11236
|
-
var boxCenter = aabb.getCenter(new Vector3());
|
|
11237
|
-
var interaction = {
|
|
11238
|
-
behavior: EFFECTS.spec.InteractBehavior.NOTIFY,
|
|
11239
|
-
type: EFFECTS.spec.ModelBoundingType.box,
|
|
11240
|
-
size: [
|
|
11241
|
-
boxSize.x,
|
|
11242
|
-
boxSize.y,
|
|
11243
|
-
boxSize.z
|
|
11244
|
-
],
|
|
11245
|
-
center: [
|
|
11246
|
-
boxCenter.x,
|
|
11247
|
-
boxCenter.y,
|
|
11248
|
-
boxCenter.z
|
|
11249
|
-
]
|
|
11250
|
-
};
|
|
11251
|
-
var _node_nodeIndex;
|
|
11252
|
-
var itemMesh = {
|
|
11253
|
-
id: "mesh_ni" + ((_node_nodeIndex = node.nodeIndex) != null ? _node_nodeIndex : 0) + "_mi" + meshIndex,
|
|
11254
|
-
parentId: parentId + "^" + node.nodeIndex,
|
|
11255
|
-
name: mesh.name,
|
|
11256
|
-
duration: this.getItemDuration(),
|
|
11257
|
-
endBehavior: this.getItemEndBehavior(),
|
|
11258
|
-
type: EFFECTS.spec.ItemType.mesh,
|
|
11259
|
-
pluginName: "model",
|
|
11260
|
-
content: {
|
|
11261
|
-
options: meshOptions,
|
|
11262
|
-
interaction: interaction
|
|
11263
|
-
}
|
|
11264
|
-
};
|
|
11265
|
-
return itemMesh;
|
|
11266
|
-
};
|
|
11267
|
-
_proto._createItemLight = function _createItemLight(node, parentId) {
|
|
11268
|
-
var lightIndex = node.light;
|
|
11269
|
-
if (lightIndex === undefined) {
|
|
11270
|
-
return;
|
|
11271
|
-
}
|
|
11272
|
-
var light = this._gltfLights[lightIndex];
|
|
11273
|
-
var lightOptions = this.createLightOptions(light);
|
|
11274
|
-
var _node_nodeIndex, _light_name;
|
|
11275
|
-
var itemLight = {
|
|
11276
|
-
id: "light_ni" + ((_node_nodeIndex = node.nodeIndex) != null ? _node_nodeIndex : 0) + "_li" + lightIndex,
|
|
11277
|
-
parentId: parentId + "^" + node.nodeIndex,
|
|
11278
|
-
name: (_light_name = light.name) != null ? _light_name : "light",
|
|
11279
|
-
duration: this.getItemDuration(),
|
|
11280
|
-
endBehavior: this.getItemEndBehavior(),
|
|
11281
|
-
type: EFFECTS.spec.ItemType.light,
|
|
11282
|
-
pluginName: "model",
|
|
11283
|
-
content: {
|
|
11284
|
-
options: lightOptions
|
|
11285
|
-
}
|
|
11286
|
-
};
|
|
11287
|
-
return itemLight;
|
|
11288
|
-
};
|
|
11289
|
-
_proto._createItemCamera = function _createItemCamera(node, parentId) {
|
|
11290
|
-
var cameraIndex = node.camera;
|
|
11291
|
-
if (cameraIndex === undefined) {
|
|
11292
|
-
return;
|
|
11293
|
-
}
|
|
11294
|
-
var camera = this._gltfCameras[cameraIndex];
|
|
11295
|
-
var cameraOptions = this.createCameraOptions(camera);
|
|
11296
|
-
if (cameraOptions === undefined) {
|
|
11297
|
-
return;
|
|
11298
|
-
}
|
|
11299
|
-
var _node_nodeIndex, _camera_name;
|
|
11300
|
-
var itemCamera = {
|
|
11301
|
-
id: "camera_ni" + ((_node_nodeIndex = node.nodeIndex) != null ? _node_nodeIndex : 0) + "_ci" + cameraIndex,
|
|
11302
|
-
parentId: parentId + "^" + node.nodeIndex,
|
|
11303
|
-
name: (_camera_name = camera.name) != null ? _camera_name : "camera",
|
|
11304
|
-
duration: this.getItemDuration(),
|
|
11305
|
-
endBehavior: this.getItemEndBehavior(),
|
|
11306
|
-
type: "camera",
|
|
11307
|
-
pluginName: "model",
|
|
11308
|
-
content: {
|
|
11309
|
-
options: cameraOptions
|
|
11310
|
-
}
|
|
11311
|
-
};
|
|
11312
|
-
return itemCamera;
|
|
11313
|
-
};
|
|
11314
|
-
_proto._createItemSkybox = function _createItemSkybox() {
|
|
11315
|
-
if (this._skyboxOptions === undefined) {
|
|
11316
|
-
return;
|
|
11317
|
-
}
|
|
11318
|
-
var itemSkybox = {
|
|
11319
|
-
id: "skybox_0",
|
|
11320
|
-
name: "skybox",
|
|
11321
|
-
duration: this.getItemDuration(),
|
|
11322
|
-
endBehavior: this.getItemEndBehavior(),
|
|
11323
|
-
type: EFFECTS.spec.ItemType.skybox,
|
|
11324
|
-
pluginName: "model",
|
|
11325
|
-
content: {
|
|
11326
|
-
options: this._skyboxOptions
|
|
11327
|
-
}
|
|
11328
|
-
};
|
|
11329
|
-
return itemSkybox;
|
|
11330
|
-
};
|
|
11331
|
-
_proto._computeSceneAABB = function _computeSceneAABB(node, parentTransform, sceneAABB) {
|
|
11332
|
-
var _this = this;
|
|
11333
|
-
var transformData = {};
|
|
11334
|
-
if (node.matrix) {
|
|
11335
|
-
var trans = Matrix4.fromArray(node.matrix).getTransform();
|
|
11336
|
-
transformData.position = trans.translation.toArray();
|
|
11337
|
-
transformData.quat = trans.rotation.toArray();
|
|
11338
|
-
transformData.scale = trans.scale.toArray();
|
|
11339
|
-
} else {
|
|
11340
|
-
if (node.translation) {
|
|
11341
|
-
transformData.position = node.translation;
|
|
11342
|
-
}
|
|
11343
|
-
if (node.rotation) {
|
|
11344
|
-
transformData.quat = node.rotation;
|
|
11345
|
-
}
|
|
11346
|
-
if (node.scale) {
|
|
11347
|
-
transformData.scale = node.scale;
|
|
11348
|
-
}
|
|
11349
|
-
}
|
|
11350
|
-
var nodeTransform = new EFFECTS.Transform(transformData, parentTransform);
|
|
11351
|
-
nodeTransform.setValid(true);
|
|
11352
|
-
//
|
|
11353
|
-
if (node.mesh !== undefined) {
|
|
11354
|
-
var mesh = this._gltfMeshs[node.mesh];
|
|
11355
|
-
var meshAABB = GLTFHelper.createBoxFromGLTFBound(mesh.bounds);
|
|
11356
|
-
meshAABB.applyMatrix4(nodeTransform.getWorldMatrix());
|
|
11357
|
-
sceneAABB.union(meshAABB);
|
|
11358
|
-
}
|
|
11359
|
-
node.children.forEach(function(child) {
|
|
11360
|
-
_this._computeSceneAABB(child, nodeTransform, sceneAABB);
|
|
11361
|
-
});
|
|
11362
|
-
};
|
|
11363
|
-
_proto.createLightOptions = function createLightOptions(light) {
|
|
11364
|
-
return PluginHelper.createLightOptions(light);
|
|
11365
|
-
};
|
|
11366
|
-
_proto.createCameraOptions = function createCameraOptions(camera) {
|
|
11367
|
-
return PluginHelper.createCameraOptions(camera);
|
|
11368
|
-
};
|
|
11369
|
-
_proto._clear = function _clear() {
|
|
11370
|
-
if (this._textureManager) {
|
|
11371
|
-
this._textureManager.dispose();
|
|
11372
|
-
this._textureManager = undefined;
|
|
11373
|
-
}
|
|
11374
|
-
this._textureManager = new TextureManager(this);
|
|
11375
|
-
};
|
|
11376
|
-
/**
|
|
11377
|
-
* 按照传入的动画播放参数,计算需要播放的动画索引
|
|
11378
|
-
*
|
|
11379
|
-
* @param treeOptions 节点树属性,需要初始化animations列表。
|
|
11380
|
-
* @returns 返回计算的动画索引,-1表示没有动画需要播放,-88888888表示播放所有动画。
|
|
11381
|
-
*/ _proto.getPlayAnimationIndex = function getPlayAnimationIndex(treeOptions) {
|
|
11382
|
-
var animations = treeOptions.animations;
|
|
11383
|
-
if (animations === undefined || animations.length <= 0) {
|
|
11384
|
-
// 硬编码,内部指定的不播放动画的索引值
|
|
11385
|
-
return -1;
|
|
11386
|
-
}
|
|
11387
|
-
if (this.isPlayAllAnimation()) {
|
|
11388
|
-
// 硬编码,内部指定的播放全部动画的索引值
|
|
11389
|
-
return -88888888;
|
|
11390
|
-
}
|
|
11391
|
-
var animationInfo = this._sceneOptions.effects.playAnimation;
|
|
11392
|
-
if (animationInfo === undefined) {
|
|
11393
|
-
return -1;
|
|
11394
|
-
}
|
|
11395
|
-
if (typeof animationInfo === "number") {
|
|
11396
|
-
if (animationInfo >= 0 && animationInfo < animations.length) {
|
|
11397
|
-
return animationInfo;
|
|
11398
|
-
} else {
|
|
11399
|
-
return -1;
|
|
11400
|
-
}
|
|
11401
|
-
} else {
|
|
11402
|
-
// typeof animationInfo === 'string'
|
|
11403
|
-
var animationIndex = -1;
|
|
11404
|
-
// 通过动画名字查找动画索引
|
|
11405
|
-
animations.forEach(function(anim, index) {
|
|
11406
|
-
if (anim.name === animationInfo) {
|
|
11407
|
-
animationIndex = index;
|
|
11408
|
-
}
|
|
11409
|
-
});
|
|
11410
|
-
return animationIndex;
|
|
11411
|
-
}
|
|
11412
|
-
};
|
|
11413
|
-
_proto.isPlayAnimation = function isPlayAnimation() {
|
|
11414
|
-
return this._sceneOptions.effects.playAnimation !== undefined;
|
|
11415
|
-
};
|
|
11416
|
-
_proto.isPlayAllAnimation = function isPlayAllAnimation() {
|
|
11417
|
-
return this._sceneOptions.effects.playAllAnimation === true;
|
|
11418
|
-
};
|
|
11419
|
-
_proto.getRemarkString = function getRemarkString() {
|
|
11420
|
-
var remark = this._sceneOptions.gltf.remark;
|
|
11421
|
-
if (remark === undefined) {
|
|
11422
|
-
return "Unknown";
|
|
11423
|
-
} else if (typeof remark === "string") {
|
|
11424
|
-
return remark;
|
|
11425
|
-
} else {
|
|
11426
|
-
return "BinaryBuffer";
|
|
11427
|
-
}
|
|
11428
|
-
};
|
|
11429
|
-
_proto.isTiny3dMode = function isTiny3dMode() {
|
|
11430
|
-
return this._loaderOptions.compatibleMode === "tiny3d";
|
|
11431
|
-
};
|
|
11432
|
-
_proto.getTextureManager = function getTextureManager() {
|
|
11433
|
-
return this._textureManager;
|
|
11434
|
-
};
|
|
11435
|
-
_proto.getItemDuration = function getItemDuration() {
|
|
11436
|
-
var _this__sceneOptions_effects_duration;
|
|
11437
|
-
return (_this__sceneOptions_effects_duration = this._sceneOptions.effects.duration) != null ? _this__sceneOptions_effects_duration : 9999;
|
|
11438
|
-
};
|
|
11439
|
-
_proto.getItemEndBehavior = function getItemEndBehavior() {
|
|
11440
|
-
var _this__sceneOptions_effects_endBehavior;
|
|
11441
|
-
return (_this__sceneOptions_effects_endBehavior = this._sceneOptions.effects.endBehavior) != null ? _this__sceneOptions_effects_endBehavior : EFFECTS.spec.ItemEndBehavior.loop;
|
|
11442
|
-
};
|
|
11443
|
-
_proto.getSkyboxType = function getSkyboxType() {
|
|
11444
|
-
var typeName = this._sceneOptions.gltf.skyboxType;
|
|
11445
|
-
switch(typeName){
|
|
11446
|
-
case "NFT":
|
|
11447
|
-
return exports.PSkyboxType.NFT;
|
|
11448
|
-
case "FARM":
|
|
11449
|
-
return exports.PSkyboxType.FARM;
|
|
11450
|
-
}
|
|
11451
|
-
};
|
|
11452
|
-
_proto.isSkyboxVis = function isSkyboxVis() {
|
|
11453
|
-
return this._sceneOptions.gltf.skyboxVis === true;
|
|
11454
|
-
};
|
|
11455
|
-
_proto.ignoreSkybox = function ignoreSkybox() {
|
|
11456
|
-
return this._sceneOptions.gltf.ignoreSkybox === true;
|
|
11457
|
-
};
|
|
11458
|
-
_proto.isEnvironmentTest = function isEnvironmentTest() {
|
|
11459
|
-
if (typeof this._sceneOptions.gltf.remark === "string") {
|
|
11460
|
-
return this._sceneOptions.gltf.remark.includes("EnvironmentTest");
|
|
11461
|
-
} else {
|
|
11462
|
-
return false;
|
|
11463
|
-
}
|
|
11464
|
-
};
|
|
11465
|
-
return LoaderImpl;
|
|
11466
|
-
}();
|
|
11467
|
-
var TextureManager = /*#__PURE__*/ function() {
|
|
11468
|
-
function TextureManager(owner) {
|
|
11469
|
-
this._owner = owner;
|
|
11470
|
-
this._gltfImages = [];
|
|
11471
|
-
this._gltfTextures = [];
|
|
11472
|
-
this._textureMap = new Map();
|
|
11473
|
-
}
|
|
11474
|
-
var _proto = TextureManager.prototype;
|
|
11475
|
-
_proto.initial = function initial(gltfImages, gltfTextures) {
|
|
11476
|
-
this._gltfImages = gltfImages;
|
|
11477
|
-
this._gltfTextures = gltfTextures;
|
|
11478
|
-
this._textureMap.clear();
|
|
11479
|
-
};
|
|
11480
|
-
_proto.dispose = function dispose() {
|
|
11481
|
-
this._textureMap.clear();
|
|
11482
|
-
};
|
|
11483
|
-
_proto.addTexture = function addTexture(matIndex, texIndex, tex, isBaseColor) {
|
|
11484
|
-
var index = isBaseColor ? (matIndex + 1) * 100000 + texIndex : texIndex;
|
|
11485
|
-
this._textureMap.set(index, tex);
|
|
11486
|
-
};
|
|
11487
|
-
_proto.getTexture = function getTexture(matIndex, texIndex, isBaseColor) {
|
|
11488
|
-
var index = isBaseColor ? (matIndex + 1) * 100000 + texIndex : texIndex;
|
|
11489
|
-
return this._textureMap.get(index);
|
|
11490
|
-
};
|
|
11491
|
-
return TextureManager;
|
|
11492
|
-
}();
|
|
11493
|
-
var GeometryProxy = /*#__PURE__*/ function() {
|
|
11494
|
-
function GeometryProxy(engine, gltfGeometry, hasSkinAnimation) {
|
|
11495
|
-
this.engine = engine;
|
|
11496
|
-
this.gltfGeometry = gltfGeometry;
|
|
11497
|
-
this.hasSkinAnimation = hasSkinAnimation;
|
|
11498
|
-
}
|
|
11499
|
-
var _proto = GeometryProxy.prototype;
|
|
11500
|
-
_proto._getBufferAttrib = function _getBufferAttrib(inAttrib) {
|
|
11501
|
-
var attrib = {
|
|
11502
|
-
type: inAttrib.type,
|
|
11503
|
-
size: inAttrib.itemSize,
|
|
11504
|
-
//stride: inAttrib.stride,
|
|
11505
|
-
//offset: inAttrib.offset,
|
|
11506
|
-
data: inAttrib.array,
|
|
11507
|
-
normalize: inAttrib.normalized
|
|
11508
|
-
};
|
|
11509
|
-
return attrib;
|
|
11510
|
-
};
|
|
11511
|
-
_proto.texCoordAttrib = function texCoordAttrib(index) {
|
|
11512
|
-
return this.gltfGeometry.getTexCoord(index);
|
|
11513
|
-
};
|
|
11514
|
-
_proto.getTargetPosition = function getTargetPosition(index) {
|
|
11515
|
-
return this.gltfGeometry.getAttribute("POSITION" + index);
|
|
11516
|
-
};
|
|
11517
|
-
_proto.getTargetNormal = function getTargetNormal(index) {
|
|
11518
|
-
return this.gltfGeometry.getAttribute("NORMAL" + index);
|
|
11519
|
-
};
|
|
11520
|
-
_proto.getTargetTangent = function getTargetTangent(index) {
|
|
11521
|
-
return this.gltfGeometry.getAttribute("TANGENT" + index);
|
|
11522
|
-
};
|
|
11523
|
-
_create_class(GeometryProxy, [
|
|
11524
|
-
{
|
|
11525
|
-
key: "geometry",
|
|
11526
|
-
get: function get() {
|
|
11527
|
-
var _this = this;
|
|
11528
|
-
var attributes = {};
|
|
11529
|
-
if (this.hasPosition) {
|
|
11530
|
-
var attrib = this.positionAttrib;
|
|
11531
|
-
attributes["aPos"] = this._getBufferAttrib(attrib);
|
|
11532
|
-
} else {
|
|
11533
|
-
throw new Error("Position attribute missing.");
|
|
11534
|
-
}
|
|
11535
|
-
if (this.hasNormal) {
|
|
11536
|
-
var attrib1 = this.normalAttrib;
|
|
11537
|
-
if (attrib1 !== undefined) {
|
|
11538
|
-
attributes["aNormal"] = this._getBufferAttrib(attrib1);
|
|
11539
|
-
}
|
|
11540
|
-
}
|
|
11541
|
-
if (this.hasTangent) {
|
|
11542
|
-
var attrib2 = this.tangentAttrib;
|
|
11543
|
-
if (attrib2 !== undefined) {
|
|
11544
|
-
attributes["aTangent"] = this._getBufferAttrib(attrib2);
|
|
11545
|
-
}
|
|
11546
|
-
}
|
|
11547
|
-
this.texCoordList.forEach(function(val) {
|
|
11548
|
-
var attrib = _this.texCoordAttrib(val);
|
|
11549
|
-
var attribName = "aUV" + (val + 1);
|
|
11550
|
-
attributes[attribName] = _this._getBufferAttrib(attrib);
|
|
11551
|
-
});
|
|
11552
|
-
if (this.hasSkinAnimation) {
|
|
11553
|
-
var jointAttrib = this.jointAttribute;
|
|
11554
|
-
if (jointAttrib !== undefined) {
|
|
11555
|
-
attributes["aJoints"] = this._getBufferAttrib(jointAttrib);
|
|
11556
|
-
}
|
|
11557
|
-
var weightAttrib = this.weightAttribute;
|
|
11558
|
-
if (weightAttrib !== undefined) {
|
|
11559
|
-
attributes["aWeights"] = this._getBufferAttrib(weightAttrib);
|
|
11560
|
-
}
|
|
11561
|
-
}
|
|
11562
|
-
/**
|
|
11563
|
-
* 设置Morph动画需要的Attribute,主要包括Position,Normal和Tangent
|
|
11564
|
-
*/ for(var i = 0; i < 8; i++){
|
|
11565
|
-
var positionAttrib = this.getTargetPosition(i);
|
|
11566
|
-
if (positionAttrib !== undefined) {
|
|
11567
|
-
attributes["aTargetPosition" + i] = this._getBufferAttrib(positionAttrib);
|
|
11568
|
-
}
|
|
11569
|
-
var normalAttrib = this.getTargetNormal(i);
|
|
11570
|
-
if (normalAttrib !== undefined) {
|
|
11571
|
-
attributes["aTargetNormal" + i] = this._getBufferAttrib(normalAttrib);
|
|
11572
|
-
}
|
|
11573
|
-
var tangentAttrib = this.getTargetTangent(i);
|
|
11574
|
-
if (tangentAttrib !== undefined) {
|
|
11575
|
-
attributes["aTargetTangent" + i] = this._getBufferAttrib(tangentAttrib);
|
|
11576
|
-
}
|
|
11577
|
-
}
|
|
11578
|
-
var indexArray = this.indexArray;
|
|
11579
|
-
if (indexArray !== undefined) {
|
|
11580
|
-
return EFFECTS.Geometry.create(this.engine, {
|
|
11581
|
-
attributes: attributes,
|
|
11582
|
-
indices: {
|
|
11583
|
-
data: indexArray
|
|
11584
|
-
},
|
|
11585
|
-
drawStart: 0,
|
|
11586
|
-
drawCount: indexArray.length,
|
|
11587
|
-
mode: EFFECTS.glContext.TRIANGLES
|
|
11588
|
-
});
|
|
11589
|
-
} else {
|
|
11590
|
-
return EFFECTS.Geometry.create(this.engine, {
|
|
11591
|
-
attributes: attributes,
|
|
11592
|
-
drawStart: 0,
|
|
11593
|
-
drawCount: this.positionAttrib.array.length / 3,
|
|
11594
|
-
mode: EFFECTS.glContext.TRIANGLES
|
|
11595
|
-
});
|
|
11596
|
-
}
|
|
11597
|
-
}
|
|
11598
|
-
},
|
|
11599
|
-
{
|
|
11600
|
-
key: "positionAttrib",
|
|
11601
|
-
get: function get() {
|
|
11602
|
-
return this.gltfGeometry.getPosition();
|
|
11603
|
-
}
|
|
11604
|
-
},
|
|
11605
|
-
{
|
|
11606
|
-
key: "normalAttrib",
|
|
11607
|
-
get: function get() {
|
|
11608
|
-
return this.gltfGeometry.getNormal();
|
|
11609
|
-
}
|
|
11610
|
-
},
|
|
11611
|
-
{
|
|
11612
|
-
key: "tangentAttrib",
|
|
11613
|
-
get: function get() {
|
|
11614
|
-
return this.gltfGeometry.getTangent();
|
|
11615
|
-
}
|
|
11616
|
-
},
|
|
11617
|
-
{
|
|
11618
|
-
key: "jointAttribute",
|
|
11619
|
-
get: function get() {
|
|
11620
|
-
return this.gltfGeometry.getJoints(0);
|
|
11621
|
-
}
|
|
11622
|
-
},
|
|
11623
|
-
{
|
|
11624
|
-
key: "weightAttribute",
|
|
11625
|
-
get: function get() {
|
|
11626
|
-
return this.gltfGeometry.getWeights(0);
|
|
11627
|
-
}
|
|
11628
|
-
},
|
|
11629
|
-
{
|
|
11630
|
-
key: "hasPosition",
|
|
11631
|
-
get: function get() {
|
|
11632
|
-
return this.positionAttrib !== undefined;
|
|
11633
|
-
}
|
|
11634
|
-
},
|
|
11635
|
-
{
|
|
11636
|
-
key: "hasNormal",
|
|
11637
|
-
get: function get() {
|
|
11638
|
-
return this.normalAttrib !== undefined;
|
|
11639
|
-
}
|
|
11640
|
-
},
|
|
11641
|
-
{
|
|
11642
|
-
key: "hasTangent",
|
|
11643
|
-
get: function get() {
|
|
11644
|
-
return this.tangentAttrib !== undefined;
|
|
11645
|
-
}
|
|
11646
|
-
},
|
|
11647
|
-
{
|
|
11648
|
-
key: "hasTexCoord",
|
|
11649
|
-
get: function get() {
|
|
11650
|
-
return this.texCoordCount > 0;
|
|
11651
|
-
}
|
|
11652
|
-
},
|
|
11653
|
-
{
|
|
11654
|
-
key: "texCoordCount",
|
|
11655
|
-
get: function get() {
|
|
11656
|
-
for(var i = 0; i < 10; i++){
|
|
11657
|
-
if (this.texCoordAttrib(i) === undefined) {
|
|
11658
|
-
return i;
|
|
11659
|
-
}
|
|
11660
|
-
}
|
|
11661
|
-
return 0;
|
|
11662
|
-
}
|
|
11663
|
-
},
|
|
11664
|
-
{
|
|
11665
|
-
key: "hasJointAttribute",
|
|
11666
|
-
get: function get() {
|
|
11667
|
-
return this.jointAttribute !== undefined;
|
|
11668
|
-
}
|
|
11669
|
-
},
|
|
11670
|
-
{
|
|
11671
|
-
key: "hasWeightAttribute",
|
|
11672
|
-
get: function get() {
|
|
11673
|
-
return this.weightAttribute !== undefined;
|
|
11674
|
-
}
|
|
11675
|
-
},
|
|
11676
|
-
{
|
|
11677
|
-
key: "indexArray",
|
|
11678
|
-
get: function get() {
|
|
11679
|
-
if (this.gltfGeometry.indices === undefined) {
|
|
11680
|
-
return undefined;
|
|
11681
|
-
}
|
|
11682
|
-
switch(this.gltfGeometry.indices.type){
|
|
11683
|
-
case WebGLRenderingContext["UNSIGNED_INT"]:
|
|
11684
|
-
return this.gltfGeometry.indices.array;
|
|
11685
|
-
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
11686
|
-
return this.gltfGeometry.indices.array;
|
|
11687
|
-
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
11688
|
-
return this.gltfGeometry.indices.array;
|
|
11689
|
-
}
|
|
11690
|
-
return undefined;
|
|
11691
|
-
}
|
|
11692
|
-
},
|
|
11693
|
-
{
|
|
11694
|
-
key: "indexCount",
|
|
11695
|
-
get: function get() {
|
|
11696
|
-
if (this.gltfGeometry.indices !== undefined) {
|
|
11697
|
-
return this.gltfGeometry.indices.array.length;
|
|
11698
|
-
} else {
|
|
11699
|
-
return 0;
|
|
11700
|
-
}
|
|
11701
|
-
}
|
|
11702
|
-
},
|
|
11703
|
-
{
|
|
11704
|
-
key: "texCoordList",
|
|
11705
|
-
get: function get() {
|
|
11706
|
-
var texCoords = [];
|
|
11707
|
-
for(var i = 0; i < 10; i++){
|
|
11708
|
-
if (this.texCoordAttrib(i) !== undefined) {
|
|
11709
|
-
texCoords.push(i);
|
|
11710
|
-
} else {
|
|
11711
|
-
break;
|
|
11712
|
-
}
|
|
11713
|
-
}
|
|
11714
|
-
return texCoords;
|
|
11715
|
-
}
|
|
11716
|
-
}
|
|
11717
|
-
]);
|
|
11718
|
-
return GeometryProxy;
|
|
11719
|
-
}();
|
|
11720
|
-
var MaterialProxy = /*#__PURE__*/ function() {
|
|
11721
|
-
function MaterialProxy(material, textures, tiny3dMode) {
|
|
11722
|
-
this.gltfMaterial = material;
|
|
11723
|
-
this.textures = textures;
|
|
11724
|
-
this.tiny3dMode = tiny3dMode;
|
|
11725
|
-
}
|
|
11726
|
-
var _proto = MaterialProxy.prototype;
|
|
11727
|
-
_proto.getTextureObject = function getTextureObject(index) {
|
|
11728
|
-
if (index < 0 || index >= this.textures.length) {
|
|
11729
|
-
return;
|
|
11730
|
-
}
|
|
11731
|
-
return this.textures[index];
|
|
11732
|
-
};
|
|
11733
|
-
_proto.getTextureObj = function getTextureObj(texInfo) {
|
|
11734
|
-
return texInfo ? this.getTextureObject(texInfo.index) : undefined;
|
|
11735
|
-
};
|
|
11736
|
-
_proto.getTextureCoord = function getTextureCoord(texInfo) {
|
|
11737
|
-
return texInfo ? texInfo.texCoord : undefined;
|
|
11738
|
-
};
|
|
11739
|
-
_proto.getTextureTransform = function getTextureTransform(texInfo) {
|
|
11740
|
-
var _texInfo_extensions;
|
|
11741
|
-
var transform = texInfo == null ? void 0 : (_texInfo_extensions = texInfo.extensions) == null ? void 0 : _texInfo_extensions.KHR_texture_transform;
|
|
11742
|
-
if (transform === undefined) {
|
|
11743
|
-
return;
|
|
11744
|
-
}
|
|
11745
|
-
if (transform.offset === undefined && transform.rotation === undefined && transform.scale === undefined) {
|
|
11746
|
-
return;
|
|
11747
|
-
}
|
|
11748
|
-
return {
|
|
11749
|
-
offset: transform.offset,
|
|
11750
|
-
rotation: transform.rotation,
|
|
11751
|
-
scale: transform.scale
|
|
11752
|
-
};
|
|
11753
|
-
};
|
|
11754
|
-
_proto.getSpecularAA = function getSpecularAA() {
|
|
11755
|
-
var _this_gltfMaterial_extras;
|
|
11756
|
-
return (_this_gltfMaterial_extras = this.gltfMaterial.extras) == null ? void 0 : _this_gltfMaterial_extras.useSpecularAA;
|
|
11757
|
-
};
|
|
11758
|
-
_create_class(MaterialProxy, [
|
|
11759
|
-
{
|
|
11760
|
-
key: "material",
|
|
11761
|
-
get: function get() {
|
|
11762
|
-
var mat = this.gltfMaterial;
|
|
11763
|
-
var isUnlit = GLTFHelper.isUnlitMaterial(mat);
|
|
11764
|
-
var blending = EFFECTS.spec.MaterialBlending.opaque;
|
|
11765
|
-
switch(mat.alphaMode){
|
|
11766
|
-
case "OPAQUE":
|
|
11767
|
-
blending = EFFECTS.spec.MaterialBlending.opaque;
|
|
11768
|
-
break;
|
|
11769
|
-
case "MASK":
|
|
11770
|
-
blending = EFFECTS.spec.MaterialBlending.masked;
|
|
11771
|
-
break;
|
|
11772
|
-
case "BLEND":
|
|
11773
|
-
blending = EFFECTS.spec.MaterialBlending.translucent;
|
|
11774
|
-
break;
|
|
11775
|
-
}
|
|
11776
|
-
var side = mat.doubleSided ? EFFECTS.spec.SideMode.DOUBLE : EFFECTS.spec.SideMode.FRONT;
|
|
11777
|
-
var enableShadow = false;
|
|
11778
|
-
var _mat_alphaCutOff;
|
|
11779
|
-
var alphaCutOff = (_mat_alphaCutOff = mat.alphaCutOff) != null ? _mat_alphaCutOff : 0.5;
|
|
11780
|
-
var name = mat.name;
|
|
11781
|
-
if (isUnlit) {
|
|
11782
|
-
var _mat_extras;
|
|
11783
|
-
return {
|
|
11784
|
-
name: name,
|
|
11785
|
-
type: EFFECTS.spec.MaterialType.unlit,
|
|
11786
|
-
baseColorTexture: this.baseColorTextureObj,
|
|
11787
|
-
baseColorTextureCoordinate: this.baseColorTextureCoord,
|
|
11788
|
-
baseColorTextureTransform: this.baseColorTextureTransfrom,
|
|
11789
|
-
baseColorFactor: this.baseColorFactor,
|
|
11790
|
-
//
|
|
11791
|
-
depthMask: (_mat_extras = mat.extras) == null ? void 0 : _mat_extras.depthMask,
|
|
11792
|
-
blending: blending,
|
|
11793
|
-
alphaCutOff: alphaCutOff,
|
|
11794
|
-
side: side
|
|
11795
|
-
};
|
|
11796
|
-
} else {
|
|
11797
|
-
var _mat_extras1;
|
|
11798
|
-
return {
|
|
11799
|
-
name: name,
|
|
11800
|
-
type: EFFECTS.spec.MaterialType.pbr,
|
|
11801
|
-
baseColorTexture: this.baseColorTextureObj,
|
|
11802
|
-
baseColorTextureCoordinate: this.baseColorTextureCoord,
|
|
11803
|
-
baseColorTextureTransform: this.baseColorTextureTransfrom,
|
|
11804
|
-
baseColorFactor: this.baseColorFactor,
|
|
11805
|
-
//
|
|
11806
|
-
useSpecularAA: this.getSpecularAA(),
|
|
11807
|
-
//
|
|
11808
|
-
metallicRoughnessTexture: this.metallicRoughnessTextureObj,
|
|
11809
|
-
metallicRoughnessTextureCoordinate: this.metallicRoughnessTextureCoord,
|
|
11810
|
-
metallicRoughnessTextureTransform: this.metallicRoughnessTextureTransfrom,
|
|
11811
|
-
metallicFactor: this.metalicFactor,
|
|
11812
|
-
roughnessFactor: this.roughnessFactor,
|
|
11813
|
-
//
|
|
11814
|
-
normalTexture: this.normalTextureObj,
|
|
11815
|
-
normalTextureCoordinate: this.normalTextureCoord,
|
|
11816
|
-
normalTextureTransform: this.normalTextureTransfrom,
|
|
11817
|
-
normalTextureScale: this.normalTextureScale,
|
|
11818
|
-
//
|
|
11819
|
-
occlusionTexture: this.occlusionTextureObj,
|
|
11820
|
-
occlusionTextureCoordinate: this.occlusionTextureCoord,
|
|
11821
|
-
occlusionTextureTransform: this.occlusionTextureTransfrom,
|
|
11822
|
-
occlusionTextureStrength: this.occlusionTextureStrength,
|
|
11823
|
-
//
|
|
11824
|
-
emissiveTexture: this.emissiveTextureObj,
|
|
11825
|
-
emissiveTextureCoordinate: this.emissiveTextureCoord,
|
|
11826
|
-
emissiveTextureTransform: this.emissiveTextureTransfrom,
|
|
11827
|
-
emissiveFactor: this.emissiveFactor,
|
|
11828
|
-
emissiveIntensity: 1.0,
|
|
11829
|
-
//
|
|
11830
|
-
depthMask: (_mat_extras1 = mat.extras) == null ? void 0 : _mat_extras1.depthMask,
|
|
11831
|
-
blending: blending,
|
|
11832
|
-
alphaCutOff: alphaCutOff,
|
|
11833
|
-
side: side,
|
|
11834
|
-
enableShadow: enableShadow
|
|
11835
|
-
};
|
|
11836
|
-
}
|
|
11837
|
-
}
|
|
11838
|
-
},
|
|
11839
|
-
{
|
|
11840
|
-
key: "baseColorTextureObj",
|
|
11841
|
-
get: function get() {
|
|
11842
|
-
return this.getTextureObj(this.gltfMaterial.baseColorTexture);
|
|
11843
|
-
}
|
|
11844
|
-
},
|
|
11845
|
-
{
|
|
11846
|
-
key: "baseColorTextureCoord",
|
|
11847
|
-
get: function get() {
|
|
11848
|
-
return this.getTextureCoord(this.gltfMaterial.baseColorTexture);
|
|
11849
|
-
}
|
|
11850
|
-
},
|
|
11851
|
-
{
|
|
11852
|
-
key: "baseColorTextureTransfrom",
|
|
11853
|
-
get: function get() {
|
|
11854
|
-
return this.getTextureTransform(this.gltfMaterial.baseColorTexture);
|
|
11855
|
-
}
|
|
11856
|
-
},
|
|
11857
|
-
{
|
|
11858
|
-
key: "metallicRoughnessTextureObj",
|
|
11859
|
-
get: function get() {
|
|
11860
|
-
return this.getTextureObj(this.gltfMaterial.metallicRoughnessTexture);
|
|
11861
|
-
}
|
|
11862
|
-
},
|
|
11863
|
-
{
|
|
11864
|
-
key: "metallicRoughnessTextureCoord",
|
|
11865
|
-
get: function get() {
|
|
11866
|
-
return this.getTextureCoord(this.gltfMaterial.metallicRoughnessTexture);
|
|
11867
|
-
}
|
|
11868
|
-
},
|
|
11869
|
-
{
|
|
11870
|
-
key: "metallicRoughnessTextureTransfrom",
|
|
11871
|
-
get: function get() {
|
|
11872
|
-
return this.getTextureTransform(this.gltfMaterial.metallicRoughnessTexture);
|
|
11873
|
-
}
|
|
11874
|
-
},
|
|
11875
|
-
{
|
|
11876
|
-
key: "normalTextureObj",
|
|
11877
|
-
get: function get() {
|
|
11878
|
-
return this.getTextureObj(this.gltfMaterial.normalTexture);
|
|
11879
|
-
}
|
|
11880
|
-
},
|
|
11881
|
-
{
|
|
11882
|
-
key: "normalTextureCoord",
|
|
11883
|
-
get: function get() {
|
|
11884
|
-
return this.getTextureCoord(this.gltfMaterial.normalTexture);
|
|
11885
|
-
}
|
|
11886
|
-
},
|
|
11887
|
-
{
|
|
11888
|
-
key: "normalTextureTransfrom",
|
|
11889
|
-
get: function get() {
|
|
11890
|
-
return this.getTextureTransform(this.gltfMaterial.normalTexture);
|
|
11891
|
-
}
|
|
11892
|
-
},
|
|
11893
|
-
{
|
|
11894
|
-
key: "occlusionTextureObj",
|
|
11895
|
-
get: function get() {
|
|
11896
|
-
return this.getTextureObj(this.gltfMaterial.occlusionTexture);
|
|
11897
|
-
}
|
|
11898
|
-
},
|
|
11899
|
-
{
|
|
11900
|
-
key: "occlusionTextureCoord",
|
|
11901
|
-
get: function get() {
|
|
11902
|
-
return this.getTextureCoord(this.gltfMaterial.occlusionTexture);
|
|
11903
|
-
}
|
|
11904
|
-
},
|
|
11905
|
-
{
|
|
11906
|
-
key: "occlusionTextureTransfrom",
|
|
11907
|
-
get: function get() {
|
|
11908
|
-
return this.getTextureTransform(this.gltfMaterial.occlusionTexture);
|
|
11909
|
-
}
|
|
11910
|
-
},
|
|
11911
|
-
{
|
|
11912
|
-
key: "emissiveTextureObj",
|
|
11913
|
-
get: function get() {
|
|
11914
|
-
return this.getTextureObj(this.gltfMaterial.emissiveTexture);
|
|
11915
|
-
}
|
|
11916
|
-
},
|
|
11917
|
-
{
|
|
11918
|
-
key: "emissiveTextureCoord",
|
|
11919
|
-
get: function get() {
|
|
11920
|
-
return this.getTextureCoord(this.gltfMaterial.emissiveTexture);
|
|
11921
|
-
}
|
|
11922
|
-
},
|
|
11923
|
-
{
|
|
11924
|
-
key: "emissiveTextureTransfrom",
|
|
11925
|
-
get: function get() {
|
|
11926
|
-
return this.getTextureTransform(this.gltfMaterial.emissiveTexture);
|
|
11927
|
-
}
|
|
11928
|
-
},
|
|
11929
|
-
{
|
|
11930
|
-
key: "hasEmissive",
|
|
11931
|
-
get: function get() {
|
|
11932
|
-
var factor = this.emissiveFactor;
|
|
11933
|
-
return factor[0] + factor[1] + factor[2] > 0;
|
|
11934
|
-
}
|
|
11935
|
-
},
|
|
11936
|
-
{
|
|
11937
|
-
key: "baseColorFactor",
|
|
11938
|
-
get: function get() {
|
|
11939
|
-
var f = this.gltfMaterial.baseColorFactor;
|
|
11940
|
-
if (f === undefined || f.length != 4) {
|
|
11941
|
-
return [
|
|
11942
|
-
1,
|
|
11943
|
-
1,
|
|
11944
|
-
1,
|
|
11945
|
-
1
|
|
11946
|
-
];
|
|
11947
|
-
} else {
|
|
11948
|
-
return [
|
|
11949
|
-
f[0],
|
|
11950
|
-
f[1],
|
|
11951
|
-
f[2],
|
|
11952
|
-
f[3]
|
|
11953
|
-
];
|
|
11954
|
-
}
|
|
11955
|
-
}
|
|
11956
|
-
},
|
|
11957
|
-
{
|
|
11958
|
-
key: "metalicFactor",
|
|
11959
|
-
get: function get() {
|
|
11960
|
-
var _this_gltfMaterial_metallicFactor;
|
|
11961
|
-
return (_this_gltfMaterial_metallicFactor = this.gltfMaterial.metallicFactor) != null ? _this_gltfMaterial_metallicFactor : 1;
|
|
11962
|
-
}
|
|
11963
|
-
},
|
|
11964
|
-
{
|
|
11965
|
-
key: "roughnessFactor",
|
|
11966
|
-
get: function get() {
|
|
11967
|
-
var _this_gltfMaterial_roughnessFactor;
|
|
11968
|
-
return (_this_gltfMaterial_roughnessFactor = this.gltfMaterial.roughnessFactor) != null ? _this_gltfMaterial_roughnessFactor : 1;
|
|
11969
|
-
}
|
|
11970
|
-
},
|
|
11971
|
-
{
|
|
11972
|
-
key: "normalTextureScale",
|
|
11973
|
-
get: function get() {
|
|
11974
|
-
var _this_gltfMaterial_normalTexture;
|
|
11975
|
-
var _this_gltfMaterial_normalTexture_scale;
|
|
11976
|
-
return (_this_gltfMaterial_normalTexture_scale = (_this_gltfMaterial_normalTexture = this.gltfMaterial.normalTexture) == null ? void 0 : _this_gltfMaterial_normalTexture.scale) != null ? _this_gltfMaterial_normalTexture_scale : 1;
|
|
11977
|
-
}
|
|
11978
|
-
},
|
|
11979
|
-
{
|
|
11980
|
-
key: "occlusionTextureStrength",
|
|
11981
|
-
get: function get() {
|
|
11982
|
-
var _this_gltfMaterial_occlusionTexture;
|
|
11983
|
-
var _this_gltfMaterial_occlusionTexture_strength;
|
|
11984
|
-
return (_this_gltfMaterial_occlusionTexture_strength = (_this_gltfMaterial_occlusionTexture = this.gltfMaterial.occlusionTexture) == null ? void 0 : _this_gltfMaterial_occlusionTexture.strength) != null ? _this_gltfMaterial_occlusionTexture_strength : 1;
|
|
11985
|
-
}
|
|
11986
|
-
},
|
|
11987
|
-
{
|
|
11988
|
-
key: "emissiveFactor",
|
|
11989
|
-
get: function get() {
|
|
11990
|
-
var f = this.gltfMaterial.emissiveFactor;
|
|
11991
|
-
if (f === undefined || f.length != 4) {
|
|
11992
|
-
return [
|
|
11993
|
-
0,
|
|
11994
|
-
0,
|
|
11995
|
-
0,
|
|
11996
|
-
1
|
|
11997
|
-
];
|
|
11998
|
-
} else {
|
|
11999
|
-
return [
|
|
12000
|
-
f[0],
|
|
12001
|
-
f[1],
|
|
12002
|
-
f[2],
|
|
12003
|
-
1.0
|
|
12004
|
-
];
|
|
12005
|
-
}
|
|
12006
|
-
}
|
|
12007
|
-
}
|
|
12008
|
-
]);
|
|
12009
|
-
return MaterialProxy;
|
|
12010
|
-
}();
|
|
12011
|
-
var GLTFHelper = /*#__PURE__*/ function() {
|
|
12012
|
-
function GLTFHelper() {}
|
|
12013
|
-
GLTFHelper.isUnlitMaterial = function isUnlitMaterial(mat) {
|
|
12014
|
-
var _mat_extensions;
|
|
12015
|
-
return ((_mat_extensions = mat.extensions) == null ? void 0 : _mat_extensions.KHR_materials_unlit) !== undefined;
|
|
12016
|
-
};
|
|
12017
|
-
GLTFHelper.createBoxFromGLTFBound = function createBoxFromGLTFBound(bound) {
|
|
12018
|
-
var boxMin = Vector3.fromArray(bound.box.min);
|
|
12019
|
-
var boxMax = Vector3.fromArray(bound.box.max);
|
|
12020
|
-
return new Box3(boxMin, boxMax);
|
|
12021
|
-
};
|
|
12022
|
-
return GLTFHelper;
|
|
12023
|
-
}();
|
|
12024
|
-
|
|
12025
|
-
var JSONConverter = /*#__PURE__*/ function() {
|
|
12026
|
-
function JSONConverter(player) {
|
|
12027
|
-
this.treeInfo = new TreeInfo();
|
|
12028
|
-
this.engine = player.renderer.engine;
|
|
12029
|
-
this.renderer = player.renderer;
|
|
12030
|
-
this.downloader = new EFFECTS.Downloader();
|
|
12031
|
-
}
|
|
12032
|
-
var _proto = JSONConverter.prototype;
|
|
12033
|
-
_proto.processScene = function processScene(sceneData) {
|
|
12034
|
-
var _this = this;
|
|
12035
|
-
return _async_to_generator(function() {
|
|
12036
|
-
var sceneJSON, _tmp, oldScene, binFiles, _iterator, _step, bin, _, newScene;
|
|
12037
|
-
return __generator(this, function(_state) {
|
|
12038
|
-
switch(_state.label){
|
|
12039
|
-
case 0:
|
|
12040
|
-
if (!EFFECTS.isObject(sceneData)) return [
|
|
12041
|
-
3,
|
|
12042
|
-
1
|
|
12043
|
-
];
|
|
12044
|
-
_tmp = sceneData;
|
|
12045
|
-
return [
|
|
12046
|
-
3,
|
|
12047
|
-
3
|
|
12048
|
-
];
|
|
12049
|
-
case 1:
|
|
12050
|
-
return [
|
|
12051
|
-
4,
|
|
12052
|
-
_this.loadJSON(sceneData)
|
|
12053
|
-
];
|
|
12054
|
-
case 2:
|
|
12055
|
-
_tmp = _state.sent();
|
|
12056
|
-
_state.label = 3;
|
|
12057
|
-
case 3:
|
|
12058
|
-
sceneJSON = _tmp;
|
|
12059
|
-
// @ts-expect-error
|
|
12060
|
-
sceneJSON.textures.forEach(function(tex) {
|
|
12061
|
-
if (tex.source === undefined) {
|
|
12062
|
-
tex.source = 0;
|
|
12063
|
-
}
|
|
12064
|
-
});
|
|
12065
|
-
oldScene = EFFECTS.getStandardJSON(sceneJSON);
|
|
12066
|
-
binFiles = [];
|
|
12067
|
-
if (!oldScene.bins) return [
|
|
12068
|
-
3,
|
|
12069
|
-
7
|
|
12070
|
-
];
|
|
12071
|
-
_iterator = _create_for_of_iterator_helper_loose(oldScene.bins);
|
|
12072
|
-
_state.label = 4;
|
|
12073
|
-
case 4:
|
|
12074
|
-
if (!!(_step = _iterator()).done) return [
|
|
12075
|
-
3,
|
|
12076
|
-
7
|
|
12077
|
-
];
|
|
12078
|
-
bin = _step.value;
|
|
12079
|
-
_ = binFiles.push;
|
|
12080
|
-
return [
|
|
12081
|
-
4,
|
|
12082
|
-
_this.loadBins(bin.url)
|
|
12083
|
-
];
|
|
12084
|
-
case 5:
|
|
12085
|
-
_.apply(binFiles, [
|
|
12086
|
-
_state.sent()
|
|
12087
|
-
]);
|
|
12088
|
-
_state.label = 6;
|
|
12089
|
-
case 6:
|
|
12090
|
-
return [
|
|
12091
|
-
3,
|
|
12092
|
-
4
|
|
12093
|
-
];
|
|
12094
|
-
case 7:
|
|
12095
|
-
// @ts-expect-error
|
|
12096
|
-
oldScene.bins = binFiles;
|
|
12097
|
-
newScene = _extends({}, oldScene, {
|
|
12098
|
-
version: "3.0",
|
|
12099
|
-
playerVersion: {
|
|
12100
|
-
web: "3.0",
|
|
12101
|
-
native: "3.0"
|
|
12102
|
-
},
|
|
12103
|
-
type: "ge",
|
|
12104
|
-
compositions: [],
|
|
12105
|
-
images: [],
|
|
12106
|
-
textures: [],
|
|
12107
|
-
items: [],
|
|
12108
|
-
components: [],
|
|
12109
|
-
materials: [],
|
|
12110
|
-
shaders: [],
|
|
12111
|
-
geometries: []
|
|
12112
|
-
});
|
|
12113
|
-
_this.setImage(newScene, oldScene);
|
|
12114
|
-
return [
|
|
12115
|
-
4,
|
|
12116
|
-
_this.setTexture(newScene, oldScene)
|
|
12117
|
-
];
|
|
12118
|
-
case 8:
|
|
12119
|
-
_state.sent();
|
|
12120
|
-
_this.setComponent(newScene, oldScene);
|
|
12121
|
-
_this.setItem(newScene, oldScene);
|
|
12122
|
-
_this.setComposition(newScene, oldScene);
|
|
12123
|
-
return [
|
|
12124
|
-
2,
|
|
12125
|
-
newScene
|
|
12126
|
-
];
|
|
12127
|
-
}
|
|
12128
|
-
});
|
|
12129
|
-
})();
|
|
12130
|
-
};
|
|
12131
|
-
_proto.setImage = function setImage(newScene, oldScene) {
|
|
12132
|
-
var newImages = [];
|
|
12133
|
-
oldScene.images.forEach(function(image) {
|
|
12134
|
-
newImages.push(image);
|
|
12135
|
-
});
|
|
12136
|
-
newScene.images = newImages;
|
|
12137
|
-
};
|
|
12138
|
-
_proto.setTexture = function setTexture(newScene, oldScene) {
|
|
10768
|
+
_proto.setTexture = function setTexture(newScene, oldScene) {
|
|
12139
10769
|
var _this = this;
|
|
12140
10770
|
return _async_to_generator(function() {
|
|
12141
10771
|
var newTextures, bins, _iterator, _step, tex, mipmaps, target, jobs, loadedMipmaps, newMipmaps, newTex, source;
|
|
@@ -13383,8 +12013,19 @@ var vertexBufferSemanticMap = {
|
|
|
13383
12013
|
a_Target_Tangent3: "TANGENT_BS3"
|
|
13384
12014
|
};
|
|
13385
12015
|
|
|
13386
|
-
|
|
13387
|
-
|
|
12016
|
+
function getDefaultEffectsGLTFLoader(options) {
|
|
12017
|
+
if (!defaultGLTFLoader) {
|
|
12018
|
+
defaultGLTFLoader = new LoaderImpl();
|
|
12019
|
+
}
|
|
12020
|
+
defaultGLTFLoader.initial(options);
|
|
12021
|
+
return defaultGLTFLoader;
|
|
12022
|
+
}
|
|
12023
|
+
function setDefaultEffectsGLTFLoader(loader) {
|
|
12024
|
+
defaultGLTFLoader = loader;
|
|
12025
|
+
}
|
|
12026
|
+
var defaultGLTFLoader;
|
|
12027
|
+
var LoaderImpl = /*#__PURE__*/ function() {
|
|
12028
|
+
function LoaderImpl(composition) {
|
|
13388
12029
|
this.gltfSkins = [];
|
|
13389
12030
|
this.gltfMeshs = [];
|
|
13390
12031
|
this.gltfLights = [];
|
|
@@ -13404,6 +12045,7 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
13404
12045
|
this.shaders = [];
|
|
13405
12046
|
this.geometries = [];
|
|
13406
12047
|
this.animations = [];
|
|
12048
|
+
this.sceneAABB = new Box3();
|
|
13407
12049
|
if (composition) {
|
|
13408
12050
|
this.composition = composition;
|
|
13409
12051
|
} else {
|
|
@@ -13437,21 +12079,16 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
13437
12079
|
};
|
|
13438
12080
|
}
|
|
13439
12081
|
}
|
|
13440
|
-
var _proto =
|
|
13441
|
-
_proto.initial = function initial(engine, options) {
|
|
13442
|
-
this.engine = engine;
|
|
13443
|
-
this.loaderOptions = options != null ? options : {};
|
|
13444
|
-
};
|
|
12082
|
+
var _proto = LoaderImpl.prototype;
|
|
13445
12083
|
_proto.loadScene = function loadScene(options) {
|
|
13446
12084
|
var _this = this;
|
|
13447
12085
|
return _async_to_generator(function() {
|
|
13448
|
-
var _this_components, _this_components1, _this_components2, _this_items,
|
|
12086
|
+
var _this_components, _this_components1, _this_components2, _this_items, gltfResource, gltfScene, component, clips, index;
|
|
13449
12087
|
return __generator(this, function(_state) {
|
|
13450
12088
|
switch(_state.label){
|
|
13451
12089
|
case 0:
|
|
13452
12090
|
_this.clear();
|
|
13453
12091
|
_this.sceneOptions = options;
|
|
13454
|
-
_this.engine = (_options_effects_renderer = options.effects.renderer) == null ? void 0 : _options_effects_renderer.engine;
|
|
13455
12092
|
_this.loaderOptions = {
|
|
13456
12093
|
compatibleMode: options.gltf.compatibleMode
|
|
13457
12094
|
};
|
|
@@ -13484,7 +12121,7 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
13484
12121
|
];
|
|
13485
12122
|
case 1:
|
|
13486
12123
|
_this.imageElements = _state.sent();
|
|
13487
|
-
_this.processGLTFResource(gltfResource);
|
|
12124
|
+
_this.processGLTFResource(gltfResource, _this.imageElements);
|
|
13488
12125
|
_this.gltfScene = gltfResource.scenes[0];
|
|
13489
12126
|
_this.gltfSkins = _this.gltfScene.skins;
|
|
13490
12127
|
_this.gltfMeshs = gltfResource.meshes;
|
|
@@ -13564,25 +12201,7 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
13564
12201
|
});
|
|
13565
12202
|
})();
|
|
13566
12203
|
};
|
|
13567
|
-
_proto.
|
|
13568
|
-
if (mesh.materials.length <= 0) {
|
|
13569
|
-
throw new Error("Submesh array is empty for mesh with ID: " + mesh.id + ".");
|
|
13570
|
-
}
|
|
13571
|
-
var geometryData;
|
|
13572
|
-
resource.meshes.forEach(function(meshData) {
|
|
13573
|
-
if (meshData.geometryData.id === mesh.geometry.id) {
|
|
13574
|
-
geometryData = meshData.geometryData;
|
|
13575
|
-
}
|
|
13576
|
-
});
|
|
13577
|
-
if (geometryData === undefined) {
|
|
13578
|
-
throw new Error("Unable to find geometry data for mesh with ID: " + mesh.geometry.id + ".");
|
|
13579
|
-
}
|
|
13580
|
-
if (geometryData.subMeshes.length !== mesh.materials.length) {
|
|
13581
|
-
throw new Error("Mismatch between submeshes count (" + geometryData.subMeshes.length + ") and materials count (" + mesh.materials.length + ").");
|
|
13582
|
-
}
|
|
13583
|
-
//mesh.materials.length !=
|
|
13584
|
-
};
|
|
13585
|
-
_proto.processGLTFResource = function processGLTFResource(resource) {
|
|
12204
|
+
_proto.processGLTFResource = function processGLTFResource(resource, imageElements) {
|
|
13586
12205
|
var _loop = function() {
|
|
13587
12206
|
var baseColorId = _step.value;
|
|
13588
12207
|
if (emissiveIdSet.has(baseColorId)) {
|
|
@@ -13591,29 +12210,26 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
13591
12210
|
});
|
|
13592
12211
|
if (texData) {
|
|
13593
12212
|
var newId = EFFECTS.generateGUID();
|
|
13594
|
-
|
|
13595
|
-
|
|
13596
|
-
newTexData.textureOptions = _extends({}, texData.textureOptions, {
|
|
13597
|
-
id: newId
|
|
13598
|
-
});
|
|
12213
|
+
var newTexData = texData.clone();
|
|
12214
|
+
newTexData.textureOptions.id = newId;
|
|
13599
12215
|
textures.push(newTexData);
|
|
13600
|
-
|
|
12216
|
+
textureDataMap[newId] = newTexData.textureOptions;
|
|
13601
12217
|
textureIdMap[baseColorId] = newId;
|
|
13602
|
-
|
|
12218
|
+
addTextures += 1;
|
|
13603
12219
|
}
|
|
13604
12220
|
}
|
|
13605
12221
|
};
|
|
13606
12222
|
var _this = this;
|
|
13607
|
-
var
|
|
12223
|
+
var textureDataMap = {};
|
|
13608
12224
|
var textures = resource.textures, materials = resource.materials, scenes = resource.scenes, imageBasedLights = resource.imageBasedLights;
|
|
13609
12225
|
textures.forEach(function(tex) {
|
|
13610
12226
|
var texData = tex.textureOptions;
|
|
13611
12227
|
var texId = texData.id;
|
|
13612
12228
|
if (texId) {
|
|
13613
|
-
if (
|
|
13614
|
-
console.error("Duplicate GUID found: " + texId + ", old " +
|
|
12229
|
+
if (textureDataMap[texId]) {
|
|
12230
|
+
console.error("Duplicate GUID found: " + texId + ", old " + textureDataMap[texId] + ", new " + texData + ".");
|
|
13615
12231
|
}
|
|
13616
|
-
|
|
12232
|
+
textureDataMap[texId] = texData;
|
|
13617
12233
|
} else {
|
|
13618
12234
|
console.error("No GUID in texture Data: " + texData + ".");
|
|
13619
12235
|
}
|
|
@@ -13632,29 +12248,29 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
13632
12248
|
emissiveIdSet.add(emissiveTexture.id);
|
|
13633
12249
|
}
|
|
13634
12250
|
});
|
|
13635
|
-
var
|
|
12251
|
+
var addTextures = 0;
|
|
13636
12252
|
var textureIdMap = {};
|
|
13637
12253
|
for(var _iterator = _create_for_of_iterator_helper_loose(baseColorIdSet), _step; !(_step = _iterator()).done;)_loop();
|
|
13638
|
-
if (
|
|
13639
|
-
console.warn("
|
|
12254
|
+
if (addTextures > 0) {
|
|
12255
|
+
console.warn("Add base color texture " + addTextures);
|
|
13640
12256
|
}
|
|
13641
12257
|
materials.forEach(function(mat) {
|
|
13642
12258
|
var _materialData_shader, _materialData_shader1;
|
|
13643
12259
|
var materialData = mat.materialData;
|
|
13644
12260
|
_this.processMaterialData(materialData);
|
|
13645
12261
|
if (((_materialData_shader = materialData.shader) == null ? void 0 : _materialData_shader.id) === UnlitShaderGUID) {
|
|
13646
|
-
_this.processMaterialTexture(materialData, "_BaseColorSampler", true,
|
|
12262
|
+
_this.processMaterialTexture(materialData, "_BaseColorSampler", true, textureDataMap, imageElements);
|
|
13647
12263
|
} else if (((_materialData_shader1 = materialData.shader) == null ? void 0 : _materialData_shader1.id) === PBRShaderGUID) {
|
|
13648
12264
|
var _materialData_textures__EmissiveSampler;
|
|
13649
12265
|
var emissiveTexture = (_materialData_textures__EmissiveSampler = materialData.textures["_EmissiveSampler"]) == null ? void 0 : _materialData_textures__EmissiveSampler.texture;
|
|
13650
12266
|
if (emissiveTexture && textureIdMap[emissiveTexture.id]) {
|
|
13651
12267
|
emissiveTexture.id = textureIdMap[emissiveTexture.id];
|
|
13652
12268
|
}
|
|
13653
|
-
_this.processMaterialTexture(materialData, "_BaseColorSampler", true,
|
|
13654
|
-
_this.processMaterialTexture(materialData, "_MetallicRoughnessSampler", false,
|
|
13655
|
-
_this.processMaterialTexture(materialData, "_NormalSampler", false,
|
|
13656
|
-
_this.processMaterialTexture(materialData, "_OcclusionSampler", false,
|
|
13657
|
-
_this.processMaterialTexture(materialData, "_EmissiveSampler", false,
|
|
12269
|
+
_this.processMaterialTexture(materialData, "_BaseColorSampler", true, textureDataMap, imageElements);
|
|
12270
|
+
_this.processMaterialTexture(materialData, "_MetallicRoughnessSampler", false, textureDataMap, imageElements);
|
|
12271
|
+
_this.processMaterialTexture(materialData, "_NormalSampler", false, textureDataMap, imageElements);
|
|
12272
|
+
_this.processMaterialTexture(materialData, "_OcclusionSampler", false, textureDataMap, imageElements);
|
|
12273
|
+
_this.processMaterialTexture(materialData, "_EmissiveSampler", false, textureDataMap, imageElements);
|
|
13658
12274
|
}
|
|
13659
12275
|
});
|
|
13660
12276
|
var gltfScene = scenes[0];
|
|
@@ -13664,9 +12280,6 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
13664
12280
|
gltfScene.lightsComponentData.forEach(function(comp) {
|
|
13665
12281
|
return _this.processLightComponentData(comp);
|
|
13666
12282
|
});
|
|
13667
|
-
gltfScene.meshesComponentData.forEach(function(comp) {
|
|
13668
|
-
return _this.processMeshComponentData(comp);
|
|
13669
|
-
});
|
|
13670
12283
|
var cubeTextures = [];
|
|
13671
12284
|
imageBasedLights.forEach(function(ibl) {
|
|
13672
12285
|
var data = ibl.imageBaseLightData;
|
|
@@ -13674,11 +12287,11 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
13674
12287
|
data.reflectionsIntensity = data.intensity;
|
|
13675
12288
|
}
|
|
13676
12289
|
if (data.diffuseImage) {
|
|
13677
|
-
var diffuseTexture =
|
|
12290
|
+
var diffuseTexture = textureDataMap[data.diffuseImage.id];
|
|
13678
12291
|
EFFECTS.addItem(cubeTextures, diffuseTexture);
|
|
13679
12292
|
}
|
|
13680
12293
|
if (data.specularImage) {
|
|
13681
|
-
var specularImage =
|
|
12294
|
+
var specularImage = textureDataMap[data.specularImage.id];
|
|
13682
12295
|
EFFECTS.addItem(cubeTextures, specularImage);
|
|
13683
12296
|
}
|
|
13684
12297
|
});
|
|
@@ -13709,8 +12322,6 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
13709
12322
|
_this.processLightComponentData(comp);
|
|
13710
12323
|
} else if (comp.dataType === EFFECTS.spec.DataType.CameraComponent) {
|
|
13711
12324
|
_this.processCameraComponentData(comp);
|
|
13712
|
-
} else if (comp.dataType === EFFECTS.spec.DataType.MeshComponent) {
|
|
13713
|
-
_this.processMeshComponentData(comp);
|
|
13714
12325
|
} else if (comp.dataType === EFFECTS.spec.DataType.SkyboxComponent) {
|
|
13715
12326
|
_this.processSkyboxComponentData(comp);
|
|
13716
12327
|
}
|
|
@@ -13751,7 +12362,6 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
13751
12362
|
}
|
|
13752
12363
|
}
|
|
13753
12364
|
};
|
|
13754
|
-
_proto.processMeshComponentData = function processMeshComponentData(mesh) {};
|
|
13755
12365
|
_proto.processSkyboxComponentData = function processSkyboxComponentData(skybox) {
|
|
13756
12366
|
if (skybox.intensity === undefined) {
|
|
13757
12367
|
skybox.intensity = 1;
|
|
@@ -13865,11 +12475,31 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
13865
12475
|
options.premultiplyAlpha = premultiplyAlpha;
|
|
13866
12476
|
options.generateMipmap = generateMipmap;
|
|
13867
12477
|
};
|
|
13868
|
-
_proto.
|
|
12478
|
+
_proto.initial = function initial(options) {
|
|
12479
|
+
this.loaderOptions = options != null ? options : {};
|
|
12480
|
+
};
|
|
12481
|
+
_proto.checkMeshComponentData = function checkMeshComponentData(mesh, resource) {
|
|
12482
|
+
if (mesh.materials.length <= 0) {
|
|
12483
|
+
throw new Error("Submesh array is empty for mesh with ID: " + mesh.id + ".");
|
|
12484
|
+
}
|
|
12485
|
+
var geometryData;
|
|
12486
|
+
resource.meshes.forEach(function(meshData) {
|
|
12487
|
+
if (meshData.geometryData.id === mesh.geometry.id) {
|
|
12488
|
+
geometryData = meshData.geometryData;
|
|
12489
|
+
}
|
|
12490
|
+
});
|
|
12491
|
+
if (geometryData === undefined) {
|
|
12492
|
+
throw new Error("Unable to find geometry data for mesh with ID: " + mesh.geometry.id + ".");
|
|
12493
|
+
}
|
|
12494
|
+
if (geometryData.subMeshes.length !== mesh.materials.length) {
|
|
12495
|
+
throw new Error("Mismatch between submeshes count (" + geometryData.subMeshes.length + ") and materials count (" + mesh.materials.length + ").");
|
|
12496
|
+
}
|
|
12497
|
+
};
|
|
12498
|
+
_proto.processMaterialTexture = function processMaterialTexture(material, textureName, isBaseColor, textureDataMap, imageElements) {
|
|
13869
12499
|
var texture = material.textures[textureName];
|
|
13870
12500
|
if (texture) {
|
|
13871
12501
|
var id = texture.texture.id;
|
|
13872
|
-
var texData =
|
|
12502
|
+
var texData = textureDataMap[id];
|
|
13873
12503
|
var imageObj;
|
|
13874
12504
|
// @ts-expect-error
|
|
13875
12505
|
if (typeof texData.source !== "number") {
|
|
@@ -13877,7 +12507,7 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
13877
12507
|
throw new Error("Invalid texture option source data, " + texData.source);
|
|
13878
12508
|
} else {
|
|
13879
12509
|
// @ts-expect-error
|
|
13880
|
-
imageObj =
|
|
12510
|
+
imageObj = imageElements[texData.source];
|
|
13881
12511
|
}
|
|
13882
12512
|
if (texData) {
|
|
13883
12513
|
this.processTextureOptions(texData, isBaseColor, imageObj);
|
|
@@ -13922,20 +12552,13 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
13922
12552
|
}
|
|
13923
12553
|
]
|
|
13924
12554
|
};
|
|
12555
|
+
var sceneAABB = this.computeSceneAABB();
|
|
13925
12556
|
return {
|
|
13926
12557
|
source: this.getRemarkString(),
|
|
13927
12558
|
jsonScene: jsonScene,
|
|
13928
12559
|
sceneAABB: {
|
|
13929
|
-
min:
|
|
13930
|
-
|
|
13931
|
-
-1,
|
|
13932
|
-
-1
|
|
13933
|
-
],
|
|
13934
|
-
max: [
|
|
13935
|
-
1,
|
|
13936
|
-
1,
|
|
13937
|
-
1
|
|
13938
|
-
]
|
|
12560
|
+
min: sceneAABB.min.toArray(),
|
|
12561
|
+
max: sceneAABB.max.toArray()
|
|
13939
12562
|
}
|
|
13940
12563
|
};
|
|
13941
12564
|
};
|
|
@@ -14106,99 +12729,6 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
14106
12729
|
});
|
|
14107
12730
|
})();
|
|
14108
12731
|
};
|
|
14109
|
-
_proto.createTreeOptions = function createTreeOptions(scene) {
|
|
14110
|
-
var nodeList = scene.nodes.map(function(node, nodeIndex) {
|
|
14111
|
-
var children = node.children.map(function(child) {
|
|
14112
|
-
if (child.nodeIndex === undefined) {
|
|
14113
|
-
throw new Error("Undefined nodeIndex for child " + child + ".");
|
|
14114
|
-
}
|
|
14115
|
-
return child.nodeIndex;
|
|
14116
|
-
});
|
|
14117
|
-
var pos = [
|
|
14118
|
-
0,
|
|
14119
|
-
0,
|
|
14120
|
-
0
|
|
14121
|
-
];
|
|
14122
|
-
var quat = [
|
|
14123
|
-
0,
|
|
14124
|
-
0,
|
|
14125
|
-
0,
|
|
14126
|
-
0
|
|
14127
|
-
];
|
|
14128
|
-
var scale = [
|
|
14129
|
-
0,
|
|
14130
|
-
0,
|
|
14131
|
-
0
|
|
14132
|
-
];
|
|
14133
|
-
if (node.matrix !== undefined) {
|
|
14134
|
-
if (node.matrix.length !== 16) {
|
|
14135
|
-
throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node + ".");
|
|
14136
|
-
}
|
|
14137
|
-
var mat = Matrix4.fromArray(node.matrix);
|
|
14138
|
-
var transform = mat.getTransform();
|
|
14139
|
-
pos = transform.translation.toArray();
|
|
14140
|
-
quat = transform.rotation.toArray();
|
|
14141
|
-
scale = transform.scale.toArray();
|
|
14142
|
-
} else {
|
|
14143
|
-
if (node.translation !== undefined) {
|
|
14144
|
-
pos = node.translation;
|
|
14145
|
-
}
|
|
14146
|
-
if (node.rotation !== undefined) {
|
|
14147
|
-
quat = node.rotation;
|
|
14148
|
-
}
|
|
14149
|
-
if (node.scale !== undefined) {
|
|
14150
|
-
scale = node.scale;
|
|
14151
|
-
}
|
|
14152
|
-
}
|
|
14153
|
-
node.nodeIndex = nodeIndex;
|
|
14154
|
-
var treeNode = {
|
|
14155
|
-
name: node.name,
|
|
14156
|
-
transform: {
|
|
14157
|
-
position: pos,
|
|
14158
|
-
quat: quat,
|
|
14159
|
-
scale: scale
|
|
14160
|
-
},
|
|
14161
|
-
children: children,
|
|
14162
|
-
id: "" + node.nodeIndex
|
|
14163
|
-
};
|
|
14164
|
-
return treeNode;
|
|
14165
|
-
});
|
|
14166
|
-
var rootNodes = scene.rootNodes.map(function(root) {
|
|
14167
|
-
if (root.nodeIndex === undefined) {
|
|
14168
|
-
throw new Error("Undefined nodeIndex for root " + root + ".");
|
|
14169
|
-
}
|
|
14170
|
-
return root.nodeIndex;
|
|
14171
|
-
});
|
|
14172
|
-
var treeOptions = {
|
|
14173
|
-
nodes: nodeList,
|
|
14174
|
-
children: rootNodes,
|
|
14175
|
-
animation: -1,
|
|
14176
|
-
animations: []
|
|
14177
|
-
};
|
|
14178
|
-
return treeOptions;
|
|
14179
|
-
};
|
|
14180
|
-
_proto.createAnimations = function createAnimations(animations) {
|
|
14181
|
-
return animations.map(function(anim) {
|
|
14182
|
-
var tracks = anim.channels.map(function(channel) {
|
|
14183
|
-
var track = {
|
|
14184
|
-
input: channel.input.array,
|
|
14185
|
-
output: channel.output.array,
|
|
14186
|
-
node: channel.target.node,
|
|
14187
|
-
path: channel.target.path,
|
|
14188
|
-
interpolation: channel.interpolation
|
|
14189
|
-
};
|
|
14190
|
-
return track;
|
|
14191
|
-
});
|
|
14192
|
-
var newAnim = {
|
|
14193
|
-
name: anim.name,
|
|
14194
|
-
tracks: tracks
|
|
14195
|
-
};
|
|
14196
|
-
return newAnim;
|
|
14197
|
-
});
|
|
14198
|
-
};
|
|
14199
|
-
_proto.createTexture2D = function createTexture2D(image, texture, isBaseColor) {
|
|
14200
|
-
return WebGLHelper.createTexture2D(this.engine, image, texture, isBaseColor, this.isTiny3dMode());
|
|
14201
|
-
};
|
|
14202
12732
|
_proto.createSkyboxComponentData = function createSkyboxComponentData(typeName) {
|
|
14203
12733
|
if (typeName !== "NFT" && typeName !== "FARM") {
|
|
14204
12734
|
throw new Error("Invalid skybox type specified: '" + typeName + "'. Valid types are: 'NFT', 'FARM'.");
|
|
@@ -14206,28 +12736,7 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
14206
12736
|
//
|
|
14207
12737
|
var typ = typeName === "NFT" ? exports.PSkyboxType.NFT : exports.PSkyboxType.FARM;
|
|
14208
12738
|
var params = PSkyboxCreator.getSkyboxParams(typ);
|
|
14209
|
-
return PSkyboxCreator.createSkyboxComponentData(
|
|
14210
|
-
};
|
|
14211
|
-
_proto.scaleColorVal = function scaleColorVal(val, fromGLTF) {
|
|
14212
|
-
return fromGLTF ? LoaderHelper.scaleTo255(val) : LoaderHelper.scaleTo1(val);
|
|
14213
|
-
};
|
|
14214
|
-
_proto.scaleColorVec = function scaleColorVec(vec, fromGLTF) {
|
|
14215
|
-
var _this = this;
|
|
14216
|
-
return vec.map(function(val) {
|
|
14217
|
-
return _this.scaleColorVal(val, fromGLTF);
|
|
14218
|
-
});
|
|
14219
|
-
};
|
|
14220
|
-
_proto.createLightOptions = function createLightOptions(light) {
|
|
14221
|
-
return PluginHelper.createLightOptions(light);
|
|
14222
|
-
};
|
|
14223
|
-
_proto.createCameraOptions = function createCameraOptions(camera) {
|
|
14224
|
-
var _PluginHelper_createCameraOptions;
|
|
14225
|
-
return (_PluginHelper_createCameraOptions = PluginHelper.createCameraOptions(camera)) != null ? _PluginHelper_createCameraOptions : {
|
|
14226
|
-
fov: 45,
|
|
14227
|
-
far: 1000,
|
|
14228
|
-
near: 0.01,
|
|
14229
|
-
clipMode: EFFECTS.spec.CameraClipMode.portrait
|
|
14230
|
-
};
|
|
12739
|
+
return PSkyboxCreator.createSkyboxComponentData(params);
|
|
14231
12740
|
};
|
|
14232
12741
|
_proto.clear = function clear() {
|
|
14233
12742
|
this.images = [];
|
|
@@ -14238,6 +12747,45 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
14238
12747
|
this.shaders = [];
|
|
14239
12748
|
this.geometries = [];
|
|
14240
12749
|
};
|
|
12750
|
+
_proto.computeSceneAABB = function computeSceneAABB() {
|
|
12751
|
+
var geometryDataMap = {};
|
|
12752
|
+
this.gltfMeshs.forEach(function(mesh) {
|
|
12753
|
+
var id = mesh.geometryData.id;
|
|
12754
|
+
geometryDataMap[id] = mesh;
|
|
12755
|
+
});
|
|
12756
|
+
var componentDataMap = {};
|
|
12757
|
+
this.components.forEach(function(component) {
|
|
12758
|
+
if (component.dataType === EFFECTS.spec.DataType.MeshComponent) {
|
|
12759
|
+
var meshComponent = component;
|
|
12760
|
+
componentDataMap[component.id] = geometryDataMap[meshComponent.geometry.id];
|
|
12761
|
+
}
|
|
12762
|
+
});
|
|
12763
|
+
var sceneAABB = new Box3();
|
|
12764
|
+
var parentTransformMap = {};
|
|
12765
|
+
this.items.forEach(function(item) {
|
|
12766
|
+
var _item_parentId;
|
|
12767
|
+
var parentId = (_item_parentId = item.parentId) != null ? _item_parentId : "";
|
|
12768
|
+
var _parentTransformMap_parentId;
|
|
12769
|
+
var parentTransform = (_parentTransformMap_parentId = parentTransformMap[parentId]) != null ? _parentTransformMap_parentId : new EFFECTS.Transform();
|
|
12770
|
+
var props = {};
|
|
12771
|
+
if (item.transform) {
|
|
12772
|
+
props.position = new Vector3().copyFrom(item.transform.position);
|
|
12773
|
+
props.rotation = Euler.fromVector3(item.transform.eulerHint);
|
|
12774
|
+
props.scale = new Vector3().copyFrom(item.transform.scale);
|
|
12775
|
+
}
|
|
12776
|
+
var transform = new EFFECTS.Transform(props, parentTransform);
|
|
12777
|
+
parentTransformMap[item.id] = transform;
|
|
12778
|
+
item.components.forEach(function(component) {
|
|
12779
|
+
var mesh = componentDataMap[component.id];
|
|
12780
|
+
if (mesh && mesh.bounds) {
|
|
12781
|
+
var minPos = Vector3.fromArray(mesh.bounds.box.min);
|
|
12782
|
+
var maxPos = Vector3.fromArray(mesh.bounds.box.max);
|
|
12783
|
+
sceneAABB.union(new Box3(minPos, maxPos));
|
|
12784
|
+
}
|
|
12785
|
+
});
|
|
12786
|
+
});
|
|
12787
|
+
return sceneAABB;
|
|
12788
|
+
};
|
|
14241
12789
|
/**
|
|
14242
12790
|
* 按照传入的动画播放参数,计算需要播放的动画索引
|
|
14243
12791
|
*
|
|
@@ -14327,19 +12875,8 @@ var LoaderECSImpl = /*#__PURE__*/ function() {
|
|
|
14327
12875
|
return false;
|
|
14328
12876
|
}
|
|
14329
12877
|
};
|
|
14330
|
-
return
|
|
12878
|
+
return LoaderImpl;
|
|
14331
12879
|
}();
|
|
14332
|
-
var globalLoader;
|
|
14333
|
-
function getDefaultEffectsGLTFLoaderECS(engine, options) {
|
|
14334
|
-
if (!globalLoader) {
|
|
14335
|
-
globalLoader = new LoaderECSImpl();
|
|
14336
|
-
}
|
|
14337
|
-
globalLoader.initial(engine, options);
|
|
14338
|
-
return globalLoader;
|
|
14339
|
-
}
|
|
14340
|
-
function setDefaultEffectsGLTFLoaderECS(loader) {
|
|
14341
|
-
globalLoader = loader;
|
|
14342
|
-
}
|
|
14343
12880
|
function getPBRShaderProperties() {
|
|
14344
12881
|
return '\n _BaseColorSampler ("基础贴图", 2D) = "" {}\n _BaseColorFactor ("基础颜色", Color) = (1, 1, 1, 1)\n _MetallicRoughnessSampler ("金属贴图", 2D) = "" {}\n _MetallicFactor ("金属度", Range(0, 1)) = 1\n _RoughnessFactor ("粗糙度", Range(0, 1)) = 1\n [Toggle] _SpecularAA ("高光抗锯齿", Float) = 0\n _NormalSampler ("法线贴图", 2D) = "" {}\n _NormalScale ("法线贴图强度", Range(0, 2)) = 1\n _OcclusionSampler ("AO贴图", 2D) = "" {}\n _OcclusionStrength ("AO贴图强度", Range(0, 1)) = 1\n _EmissiveSampler ("自发光贴图", 2D) = "" {}\n _EmissiveIntensity ("自发光贴图强度", Float) = 1\n _EmissiveFactor ("自发光颜色", Color) = (0, 0, 0, 1)\n _AlphaCutoff ("Alpha裁剪值", Range(0, 1)) = 0.5\n ';
|
|
14345
12882
|
}
|
|
@@ -14425,7 +12962,7 @@ function getDefaultUnlitMaterialData() {
|
|
|
14425
12962
|
|
|
14426
12963
|
EFFECTS.registerPlugin("tree", ModelTreePlugin, EFFECTS.VFXItem, true);
|
|
14427
12964
|
EFFECTS.registerPlugin("model", ModelPlugin, EFFECTS.VFXItem);
|
|
14428
|
-
var version = "2.0.0-alpha.
|
|
12965
|
+
var version = "2.0.0-alpha.22";
|
|
14429
12966
|
EFFECTS.logger.info("Plugin model version: " + version + ".");
|
|
14430
12967
|
if (version !== EFFECTS__namespace.version) {
|
|
14431
12968
|
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!");
|
|
@@ -14448,7 +12985,6 @@ exports.HitTestingProxy = HitTestingProxy;
|
|
|
14448
12985
|
exports.HookOGLFunc = HookOGLFunc;
|
|
14449
12986
|
exports.InterpolationSampler = InterpolationSampler;
|
|
14450
12987
|
exports.JSONConverter = JSONConverter;
|
|
14451
|
-
exports.LoaderECSImpl = LoaderECSImpl;
|
|
14452
12988
|
exports.LoaderHelper = LoaderHelper;
|
|
14453
12989
|
exports.LoaderImpl = LoaderImpl;
|
|
14454
12990
|
exports.Matrix3 = Matrix3;
|
|
@@ -14506,7 +13042,6 @@ exports.createPluginMaterial = createPluginMaterial;
|
|
|
14506
13042
|
exports.fetchPBRShaderCode = fetchPBRShaderCode;
|
|
14507
13043
|
exports.fetchUnlitShaderCode = fetchUnlitShaderCode;
|
|
14508
13044
|
exports.getDefaultEffectsGLTFLoader = getDefaultEffectsGLTFLoader;
|
|
14509
|
-
exports.getDefaultEffectsGLTFLoaderECS = getDefaultEffectsGLTFLoaderECS;
|
|
14510
13045
|
exports.getDefaultPBRMaterialData = getDefaultPBRMaterialData;
|
|
14511
13046
|
exports.getDefaultUnlitMaterialData = getDefaultUnlitMaterialData;
|
|
14512
13047
|
exports.getDiffuseOnlyShaderCode = getDiffuseOnlyShaderCode;
|
|
@@ -14529,6 +13064,5 @@ exports.getTransparecyBaseShader = getTransparecyBaseShader;
|
|
|
14529
13064
|
exports.getTransparecyFilterShader = getTransparecyFilterShader;
|
|
14530
13065
|
exports.getUnlitShaderProperties = getUnlitShaderProperties;
|
|
14531
13066
|
exports.setDefaultEffectsGLTFLoader = setDefaultEffectsGLTFLoader;
|
|
14532
|
-
exports.setDefaultEffectsGLTFLoaderECS = setDefaultEffectsGLTFLoaderECS;
|
|
14533
13067
|
exports.version = version;
|
|
14534
13068
|
//# sourceMappingURL=alipay.js.map
|