|
@@ -167,92 +167,60 @@ export default class App {
|
|
|
|
|
|
bindSocketEvents() {
|
|
|
|
|
|
+ let walkPointsTemp = []
|
|
|
+
|
|
|
window.connection.socket.on('getSocketVideo', async(data) => {
|
|
|
|
|
|
console.log("[3D] getSocketVideo: ", data)
|
|
|
|
|
|
- if(this.getWalkVideo) {
|
|
|
+ const blob = new Blob( [data], { type: 'application/video' })
|
|
|
|
|
|
- const blob = new Blob( [data], { type: 'application/video' })
|
|
|
+ const url = URL.createObjectURL(blob)
|
|
|
+ setTimeout(function () {
|
|
|
+ URL.revokeObjectURL(url)
|
|
|
+ }, 3000)
|
|
|
|
|
|
- const url = URL.createObjectURL(blob)
|
|
|
- setTimeout(function () {
|
|
|
- URL.revokeObjectURL(url)
|
|
|
- }, 3000)
|
|
|
+ if(this.getSocketVideoType == "walkPath") {
|
|
|
|
|
|
+ let dir = this.charactorManager.getVideoDirecNum()
|
|
|
// 获得行走视频
|
|
|
- let path = this.currentPoints.map( (point, index) => {
|
|
|
+ let path = walkPointsTemp.map( (point, i) => {
|
|
|
return {
|
|
|
+ id: point.id,
|
|
|
point: new BABYLON.Vector3(-point.location.x, 0, point.location.z),
|
|
|
- video: index == 1 ? common.createVideoElement0(url) : null
|
|
|
+ video: i == 0 ? common.createVideoElement0(url) : null,
|
|
|
+ videoName: i != walkPointsTemp.length - 1 ? (point.id + "/" + point.id + "_" + walkPointsTemp[i+1].id + "_" + dir) : null
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+ this.getSocketVideoType = "nextWalk"
|
|
|
|
|
|
// 行走时锁定camera
|
|
|
this.cameraController.lockCamera(true)
|
|
|
this.charactorManager.charactor.startWalk(path, this.charactorManager)
|
|
|
|
|
|
- this.getWalkVideo = false
|
|
|
+ }
|
|
|
+ else if(this.getSocketVideoType == "nextWalk") {
|
|
|
|
|
|
- // 获得行走视频后,获取终点旋转视频
|
|
|
- let endPointId = this.currentPoints[this.currentPoints.length - 1].id
|
|
|
+ let charactor = this.charactorManager.charactor
|
|
|
+ let video = common.createVideoElement0(url) //await common.createVideoElement(url)
|
|
|
|
|
|
- console.log("[3D] send(getRotateVideo): ", endPointId + "/" + endPointId)
|
|
|
- window.connection.socket.emit("getRotateVideo", {
|
|
|
- videoPath: endPointId + "/" + endPointId,
|
|
|
- sangle: 0,
|
|
|
- eangle: 360,
|
|
|
- reverses: false,
|
|
|
- sceneCode: settings.sceneCode,
|
|
|
- roomId: settings.roomId,
|
|
|
- userId: settings.userId,
|
|
|
- });
|
|
|
- window.connection.socket.emit("getRotateVideo", {
|
|
|
- videoPath: endPointId + "/" + endPointId,
|
|
|
- sangle: 0,
|
|
|
- eangle: 360,
|
|
|
- reverses: true,
|
|
|
- sceneCode: settings.sceneCode,
|
|
|
- roomId: settings.roomId,
|
|
|
- userId: settings.userId,
|
|
|
- });
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- // write the bytes of the string to an ArrayBuffer
|
|
|
- //var ab = new ArrayBuffer(data.length);
|
|
|
- var ia = new Uint8Array(data);
|
|
|
- for (var i = 0; i < data.length; i++) {
|
|
|
- ia[i] = data.charCodeAt(i);
|
|
|
- }
|
|
|
-
|
|
|
- const blob = new Blob([data], { type: 'application/video' })
|
|
|
+ console.error(charactor.walkData.currentPoint+1)
|
|
|
+ charactor.walkData.pathArr[charactor.walkData.currentPoint+1].video = video
|
|
|
|
|
|
+ }
|
|
|
+ else {
|
|
|
// 获得旋转视频
|
|
|
- //const blob = new Blob([data], { type: 'application/video' })
|
|
|
- const url = URL.createObjectURL(blob)
|
|
|
- // this.updateHouseVideoBlob(url, true)
|
|
|
- // let video = common.createVideoElement0(url)
|
|
|
- // video.loop = "loop"
|
|
|
- setTimeout(function () {
|
|
|
- return URL.revokeObjectURL(url)
|
|
|
- }, 3000)
|
|
|
-
|
|
|
- // this.cameraController.rotateCamera(this.cameraController.alphaOffset)
|
|
|
|
|
|
+ let video = this.isReverse ? document.getElementById("houseTextureReverse")
|
|
|
+ : document.getElementById("houseTexture")
|
|
|
|
|
|
- let video
|
|
|
- if(this.isReverse) {
|
|
|
- video = document.getElementById("houseTextureReverse")
|
|
|
- } else {
|
|
|
- video = document.getElementById("houseTexture")
|
|
|
- }
|
|
|
video.src = url
|
|
|
|
|
|
this.isReverse = !this.isReverse
|
|
|
|
|
|
+ // 页面刷新后初次加载视频
|
|
|
if(this.initVideo) {
|
|
|
- // this.updateHouseVideoBlob(url, true)
|
|
|
this.updateHouseVideo(video, true)
|
|
|
this.initVideo = false
|
|
|
this.cameraController.camera.minZ = 0.001
|
|
@@ -289,19 +257,14 @@ export default class App {
|
|
|
|
|
|
if(!data || data.length < 2) return
|
|
|
|
|
|
- // data = data.reverse()
|
|
|
- this.currentPoints = data
|
|
|
+ walkPointsTemp = data
|
|
|
|
|
|
let dir = this.charactorManager.getVideoDirecNum()
|
|
|
+ let firstVideoName = data[0].id + "/" + data[0].id + "_" + data[1].id + "_" + dir
|
|
|
|
|
|
- this.walkVideoNames = []
|
|
|
- for(let i = 0; i < data.length - 1; i++) {
|
|
|
- this.walkVideoNames.push(data[i].id + "/" + data[i].id + "_" + data[i+1].id + "_" + dir)
|
|
|
- }
|
|
|
-
|
|
|
- this.getWalkVideo = true
|
|
|
+ this.getSocketVideoType = "walkPath"
|
|
|
let sendData = {
|
|
|
- videoList: this.walkVideoNames, //[0],
|
|
|
+ videoList: [firstVideoName],
|
|
|
sceneCode: settings.sceneCode,
|
|
|
roomId: settings.roomId,
|
|
|
userId: settings.userId,
|