zjs_project 1 年之前
父節點
當前提交
0fef5ec17b

+ 5 - 1
src/App.vue

@@ -13,7 +13,7 @@
 				<div class="loadingMsg">{{loadingMsg}}</div>
 			</div>
 		</div>
-
+		<webglCom ref="webglCom"></webglCom>
 	</div>
 </template>
 
@@ -23,9 +23,11 @@
 		getStorage,
 		pxoveItem
 	} from '@/utils/localStorage';
+	import webglCom from'@/components/webglCom/webglCom.vue';
 	const util = require('@/utils/util.js').default;
 	export default {
 		name: "App",
+		components:{webglCom},
 		// provide() {
 		// 	return {
 		// 		reload: this.reload,
@@ -107,6 +109,8 @@
 					e.preventDefault();
 				}
 			});
+			window.webglCom = this.$refs.webglCom;//定义全局webgl对象
+			console.warn("window.webglCom:", window.webglCom);
 		},
 		methods: {
 			async webLogin(){

+ 20 - 20
src/components/newBottomCom/viewCareful/viewCareful.vue

@@ -21,10 +21,6 @@
 			}
 		},
 		props:{
-			overChange: {//当前页面是否处在忙碌状态
-				type: Boolean,
-				default: false,
-			},
 			curHouseObj: {//当前展示的户型
 				type: Object,
 				default: () => {
@@ -58,6 +54,9 @@
 			curSpaceId() {
 				return this.$store.state.curSpaceId;
 			},
+			overChange() {
+				return this.$store.state.overChange;
+			},
 		},
 		mixins: [],
 		async mounted() {//组件挂载时事件
@@ -183,27 +182,28 @@
 				// var currPage = getCurrentPages()[getCurrentPages().length - 1] ? getCurrentPages()[getCurrentPages().length - 1].$vm : null;
 				// this.sendMessageAction(JSON.stringify(parmas));
 				this.$parent.$parent.callBackFun = this.callBack;//向父页面注册通知回调函数
-				this.$emit("curSpaceChange",data);//通知父组件-空间面积变化
+				// this.$emit("curSpaceChange",data);//通知父组件-空间面积变化
+				webglCom.curSpaceChange(data)
 			},
 			selectSpace(item,index){
 				this.selectIndex = index;
-				this.$parent.$parent.curSpaceSelect(item);//向父页面通知空间被选中了
+				webglCom.curSpaceSelect(item.spaceId);//向父页面通知空间被选中了
 			},
 			//去往详情页面
-			goRoam(){
-				let item = this.lastCareList[this.selectIndex];
-				this.$parent.$parent.goRoam1(item.spaceId);
-				let param = {
-					type: 'CLK', //埋点类型
-					clkId: 'clk_2cmina_24012901', //点击ID
-					clkName: 'AI_clk', //点击前往的页面名称
-					clkParams: {
-						locusName: "AI精软装",
-						carefulList:this.carefulList
-					}
-				};
-				util.trackRequest(param);
-			},
+			// goRoam(){
+			// 	let item = this.lastCareList[this.selectIndex];
+			// 	webglCom.goRoam1(item.spaceId);
+			// 	let param = {
+			// 		type: 'CLK', //埋点类型
+			// 		clkId: 'clk_2cmina_24012901', //点击ID
+			// 		clkName: 'AI_clk', //点击前往的页面名称
+			// 		clkParams: {
+			// 			locusName: "AI精软装",
+			// 			carefulList:this.carefulList
+			// 		}
+			// 	};
+			// 	util.trackRequest(param);
+			// },
 			callBack(type){
 				console.warn("***callBack***",type)
 				this.initData();

+ 57 - 51
src/components/newBottomCom/viewMask/viewMask.vue

@@ -165,54 +165,72 @@
 				// dialogVisible: false,
 				// dialogAIVisible: false,
 				datalist:[],
-				curSpaceId:'',
+				spaceList:[],
+				spaceObj:null,
 			}
 		},
 		props:{
-			spaceObj: {
-				type: Object,
-				default: null,
+			// layoutList:{
+			// 	type: [Array ,Object],
+			// 	default: [],
+			// }
+		},
+		computed:{
+			curSpaceId() {
+				return this.$store.state.curSpaceId;
 			},
-			spaceList: {
-				type: [Array ,Object],
-				default: [],
+			curHouseObj() {
+				return this.$store.state.curHouseObj;
+			},
+			arrFrunList() {
+				return webglCom.arrFrunList;
+			},
+			aiData() {
+				return this.$store.state.aiData;
+			},
+			userId() {
+				return this.$store.state.userId;
 			},
-			layoutList:{
-				type: [Array ,Object],
-				default: [],
-			}
 		},
 		watch: {
-			spaceObj(newVal, oldVal) {
-				if (newVal == null) {
-					return;
-				}
-				console.log("当前空间数据view-mark-watch:", newVal,newVal.layoutSpaceName,newVal.layoutSpaceType);
-				this.getAiBeautyFamily();
-				// this.curSpaceArea = parseFloat(
-				// 	(newVal.spaceWidth * newVal.spaceHeight) / 10000
-				// ).toFixed(2);
-				// this.getOverallArrangementDetailsList();
+			curHouseObj: {
+				handler(newVal,oldVal) {
+					if (newVal) {
+						console.warn("***curHouseObj-CHANGE-viewMask***", newVal)
+						let spaceDetail = newVal;
+						let spaceList = JSON.parse(spaceDetail.houseJson);
+						this.spaceList = spaceList;
+						this.datalist = [];
+						spaceList.forEach(it=>{
+							if(it.spaceName && !it.isSizeLock){
+								this.datalist.push(it);
+							}
+						})
+					}
+				},
+				immediate: true
 			},
-			spaceList(newVal, oldVal) {
-				if (newVal == null) {
-					return;
-				}
-				console.log("当前空间数据spaceList-watch:", newVal);
-				if(newVal && newVal.length>0){
-					this.datalist = [];
-					newVal.forEach(it=>{
-						if(it.spaceName && !it.isSizeLock){
-							this.datalist.push(it);
-						}
-					})
-				}
+			curSpaceId: {
+				handler(newVal,oldVal) {
+					if (newVal) {
+						console.warn("***curSpaceId-CHANGE-viewMask***", newVal,oldVal)
+						// this.initData();
+						const spaceDetail = this.spaceList.find(it=>it.spaceId == newVal);
+						this.spaceObj = spaceDetail;
+						this.getAiBeautyFamily();
+					}
+				},
+				immediate: true
 			},
-			layoutList(newVal, oldVal) {
-				if (newVal == null) {
-					return;
-				}
-				this.updataLable();
+			arrFrunList: {
+				handler(newVal,oldVal) {
+					console.warn("***arrFrunList-CHANGE-viewMask***", newVal,oldVal)
+					if (newVal == null) {
+						return;
+					}
+					this.updataLable();
+				},
+				immediate: true
 			},
 		},
 		filters:{
@@ -252,17 +270,6 @@
 			console.warn("***beforeDestroy***");//更新到页面上的数据
 			this.stopInterval();
 		},
-		computed: {
-			aiData() {
-				return this.$store.state.aiData;
-			},
-			curHouseObj() {
-				return this.$store.state.curHouseObj;
-			},
-			userId() {
-				return this.$store.state.userId;
-			},
-		},
 		methods:{
 			//更改空间显示名称 X空间 类型 根据布局所属类型来显示
 			updataLable(){
@@ -680,7 +687,6 @@
 						parmas.model = "deployments/elabgroup/elab-ssd-1b";
 					}
 				}
-				this.curSpaceId = this.spaceObj.spaceId;//生成时的空间id
 				let result = await this.prevHandle(parmas);
 				console.warn("***prevHandle***",result)
 				if(result && result.length>0){

+ 0 - 4
src/components/newBottomCom/viewPlot/viewPlot.vue

@@ -31,10 +31,6 @@
 			}
 		},
 		props:{
-			overChange: {//当前页面是否处在忙碌状态
-				type: Boolean,
-				default: false,
-			},
 			curHouseObj: {//当前展示的户型
 				type: Object,
 				default: () => {

+ 3 - 3
src/components/newBottomCom/viewShell/viewShell.html

@@ -25,13 +25,13 @@
 		<div class="signscoll-block"></div>
 	</div> -->
 	<!-- 精细化视图 -->
-	<viewCareful ref="viewCareful" v-show="styleType==2" @curSpaceChange="curSpaceChange" :overChange="overChange" :curHouseObj="houseObj"></viewCareful>
+	<viewCareful ref="viewCareful" v-show="styleType==2" @curSpaceChange="curSpaceChange" :curHouseObj="houseObj"></viewCareful>
 	<!-- 布局选择 -->
 	<viewPlot ref="viewPlot" v-show="styleType==3" @curSpaceChange="curSpaceChange"
-	:overChange="overChange" :curHouseObj="houseObj"></viewPlot>
+	:curHouseObj="houseObj"></viewPlot>
 	<!-- 底部按钮视图 -->
 	<viewlayout ref="viewlayout" @curSpaceChange="curSpaceChange" :styleType="styleType" 
-	:overChange="overChange" :curHouseObj="houseObj" :houseList="houseList" @changeStyle="changeStyle"
+	:curHouseObj="houseObj" :houseList="houseList" @changeStyle="changeStyle"
 	@streamRecord="streamRecord" @streamRecordEnd="streamRecordEnd" @seedChange="seedChange"></viewlayout>
 	<!-- nav视图 -->
 	<!-- <viewToolNav v-show="pageType==1 && (styleType==2 || styleType==3)" :seedItem="seedItem" @downCom="downScroll"></viewToolNav> -->

+ 3 - 7
src/components/newBottomCom/viewShell/viewShell.vue

@@ -37,10 +37,6 @@
 			}
 		},
 		props:{
-			overChange: {//当前选中的户型类型
-				type: Boolean,
-				default: false,
-			},
 			pageType: {//当前组件所在的页面类型-决定了使用哪些子组件和样式
 				type: [String, Number],
 				default: 1,
@@ -98,10 +94,10 @@
 							_endHeight = 600;
 						}
 						// let currPage = getCurrentPages()[getCurrentPages().length - 1] ? getCurrentPages()[getCurrentPages().length - 1].$vm : null;
-						if(this.$parent && this.$parent.hasOwnProperty('canvasHeight')){
-							this.$parent.gradientResize(1,_starHeight,_endHeight)
+						if(webglCom && webglCom.hasOwnProperty('canvasHeight')){
+							webglCom.gradientResize(1,_starHeight,_endHeight);
+							webglCom.styleType = newVal;//变更为展开状态
 						}
-						this.$parent.styleType = newVal;//变更为展开状态
 					}
 				},
 			},

+ 13 - 7
src/components/newBottomCom/viewlayout/viewlayout.vue

@@ -2,7 +2,7 @@
 
 </template>
 <script>
-	// const util = require('@/static/utils/util.js');
+	const util = require('@/utils/util.js').default;
 	const config = require('@/services/urlConfig.js');
 	import {
 		Toast
@@ -58,10 +58,6 @@
 					return null
 				}
 			},
-			overChange: {//当前选中的户型类型
-				type: Boolean,
-				default: false,
-			},
 			styleType:{
 				type: [String, Number],
 				default: '',
@@ -228,7 +224,17 @@
 				// util.trackRequest(param);
 			},
 			goRoam(){
-				this.$parent.$refs.viewCareful.goRoam();
+				let param = {
+					type: 'CLK', //埋点类型
+					clkId: 'clk_2cmina_24012901', //点击ID
+					clkName: 'AI_clk', //点击前往的页面名称
+					clkParams: {
+						locusName: "AI精软装",
+						carefulList:this.curSpaceId
+					}
+				};
+				util.trackRequest(param);
+				webglCom.goRoam1(this.curSpaceId);
 			},
 			//获取录音权限
 			getRecordAuth: function() {
@@ -278,7 +284,7 @@
 			},
 			//声音变化
 			async textChange(text) {
-				if(this.overChange){
+				if(webglCom.overChange){
 					uni.showToast({
 						title: '请慢一点',
 						icon: 'none',

+ 14 - 14
src/components/newQCCom/viewCareful/viewCareful.vue

@@ -190,20 +190,20 @@
 				this.$parent.$parent.curSpaceSelect(item);//向父页面通知空间被选中了
 			},
 			//去往详情页面
-			goRoam(){
-				let item = this.lastCareList[this.selectIndex];
-				this.$parent.$parent.goRoam1(item.spaceId);
-				let param = {
-					type: 'CLK', //埋点类型
-					clkId: 'clk_2cmina_24012901', //点击ID
-					clkName: 'AI_clk', //点击前往的页面名称
-					clkParams: {
-						locusName: "AI精软装",
-						carefulList:this.carefulList
-					}
-				};
-				util.trackRequest(param);
-			},
+			// goRoam(){
+			// 	let item = this.lastCareList[this.selectIndex];
+			// 	webglCom.goRoam1(item.spaceId);
+			// 	let param = {
+			// 		type: 'CLK', //埋点类型
+			// 		clkId: 'clk_2cmina_24012901', //点击ID
+			// 		clkName: 'AI_clk', //点击前往的页面名称
+			// 		clkParams: {
+			// 			locusName: "AI精软装",
+			// 			carefulList:this.carefulList
+			// 		}
+			// 	};
+			// 	util.trackRequest(param);
+			// },
 			callBack(type){
 				console.warn("***callBack***",type)
 				this.initData();

+ 0 - 10
src/components/newQCCom/viewPlot/viewPlot.vue

@@ -188,16 +188,6 @@
 				this.$parent.$parent.userSelectPlot(plot,this.selectSpace);//告知页面,用户选择的布局id
 				this.lastTabIndex = this.tabIndex;
 			},
-			//去往详情页面
-			goRoam(){
-				let item = this.lastCareList[this.selectIndex];
-				this.$parent.$parent.goRoam1(item.spaceId);
-			},
-			callBack(type){
-				console.warn("***callBack***",type)
-				this.initData();
-				this.$parent.$parent.callBackFun = null;//注销父页面的通知回调函数
-			}
 		}
 	}
 </script>

+ 12 - 2
src/components/newQCCom/viewlayout/viewlayout.vue

@@ -2,7 +2,7 @@
 
 </template>
 <script>
-	// const util = require('@/static/utils/util.js');
+	const util = require('@/utils/util.js').default;
 	const config = require('@/services/urlConfig.js');
 	import {
 		Toast
@@ -225,7 +225,17 @@
 				// util.trackRequest(param);
 			},
 			goRoam(){
-				this.$parent.$refs.viewCareful.goRoam();
+				let param = {
+					type: 'CLK', //埋点类型
+					clkId: 'clk_2cmina_24012901', //点击ID
+					clkName: 'AI_clk', //点击前往的页面名称
+					clkParams: {
+						locusName: "AI精软装",
+						carefulList:this.curSpaceId
+					}
+				};
+				util.trackRequest(param);
+				webglCom.goRoam1(this.curSpaceId);
 			},
 			
 		}

+ 29 - 0
src/components/webglCom/webglCom.html

@@ -0,0 +1,29 @@
+<!-- webgl的视图页面 -->
+<div class="webgl-view">
+	<!-- 户型面积相关视图 -->
+	<div class="area-view" v-if="showArea">
+		<div>总面积:{{layoutArea}}<span style="font-weight: 700;">㎡</span></div>
+		<div class="rows style1">
+			<div v-if="changeArea" class="reduce">
+				<div>{{changeArea < 0 ? '减少':'增加'}}</div>
+				<div class="style2" >{{Math.abs(changeArea)}}<span class="style3">㎡</span></div>
+			</div>
+			<div>
+				<div>初始面积:{{fixedArea}}<span style="font-weight: 700;">㎡</span></div>
+				<div>当前面积:{{sumArea}}<span style="font-weight: 700;">㎡</span></div>
+			</div>
+		</div>
+	</div>
+	<div id="mapDiv" ref="webgl"></div>
+	<canvas id="glcanvas" width="100vw" height="100vh" ref="glcanvas"
+	 :style="{'height':canvasHeight+'px'}">
+		你的浏览器似乎不支持或者禁用了 HTML5 <code>&lt;canvas&gt;</code> 元素。
+	</canvas>
+	<!-- 空间悬浮文字说明 -->
+	<div v-show="showLables && gltf.text.length>0 && gltf.transform" v-for="(gltf,index) in lableItem" :key="index" 
+		class="word-view"
+		:style="{'transform':gltf.transform}" @click="selectSpaceHandle(gltf)">
+		<div v-if="styleType==2" user-select="false" :class="['number-view ',(index+1)>9?'number-more':'',currentChangeSpaceId==gltf.spaceId?' active':'']">{{gltf.spaceIndex+1}}</div>
+		<div v-else user-select="false" class="word" :class="currentChangeSpaceId==gltf.spaceId?'active':''">{{gltf.text}}></div>
+	</div>
+</div>

+ 96 - 0
src/components/webglCom/webglCom.scss

@@ -0,0 +1,96 @@
+.area-view{
+	position: absolute;
+	top:10px;
+	left:30px;
+	// width:100%;
+	font-size: 24px;
+	font-family: "Verdana";
+	font-weight: 400;
+	z-index: 301;
+	.style1{
+		margin-top:10px;
+	}
+	.style2{
+		font-weight: 700;
+		font-size: 28px;
+	}
+	.style3{
+		font-size: 24px;
+	}
+	span{
+		font-size: 28px;
+	}
+	.reduce{
+		// width: 92px;
+		height: 72px;
+		border-radius: 12px;
+		color: #fa9f40;
+		background: rgba(250, 159, 64, 0.12);
+		font-size: 24px;
+		margin-right:10px;
+		padding:4px 10px;
+	}
+}
+#mapDiv{
+    width: 100%;
+    height: 100vh;
+    background-color: #fff;
+}
+canvas { 
+	width:100vw; 
+	height:calc(100vh - 200px);
+	z-index: 10; 
+}
+canvas:focus {
+	outline:none;
+}
+.webgl-view{
+	position: absolute;
+	top: 0px;
+	left: 0px;
+	width: 100%;
+	height: 100vh;
+	// z-index: 1;
+}
+// 空间悬浮说明
+.word-view{
+	position: absolute; 
+	left: 0;            
+	top: 0;
+	user-select: none;  
+	z-index: 12;
+	text-align: center;
+	border-radius: 5px;
+	.word{
+		font-family: "Verdana";
+		font-weight: 400;
+		height: 40px;
+		line-height: 40px;
+		padding:0px 10px;
+		border-radius: 20px;
+		background: #fff;
+		font-size:26px;
+		color: #1d1d1d;
+	}
+	.number-view{
+		width: 30px;
+		height: 30px;
+		line-height: 30px;
+		background: #fff;
+		color: #121212;
+		font-weight: 700;
+		font-size: 28px;
+		font-family: "DIN Alternate Bold";
+		border-radius: 30px;
+	}
+	.number-more{
+		width: 40px;
+		height: 40px;
+		line-height: 40px;
+		border-radius: 30px;
+	}
+	.active{
+		background: #faad5c;
+		color: #fff;
+	}
+}

File diff suppressed because it is too large
+ 1188 - 0
src/components/webglCom/webglCom.vue


+ 0 - 1
src/main.js

@@ -41,7 +41,6 @@ Vue.prototype.$message = message//重写提示
 // 引入echarts
 import * as echarts from 'echarts'
 window.echarts = echarts;
-
 console.log('***process.env***production', process.env);
 window.env = process.env.NODE_ENV;
 env = env == 'development' ? 'test2' : env;

+ 0 - 1
src/mixins/floorMethod.js

@@ -15,7 +15,6 @@ export default {
 			// gltfSpaceUrl: "https://dm.static.elab-plus.com/miniProgram/model/BP_L_carpet01-1.gltf", //模型地址
 			// gltfSpace1Url: "https://dm.static.elab-plus.com/miniProgram/model/BP_G_tiles01_1.gltf", //模型地址
 			gltfSpace1Url: "https://dm.static.elab-plus.com/miniProgram/model/BP_G_tiles01.glb", //模型地址
-			instancedSpaceMeshList:[],//地板实例对象 当地板复杂是就会存在多个
 			spaceTypes:spaceTypes,
 		}
 	},

+ 1 - 1
src/mixins/loadModel.js

@@ -11,7 +11,7 @@ import * as THREE from 'three';
 export default {
 	data() {
 		return {
-			gltfLayouts: [],
+			// gltfLayouts: [],
 			instancedFurList:[],
 			
 			// graderGltfLayouts: [],//花园地块的模型对象

+ 0 - 3
src/mixins/wallMethod.js

@@ -200,15 +200,12 @@ export default {
 										instancedMeshIndexList:[//标识网格实例数组的序号 以及 当前几何体 在网格实例的序号
 											{instancedMeshIndex:this.instancedMeshList.length-1,instancedAtIndex:i},
 										],
-										// id:child.id,//几何体的id
-										// name:child.name,//几何体的id
 										wallPositionX:modelItem.wallPositionX,
 										wallPositionY:modelItem.wallPositionY,
 										wallScaleX:modelItem.wallScaleX,
 										wallScaleY:modelItem.wallScaleY,
 										wallRotateY:modelItem.wallRotateY,
 										wallWidth:modelItem.wallWidth,
-										// lastWallType:51,
 										wallModelData:modelItem,
 										wallModelInitData:modelItem, // 保留初始化墙体数据,方便空间变形计算缩放比例 
 										wallDirection:it.wallDirection, 

File diff suppressed because it is too large
+ 2483 - 0
src/pages/webgl_rxdz/webgl_rxdz - 副本 (2).vue


+ 8 - 13
src/pages/webgl_rxdz/webgl_rxdz.html

@@ -1,8 +1,8 @@
-<div class="map" style="position: absolute;width: 100%;height: 100vh;z-index: 1;">
+<div class="map" style="position: absolute;width: 100%;height: 100vh;">
 	<mynavbar :barData='navbar'/>
 	<!-- 提交按钮 -->
 	<!-- <div class="submit-btn" @click="submitHouse" v-if="styleType==1">提交</div> -->
-	<div class="area-view">
+	<!-- <div class="area-view">
 		<div>总面积:{{layoutArea}}<span style="font-weight: 700;">㎡</span></div>
 		<div class="rows style1">
 			<div v-if="changeArea" class="reduce">
@@ -19,16 +19,11 @@
 	<canvas id="glcanvas" width="100vw" height="100vh" ref="glcanvas"
 	 :style="{'height':canvasHeight+'px'}">
 		你的浏览器似乎不支持或者禁用了 HTML5 <code>&lt;canvas&gt;</code> 元素。
-	</canvas>
+	</canvas> -->
 	<!-- 主要操作视图 -->
-	<viewShell ref="viewShell" pageType="1" :overChange="overChange" :houseList="houseList" :houseObj="curHouseObj" :curHouseType="curHouseType" @curSpaceChange="curSpaceChange" @curHouseTypeChange="curHouseTypeChange" @curHouseFloorChange="curHouseFloorChange"></viewShell>
-	
-	<div v-show="showLables && gltf.text.length>0 && gltf.transform" v-for="(gltf,index) in lableItem" :key="index" class="word-view"
-	:style="{'transform':gltf.transform}" @click="selectSpaceHandle(gltf)">
-		<div v-if="styleType==2" user-select="false" :class="['number-view ',(index+1)>9?'number-more':'',currentChangeSpaceId==gltf.spaceId?' active':'']">{{gltf.spaceIndex+1}}</div>
-		<div v-else user-select="false" class="word" :class="currentChangeSpaceId==gltf.spaceId?'active':''">{{gltf.text}}></div>
-	</div>
-	<!-- <div id="labels"></div> -->
-	<!-- 左侧操作区域 -->
-	<!-- <left-operate-comp @operateHandle="operateHandle"></left-operate-comp> -->
+	<viewShell ref="viewShell" pageType="1" 
+	:houseList="houseList" 
+	:houseObj="curHouseObj" :curHouseType="curHouseType" 
+	@curHouseTypeChange="curHouseTypeChange" 
+	@curHouseFloorChange="curHouseFloorChange"></viewShell>
 </div>

File diff suppressed because it is too large
+ 54 - 1112
src/pages/webgl_rxdz/webgl_rxdz.vue


+ 271 - 254
src/pages/webgl_rxdz_roam/webgl_rxdz_roam - 副本.vue

@@ -8,13 +8,13 @@
 	import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
 	
 	import TWEEN from 'three/addons/libs/tween.module.js';
-
+	import {getStorage} from '@/utils/localStorage';
 	var requestId = "";
     const util = require('@/utils/util.js').default;
 	// import util from '@/utils/util.js';
     // const config = require('@/services/urlConfig.js');
     // import requestConfig from '@/static/lib/requestConfig.js';
-	import viewShell from'@/components/newBottomCom/viewShell/viewShell.vue';
+	// import viewShell from'@/components/newBottomCom/viewShell/viewShell.vue';
 	import viewMask from'@/components/newBottomCom/viewMask/viewMask.vue';
 
 	// import { RGBELoader } from '@/webgl/jsm/loaders/RGBELoader.js';
@@ -22,11 +22,12 @@
 	import floorMethod from '@/mixins/floorMethod.js';
 	import loadModel from '@/mixins/loadModel.js';
 	import wallMethod from '@/mixins/wallMethod.js';
+	import commonPageMethod from '@/mixins/commonPageMethod.js';
 	// import commonPageMethod from '@/common/commonPageMethod.js';
     // const app = getApp(); //获取应用实例
     export default {
-		components:{viewShell,viewMask},
-		mixins:[screenshot,loadModel,floorMethod,wallMethod],
+		components:{viewMask},
+		mixins:[screenshot,loadModel,floorMethod,wallMethod,commonPageMethod],
         /**
          * 页面的初始数据
          */
@@ -46,7 +47,7 @@
 				    navPaddingBg:'transparent',
 				    navBarColor: 'transparent',
 				    navBackColor: 'transparent',
-				    haveCallback: false, // 如果是 true 会接手 navbarBackClk
+				    haveCallback: true, // 如果是 true 会接手 navbarBackClk
 				    fromShare: false,
 				    fromProject: 0,
 				    shareToken: "",
@@ -55,6 +56,7 @@
                 id:'',// 户型编号
                 spaceList:[], // 空间列表
                 gltfSpaces:[], // 场景中地板模型数组
+				gltfSpaceRoofs:[],
                 curSpaceObj:null, // 当前选中的空间
                 // curSpaceIndex:-1, // 当前选中的空间索引
 				spaceId:null,
@@ -71,7 +73,6 @@
 				controlLastPosition: null,		//观察点上一次移动到的位置
 				canvasHeight:408,	//canvas视图的高度-计算得出
 				chooseMesh:null,//标记鼠标拾取到的mesh
-				isManyou: false,	//当前是否处在漫游状态
 				shottingImg: [],
 				progress:1,	//进度条
 				myLoadingStatus:false,
@@ -83,8 +84,9 @@
 				actors:[],
 				showDownView:true,//默认显示下载按钮
 				currentActor:null,
-				isIos:false,	//是否ios手机。默认不是
-				circleGroup:null,
+				circleGroup:null,//圆形地标
+				isIOS:false,
+				defaulIndex:null,	//默认视角的序号
 				// aiImagesList:[
 				// 	// "https://dm.static.elab-plus.com/miniProgram/plus_IM01.png",
 				// 	// "https://dm.static.elab-plus.com/miniProgram/plus_IM02.png",
@@ -97,11 +99,34 @@
 			cancelAnimationFrame(requestId, this.canvas)
 			this.worker && this.worker.terminate()
 			if (this.renderer instanceof THREE.WebGLRenderer) {
-				this.renderer.dispose()
-				this.renderer.forceContextLoss()
-				this.renderer.context = null
-				this.renderer.domElement = null
-				this.renderer = null;
+				// 遍历场景中的所有子对象,找到类型为Mesh的对象并移除
+				let deleList = this.scene.children.filter(object=>{
+					if (object instanceof THREE.Mesh) {
+						return object
+					}
+				})
+				if(deleList && deleList.length>0){
+					this.scene.remove(...deleList);
+				}
+				this.scene.traverse(function(object) {
+					if (object instanceof THREE.Mesh) {
+						if(object.geometry && typeof(object.geometry.dispose)=='function'){
+							object.geometry.dispose();
+						}
+						if(object.material && typeof(object.material.dispose)=='function'){
+							object.material.dispose();
+						}
+						if(object.texture && typeof(object.texture.dispose)=='function'){
+							object.texture.dispose();
+						}
+					}
+				});
+				this.renderer.clear();
+				this.renderer.dispose();
+				this.renderer.forceContextLoss();
+				this.renderer.context = null;
+				this.renderer.domElement = null;
+				this.renderer = null;;
 				this.clearHandle()
 			}
 			TWEEN && TWEEN.removeAll();//清除所有的tween;
@@ -109,10 +134,29 @@
 		},
         mounted(options) {
 			var that = this;
+			// alert("JavaScript 堆大小限制: "+performance.memory.jsHeapSizeLimit
+			// +"\n已使用的 JavaScript 堆大小: "+performance.memory.usedJSHeapSize
+			// +"\nJavaScript 堆的总大小: "+performance.memory.totalJSHeapSize);
 			console.warn("***webgl_rxdz_roam-options***",this.$route.query)
-			// alert("***mounted-webgl_rxdz_roam***"+this.curHouseObj)
-			let unit = window.screen.width / 750;//单位rpm 对应 px 的值
-			this.canvasHeight = window.screen.height - (600 * unit) + (40 * unit);
+			this.isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
+			if(this.isIOS){
+				this.curHouseObj = JSON.parse(getStorage('curHouseObj'));
+				this.wallList = JSON.parse(getStorage('wallList'));
+			}else{
+				this.curHouseObj = 	this.$store.state.curHouseObj;
+				this.wallList = 	this.$store.state.wallList;
+			}
+			// alert("***mounted-webgl_rxdz_roam***"+this.isIOS + this.curHouseObj)
+			let screenWidth = window.screen.width;
+			let screenHeight = window.screen.height;
+			if(window.innerWidth && window.screen.width){
+				screenWidth = Math.min(window.innerWidth,window.screen.width)
+			}
+			if(window.innerHeight && window.screen.height){
+				screenHeight = Math.min(window.innerHeight,window.screen.height)
+			}
+			let unit = screenWidth / 750;//单位rpm 对应 px 的值
+			this.canvasHeight = screenHeight - (600 * unit) + (40 * unit);
 			this.houseId = this.$route.query.houseId?this.$route.query.houseId:'';
 			this.spaceId = this.$route.query.spaceId?this.$route.query.spaceId:'';
 			let container = this.$refs.webgl;
@@ -145,8 +189,8 @@
 			// this.meshRoam = meshRoam;
 			this.tweenCameraAnmaChange = tweenCameraAnmaChange;
 			this.switchActor = switchActor;
-			this.hideOrShowActor = hideOrShowActor;
 			this.starRender = starRender;//对外暴露启动渲染的方法
+			this.stopRender = stopRender;//对外暴露停止渲染的方法
 			this.positionCamer = positionCamer;
 			if(this.curHouseObj && this.curHouseObj.id){
 				this.setHouseDetail(this.curHouseObj);
@@ -165,7 +209,7 @@
 				// })
 
 				// 创建相机位置
-				camera = new THREE.PerspectiveCamera(95, window.screen.width / that.canvasHeight, 0.1, 10000 );
+				camera = new THREE.PerspectiveCamera(90, screenWidth / that.canvasHeight, 0.1, 10000 );
 				// camera.up.set(0, 1, 0);//俯视状态,将相机的up向量设置为z轴负方向 {x:0,y:1,z:0}
 				// camera.position.set(that.cameraStarPosition.x, that.cameraStarPosition.y, that.cameraStarPosition.z);
 				scene.add(camera);
@@ -177,16 +221,18 @@
 				//平行光
 				const light = new THREE.DirectionalLight(0xFFF8E5, 2.5);
 				light.position.set(5, 7, 3); //default; light shining from top
-				light.castShadow = true; // default false
-				// 默认情况下光投影相机区域是一个长宽高为10x10x500的长方体区域,光源投射方向为通过坐标原点
-				light.shadow.camera.left = -100; // 这个区域内产生阴影
-				light.shadow.camera.right  = 100; // 这个区域内产生阴影
-				light.shadow.camera.top  = 100; // 这个区域内产生阴影
-				light.shadow.camera.bottom  = -100; // 这个区域内产生阴影
+				if(!that.isIOS){
+					light.castShadow = true; // default false
+					// 默认情况下光投影相机区域是一个长宽高为10x10x500的长方体区域,光源投射方向为通过坐标原点
+					light.shadow.camera.left = -100; // 这个区域内产生阴影
+					light.shadow.camera.right  = 100; // 这个区域内产生阴影
+					light.shadow.camera.top  = 100; // 这个区域内产生阴影
+					light.shadow.camera.bottom  = -100; // 这个区域内产生阴影
+					
+					light.shadow.mapSize.width = 1024; 	// 影响阴影的清晰度
+					light.shadow.mapSize.height = 1024; // 影响阴影的清晰度
+				}
 				
-				light.shadow.mapSize.width = 8192; 	// 影响阴影的清晰度
-				light.shadow.mapSize.height = 8192; // 影响阴影的清晰度
-
 				scene.add(light);
 				
 				//antialias 这个值得设置为false,不然IOS上截图会失效
@@ -196,8 +242,10 @@
 					antialias:true,
 					preserveDrawingBuffer: true,
 				});
-				// renderer.shadowMap.enabled = true;//产生阴影  IOS 下有阴影会导致渲染下重新执行挂载方法-页面会二次载入,不知原因
-				// renderer.shadowMap.type = THREE.PCFSoftShadowMap; // 阴影属性
+				if(!that.isIOS){
+					renderer.shadowMap.enabled = true;//产生阴影
+					renderer.shadowMap.type = THREE.PCFSoftShadowMap; // 阴影属性
+				}
 				renderer.outputEncoding = THREE.sRGBEncoding;
 				renderer.outputColorSpace = THREE.SRGBColorSpace;
 				// renderer.toneMappingExposure = 0.1;//色调映射的曝光级别。默认是1
@@ -205,22 +253,22 @@
 				renderer.physicallyCorrectLights = true;//关键参数,模拟物理光照影响,必须设置为true
 
                 renderer.setPixelRatio(window.devicePixelRatio);
-                renderer.setSize(window.screen.width, that.canvasHeight);
+                renderer.setSize(screenWidth, that.canvasHeight);
                 container.appendChild( renderer.domElement );
 				
 				controls = new OrbitControls( camera, renderer.domElement );
-				controls.screenSpacePanning = true;
-				controls.enableDamping = true;
-				controls.minDistance = 0.5;
+				controls.enableDamping = true;//启动缓动
+				controls.minDistance = 0.0001;
 				controls.maxDistance = 10;
 				controls.minPolarAngle = 0;// 默认0
 				controls.maxPolarAngle = Math.PI / 2; // 默认Math.PI,即可以向下旋转到的视角。
-				controls.target.set(  that.controlStarPosition.x, that.controlStarPosition.y, that.controlStarPosition.z);
-				
+				// controls.target.set(  that.controlStarPosition.x, that.controlStarPosition.y, that.controlStarPosition.z);
 				controls.enableZoom = true;//启用摄像机的缩放
-				controls.enablePan = false;//禁用摄像机平移
+				controls.enablePan = true;//禁用摄像机平移
 				controls.enableRotate = true;//启用摄像机水平或垂直旋转
-				controls.zoomToCursor = true;
+				// controls.zoomToCursor = true;
+				
+				// controls.target.copy(camera.position);
 				// controls.update();
 				// 监听相机移动事件-限制只能在当前空间范围内移动
 				controls.addEventListener('change', () => {
@@ -237,9 +285,9 @@
 				// controls.target = new THREE.Vector3( );;
 				// camera.lookAt(that.controlStarPosition.x,that.controlStarPosition.y,that.controlStarPosition.z);
                 raycaster = new THREE.Raycaster();
-				stats = new Stats();
-				container.appendChild(stats.dom);
-				stats.domElement.style.top = '100px';
+				// stats = new Stats();
+				// container.appendChild(stats.dom);
+				// stats.domElement.style.top = '100px';
 				attendEvent();//注册监听事件
 				starRender();	//启动渲染
             }
@@ -247,9 +295,9 @@
 				tweenCameraAnma = value
 			}
 			function attendEvent () {
-				renderer.domElement.addEventListener('touchstart', onPointerStart, false);
-				renderer.domElement.addEventListener('touchmove', onPointerMove, false);
-				renderer.domElement.addEventListener('touchend', onPointerUp, false);
+				renderer && renderer.domElement && renderer.domElement.addEventListener('touchstart', onPointerStart, false);
+				renderer && renderer.domElement && renderer.domElement.addEventListener('touchmove', onPointerMove, false);
+				renderer && renderer.domElement && renderer.domElement.addEventListener('touchend', onPointerUp, false);
 			}
 			//取消事件监听-避免二次进入时触发多次事件
 			function clearEvent(){
@@ -288,7 +336,7 @@
 			}
 			//射线检测handle
 			function checkIntersection(event) {
-			    let x = (event.changedTouches[0].clientX / window.screen.width) * 2 - 1;
+			    let x = (event.changedTouches[0].clientX / screenWidth) * 2 - 1;
 			    let y = -(event.changedTouches[0].clientY / that.canvasHeight) * 2 + 1;
 			    mouse.x = x;
 			    mouse.y = y;
@@ -323,6 +371,7 @@
 						let index = mesh.instanceId;//射线相交是的实例序号
 						let spaceId = that.gltfSpaces[index].spaceId;//获取选中实例的空间id
 						if(floor.name == "花园"){//花园
+							return false;
 							let selectMesh = that.gltfSpaces.find(it=>{return it.spaceType==14 && it.instancedMeshIndexList[0].instancedAtIndex==index})
 							spaceId = selectMesh.spaceId;
 						}else{//室内
@@ -331,60 +380,34 @@
 							spaceId = selectMesh.spaceId;
 						}
 						// let spaceId = that.gltfSpaces[index].spaceId;//获取选中实例的空间id
-						console.warn("***checkIntersection-地板***",mesh,floor,index,spaceId,that.spaceId)
+						console.warn("***checkIntersection-地板***",floor,index,spaceId,that.spaceId)
 						//当前拾取到的是本空间的底部-意味着用户点击了地板
 						if(floor && spaceId == that.spaceId){
-							// console.warn("***checkIntersection-地板***",mesh,floor)
 							moveCarmer(mesh.point);
 							return false;
 						}
 					}
 			    }
 			}
-			//显示当前选中的视角或者隐藏所有视角-因为截图时不能保留视角
-			function hideOrShowActor (type) {
-				console.warn("***hideOrShowActor***",type)
-				if(type=='hide'){
-					that.actors.forEach(it=>{
-						it.visible = false;//隐藏所有的视角的mesh模型
-					})
-				}else{
-					if(!that.currentActor){
-						uni.showToast({
-							icon: "none",
-							title: "没有视角!",
-						});
-						return false;
-					}
-					that.actors.forEach(it=>{
-						if(that.currentActor.userIndex==it.userIndex){
-							it.visible = false;//隐藏即将切换到的视角的mesh模型
-						}else{
-							it.visible = true;//显示其他视角的模型
-						}
-					})
-				}
-			}
 			//自动切换视角
-			function switchActor () {
+			function switchActor (toIndex=null) {
 				if(!that.currentActor){
-					uni.showToast({
-						icon: "none",
-						title: "没有当前视角!",
-					});
+					this.$message.warning("没有当前视角!");
 					return false;
 				}
 				if(!that.actors || that.actors.length==0){
-					uni.showToast({
-						icon: "none",
-						title: "没有视角!",
-					});
+					this.$message.warning("没有视角!");
 					return false;
 				}
-				let index = that.currentActor.userIndex;//当前视角的序号
-				let nextIndex = (index + 1) % that.actors.length;
-				//移动到对应的视角去
-				moveActor(that.actors[nextIndex]);
+				if(toIndex!=null){//存在要去往的视角
+					moveActor(that.actors[toIndex]);
+				}else{
+					let index = that.currentActor.userIndex;//当前视角的序号
+					let nextIndex = (index + 1) % that.actors.length;
+					//移动到对应的视角去
+					moveActor(that.actors[nextIndex]);
+					that.defaulIndex = nextIndex;//更新下默认视角
+				}
 			}
 			//移动到选中的位置-地板
 			function moveCarmer (point) {
@@ -394,14 +417,16 @@
 				}
 				let _x =  point.x - camera.position.x;//x轴移动的距离
 				let _z =  point.z - camera.position.z;//z轴移动的距离
-				// console.warn("***moveCarmer***",_x,_z)
-				let cameraNewPosition = {x:camera.position.x + _x,y:1.2,z:camera.position.z + _z};
-				let targetNewPosition = {x:controls.target.x + _x,y:1.2,z:controls.target.z + _z};
+				let cameraNewPosition = {x:camera.position.x + _x,y:1.5,z:camera.position.z + _z};
+				let targetNewPosition = {x:controls.target.x + _x,y:1.5,z:controls.target.z + _z};
 				let oldUp = {x:0,y:1,z:0};	
 				let newUp = {x:0,y:1,z:0};
 				moveTip(cameraNewPosition)
 				// console.warn("**moveCarmer***",lon,JSON.stringify(cameraNewPosition),JSON.stringify(targetNewPosition))
 				tweenCamera(camera.position,controls.target,cameraNewPosition,targetNewPosition,oldUp,newUp,2000);
+				setTimeout(()=> {
+					that.circleGroup.visible = false;
+				}, 2000);
 			}
 			//创建地标
 			function creatMoveTip(position){
@@ -423,6 +448,7 @@
 					});
 					that.circleGroup.add(circle);
 					scene.add(that.circleGroup);
+					that.circleGroup.visible = false;
 				}
 			}
 			//移动地标
@@ -440,30 +466,26 @@
 					that.circleGroup.add(circle);
 					scene.add(that.circleGroup);
 				}else{
+					that.circleGroup.visible = true;
 					that.circleGroup.children[0].position.set(position.x,0.01,position.z);
 				}
 			}
 			//移动视角点位
 			function moveActor (obj) {
 				clearEvent();//注销事件监听
-				that.actors.forEach(it=>{
-					if(obj.userIndex==it.userIndex){
-						it.visible = false;//隐藏
-					}else{
-						it.visible = true;//显示其他
-					}
-				})
 				// console.warn("***moveActor***",obj)
 				that.currentActor = obj;//记录下当前的视角对象 mesh网格模型
 				let cameraNewPosition = obj.position;
 				let targetNewPosition = obj.targetNewPosition;
 				let oldUp = {x:0,y:1,z:0};	//俯视
 				let newUp = {x:0,y:1,z:0};	//正视
-				console.warn("**moveActor***",JSON.stringify(cameraNewPosition),JSON.stringify(targetNewPosition))
+				// moveTip(cameraNewPosition);
+				// console.warn("**moveActor***",JSON.stringify(cameraNewPosition),JSON.stringify(targetNewPosition))
 				tweenCamera(camera.position,controls.target,cameraNewPosition,targetNewPosition,oldUp,newUp,2000);
 				lon = 0;
 				setTimeout(()=> {
 					attendEvent()
+					// that.circleGroup.visible = false;
 				}, 2000);
 			}
 			//初始化点位视角
