@galacean/effects-plugin-model 2.0.0-alpha.22 → 2.0.0-alpha.24
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 +830 -13
- package/dist/alipay.js.map +1 -1
- package/dist/alipay.mjs +830 -13
- package/dist/alipay.mjs.map +1 -1
- package/dist/gltf/loader-impl.d.ts +24 -6
- package/dist/gltf/protocol.d.ts +17 -3
- package/dist/index.js +831 -14
- 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 +831 -14
- package/dist/index.mjs.map +1 -1
- package/dist/loader.mjs +831 -14
- package/dist/loader.mjs.map +1 -1
- package/dist/runtime/camera.d.ts +7 -2
- package/dist/runtime/scene.d.ts +1 -1
- package/package.json +4 -4
package/dist/index.mjs
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.24
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as EFFECTS from '@galacean/effects';
|
|
@@ -1875,6 +1875,9 @@ var deg2rad = Math.PI / 180;
|
|
|
1875
1875
|
* Y 轴上视角
|
|
1876
1876
|
*/ _this.fov = 45;
|
|
1877
1877
|
/**
|
|
1878
|
+
* fov 缩放大小
|
|
1879
|
+
*/ _this.fovScaleRatio = 1;
|
|
1880
|
+
/**
|
|
1878
1881
|
* 纵横比
|
|
1879
1882
|
*/ _this.aspect = 1.0;
|
|
1880
1883
|
/**
|
|
@@ -1914,7 +1917,7 @@ var deg2rad = Math.PI / 180;
|
|
|
1914
1917
|
this.transform.fromEffectsTransform(this.owner.transform);
|
|
1915
1918
|
}
|
|
1916
1919
|
var reverse = this.clipMode === spec.CameraClipMode.portrait;
|
|
1917
|
-
this.projectionMatrix.perspective(this.fov * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse);
|
|
1920
|
+
this.projectionMatrix.perspective(this.fov * deg2rad * this.fovScaleRatio, this.aspect, this.nearPlane, this.farPlane, reverse);
|
|
1918
1921
|
this.viewMatrix = this.matrix.invert();
|
|
1919
1922
|
};
|
|
1920
1923
|
/**
|
|
@@ -1923,14 +1926,14 @@ var deg2rad = Math.PI / 180;
|
|
|
1923
1926
|
* @returns 投影矩阵
|
|
1924
1927
|
*/ _proto.getNewProjectionMatrix = function getNewProjectionMatrix(fov) {
|
|
1925
1928
|
var reverse = this.clipMode === spec.CameraClipMode.portrait;
|
|
1926
|
-
return new Matrix4().perspective(Math.min(fov * 1.25, 140) * deg2rad, this.aspect, this.nearPlane, this.farPlane, reverse);
|
|
1929
|
+
return new Matrix4().perspective(Math.min(fov * 1.25, 140) * deg2rad * this.fovScaleRatio, this.aspect, this.nearPlane, this.farPlane, reverse);
|
|
1927
1930
|
};
|
|
1928
1931
|
/**
|
|
1929
1932
|
* 计算视角中的包围盒大小
|
|
1930
1933
|
* @param box - 包围盒
|
|
1931
1934
|
* @returns 视角中的包围盒
|
|
1932
1935
|
*/ _proto.computeViewAABB = function computeViewAABB(box) {
|
|
1933
|
-
var tanTheta = Math.tan(this.fov * deg2rad * 0.5);
|
|
1936
|
+
var tanTheta = Math.tan(this.fov * deg2rad * this.fovScaleRatio * 0.5);
|
|
1934
1937
|
var aspect = this.aspect;
|
|
1935
1938
|
var yFarCoord = 0;
|
|
1936
1939
|
var yNearCoord = 0;
|
|
@@ -2060,15 +2063,17 @@ var deg2rad = Math.PI / 180;
|
|
|
2060
2063
|
};
|
|
2061
2064
|
/**
|
|
2062
2065
|
* 更新默认相机状态,并计算新的透视和相机矩阵
|
|
2063
|
-
* @param
|
|
2066
|
+
* @param fov - 视角
|
|
2067
|
+
* @param fovScaleRatio - 视角缩放比例
|
|
2064
2068
|
* @param aspect - 纵横比
|
|
2065
2069
|
* @param nearPlane - 近裁剪平面
|
|
2066
2070
|
* @param farPlane - 远裁剪平面
|
|
2067
2071
|
* @param position - 位置
|
|
2068
2072
|
* @param rotation - 旋转
|
|
2069
2073
|
* @param clipMode - 剪裁模式
|
|
2070
|
-
*/ _proto.updateDefaultCamera = function updateDefaultCamera(
|
|
2071
|
-
this.defaultCamera.fov =
|
|
2074
|
+
*/ _proto.updateDefaultCamera = function updateDefaultCamera(fov, fovScaleRatio, aspect, nearPlane, farPlane, position, rotation, clipMode) {
|
|
2075
|
+
this.defaultCamera.fov = fov;
|
|
2076
|
+
this.defaultCamera.fovScaleRatio = fovScaleRatio;
|
|
2072
2077
|
this.defaultCamera.aspect = aspect;
|
|
2073
2078
|
this.defaultCamera.nearPlane = nearPlane;
|
|
2074
2079
|
this.defaultCamera.farPlane = farPlane;
|
|
@@ -3736,12 +3741,12 @@ var EffectsMeshProxy = /*#__PURE__*/ function() {
|
|
|
3736
3741
|
/**
|
|
3737
3742
|
* 更新默认相机状态,根据传入的相机参数
|
|
3738
3743
|
* @param camera - 相机参数
|
|
3739
|
-
*/ _proto.updateDefaultCamera = function updateDefaultCamera(camera) {
|
|
3744
|
+
*/ _proto.updateDefaultCamera = function updateDefaultCamera(camera, fovScaleRatio) {
|
|
3740
3745
|
var effectsTransfrom = new Transform(_extends({}, camera, {
|
|
3741
3746
|
valid: true
|
|
3742
3747
|
}));
|
|
3743
3748
|
var newTransform = new PTransform().fromEffectsTransform(effectsTransfrom);
|
|
3744
|
-
this.cameraManager.updateDefaultCamera(camera.fov, camera.aspect, camera.near, camera.far, newTransform.getPosition(), newTransform.getRotation(), camera.clipMode);
|
|
3749
|
+
this.cameraManager.updateDefaultCamera(camera.fov, fovScaleRatio, camera.aspect, camera.near, camera.far, newTransform.getPosition(), newTransform.getRotation(), camera.clipMode);
|
|
3745
3750
|
};
|
|
3746
3751
|
/**
|
|
3747
3752
|
* 更新插件场景,需要更新内部的相关的插件对象,特别是 Mesh 对象的骨骼动画
|
|
@@ -9883,7 +9888,7 @@ var ModelPluginComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
|
9883
9888
|
* @param composition - 当前合成对象
|
|
9884
9889
|
* @param sceneManager - 当前合成对象绑定的 SceneManager
|
|
9885
9890
|
*/ _proto.updateSceneCamera = function updateSceneCamera(composition) {
|
|
9886
|
-
this.scene.updateDefaultCamera(composition.camera.getOptions());
|
|
9891
|
+
this.scene.updateDefaultCamera(composition.camera.getOptions(), composition.camera.getFovScaleRatio());
|
|
9887
9892
|
};
|
|
9888
9893
|
_proto.getLightItemCount = function getLightItemCount() {
|
|
9889
9894
|
var _this_item_composition;
|
|
@@ -11998,11 +12003,11 @@ var vertexBufferSemanticMap = {
|
|
|
11998
12003
|
a_Target_Tangent3: "TANGENT_BS3"
|
|
11999
12004
|
};
|
|
12000
12005
|
|
|
12001
|
-
function getDefaultEffectsGLTFLoader(options) {
|
|
12006
|
+
function getDefaultEffectsGLTFLoader(engine, options) {
|
|
12002
12007
|
if (!defaultGLTFLoader) {
|
|
12003
12008
|
defaultGLTFLoader = new LoaderImpl();
|
|
12004
12009
|
}
|
|
12005
|
-
defaultGLTFLoader.initial(options);
|
|
12010
|
+
defaultGLTFLoader.initial(engine, options);
|
|
12006
12011
|
return defaultGLTFLoader;
|
|
12007
12012
|
}
|
|
12008
12013
|
function setDefaultEffectsGLTFLoader(loader) {
|
|
@@ -12460,7 +12465,8 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
12460
12465
|
options.premultiplyAlpha = premultiplyAlpha;
|
|
12461
12466
|
options.generateMipmap = generateMipmap;
|
|
12462
12467
|
};
|
|
12463
|
-
_proto.initial = function initial(options) {
|
|
12468
|
+
_proto.initial = function initial(engine, options) {
|
|
12469
|
+
this.engine = engine;
|
|
12464
12470
|
this.loaderOptions = options != null ? options : {};
|
|
12465
12471
|
};
|
|
12466
12472
|
_proto.checkMeshComponentData = function checkMeshComponentData(mesh, resource) {
|
|
@@ -12860,6 +12866,286 @@ var LoaderImpl = /*#__PURE__*/ function() {
|
|
|
12860
12866
|
return false;
|
|
12861
12867
|
}
|
|
12862
12868
|
};
|
|
12869
|
+
/**
|
|
12870
|
+
* for old scene compatibility
|
|
12871
|
+
*/ _proto.processLight = function processLight(lights, fromGLTF) {
|
|
12872
|
+
var _this = this;
|
|
12873
|
+
lights.forEach(function(l) {
|
|
12874
|
+
if (l.color === undefined) {
|
|
12875
|
+
if (fromGLTF) {
|
|
12876
|
+
l.color = [
|
|
12877
|
+
255,
|
|
12878
|
+
255,
|
|
12879
|
+
255,
|
|
12880
|
+
255
|
|
12881
|
+
];
|
|
12882
|
+
} else {
|
|
12883
|
+
l.color = [
|
|
12884
|
+
1,
|
|
12885
|
+
1,
|
|
12886
|
+
1,
|
|
12887
|
+
1
|
|
12888
|
+
];
|
|
12889
|
+
}
|
|
12890
|
+
} else {
|
|
12891
|
+
l.color[0] = _this.scaleColorVal(l.color[0], fromGLTF);
|
|
12892
|
+
l.color[1] = _this.scaleColorVal(l.color[1], fromGLTF);
|
|
12893
|
+
l.color[2] = _this.scaleColorVal(l.color[2], fromGLTF);
|
|
12894
|
+
l.color[3] = _this.scaleColorVal(l.color[3], fromGLTF);
|
|
12895
|
+
}
|
|
12896
|
+
});
|
|
12897
|
+
};
|
|
12898
|
+
_proto.processCamera = function processCamera(cameras, fromGLTF) {
|
|
12899
|
+
var scale = fromGLTF ? 180.0 / Math.PI : Math.PI / 180.0;
|
|
12900
|
+
cameras.forEach(function(camera) {
|
|
12901
|
+
if (camera.perspective !== undefined) {
|
|
12902
|
+
camera.perspective.yfov *= scale;
|
|
12903
|
+
}
|
|
12904
|
+
});
|
|
12905
|
+
};
|
|
12906
|
+
_proto.processMaterial = function processMaterial(materials, fromGLTF) {
|
|
12907
|
+
var _this = this;
|
|
12908
|
+
materials.forEach(function(mat) {
|
|
12909
|
+
if (mat.baseColorFactor === undefined) {
|
|
12910
|
+
if (fromGLTF) {
|
|
12911
|
+
mat.baseColorFactor = [
|
|
12912
|
+
255,
|
|
12913
|
+
255,
|
|
12914
|
+
255,
|
|
12915
|
+
255
|
|
12916
|
+
];
|
|
12917
|
+
} else {
|
|
12918
|
+
mat.baseColorFactor = [
|
|
12919
|
+
1,
|
|
12920
|
+
1,
|
|
12921
|
+
1,
|
|
12922
|
+
1
|
|
12923
|
+
];
|
|
12924
|
+
}
|
|
12925
|
+
} else {
|
|
12926
|
+
mat.baseColorFactor[0] = _this.scaleColorVal(mat.baseColorFactor[0], fromGLTF);
|
|
12927
|
+
mat.baseColorFactor[1] = _this.scaleColorVal(mat.baseColorFactor[1], fromGLTF);
|
|
12928
|
+
mat.baseColorFactor[2] = _this.scaleColorVal(mat.baseColorFactor[2], fromGLTF);
|
|
12929
|
+
mat.baseColorFactor[3] = _this.scaleColorVal(mat.baseColorFactor[3], fromGLTF);
|
|
12930
|
+
}
|
|
12931
|
+
if (mat.emissiveFactor === undefined) {
|
|
12932
|
+
if (fromGLTF) {
|
|
12933
|
+
mat.emissiveFactor = [
|
|
12934
|
+
255,
|
|
12935
|
+
255,
|
|
12936
|
+
255,
|
|
12937
|
+
255
|
|
12938
|
+
];
|
|
12939
|
+
} else {
|
|
12940
|
+
mat.emissiveFactor = [
|
|
12941
|
+
1,
|
|
12942
|
+
1,
|
|
12943
|
+
1,
|
|
12944
|
+
1
|
|
12945
|
+
];
|
|
12946
|
+
}
|
|
12947
|
+
} else {
|
|
12948
|
+
mat.emissiveFactor[0] = _this.scaleColorVal(mat.emissiveFactor[0], fromGLTF);
|
|
12949
|
+
mat.emissiveFactor[1] = _this.scaleColorVal(mat.emissiveFactor[1], fromGLTF);
|
|
12950
|
+
mat.emissiveFactor[2] = _this.scaleColorVal(mat.emissiveFactor[2], fromGLTF);
|
|
12951
|
+
mat.emissiveFactor[3] = _this.scaleColorVal(mat.emissiveFactor[3], fromGLTF);
|
|
12952
|
+
}
|
|
12953
|
+
if (fromGLTF && mat.occlusionTexture !== undefined && mat.occlusionTexture.strength === undefined) {
|
|
12954
|
+
mat.occlusionTexture.strength = _this.isTiny3dMode() ? 0 : 1;
|
|
12955
|
+
}
|
|
12956
|
+
});
|
|
12957
|
+
};
|
|
12958
|
+
_proto.createTreeOptions = function createTreeOptions(scene) {
|
|
12959
|
+
var nodeList = scene.nodes.map(function(node, nodeIndex) {
|
|
12960
|
+
var children = node.children.map(function(child) {
|
|
12961
|
+
if (child.nodeIndex === undefined) {
|
|
12962
|
+
throw new Error("Undefined nodeIndex for child " + child);
|
|
12963
|
+
}
|
|
12964
|
+
return child.nodeIndex;
|
|
12965
|
+
});
|
|
12966
|
+
var pos;
|
|
12967
|
+
var quat;
|
|
12968
|
+
var scale;
|
|
12969
|
+
if (node.matrix !== undefined) {
|
|
12970
|
+
if (node.matrix.length !== 16) {
|
|
12971
|
+
throw new Error("Invalid matrix length " + node.matrix.length + " for node " + node);
|
|
12972
|
+
}
|
|
12973
|
+
var mat = Matrix4.fromArray(node.matrix);
|
|
12974
|
+
var transform = mat.getTransform();
|
|
12975
|
+
pos = transform.translation.toArray();
|
|
12976
|
+
quat = transform.rotation.toArray();
|
|
12977
|
+
scale = transform.scale.toArray();
|
|
12978
|
+
} else {
|
|
12979
|
+
if (node.translation !== undefined) {
|
|
12980
|
+
pos = node.translation;
|
|
12981
|
+
}
|
|
12982
|
+
if (node.rotation !== undefined) {
|
|
12983
|
+
quat = node.rotation;
|
|
12984
|
+
}
|
|
12985
|
+
if (node.scale !== undefined) {
|
|
12986
|
+
scale = node.scale;
|
|
12987
|
+
}
|
|
12988
|
+
}
|
|
12989
|
+
node.nodeIndex = nodeIndex;
|
|
12990
|
+
var treeNode = {
|
|
12991
|
+
name: node.name,
|
|
12992
|
+
transform: {
|
|
12993
|
+
position: pos,
|
|
12994
|
+
quat: quat,
|
|
12995
|
+
scale: scale
|
|
12996
|
+
},
|
|
12997
|
+
children: children,
|
|
12998
|
+
id: "" + node.nodeIndex
|
|
12999
|
+
};
|
|
13000
|
+
return treeNode;
|
|
13001
|
+
});
|
|
13002
|
+
var rootNodes = scene.rootNodes.map(function(root) {
|
|
13003
|
+
if (root.nodeIndex === undefined) {
|
|
13004
|
+
throw new Error("Undefined nodeIndex for root " + root);
|
|
13005
|
+
}
|
|
13006
|
+
return root.nodeIndex;
|
|
13007
|
+
});
|
|
13008
|
+
var treeOptions = {
|
|
13009
|
+
nodes: nodeList,
|
|
13010
|
+
children: rootNodes,
|
|
13011
|
+
animation: -1,
|
|
13012
|
+
animations: []
|
|
13013
|
+
};
|
|
13014
|
+
return treeOptions;
|
|
13015
|
+
};
|
|
13016
|
+
_proto.createAnimations = function createAnimations(animations) {
|
|
13017
|
+
return animations.map(function(anim) {
|
|
13018
|
+
var tracks = anim.channels.map(function(channel) {
|
|
13019
|
+
var track = {
|
|
13020
|
+
input: channel.input.array,
|
|
13021
|
+
output: channel.output.array,
|
|
13022
|
+
node: channel.target.node,
|
|
13023
|
+
path: channel.target.path,
|
|
13024
|
+
interpolation: channel.interpolation
|
|
13025
|
+
};
|
|
13026
|
+
return track;
|
|
13027
|
+
});
|
|
13028
|
+
var newAnim = {
|
|
13029
|
+
name: anim.name,
|
|
13030
|
+
tracks: tracks
|
|
13031
|
+
};
|
|
13032
|
+
return newAnim;
|
|
13033
|
+
});
|
|
13034
|
+
};
|
|
13035
|
+
_proto.createGeometry = function createGeometry(primitive, hasSkinAnim) {
|
|
13036
|
+
var proxy = new GeometryProxy(this.engine, primitive, hasSkinAnim);
|
|
13037
|
+
return proxy.geometry;
|
|
13038
|
+
};
|
|
13039
|
+
_proto.createMaterial = function createMaterial(material) {
|
|
13040
|
+
var proxy = new MaterialProxy(material, [], this.isTiny3dMode());
|
|
13041
|
+
return proxy.material;
|
|
13042
|
+
};
|
|
13043
|
+
_proto.createTexture2D = function createTexture2D(image, texture, isBaseColor) {
|
|
13044
|
+
return WebGLHelper.createTexture2D(this.engine, image, texture, isBaseColor, this.isTiny3dMode());
|
|
13045
|
+
};
|
|
13046
|
+
_proto.createTextureCube = function createTextureCube(cubeImages, level0Size) {
|
|
13047
|
+
var _this = this;
|
|
13048
|
+
if (cubeImages.length == 0) {
|
|
13049
|
+
throw new Error("createTextureCube: Invalid cubeImages length " + cubeImages);
|
|
13050
|
+
}
|
|
13051
|
+
var mipmaps = [];
|
|
13052
|
+
cubeImages.forEach(function(cubeImage) {
|
|
13053
|
+
if (cubeImage.length != 6) {
|
|
13054
|
+
throw new Error("createTextureCube: cubeimage count should always be 6, " + cubeImage);
|
|
13055
|
+
}
|
|
13056
|
+
//
|
|
13057
|
+
var imgList = [];
|
|
13058
|
+
cubeImage.forEach(function(img) {
|
|
13059
|
+
if (img.imageData === undefined) {
|
|
13060
|
+
throw new Error("createTextureCube: Invalid image data from " + img);
|
|
13061
|
+
}
|
|
13062
|
+
//
|
|
13063
|
+
imgList.push({
|
|
13064
|
+
type: "buffer",
|
|
13065
|
+
data: img.imageData,
|
|
13066
|
+
mimeType: img.mimeType
|
|
13067
|
+
});
|
|
13068
|
+
});
|
|
13069
|
+
if (_this.isTiny3dMode()) {
|
|
13070
|
+
var ref;
|
|
13071
|
+
ref = [
|
|
13072
|
+
imgList[5],
|
|
13073
|
+
imgList[4]
|
|
13074
|
+
], imgList[4] = ref[0], imgList[5] = ref[1];
|
|
13075
|
+
}
|
|
13076
|
+
mipmaps.push(imgList);
|
|
13077
|
+
});
|
|
13078
|
+
//
|
|
13079
|
+
if (mipmaps.length == 1) {
|
|
13080
|
+
// no mipmaps
|
|
13081
|
+
return WebGLHelper.createTextureCubeFromBuffer(this.engine, mipmaps[0]);
|
|
13082
|
+
} else {
|
|
13083
|
+
// has mipmaps
|
|
13084
|
+
return WebGLHelper.createTextureCubeMipmapFromBuffer(this.engine, mipmaps, level0Size != null ? level0Size : Math.pow(2, mipmaps.length - 1));
|
|
13085
|
+
}
|
|
13086
|
+
};
|
|
13087
|
+
_proto.createSkybox = function createSkybox(ibl) {
|
|
13088
|
+
var _this = this;
|
|
13089
|
+
var _ibl_reflectionsIntensity;
|
|
13090
|
+
var reflectionsIntensity = (_ibl_reflectionsIntensity = ibl.reflectionsIntensity) != null ? _ibl_reflectionsIntensity : ibl.intensity;
|
|
13091
|
+
var irradianceCoeffs = ibl.irradianceCoefficients;
|
|
13092
|
+
var inSpecularImages = ibl.specularImages;
|
|
13093
|
+
var specularImages = inSpecularImages.map(function(images) {
|
|
13094
|
+
var newImages = images.map(function(img) {
|
|
13095
|
+
var outImg = {
|
|
13096
|
+
type: "buffer",
|
|
13097
|
+
data: img.imageData,
|
|
13098
|
+
mimeType: img.mimeType
|
|
13099
|
+
};
|
|
13100
|
+
return outImg;
|
|
13101
|
+
});
|
|
13102
|
+
if (_this.isTiny3dMode()) {
|
|
13103
|
+
var ref;
|
|
13104
|
+
ref = [
|
|
13105
|
+
newImages[5],
|
|
13106
|
+
newImages[4]
|
|
13107
|
+
], newImages[4] = ref[0], newImages[5] = ref[1];
|
|
13108
|
+
}
|
|
13109
|
+
return newImages;
|
|
13110
|
+
});
|
|
13111
|
+
var specularMipCount = specularImages.length - 1;
|
|
13112
|
+
var _ibl_specularImageSize;
|
|
13113
|
+
var specularImageSize = (_ibl_specularImageSize = ibl.specularImageSize) != null ? _ibl_specularImageSize : Math.pow(2, specularMipCount);
|
|
13114
|
+
var newIrradianceCoeffs = [];
|
|
13115
|
+
irradianceCoeffs.forEach(function(coeffs) {
|
|
13116
|
+
var _newIrradianceCoeffs;
|
|
13117
|
+
(_newIrradianceCoeffs = newIrradianceCoeffs).push.apply(_newIrradianceCoeffs, [].concat(coeffs));
|
|
13118
|
+
});
|
|
13119
|
+
var params = {
|
|
13120
|
+
type: "buffer",
|
|
13121
|
+
renderable: this.isSkyboxVis(),
|
|
13122
|
+
intensity: ibl.intensity,
|
|
13123
|
+
reflectionsIntensity: reflectionsIntensity,
|
|
13124
|
+
irradianceCoeffs: newIrradianceCoeffs,
|
|
13125
|
+
specularImage: specularImages,
|
|
13126
|
+
specularMipCount: specularMipCount,
|
|
13127
|
+
specularImageSize: specularImageSize
|
|
13128
|
+
};
|
|
13129
|
+
return PSkyboxCreator.createSkyboxOptions(this.engine, params);
|
|
13130
|
+
};
|
|
13131
|
+
_proto.createDefaultSkybox = function createDefaultSkybox(typeName) {
|
|
13132
|
+
if (typeName !== "NFT" && typeName !== "FARM") {
|
|
13133
|
+
throw new Error("Invalid skybox type name " + typeName);
|
|
13134
|
+
}
|
|
13135
|
+
//
|
|
13136
|
+
var typ = typeName === "NFT" ? PSkyboxType.NFT : PSkyboxType.FARM;
|
|
13137
|
+
var params = PSkyboxCreator.getSkyboxParams(typ);
|
|
13138
|
+
return PSkyboxCreator.createSkyboxOptions(this.engine, params);
|
|
13139
|
+
};
|
|
13140
|
+
_proto.scaleColorVal = function scaleColorVal(val, fromGLTF) {
|
|
13141
|
+
return fromGLTF ? LoaderHelper.scaleTo255(val) : LoaderHelper.scaleTo1(val);
|
|
13142
|
+
};
|
|
13143
|
+
_proto.scaleColorVec = function scaleColorVec(vec, fromGLTF) {
|
|
13144
|
+
var _this = this;
|
|
13145
|
+
return vec.map(function(val) {
|
|
13146
|
+
return _this.scaleColorVal(val, fromGLTF);
|
|
13147
|
+
});
|
|
13148
|
+
};
|
|
12863
13149
|
return LoaderImpl;
|
|
12864
13150
|
}();
|
|
12865
13151
|
function getPBRShaderProperties() {
|
|
@@ -12944,10 +13230,541 @@ function getDefaultUnlitMaterialData() {
|
|
|
12944
13230
|
};
|
|
12945
13231
|
return material;
|
|
12946
13232
|
}
|
|
13233
|
+
var GeometryProxy = /*#__PURE__*/ function() {
|
|
13234
|
+
function GeometryProxy(engine, gltfGeometry, hasSkinAnimation) {
|
|
13235
|
+
this.engine = engine;
|
|
13236
|
+
this.gltfGeometry = gltfGeometry;
|
|
13237
|
+
this.hasSkinAnimation = hasSkinAnimation;
|
|
13238
|
+
}
|
|
13239
|
+
var _proto = GeometryProxy.prototype;
|
|
13240
|
+
_proto._getBufferAttrib = function _getBufferAttrib(inAttrib) {
|
|
13241
|
+
var attrib = {
|
|
13242
|
+
type: inAttrib.type,
|
|
13243
|
+
size: inAttrib.itemSize,
|
|
13244
|
+
//stride: inAttrib.stride,
|
|
13245
|
+
//offset: inAttrib.offset,
|
|
13246
|
+
data: inAttrib.array,
|
|
13247
|
+
normalize: inAttrib.normalized
|
|
13248
|
+
};
|
|
13249
|
+
return attrib;
|
|
13250
|
+
};
|
|
13251
|
+
_proto.texCoordAttrib = function texCoordAttrib(index) {
|
|
13252
|
+
return this.gltfGeometry.getTexCoord(index);
|
|
13253
|
+
};
|
|
13254
|
+
_proto.getTargetPosition = function getTargetPosition(index) {
|
|
13255
|
+
return this.gltfGeometry.getAttribute("POSITION" + index);
|
|
13256
|
+
};
|
|
13257
|
+
_proto.getTargetNormal = function getTargetNormal(index) {
|
|
13258
|
+
return this.gltfGeometry.getAttribute("NORMAL" + index);
|
|
13259
|
+
};
|
|
13260
|
+
_proto.getTargetTangent = function getTargetTangent(index) {
|
|
13261
|
+
return this.gltfGeometry.getAttribute("TANGENT" + index);
|
|
13262
|
+
};
|
|
13263
|
+
_create_class(GeometryProxy, [
|
|
13264
|
+
{
|
|
13265
|
+
key: "geometry",
|
|
13266
|
+
get: function get() {
|
|
13267
|
+
var _this = this;
|
|
13268
|
+
var attributes = {};
|
|
13269
|
+
if (this.hasPosition) {
|
|
13270
|
+
var attrib = this.positionAttrib;
|
|
13271
|
+
attributes["a_Position"] = this._getBufferAttrib(attrib);
|
|
13272
|
+
} else {
|
|
13273
|
+
throw new Error("Position attribute missing");
|
|
13274
|
+
}
|
|
13275
|
+
if (this.hasNormal) {
|
|
13276
|
+
var attrib1 = this.normalAttrib;
|
|
13277
|
+
if (attrib1 !== undefined) {
|
|
13278
|
+
attributes["a_Normal"] = this._getBufferAttrib(attrib1);
|
|
13279
|
+
}
|
|
13280
|
+
}
|
|
13281
|
+
if (this.hasTangent) {
|
|
13282
|
+
var attrib2 = this.tangentAttrib;
|
|
13283
|
+
if (attrib2 !== undefined) {
|
|
13284
|
+
attributes["a_Tangent"] = this._getBufferAttrib(attrib2);
|
|
13285
|
+
}
|
|
13286
|
+
}
|
|
13287
|
+
this.texCoordList.forEach(function(val) {
|
|
13288
|
+
var attrib = _this.texCoordAttrib(val);
|
|
13289
|
+
var attribName = "a_UV" + (val + 1);
|
|
13290
|
+
attributes[attribName] = _this._getBufferAttrib(attrib);
|
|
13291
|
+
});
|
|
13292
|
+
if (this.hasSkinAnimation) {
|
|
13293
|
+
var jointAttrib = this.jointAttribute;
|
|
13294
|
+
if (jointAttrib !== undefined) {
|
|
13295
|
+
attributes["a_Joint1"] = this._getBufferAttrib(jointAttrib);
|
|
13296
|
+
}
|
|
13297
|
+
var weightAttrib = this.weightAttribute;
|
|
13298
|
+
if (weightAttrib !== undefined) {
|
|
13299
|
+
attributes["a_Weight1"] = this._getBufferAttrib(weightAttrib);
|
|
13300
|
+
}
|
|
13301
|
+
}
|
|
13302
|
+
/**
|
|
13303
|
+
* 设置Morph动画需要的Attribute,主要包括Position,Normal和Tangent
|
|
13304
|
+
*/ for(var i = 0; i < 8; i++){
|
|
13305
|
+
var positionAttrib = this.getTargetPosition(i);
|
|
13306
|
+
if (positionAttrib !== undefined) {
|
|
13307
|
+
attributes["a_Target_Position" + i] = this._getBufferAttrib(positionAttrib);
|
|
13308
|
+
}
|
|
13309
|
+
var normalAttrib = this.getTargetNormal(i);
|
|
13310
|
+
if (normalAttrib !== undefined) {
|
|
13311
|
+
attributes["a_Target_Normal" + i] = this._getBufferAttrib(normalAttrib);
|
|
13312
|
+
}
|
|
13313
|
+
var tangentAttrib = this.getTargetTangent(i);
|
|
13314
|
+
if (tangentAttrib !== undefined) {
|
|
13315
|
+
attributes["a_Target_Tangent" + i] = this._getBufferAttrib(tangentAttrib);
|
|
13316
|
+
}
|
|
13317
|
+
}
|
|
13318
|
+
var indexArray = this.indexArray;
|
|
13319
|
+
if (indexArray !== undefined) {
|
|
13320
|
+
return Geometry.create(this.engine, {
|
|
13321
|
+
attributes: attributes,
|
|
13322
|
+
indices: {
|
|
13323
|
+
data: indexArray
|
|
13324
|
+
},
|
|
13325
|
+
drawStart: 0,
|
|
13326
|
+
drawCount: indexArray.length,
|
|
13327
|
+
mode: glContext.TRIANGLES
|
|
13328
|
+
});
|
|
13329
|
+
} else {
|
|
13330
|
+
return Geometry.create(this.engine, {
|
|
13331
|
+
attributes: attributes,
|
|
13332
|
+
drawStart: 0,
|
|
13333
|
+
drawCount: this.positionAttrib.array.length / 3,
|
|
13334
|
+
mode: glContext.TRIANGLES
|
|
13335
|
+
});
|
|
13336
|
+
}
|
|
13337
|
+
}
|
|
13338
|
+
},
|
|
13339
|
+
{
|
|
13340
|
+
key: "positionAttrib",
|
|
13341
|
+
get: function get() {
|
|
13342
|
+
return this.gltfGeometry.getPosition();
|
|
13343
|
+
}
|
|
13344
|
+
},
|
|
13345
|
+
{
|
|
13346
|
+
key: "normalAttrib",
|
|
13347
|
+
get: function get() {
|
|
13348
|
+
return this.gltfGeometry.getNormal();
|
|
13349
|
+
}
|
|
13350
|
+
},
|
|
13351
|
+
{
|
|
13352
|
+
key: "tangentAttrib",
|
|
13353
|
+
get: function get() {
|
|
13354
|
+
return this.gltfGeometry.getTangent();
|
|
13355
|
+
}
|
|
13356
|
+
},
|
|
13357
|
+
{
|
|
13358
|
+
key: "jointAttribute",
|
|
13359
|
+
get: function get() {
|
|
13360
|
+
return this.gltfGeometry.getJoints(0);
|
|
13361
|
+
}
|
|
13362
|
+
},
|
|
13363
|
+
{
|
|
13364
|
+
key: "weightAttribute",
|
|
13365
|
+
get: function get() {
|
|
13366
|
+
return this.gltfGeometry.getWeights(0);
|
|
13367
|
+
}
|
|
13368
|
+
},
|
|
13369
|
+
{
|
|
13370
|
+
key: "hasPosition",
|
|
13371
|
+
get: function get() {
|
|
13372
|
+
return this.positionAttrib !== undefined;
|
|
13373
|
+
}
|
|
13374
|
+
},
|
|
13375
|
+
{
|
|
13376
|
+
key: "hasNormal",
|
|
13377
|
+
get: function get() {
|
|
13378
|
+
return this.normalAttrib !== undefined;
|
|
13379
|
+
}
|
|
13380
|
+
},
|
|
13381
|
+
{
|
|
13382
|
+
key: "hasTangent",
|
|
13383
|
+
get: function get() {
|
|
13384
|
+
return this.tangentAttrib !== undefined;
|
|
13385
|
+
}
|
|
13386
|
+
},
|
|
13387
|
+
{
|
|
13388
|
+
key: "hasTexCoord",
|
|
13389
|
+
get: function get() {
|
|
13390
|
+
return this.texCoordCount > 0;
|
|
13391
|
+
}
|
|
13392
|
+
},
|
|
13393
|
+
{
|
|
13394
|
+
key: "texCoordCount",
|
|
13395
|
+
get: function get() {
|
|
13396
|
+
for(var i = 0; i < 10; i++){
|
|
13397
|
+
if (this.texCoordAttrib(i) === undefined) {
|
|
13398
|
+
return i;
|
|
13399
|
+
}
|
|
13400
|
+
}
|
|
13401
|
+
return 0;
|
|
13402
|
+
}
|
|
13403
|
+
},
|
|
13404
|
+
{
|
|
13405
|
+
key: "hasJointAttribute",
|
|
13406
|
+
get: function get() {
|
|
13407
|
+
return this.jointAttribute !== undefined;
|
|
13408
|
+
}
|
|
13409
|
+
},
|
|
13410
|
+
{
|
|
13411
|
+
key: "hasWeightAttribute",
|
|
13412
|
+
get: function get() {
|
|
13413
|
+
return this.weightAttribute !== undefined;
|
|
13414
|
+
}
|
|
13415
|
+
},
|
|
13416
|
+
{
|
|
13417
|
+
key: "indexArray",
|
|
13418
|
+
get: function get() {
|
|
13419
|
+
if (this.gltfGeometry.indices === undefined) {
|
|
13420
|
+
return undefined;
|
|
13421
|
+
}
|
|
13422
|
+
switch(this.gltfGeometry.indices.type){
|
|
13423
|
+
case WebGLRenderingContext["UNSIGNED_INT"]:
|
|
13424
|
+
return this.gltfGeometry.indices.array;
|
|
13425
|
+
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
13426
|
+
return this.gltfGeometry.indices.array;
|
|
13427
|
+
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
13428
|
+
return this.gltfGeometry.indices.array;
|
|
13429
|
+
}
|
|
13430
|
+
return undefined;
|
|
13431
|
+
}
|
|
13432
|
+
},
|
|
13433
|
+
{
|
|
13434
|
+
key: "indexCount",
|
|
13435
|
+
get: function get() {
|
|
13436
|
+
if (this.gltfGeometry.indices !== undefined) {
|
|
13437
|
+
return this.gltfGeometry.indices.array.length;
|
|
13438
|
+
} else {
|
|
13439
|
+
return 0;
|
|
13440
|
+
}
|
|
13441
|
+
}
|
|
13442
|
+
},
|
|
13443
|
+
{
|
|
13444
|
+
key: "texCoordList",
|
|
13445
|
+
get: function get() {
|
|
13446
|
+
var texCoords = [];
|
|
13447
|
+
for(var i = 0; i < 10; i++){
|
|
13448
|
+
if (this.texCoordAttrib(i) !== undefined) {
|
|
13449
|
+
texCoords.push(i);
|
|
13450
|
+
} else {
|
|
13451
|
+
break;
|
|
13452
|
+
}
|
|
13453
|
+
}
|
|
13454
|
+
return texCoords;
|
|
13455
|
+
}
|
|
13456
|
+
}
|
|
13457
|
+
]);
|
|
13458
|
+
return GeometryProxy;
|
|
13459
|
+
}();
|
|
13460
|
+
var MaterialProxy = /*#__PURE__*/ function() {
|
|
13461
|
+
function MaterialProxy(material, textures, tiny3dMode) {
|
|
13462
|
+
this.gltfMaterial = material;
|
|
13463
|
+
this.textures = textures;
|
|
13464
|
+
this.tiny3dMode = tiny3dMode;
|
|
13465
|
+
}
|
|
13466
|
+
var _proto = MaterialProxy.prototype;
|
|
13467
|
+
_proto.getTextureObject = function getTextureObject(index) {
|
|
13468
|
+
if (index < 0 || index >= this.textures.length) {
|
|
13469
|
+
return;
|
|
13470
|
+
}
|
|
13471
|
+
return this.textures[index];
|
|
13472
|
+
};
|
|
13473
|
+
_proto.getTextureObj = function getTextureObj(texInfo) {
|
|
13474
|
+
return texInfo ? this.getTextureObject(texInfo.index) : undefined;
|
|
13475
|
+
};
|
|
13476
|
+
_proto.getTextureCoord = function getTextureCoord(texInfo) {
|
|
13477
|
+
return texInfo ? texInfo.texCoord : undefined;
|
|
13478
|
+
};
|
|
13479
|
+
_proto.getTextureTransform = function getTextureTransform(texInfo) {
|
|
13480
|
+
var _texInfo_extensions;
|
|
13481
|
+
var transform = texInfo == null ? void 0 : (_texInfo_extensions = texInfo.extensions) == null ? void 0 : _texInfo_extensions.KHR_texture_transform;
|
|
13482
|
+
if (transform === undefined) {
|
|
13483
|
+
return;
|
|
13484
|
+
}
|
|
13485
|
+
if (transform.offset === undefined && transform.rotation === undefined && transform.scale === undefined) {
|
|
13486
|
+
return;
|
|
13487
|
+
}
|
|
13488
|
+
return {
|
|
13489
|
+
offset: transform.offset,
|
|
13490
|
+
rotation: transform.rotation,
|
|
13491
|
+
scale: transform.scale
|
|
13492
|
+
};
|
|
13493
|
+
};
|
|
13494
|
+
_proto.getSpecularAA = function getSpecularAA() {
|
|
13495
|
+
var _this_gltfMaterial_extras;
|
|
13496
|
+
return (_this_gltfMaterial_extras = this.gltfMaterial.extras) == null ? void 0 : _this_gltfMaterial_extras.useSpecularAA;
|
|
13497
|
+
};
|
|
13498
|
+
_create_class(MaterialProxy, [
|
|
13499
|
+
{
|
|
13500
|
+
key: "material",
|
|
13501
|
+
get: function get() {
|
|
13502
|
+
var mat = this.gltfMaterial;
|
|
13503
|
+
var isUnlit = GLTFHelper.isUnlitMaterial(mat);
|
|
13504
|
+
var blending = spec.MaterialBlending.opaque;
|
|
13505
|
+
switch(mat.alphaMode){
|
|
13506
|
+
case "OPAQUE":
|
|
13507
|
+
blending = spec.MaterialBlending.opaque;
|
|
13508
|
+
break;
|
|
13509
|
+
case "MASK":
|
|
13510
|
+
blending = spec.MaterialBlending.masked;
|
|
13511
|
+
break;
|
|
13512
|
+
case "BLEND":
|
|
13513
|
+
blending = spec.MaterialBlending.translucent;
|
|
13514
|
+
break;
|
|
13515
|
+
}
|
|
13516
|
+
var side = mat.doubleSided ? spec.SideMode.DOUBLE : spec.SideMode.FRONT;
|
|
13517
|
+
var enableShadow = false;
|
|
13518
|
+
var _mat_alphaCutOff;
|
|
13519
|
+
var alphaCutOff = (_mat_alphaCutOff = mat.alphaCutOff) != null ? _mat_alphaCutOff : 0.5;
|
|
13520
|
+
var name = mat.name;
|
|
13521
|
+
if (isUnlit) {
|
|
13522
|
+
var _mat_extras;
|
|
13523
|
+
return {
|
|
13524
|
+
name: name,
|
|
13525
|
+
type: spec.MaterialType.unlit,
|
|
13526
|
+
baseColorTexture: this.baseColorTextureObj,
|
|
13527
|
+
baseColorTextureCoordinate: this.baseColorTextureCoord,
|
|
13528
|
+
baseColorTextureTransform: this.baseColorTextureTransfrom,
|
|
13529
|
+
baseColorFactor: this.baseColorFactor,
|
|
13530
|
+
//
|
|
13531
|
+
depthMask: (_mat_extras = mat.extras) == null ? void 0 : _mat_extras.depthMask,
|
|
13532
|
+
blending: blending,
|
|
13533
|
+
alphaCutOff: alphaCutOff,
|
|
13534
|
+
side: side
|
|
13535
|
+
};
|
|
13536
|
+
} else {
|
|
13537
|
+
var _mat_extras1;
|
|
13538
|
+
return {
|
|
13539
|
+
name: name,
|
|
13540
|
+
type: spec.MaterialType.pbr,
|
|
13541
|
+
baseColorTexture: this.baseColorTextureObj,
|
|
13542
|
+
baseColorTextureCoordinate: this.baseColorTextureCoord,
|
|
13543
|
+
baseColorTextureTransform: this.baseColorTextureTransfrom,
|
|
13544
|
+
baseColorFactor: this.baseColorFactor,
|
|
13545
|
+
//
|
|
13546
|
+
useSpecularAA: this.getSpecularAA(),
|
|
13547
|
+
//
|
|
13548
|
+
metallicRoughnessTexture: this.metallicRoughnessTextureObj,
|
|
13549
|
+
metallicRoughnessTextureCoordinate: this.metallicRoughnessTextureCoord,
|
|
13550
|
+
metallicRoughnessTextureTransform: this.metallicRoughnessTextureTransfrom,
|
|
13551
|
+
metallicFactor: this.metalicFactor,
|
|
13552
|
+
roughnessFactor: this.roughnessFactor,
|
|
13553
|
+
//
|
|
13554
|
+
normalTexture: this.normalTextureObj,
|
|
13555
|
+
normalTextureCoordinate: this.normalTextureCoord,
|
|
13556
|
+
normalTextureTransform: this.normalTextureTransfrom,
|
|
13557
|
+
normalTextureScale: this.normalTextureScale,
|
|
13558
|
+
//
|
|
13559
|
+
occlusionTexture: this.occlusionTextureObj,
|
|
13560
|
+
occlusionTextureCoordinate: this.occlusionTextureCoord,
|
|
13561
|
+
occlusionTextureTransform: this.occlusionTextureTransfrom,
|
|
13562
|
+
occlusionTextureStrength: this.occlusionTextureStrength,
|
|
13563
|
+
//
|
|
13564
|
+
emissiveTexture: this.emissiveTextureObj,
|
|
13565
|
+
emissiveTextureCoordinate: this.emissiveTextureCoord,
|
|
13566
|
+
emissiveTextureTransform: this.emissiveTextureTransfrom,
|
|
13567
|
+
emissiveFactor: this.emissiveFactor,
|
|
13568
|
+
emissiveIntensity: 1.0,
|
|
13569
|
+
//
|
|
13570
|
+
depthMask: (_mat_extras1 = mat.extras) == null ? void 0 : _mat_extras1.depthMask,
|
|
13571
|
+
blending: blending,
|
|
13572
|
+
alphaCutOff: alphaCutOff,
|
|
13573
|
+
side: side,
|
|
13574
|
+
enableShadow: enableShadow
|
|
13575
|
+
};
|
|
13576
|
+
}
|
|
13577
|
+
}
|
|
13578
|
+
},
|
|
13579
|
+
{
|
|
13580
|
+
key: "baseColorTextureObj",
|
|
13581
|
+
get: function get() {
|
|
13582
|
+
return this.getTextureObj(this.gltfMaterial.baseColorTexture);
|
|
13583
|
+
}
|
|
13584
|
+
},
|
|
13585
|
+
{
|
|
13586
|
+
key: "baseColorTextureCoord",
|
|
13587
|
+
get: function get() {
|
|
13588
|
+
return this.getTextureCoord(this.gltfMaterial.baseColorTexture);
|
|
13589
|
+
}
|
|
13590
|
+
},
|
|
13591
|
+
{
|
|
13592
|
+
key: "baseColorTextureTransfrom",
|
|
13593
|
+
get: function get() {
|
|
13594
|
+
return this.getTextureTransform(this.gltfMaterial.baseColorTexture);
|
|
13595
|
+
}
|
|
13596
|
+
},
|
|
13597
|
+
{
|
|
13598
|
+
key: "metallicRoughnessTextureObj",
|
|
13599
|
+
get: function get() {
|
|
13600
|
+
return this.getTextureObj(this.gltfMaterial.metallicRoughnessTexture);
|
|
13601
|
+
}
|
|
13602
|
+
},
|
|
13603
|
+
{
|
|
13604
|
+
key: "metallicRoughnessTextureCoord",
|
|
13605
|
+
get: function get() {
|
|
13606
|
+
return this.getTextureCoord(this.gltfMaterial.metallicRoughnessTexture);
|
|
13607
|
+
}
|
|
13608
|
+
},
|
|
13609
|
+
{
|
|
13610
|
+
key: "metallicRoughnessTextureTransfrom",
|
|
13611
|
+
get: function get() {
|
|
13612
|
+
return this.getTextureTransform(this.gltfMaterial.metallicRoughnessTexture);
|
|
13613
|
+
}
|
|
13614
|
+
},
|
|
13615
|
+
{
|
|
13616
|
+
key: "normalTextureObj",
|
|
13617
|
+
get: function get() {
|
|
13618
|
+
return this.getTextureObj(this.gltfMaterial.normalTexture);
|
|
13619
|
+
}
|
|
13620
|
+
},
|
|
13621
|
+
{
|
|
13622
|
+
key: "normalTextureCoord",
|
|
13623
|
+
get: function get() {
|
|
13624
|
+
return this.getTextureCoord(this.gltfMaterial.normalTexture);
|
|
13625
|
+
}
|
|
13626
|
+
},
|
|
13627
|
+
{
|
|
13628
|
+
key: "normalTextureTransfrom",
|
|
13629
|
+
get: function get() {
|
|
13630
|
+
return this.getTextureTransform(this.gltfMaterial.normalTexture);
|
|
13631
|
+
}
|
|
13632
|
+
},
|
|
13633
|
+
{
|
|
13634
|
+
key: "occlusionTextureObj",
|
|
13635
|
+
get: function get() {
|
|
13636
|
+
return this.getTextureObj(this.gltfMaterial.occlusionTexture);
|
|
13637
|
+
}
|
|
13638
|
+
},
|
|
13639
|
+
{
|
|
13640
|
+
key: "occlusionTextureCoord",
|
|
13641
|
+
get: function get() {
|
|
13642
|
+
return this.getTextureCoord(this.gltfMaterial.occlusionTexture);
|
|
13643
|
+
}
|
|
13644
|
+
},
|
|
13645
|
+
{
|
|
13646
|
+
key: "occlusionTextureTransfrom",
|
|
13647
|
+
get: function get() {
|
|
13648
|
+
return this.getTextureTransform(this.gltfMaterial.occlusionTexture);
|
|
13649
|
+
}
|
|
13650
|
+
},
|
|
13651
|
+
{
|
|
13652
|
+
key: "emissiveTextureObj",
|
|
13653
|
+
get: function get() {
|
|
13654
|
+
return this.getTextureObj(this.gltfMaterial.emissiveTexture);
|
|
13655
|
+
}
|
|
13656
|
+
},
|
|
13657
|
+
{
|
|
13658
|
+
key: "emissiveTextureCoord",
|
|
13659
|
+
get: function get() {
|
|
13660
|
+
return this.getTextureCoord(this.gltfMaterial.emissiveTexture);
|
|
13661
|
+
}
|
|
13662
|
+
},
|
|
13663
|
+
{
|
|
13664
|
+
key: "emissiveTextureTransfrom",
|
|
13665
|
+
get: function get() {
|
|
13666
|
+
return this.getTextureTransform(this.gltfMaterial.emissiveTexture);
|
|
13667
|
+
}
|
|
13668
|
+
},
|
|
13669
|
+
{
|
|
13670
|
+
key: "hasEmissive",
|
|
13671
|
+
get: function get() {
|
|
13672
|
+
var factor = this.emissiveFactor;
|
|
13673
|
+
return factor[0] + factor[1] + factor[2] > 0;
|
|
13674
|
+
}
|
|
13675
|
+
},
|
|
13676
|
+
{
|
|
13677
|
+
key: "baseColorFactor",
|
|
13678
|
+
get: function get() {
|
|
13679
|
+
var f = this.gltfMaterial.baseColorFactor;
|
|
13680
|
+
if (f === undefined || f.length != 4) {
|
|
13681
|
+
return [
|
|
13682
|
+
1,
|
|
13683
|
+
1,
|
|
13684
|
+
1,
|
|
13685
|
+
1
|
|
13686
|
+
];
|
|
13687
|
+
} else {
|
|
13688
|
+
return [
|
|
13689
|
+
f[0],
|
|
13690
|
+
f[1],
|
|
13691
|
+
f[2],
|
|
13692
|
+
f[3]
|
|
13693
|
+
];
|
|
13694
|
+
}
|
|
13695
|
+
}
|
|
13696
|
+
},
|
|
13697
|
+
{
|
|
13698
|
+
key: "metalicFactor",
|
|
13699
|
+
get: function get() {
|
|
13700
|
+
var _this_gltfMaterial_metallicFactor;
|
|
13701
|
+
return (_this_gltfMaterial_metallicFactor = this.gltfMaterial.metallicFactor) != null ? _this_gltfMaterial_metallicFactor : 1;
|
|
13702
|
+
}
|
|
13703
|
+
},
|
|
13704
|
+
{
|
|
13705
|
+
key: "roughnessFactor",
|
|
13706
|
+
get: function get() {
|
|
13707
|
+
var _this_gltfMaterial_roughnessFactor;
|
|
13708
|
+
return (_this_gltfMaterial_roughnessFactor = this.gltfMaterial.roughnessFactor) != null ? _this_gltfMaterial_roughnessFactor : 1;
|
|
13709
|
+
}
|
|
13710
|
+
},
|
|
13711
|
+
{
|
|
13712
|
+
key: "normalTextureScale",
|
|
13713
|
+
get: function get() {
|
|
13714
|
+
var _this_gltfMaterial_normalTexture;
|
|
13715
|
+
var _this_gltfMaterial_normalTexture_scale;
|
|
13716
|
+
return (_this_gltfMaterial_normalTexture_scale = (_this_gltfMaterial_normalTexture = this.gltfMaterial.normalTexture) == null ? void 0 : _this_gltfMaterial_normalTexture.scale) != null ? _this_gltfMaterial_normalTexture_scale : 1;
|
|
13717
|
+
}
|
|
13718
|
+
},
|
|
13719
|
+
{
|
|
13720
|
+
key: "occlusionTextureStrength",
|
|
13721
|
+
get: function get() {
|
|
13722
|
+
var _this_gltfMaterial_occlusionTexture;
|
|
13723
|
+
var _this_gltfMaterial_occlusionTexture_strength;
|
|
13724
|
+
return (_this_gltfMaterial_occlusionTexture_strength = (_this_gltfMaterial_occlusionTexture = this.gltfMaterial.occlusionTexture) == null ? void 0 : _this_gltfMaterial_occlusionTexture.strength) != null ? _this_gltfMaterial_occlusionTexture_strength : 1;
|
|
13725
|
+
}
|
|
13726
|
+
},
|
|
13727
|
+
{
|
|
13728
|
+
key: "emissiveFactor",
|
|
13729
|
+
get: function get() {
|
|
13730
|
+
var f = this.gltfMaterial.emissiveFactor;
|
|
13731
|
+
if (f === undefined || f.length != 4) {
|
|
13732
|
+
return [
|
|
13733
|
+
0,
|
|
13734
|
+
0,
|
|
13735
|
+
0,
|
|
13736
|
+
1
|
|
13737
|
+
];
|
|
13738
|
+
} else {
|
|
13739
|
+
return [
|
|
13740
|
+
f[0],
|
|
13741
|
+
f[1],
|
|
13742
|
+
f[2],
|
|
13743
|
+
1.0
|
|
13744
|
+
];
|
|
13745
|
+
}
|
|
13746
|
+
}
|
|
13747
|
+
}
|
|
13748
|
+
]);
|
|
13749
|
+
return MaterialProxy;
|
|
13750
|
+
}();
|
|
13751
|
+
var GLTFHelper = /*#__PURE__*/ function() {
|
|
13752
|
+
function GLTFHelper() {}
|
|
13753
|
+
GLTFHelper.isUnlitMaterial = function isUnlitMaterial(mat) {
|
|
13754
|
+
var _mat_extensions;
|
|
13755
|
+
return ((_mat_extensions = mat.extensions) == null ? void 0 : _mat_extensions.KHR_materials_unlit) !== undefined;
|
|
13756
|
+
};
|
|
13757
|
+
GLTFHelper.createBoxFromGLTFBound = function createBoxFromGLTFBound(bound) {
|
|
13758
|
+
var boxMin = Vector3.fromArray(bound.box.min);
|
|
13759
|
+
var boxMax = Vector3.fromArray(bound.box.max);
|
|
13760
|
+
return new Box3(boxMin, boxMax);
|
|
13761
|
+
};
|
|
13762
|
+
return GLTFHelper;
|
|
13763
|
+
}();
|
|
12947
13764
|
|
|
12948
13765
|
registerPlugin("tree", ModelTreePlugin, VFXItem, true);
|
|
12949
13766
|
registerPlugin("model", ModelPlugin, VFXItem);
|
|
12950
|
-
var version = "2.0.0-alpha.
|
|
13767
|
+
var version = "2.0.0-alpha.24";
|
|
12951
13768
|
logger.info("Plugin model version: " + version + ".");
|
|
12952
13769
|
if (version !== EFFECTS.version) {
|
|
12953
13770
|
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!");
|