Browse Source

优化模型

zhoujs 1 year ago
parent
commit
fd93b70dc4

+ 8 - 1
src/mixins/loadModel - 副本.js

@@ -65,6 +65,7 @@ export default {
 			let parmas = {
 				ids: arr,
 			};
+
 			// 默认的布局
 			let res = await requestConfig("getOverallArrangementDetailsList", parmas);
 			if (!res.success || !res.list || res.list.length == 0) {
@@ -72,11 +73,14 @@ export default {
 			}
 			this.promise_list = [];
 			this.arrFrunList = res.list;
+
+			console.log("空间布局数据", this.arrFrunList)
 			// 通过默认布局
 			this.furnHandle(this.arrFrunList);
 		},
 		//拆分家具模型加载逻辑
 		furnHandle(arrFrunList){
+
 			if(!arrFrunList || arrFrunList.length == 0){
 				return
 			}
@@ -128,7 +132,8 @@ export default {
 			}
 			let realFurArr = this.preFurnitureData(tmpList);//统一处理家具模型
 			this.calculateLayoutModelSize() // 提前计算模型的位置
-			console.log("***realFurArr***", realFurArr,this.gltfLayouts);		
+			console.log("***realFurArr***", realFurArr,this.gltfLayouts);
+			
 			realFurArr && realFurArr.forEach((item,index) => {
 				this.promise_list.push(
 					new Promise((resolve, reject) => {
@@ -683,6 +688,7 @@ export default {
 
 					// console.log("右边拉伸", Math.abs(parseFloat(cubeInfo.rotation)))
 				}
+
 				if(parseInt(cubeInfo.referenceModelBottom) > 0 && parseInt(cubeInfo.referenceModelTop) > 0){
 
 					// 上边惨遭物
@@ -778,6 +784,7 @@ export default {
 		},
 		//更新家具模型到页面中
 		updateInfo(cube,oldPosition,scaleX,scaleY){
+			console.log("更新布局模型");
 			let lay = this.gltfLayouts.find(it=>it.uniId==cube.uniId);
 			if(cube.instancedMeshIndexList && cube.instancedMeshIndexList.length>0){
 				cube.instancedMeshIndexList.forEach(item=>{

+ 4 - 10
src/mixins/loadModel.js

@@ -13,12 +13,6 @@ export default {
 			instancedFurList:[],
 			arrFrunList:[],
 			promise_list:[],
-			// loadFurPromise: new Promise((resolve) => {
-			//     this.loadedCompleteFun = function() {
-			//         console.log('家具模型接口结束');
-			//         resolve()
-			//     }
-			// }),
 			dracoLoader:null,
 			type:1,
 			tmpList:[],
@@ -28,10 +22,10 @@ export default {
 	watch: {},
 	mounted() {
 		console.warn("***loadmodel-mounted****")
-		// this.dracoLoader = new DRACOLoader();
-		// this.dracoLoader.setDecoderPath('/gltf/');
-		// this.dracoLoader.setDecoderConfig( { type: 'js' } );
-		// this.dracoLoader.preload();
+		this.dracoLoader = new DRACOLoader();
+		this.dracoLoader.setDecoderPath('/gltf/');
+		this.dracoLoader.setDecoderConfig( { type: 'js' } );
+		this.dracoLoader.preload();
 	},
 	methods: {
 		// 设置空间数组的墙体信息 

+ 2 - 20
src/pages/webgl_rxdz/webgl_rxdz.vue

@@ -64,7 +64,7 @@
 				gltfWalls:[], // 场景中墙体模型数组
 				gltfAutoWalls:[],// 空间自动补墙模型数组
 				// lastWallPosition:0, // 当面墙中墙体模型的开始位置
-				tempSpaceList:[],// 全部空间临时数组
+				tempSpaceList:[],// 全部空间临时数组,寻找关联空间,递归使用
 				leftSpaces:[], // 移动空间左边数组
 				rightSpaces:[],// 移动空间右边数组
 				changeSpaces:[],// 尺寸变化涉及到的全部空间
@@ -123,24 +123,6 @@
 				styleType:1,
 			}
 		},
-		watch:{
-			curSpaceObj(newVal, oldVal){
-				if(!newVal || newVal==oldVal){
-					return
-				}
-				console.log("切换空间",newVal, oldVal);
-				// this.curSpaceIndex = this.spaceList.findIndex((item)=>{
-				// 	return item.spaceId == newVal.spaceId
-				// })
-				// TODO 切换空间埋点...
-			},
-			curWallValue(newVal, oldVal){
-				if(!newVal || newVal==oldVal){
-					return
-				}
-				console.log("当前墙体值变化", newVal, oldVal);
-			}
-		},
 		beforeDestroy() {
 			cancelAnimationFrame(requestId, this.canvas)
 			this.worker && this.worker.terminate()
@@ -638,7 +620,7 @@
 				console.warn("***shottingImg***",shottingImg);
 				let userId = this.userId ? this.userId : '';
 				let param = {
-					"brandId": 94,
+					"brandId": $config.brandId,
 					"houseId": this.curHouseObj.houseId,
 					"userId": userId,
 					"floot": this.curHouseObj.houseFloor,

+ 3 - 3
src/static/layoutModelData.js

@@ -70,7 +70,7 @@ var layoutModel = [
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_L_children07.glb', name: '儿童家具07',modelName: 'BP_L_children07', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_X_ReadingArea01.gltf', name: '阅读角01',modelName: 'BP_X_ReadingArea01', type:1},
 	
-	// {url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_T_OpenShower01.glb', name: '开敞侧淋浴间',modelName: 'BP_T_OpenShower01', type:1},
+	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_T_OpenShower01.glb', name: '开敞侧淋浴间',modelName: 'BP_T_OpenShower01', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_T_matong.gltf', name: '马桶',modelName: 'BP_T_matong', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_T_1PeopleBasin01.glb', name: '1人台盆01',modelName: 'BP_T_1PeopleBasin01', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_T_flue001.glb', name: '水井管道01',modelName: 'BP_T_flue001', type:1},
@@ -90,7 +90,7 @@ var layoutModel = [
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_AutoWall_CLosedFrenchWindow_6.3M.gltf', name: '关闭落地窗-6.3M',modelName: 'BP_AutoWall_63M', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_AutoWall_CLosedFrenchWindow_6.9M.gltf', name: '关闭落地窗-6.9M',modelName: 'BP_AutoWall_69M', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_AutoWall_FoldingInternalDoor_1.95M.gltf', name: '户内折叠门',modelName: 'BP_AutoWall_195M', type:1},
-	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_AutoWall_OpenInternalDoor_0.8M.glt', name: '关闭户内门-0.8M',modelName: 'BP_AutoWallr_08M', type:1},
+	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_AutoWall_OpenInternalDoor_0.8M.glb', name: '关闭户内门-0.8M',modelName: 'BP_AutoWallr_08M', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_G_tree00.glb', name: '大树',modelName: 'BP_G_tree00', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_G_tree01.glb', name: '中树',modelName: 'BP_G_tree01', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_G_tree02.glb', name: '小树',modelName: 'BP_G_tree02', type:1},
@@ -104,7 +104,7 @@ var layoutModel = [
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_X_PartyTable01.gltf', name: '聚会长桌',modelName: 'BP_X_PartyTable01', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_G_PoolTable01.gltf', name: '台球桌01',modelName: 'BP_X_PoolTable01', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_X_weiqi01.gltf', name: '带伞棋坛',modelName: 'BP_G_weiqi01', type:1},
-	// {url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_X_RelaxChair01_One.glb', name: '单独休闲椅01',modelName: 'BP_X_RelaxChair01_One', type:1},
+	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_X_RelaxChair01_One.glb', name: '单独休闲椅01',modelName: 'BP_X_RelaxChair01_One', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_X_RelaxChair02_One.gltf', name: '单独休闲椅02',modelName: 'BP_X_RelaxChair02_One', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_X_RelaxChair03_One.gltf', name: '单独休闲椅03',modelName: 'BP_X_RelaxChair03_One', type:1},
 	{url: 'https://dm.static.elab-plus.com/miniProgram/model/BP_X_swimmingpool01.gltf', name: '泳池01',modelName: 'BP_X_swimmingpool01', type:1},

BIN
webgl/favicon.ico


File diff suppressed because it is too large
+ 0 - 33
webgl/gltf/draco_decoder.js


BIN
webgl/gltf/draco_decoder.wasm


File diff suppressed because it is too large
+ 0 - 33
webgl/gltf/draco_encoder.js


File diff suppressed because it is too large
+ 0 - 116
webgl/gltf/draco_wasm_wrapper.js


+ 0 - 19
webgl/index.html

@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<html lang="">
-  <head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width,initial-scale=1.0">
-	<meta http-equiv="Access-Control-Allow-Origin" content="*">
-    <link rel="icon" href="favicon.ico">
-    <title>webgl</title>
-  <script defer src="static/js/chunk-vendors.js"></script><script defer src="static/js/app.js"></script></head>
-  <body>
-    <noscript>
-      <strong>We're sorry but webgl doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
-    </noscript>
-    <div id="app"></div>
-    <!-- built files will be auto injected -->
-	<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
-  </body>
-</html>

BIN
webgl/static/fonts/element-icons.f1a45d74.ttf


BIN
webgl/static/fonts/element-icons.ff18efd1.woff