Spaces:
Running
Running
dylanebert
commited on
Commit
·
4dbe7ae
1
Parent(s):
ec3121c
remove deltaTime scaling
Browse files
viewer/src/lib/splat.js/controls/OrbitControls.ts
CHANGED
|
@@ -25,7 +25,7 @@ class OrbitControls extends EventDispatcher {
|
|
| 25 |
orbitSpeed: number = 1;
|
| 26 |
panSpeed: number = 1;
|
| 27 |
zoomSpeed: number = 1;
|
| 28 |
-
dampening: number =
|
| 29 |
|
| 30 |
constructor(camera: Camera, domElement: HTMLElement) {
|
| 31 |
super();
|
|
@@ -51,11 +51,11 @@ class OrbitControls extends EventDispatcher {
|
|
| 51 |
this.desiredTarget.add(up.multiply(dy));
|
| 52 |
}
|
| 53 |
|
| 54 |
-
update(
|
| 55 |
-
this.alpha = this.lerp(this.alpha, this.desiredAlpha, this.dampening
|
| 56 |
-
this.beta = this.lerp(this.beta, this.desiredBeta, this.dampening
|
| 57 |
-
this.radius = this.lerp(this.radius, this.desiredRadius, this.dampening
|
| 58 |
-
this.target = this.target.lerp(this.desiredTarget, this.dampening
|
| 59 |
|
| 60 |
const x = this.target.x + this.radius * Math.sin(this.alpha) * Math.cos(this.beta);
|
| 61 |
const y = this.target.y - this.radius * Math.sin(this.beta);
|
|
|
|
| 25 |
orbitSpeed: number = 1;
|
| 26 |
panSpeed: number = 1;
|
| 27 |
zoomSpeed: number = 1;
|
| 28 |
+
dampening: number = 0.3;
|
| 29 |
|
| 30 |
constructor(camera: Camera, domElement: HTMLElement) {
|
| 31 |
super();
|
|
|
|
| 51 |
this.desiredTarget.add(up.multiply(dy));
|
| 52 |
}
|
| 53 |
|
| 54 |
+
update() {
|
| 55 |
+
this.alpha = this.lerp(this.alpha, this.desiredAlpha, this.dampening);
|
| 56 |
+
this.beta = this.lerp(this.beta, this.desiredBeta, this.dampening);
|
| 57 |
+
this.radius = this.lerp(this.radius, this.desiredRadius, this.dampening);
|
| 58 |
+
this.target = this.target.lerp(this.desiredTarget, this.dampening);
|
| 59 |
|
| 60 |
const x = this.target.x + this.radius * Math.sin(this.alpha) * Math.cos(this.beta);
|
| 61 |
const y = this.target.y - this.radius * Math.sin(this.beta);
|
viewer/src/routes/viewer/[slug]/SplatViewer.ts
CHANGED
|
@@ -184,15 +184,9 @@ export class SplatViewer implements IViewer {
|
|
| 184 |
};
|
| 185 |
|
| 186 |
let vertexCount = 0;
|
| 187 |
-
let lastTime = performance.now();
|
| 188 |
|
| 189 |
const frame = () => {
|
| 190 |
-
|
| 191 |
-
const deltaTime = (currentTime - lastTime) / 1000;
|
| 192 |
-
lastTime = currentTime;
|
| 193 |
-
console.log(deltaTime);
|
| 194 |
-
|
| 195 |
-
this.orbitControls.update(deltaTime);
|
| 196 |
|
| 197 |
this.camera.updateProjectionMatrix(this.canvas.width, this.canvas.height);
|
| 198 |
viewMatrix = SPLAT.getViewMatrix(this.camera);
|
|
|
|
| 184 |
};
|
| 185 |
|
| 186 |
let vertexCount = 0;
|
|
|
|
| 187 |
|
| 188 |
const frame = () => {
|
| 189 |
+
this.orbitControls.update();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
this.camera.updateProjectionMatrix(this.canvas.width, this.canvas.height);
|
| 192 |
viewMatrix = SPLAT.getViewMatrix(this.camera);
|