@@ -480,68 +502,65 @@
 				if(defaulIndex == -1){
 					defaulIndex = 0;
 				}
+				that.defaulIndex = defaulIndex;//记录下默认视角
 				that.actors = [];
-				that.loader.load("https://dm.static.elab-plus.com/miniProgram/hs/gltf/sxtgltf.gltf",  ( gltf ) => {
-					spaceObj.actors.forEach((actor,index)=>{
-						let model = gltf.scene; // 获取模型
-						let cloneModel = model.clone(true);//赋值模型,准备复用
-						cloneModel.children.map((v,i)=>{
-							if(v.material){
-								v.material = model.children[i].material.clone()
+				spaceObj.actors.forEach((actor,index)=>{
+					// let model = gltf.scene; // 获取模型
+					// let cloneModel = model.clone(true);//赋值模型,准备复用
+					// cloneModel.children.map((v,i)=>{
+					// 	if(v.material){
+					// 		v.material = model.children[i].material.clone()
+					// 	}
+					// })
+					// let cube = cloneModel;
+					let cube = {};
+					cube.name = "actor";
+					cube.userType = "mesh";
+					//新的摄像机的位置-新的摄像机角度是倾斜角度,所以z值需要计算,高度设置为模型高度的2倍
+					let _actorLoaction = actor.actorLocation.split(',');//x y z
+					let _actorTransform = actor.actorTransform.split(',');//旋转角度,取第三个值
+					let _hd = THREE.MathUtils.degToRad(parseInt(_actorTransform[2]));//将度转化为弧度。
+					let _hdY = THREE.MathUtils.degToRad(parseInt(_actorTransform[1]));//Y轴方向上将度转化为弧度。
+					// if(parseInt(_actorLoaction[1])==0){//X轴
+					// 	_actorLoaction[1] = spaceObj.centerX;
+					// }
+					// if(parseInt(_actorLoaction[0])==0){//Y轴
+					// 	_actorLoaction[0] = spaceObj.centerY;
+					// }
+					let X_C = parseInt(_actorLoaction[0]);//X轴偏移量
+					let Y_C = -parseInt(_actorLoaction[1]);//Y轴偏移量-取反,UE里面的Y轴方向跟Three.js相反
+					let px = spaceObj.centerX + X_C;
+					let py = -spaceObj.centerY + Y_C;//UE里面的centerY值跟Three.js Y轴相反;获得真实的坐标值
+					let position = {
+						x:(parseInt(px))/100,
+						y:1.5, 
+						z:(parseInt(py))/100,//模型Y轴坐标系正负值跟webglZ轴是相反的
+					}
+					//新的观察点的位置-取模型的中心点坐标,加上高度,由于模型都是贴地的,所以高度设置为1.5
+					let targetNewPosition = {
+						x:position.x + Math.sin(_hd),
+						y:1.5 + Math.tan(_hdY),
+						z:(position.z - Math.cos(_hd)),
+					}
+					cube.position = position;
+					cube.userIndex = index;
+					cube.actorEum = index;
+					cube.targetNewPosition = targetNewPosition;
+					// console.warn("*actors*",cube,defaulIndex)
+					that.actors.push(cube);//添加视角
+					if(index == defaulIndex){//隐藏当前视角
+						that.currentActor = cube;//记录下当前的视角对象 mesh网格模型
+						let param = {
+							type: 'CLK', //埋点类型
+							clkId: 'clk_2cmina_23080411', //点击ID
+							clkName: 'visualangle_clk', //点击前往的页面名称
+							clkParams: {
+								locusName: "预制视角",
+								type:that.actors[index].actorEum
 							}
-						})
-						let cube = cloneModel;
-						cube.name = "actor";
-						cube.userType = "mesh";
-						//新的摄像机的位置-新的摄像机角度是倾斜角度,所以z值需要计算,高度设置为模型高度的2倍
-						let _actorLoaction = actor.actorLocation.split(',');//x y z
-						let _actorTransform = actor.actorTransform.split(',');//旋转角度,取第三个值
-						let _hd = THREE.MathUtils.degToRad(parseInt(_actorTransform[2]));//将度转化为弧度。
-						let _hdY = THREE.MathUtils.degToRad(parseInt(_actorTransform[1]));//Y轴方向上将度转化为弧度。
-						if(parseInt(_actorLoaction[1])==0){//X轴
-							_actorLoaction[1] = spaceObj.centerX;
-						}
-						if(parseInt(_actorLoaction[0])==0){//Y轴
-							_actorLoaction[0] = spaceObj.centerY;
-						}
-						let X_C = _actorLoaction[0] - spaceObj.centerY;//X轴偏移量
-						let Y_C = _actorLoaction[1] - spaceObj.centerX;//Y轴偏移量
-						let px = spaceObj.centerX + X_C;
-						let py = spaceObj.centerY + Y_C;
-						let position = {
-							x:(parseInt(px))/100,
-							y:1.2, 
-							z:-(parseInt(py))/100,//模型Y轴坐标系正负值跟webglZ轴是相反的
-						}
-						//新的观察点的位置-取模型的中心点坐标,加上高度,由于模型都是贴地的,所以高度设置为1.2
-						let targetNewPosition = {
-							x:position.x + Math.sin(_hd),
-							y:1.2 + Math.tan(_hdY),
-							z:(position.z - Math.cos(_hd)),
-						}
-						cube.position.set(position.x,position.y,position.z)
-						cube.scale.set(2, 2, 2);
-						cube.userIndex = index;
-						cube.actorEum = index;
-						cube.targetNewPosition = targetNewPosition;
-						console.warn("*actors*",cube)
-						scene.add(cube);
-						that.actors.push(cube);//添加视角
-						if(index == defaulIndex){//隐藏当前视角
-							cube.visible = false;
-							that.currentActor = cube;//记录下当前的视角对象 mesh网格模型
-							let param = {
-								type: 'CLK', //埋点类型
-								clkId: 'clk_2cmina_23080411', //点击ID
-								clkName: 'visualangle_clk', //点击前往的页面名称
-								clkParams: {
-									locusName: "预制视角",
-									type:that.actors[index].actorEum
-								}
-							};
-							util.trackRequest(param);
-						}
-					})
+						};
+						util.trackRequest(param);
+					}
 				})
 			}
 			//计算当前选中空间的平视时的观察点和摄像机的放置点位
@@ -563,49 +582,53 @@
 				let _actorTransform = defaultActor.actorTransform.split(',');//旋转角度,取第三个值
 				let _hd = THREE.MathUtils.degToRad(parseInt(_actorTransform[2]) + lon);//将度转化为弧度。
 				let _hdY = THREE.MathUtils.degToRad(parseInt(_actorTransform[1]));//Y轴方向上将度转化为弧度。
-				if(parseInt(_actorLoaction[1])==0){//X轴
-					_actorLoaction[1] = spaceObj.centerX;
-				}
-				if(parseInt(_actorLoaction[0])==0){//Y轴
-					_actorLoaction[0] = spaceObj.centerY;
-				}
-				let X_C = _actorLoaction[0] - spaceObj.centerY;//X轴偏移量
-				let Y_C = _actorLoaction[1] - spaceObj.centerX;//Y轴偏移量
+				// if(parseInt(_actorLoaction[1])==0){//X轴
+				// 	_actorLoaction[1] = spaceObj.centerX;
+				// }
+				// if(parseInt(_actorLoaction[0])==0){//Y轴
+				// 	_actorLoaction[0] = spaceObj.centerY;
+				// }
+				let X_C = parseInt(_actorLoaction[0]);//X轴偏移量-UE原因
+				let Y_C = -parseInt(_actorLoaction[1]);//Y轴偏移量-取反,UE里面的Y轴方向跟Three.js相反
 				let px = spaceObj.centerX + X_C;
-				let py = spaceObj.centerY + Y_C;
+				let py = -spaceObj.centerY + Y_C;
 				//新的摄像机的位置-新的摄像机角度是倾斜角度,所以z值需要计算,高度设置为模型高度的2倍
 				let cameraNewPosition = {
 					x:(parseInt(px))/100,
-					y:1.2, 
-					z:-(parseInt(py))/100,//模型Y轴坐标系正负值跟webglZ轴是相反的
+					y:1.5, 
+					z:(parseInt(py))/100,//模型Y轴坐标系正负值跟webglZ轴是相反的
 				}
 				if(cameraNewPosition){
 					let minX = 0,maxX = 0,minY = 0,maxY = 0;//0.1 是模型墙壁厚度
 					minX = (spaceObj.centerX - (spaceObj.spaceWidth/2))/100 + 0.1;
 					maxX = (spaceObj.centerX + (spaceObj.spaceWidth/2))/100 - 0.1;
-					maxY = -((spaceObj.centerY - (spaceObj.spaceHeight/2))/100 + 0.1);
-					minY = -((spaceObj.centerY + (spaceObj.spaceHeight/2))/100 - 0.1);
+					maxY = ((-spaceObj.centerY + (spaceObj.spaceHeight/2))/100 - 0.1);
+					minY = ((-spaceObj.centerY - (spaceObj.spaceHeight/2))/100 + 0.1);
 					//新的坐标轴不在房间范围内,则不能移动
-					// console.warn("**roamPositionHandle-观察点不在范围中****",JSON.stringify(cameraNewPosition),minX,maxX,minY,maxY)
 					if(cameraNewPosition.x<minX || cameraNewPosition.x>maxX
 					||cameraNewPosition.z<minY || cameraNewPosition.z>maxY){//不在房间范围
 						let _x = ((spaceObj.spaceWidth/2) - 15)*defaultActor.presentX + spaceObj.centerX;
-						let _z = ((spaceObj.spaceHeight/2) - 15)*defaultActor.presentY + spaceObj.centerY;
+						let _z = ((spaceObj.spaceHeight/2) - 15)*defaultActor.presentY + (-spaceObj.centerY);
 						cameraNewPosition.x = _x/100;
-						cameraNewPosition.z = - _z/100;
+						cameraNewPosition.z = _z/100;
 						console.warn("**roamPositionHandle-观察点不在空间范围-强制修正观察点位置****",JSON.stringify(cameraNewPosition))
 					}
 				}
-				//新的观察点的位置-取模型的中心点坐标,加上高度,由于模型都是贴地的,所以高度设置为1.2
+				//新的观察点的位置-取模型的中心点坐标,加上高度,由于模型都是贴地的,所以高度设置为1.5
 				let targetNewPosition = {
 					x:cameraNewPosition.x + Math.sin(_hd),
-					y:1.2 + Math.tan(_hdY),
+					y:1.5 + Math.tan(_hdY),
 					z:(cameraNewPosition.z - Math.cos(_hd)),
 				}
-				return {cameraNewPosition,targetNewPosition}
+				let lookPosition = {
+					x:cameraNewPosition.x + (Math.sin(_hd)*0.01),
+					y:1.5 + Math.tan(_hdY),
+					z:(cameraNewPosition.z - (Math.cos(_hd))*0.01),
+				}
+				return {cameraNewPosition,targetNewPosition,lookPosition}
 			}
 			//直接定位到摄像头位置
-			function positionCamer(mesh=null){
+			function positionCamer(mesh=null,needAni=false){
 				if(mesh){//如果传入了模型,则取模型
 					chooseMesh = mesh;
 				}
@@ -622,7 +645,6 @@
 						presentY:chooseMesh.presentY,
 					}]
 				}
