|
@@ -5,12 +5,30 @@ import Person from "./enum/Person.js"
|
|
|
import ClickType from "./enum/ClickType.js"
|
|
|
import Logger from "./Logger.js"
|
|
|
|
|
|
+
|
|
|
+import { VDecoder } from "./h264Decoder/VDecoder.js";
|
|
|
+
|
|
|
const logger = new Logger('actions-handler')
|
|
|
const QueueActions = [Actions.Transfer, Actions.ChangeSkin, Actions.GetOnVehicle, Actions.GetOffVehicle];
|
|
|
export default class ActionsHandler {
|
|
|
constructor(e) {
|
|
|
this.currentActiveAction = null
|
|
|
this.room = e
|
|
|
+
|
|
|
+ //xst
|
|
|
+ window.workerReady = false
|
|
|
+ this.vDecoder = new VDecoder({
|
|
|
+ maxChip: 100,
|
|
|
+ });
|
|
|
+ window.vDecoder = this.vDecoder
|
|
|
+ this.init()
|
|
|
+ }
|
|
|
+
|
|
|
+ init(){
|
|
|
+ this.vDecoder.on('ready', () => {
|
|
|
+ console.log("ready");
|
|
|
+ window.workerReady = true
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
async avatarComponentsSync(e){
|
|
@@ -334,7 +352,7 @@ export default class ActionsHandler {
|
|
|
}
|
|
|
|
|
|
/***********************************************************************xst****************************************************************/
|
|
|
-
|
|
|
+ /*
|
|
|
rotate({pitch: e, yaw: t}) {
|
|
|
var n;
|
|
|
if (this.room.disableRotate || this.room.isPano || ((n = this.room._userAvatar) == null ? void 0 : n._isChangingComponentsMode))
|
|
@@ -353,19 +371,53 @@ export default class ActionsHandler {
|
|
|
sampleRate: .02
|
|
|
})
|
|
|
}
|
|
|
+ */
|
|
|
|
|
|
|
|
|
- // rotate({type: type, angle: angle}) {
|
|
|
- // //每6°一个角
|
|
|
- // for(let i=0;i<60;++i){
|
|
|
- // if(Math.abs(angle - i/60 * 2 * Math.PI)<0.01){
|
|
|
- // //找到了
|
|
|
- // this.sendData({
|
|
|
+ rotate({type: type, angle: angle}) {
|
|
|
+ let endRotation = window.room.sceneManager.cameraComponent.mainCamera.rotation.y
|
|
|
+ if(endRotation<0){
|
|
|
+ endRotation += 2*Math.PI
|
|
|
+ }
|
|
|
+ else if(endRotation>2*Math.PI){
|
|
|
+ endRotation -= 2*Math.PI
|
|
|
+ }
|
|
|
+
|
|
|
+ let sfns = Math.round(endRotation/Math.PI * 180 /6)
|
|
|
+ //每6°一帧
|
|
|
+ for(let i=0;i<60;++i){
|
|
|
+ if(Math.abs(Math.abs(angle) - i/60 * 2 * Math.PI)<0.01){
|
|
|
+ //找到了
|
|
|
+ endRotation += angle
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let efns = Math.round(endRotation/Math.PI * 180 /6)
|
|
|
+ console.log('取帧:'+sfns+','+efns);
|
|
|
+ this.fetchData({
|
|
|
+ type:type,
|
|
|
+ sFrame:sfns,
|
|
|
+ eFrame:efns
|
|
|
+ })
|
|
|
+
|
|
|
+ this.room.sceneManager.materialComponent.initreceveFrames()
|
|
|
+
|
|
|
+ // this.room.sceneManager.cameraComponent.mainCamera.rotation.y = endRotation
|
|
|
+ // window.room.sceneManager.cameraComponent._cameraPose.rotation._y = endRotation
|
|
|
+ window.room.sceneManager.cameraComponent.mainCamera.rotation.y=endRotation
|
|
|
+ }
|
|
|
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
+ fetchData({sFrame: sfns, eFrame: efns}){
|
|
|
+ if(window.workerReady){
|
|
|
+ this.vDecoder.fetch({
|
|
|
+ path: "https://laser-data.oss-cn-shenzhen.aliyuncs.com/test-video/earth",
|
|
|
+ range: [sfns, efns],
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ console.error('还没准备好')
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/*******************************************************************************************************************************************/
|
|
|
|