|
@@ -181,86 +181,86 @@ export default class App {
|
|
|
return URL.revokeObjectURL(url)
|
|
|
}, 3000)
|
|
|
|
|
|
- // this.cameraController.rotateCamera(this.cameraController.alphaOffset)
|
|
|
+ if(this.getWalkVideo) {
|
|
|
+
|
|
|
+ let path = this.currentPoints.map( (point, index) => {
|
|
|
+ return {
|
|
|
+ point: new BABYLON.Vector3(point.location.x, 0, point.location.z),
|
|
|
+ video: common.createVideoElement0(url)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 行走时锁定camera
|
|
|
+ this.cameraController.lockCamera(true)
|
|
|
+ this.charactorManager.charactor.startWalk(path, this.charactorManager)
|
|
|
+
|
|
|
+ this.getWalkVideo = false
|
|
|
|
|
|
- if(this.isReverse) {
|
|
|
- document.getElementById("houseTextureReverse").src = url
|
|
|
} else {
|
|
|
- document.getElementById("houseTexture").src = url
|
|
|
- }
|
|
|
+ // this.cameraController.rotateCamera(this.cameraController.alphaOffset)
|
|
|
+
|
|
|
+ if(this.isReverse) {
|
|
|
+ document.getElementById("houseTextureReverse").src = url
|
|
|
+ } else {
|
|
|
+ document.getElementById("houseTexture").src = url
|
|
|
+ }
|
|
|
|
|
|
- this.isReverse = !this.isReverse
|
|
|
+ this.isReverse = !this.isReverse
|
|
|
|
|
|
- if(this.initVideo) {
|
|
|
- this.updateHouseVideoBlob(url, true)
|
|
|
- this.initVideo = false
|
|
|
+ if(this.initVideo) {
|
|
|
+ this.updateHouseVideoBlob(url, true)
|
|
|
+ this.initVideo = false
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
|
|
|
// 获得行走视频
|
|
|
- window.connection.socket.on('getVideo', async (jsonArr) => {
|
|
|
+ window.connection.socket.on('getVideo', async (data) => {
|
|
|
|
|
|
console.log("[3D] getVideo: ", data)
|
|
|
|
|
|
- let path = jsonArr.map( async (data, index) => {
|
|
|
+ const blob = new Blob([data], { type: 'application/video' })
|
|
|
+ const url = URL.createObjectURL(blob)
|
|
|
+ setTimeout(function () {
|
|
|
+ URL.revokeObjectURL(url)
|
|
|
+ }, 3000)
|
|
|
|
|
|
- const blob = new Blob([data.video], { type: 'application/video' })
|
|
|
- const url = URL.createObjectURL(blob)
|
|
|
- setTimeout(function () {
|
|
|
- return URL.revokeObjectURL(url)
|
|
|
- }, 3000)
|
|
|
-
|
|
|
- return {
|
|
|
- point: new BABYLON.Vector3(data.point.x, 0, data.point.z),
|
|
|
- video: await common.createVideoElement(url)
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- // 行走时锁定camera
|
|
|
- this.cameraController.lockCamera(true)
|
|
|
- this.charactorManager.charactor.startWalk(path, this)
|
|
|
+ // let path = this.currentPoints.map( (point, index) => {
|
|
|
+ // return {
|
|
|
+ // point: new BABYLON.Vector3(point.location.x, 0, point.location.z),
|
|
|
+ // video: url // await common.createVideoElement0(url)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+
|
|
|
+ // // 行走时锁定camera
|
|
|
+ // this.cameraController.lockCamera(true)
|
|
|
+ // this.charactorManager.charactor.startWalk(path, this.charactorManager)
|
|
|
})
|
|
|
|
|
|
// 获得行走路径
|
|
|
- window.connection.socket.on("getRoute", (event) => {
|
|
|
-
|
|
|
- console.log("[3D] getRoute", event);
|
|
|
-
|
|
|
- let endPointId = 1
|
|
|
-
|
|
|
- // window.connection.socket.emit("getRotateVideo", {
|
|
|
- // videoPath: endPointId + "/" + endPointId,
|
|
|
- // sangle: 0,
|
|
|
- // eangle: 359,
|
|
|
- // reverses: true,
|
|
|
- // sceneCode: settings.sceneCode,
|
|
|
- // roomId: settings.roomId,
|
|
|
- // userId: settings.userId,
|
|
|
- // });
|
|
|
- // window.connection.socket.emit("getRotateVideo", {
|
|
|
- // videoPath: endPointId + "/" + endPointId,
|
|
|
- // sangle: 0,
|
|
|
- // eangle: 359,
|
|
|
- // reverses: false,
|
|
|
- // sceneCode: settings.sceneCode,
|
|
|
- // roomId: settings.roomId,
|
|
|
- // userId: settings.userId,
|
|
|
- // });
|
|
|
+ window.connection.socket.on("getRoute", (data) => {
|
|
|
|
|
|
+ console.log("[3D] getRoute", data);
|
|
|
+
|
|
|
+ if(data.length < 2) return
|
|
|
+
|
|
|
+ data = data.reverse()
|
|
|
+ this.currentPoints = data
|
|
|
+
|
|
|
let dir = this.charactorManager.getVideoDirecNum()
|
|
|
|
|
|
- let arr = []
|
|
|
let videos = []
|
|
|
- for(let i = 0; i < arr.length - 1; i++) {
|
|
|
- videos.push(arr[i] + "/" + arr[i] + "_" + arr[i+1] + "_" + dir)
|
|
|
+ for(let i = 0; i < data.length - 1; i++) {
|
|
|
+ videos.push(data[i].id + "/" + data[i].id + "_" + data[i+1].id + "_" + dir)
|
|
|
}
|
|
|
|
|
|
- // connection.socket.emit("getVideo", {
|
|
|
- // videoList: ["0/0_1_0", "0/0_1_1", "0/0_1_2"],
|
|
|
- // sceneCode: testConfig.sceneCode,
|
|
|
- // roomId: testConfig.roomId,
|
|
|
- // userId: testConfig.userId,
|
|
|
- // });
|
|
|
+ this.getWalkVideo = true
|
|
|
+ connection.socket.emit("getVideo", {
|
|
|
+ videoList: videos,
|
|
|
+ sceneCode: settings.sceneCode,
|
|
|
+ roomId: settings.roomId,
|
|
|
+ userId: settings.userId,
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -280,6 +280,7 @@ export default class App {
|
|
|
mesh.material && mesh.material.setTexture("texture_video", videoTexture)
|
|
|
})
|
|
|
!notPlay && video.play()
|
|
|
+ return video
|
|
|
}
|
|
|
|
|
|
}
|