-				// try{
 				boundary = new THREE.Box3(
 					new THREE.Vector3(chooseMesh.centerX/100 - chooseMesh.spaceWidth/100/2 + 0.1, 0, -chooseMesh.centerY/100 - chooseMesh.spaceHeight/100/2 + 0.1), // 边界框的最小点
 					new THREE.Vector3(chooseMesh.centerX/100 + chooseMesh.spaceWidth/100/2 - 0.1, 2.7, -chooseMesh.centerY/100 + chooseMesh.spaceHeight/100/2 - 0.1) // 边界框的最大点
@@ -631,13 +653,20 @@
 				let data = roamPositionHandle();
 				let cameraNewPosition = data.cameraNewPosition;
 				let targetNewPosition = data.targetNewPosition;
+				targetNewPosition.z = targetNewPosition.z;//增加偏差,防止极点翻转问题?不知道为啥会有用
+				let lookPosition = data.lookPosition;
 				creatMoveTip(cameraNewPosition);//创建移动的地标
-				camera.position.set(cameraNewPosition.x, cameraNewPosition.y, cameraNewPosition.z);
-				camera.lookAt(targetNewPosition.x,targetNewPosition.y,targetNewPosition.z);
-				controls.target.set(targetNewPosition.x,targetNewPosition.y,targetNewPosition.z);
-				// }catch(e){
-				// 	alert("***positionCamer-error***"+e)
-				// }
+				if(needAni){
+					let oldUp = {x:0,y:1,z:0};	//俯视
+					let newUp = {x:0,y:1,z:0};	//正视
+					tweenCamera(camera.position,controls.target,cameraNewPosition,targetNewPosition,oldUp,newUp,2000);
+				}else{
+					camera.position.set(cameraNewPosition.x, cameraNewPosition.y, cameraNewPosition.z);
+					controls.target.set(lookPosition.x,lookPosition.y,lookPosition.z);
+					// controls.target.set(cameraNewPosition.x,cameraNewPosition.y,cameraNewPosition.z);
+					// controls.target.copy(camera.position);
+					camera.lookAt(targetNewPosition.x,targetNewPosition.y,targetNewPosition.z);
+				}
 			}
 			// oldP  相机原来的位置
             // oldT  target原来的位置
