Skip to content

Commit 44bcb3d

Browse files
authored
Refactor rotateToView method to use current camera
1 parent 459e753 commit 44bcb3d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

class.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ namespace Polymesh {
164164

165165
}
166166

167-
rotateToView(width: number, height: number, cam?: view) {
167+
rotateToView(cam?: view) {
168168
if (cam) this.curcam = cam;
169-
const centerX = width >>> 1, centerY = height >>> 1;
169+
const centerX = this.curcam.viewport.width >>> 1, centerY = this.curcam.viewport.height >>> 1;
170170

171171
let tmp = 0
172172
const cosX = fcos(this.curcam.rot.x), sinX = fsin(this.curcam.rot.x);
@@ -371,6 +371,7 @@ namespace Polymesh {
371371
};
372372

373373
__onLoop() {
374+
this.rotateToView();
374375
this.updImgLodCacheSlot();
375376
this.updImgLodCache();
376377
}

0 commit comments

Comments
 (0)