|
@@ -22,6 +22,7 @@ export default {
|
|
|
tmpList:[],
|
|
|
realList:[],
|
|
|
nextString:'_simple',//精简模型后缀
|
|
|
+ loadLayFlag:false, //是否处在加载家具过程中
|
|
|
// lastFrunList:[],
|
|
|
}
|
|
|
},
|
|
@@ -203,6 +204,7 @@ export default {
|
|
|
}
|
|
|
console.log("***realFurArr***", realFurArr,this.gltfLayouts);
|
|
|
realFurArr && realFurArr.forEach((item,index) => {
|
|
|
+ this.loadLayFlag = true;
|
|
|
this.promise_list.push(
|
|
|
new Promise((resolve, reject) => {
|
|
|
this.loadLayoutModels(item, resolve);
|
|
@@ -211,6 +213,7 @@ export default {
|
|
|
});
|
|
|
Promise.all(this.promise_list).then(() => {
|
|
|
let endTime = new Date().getTime();
|
|
|
+ this.loadLayFlag = false;
|
|
|
console.log("家具模型全部加载完成,时间:", endTime - startTime, this.gltfLayouts);
|
|
|
this.loadLastSpaceModel();//加载剩余空间的家具模型
|
|
|
})
|
|
@@ -353,22 +356,23 @@ export default {
|
|
|
//realData 该模型被重复使用时的每一次的形变参数等
|
|
|
realData.list && realData.list.forEach((it,i)=>{
|
|
|
let gltfFurn = that.gltfLayouts.find(itme=>itme.uniId==it.uniId);//判断是否已经添加过
|
|
|
-
|
|
|
- gltf.scene.rotation.y = gltfFurn.rotation.y;
|
|
|
- gltf.scene.position.set(gltfFurn.position.x,0,gltfFurn.position.z);
|
|
|
- gltf.scene.scale.set(gltfFurn.scale.x,1,gltfFurn.scale.z);
|
|
|
- gltf.scene.updateMatrixWorld();//更新世界坐标-这样,子模型也同步更新了
|
|
|
- instancedMesh.setMatrixAt(i, child.matrixWorld);
|
|
|
- instancedMesh.instanceMatrix.needsUpdate = true;
|
|
|
- gltfFurn.loaded = true;
|
|
|
- if(!gltfFurn.instancedMeshIndexList){//标识网格实例数组的序号 以及 当前几何体 在网格实例的序号
|
|
|
- gltfFurn.instancedMeshIndexList = [
|
|
|
- {instancedMeshIndex:this.instancedFurList.length-1,instancedAtIndex:i},
|
|
|
- ]
|
|
|
- }else{
|
|
|
- gltfFurn.instancedMeshIndexList.push({
|
|
|
- instancedMeshIndex:this.instancedFurList.length-1,instancedAtIndex:i
|
|
|
- })
|
|
|
+ if(gltfFurn){
|
|
|
+ gltf.scene.rotation.y = gltfFurn.rotation.y;
|
|
|
+ gltf.scene.position.set(gltfFurn.position.x,0,gltfFurn.position.z);
|
|
|
+ gltf.scene.scale.set(gltfFurn.scale.x,1,gltfFurn.scale.z);
|
|
|
+ gltf.scene.updateMatrixWorld();//更新世界坐标-这样,子模型也同步更新了
|
|
|
+ instancedMesh.setMatrixAt(i, child.matrixWorld);
|
|
|
+ instancedMesh.instanceMatrix.needsUpdate = true;
|
|
|
+ gltfFurn.loaded = true;
|
|
|
+ if(!gltfFurn.instancedMeshIndexList){//标识网格实例数组的序号 以及 当前几何体 在网格实例的序号
|
|
|
+ gltfFurn.instancedMeshIndexList = [
|
|
|
+ {instancedMeshIndex:this.instancedFurList.length-1,instancedAtIndex:i},
|
|
|
+ ]
|
|
|
+ }else{
|
|
|
+ gltfFurn.instancedMeshIndexList.push({
|
|
|
+ instancedMeshIndex:this.instancedFurList.length-1,instancedAtIndex:i
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
instancedMesh.userType = "layoutMesh";
|