@@ -680,22 +709,21 @@
 					camera.position.x = object.x1;
 					camera.position.y = object.y1;
 					camera.position.z = object.z1;
-					let newTarget = new THREE.Vector3(object.x3,object.y3,object.z3);
-					camera.up.copy(newTarget);
+					// let newTarget = new THREE.Vector3(object.x3,object.y3,object.z3);
+					// camera.up.copy(newTarget);
 					camera.lookAt(object.x2,object.y2,object.z2);
 					// controls.target.x = object.x2;
 					// controls.target.y = object.y2;
 					// controls.target.z = object.z2;
 					// controls.update();
-					// console.warn("****onUpdate**",object.x1,object.y1,object.z1,object.x2,object.y2,object.z2)
 				}).onComplete(()=>{
 					controls.target.x = newT.x;
 					controls.target.y = newT.y;
 					controls.target.z = newT.z;
 					//修正最后的视角
-					let up = new THREE.Vector3(newUp.x,newUp.y,newUp.z);
-					camera.up.copy(up);
-					camera.lookAt(controls.target.x,controls.target.y,controls.target.z);
+					// let up = new THREE.Vector3(newUp.x,newUp.y,newUp.z);
+					// camera.up.copy(up);
+					camera.lookAt(newT.x,newT.y,newT.z);
 					tweenCameraAnma = false;
 					that.repeatFlag = false;//放开限制,可以再次点击
 				})
