@fonsecabarreto/genesis-gl-core 0.1.2 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Core/classes/Renderer.js +1 -1
- package/dist/Core/classes/Viewport.d.ts +4 -1
- package/dist/Core/classes/Viewport.js +1 -1
- package/dist/Core/index.d.ts +49 -0
- package/dist/Core/index.js +6 -2
- package/dist/Core/utils/load-glb.js +1 -1
- package/dist/Core/utils/parse-obj.js +1 -1
- package/dist/Game/index.js +2 -2
- package/dist/{chunk-SUNYSY45.js → chunk-LFLNQ35F.js} +1 -1
- package/dist/{chunk-XMW2MS66.js → chunk-WHOIVV44.js} +19 -12
- package/dist/chunk-WHOIVV44.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-XMW2MS66.js.map +0 -1
- /package/dist/{chunk-SUNYSY45.js.map → chunk-LFLNQ35F.js.map} +0 -0
|
@@ -24,11 +24,14 @@ declare class Viewport {
|
|
|
24
24
|
* GL context is reused for viewport resize instead of
|
|
25
25
|
* requesting a new one.
|
|
26
26
|
*/
|
|
27
|
-
constructor(canvasOrId: string | HTMLCanvasElement, width: number, height: number, webglCore?: WebGLCore
|
|
27
|
+
constructor(canvasOrId: string | HTMLCanvasElement, width: number, height: number, webglCore?: WebGLCore, options?: {
|
|
28
|
+
pointerLock?: boolean;
|
|
29
|
+
});
|
|
28
30
|
private setupControls;
|
|
29
31
|
isDraggingCamera(): boolean;
|
|
30
32
|
private resizeCanvas;
|
|
31
33
|
getCanvas(): HTMLCanvasElement;
|
|
34
|
+
getWebGLCore(): WebGLCore | null;
|
|
32
35
|
getScale(): number;
|
|
33
36
|
/** Release event listeners. Call when the viewport is no longer needed. */
|
|
34
37
|
dispose(): void;
|
package/dist/Core/index.d.ts
CHANGED
|
@@ -8,3 +8,52 @@ export { Viewport } from './classes/Viewport.js';
|
|
|
8
8
|
export { K as KeyboardControl } from '../KeyboardControl-5w7Vm0J0.js';
|
|
9
9
|
import 'gl-matrix';
|
|
10
10
|
import './domain/interfaces/Vectors.js';
|
|
11
|
+
|
|
12
|
+
interface IMouseControl {
|
|
13
|
+
enable(): void;
|
|
14
|
+
disable(): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type DragListener = (dx: number, dy: number, button: number) => void;
|
|
18
|
+
declare class MouseDragControl implements IMouseControl {
|
|
19
|
+
private element;
|
|
20
|
+
private listeners;
|
|
21
|
+
isDragging: boolean;
|
|
22
|
+
private dragButton;
|
|
23
|
+
private lastX;
|
|
24
|
+
private lastY;
|
|
25
|
+
constructor(element: HTMLElement);
|
|
26
|
+
enable(): void;
|
|
27
|
+
disable(): void;
|
|
28
|
+
onChange(listener: DragListener): void;
|
|
29
|
+
/** Remove a previously registered listener. */
|
|
30
|
+
removeListener(listener: DragListener): void;
|
|
31
|
+
private onMouseDown;
|
|
32
|
+
private onMouseUp;
|
|
33
|
+
private onMouseMove;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type MoveListener = (dx: number, dy: number) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Captures mouse movement using the Pointer Lock API.
|
|
39
|
+
* Ideal for camera-like controls where the cursor should not hit screen edges.
|
|
40
|
+
*/
|
|
41
|
+
declare class MousePointerLockControl implements IMouseControl {
|
|
42
|
+
private element;
|
|
43
|
+
private sensitivity;
|
|
44
|
+
private listeners;
|
|
45
|
+
private isEnabled;
|
|
46
|
+
private isPointerLocked;
|
|
47
|
+
constructor(element: HTMLElement, sensitivity?: number);
|
|
48
|
+
enable(): void;
|
|
49
|
+
disable(): void;
|
|
50
|
+
onChange(listener: MoveListener): void;
|
|
51
|
+
/** Remove a previously registered listener. */
|
|
52
|
+
removeListener(listener: MoveListener): void;
|
|
53
|
+
setSensitivity(value: number): void;
|
|
54
|
+
private requestPointerLock;
|
|
55
|
+
private onPointerLockChange;
|
|
56
|
+
private onMouseMove;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { MouseDragControl, MousePointerLockControl };
|
package/dist/Core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KeyboardControl
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-LFLNQ35F.js";
|
|
4
4
|
import {
|
|
5
5
|
AnimationClip,
|
|
6
6
|
GL_LINES,
|
|
@@ -26,8 +26,10 @@ import {
|
|
|
26
26
|
} from "../chunk-3ULETMWF.js";
|
|
27
27
|
import {
|
|
28
28
|
Camera,
|
|
29
|
+
MouseDragControl,
|
|
30
|
+
MousePointerLockControl,
|
|
29
31
|
Viewport
|
|
30
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-WHOIVV44.js";
|
|
31
33
|
export {
|
|
32
34
|
AnimationClip,
|
|
33
35
|
Camera,
|
|
@@ -42,6 +44,8 @@ export {
|
|
|
42
44
|
Mesh,
|
|
43
45
|
MeshBuffers,
|
|
44
46
|
Model,
|
|
47
|
+
MouseDragControl,
|
|
48
|
+
MousePointerLockControl,
|
|
45
49
|
Renderer,
|
|
46
50
|
Scene,
|
|
47
51
|
Skeleton,
|
package/dist/Game/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KeyboardInput
|
|
3
3
|
} from "../chunk-P7QOKDLY.js";
|
|
4
|
-
import "../chunk-
|
|
4
|
+
import "../chunk-LFLNQ35F.js";
|
|
5
5
|
import {
|
|
6
6
|
Mesh,
|
|
7
7
|
Renderer,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "../chunk-3ULETMWF.js";
|
|
19
19
|
import {
|
|
20
20
|
Viewport
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-WHOIVV44.js";
|
|
22
22
|
|
|
23
23
|
// src/Game/classes/AnimationController.ts
|
|
24
24
|
var AnimationController = class {
|
|
@@ -13,9 +13,9 @@ var Camera = class {
|
|
|
13
13
|
position = [0, 0, 0];
|
|
14
14
|
// 3D position
|
|
15
15
|
/* Zoom */
|
|
16
|
-
zoom =
|
|
16
|
+
zoom = 1;
|
|
17
17
|
minZoom = 0.5;
|
|
18
|
-
maxZoom =
|
|
18
|
+
maxZoom = 10;
|
|
19
19
|
zoomSpeed = 0.06;
|
|
20
20
|
/* Rotation */
|
|
21
21
|
yaw = 0;
|
|
@@ -121,7 +121,7 @@ var Camera = class {
|
|
|
121
121
|
maxPitch = Math.PI / 2 - 0.01;
|
|
122
122
|
rotate(deltaYaw, deltaPitch) {
|
|
123
123
|
this.yaw += deltaYaw;
|
|
124
|
-
this.pitch
|
|
124
|
+
this.pitch += deltaPitch;
|
|
125
125
|
this.pitch = Math.max(this.minPitch, Math.min(this.maxPitch, this.pitch));
|
|
126
126
|
this._viewDirty = true;
|
|
127
127
|
}
|
|
@@ -265,7 +265,7 @@ var Viewport = class _Viewport {
|
|
|
265
265
|
* GL context is reused for viewport resize instead of
|
|
266
266
|
* requesting a new one.
|
|
267
267
|
*/
|
|
268
|
-
constructor(canvasOrId, width, height, webglCore) {
|
|
268
|
+
constructor(canvasOrId, width, height, webglCore, options = {}) {
|
|
269
269
|
this.width = width;
|
|
270
270
|
this.height = height;
|
|
271
271
|
this.canvas = typeof canvasOrId === "string" ? document.getElementById(canvasOrId) : canvasOrId;
|
|
@@ -275,7 +275,7 @@ var Viewport = class _Viewport {
|
|
|
275
275
|
this.dragControl = new MouseDragControl(this.canvas);
|
|
276
276
|
this.moveControl = new MousePointerLockControl(this.canvas, 0.25);
|
|
277
277
|
this.resizeCanvas();
|
|
278
|
-
this.setupControls();
|
|
278
|
+
this.setupControls(options.pointerLock ?? true);
|
|
279
279
|
window.addEventListener("resize", this.resizeHandler);
|
|
280
280
|
}
|
|
281
281
|
width;
|
|
@@ -290,7 +290,7 @@ var Viewport = class _Viewport {
|
|
|
290
290
|
webglCore = null;
|
|
291
291
|
resizeHandler = () => this.resizeCanvas();
|
|
292
292
|
camera;
|
|
293
|
-
setupControls() {
|
|
293
|
+
setupControls(pointerLock) {
|
|
294
294
|
const zoomInterval = _Viewport.zoomInterval;
|
|
295
295
|
this.wheelControl.onChange((direction) => {
|
|
296
296
|
const now = performance.now();
|
|
@@ -300,11 +300,13 @@ var Viewport = class _Viewport {
|
|
|
300
300
|
this.lastZoomTime = now;
|
|
301
301
|
});
|
|
302
302
|
this.wheelControl.enable();
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
303
|
+
if (pointerLock) {
|
|
304
|
+
this.moveControl.onChange((dx, dy) => {
|
|
305
|
+
const factor = 0.01 * this.camera.zoom;
|
|
306
|
+
this.camera.rotate(-dx * factor, -dy * factor);
|
|
307
|
+
});
|
|
308
|
+
this.moveControl.enable();
|
|
309
|
+
}
|
|
308
310
|
this.canvas.addEventListener("contextmenu", (e) => e.preventDefault());
|
|
309
311
|
}
|
|
310
312
|
isDraggingCamera() {
|
|
@@ -334,6 +336,9 @@ var Viewport = class _Viewport {
|
|
|
334
336
|
getCanvas() {
|
|
335
337
|
return this.canvas;
|
|
336
338
|
}
|
|
339
|
+
getWebGLCore() {
|
|
340
|
+
return this.webglCore;
|
|
341
|
+
}
|
|
337
342
|
getScale() {
|
|
338
343
|
return this.scale;
|
|
339
344
|
}
|
|
@@ -348,6 +353,8 @@ var Viewport = class _Viewport {
|
|
|
348
353
|
|
|
349
354
|
export {
|
|
350
355
|
Camera,
|
|
356
|
+
MouseDragControl,
|
|
357
|
+
MousePointerLockControl,
|
|
351
358
|
Viewport
|
|
352
359
|
};
|
|
353
|
-
//# sourceMappingURL=chunk-
|
|
360
|
+
//# sourceMappingURL=chunk-WHOIVV44.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Core/classes/Camera.ts","../src/Core/controls/Mouse/MouseWheelControl.ts","../src/Core/controls/Mouse/MouseDragControl.ts","../src/Core/controls/Mouse/MousePointerLockControl.ts","../src/Core/classes/Viewport.ts"],"sourcesContent":["import { mat4, vec3, vec4 } from 'gl-matrix';\nimport { Vector3 } from '../domain/interfaces/Vectors';\n\n/**\n * Perspective camera with orbit (yaw/pitch), zoom, and viewport controls.\n */\nexport class Camera {\n public target: Vector3 = [0, 0, 0]; // camera looks at this\n\n /* Translation */\n public position: Vector3 = [0, 0, 0]; // 3D position\n\n /* Zoom */\n public zoom: number = 1;\n public minZoom: number = 0.5;\n public maxZoom: number = 10;\n public zoomSpeed: number = 0.06;\n\n /* Rotation */\n public yaw: number = 0; // horizontal rotation\n public pitch: number = 0.5; // vertical rotation\n\n public near = 0.01;\n public far = 1000.0;\n\n /* Render Utils */\n public lastViewMatrix?: Float32Array;\n public lastProjectionMatrix?: Float32Array;\n\n // ── Cached matrices (rebuilt only when camera state changes) ──\n private readonly _view: mat4 = mat4.create();\n private readonly _proj: mat4 = mat4.create();\n private readonly _mvp: mat4 = mat4.create();\n private _viewDirty = true;\n private _projDirty = true;\n\n constructor(\n public viewportWidth: number,\n public viewportHeight: number,\n ) {}\n\n /** Translate the camera by a delta. */\n move(dx: number, dy: number, dz: number = 0) {\n this.position[0] += dx;\n this.position[1] += dy;\n this.position[2] += dz;\n this._viewDirty = true;\n }\n\n /** Clamp-set the zoom level. */\n setZoom(zoom: number) {\n this.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, zoom));\n this._viewDirty = true;\n this._projDirty = true;\n }\n\n /**\n * Mark the view matrix as dirty so it is rebuilt on the next\n * {@link getViewMatrix} call. Call this after directly mutating\n * {@link target} or {@link position} (e.g. from a follow-camera update).\n */\n invalidate(): void {\n this._viewDirty = true;\n }\n\n /** Zoom by a signed delta (positive = zoom in). */\n zoomBy(delta: number) {\n const factor = Math.exp(delta * this.zoomSpeed);\n this.setZoom(this.zoom * factor);\n }\n\n worldToNDC(x: number, y: number): [number, number] {\n const ndcX = ((x - this.position[0]) / this.viewportWidth) * 2 * this.zoom;\n const ndcY = ((y - this.position[1]) / this.viewportHeight) * 2 * this.zoom;\n return [ndcX, ndcY];\n }\n\n worldScale(scale: [number, number]): [number, number] {\n return [\n (scale[0] / this.viewportWidth) * 2 * this.zoom,\n (scale[1] / this.viewportHeight) * 2 * this.zoom,\n ];\n }\n\n setViewport(width: number, height: number) {\n this.viewportWidth = width;\n this.viewportHeight = height;\n this._projDirty = true;\n }\n\n /** Compute the eye position from yaw/pitch/distance to target. */\n getComputedPosition(): vec3 {\n const radius = vec3.distance(this.position, this.target);\n\n const camX =\n this.target[0] + radius * Math.cos(this.pitch) * Math.sin(this.yaw);\n const camY = this.target[1] + radius * Math.sin(this.pitch);\n const camZ =\n this.target[2] + radius * Math.cos(this.pitch) * Math.cos(this.yaw);\n\n return vec3.fromValues(camX, camY, camZ);\n }\n\n /** Build the view matrix (lookAt). Returns a cached matrix rebuilt only when the camera moves. */\n getViewMatrix(): mat4 {\n if (this._viewDirty) {\n const eye = this.getComputedPosition();\n mat4.lookAt(this._view, eye, this.target, vec3.fromValues(0, 1, 0));\n this._viewDirty = false;\n this.lastViewMatrix = this._view as unknown as Float32Array;\n }\n return this._view;\n }\n\n /** Build the perspective projection matrix. Returns a cached matrix rebuilt only when viewport/zoom changes. */\n getProjectionMatrix(): mat4 {\n if (this._projDirty) {\n const aspect = this.viewportWidth / this.viewportHeight;\n const fov = Math.PI / 4 / this.zoom;\n mat4.perspective(this._proj, fov, aspect, this.near, this.far);\n this._projDirty = false;\n this.lastProjectionMatrix = this._proj as unknown as Float32Array;\n }\n return this._proj;\n }\n\n worldToNDC3D(x: number, y: number, z: number = 0): [number, number, number] {\n const world = vec4.fromValues(x, y, z, 1.0);\n mat4.multiply(this._mvp, this.getProjectionMatrix(), this.getViewMatrix());\n vec4.transformMat4(world, world, this._mvp);\n return [world[0] / world[3], world[1] / world[3], world[2] / world[3]];\n }\n\n worldScale3D(scale: [number, number, number]): [number, number, number] {\n return [\n (scale[0] / this.viewportWidth) * 2 * this.zoom,\n (scale[1] / this.viewportHeight) * 2 * this.zoom,\n (scale[2] / ((this.viewportWidth + this.viewportHeight) / 2)) *\n 2 *\n this.zoom,\n ];\n }\n\n public minPitch: number = -Math.PI / 2 + 1.49;\n public maxPitch: number = Math.PI / 2 - 0.01;\n\n rotate(deltaYaw: number, deltaPitch: number) {\n this.yaw += deltaYaw;\n\n this.pitch += deltaPitch; // this.pitch -= deltaPitch; // ← add deltaPitch here\n this.pitch = Math.max(this.minPitch, Math.min(this.maxPitch, this.pitch));\n this._viewDirty = true;\n }\n}\n","import { IMouseControl } from './IMouseControl';\n\nexport type WheelDirection = 'up' | 'down';\nexport type WheelListener = (direction: WheelDirection, delta: number) => void;\n\nexport class MouseWheelControl implements IMouseControl {\n private listeners: WheelListener[] = [];\n private wheelHandler?: (e: WheelEvent) => void;\n\n public enable() {\n if (this.wheelHandler) return;\n\n this.wheelHandler = (e: WheelEvent) => {\n const direction: WheelDirection = e.deltaY < 0 ? 'up' : 'down';\n this.notify(direction, e.deltaY);\n };\n\n window.addEventListener('wheel', this.wheelHandler, { passive: true });\n }\n\n public disable() {\n if (this.wheelHandler) {\n window.removeEventListener('wheel', this.wheelHandler);\n this.wheelHandler = undefined;\n }\n }\n\n public onChange(listener: WheelListener) {\n this.listeners.push(listener);\n }\n\n /** Remove a previously registered listener. */\n public removeListener(listener: WheelListener) {\n this.listeners = this.listeners.filter((l) => l !== listener);\n }\n\n private notify(direction: WheelDirection, delta: number) {\n for (const listener of this.listeners) listener(direction, delta);\n }\n}\n","import { IMouseControl } from './IMouseControl';\n\nexport type DragListener = (dx: number, dy: number, button: number) => void;\n\nexport class MouseDragControl implements IMouseControl {\n private listeners: DragListener[] = [];\n public isDragging = false;\n\n private dragButton: number = 0; // 0 = left, 2 = right\n private lastX = 0;\n private lastY = 0;\n\n constructor(private element: HTMLElement) {}\n\n enable() {\n this.element.addEventListener('mousedown', this.onMouseDown);\n window.addEventListener('mouseup', this.onMouseUp);\n window.addEventListener('mousemove', this.onMouseMove);\n }\n\n disable() {\n this.element.removeEventListener('mousedown', this.onMouseDown);\n window.removeEventListener('mouseup', this.onMouseUp);\n window.removeEventListener('mousemove', this.onMouseMove);\n }\n\n onChange(listener: DragListener) {\n this.listeners.push(listener);\n }\n\n /** Remove a previously registered listener. */\n removeListener(listener: DragListener) {\n this.listeners = this.listeners.filter((l) => l !== listener);\n }\n\n private onMouseDown = (e: MouseEvent) => {\n this.isDragging = true;\n this.dragButton = e.button;\n\n this.lastX = e.clientX;\n this.lastY = e.clientY;\n };\n\n private onMouseUp = () => {\n this.isDragging = false;\n };\n\n private onMouseMove = (e: MouseEvent) => {\n if (!this.isDragging) return;\n\n const dx = e.clientX - this.lastX;\n const dy = e.clientY - this.lastY;\n\n this.lastX = e.clientX;\n this.lastY = e.clientY;\n\n for (const listener of this.listeners) listener(dx, dy, this.dragButton);\n };\n}\n","import { IMouseControl } from './IMouseControl';\n\nexport type MoveListener = (dx: number, dy: number) => void;\n\n/**\n * Captures mouse movement using the Pointer Lock API.\n * Ideal for camera-like controls where the cursor should not hit screen edges.\n */\nexport class MousePointerLockControl implements IMouseControl {\n private listeners: MoveListener[] = [];\n private isEnabled = false;\n private isPointerLocked = false;\n\n constructor(\n private element: HTMLElement,\n private sensitivity = 1,\n ) {}\n\n enable() {\n if (this.isEnabled) return;\n this.isEnabled = true;\n\n // Must be initiated by user click\n this.element.addEventListener('click', this.requestPointerLock);\n document.addEventListener('pointerlockchange', this.onPointerLockChange);\n document.addEventListener('mousemove', this.onMouseMove);\n }\n\n disable() {\n if (!this.isEnabled) return;\n this.isEnabled = false;\n\n this.element.removeEventListener('click', this.requestPointerLock);\n document.removeEventListener('pointerlockchange', this.onPointerLockChange);\n document.removeEventListener('mousemove', this.onMouseMove);\n\n if (this.isPointerLocked) document.exitPointerLock();\n }\n\n onChange(listener: MoveListener) {\n this.listeners.push(listener);\n }\n\n /** Remove a previously registered listener. */\n removeListener(listener: MoveListener) {\n this.listeners = this.listeners.filter((l) => l !== listener);\n }\n\n setSensitivity(value: number) {\n this.sensitivity = value;\n }\n\n private requestPointerLock = () => {\n this.element.requestPointerLock();\n };\n\n private onPointerLockChange = () => {\n this.isPointerLocked = document.pointerLockElement === this.element;\n };\n\n private onMouseMove = (e: MouseEvent) => {\n if (!this.isPointerLocked) return;\n\n const dx = e.movementX * this.sensitivity;\n const dy = e.movementY * this.sensitivity;\n\n for (const listener of this.listeners) listener(dx, dy);\n };\n}\n","import { Camera } from './Camera';\nimport {\n MouseWheelControl,\n WheelDirection,\n} from '../controls/Mouse/MouseWheelControl';\nimport { MouseDragControl } from '../controls/Mouse/MouseDragControl';\nimport { MousePointerLockControl } from '../controls/Mouse/MousePointerLockControl';\nimport WebGLCore from './WebGLCore';\n\nexport class Viewport {\n private static zoomInterval = 25;\n\n private wheelControl = new MouseWheelControl();\n private dragControl: MouseDragControl;\n private moveControl: MousePointerLockControl;\n\n private lastZoomTime: number = 0;\n private canvas: HTMLCanvasElement;\n private scale: number = 1;\n private webglCore: WebGLCore | null = null;\n private resizeHandler = () => this.resizeCanvas();\n public camera: Camera;\n\n /**\n * @param canvasOrId - An HTMLCanvasElement or the `id` attribute of one.\n * @param width - Logical viewport width.\n * @param height - Logical viewport height.\n * @param webglCore - Optional WebGLCore instance. When provided, the existing\n * GL context is reused for viewport resize instead of\n * requesting a new one.\n */\n constructor(\n canvasOrId: string | HTMLCanvasElement,\n public width: number,\n public height: number,\n webglCore?: WebGLCore,\n options: { pointerLock?: boolean } = {},\n ) {\n this.canvas =\n typeof canvasOrId === 'string'\n ? (document.getElementById(canvasOrId) as HTMLCanvasElement)\n : canvasOrId;\n if (!this.canvas) throw new Error('Canvas not found');\n\n this.webglCore = webglCore ?? null;\n this.camera = new Camera(width, height);\n this.dragControl = new MouseDragControl(this.canvas);\n this.moveControl = new MousePointerLockControl(this.canvas, 0.25);\n\n this.resizeCanvas();\n this.setupControls(options.pointerLock ?? true);\n\n window.addEventListener('resize', this.resizeHandler);\n }\n\n private setupControls(pointerLock: boolean) {\n const zoomInterval = Viewport.zoomInterval;\n\n // Camera Zoom\n this.wheelControl.onChange((direction: WheelDirection) => {\n const now = performance.now();\n if (now - this.lastZoomTime < zoomInterval) return;\n\n const zoomDelta = direction === 'up' ? 1 : -1;\n this.camera.zoomBy(zoomDelta);\n\n this.lastZoomTime = now;\n });\n this.wheelControl.enable();\n\n if (pointerLock) {\n this.moveControl.onChange((dx, dy) => {\n const factor = 0.01 * this.camera.zoom;\n this.camera.rotate(-dx * factor, -dy * factor);\n });\n this.moveControl.enable();\n }\n\n this.canvas.addEventListener('contextmenu', (e) => e.preventDefault());\n }\n\n public isDraggingCamera(): boolean {\n return this.dragControl.isDragging;\n }\n\n private resizeCanvas() {\n const screenWidth = window.innerWidth;\n const screenHeight = window.innerHeight;\n\n const aspectViewport = this.width / this.height;\n const aspectScreen = screenWidth / screenHeight;\n\n let canvasWidth: number, canvasHeight: number;\n\n if (aspectScreen > aspectViewport) {\n canvasHeight = screenHeight;\n canvasWidth = canvasHeight * aspectViewport;\n } else {\n canvasWidth = screenWidth;\n canvasHeight = canvasWidth / aspectViewport;\n }\n\n this.canvas.width = canvasWidth;\n this.canvas.height = canvasHeight;\n\n this.scale = canvasWidth / this.width;\n\n // Reuse the existing GL context when available, otherwise fall back.\n const gl = this.webglCore\n ? this.webglCore.getRenderingContext()\n : (this.canvas.getContext('webgl2') ?? this.canvas.getContext('webgl'));\n\n if (!gl) throw new Error('WebGL not supported');\n gl.viewport(0, 0, canvasWidth, canvasHeight);\n\n this.camera.setViewport(canvasWidth, canvasHeight);\n }\n\n getCanvas(): HTMLCanvasElement {\n return this.canvas;\n }\n\n getWebGLCore(): WebGLCore | null {\n return this.webglCore;\n }\n\n getScale(): number {\n return this.scale;\n }\n\n /** Release event listeners. Call when the viewport is no longer needed. */\n dispose() {\n window.removeEventListener('resize', this.resizeHandler);\n this.wheelControl.disable();\n this.dragControl.disable();\n this.moveControl.disable();\n }\n}\n"],"mappings":";AAAA,SAAS,MAAM,MAAM,YAAY;AAM1B,IAAM,SAAN,MAAa;AAAA,EA8BlB,YACS,eACA,gBACP;AAFO;AACA;AAAA,EACN;AAAA,EAFM;AA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AAC1B,SAAK,YAAY,QAAQ;AACzB,SAAK,YAAY,QAAQ;AAAA,EAC3B;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Core/classes/Camera.ts","../src/Core/controls/Mouse/MouseWheelControl.ts","../src/Core/controls/Mouse/MouseDragControl.ts","../src/Core/controls/Mouse/MousePointerLockControl.ts","../src/Core/classes/Viewport.ts"],"sourcesContent":["import { mat4, vec3, vec4 } from 'gl-matrix';\nimport { Vector3 } from '../domain/interfaces/Vectors';\n\n/**\n * Perspective camera with orbit (yaw/pitch), zoom, and viewport controls.\n */\nexport class Camera {\n public target: Vector3 = [0, 0, 0]; // camera looks at this\n\n /* Translation */\n public position: Vector3 = [0, 0, 0]; // 3D position\n\n /* Zoom */\n public zoom: number = 0.89;\n public minZoom: number = 0.5;\n public maxZoom: number = 1;\n public zoomSpeed: number = 0.06;\n\n /* Rotation */\n public yaw: number = 0; // horizontal rotation\n public pitch: number = 0.5; // vertical rotation\n\n public near = 0.01;\n public far = 1000.0;\n\n /* Render Utils */\n public lastViewMatrix?: Float32Array;\n public lastProjectionMatrix?: Float32Array;\n\n // ── Cached matrices (rebuilt only when camera state changes) ──\n private readonly _view: mat4 = mat4.create();\n private readonly _proj: mat4 = mat4.create();\n private readonly _mvp: mat4 = mat4.create();\n private _viewDirty = true;\n private _projDirty = true;\n\n constructor(\n public viewportWidth: number,\n public viewportHeight: number,\n ) {}\n\n /** Translate the camera by a delta. */\n move(dx: number, dy: number, dz: number = 0) {\n this.position[0] += dx;\n this.position[1] += dy;\n this.position[2] += dz;\n this._viewDirty = true;\n }\n\n /** Clamp-set the zoom level. */\n setZoom(zoom: number) {\n this.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, zoom));\n this._viewDirty = true;\n this._projDirty = true;\n }\n\n /**\n * Mark the view matrix as dirty so it is rebuilt on the next\n * {@link getViewMatrix} call. Call this after directly mutating\n * {@link target} or {@link position} (e.g. from a follow-camera update).\n */\n invalidate(): void {\n this._viewDirty = true;\n }\n\n /** Zoom by a signed delta (positive = zoom in). */\n zoomBy(delta: number) {\n const factor = Math.exp(delta * this.zoomSpeed);\n this.setZoom(this.zoom * factor);\n }\n\n worldToNDC(x: number, y: number): [number, number] {\n const ndcX = ((x - this.position[0]) / this.viewportWidth) * 2 * this.zoom;\n const ndcY = ((y - this.position[1]) / this.viewportHeight) * 2 * this.zoom;\n return [ndcX, ndcY];\n }\n\n worldScale(scale: [number, number]): [number, number] {\n return [\n (scale[0] / this.viewportWidth) * 2 * this.zoom,\n (scale[1] / this.viewportHeight) * 2 * this.zoom,\n ];\n }\n\n setViewport(width: number, height: number) {\n this.viewportWidth = width;\n this.viewportHeight = height;\n this._projDirty = true;\n }\n\n /** Compute the eye position from yaw/pitch/distance to target. */\n getComputedPosition(): vec3 {\n const radius = vec3.distance(this.position, this.target);\n\n const camX =\n this.target[0] + radius * Math.cos(this.pitch) * Math.sin(this.yaw);\n const camY = this.target[1] + radius * Math.sin(this.pitch);\n const camZ =\n this.target[2] + radius * Math.cos(this.pitch) * Math.cos(this.yaw);\n\n return vec3.fromValues(camX, camY, camZ);\n }\n\n /** Build the view matrix (lookAt). Returns a cached matrix rebuilt only when the camera moves. */\n getViewMatrix(): mat4 {\n if (this._viewDirty) {\n const eye = this.getComputedPosition();\n mat4.lookAt(this._view, eye, this.target, vec3.fromValues(0, 1, 0));\n this._viewDirty = false;\n this.lastViewMatrix = this._view as unknown as Float32Array;\n }\n return this._view;\n }\n\n /** Build the perspective projection matrix. Returns a cached matrix rebuilt only when viewport/zoom changes. */\n getProjectionMatrix(): mat4 {\n if (this._projDirty) {\n const aspect = this.viewportWidth / this.viewportHeight;\n const fov = Math.PI / 4 / this.zoom;\n mat4.perspective(this._proj, fov, aspect, this.near, this.far);\n this._projDirty = false;\n this.lastProjectionMatrix = this._proj as unknown as Float32Array;\n }\n return this._proj;\n }\n\n worldToNDC3D(x: number, y: number, z: number = 0): [number, number, number] {\n const world = vec4.fromValues(x, y, z, 1.0);\n mat4.multiply(this._mvp, this.getProjectionMatrix(), this.getViewMatrix());\n vec4.transformMat4(world, world, this._mvp);\n return [world[0] / world[3], world[1] / world[3], world[2] / world[3]];\n }\n\n worldScale3D(scale: [number, number, number]): [number, number, number] {\n return [\n (scale[0] / this.viewportWidth) * 2 * this.zoom,\n (scale[1] / this.viewportHeight) * 2 * this.zoom,\n (scale[2] / ((this.viewportWidth + this.viewportHeight) / 2)) *\n 2 *\n this.zoom,\n ];\n }\n\n public minPitch: number = -Math.PI / 2 + 1.49;\n public maxPitch: number = Math.PI / 2 - 0.01;\n\n rotate(deltaYaw: number, deltaPitch: number) {\n this.yaw += deltaYaw;\n\n this.pitch -= deltaPitch; // ← add deltaPitch here\n this.pitch = Math.max(this.minPitch, Math.min(this.maxPitch, this.pitch));\n this._viewDirty = true;\n }\n}\n","import { IMouseControl } from './IMouseControl';\n\nexport type WheelDirection = 'up' | 'down';\nexport type WheelListener = (direction: WheelDirection, delta: number) => void;\n\nexport class MouseWheelControl implements IMouseControl {\n private listeners: WheelListener[] = [];\n private wheelHandler?: (e: WheelEvent) => void;\n\n public enable() {\n if (this.wheelHandler) return;\n\n this.wheelHandler = (e: WheelEvent) => {\n const direction: WheelDirection = e.deltaY < 0 ? 'up' : 'down';\n this.notify(direction, e.deltaY);\n };\n\n window.addEventListener('wheel', this.wheelHandler, { passive: true });\n }\n\n public disable() {\n if (this.wheelHandler) {\n window.removeEventListener('wheel', this.wheelHandler);\n this.wheelHandler = undefined;\n }\n }\n\n public onChange(listener: WheelListener) {\n this.listeners.push(listener);\n }\n\n /** Remove a previously registered listener. */\n public removeListener(listener: WheelListener) {\n this.listeners = this.listeners.filter((l) => l !== listener);\n }\n\n private notify(direction: WheelDirection, delta: number) {\n for (const listener of this.listeners) listener(direction, delta);\n }\n}\n","import { IMouseControl } from './IMouseControl';\n\nexport type DragListener = (dx: number, dy: number, button: number) => void;\n\nexport class MouseDragControl implements IMouseControl {\n private listeners: DragListener[] = [];\n public isDragging = false;\n\n private dragButton: number = 0; // 0 = left, 2 = right\n private lastX = 0;\n private lastY = 0;\n\n constructor(private element: HTMLElement) {}\n\n enable() {\n this.element.addEventListener('mousedown', this.onMouseDown);\n window.addEventListener('mouseup', this.onMouseUp);\n window.addEventListener('mousemove', this.onMouseMove);\n }\n\n disable() {\n this.element.removeEventListener('mousedown', this.onMouseDown);\n window.removeEventListener('mouseup', this.onMouseUp);\n window.removeEventListener('mousemove', this.onMouseMove);\n }\n\n onChange(listener: DragListener) {\n this.listeners.push(listener);\n }\n\n /** Remove a previously registered listener. */\n removeListener(listener: DragListener) {\n this.listeners = this.listeners.filter((l) => l !== listener);\n }\n\n private onMouseDown = (e: MouseEvent) => {\n this.isDragging = true;\n this.dragButton = e.button;\n\n this.lastX = e.clientX;\n this.lastY = e.clientY;\n };\n\n private onMouseUp = () => {\n this.isDragging = false;\n };\n\n private onMouseMove = (e: MouseEvent) => {\n if (!this.isDragging) return;\n\n const dx = e.clientX - this.lastX;\n const dy = e.clientY - this.lastY;\n\n this.lastX = e.clientX;\n this.lastY = e.clientY;\n\n for (const listener of this.listeners) listener(dx, dy, this.dragButton);\n };\n}\n","import { IMouseControl } from './IMouseControl';\n\nexport type MoveListener = (dx: number, dy: number) => void;\n\n/**\n * Captures mouse movement using the Pointer Lock API.\n * Ideal for camera-like controls where the cursor should not hit screen edges.\n */\nexport class MousePointerLockControl implements IMouseControl {\n private listeners: MoveListener[] = [];\n private isEnabled = false;\n private isPointerLocked = false;\n\n constructor(\n private element: HTMLElement,\n private sensitivity = 1,\n ) {}\n\n enable() {\n if (this.isEnabled) return;\n this.isEnabled = true;\n\n // Must be initiated by user click\n this.element.addEventListener('click', this.requestPointerLock);\n document.addEventListener('pointerlockchange', this.onPointerLockChange);\n document.addEventListener('mousemove', this.onMouseMove);\n }\n\n disable() {\n if (!this.isEnabled) return;\n this.isEnabled = false;\n\n this.element.removeEventListener('click', this.requestPointerLock);\n document.removeEventListener('pointerlockchange', this.onPointerLockChange);\n document.removeEventListener('mousemove', this.onMouseMove);\n\n if (this.isPointerLocked) document.exitPointerLock();\n }\n\n onChange(listener: MoveListener) {\n this.listeners.push(listener);\n }\n\n /** Remove a previously registered listener. */\n removeListener(listener: MoveListener) {\n this.listeners = this.listeners.filter((l) => l !== listener);\n }\n\n setSensitivity(value: number) {\n this.sensitivity = value;\n }\n\n private requestPointerLock = () => {\n this.element.requestPointerLock();\n };\n\n private onPointerLockChange = () => {\n this.isPointerLocked = document.pointerLockElement === this.element;\n };\n\n private onMouseMove = (e: MouseEvent) => {\n if (!this.isPointerLocked) return;\n\n const dx = e.movementX * this.sensitivity;\n const dy = e.movementY * this.sensitivity;\n\n for (const listener of this.listeners) listener(dx, dy);\n };\n}\n","import { Camera } from './Camera';\nimport {\n MouseWheelControl,\n WheelDirection,\n} from '../controls/Mouse/MouseWheelControl';\nimport { MouseDragControl } from '../controls/Mouse/MouseDragControl';\nimport { MousePointerLockControl } from '../controls/Mouse/MousePointerLockControl';\nimport WebGLCore from './WebGLCore';\n\nexport class Viewport {\n private static zoomInterval = 25;\n\n private wheelControl = new MouseWheelControl();\n private dragControl: MouseDragControl;\n private moveControl: MousePointerLockControl;\n\n private lastZoomTime: number = 0;\n private canvas: HTMLCanvasElement;\n private scale: number = 1;\n private webglCore: WebGLCore | null = null;\n private resizeHandler = () => this.resizeCanvas();\n public camera: Camera;\n\n /**\n * @param canvasOrId - An HTMLCanvasElement or the `id` attribute of one.\n * @param width - Logical viewport width.\n * @param height - Logical viewport height.\n * @param webglCore - Optional WebGLCore instance. When provided, the existing\n * GL context is reused for viewport resize instead of\n * requesting a new one.\n */\n constructor(\n canvasOrId: string | HTMLCanvasElement,\n public width: number,\n public height: number,\n webglCore?: WebGLCore,\n ) {\n this.canvas =\n typeof canvasOrId === 'string'\n ? (document.getElementById(canvasOrId) as HTMLCanvasElement)\n : canvasOrId;\n if (!this.canvas) throw new Error('Canvas not found');\n\n this.webglCore = webglCore ?? null;\n this.camera = new Camera(width, height);\n this.dragControl = new MouseDragControl(this.canvas);\n this.moveControl = new MousePointerLockControl(this.canvas, 0.25);\n\n this.resizeCanvas();\n this.setupControls();\n\n window.addEventListener('resize', this.resizeHandler);\n }\n\n private setupControls() {\n const zoomInterval = Viewport.zoomInterval;\n\n // Camera Zoom\n this.wheelControl.onChange((direction: WheelDirection) => {\n const now = performance.now();\n if (now - this.lastZoomTime < zoomInterval) return;\n\n const zoomDelta = direction === 'up' ? 1 : -1;\n this.camera.zoomBy(zoomDelta);\n\n this.lastZoomTime = now;\n });\n this.wheelControl.enable();\n\n // Drag / pan / rotate\n /* this.dragControl.onChange((dx, dy, button) => {\n const factor = 0.01 * this.camera.zoom;\n\n if (button === 2) {\n // Right click = orbit\n this.camera.rotate(-dx * factor, -dy * factor);\n } else if (button === 0) {\n this.camera.target[0] -= (dx * factor) / this.scale;\n this.camera.target[1] += (dy * factor) / this.scale;\n }\n\n });\n this.dragControl.enable(); */\n\n this.moveControl.onChange((dx, dy) => {\n const factor = 0.01 * this.camera.zoom;\n this.camera.rotate(-dx * factor, -dy * factor);\n });\n this.moveControl.enable();\n\n this.canvas.addEventListener('contextmenu', (e) => e.preventDefault());\n }\n\n public isDraggingCamera(): boolean {\n return this.dragControl.isDragging;\n }\n\n private resizeCanvas() {\n const screenWidth = window.innerWidth;\n const screenHeight = window.innerHeight;\n\n const aspectViewport = this.width / this.height;\n const aspectScreen = screenWidth / screenHeight;\n\n let canvasWidth: number, canvasHeight: number;\n\n if (aspectScreen > aspectViewport) {\n canvasHeight = screenHeight;\n canvasWidth = canvasHeight * aspectViewport;\n } else {\n canvasWidth = screenWidth;\n canvasHeight = canvasWidth / aspectViewport;\n }\n\n this.canvas.width = canvasWidth;\n this.canvas.height = canvasHeight;\n\n this.scale = canvasWidth / this.width;\n\n // Reuse the existing GL context when available, otherwise fall back.\n const gl = this.webglCore\n ? this.webglCore.getRenderingContext()\n : (this.canvas.getContext('webgl2') ?? this.canvas.getContext('webgl'));\n\n if (!gl) throw new Error('WebGL not supported');\n gl.viewport(0, 0, canvasWidth, canvasHeight);\n\n this.camera.setViewport(canvasWidth, canvasHeight);\n }\n\n getCanvas(): HTMLCanvasElement {\n return this.canvas;\n }\n\n getScale(): number {\n return this.scale;\n }\n\n /** Release event listeners. Call when the viewport is no longer needed. */\n dispose() {\n window.removeEventListener('resize', this.resizeHandler);\n this.wheelControl.disable();\n this.dragControl.disable();\n this.moveControl.disable();\n }\n}\n"],"mappings":";AAAA,SAAS,MAAM,MAAM,YAAY;AAM1B,IAAM,SAAN,MAAa;AAAA,EA8BlB,YACS,eACA,gBACP;AAFO;AACA;AAAA,EACN;AAAA,EAFM;AAAA,EACA;AAAA,EA/BF,SAAkB,CAAC,GAAG,GAAG,CAAC;AAAA;AAAA;AAAA,EAG1B,WAAoB,CAAC,GAAG,GAAG,CAAC;AAAA;AAAA;AAAA,EAG5B,OAAe;AAAA,EACf,UAAkB;AAAA,EAClB,UAAkB;AAAA,EAClB,YAAoB;AAAA;AAAA,EAGpB,MAAc;AAAA;AAAA,EACd,QAAgB;AAAA;AAAA,EAEhB,OAAO;AAAA,EACP,MAAM;AAAA;AAAA,EAGN;AAAA,EACA;AAAA;AAAA,EAGU,QAAc,KAAK,OAAO;AAAA,EAC1B,QAAc,KAAK,OAAO;AAAA,EAC1B,OAAa,KAAK,OAAO;AAAA,EAClC,aAAa;AAAA,EACb,aAAa;AAAA;AAAA,EAQrB,KAAK,IAAY,IAAY,KAAa,GAAG;AAC3C,SAAK,SAAS,CAAC,KAAK;AACpB,SAAK,SAAS,CAAC,KAAK;AACpB,SAAK,SAAS,CAAC,KAAK;AACpB,SAAK,aAAa;AAAA,EACpB;AAAA;AAAA,EAGA,QAAQ,MAAc;AACpB,SAAK,OAAO,KAAK,IAAI,KAAK,SAAS,KAAK,IAAI,KAAK,SAAS,IAAI,CAAC;AAC/D,SAAK,aAAa;AAClB,SAAK,aAAa;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;A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