Skip to content

Commit

Permalink
switch to use frame rate monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemckinstry committed Sep 26, 2024
1 parent 331650c commit 29a31b1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 55 deletions.
40 changes: 0 additions & 40 deletions packages/engine/Source/Core/FpsTracker.js

This file was deleted.

12 changes: 0 additions & 12 deletions packages/engine/Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ import View from "./View.js";
import DebugInspector from "./DebugInspector.js";
import VoxelCell from "./VoxelCell.js";
import VoxelPrimitive from "./VoxelPrimitive.js";
import FpsTracker from "../Core/FpsTracker.js";

const requestRenderAfterFrame = function (scene) {
return function () {
Expand Down Expand Up @@ -163,7 +162,6 @@ function Scene(options) {
this._frameState.scene3DOnly = defaultValue(options.scene3DOnly, false);
this._removeCreditContainer = !hasCreditContainer;
this._creditContainer = creditContainer;
this._fpsTracker = new FpsTracker();

this._canvas = canvas;
this._context = context;
Expand Down Expand Up @@ -1691,15 +1689,6 @@ Object.defineProperties(Scene.prototype, {
return this._globeHeight;
},
},

/**
* @private
*/
fpsTracker: {
get: function () {
return this._fpsTracker;
},
},
});

/**
Expand Down Expand Up @@ -4107,7 +4096,6 @@ Scene.prototype.render = function (time) {
1.0
);
updateFrameNumber(this, frameNumber, time);
this.fpsTracker.updateFrameTimeStamp();
frameState.newFrame = true;
}

Expand Down
5 changes: 4 additions & 1 deletion packages/engine/Source/Scene/ScreenSpaceCameraController.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import MapMode2D from "./MapMode2D.js";
import SceneMode from "./SceneMode.js";
import SceneTransforms from "./SceneTransforms.js";
import TweenCollection from "./TweenCollection.js";
import FrameRateMonitor from "./FrameRateMonitor.js";

/**
* Modifies the camera position and orientation based on mouse input to a canvas.
Expand Down Expand Up @@ -145,6 +146,8 @@ function ScreenSpaceCameraController(scene) {
*/
this.zoomFactor = 5.0;

this.frameRateMonitor = FrameRateMonitor.fromScene(scene);

/**
* The input that allows the user to pan around the map. This only applies in 2D and Columbus view modes.
* <p>
Expand Down Expand Up @@ -575,7 +578,7 @@ function handleZoom(
const minDistance = distanceMeasure - minHeight;

let fpsMultiplier = 1;
const fps = object._scene.fpsTracker.getAverageFps();
const fps = object.frameRateMonitor.lastFramesPerSecond;
if (fps) {
fpsMultiplier = 30 / fps;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
MapMode2D,
SceneMode,
ScreenSpaceCameraController,
FpsTracker,
} from "../../index.js";

import createCamera from "../../../../Specs/createCamera.js";
Expand All @@ -42,7 +41,6 @@ describe("Scene/ScreenSpaceCameraController", function () {
this.screenSpaceCameraController = undefined;
this.cameraUnderground = false;
this.globeHeight = 0.0;
this.fpsTracker = new FpsTracker();
}

function MockGlobe(ellipsoid) {
Expand Down

0 comments on commit 29a31b1

Please sign in to comment.