@@ -718,77 +746,45 @@
 					return false;
 				}
                 TWEEN && TWEEN.update();
-				stats.update();
-				//不处在动画过程中,则可以处理移动等动作
-				if(tweenCameraAnma==false){
-					
-				}
+				// stats.update();
 				renderer.render(scene, camera);//单次渲染
 				requestId = requestAnimationFrame(render, canvas3d);
 				if (that.screenshotResolve) {
-					// if(that.isIos){//IOS手机
-						stopRender();
-						that.screenshotResolve()
-						that.screenshotResolve = null;//释放Promise
-					// }else{//安卓手机
-					// 	let gl = renderer.getContext();
-					// 	let frameBuffer = new THREE.Vector2();
-					// 	renderer.getDrawingBufferSize(frameBuffer);
-					// 	let pixelData = new Uint8Array(frameBuffer.x * frameBuffer.y * 4);
-					// 	//参考 Threejs WebGLRenderer.readRenderTargetPixels
-					// 	if (gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE) {
-					// 		gl.readPixels(0, 0, frameBuffer.x, frameBuffer.y, gl.RGBA, gl.UNSIGNED_BYTE, pixelData);
-					// 		// 确保有像素,微信小程序安卓在进入子页面返回本页面后,再一次readPixels稳定无像素
-					// 		if (pixelData.some(i => i !== 0)) {
-					// 			stopRender();
-					// 			console.warn("***screenshotResolve-pixelData***");
-					// 			that.screenshotResolve([pixelData, frameBuffer.x, frameBuffer.y])
-					// 			that.screenshotResolve = null;//释放Promise
-					// 			frameBuffer = null;//清空内存中的数据
-					// 			pixelData = null;//清空内存中的数据
-					// 		}
-					// 	}
-					// }
+					stopRender();
+					that.screenshotResolve()
+					that.screenshotResolve = null;//释放Promise
 				}
             }
 
 		},
