Skip to content

Commit

Permalink
Issue #26 Adjust raycast interval
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmas committed Jan 8, 2024
1 parent a501757 commit d45e155
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/viewer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class Viewer {
targetZoom = 5;
minZoomLevel = 1;
maxZoomLevel = 10;
frameCount = 0;
raycastFrameInterval = 16;

constructor (config?: Record<string, any>) {
this.config = { ...this.config, ...config };
Expand Down Expand Up @@ -215,6 +217,10 @@ class Viewer {
return;
}

if (this.frameCount % this.raycastFrameInterval !== 0) {
return;
}

const satelliteIds = this.findSatellitesAtMouse({
x: event.clientX,
y: event.clientY
Expand Down Expand Up @@ -324,6 +330,8 @@ class Viewer {
if (this.renderer) {
this.renderer.render(this.scene as SatelliteOrbitScene, this.camera as Camera);
}

this.frameCount++;
}

getSatelliteStore () {
Expand Down

0 comments on commit d45e155

Please sign in to comment.