|
@@ -4,23 +4,18 @@
|
|
|
<script>
|
|
|
import * as THREE from 'three';
|
|
|
import Stats from 'three/addons/libs/stats.module.js';
|
|
|
- import {
|
|
|
- OrbitControls
|
|
|
- } from 'three/addons/controls/OrbitControls.js';
|
|
|
+ import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
|
import { DragControls } from 'three/addons/controls/DragControls.js';
|
|
|
- import {
|
|
|
- getStorage
|
|
|
- } from '@/utils/localStorage';
|
|
|
+ import {getStorage} from '@/utils/localStorage';
|
|
|
var requestId = "";
|
|
|
const util = require('@/utils/util.js').default;
|
|
|
- import viewShell from '@/components/newBottomCom/viewShell/viewShell.vue';
|
|
|
- import viewMask from '@/components/newBottomCom/viewMask/viewMask.vue';
|
|
|
+ import viewAI from '@/components/newBottomCom/viewAI/viewAI.vue';
|
|
|
|
|
|
import commonPageMethod from '@/mixins/commonPageMethod.js';
|
|
|
// import commonPageMethod from '@/common/commonPageMethod.js';
|
|
|
export default {
|
|
|
components: {
|
|
|
- viewMask
|
|
|
+ viewAI
|
|
|
},
|
|
|
mixins: [commonPageMethod],
|
|
|
/**
|
|
@@ -28,15 +23,15 @@
|
|
|
*/
|
|
|
data() {
|
|
|
return {
|
|
|
- pvCurPageName: "room_show",
|
|
|
- locusBehaviorName: "房间展示",
|
|
|
+ pvCurPageName: "add_AI_people",
|
|
|
+ locusBehaviorName: "添加数字人",
|
|
|
pvCurPageParams: null,
|
|
|
houseId: "",
|
|
|
pvId: 'p_2cmina_23080402',
|
|
|
canvas: null,
|
|
|
navbar: {
|
|
|
showCapsule: 1,
|
|
|
- title: '客厅',
|
|
|
+ title: '添加数字人',
|
|
|
titleColor: '#000',
|
|
|
navPadding: 0,
|
|
|
navPaddingBg: 'transparent',
|
|
@@ -109,7 +104,7 @@
|
|
|
var that = this;
|
|
|
console.warn("***webgl_rxdz_roam-options***", this.$route.query)
|
|
|
this.isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
|
|
|
- this.videoUrl = this.$route.query.videoUrl || 'https://dm.static.elab-plus.com/miniProgram/005.mp4';
|
|
|
+ this.videoUrl = this.$route.query.videoUrl || '';
|
|
|
this.bgUrl = this.$route.query.bgUrl || 'https://dm.static.elab-plus.com/miniProgram/tears_of_steel_bridge_2k.jpg';
|
|
|
|
|
|
// alert("***mounted-webgl_rxdz_roam***"+this.isIOS + this.curHouseObj)
|
|
@@ -122,7 +117,8 @@
|
|
|
screenHeight = Math.min(window.innerHeight, window.screen.height)
|
|
|
}
|
|
|
let unit = screenWidth / 750; //单位rpm 对应 px 的值
|
|
|
- this.canvasHeight = screenHeight - (600 * unit) + (40 * unit);
|
|
|
+ // this.canvasHeight = screenHeight - (600 * unit) + (40 * unit);
|
|
|
+ this.canvasHeight = screenWidth;
|
|
|
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;
|
|
@@ -143,7 +139,7 @@
|
|
|
// this.attendEvent = attendEvent;
|
|
|
this.starRender = starRender; //对外暴露启动渲染的方法
|
|
|
this.stopRender = stopRender; //对外暴露停止渲染的方法
|
|
|
-
|
|
|
+ this.videoHandle = videoHandle; //视频处理方法
|
|
|
function init() {
|
|
|
// 创建相机位置
|
|
|
camera = new THREE.PerspectiveCamera(120, screenWidth / that.canvasHeight, 0.1, 10000);
|
|
@@ -156,12 +152,13 @@
|
|
|
// const ambientLight = new THREE.AmbientLight(0xFFEFE0, 3.5);
|
|
|
// scene.add(ambientLight);
|
|
|
// 辅助方格
|
|
|
- const axesHelper = new THREE.AxesHelper( 50 );
|
|
|
- scene.add( axesHelper );
|
|
|
- const gridHelper = new THREE.GridHelper(50, 10, 0xcccccc, 0xcccccc);
|
|
|
- gridHelper.position.y = 0;
|
|
|
- gridHelper.position.x = 0;
|
|
|
- scene.add(gridHelper);
|
|
|
+ // const axesHelper = new THREE.AxesHelper( 50 );
|
|
|
+ // scene.add( axesHelper );
|
|
|
+ // const gridHelper = new THREE.GridHelper(50, 10, 0xcccccc, 0xcccccc);
|
|
|
+ // gridHelper.position.y = 0;
|
|
|
+ // gridHelper.position.x = 0;
|
|
|
+ // scene.add(gridHelper);
|
|
|
+
|
|
|
//加载环境720贴图
|
|
|
const loader = new THREE.TextureLoader();
|
|
|
const texture = loader.load(that.bgUrl, () => {
|
|
@@ -201,12 +198,18 @@
|
|
|
});
|
|
|
camera.lookAt(that.controlStarPosition.x, that.controlStarPosition.y, that.controlStarPosition.z);
|
|
|
starRender(); //启动渲染
|
|
|
- setTimeout(() => {
|
|
|
- videoHandle()
|
|
|
- }, 500);
|
|
|
+ // setTimeout(() => {
|
|
|
+ // videoHandle()
|
|
|
+ // }, 500);
|
|
|
}
|
|
|
|
|
|
function videoHandle() {
|
|
|
+ if(!that.videoUrl){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(videoMesh){
|
|
|
+ that.scene.remove(videoMesh);
|
|
|
+ }
|
|
|
// 创建视频元素
|
|
|
var video = document.createElement('video');
|
|
|
video.src = that.videoUrl; // 视频文件的路径
|
|
@@ -433,6 +436,14 @@
|
|
|
clearHandle() {
|
|
|
this.clearEvent();
|
|
|
},
|
|
|
+ aiPeopleChange(item){
|
|
|
+ console.warn("***aiPeopleChange***",item);
|
|
|
+ if(!item || !item.url){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ this.videoUrl = item.url;
|
|
|
+ this.videoHandle();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|