-		computed: {
-			curHouseObj() {
-				return this.$store.state.curHouseObj;
-			},
-			wallList() {
-				return this.$store.state.wallList;
-			},
-		},
-		watch: {
-			curHouseObj: {
-				handler(val) {
-					if (val) {
-						// setTimeout(()=> {
-						if(this.renderer){
-							this.setHouseDetail(val);
-						}
-						// }, 1000);
-					}
-				},
-				immediate: true,
-			}
-		},
+		// computed: {
+		// 	curHouseObj() {
+		// 		return this.$store.state.curHouseObj;
+		// 	},
+		// 	wallList() {
+		// 		return this.$store.state.wallList;
+		// 	},
+		// },
 		methods: {
-			hideOrShowActor(){
-				
-			},
-			switchActor(){
-				
+			navbarBackClk() {
+				if(!this.$refs.viewMask){
+					this.$router.go(-1);
+					return false
+				}
+				if (this.$refs.viewMask.showAIImage) {
+					this.$refs.viewMask.showOrHideWebGl();//隐藏显示的AI生图
+					// if(this.currentActor.userIndex!=this.defaulIndex){//当前不是默认视角了
+						this.switchActor(this.defaulIndex);//切换到默认视角
+					// }
+				} else {
+					this.$router.go(-1);
+				}
 			},
+			switchActor(){},
 			positionCamer(){},
 			clearHandle(){
 				this.clearEvent();
 			},
-			showOrHideWebGl(){
-				this.$refs.viewMask.showOrHideWebGl();//显示或者隐藏AI
-			},
 			save(){
 				this.$refs.viewMask.save();//下载
 			},
@@ -798,9 +794,9 @@
 			 */
 			setHouseDetail(data){
 				if(data){
-					this.id = this.curHouseObj.id;
+					this.id = data.id;
 					this.spaceId = this.$route.query.spaceId?this.$route.query.spaceId:'';
-					console.warn("***curHouseObj***",this.curHouseObj)
+					console.warn("***curHouseObj***",data)
 					// 加载户型
 					this.loadSpace();
 				}else{
@@ -823,22 +819,28 @@
                     for (let index = 0; index < spaceList.length; index++) {
                         var element = spaceList[index];
                         // const centerX = JSON.parse(JSON.stringify(element.centerX))
+						if(!element.actors || element.actors.length==0){
+							element.actors = [{
+								actorLocation:element.actorLocation,
+								actorTransform:element.actorTransform,
+								isSelected:true,
+							}]
+						}
 						element.actors.forEach(actor=>{
 							let _actorLoaction = actor.actorLocation.split(',');//x y z
-							let X_C = (parseInt(_actorLoaction[0]) || element.centerY) - element.centerY;//X轴偏移量-UE原因
-							let Y_C = (parseInt(_actorLoaction[1]) || element.centerX) - element.centerX;//Y轴偏移量-向量
+							let X_C = parseInt(_actorLoaction[0]);//X轴偏移量-UE原因
+							let Y_C = -parseInt(_actorLoaction[1]);//Y轴偏移量-取反,UE里面的Y轴方向跟Three.js相反
 							let _x = element.centerX + X_C;
-							let _z = element.centerY + Y_C;
+							let _z = -element.centerY + Y_C;//centerY 要取反,因为UE里面是反向的
 							
 							// let _x = parseInt(_actorLoaction[1]) || element.centerX;//观察点 X轴坐标 
 							// let _z = parseInt(_actorLoaction[0]) || element.centerY;//观察点 Z轴坐标
 							let _presentX = (_x - element.centerX)/((element.spaceWidth/2) - 10);//10是墙壁厚度-单位cm
-							let _presentY = (_z - element.centerY)/((element.spaceHeight/2) - 10);
+							let _presentY = (_z + element.centerY)/((element.spaceHeight/2) - 10);
 							//注意如果一开始就设置大超过空间大小,则处理成贴近空间边界
 							actor.presentX = Math.abs(_presentX)>1 ? (_presentX>1?1:-1) : _presentX;//观察点跟空间中心原点的距离比例
 							actor.presentY = Math.abs(_presentY)>1 ? (_presentY>1?1:-1) : _presentY;
 						})
-						
 						element.wallMoveValue = "[0,0,0,0]"
                         this.spaceList.push(element);
                         this.wallIds.push(element.wallId);
@@ -853,13 +855,28 @@
                 }
 				let curSpaceArea = parseFloat((this.curSpaceObj.spaceWidth * this.curSpaceObj.spaceHeight) / 10000).toFixed(1);
 				this.navbar.title = this.curSpaceObj.spaceName + "  " + curSpaceArea + "㎡"
-                console.log("该户型空间数据:", this.spaceList);curSpaceArea
+                console.log("该户型空间数据:", this.spaceList);
                 console.log("当前选中的空间:", this.curSpaceObj);
 				this.positionCamer(this.curSpaceObj);
 				this.loaderSpaceArr(this.spaceList);//绘制地板
                 // 获取墙体数据并且绘制墙体
                 this.getHouseTypeSpaceWalls();
             },
+			changeSpace(spaceId){
+				console.warn("***changeSpace***",spaceId,this.spaceId)
+				if(spaceId == this.spaceId){
+					return false;
+				}
+				this.spaceId = spaceId;
+				this.curSpaceObj = this.spaceList.find(it=>it.spaceId == spaceId);
+				if(this.isIOS){
+					this.furnSingleSpaceHandle(this.curSpaceObj);
+				}
+				this.positionCamer(this.curSpaceObj,true);
+				let curSpaceArea = parseFloat((this.curSpaceObj.spaceWidth * this.curSpaceObj.spaceHeight) / 10000).toFixed(1);
+				this.navbar.title = this.curSpaceObj.spaceName + "  " + curSpaceArea + "㎡";
+				document.title = this.navbar.title;
+			},
 			// 获取墙体数据
             async getHouseTypeSpaceWalls(){
 				let wallList = [];
@@ -868,7 +885,7 @@
 				}else{
 					let data = {id:this.wallIds}
 					const res = await requestConfig('getHouseTypeSpaceWalls', data, true);
-					console.log("墙体数据:", res.list)
+					// console.log("墙体数据:", res.list)
 					if(res.success){
 					    wallList = this.wallList = res.list;
 					}

+ 3 - 4
src/pages/webgl_rxdz_roam/webgl_rxdz_roam.html

@@ -15,14 +15,13 @@
 		<canvas id="FPS" type="2d" style="width:80px;height:48px"></canvas>
 		<canvas id="MS" type="2d" style="width:80px;height:48px"></canvas>
 	</div> -->
-	<div id="mapDiv" ref="webgl"></div>
+	<!-- <div id="mapDiv" ref="webgl"></div>
 	<canvas id="canvas_webgl" type="webgl" ref="glcanvas"
 		 width="100vw" 
 		:style="{'height':canvasHeight+'px'}">
-	</canvas>
+	</canvas> -->
 	<!-- AI结果覆盖层 -->
-	<viewMask ref="viewMask" @switchActor="switchActor" style="z-index: 13;"
-	  :spaceObj="curSpaceObj" :spaceList="spaceList" :layoutList="arrFrunList" ></viewMask>
+	<viewMask ref="viewMask" style="z-index: 13;"></viewMask>
 	<!-- 生成截屏的画布对象 -->
 	<canvas id="canvas" type="2d" :style="{'height':canvasHeight+'px','top':'100vh'}"></canvas>
 </div>

+ 4 - 853
src/pages/webgl_rxdz_roam/webgl_rxdz_roam.vue

@@ -2,32 +2,18 @@
 
 </template>
 <script>
-	import * as THREE from 'three';
-	import Stats from 'three/addons/libs/stats.module.js';
-	import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
-	import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
 	
-	import TWEEN from 'three/addons/libs/tween.module.js';
 	import {getStorage} from '@/utils/localStorage';
 	var requestId = "";
     const util = require('@/utils/util.js').default;
-	// import util from '@/utils/util.js';
-    // const config = require('@/services/urlConfig.js');
-    // import requestConfig from '@/static/lib/requestConfig.js';
-	// import viewShell from'@/components/newBottomCom/viewShell/viewShell.vue';
 	import viewMask from'@/components/newBottomCom/viewMask/viewMask.vue';
 
-	// import { RGBELoader } from '@/webgl/jsm/loaders/RGBELoader.js';
-	import screenshot from '@/mixins/screenshot.js';
-	import floorMethod from '@/mixins/floorMethod.js';
-	import loadModel from '@/mixins/loadModel.js';
-	import wallMethod from '@/mixins/wallMethod.js';
 	import commonPageMethod from '@/mixins/commonPageMethod.js';
 	// import commonPageMethod from '@/common/commonPageMethod.js';
     // const app = getApp(); //获取应用实例
     export default {
 		components:{viewMask},
-		mixins:[screenshot,loadModel,floorMethod,wallMethod,commonPageMethod],
+		mixins:[commonPageMethod],
         /**
          * 页面的初始数据
          */
@@ -54,99 +40,16 @@
 				    pageName: this.pvCurPageName,
 				},
                 id:'',// 户型编号
-                spaceList:[], // 空间列表
-                gltfSpaces:[], // 场景中地板模型数组
-				gltfSpaceRoofs:[],
-                curSpaceObj:null, // 当前选中的空间
-                // curSpaceIndex:-1, // 当前选中的空间索引
-				spaceId:null,
-                wallIds:[], // 空间墙体id
-				// wallList:[], // 墙体数据
-                gltfWalls:[], // 场景中墙体模型数组
-                loader:null,
-                scene:null,
-                // sky:null,
-                camera:null,
-				controlStarPosition : { x:0, y:0, z:0},	//控制器初始位置
-				cameraStarPosition : { x:0, y:20, z:0}	,//摄像头初始位置
-				cameraLastPosition: null,		//摄像头上一次移动到的位置
-				controlLastPosition: null,		//观察点上一次移动到的位置
-				canvasHeight:408,	//canvas视图的高度-计算得出
-				chooseMesh:null,//标记鼠标拾取到的mesh
-				shottingImg: [],
-				progress:1,	//进度条
-				myLoadingStatus:false,
-				// textGeoList:[],
-				repeatFlag:false,	//重复点击
-				// skyPlan: null, // 天空盒子
-				instancedMeshList: [],
-				screenshotResolve:null,
-				actors:[],
-				showDownView:true,//默认显示下载按钮
-				currentActor:null,
-				circleGroup:null,//圆形地标
-				isIOS:false,
-				defaulIndex:null,	//默认视角的序号
-				// aiImagesList:[
-				// 	// "https://dm.static.elab-plus.com/miniProgram/plus_IM01.png",
-				// 	// "https://dm.static.elab-plus.com/miniProgram/plus_IM02.png",
-				// 	// "https://dm.static.elab-plus.com/miniProgram/plus_IM03.png",
-				// 	// "https://dm.static.elab-plus.com/miniProgram/plus_IM04.png",
-				// ]
+				canvasHeight:'',
             }
         },
-		beforeDestroy() {
-			cancelAnimationFrame(requestId, this.canvas)
-			this.worker && this.worker.terminate()
-			if (this.renderer instanceof THREE.WebGLRenderer) {
-				// 遍历场景中的所有子对象,找到类型为Mesh的对象并移除
-				let deleList = this.scene.children.filter(object=>{
-					if (object instanceof THREE.Mesh) {
-						return object
-					}
-				})
-				if(deleList && deleList.length>0){
-					this.scene.remove(...deleList);
-				}
-				this.scene.traverse(function(object) {
-					if (object instanceof THREE.Mesh) {
-						if(object.geometry && typeof(object.geometry.dispose)=='function'){
-							object.geometry.dispose();
-						}
-						if(object.material && typeof(object.material.dispose)=='function'){
-							object.material.dispose();
-						}
-						if(object.texture && typeof(object.texture.dispose)=='function'){
-							object.texture.dispose();
-						}
-					}
-				});
-				this.renderer.clear();
-				this.renderer.dispose();
-				this.renderer.forceContextLoss();
-				this.renderer.context = null;
-				this.renderer.domElement = null;
-				this.renderer = null;;
-				this.clearHandle()
-			}
-			TWEEN && TWEEN.removeAll();//清除所有的tween;
-			console.warn("***beforeDestroy-webgl_rxdz_roam***");
-		},
+		
         mounted(options) {
 			var that = this;
 			// alert("JavaScript 堆大小限制: "+performance.memory.jsHeapSizeLimit
 			// +"\n已使用的 JavaScript 堆大小: "+performance.memory.usedJSHeapSize
 			// +"\nJavaScript 堆的总大小: "+performance.memory.totalJSHeapSize);
 			console.warn("***webgl_rxdz_roam-options***",this.$route.query)
-			this.isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
-			if(this.isIOS){
-				this.curHouseObj = JSON.parse(getStorage('curHouseObj'));
-				this.wallList = JSON.parse(getStorage('wallList'));
-			}else{
-				this.curHouseObj = 	this.$store.state.curHouseObj;
-				this.wallList = 	this.$store.state.wallList;
-			}
-			// alert("***mounted-webgl_rxdz_roam***"+this.isIOS + this.curHouseObj)
 			let screenWidth = window.screen.width;
 			let screenHeight = window.screen.height;
 			if(window.innerWidth && window.screen.width){
@@ -157,605 +60,6 @@
 			}
 			let unit = screenWidth / 750;//单位rpm 对应 px 的值
 			this.canvasHeight = screenHeight - (600 * unit) + (40 * unit);
-			this.houseId = this.$route.query.houseId?this.$route.query.houseId:'';
-			this.spaceId = this.$route.query.spaceId?this.$route.query.spaceId:'';
-			let container = this.$refs.webgl;
-            let canvas3d = this.canvas = this.$refs.glcanvas;
-			//uniapp 兼容写法,因为uni的页面对象的Vue 实例是$vm
-			
-			let camera = null, renderer = null;
-			let needRender = false;	//是否需要渲染 false表示不需要渲染;true 表示需要渲染
-            let loader = this.loader = new GLTFLoader();
-            let scene = this.scene = new THREE.Scene();
-            let raycaster = null;
-            let mouse = new THREE.Vector2();
-            let chooseMesh = this.chooseMesh;//标记鼠标拾取到的mesh
-			let isUserContorl = true;//是否进入漫游状态-默认是
-			//漫游时变量
-			let onPointerDownMouseX = 0, onPointerDownMouseY = 0,
-			lon = 0;
-			let fingerCount = 0;	//触摸时的手指数目
-			let startTime = 0;	//非漫游时的移动变量
-			let tweenCameraAnma = false;	//表示当前是否处在动画过程中
-			let controls = null,boundary=null;
-			let stats;
-			init();
-			// this.$refs.myLoading.showLoading("加载中...1%")
-			this.$store.state.loadingMsg="加载中...1%";
-			// this.myLoadingStatus = true;
-			this.progress = 1;
-			this.clearEvent = clearEvent;
-			this.attendEvent = attendEvent;
-			// this.meshRoam = meshRoam;
-			this.tweenCameraAnmaChange = tweenCameraAnmaChange;
-			this.switchActor = switchActor;
-			this.starRender = starRender;//对外暴露启动渲染的方法
-			this.stopRender = stopRender;//对外暴露停止渲染的方法
-			this.positionCamer = positionCamer;
-			if(this.curHouseObj && this.curHouseObj.id){
-				this.setHouseDetail(this.curHouseObj);
-			}
-			function init() {
-
-                scene.background = new THREE.Color("#FFFFFF");
-				// scene.environment = new THREE.Color("#F2F2F2");
-				// 创建一个HDR贴图加载器
-				// const rgbeloader = new RGBELoader();
-				// // 加载HDR贴图
-				// rgbeloader.load('https://dm.static.elab-plus.com/miniProgram/environment.hdr', (texture) => {
-				// 	// 将HDR贴图设置为场景的环境贴图
-				// 	texture.mapping = THREE.EquirectangularReflectionMapping;
-				// 	scene.environment = texture;
-				// })
-
-				// 创建相机位置
-				camera = new THREE.PerspectiveCamera(90, screenWidth / that.canvasHeight, 0.1, 10000 );
-				// camera.up.set(0, 1, 0);//俯视状态,将相机的up向量设置为z轴负方向 {x:0,y:1,z:0}
-				// camera.position.set(that.cameraStarPosition.x, that.cameraStarPosition.y, that.cameraStarPosition.z);
-				scene.add(camera);
-                that.camera = camera;
-
-                // 环境光会均匀的照亮场景中的所有物体
-				const ambientLight = new THREE.AmbientLight(0xFFEFE0, 3.5);
-				scene.add(ambientLight);
-				//平行光
-				const light = new THREE.DirectionalLight(0xFFF8E5, 2.5);
-				light.position.set(5, 7, 3); //default; light shining from top
-				if(!that.isIOS){
-					light.castShadow = true; // default false
-					// 默认情况下光投影相机区域是一个长宽高为10x10x500的长方体区域,光源投射方向为通过坐标原点
-					light.shadow.camera.left = -100; // 这个区域内产生阴影
-					light.shadow.camera.right  = 100; // 这个区域内产生阴影
-					light.shadow.camera.top  = 100; // 这个区域内产生阴影
-					light.shadow.camera.bottom  = -100; // 这个区域内产生阴影
-					
-					light.shadow.mapSize.width = 1024; 	// 影响阴影的清晰度
-					light.shadow.mapSize.height = 1024; // 影响阴影的清晰度
-				}
-				
-				scene.add(light);
-				
-				//antialias 这个值得设置为false,不然IOS上截图会失效
-                renderer = that.renderer = new THREE.WebGLRenderer( { 
-					canvas:canvas3d, 
-					alpha: true,
-					antialias:true,
-					preserveDrawingBuffer: true,
-				});
-				if(!that.isIOS){
-					renderer.shadowMap.enabled = true;//产生阴影
-					renderer.shadowMap.type = THREE.PCFSoftShadowMap; // 阴影属性
-				}
-				renderer.outputEncoding = THREE.sRGBEncoding;
-				renderer.outputColorSpace = THREE.SRGBColorSpace;
-				// renderer.toneMappingExposure = 0.1;//色调映射的曝光级别。默认是1
-				renderer.toneMapping = THREE.NoToneMapping;//色调映射
-				renderer.physicallyCorrectLights = true;//关键参数,模拟物理光照影响,必须设置为true
-
-                renderer.setPixelRatio(window.devicePixelRatio);
-                renderer.setSize(screenWidth, that.canvasHeight);
-                container.appendChild( renderer.domElement );
-				
-				controls = new OrbitControls( camera, renderer.domElement );
-				controls.enableDamping = true;//启动缓动
-				controls.minDistance = 0.0001;
-				controls.maxDistance = 10;
-				controls.minPolarAngle = 0;// 默认0
-				controls.maxPolarAngle = Math.PI / 2; // 默认Math.PI,即可以向下旋转到的视角。
-				// controls.target.set(  that.controlStarPosition.x, that.controlStarPosition.y, that.controlStarPosition.z);
-				controls.enableZoom = true;//启用摄像机的缩放
-				controls.enablePan = true;//禁用摄像机平移
-				controls.enableRotate = true;//启用摄像机水平或垂直旋转
-				// controls.zoomToCursor = true;
-				
-				// controls.target.copy(camera.position);
-				// controls.update();
-				// 监听相机移动事件-限制只能在当前空间范围内移动
-				controls.addEventListener('change', () => {
-					// 检查相机位置是否超出边界框
-					if (boundary && !boundary.containsPoint(camera.position)) {
-						let clampedPosition = new THREE.Vector3( );
-						boundary.clampPoint(camera.position,clampedPosition);
-						if(clampedPosition){
-							camera.position.copy(clampedPosition);
-							// controls.target.copy(clampedPosition);
-						}
-					}
-				});
-				// controls.target = new THREE.Vector3( );;
-				// camera.lookAt(that.controlStarPosition.x,that.controlStarPosition.y,that.controlStarPosition.z);
-                raycaster = new THREE.Raycaster();
-				// stats = new Stats();
-				// container.appendChild(stats.dom);
-				// stats.domElement.style.top = '100px';
-				attendEvent();//注册监听事件
-				starRender();	//启动渲染
-            }
-			function tweenCameraAnmaChange (value) {
-				tweenCameraAnma = value
-			}
-			function attendEvent () {
-				renderer && renderer.domElement && renderer.domElement.addEventListener('touchstart', onPointerStart, false);
-				renderer && renderer.domElement && renderer.domElement.addEventListener('touchmove', onPointerMove, false);
-				renderer && renderer.domElement && renderer.domElement.addEventListener('touchend', onPointerUp, false);
-			}
-			//取消事件监听-避免二次进入时触发多次事件
-			function clearEvent(){
-				console.warn("**clearEvent****")
-				renderer && renderer.domElement && renderer.domElement.removeEventListener('touchstart', onPointerStart);
-				renderer && renderer.domElement && renderer.domElement.removeEventListener('touchmove', onPointerMove );
-				renderer && renderer.domElement && renderer.domElement.removeEventListener('touchend', onPointerUp );
-			}
-			// 手指移动开始
-			function onPointerStart(event){
-				startTime = (new Date()).getTime();
-				fingerCount = event.touches.length;//手指个数
-				console.log('开始触摸事件:',lon,fingerCount,camera.position.y)
-				if (fingerCount === 1) {
-					// 只有一个手指时记录当前点的坐标作为平移起始点
-					onPointerDownMouseX = event.changedTouches[0].clientX;
-					onPointerDownMouseY = event.changedTouches[0].clientY;
-				}
-			}
-			//持续触摸中
-			function onPointerMove( event ) {
-				fingerCount = event.touches.length;//手指个数
-			}
-			//触摸结束
-			function onPointerUp(event) {
-				fingerCount = event.touches.length;//手指个数
-				console.warn("***触摸结束***",fingerCount,startTime)
-				if(fingerCount==0){
-					let now = new Date().getTime()
-					if (Math.abs(event.changedTouches[0].clientX - onPointerDownMouseX) < 10 
-					&& Math.abs(event.changedTouches[0].clientY - onPointerDownMouseY) < 10 
-					&& (now - startTime) < 300 ){
-						checkIntersection(event);
-					}
-				}
-			}
-			//射线检测handle
-			function checkIntersection(event) {
-			    let x = (event.changedTouches[0].clientX / screenWidth) * 2 - 1;
-			    let y = -(event.changedTouches[0].clientY / that.canvasHeight) * 2 + 1;
-			    mouse.x = x;
-			    mouse.y = y;
-			    //更新射线
-			    raycaster.setFromCamera(mouse, camera);
-			    let intersects = raycaster.intersectObjects(scene.children,true);
-				console.warn("***checkIntersection***",intersects.length)
-			    if (intersects.length > 0) {
-					//找到最近的那个网格模型物体
-					let mesh = intersects.find((it) => {
-						if(it.object && it.object.isMesh == true  
-							&& it.object.parent && it.object.parent.name == 'actor'
-							&& it.object.parent.visible == true){
-							return true;
-						}
-					});
-					
-					//拾取到了视角,就不继续拾取了
-					if(mesh){
-						moveActor(mesh.object.parent);
-						return false;
-					}
-					mesh = intersects.find((it) => {
-						if(it.object && it.object.isInstancedMesh
-							&& (it.object.name == '地板' || it.object.name == '花园') && it.object.visible == true){
-							return true;
-						}
-					});
-					//拾取到了地板
-					if(mesh){
-						let floor = mesh.object;
-						let index = mesh.instanceId;//射线相交是的实例序号
-						let spaceId = that.gltfSpaces[index].spaceId;//获取选中实例的空间id
-						if(floor.name == "花园"){//花园
-							return false;
-							let selectMesh = that.gltfSpaces.find(it=>{return it.spaceType==14 && it.instancedMeshIndexList[0].instancedAtIndex==index})
-							spaceId = selectMesh.spaceId;
-						}else{//室内
-							// floor.name = "地板";
-							let selectMesh = that.gltfSpaces.find(it=>{return it.spaceType!=14 && it.instancedMeshIndexList[0].instancedAtIndex==index})
-							spaceId = selectMesh.spaceId;
-						}
-						// let spaceId = that.gltfSpaces[index].spaceId;//获取选中实例的空间id
-						console.warn("***checkIntersection-地板***",floor,index,spaceId,that.spaceId)
-						//当前拾取到的是本空间的底部-意味着用户点击了地板
-						if(floor && spaceId == that.spaceId){
-							moveCarmer(mesh.point);
-							return false;
-						}
-					}
-			    }
-			}
-			//自动切换视角
-			function switchActor (toIndex=null) {
-				if(!that.currentActor){
-					this.$message.warning("没有当前视角!");
-					return false;
-				}
-				if(!that.actors || that.actors.length==0){
-					this.$message.warning("没有视角!");
-					return false;
-				}
-				if(toIndex!=null){//存在要去往的视角
-					moveActor(that.actors[toIndex]);
-				}else{
-					let index = that.currentActor.userIndex;//当前视角的序号
-					let nextIndex = (index + 1) % that.actors.length;
-					//移动到对应的视角去
-					moveActor(that.actors[nextIndex]);
-					that.defaulIndex = nextIndex;//更新下默认视角
-				}
-			}
-			//移动到选中的位置-地板
-			function moveCarmer (point) {
-				//还在动画中,不能点击切换
-				if(tweenCameraAnma == true){
-					return false;
-				}
-				let _x =  point.x - camera.position.x;//x轴移动的距离
-				let _z =  point.z - camera.position.z;//z轴移动的距离
-				let cameraNewPosition = {x:camera.position.x + _x,y:1.5,z:camera.position.z + _z};
-				let targetNewPosition = {x:controls.target.x + _x,y:1.5,z:controls.target.z + _z};
-				let oldUp = {x:0,y:1,z:0};	
-				let newUp = {x:0,y:1,z:0};
-				moveTip(cameraNewPosition)
-				// console.warn("**moveCarmer***",lon,JSON.stringify(cameraNewPosition),JSON.stringify(targetNewPosition))
-				tweenCamera(camera.position,controls.target,cameraNewPosition,targetNewPosition,oldUp,newUp,2000);
-				setTimeout(()=> {
-					that.circleGroup.visible = false;
-				}, 2000);
-			}
-			//创建地标
-			function creatMoveTip(position){
-				if(!that.circleGroup){
-					that.circleGroup = new THREE.Group();
-					let geometry = new THREE.CircleGeometry( 0.2, 32 );
-					let material = new THREE.MeshBasicMaterial( { transparent: true } );
-					let circle = new THREE.Mesh( geometry, material );
-					circle.position.set(position.x,0.01,position.z);
-					circle.rotation.x = -Math.PI / 2;
-					// let geometry1 = new THREE.CircleGeometry( 0.4, 32 );
-					// let circle2 = new THREE.Mesh( geometry1, material );
-					// circle2.position.set(position.x,0.01,position.z);
-					// 使用贴图
-					const textureLoader = new THREE.TextureLoader();
-					textureLoader.load('https://dm.static.elab-plus.com/miniProgram/circlemap1.png', function(texture) {
-						material.map = texture; // 将贴图应用于材质的map属性
-						material.needsUpdate = true; // 更新材质
-					});
-					that.circleGroup.add(circle);
-					scene.add(that.circleGroup);
-					that.circleGroup.visible = false;
-				}
-			}
-			//移动地标
-			function moveTip(position){
-				if(!that.circleGroup){
-					that.circleGroup = new THREE.Group();
-					let geometry = new THREE.CircleGeometry( 0.2, 32 );
-					let material = new THREE.MeshBasicMaterial( { color: 0xffffff } );
-					let circle = new THREE.Mesh( geometry, material );
-					circle.position.set(position.x,0.01,position.z);
-					circle.rotation.x = -Math.PI / 2;
-					// let geometry1 = new THREE.CircleGeometry( 0.4, 32 );
-					// let circle2 = new THREE.Mesh( geometry1, material );
-					// circle2.position.set(position.x,0.01,position.z);
-					that.circleGroup.add(circle);
-					scene.add(that.circleGroup);
-				}else{
-					that.circleGroup.visible = true;
-					that.circleGroup.children[0].position.set(position.x,0.01,position.z);
-				}
-			}
-			//移动视角点位
-			function moveActor (obj) {
-				clearEvent();//注销事件监听
-				// console.warn("***moveActor***",obj)
-				that.currentActor = obj;//记录下当前的视角对象 mesh网格模型
-				let cameraNewPosition = obj.position;
-				let targetNewPosition = obj.targetNewPosition;
-				let oldUp = {x:0,y:1,z:0};	//俯视
-				let newUp = {x:0,y:1,z:0};	//正视
-				// moveTip(cameraNewPosition);
-				// console.warn("**moveActor***",JSON.stringify(cameraNewPosition),JSON.stringify(targetNewPosition))
-				tweenCamera(camera.position,controls.target,cameraNewPosition,targetNewPosition,oldUp,newUp,2000);
-				lon = 0;
-				setTimeout(()=> {
-					attendEvent()
-					// that.circleGroup.visible = false;
-				}, 2000);
-			}
-			//初始化点位视角
-			function initActor(){
-				if(!chooseMesh){
-					console.error("[drawActor],没有选中的空间数据")
-					return false;
-				}
-				let spaceObj = chooseMesh;//获取选中的空间模型的相关数据
-				if(!spaceObj.actors){
-					return false;
-				}
-				let defaulIndex = spaceObj.actors.findIndex(it=>it.isSelected==true);
-				if(defaulIndex == -1){
-					defaulIndex = 0;
-				}
-				that.defaulIndex = defaulIndex;//记录下默认视角
-				that.actors = [];
-				spaceObj.actors.forEach((actor,index)=>{
-					// let model = gltf.scene; // 获取模型
-					// let cloneModel = model.clone(true);//赋值模型,准备复用
-					// cloneModel.children.map((v,i)=>{
-					// 	if(v.material){
-					// 		v.material = model.children[i].material.clone()
-					// 	}
-					// })
-					// let cube = cloneModel;
-					let cube = {};
-					cube.name = "actor";
-					cube.userType = "mesh";
-					//新的摄像机的位置-新的摄像机角度是倾斜角度,所以z值需要计算,高度设置为模型高度的2倍
-					let _actorLoaction = actor.actorLocation.split(',');//x y z
-					let _actorTransform = actor.actorTransform.split(',');//旋转角度,取第三个值
-					let _hd = THREE.MathUtils.degToRad(parseInt(_actorTransform[2]));//将度转化为弧度。
-					let _hdY = THREE.MathUtils.degToRad(parseInt(_actorTransform[1]));//Y轴方向上将度转化为弧度。
-					// if(parseInt(_actorLoaction[1])==0){//X轴
-					// 	_actorLoaction[1] = spaceObj.centerX;
-					// }
-					// if(parseInt(_actorLoaction[0])==0){//Y轴
-					// 	_actorLoaction[0] = spaceObj.centerY;
-					// }
-					let X_C = parseInt(_actorLoaction[0]);//X轴偏移量
-					let Y_C = -parseInt(_actorLoaction[1]);//Y轴偏移量-取反,UE里面的Y轴方向跟Three.js相反
-					let px = spaceObj.centerX + X_C;
-					let py = -spaceObj.centerY + Y_C;//UE里面的centerY值跟Three.js Y轴相反;获得真实的坐标值
-					let position = {
-						x:(parseInt(px))/100,
-						y:1.5, 
-						z:(parseInt(py))/100,//模型Y轴坐标系正负值跟webglZ轴是相反的
-					}
-					//新的观察点的位置-取模型的中心点坐标,加上高度,由于模型都是贴地的,所以高度设置为1.5
-					let targetNewPosition = {
-						x:position.x + Math.sin(_hd),
-						y:1.5 + Math.tan(_hdY),
-						z:(position.z - Math.cos(_hd)),
-					}
-					cube.position = position;
-					cube.userIndex = index;
-					cube.actorEum = index;
-					cube.targetNewPosition = targetNewPosition;
-					// console.warn("*actors*",cube,defaulIndex)
-					that.actors.push(cube);//添加视角
-					if(index == defaulIndex){//隐藏当前视角
-						that.currentActor = cube;//记录下当前的视角对象 mesh网格模型
-						let param = {
-							type: 'CLK', //埋点类型
-							clkId: 'clk_2cmina_23080411', //点击ID
-							clkName: 'visualangle_clk', //点击前往的页面名称
-							clkParams: {
-								locusName: "预制视角",
-								type:that.actors[index].actorEum
-							}
-						};
-						util.trackRequest(param);
-					}
-				})
-			}
-			//计算当前选中空间的平视时的观察点和摄像机的放置点位
-			function roamPositionHandle(lon=''){
-				if(!chooseMesh){
-					console.error("[roamPositionHandle],没有选中的空间数据")
-					return false;
-				}
-				let spaceObj = chooseMesh;//获取选中的空间模型的相关数据
-				//获取视角
-				let defaultActor = null;
-				if(spaceObj.actors && spaceObj.actors.length>0){
-					defaultActor = spaceObj.actors.find(it=>it.isSelected==true);
-					if(!defaultActor){
-						defaultActor = spaceObj.actors[0];
-					}
-				}
-				let _actorLoaction = defaultActor.actorLocation.split(',');//x y z
-				let _actorTransform = defaultActor.actorTransform.split(',');//旋转角度,取第三个值
-				let _hd = THREE.MathUtils.degToRad(parseInt(_actorTransform[2]) + lon);//将度转化为弧度。
-				let _hdY = THREE.MathUtils.degToRad(parseInt(_actorTransform[1]));//Y轴方向上将度转化为弧度。
-				// if(parseInt(_actorLoaction[1])==0){//X轴
-				// 	_actorLoaction[1] = spaceObj.centerX;
-				// }
-				// if(parseInt(_actorLoaction[0])==0){//Y轴
-				// 	_actorLoaction[0] = spaceObj.centerY;
-				// }
-				let X_C = parseInt(_actorLoaction[0]);//X轴偏移量-UE原因
-				let Y_C = -parseInt(_actorLoaction[1]);//Y轴偏移量-取反,UE里面的Y轴方向跟Three.js相反
-				let px = spaceObj.centerX + X_C;
-				let py = -spaceObj.centerY + Y_C;
-				//新的摄像机的位置-新的摄像机角度是倾斜角度,所以z值需要计算,高度设置为模型高度的2倍
-				let cameraNewPosition = {
-					x:(parseInt(px))/100,
-					y:1.5, 
-					z:(parseInt(py))/100,//模型Y轴坐标系正负值跟webglZ轴是相反的
-				}
-				if(cameraNewPosition){
-					let minX = 0,maxX = 0,minY = 0,maxY = 0;//0.1 是模型墙壁厚度
-					minX = (spaceObj.centerX - (spaceObj.spaceWidth/2))/100 + 0.1;
-					maxX = (spaceObj.centerX + (spaceObj.spaceWidth/2))/100 - 0.1;
-					maxY = ((-spaceObj.centerY + (spaceObj.spaceHeight/2))/100 - 0.1);
-					minY = ((-spaceObj.centerY - (spaceObj.spaceHeight/2))/100 + 0.1);
-					//新的坐标轴不在房间范围内,则不能移动
-					if(cameraNewPosition.x<minX || cameraNewPosition.x>maxX
-					||cameraNewPosition.z<minY || cameraNewPosition.z>maxY){//不在房间范围
-						let _x = ((spaceObj.spaceWidth/2) - 15)*defaultActor.presentX + spaceObj.centerX;
-						let _z = ((spaceObj.spaceHeight/2) - 15)*defaultActor.presentY + (-spaceObj.centerY);
-						cameraNewPosition.x = _x/100;
-						cameraNewPosition.z = _z/100;
-						console.warn("**roamPositionHandle-观察点不在空间范围-强制修正观察点位置****",JSON.stringify(cameraNewPosition))
-					}
-				}
-				//新的观察点的位置-取模型的中心点坐标,加上高度,由于模型都是贴地的,所以高度设置为1.5
-				let targetNewPosition = {
-					x:cameraNewPosition.x + Math.sin(_hd),
-					y:1.5 + Math.tan(_hdY),
-					z:(cameraNewPosition.z - Math.cos(_hd)),
-				}
-				let lookPosition = {
-					x:cameraNewPosition.x + (Math.sin(_hd)*0.01),
-					y:1.5 + Math.tan(_hdY),
-					z:(cameraNewPosition.z - (Math.cos(_hd))*0.01),
-				}
-				return {cameraNewPosition,targetNewPosition,lookPosition}
-			}
-			//直接定位到摄像头位置
-			function positionCamer(mesh=null,needAni=false){
-				if(mesh){//如果传入了模型,则取模型
-					chooseMesh = mesh;
-				}
-				if(!chooseMesh){
-					console.error("[positionCamer],没有选中的空间数据")
-					return false;
-				}
-				if(!chooseMesh.actors || chooseMesh.actors.length==0){
-					chooseMesh.actors = [{
-						actorLocation:chooseMesh.actorLocation,
-						actorTransform:chooseMesh.actorTransform,
-						isSelected:true,
-						presentX:chooseMesh.presentX,
-						presentY:chooseMesh.presentY,
-					}]
-				}
-				boundary = new THREE.Box3(
-					new THREE.Vector3(chooseMesh.centerX/100 - chooseMesh.spaceWidth/100/2 + 0.1, 0, -chooseMesh.centerY/100 - chooseMesh.spaceHeight/100/2 + 0.1), // 边界框的最小点
-					new THREE.Vector3(chooseMesh.centerX/100 + chooseMesh.spaceWidth/100/2 - 0.1, 2.7, -chooseMesh.centerY/100 + chooseMesh.spaceHeight/100/2 - 0.1) // 边界框的最大点
-				);
-				initActor();//初始化视角
-				let data = roamPositionHandle();
-				let cameraNewPosition = data.cameraNewPosition;
-				let targetNewPosition = data.targetNewPosition;
-				targetNewPosition.z = targetNewPosition.z;//增加偏差,防止极点翻转问题?不知道为啥会有用
-				let lookPosition = data.lookPosition;
-				creatMoveTip(cameraNewPosition);//创建移动的地标
-				if(needAni){
-					let oldUp = {x:0,y:1,z:0};	//俯视
-					let newUp = {x:0,y:1,z:0};	//正视
-					tweenCamera(camera.position,controls.target,cameraNewPosition,targetNewPosition,oldUp,newUp,2000);
-				}else{
-					camera.position.set(cameraNewPosition.x, cameraNewPosition.y, cameraNewPosition.z);
-					controls.target.set(lookPosition.x,lookPosition.y,lookPosition.z);
-					// controls.target.set(cameraNewPosition.x,cameraNewPosition.y,cameraNewPosition.z);
-					// controls.target.copy(camera.position);
-					camera.lookAt(targetNewPosition.x,targetNewPosition.y,targetNewPosition.z);
-				}
-			}
-			// oldP  相机原来的位置
-            // oldT  target原来的位置
-            // newP  相机新的位置
-            // newT  target新的位置
-            function tweenCamera(oldP, oldT, newP, newT, oldUp, newUp, time=1000) {
-				if(JSON.stringify(oldP) == JSON.stringify(newP) && JSON.stringify(oldT) == JSON.stringify(newT)){
-					that.repeatFlag = false;//放开限制,可以再次点击
-					return false;
-				}
-				if (!chooseMesh) {
-					that.repeatFlag = false;//放开限制,可以再次点击
-					return false;
-				}
-				tweenCameraAnma = true;
-				var tween = new TWEEN.Tween({
-					x1: oldP.x, // 相机x
-					y1: oldP.y, // 相机y
-					z1: oldP.z, // 相机z
-					x2: oldT.x, // 控制点的中心点x
-					y2: oldT.y, // 控制点的中心点y
-					z2: oldT.z,	// 控制点的中心点z
-					x3: oldUp.x, // 控制点的中心点x
-					y3: oldUp.y, // 控制点的中心点y
-					z3: oldUp.z  // 控制点的中心点z
-				})
-				.to({
-			        x1: newP.x,
-					y1: newP.y,
-					z1: newP.z,
-					x2: newT.x,
-					y2: newT.y,
-					z2: newT.z,
-					x3: newUp.x, // up向量
-					y3: newUp.y, // 控制点的中心点y
-					z3: newUp.z  // 控制点的中心点z
-			    }, time)
-				.easing(TWEEN.Easing.Quadratic.InOut)
-				.onUpdate((object)=> {
-					camera.position.x = object.x1;
-					camera.position.y = object.y1;
-					camera.position.z = object.z1;
-					// let newTarget = new THREE.Vector3(object.x3,object.y3,object.z3);
-					// camera.up.copy(newTarget);
-					camera.lookAt(object.x2,object.y2,object.z2);
-					// controls.target.x = object.x2;
-					// controls.target.y = object.y2;
-					// controls.target.z = object.z2;
-					// controls.update();
-				}).onComplete(()=>{
-					controls.target.x = newT.x;
-					controls.target.y = newT.y;
-					controls.target.z = newT.z;
-					//修正最后的视角
-					// let up = new THREE.Vector3(newUp.x,newUp.y,newUp.z);
-					// camera.up.copy(up);
-					camera.lookAt(newT.x,newT.y,newT.z);
-					tweenCameraAnma = false;
-					that.repeatFlag = false;//放开限制,可以再次点击
-				})
-				// 开始动画
-				tween.start();
-			}
-
-			function stopRender () {
-				needRender = false;
-			}
-			function starRender () {
-				if(needRender==true){//如果已经在渲染中了,则不能再次开启,避免渲染过多
-					false;
-				}
-				needRender = true;
-				render();//开始渲染
-			}
-            function render() {
-				if(needRender==false){
-					return false;
-				}
-                TWEEN && TWEEN.update();
-				// stats.update();
-				renderer.render(scene, camera);//单次渲染
-				requestId = requestAnimationFrame(render, canvas3d);
-				if (that.screenshotResolve) {
-					stopRender();
-					that.screenshotResolve()
-					that.screenshotResolve = null;//释放Promise
-				}
-            }
-
 		},
 		// computed: {
 		// 	curHouseObj() {
@@ -780,166 +84,13 @@
 					this.$router.go(-1);
 				}
 			},
