zhouenguang 3 vuotta sitten
vanhempi
commit
d68099d528
3 muutettua tiedostoa jossa 13 lisäystä ja 8 poistoa
  1. 6 1
      src/ActionsHandler.js
  2. 3 6
      src/RotationEvent.js
  3. 4 1
      src/XMaterialComponent.js

+ 6 - 1
src/ActionsHandler.js

@@ -386,6 +386,7 @@ export default class ActionsHandler {
         
         let sfns = Math.round(endRotation/6)
         endRotation += angle/Math.PI*180
+        endRotation = (endRotation % 360 + 360) % 360
 
         let efns = Math.round(endRotation/6)
         
@@ -402,11 +403,14 @@ export default class ActionsHandler {
         // 起始帧不需要传入
         if(efns>sfns) sfns = (sfns + 1 + 60) % 60
         if(efns<sfns) sfns = (sfns - 1 + 60) % 60
-        efns = (efns + 60) % 60
+        efns = sfns // (efns + 60) % 60
         // console.error(sfns, efns)
 
+        window.rotating = true      // 标记旋转中
+        window.rotateFrame = efns - sfns   // 旋转帧数
         window.camera_endRotation = endRotation
         window.star_angle = angle
+
         console.log('取帧:'+sfns+','+efns);
         this.fetchData({
             type:type,
@@ -478,6 +482,7 @@ export default class ActionsHandler {
             this.vDecoder.fetch({
                 path: "https://laser-data.oss-cn-shenzhen.aliyuncs.com/test-video/2",
                 range: [sfns, efns],
+                // range: sfns == efns ? [efns] : [sfns, efns],
               });
         }
         else{

+ 3 - 6
src/RotationEvent.js

@@ -48,9 +48,9 @@ export default class RotationEvent {
             const canvasHeight = this._room.options.canvas.offsetHeight
             const canvasWidth = this._room.options.canvas.offsetWidth
 
-            if(window.initFinished){
-                 // 旋转中
-                // if(window.rotating) return
+            if(window.initFinished) {
+                // 旋转中
+                if(window.rotating) return
 
                 // offset累计
                 if(!this.offset) this.offset = 0
@@ -61,8 +61,6 @@ export default class RotationEvent {
                 angle = Math.round(angle / (Math.PI/30)) * (Math.PI/30)
                 if(Math.abs(angle) < Math.PI/30) return
 
-                // window.rotating = true
-
                 // 开始旋转
                 this._room.actionsHandler.rotate({
                     type: 'rotate',
@@ -71,7 +69,6 @@ export default class RotationEvent {
 
                 // 重置累计
                 this.offset = 0
-                // this.rotating = false
             }
 
             this.touchStartX = pageX;

+ 4 - 1
src/XMaterialComponent.js

@@ -273,7 +273,10 @@ export default class XMaterialComponent {
     }
     //xst
     receveFrames(data){
-        // console.error("decodeData")
+        // console.error("decodeData", data.clipId, data.renderStateId)
+        if(!window.rotating) return
+        if(window.rotateFrame <= data.renderStateId) window.rotating = false
+
         window.room.doRotate(window.star_angle)
 
         const { width, height, data: buffer } = data;