Prechádzať zdrojové kódy

Merge branch 'feature_UI调整' of http://101.231.166.56:3000/elab-damai-h5/h5-webgl-program into feature_UI调整

zjs_project 1 rok pred
rodič
commit
1f96f75aa1

+ 32 - 1
src/mixins/floorMethod.js

@@ -113,8 +113,15 @@ export default {
 							const planeMesh = new THREE.Mesh(planeGeometry, planeMaterial)
 							planeMesh.rotation.x =  Math.PI / 2 ;  // 旋转 180 度
 							planeMesh.position.set(positionX, 2.8, -positionY);
-							planeMesh.userType = "mesh";
+							planeMesh.userType = "mesh"
+							const spaceObj = {
+								spaceId:obj.spaceId,
+								spaceWidth:obj.spaceWidth,
+								spaceHeight:obj.spaceHeight
+							}
+							planeMesh.userData = spaceObj;
 							that.scene.add(planeMesh);
+							that.gltfSpaceRoofs.push(planeMesh);
 						}
 					})
 				}
@@ -133,6 +140,11 @@ export default {
 			texture.wrapT = THREE.RepeatWrapping;
 			
 			list && list.forEach(obj=>{
+				// 暂时手动过滤 2楼 儿童房和次卫 不添加草地
+				if((obj.spaceId == 582 && obj.spaceName == "儿童房") || (obj.spaceId == 388 && obj.spaceName == "次卫")){
+					return
+				}
+
 				let positionX = obj.centerX / 100;
 				let positionY = obj.centerY / 100;
 				let scaleX = obj.spaceWidth / 100;
@@ -322,6 +334,25 @@ export default {
 				// 开始动画
 				tween.start();
 			}
+
+			
+			// 屋顶尺寸调整
+			const cubeRoof = this.gltfSpaceRoofs.find((item)=>{
+			    return item.userData.spaceId == curSpace.spaceId;
+			})
+			if(cubeRoof){
+				let roofScaleX =  curSpace.spaceObj.spaceWidth / cubeRoof.userData.spaceWidth
+				let roofScaleY =  curSpace.spaceObj.spaceHeight / cubeRoof.userData.spaceHeight
+				console.log("屋顶尺寸变化", curSpace.spaceObj, cubeRoof, roofScaleX, roofScaleY)
+				// cubeRoof.scale.x = toScaleX / scaleX;
+				// cubeRoof.scale.z = 0.5;
+				// cubeRoof.position.x = toPx;
+				// cubeRoof.position.z = toPz;
+				cubeRoof.scale.set(roofScaleX,roofScaleY,1);//缩小为原来0.5倍
+				cubeRoof.position.x = toPx;
+				cubeRoof.position.z = toPz;
+				// cubeRoof.position.set(toPx - x, 0, 1);
+			}
 		},
 		//所有空间整体缩放-同时同步到数据里面
 		allSpaceScale(){

+ 4 - 1
src/pages/webgl_rxdz/webgl_rxdz.vue

@@ -53,6 +53,7 @@
 				spaceList:[], // 空间列表
 				spaceListBackup:[], // 空间列表原始尺寸备份,用于墙体比例计算
 				gltfSpaces:[], // 场景中地板模型数组
+				gltfSpaceRoofs:[], // 屋顶模型数组
 				curSpaceObj:null, // 当前选中的空间
 				// curSpaceIndex:-1, // 当前选中的空间索引
 				curWallDirection:"", // 当前选中的墙面
@@ -139,6 +140,7 @@
 			}
 			this.gltfWalls = [];
 			this.gltfSpaces = [];
+			this.gltfSpaceRoofs = [];
 			this.instancedMeshList = [];
 			this.instancedSpaceMeshList = [];
 			this.lableItem = [];
@@ -1647,6 +1649,7 @@
 				
 				this.gltfWalls = [];
 				this.gltfSpaces = [];
+				this.gltfSpaceRoofs = [];
 				this.instancedMeshList = [];
 				this.instancedSpaceMeshList = [];
 				this.lableItem = [];
@@ -2192,7 +2195,7 @@
 			    }
 				this.curHouseObj.houseJson = JSON.stringify(this.spaceList);
 			    //空间动画处理-提取到floorMethod.js中
-				this.changeSpacesAnim({spaceId:spaceObj.spaceId,toScaleX,toScaleZ,toPx,toPz})
+				this.changeSpacesAnim({spaceId:spaceObj.spaceId,toScaleX,toScaleZ,toPx,toPz,spaceObj})
 				// 墙体动画处理
 				//// 根据空间尺寸,更新前提数据
 				const wallObj = this.wallList.find((item)=>{

+ 1 - 0
src/pages/webgl_rxdz_roam/webgl_rxdz_roam.vue

@@ -55,6 +55,7 @@
                 id:'',// 户型编号
                 spaceList:[], // 空间列表
                 gltfSpaces:[], // 场景中地板模型数组
+				gltfSpaceRoofs:[],
                 curSpaceObj:null, // 当前选中的空间
                 // curSpaceIndex:-1, // 当前选中的空间索引
 				spaceId:null,

+ 1 - 1
src/static/wallData.js

@@ -10,7 +10,7 @@ var wallType = [
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_AutoWall_CLosedEntranceDoor_0.9M.glb', name: '关闭入户门-0.9M',type:4, width:90, group:2, level:0, total:1},
 	
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_AutoWall_CLosedFoldingWindow_0.6M.glb', name: '关闭折叠窗-0.6M',type:2, width:60, group:3, level:0, total:5},
-	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_AutoWall_CLosedFoldingWindow_1.2M__1_.glb', name: '关闭折叠窗-1.2M',type:5, width:120, group:3, level:1, total:5},
+	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_AutoWall_CLosedFoldingWindow_1.2M.glb', name: '关闭折叠窗-1.2M',type:5, width:120, group:3, level:1, total:5},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_AutoWall_CLosedFoldingWindow_2.4M.glb', name: '关闭折叠窗-2.4M',type:8, width:240, group:3, level:2, total:5},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_AutoWall_CLosedFoldingWindow_2.7M.glb', name: '关闭折叠窗-2.7M',type:9, width:270, group:3, level:3, total:5},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_AutoWall_CLosedFoldingWindow_3.6M.glb', name: '关闭折叠窗-3.6M',type:10, width:360, group:3, level:4, total:5},