-			switchActor(){},
-			positionCamer(){},
 			clearHandle(){
 				this.clearEvent();
 			},
 			save(){
 				this.$refs.viewMask.save();//下载
 			},
-			/**
-			 * 设置户型详情信息
-			 * @param {Object} data 户型详情
-			 */
-			setHouseDetail(data){
-				if(data){
-					this.id = data.id;
-					this.spaceId = this.$route.query.spaceId?this.$route.query.spaceId:'';
-					console.warn("***curHouseObj***",data)
-					// 加载户型
-					this.loadSpace();
-				}else{
-					this.curHouseObj = {}
-				}
-			},
-            // 绘制空间-即地板
-            async loadSpace(){
-				this.spaceList = [];
-				this.wallIds = [];
-				if(!this.curHouseObj || !this.spaceId){//减少重复请求
-					alert("数据错误")
-					console.warn("***数据错误***")
-					return false
-				}
-                if(this.curHouseObj){
-                    const spaceDetail = this.curHouseObj;
-                    const spaceList = JSON.parse(spaceDetail.houseJson);
-                    // 交换centerX, centerY;上一页面已经处理过了,这里不在需要处理
-                    for (let index = 0; index < spaceList.length; index++) {
-                        var element = spaceList[index];
-                        // const centerX = JSON.parse(JSON.stringify(element.centerX))
-						if(!element.actors || element.actors.length==0){
-							element.actors = [{
-								actorLocation:element.actorLocation,
-								actorTransform:element.actorTransform,
-								isSelected:true,
-							}]
-						}
-						element.actors.forEach(actor=>{
-							let _actorLoaction = actor.actorLocation.split(',');//x y z
-							let X_C = parseInt(_actorLoaction[0]);//X轴偏移量-UE原因
-							let Y_C = -parseInt(_actorLoaction[1]);//Y轴偏移量-取反,UE里面的Y轴方向跟Three.js相反
-							let _x = element.centerX + X_C;
-							let _z = -element.centerY + Y_C;//centerY 要取反,因为UE里面是反向的
-							
-							// let _x = parseInt(_actorLoaction[1]) || element.centerX;//观察点 X轴坐标 
-							// let _z = parseInt(_actorLoaction[0]) || element.centerY;//观察点 Z轴坐标
-							let _presentX = (_x - element.centerX)/((element.spaceWidth/2) - 10);//10是墙壁厚度-单位cm
-							let _presentY = (_z + element.centerY)/((element.spaceHeight/2) - 10);
-							//注意如果一开始就设置大超过空间大小,则处理成贴近空间边界
-							actor.presentX = Math.abs(_presentX)>1 ? (_presentX>1?1:-1) : _presentX;//观察点跟空间中心原点的距离比例
-							actor.presentY = Math.abs(_presentY)>1 ? (_presentY>1?1:-1) : _presentY;
-						})
-						element.wallMoveValue = "[0,0,0,0]"
-                        this.spaceList.push(element);
-                        this.wallIds.push(element.wallId);
-
-                        if(element.spaceId == this.spaceId){ // 默认选中空间
-                            this.curSpaceObj = element;
-                        }
-                    }
-                    if(!this.curSpaceObj && this.spaceList.length > 0){
-                        this.curSpaceObj = this.spaceList[0];
-                    }
-                }
-				let curSpaceArea = parseFloat((this.curSpaceObj.spaceWidth * this.curSpaceObj.spaceHeight) / 10000).toFixed(1);
-				this.navbar.title = this.curSpaceObj.spaceName + "  " + curSpaceArea + "㎡"
-                console.log("该户型空间数据:", this.spaceList);
-                console.log("当前选中的空间:", this.curSpaceObj);
-				this.positionCamer(this.curSpaceObj);
-				this.loaderSpaceArr(this.spaceList);//绘制地板
-                // 获取墙体数据并且绘制墙体
-                this.getHouseTypeSpaceWalls();
-            },
-			changeSpace(spaceId){
-				console.warn("***changeSpace***",spaceId,this.spaceId)
-				if(spaceId == this.spaceId){
-					return false;
-				}
-				this.spaceId = spaceId;
-				this.curSpaceObj = this.spaceList.find(it=>it.spaceId == spaceId);
-				if(this.isIOS){
-					this.furnSingleSpaceHandle(this.curSpaceObj);
-				}
-				this.positionCamer(this.curSpaceObj,true);
-				let curSpaceArea = parseFloat((this.curSpaceObj.spaceWidth * this.curSpaceObj.spaceHeight) / 10000).toFixed(1);
-				this.navbar.title = this.curSpaceObj.spaceName + "  " + curSpaceArea + "㎡";
-				document.title = this.navbar.title;
-			},
-			// 获取墙体数据
-            async getHouseTypeSpaceWalls(){
-				let wallList = [];
-				if(this.wallList){
-					wallList = this.wallList;
-				}else{
-					let data = {id:this.wallIds}
-					const res = await requestConfig('getHouseTypeSpaceWalls', data, true);
-					// console.log("墙体数据:", res.list)
-					if(res.success){
-					    wallList = this.wallList = res.list;
-					}
-				}
-                let wallArr = []
-                for (let index = 0; index < wallList.length; index++) {//每个空间对应一个数据
-                    let element = JSON.parse(wallList[index].wallJson);
-					let space = this.spaceList.find(space=>space.spaceId==element.spaceId);
-					this.computeWallHandleOld(space,element);//提前计算
-                    for (let i = 0; i < element.wallData.length; i ++) {//对应空间里面的4个方向的墙壁数据
-                        let wallData = element.wallData[i];
-						//对应方向的墙壁的墙体模型数据列表,每一面墙可能有多个模型
-                        for (let j = 0; j < wallData.wallModelData.length; j ++) {
-                            let wallModelData = wallData.wallModelData[j];
-                            wallArr.push({spaceId:element.spaceId, wallModelData:wallModelData, wallDirection:wallData.wallDirection})
-                            // console.log("wallModelData", element,wallData.wallDirection, wallModelData.wallType );
-                        }
-                    }
-                }
-                this.loadSpaceObjWalls(wallArr, wallList);
-				this.getOverallArrangementDetailsList();//
-            },
-            // 加载单个空间墙体资源
-            async loadSpaceObjWalls(wallArr, wallList){
-                // 加载远程墙体模型资源
-				let startTime = new Date().getTime();
-                // console.log("wallArr:", wallArr)
-				let promise_list = [];
-				let realWallArr = this.preWallData(wallArr);
-				let arrLength = realWallArr.length;
-				realWallArr && realWallArr.forEach((item,index) => {
-					promise_list.push(
-						new Promise((resolve, reject) => {
-							this.loadWallModels(item, wallList, arrLength , resolve);
-						})
-					)
-				});
-				Promise.all(promise_list).then(()=>{
-					let endTime = new Date().getTime();
-					console.log("墙体模型全部加载完成,时间:",endTime - startTime);
-					// 设置空间数组的墙体信息
-					// this.setSpaceListWallInfo();
-					this.$nextTick(()=>{
-						// this.moveMeshCenter(this.curSpaceObj);
-						this.progress = 100;
-						// this.$refs.myLoading.showLoading("加载中..." + this.progress + '%')
-						this.$nextTick(()=>{
-							this.myLoadingStatus = false;
-							// this.$refs.myLoading.hideLoading();
-							// this.meshRoam(this.curSpaceObj);//开始漫游,必须先选中模型
-						})
-					})
-				})
-            },
+		
         }
     }
 </script>

