gemercheung 3 年 前
コミット
4b040ce1f9
3 ファイル変更23 行追加13 行削除
  1. 11 1
      src/get-router/get-router.service.ts
  2. 1 1
      src/move/move.service.ts
  3. 11 11
      src/scene/scene.service.ts

+ 11 - 1
src/get-router/get-router.service.ts

@@ -60,6 +60,10 @@ export class GetRouterService implements OnModuleInit {
     // );
     // const startPoint = JSON.parse(startPointRes);
     const startPoint = this.breakPointInfo[startPointId];
+    if (startPoint.contact.indexOf(endPoint.breakPointId) > -1) {
+      // debugger;
+      return [startPointId, endPoint.breakPointId];
+    }
     // const endPointRes = await this.cacheService.get(
     //   'breakpoints:app_id:' + appId + ':break_point_id:' + endPointId,
     // );
@@ -139,21 +143,27 @@ export class GetRouterService implements OnModuleInit {
     } while ((result_index = this.existList(endPoint, openList)) == -1);
 
     //判断结果列表是否为空
+    let currentObj;
     if (result_index == -1) {
       result = [];
     } else {
-      let currentObj = openList[result_index];
+      currentObj = openList[result_index];
       do {
         //把路劲节点添加到result当中
         result.unshift(currentObj.breakPointId);
         currentObj = currentObj.parent;
+        if (!currentObj) {
+          break;
+        }
       } while (
         //currentObj.position.x != startPoint.position.x ||
         //currentObj.position.y != startPoint.position.y
         currentObj.contact.indexOf(startPointId) < 0
       );
     }
+    result.unshift(currentObj.breakPointId);
     result.unshift(startPointId);
+    console.log('过渡路径:' + result);
     return result;
   }
 

+ 1 - 1
src/move/move.service.ts

@@ -221,7 +221,7 @@ export class MoveService implements OnModuleInit {
       this.reply['actionResponses'][0].traceId = traceId;
       console.log('矫正后-相机:' + user.camera.angle.yaw);
       const index = Math.round(user.camera.angle.yaw / 44); //过渡需要
-      debugger;
+      // debugger;
       for (let i = 0; i < path.length - 1; ++i) {
         let pathReplys = [];
         const start_break_point_id = path[i];

+ 11 - 11
src/scene/scene.service.ts

@@ -26,7 +26,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
     private rotateService: RotateService,
     private moveService: MoveService,
     private getRouterService: GetRouterService, // @InjectQueue('rotate') private rotateQueue: Queue, // @InjectQueue('walking') private walkingQueue: Queue,
-  ) { }
+  ) {}
   @Client(grpcClientOptions) private readonly client: ClientGrpc;
 
   public _frameInteval: NodeJS.Timeout;
@@ -59,7 +59,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
   private clickQueueSub: any;
 
   private streamServiceSub: any;
-  private roRequestQueue: RxQueue = new RxQueue(5);
+  private roRequestQueue: RxQueue = new RxQueue(8);
   private roQueue: RxQueue = new DelayQueue(20);
   private clickQueue: RxQueue = new DebounceQueue(500);
   private moveQueue: RxQueue = new DelayQueue(30);
@@ -296,8 +296,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
                       this.frameCnt.getValue() < 10
                         ? 3
                         : random_boolean
-                          ? 1
-                          : 3,
+                        ? 1
+                        : 3,
                   };
                   console.log('rotate', stream, Date.now());
                   clearTimeout(this._rotateTimeout);
@@ -336,7 +336,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
         const walkingRes = await this.moveService.move(path, request);
 
         console.log('walking', walkingRes);
-        debugger;
+        // debugger;
         if (walkingRes && !this.onMoving.value) {
           // console.log('walkingRes-front', walkingRes);
           // shift出前第一个镜头数据
@@ -359,8 +359,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
           if (rotateCamData?.length || seqs?.length) {
             const lastSeq = rotateCamData?.length
               ? (Array.from(rotateCamData).concat(
-                seqs,
-              ) as any as StreamReplyType[])
+                  seqs,
+                ) as any as StreamReplyType[])
               : seqs;
 
             console.log('walking --总序列--seqs-2', seqs.length);
@@ -369,7 +369,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
             console.error('walking-move无数据');
             this.cleanMoveSteam();
           }
-          debugger;
+          // debugger;
           // this.lastMoveCnt = this.frameCnt.value + seqs.length;
         }
       });
@@ -410,8 +410,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
                 console.log('joystickRes-seqs', seqs.length);
                 const lastSeq = rotateCamData?.length
                   ? (Array.from(rotateCamData).concat(
-                    seqs,
-                  ) as any as StreamReplyType[])
+                      seqs,
+                    ) as any as StreamReplyType[])
                   : seqs;
                 this.handleSeqMoving(lastSeq);
               } else {
@@ -694,7 +694,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
                 delete redisData.mediaSrc;
                 this.logger.log(
                   `user:${this.user_id}:first render stream` +
-                  JSON.stringify({ path: clipPath, meta: redisData }),
+                    JSON.stringify({ path: clipPath, meta: redisData }),
                 );
                 const status = await this.pushFirstRender(
                   clipPath,