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