+ 10 - 0
src/store/actions.js

@@ -44,6 +44,16 @@ const actions = {
 	}, curSpaceId) {
 		commit('SET_CURSPACEID', curSpaceId)
 	},
+	setCurHouseType({
+		commit
+	}, curHouseType) {
+		commit('SET_CURHOUSETYPE', curHouseType)
+	},
+	setHouseList({
+		commit
+	}, houseList) {
+		commit('SET_HOUSELIST', houseList)
+	},
 	// setCityListData({
 	// 	commit
 	// }, cityListData) {

+ 6 - 0
src/store/mutations.js

@@ -26,5 +26,11 @@ const mutations = {
 	SET_CURSPACEID(state, curSpaceId) {
 		state.curSpaceId = curSpaceId
 	},
+	SET_CURHOUSETYPE(state, curHouseType) {
+		state.curHouseType = curHouseType
+	},
+	SET_HOUSELIST(state, houseList) {
+		state.houseList = houseList
+	},
 }
 export default mutations;

+ 4 - 1
src/store/state.js

@@ -5,9 +5,12 @@ const state = {
 	account:null,	//账号
 	userId:'',	//用户id-小程序当中提供的
 	houseId:'',	//项目id-小程序当中提供的
-	curHouseObj:null,
 	wallList:null,	//墙体数据
 	aiData:null,	//AI生成的数据
+	overChange:false,	//当前空间是否处在形变中
 	curSpaceId:null,	//当前选中的空间id
+	curHouseObj:null,
+	curHouseType:null,	//当前选中的户型类型
+	houseList:[],	//当前项目下所有户型数据(以户型类型分组)
 }
 export default state