|
@@ -12,7 +12,8 @@ import { SrsRTC } from "./srsRtc.js";
|
|
|
import { Connection } from "./connection.js";
|
|
|
|
|
|
|
|
|
-const ossVideoDir = "https://laser-data.oss-cn-shenzhen.aliyuncs.com/test-video/optest/"
|
|
|
+const ossVideoDir = "https://laser-data.oss-cn-shenzhen.aliyuncs.com/new-video/new-nc/"
|
|
|
+const walkVideoFrame = 29
|
|
|
|
|
|
window.currentFrame = null
|
|
|
const logger = new Logger('actions-handler')
|
|
@@ -61,12 +62,14 @@ export default class ActionsHandler {
|
|
|
|
|
|
window.connection.socket.on("getRoute", (pathArr) => {
|
|
|
console.error("getRoute", pathArr);
|
|
|
+
|
|
|
+ if(!pathArr) return
|
|
|
|
|
|
let {anglePlus, dircNum} = window.room.sceneManager.correctCameraDirec()
|
|
|
|
|
|
pathArr.forEach(point => {
|
|
|
// todo 矫正
|
|
|
- let ue4Pos = util.xversePosition2Ue4({x: -point.location.x-0.8, y: point.location.y, z: point.location.z+0.8})
|
|
|
+ let ue4Pos = util.xversePosition2Ue4({x: -point.location.x, y: point.location.y, z: point.location.z})
|
|
|
point.location = new BABYLON.Vector3(ue4Pos.x, ue4Pos.y, ue4Pos.z)
|
|
|
})
|
|
|
|
|
@@ -79,9 +82,9 @@ export default class ActionsHandler {
|
|
|
let point0 = new BABYLON.Vector3(pathArr[i].location.x, pathArr[i].location.y, pathArr[i].location.z)
|
|
|
let point1 = new BABYLON.Vector3(pathArr[i+1].location.x, pathArr[i+1].location.y, pathArr[i+1].location.z)
|
|
|
let distanceVec = point1.clone().subtract(point0)
|
|
|
- let distancePerFrame = distanceVec.length() / 30
|
|
|
+ let distancePerFrame = distanceVec.length() / walkVideoFrame
|
|
|
let dir = distanceVec.normalize()
|
|
|
- for(let currentFrame = 1; currentFrame <= 30; currentFrame++) {
|
|
|
+ for(let currentFrame = 1; currentFrame <= walkVideoFrame; currentFrame++) {
|
|
|
walkPoints.push(point0.add(dir.scale(distancePerFrame * currentFrame)))
|
|
|
}
|
|
|
}
|
|
@@ -89,7 +92,7 @@ export default class ActionsHandler {
|
|
|
console.error(walkPoints)
|
|
|
|
|
|
window.walkSettings = {
|
|
|
- "frameNum": 30 * (pathArr.length - 1),
|
|
|
+ "frameNum": walkVideoFrame * (pathArr.length - 1),
|
|
|
"walkPoints": walkPoints,
|
|
|
}
|
|
|
|
|
@@ -185,15 +188,26 @@ export default class ActionsHandler {
|
|
|
|
|
|
// 镜头矫正
|
|
|
let {anglePlus, dircNum} = window.room.sceneManager.correctCameraDirec()
|
|
|
+ let anglePlusFrame = Math.floor(anglePlus / (Math.PI/30))
|
|
|
+ anglePlus = anglePlusFrame * (Math.PI/30)
|
|
|
+
|
|
|
if(Math.abs(anglePlus) > 0.0001) {
|
|
|
- window.moveBackCall = {
|
|
|
+ window.moveCallBack = {
|
|
|
func: this.moveTo.bind(this),
|
|
|
args: [e]
|
|
|
}
|
|
|
- this.rotate({type: 'rotate', angle: anglePlus})
|
|
|
+ window.rotateCallBack = {
|
|
|
+ func: this.rotate.bind(this),
|
|
|
+ args: [{type: 'rotate', angle: Math.PI/30 * Math.sign(anglePlus)}],
|
|
|
+ frame: anglePlusFrame,
|
|
|
+ currentFrame: 0,
|
|
|
+ }
|
|
|
+ this.rotate({type: 'rotate', angle: Math.PI/30 * Math.sign(anglePlus)})
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+
|
|
|
const {point: t, extra: r="", motionType: n} = e
|
|
|
, o = {
|
|
|
action_type: Actions.Clicking,
|
|
@@ -520,7 +534,7 @@ export default class ActionsHandler {
|
|
|
|
|
|
let endRotation = util.xverseRotation2Ue4(window.room.sceneManager.cameraComponent.mainCamera.rotation).yaw
|
|
|
endRotation = (endRotation % 360 + 360) % 360
|
|
|
-
|
|
|
+
|
|
|
// todo 矫正
|
|
|
let sfns = Math.round((endRotation + 180)/6) // 仅视频贴图偏移矫正180度
|
|
|
endRotation += angle/Math.PI*180
|
|
@@ -541,8 +555,8 @@ export default class ActionsHandler {
|
|
|
// 起始帧不需要传入
|
|
|
if(efns>sfns) sfns = (sfns + 1 + 60) % 60
|
|
|
if(efns<sfns) sfns = (sfns - 1 + 60) % 60
|
|
|
- efns = sfns // (efns + 60) % 60
|
|
|
- // console.error(sfns, efns)
|
|
|
+ efns = sfns // (efns + 60) % 60 // 目前一帧一帧跳,防止漂移和跨0问题
|
|
|
+ // console.error(angle/Math.PI*180, endRotation, efns, sfns)
|
|
|
|
|
|
window.rotating = true // 标记旋转中
|
|
|
window.rotateFrame = efns - sfns // 旋转帧数
|
|
@@ -644,13 +658,14 @@ export default class ActionsHandler {
|
|
|
// "https://laser-data.oss-cn-shenzhen.aliyuncs.com/test-video/1",
|
|
|
// ]
|
|
|
videoPathArr.forEach(path => {
|
|
|
- for(let i = 0; i < 30; i++) {
|
|
|
+ for(let i = 0; i < walkVideoFrame; i++) {
|
|
|
sendData.push({
|
|
|
path: path,
|
|
|
frame: i,
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ // sendData.reverse()
|
|
|
this.vDecoder.mutiFetch(sendData);
|
|
|
}
|
|
|
else{
|