@illgrenoble/webx-client 1.12.0 → 1.13.0
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/README.md +0 -2
- package/dist/WebXClient.d.ts +4 -2
- package/dist/WebXEngine.d.ts +4 -0
- package/dist/WebXOptions.d.ts +7 -0
- package/dist/display/WebXDisplay.d.ts +6 -2
- package/dist/display/WebXDisplayOptions.d.ts +16 -0
- package/dist/display/WebXDisplayOverlay.d.ts +38 -0
- package/dist/display/WebXMaterial.d.ts +56 -0
- package/dist/display/filter/WebXCRTFilterMaterial.d.ts +36 -0
- package/dist/display/filter/WebXFilter.d.ts +55 -0
- package/dist/display/filter/WebXFilterFactory.d.ts +31 -0
- package/dist/display/filter/WebXFilterMaterial.d.ts +41 -0
- package/dist/display/filter/WebXTestFilterMaterial.d.ts +41 -0
- package/dist/display/filter/index.d.ts +5 -0
- package/dist/display/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/renderer/WebXCanvasRenderer.d.ts +0 -1
- package/dist/texture/WebXTexture.d.ts +53 -4
- package/dist/texture/WebXTextureFactory.d.ts +1 -2
- package/dist/webx-client.cjs +1 -5391
- package/dist/webx-client.esm.js +1 -5322
- package/package.json +4 -3
- package/dist/GuacamoleKeyboard.js +0 -1551
- package/dist/WebXClient.js +0 -513
- package/dist/WebXClient.js.map +0 -1
- package/dist/WebXConnectionHandler.js +0 -96
- package/dist/WebXConnectionHandler.js.map +0 -1
- package/dist/WebXEngine.js +0 -7
- package/dist/WebXEngine.js.map +0 -1
- package/dist/display/WebXCursor.js +0 -139
- package/dist/display/WebXCursor.js.map +0 -1
- package/dist/display/WebXCursorFactory.js +0 -59
- package/dist/display/WebXCursorFactory.js.map +0 -1
- package/dist/display/WebXDisplay.js +0 -507
- package/dist/display/WebXDisplay.js.map +0 -1
- package/dist/display/WebXDisplayOverlay.js +0 -31
- package/dist/display/WebXDisplayOverlay.js.map +0 -1
- package/dist/display/WebXMaterial.js +0 -142
- package/dist/display/WebXMaterial.js.map +0 -1
- package/dist/display/WebXSubImage.d.ts +0 -50
- package/dist/display/WebXSubImage.js +0 -26
- package/dist/display/WebXSubImage.js.map +0 -1
- package/dist/display/WebXTexture.d.ts +0 -6
- package/dist/display/WebXTextureFactory.d.ts +0 -54
- package/dist/display/WebXTextureFactory.js +0 -160
- package/dist/display/WebXTextureFactory.js.map +0 -1
- package/dist/display/WebXTextureFunc.d.ts +0 -3
- package/dist/display/WebXWindow.js +0 -478
- package/dist/display/WebXWindow.js.map +0 -1
- package/dist/display/WebXWindowProperties.d.ts +0 -44
- package/dist/display/WebXWindowProperties.js +0 -25
- package/dist/display/WebXWindowProperties.js.map +0 -1
- package/dist/display/index.js +0 -24
- package/dist/display/index.js.map +0 -1
- package/dist/index.js +0 -25
- package/dist/index.js.map +0 -1
- package/dist/input/GuacamoleKeyboard.js +0 -1551
- package/dist/input/WebXKeyboard.js +0 -44
- package/dist/input/WebXKeyboard.js.map +0 -1
- package/dist/input/WebXMouse.js +0 -231
- package/dist/input/WebXMouse.js.map +0 -1
- package/dist/input/index.js +0 -20
- package/dist/input/index.js.map +0 -1
- package/dist/input/mouse/WebXMouseState.js +0 -217
- package/dist/input/mouse/WebXMouseState.js.map +0 -1
- package/dist/input/mouse/index.js +0 -18
- package/dist/input/mouse/index.js.map +0 -1
- package/dist/instruction/WebXClipboardInstruction.js +0 -23
- package/dist/instruction/WebXClipboardInstruction.js.map +0 -1
- package/dist/instruction/WebXConnectInstruction.js +0 -24
- package/dist/instruction/WebXConnectInstruction.js.map +0 -1
- package/dist/instruction/WebXCursorImageInstruction.js +0 -23
- package/dist/instruction/WebXCursorImageInstruction.js.map +0 -1
- package/dist/instruction/WebXDataAckInstruction.js +0 -26
- package/dist/instruction/WebXDataAckInstruction.js.map +0 -1
- package/dist/instruction/WebXImageInstruction.js +0 -23
- package/dist/instruction/WebXImageInstruction.js.map +0 -1
- package/dist/instruction/WebXInstruction.js +0 -28
- package/dist/instruction/WebXInstruction.js.map +0 -1
- package/dist/instruction/WebXInstructionResponse.js +0 -78
- package/dist/instruction/WebXInstructionResponse.js.map +0 -1
- package/dist/instruction/WebXInstructionType.js +0 -96
- package/dist/instruction/WebXInstructionType.js.map +0 -1
- package/dist/instruction/WebXKeyboardInstruction.js +0 -25
- package/dist/instruction/WebXKeyboardInstruction.js.map +0 -1
- package/dist/instruction/WebXMouseInstruction.js +0 -27
- package/dist/instruction/WebXMouseInstruction.js.map +0 -1
- package/dist/instruction/WebXPongInstruction.js +0 -23
- package/dist/instruction/WebXPongInstruction.js.map +0 -1
- package/dist/instruction/WebXQualityInstruction.js +0 -24
- package/dist/instruction/WebXQualityInstruction.js.map +0 -1
- package/dist/instruction/WebXScreenInstruction.js +0 -20
- package/dist/instruction/WebXScreenInstruction.js.map +0 -1
- package/dist/instruction/WebXShapeInstruction.js +0 -23
- package/dist/instruction/WebXShapeInstruction.js.map +0 -1
- package/dist/instruction/WebXWindowsInstruction.js +0 -21
- package/dist/instruction/WebXWindowsInstruction.js.map +0 -1
- package/dist/instruction/index.js +0 -32
- package/dist/instruction/index.js.map +0 -1
- package/dist/message/WebXClipboardMessage.js +0 -23
- package/dist/message/WebXClipboardMessage.js.map +0 -1
- package/dist/message/WebXConnectionMessage.js +0 -21
- package/dist/message/WebXConnectionMessage.js.map +0 -1
- package/dist/message/WebXCursorImageMessage.js +0 -35
- package/dist/message/WebXCursorImageMessage.js.map +0 -1
- package/dist/message/WebXImageMessage.js +0 -33
- package/dist/message/WebXImageMessage.js.map +0 -1
- package/dist/message/WebXMessage.js +0 -23
- package/dist/message/WebXMessage.js.map +0 -1
- package/dist/message/WebXMessageType.js +0 -64
- package/dist/message/WebXMessageType.js.map +0 -1
- package/dist/message/WebXMouseMessage.js +0 -29
- package/dist/message/WebXMouseMessage.js.map +0 -1
- package/dist/message/WebXNopMessage.js +0 -18
- package/dist/message/WebXNopMessage.js.map +0 -1
- package/dist/message/WebXPingMessage.js +0 -21
- package/dist/message/WebXPingMessage.js.map +0 -1
- package/dist/message/WebXQualityMessage.js +0 -32
- package/dist/message/WebXQualityMessage.js.map +0 -1
- package/dist/message/WebXScreenMessage.js +0 -29
- package/dist/message/WebXScreenMessage.js.map +0 -1
- package/dist/message/WebXShapeMessage.js +0 -29
- package/dist/message/WebXShapeMessage.js.map +0 -1
- package/dist/message/WebXSubImagesMessage.js +0 -29
- package/dist/message/WebXSubImagesMessage.js.map +0 -1
- package/dist/message/WebXWindowsMessage.js +0 -25
- package/dist/message/WebXWindowsMessage.js.map +0 -1
- package/dist/message/index.js +0 -31
- package/dist/message/index.js.map +0 -1
- package/dist/renderer/WebXAlphaStencilBlender.d.ts +0 -30
- package/dist/renderer/WebXAlphaStencilBlender.js +0 -136
- package/dist/renderer/WebXAlphaStencilBlender.js.map +0 -1
- package/dist/renderer/WebXCanvasRenderer.js +0 -190
- package/dist/renderer/WebXCanvasRenderer.js.map +0 -1
- package/dist/renderer/WebXImageBlenderFunc.d.ts +0 -8
- package/dist/renderer/WebXWindowCanvas.js +0 -312
- package/dist/renderer/WebXWindowCanvas.js.map +0 -1
- package/dist/renderer/index.js +0 -20
- package/dist/renderer/index.js.map +0 -1
- package/dist/tracer/WebXDebugImageMessageHandler.js +0 -102
- package/dist/tracer/WebXDebugImageMessageHandler.js.map +0 -1
- package/dist/tracer/WebXHandler.js +0 -3
- package/dist/tracer/WebXHandler.js.map +0 -1
- package/dist/tracer/WebXInstructionHandler.js +0 -13
- package/dist/tracer/WebXInstructionHandler.js.map +0 -1
- package/dist/tracer/WebXMessageHandler.js +0 -13
- package/dist/tracer/WebXMessageHandler.js.map +0 -1
- package/dist/tracer/WebXStatsHandler.js +0 -13
- package/dist/tracer/WebXStatsHandler.js.map +0 -1
- package/dist/tracer/index.js +0 -22
- package/dist/tracer/index.js.map +0 -1
- package/dist/transport/WebXBinarySerializer.js +0 -63
- package/dist/transport/WebXBinarySerializer.js.map +0 -1
- package/dist/transport/WebXInstructionBuffer.js +0 -109
- package/dist/transport/WebXInstructionBuffer.js.map +0 -1
- package/dist/transport/WebXInstructionEncoder.js +0 -294
- package/dist/transport/WebXInstructionEncoder.js.map +0 -1
- package/dist/transport/WebXMessageBuffer.js +0 -104
- package/dist/transport/WebXMessageBuffer.js.map +0 -1
- package/dist/transport/WebXMessageDecoder.js +0 -333
- package/dist/transport/WebXMessageDecoder.js.map +0 -1
- package/dist/transport/index.js +0 -22
- package/dist/transport/index.js.map +0 -1
- package/dist/tunnel/WebXTunnel.js +0 -156
- package/dist/tunnel/WebXTunnel.js.map +0 -1
- package/dist/tunnel/WebXWebSocketTunnel.js +0 -88
- package/dist/tunnel/WebXWebSocketTunnel.js.map +0 -1
- package/dist/tunnel/index.js +0 -19
- package/dist/tunnel/index.js.map +0 -1
- package/dist/utils/WebXColorGenerator.js +0 -46
- package/dist/utils/WebXColorGenerator.js.map +0 -1
- package/dist/utils/WebXVersion.js +0 -25
- package/dist/utils/WebXVersion.js.map +0 -1
- package/dist/utils/index.js +0 -19
- package/dist/utils/index.js.map +0 -1
- package/dist/webx-client.cjs.map +0 -1
- package/dist/webx-client.esm.js.map +0 -1
package/README.md
CHANGED
|
@@ -24,8 +24,6 @@ WebX is a Remote Desktop technology allowing an X11 desktop to be rendered in a
|
|
|
24
24
|
|
|
25
25
|
WebX's principal differentiation to other Remote Desktop technologies is that it manages individual windows within the display rather than treating the desktop as a single image. A couple of advantages with a window-based protocol is that window movement events are efficiently passed to clients (rather than graphically updating regions of the desktop) and similarly it avoids <em>tearing</em> render effects during the movement. WebX aims to optimise the flow of data from the window region capture, the transfer of data and client rendering.
|
|
26
26
|
|
|
27
|
-
> The full source code is openly available and the technology stack can be (relatively) easily demoed but it should be currently considered a work in progress.
|
|
28
|
-
|
|
29
27
|
The WebX remote desktop stack is composed of a number of different projects:
|
|
30
28
|
- [WebX Engine](https://github.com/ILLGrenoble/webx-engine) The WebX Engine is the core of WebX providing a server that connects to an X11 display obtaining window parameters and images. It listens to X11 events and forwards event data to connected clients. Remote clients similarly interact with the desktop and the actions they send to the WebX Engine are forwarded to X11.
|
|
31
29
|
- [WebX Router](https://github.com/ILLGrenoble/webx-router) The WebX Router manages multiple WebX sessions on single host, routing traffic between running WebX Engines and the WebX Relay. It authenticates session creation requests and spawns Xorg, window manager and WebX Engine processes.
|
package/dist/WebXClient.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { WebXTunnel } from './tunnel';
|
|
|
2
2
|
import { WebXDisplay } from './display';
|
|
3
3
|
import { WebXKeyboard, WebXMouse, WebXMouseState } from './input';
|
|
4
4
|
import { WebXDebugImageMessageHandler, WebXHandler } from './tracer';
|
|
5
|
-
import {
|
|
5
|
+
import { WebXOptions } from "./WebXOptions";
|
|
6
6
|
/**
|
|
7
7
|
* Configuration options for the WebXClient.
|
|
8
8
|
*/
|
|
@@ -20,6 +20,7 @@ export interface WebXClientConfig {
|
|
|
20
20
|
*/
|
|
21
21
|
export declare class WebXClient {
|
|
22
22
|
private _tunnel;
|
|
23
|
+
private _options?;
|
|
23
24
|
private readonly _windowImageFactory;
|
|
24
25
|
private readonly _cursorFactory;
|
|
25
26
|
private _tracers;
|
|
@@ -63,8 +64,9 @@ export declare class WebXClient {
|
|
|
63
64
|
* Creates a new instance of the WebXClient.
|
|
64
65
|
*
|
|
65
66
|
* @param _tunnel The WebXTunnel instance used for communication with the WebX Engine.
|
|
67
|
+
* @param _options The WebXOptions to set, for example, display properties
|
|
66
68
|
*/
|
|
67
|
-
constructor(_tunnel: WebXTunnel);
|
|
69
|
+
constructor(_tunnel: WebXTunnel, _options?: WebXOptions);
|
|
68
70
|
/**
|
|
69
71
|
* Connects to the WebX Engine and initializes the communication tunnel.
|
|
70
72
|
*
|
package/dist/WebXEngine.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import { WebXWindow } from './WebXWindow';
|
|
|
4
4
|
import { WebXSubImage, WebXWindowProperties } from '../common';
|
|
5
5
|
import { WebXCursorFactory } from './WebXCursorFactory';
|
|
6
6
|
import { WebXCanvasRenderer } from '../renderer';
|
|
7
|
-
import { Blob } from "buffer";
|
|
8
7
|
import { WebXWindowImageFactory } from "./WebXWindowImageFactory";
|
|
9
8
|
import { WebXTexture } from "../texture";
|
|
9
|
+
import { WebXDisplayOptions } from "./WebXDisplayOptions";
|
|
10
10
|
/**
|
|
11
11
|
* Manages the rendering of the WebX remote desktop using WebGL.
|
|
12
12
|
*
|
|
@@ -18,9 +18,12 @@ export declare class WebXDisplay {
|
|
|
18
18
|
private readonly _scene;
|
|
19
19
|
private readonly _camera;
|
|
20
20
|
private readonly _renderer;
|
|
21
|
+
private readonly _filter;
|
|
21
22
|
private readonly _screen;
|
|
23
|
+
private readonly _isWebGL;
|
|
22
24
|
private readonly _screenWidth;
|
|
23
25
|
private readonly _screenHeight;
|
|
26
|
+
private readonly _options;
|
|
24
27
|
private readonly _windowImageFactory;
|
|
25
28
|
private readonly _containerElement;
|
|
26
29
|
private _windows;
|
|
@@ -92,8 +95,9 @@ export declare class WebXDisplay {
|
|
|
92
95
|
* @param screenHeight The height of the screen.
|
|
93
96
|
* @param windowImageFactory The factory used for obtaining window images.
|
|
94
97
|
* @param cursorFactory The cursor factory used for managing cursors.
|
|
98
|
+
* @param options The display options
|
|
95
99
|
*/
|
|
96
|
-
constructor(containerElement: HTMLElement, screenWidth: number, screenHeight: number, windowImageFactory: WebXWindowImageFactory, cursorFactory: WebXCursorFactory);
|
|
100
|
+
constructor(containerElement: HTMLElement, screenWidth: number, screenHeight: number, windowImageFactory: WebXWindowImageFactory, cursorFactory: WebXCursorFactory, options?: WebXDisplayOptions);
|
|
97
101
|
/**
|
|
98
102
|
* Displays the screen by adding it to the scene.
|
|
99
103
|
*/
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stores generic configuration options for display filters
|
|
3
|
+
*/
|
|
4
|
+
export type WebXFilterOptions = {
|
|
5
|
+
name?: string;
|
|
6
|
+
params?: any;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Stores configuration settings used by the WebX Display
|
|
10
|
+
*/
|
|
11
|
+
export type WebXDisplayOptions = {
|
|
12
|
+
backgroundColor?: string | number;
|
|
13
|
+
forceCanvas?: boolean;
|
|
14
|
+
disableStencil?: boolean;
|
|
15
|
+
filter?: string | WebXFilterOptions;
|
|
16
|
+
};
|
|
@@ -1,10 +1,48 @@
|
|
|
1
1
|
import { WebXCursor } from "./WebXCursor";
|
|
2
|
+
/**
|
|
3
|
+
* WebXDisplayOverlay
|
|
4
|
+
*
|
|
5
|
+
* Manages an absolute-positioned overlay element that hosts the WebX cursor canvas.
|
|
6
|
+
* The overlay is initially hidden and can be toggled via the `visible` setter.
|
|
7
|
+
*/
|
|
2
8
|
export declare class WebXDisplayOverlay {
|
|
3
9
|
private _cursor;
|
|
10
|
+
/**
|
|
11
|
+
* The underlying overlay DOM element.
|
|
12
|
+
*/
|
|
4
13
|
private readonly _overlayElement;
|
|
14
|
+
/**
|
|
15
|
+
* Accessor for the overlay DOM element.
|
|
16
|
+
*
|
|
17
|
+
* @returns The root overlay HTMLElement used to host overlay content.
|
|
18
|
+
*/
|
|
5
19
|
get overlayElement(): HTMLElement;
|
|
20
|
+
/**
|
|
21
|
+
* Show or hide the overlay.
|
|
22
|
+
*
|
|
23
|
+
* @param visible - `true` to show the overlay, `false` to hide it.
|
|
24
|
+
*/
|
|
6
25
|
set visible(visible: boolean);
|
|
26
|
+
/**
|
|
27
|
+
* Create a new WebXDisplayOverlay.
|
|
28
|
+
*
|
|
29
|
+
* @param _cursor - The WebXCursor instance whose canvas will be appended to the overlay.
|
|
30
|
+
*/
|
|
7
31
|
constructor(_cursor: WebXCursor);
|
|
32
|
+
/**
|
|
33
|
+
* Update per-frame overlay logic.
|
|
34
|
+
*
|
|
35
|
+
* Call this from the application's render loop if the overlay needs per-frame updates
|
|
36
|
+
* (positioning, visibility logic, etc.). Currently a no-op.
|
|
37
|
+
*/
|
|
8
38
|
update(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Create and configure the overlay HTMLElement.
|
|
41
|
+
*
|
|
42
|
+
* The element is positioned absolutely to cover its container, uses a high z-index,
|
|
43
|
+
* and starts hidden with overflow clipped.
|
|
44
|
+
*
|
|
45
|
+
* @returns A configured `div` element to use as the display overlay.
|
|
46
|
+
*/
|
|
9
47
|
private _createDisplayOverlayElement;
|
|
10
48
|
}
|
|
@@ -1,13 +1,69 @@
|
|
|
1
1
|
import { Color, ShaderMaterial, Texture } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* WebXMaterial
|
|
4
|
+
*
|
|
5
|
+
* A custom ShaderMaterial that supports an optional diffuse map, alpha map, and stencil
|
|
6
|
+
* texture. It exposes convenience getters/setters for these textures and synchronizes
|
|
7
|
+
* texture transforms (matrix) with the shader uniforms before rendering.
|
|
8
|
+
*/
|
|
2
9
|
export declare class WebXMaterial extends ShaderMaterial {
|
|
10
|
+
/**
|
|
11
|
+
* Diffuse texture (RGB) used to modulate the material color.
|
|
12
|
+
*/
|
|
3
13
|
get map(): Texture;
|
|
14
|
+
/**
|
|
15
|
+
* Set the diffuse texture. Assigning a texture updates the `map` uniform value.
|
|
16
|
+
*/
|
|
4
17
|
set map(value: Texture);
|
|
18
|
+
/**
|
|
19
|
+
* Alpha texture used to control per-pixel opacity (uses the `g` channel).
|
|
20
|
+
*/
|
|
5
21
|
get alphaMap(): Texture;
|
|
22
|
+
/**
|
|
23
|
+
* Set the alpha texture. Assigning a texture updates the `alphaMap` uniform value.
|
|
24
|
+
*/
|
|
6
25
|
set alphaMap(value: Texture);
|
|
26
|
+
/**
|
|
27
|
+
* Stencil texture used to discard fragments where stencil.r < 0.5.
|
|
28
|
+
*/
|
|
7
29
|
get stencilMap(): Texture;
|
|
30
|
+
/**
|
|
31
|
+
* Set the stencil texture. Toggles the `USE_STENCILMAP` shader define when a texture
|
|
32
|
+
* is present or removed.
|
|
33
|
+
*
|
|
34
|
+
* @param value - Texture to use as stencil or `null` to disable stencil testing.
|
|
35
|
+
*/
|
|
8
36
|
set stencilMap(value: Texture);
|
|
37
|
+
/**
|
|
38
|
+
* Material base color (multiplicative with `map` if present).
|
|
39
|
+
*/
|
|
9
40
|
get color(): Color;
|
|
41
|
+
/**
|
|
42
|
+
* Set the material color by copying the provided `Color`.
|
|
43
|
+
*
|
|
44
|
+
* @param value - New base color.
|
|
45
|
+
*/
|
|
10
46
|
set color(value: Color);
|
|
47
|
+
/**
|
|
48
|
+
* Create a new WebXMaterial.
|
|
49
|
+
*
|
|
50
|
+
* Options in `params`:
|
|
51
|
+
* - `color` (Color | number | string): Optional initial color; forwarded to `this.color.set`.
|
|
52
|
+
*
|
|
53
|
+
* The material is configured with:
|
|
54
|
+
* - custom vertex and fragment shaders
|
|
55
|
+
* - uniforms for textures and transforms
|
|
56
|
+
* - `transparent: true` to allow alpha blending
|
|
57
|
+
* - `side: BackSide` suitable for inside-out rendering surfaces
|
|
58
|
+
*
|
|
59
|
+
* @param params - Optional initialization parameters.
|
|
60
|
+
*/
|
|
11
61
|
constructor(params?: any);
|
|
62
|
+
/**
|
|
63
|
+
* Lifecycle hook called before rendering the material.
|
|
64
|
+
*
|
|
65
|
+
* Synchronizes texture matrices to the shader uniforms when the textures' `matrixAutoUpdate`
|
|
66
|
+
* flags are enabled. This allows UV transforms applied to `Texture`s to be used by the shader.
|
|
67
|
+
*/
|
|
12
68
|
onBeforeRender(): void;
|
|
13
69
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { WebXFilterMaterial } from "./WebXFilterMaterial";
|
|
2
|
+
import { Texture } from "three";
|
|
3
|
+
/**
|
|
4
|
+
* WebXCRTFilterMaterial
|
|
5
|
+
*
|
|
6
|
+
* Shader-based post-process material emulating CRT/tube display effects:
|
|
7
|
+
* curvature, scanlines, vignette, noise/flicker, chromatic aberration,
|
|
8
|
+
* brightness/contrast adjustment and phosphor glow. Extends `WebXFilterMaterial`
|
|
9
|
+
* and exposes a `tDiffuse` setter plus an `update()` method for time-based animation.
|
|
10
|
+
*/
|
|
11
|
+
export declare class WebXCRTFilterMaterial extends WebXFilterMaterial {
|
|
12
|
+
/**
|
|
13
|
+
* Start time used to drive `time` uniform (in seconds).
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
private _startTime;
|
|
17
|
+
/**
|
|
18
|
+
* Set the source texture for the filter (`tDiffuse` uniform).
|
|
19
|
+
*
|
|
20
|
+
* @param value - Three.js `Texture` containing the scene to be filtered.
|
|
21
|
+
*/
|
|
22
|
+
set tDiffuse(value: Texture);
|
|
23
|
+
/**
|
|
24
|
+
* Construct a new CRT filter material.
|
|
25
|
+
*
|
|
26
|
+
* @param params - Optional parameter overrides for the filter uniforms.
|
|
27
|
+
*/
|
|
28
|
+
constructor(params?: any);
|
|
29
|
+
/**
|
|
30
|
+
* Update per-frame state for the material.
|
|
31
|
+
*
|
|
32
|
+
* Updates the `time` uniform based on the elapsed time since construction.
|
|
33
|
+
* Called by the owning `WebXFilter` before rendering the filter pass.
|
|
34
|
+
*/
|
|
35
|
+
update(): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { Camera, Scene } from "three";
|
|
3
|
+
import { WebXFilterMaterial } from "./WebXFilterMaterial";
|
|
4
|
+
/**
|
|
5
|
+
* WebXFilter
|
|
6
|
+
*
|
|
7
|
+
* Helper that renders a provided scene into an offscreen render target and then
|
|
8
|
+
* applies a full-screen filter material to that texture providing a post-processing
|
|
9
|
+
* effect to the entire screen.
|
|
10
|
+
*/
|
|
11
|
+
export declare class WebXFilter {
|
|
12
|
+
/**
|
|
13
|
+
* Renderer used for both offscreen and final compositing passes.
|
|
14
|
+
*/
|
|
15
|
+
private _renderer;
|
|
16
|
+
/**
|
|
17
|
+
* Scene containing the single mesh used to draw the filter pass.
|
|
18
|
+
*
|
|
19
|
+
* Present only when a `filterMaterial` was supplied in the constructor.
|
|
20
|
+
*/
|
|
21
|
+
private readonly _sceneScreen;
|
|
22
|
+
/**
|
|
23
|
+
* Material that performs the post-process/filtering step.
|
|
24
|
+
*/
|
|
25
|
+
private readonly _filterMaterial;
|
|
26
|
+
/**
|
|
27
|
+
* Render target used to capture the main scene before the filter is applied.
|
|
28
|
+
* May be `null` if no `filterMaterial` was provided.
|
|
29
|
+
*/
|
|
30
|
+
private readonly _rtTexture;
|
|
31
|
+
/**
|
|
32
|
+
* Create a new WebXFilter.
|
|
33
|
+
*
|
|
34
|
+
* When `filterMaterial` is provided:
|
|
35
|
+
* - An offscreen `WebGLRenderTarget` is created with the given width/height.
|
|
36
|
+
* - The filter material's `tDiffuse` is set to the render target's texture (the fully rendered scene of windows)
|
|
37
|
+
*
|
|
38
|
+
* @param renderer - WebGL renderer used to perform rendering.
|
|
39
|
+
* @param screenWidth - Width to use for the offscreen render target and screen plane.
|
|
40
|
+
* @param screenHeight - Height to use for the offscreen render target and screen plane.
|
|
41
|
+
* @param filterMaterial - Optional filter material; when omitted the filter pass is disabled.
|
|
42
|
+
*/
|
|
43
|
+
constructor(renderer: THREE.WebGLRenderer, screenWidth: number, screenHeight: number, filterMaterial?: WebXFilterMaterial);
|
|
44
|
+
/**
|
|
45
|
+
* Render the scene with optional post-processing filter. If the scene is dirty then all the webx windows
|
|
46
|
+
* are redrawn. The rendering is done on the render texture if present or the default framebuffer otherwise.
|
|
47
|
+
* When filtering is enabled, the sceneScreen is present and the full scene is rendered using the
|
|
48
|
+
* filter post-processing shader to the WebGL canvas.
|
|
49
|
+
*
|
|
50
|
+
* @param scene - The main scene to render into the offscreen target.
|
|
51
|
+
* @param camera - Camera used for both the main render and the filter pass.
|
|
52
|
+
* @param isSceneDirty - When true the main scene will be re-rendered.
|
|
53
|
+
*/
|
|
54
|
+
render(scene: Scene, camera: Camera, isSceneDirty: boolean): void;
|
|
55
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { WebXFilter } from "./WebXFilter";
|
|
2
|
+
import { WebGLRenderer } from "three";
|
|
3
|
+
/**
|
|
4
|
+
* WebXFilterFactory
|
|
5
|
+
*
|
|
6
|
+
* Factory for creating `WebXFilter` instances. Chooses a filter material by name
|
|
7
|
+
* and constructs a `WebXFilter` configured with the provided renderer and screen
|
|
8
|
+
* dimensions. If an unknown filter name is supplied the returned `WebXFilter`
|
|
9
|
+
* will be created without a filter material (no post-process applied).
|
|
10
|
+
*/
|
|
11
|
+
export declare class WebXFilterFactory {
|
|
12
|
+
/**
|
|
13
|
+
* Build a `WebXFilter` configured with a named filter material.
|
|
14
|
+
*
|
|
15
|
+
* @param renderer - Three.js WebGLRenderer used for rendering passes.
|
|
16
|
+
* @param screenWidth - Width in pixels for the offscreen render target and screen plane.
|
|
17
|
+
* @param screenHeight - Height in pixels for the offscreen render target and screen plane.
|
|
18
|
+
* @param name - Name of the filter to create (e.g. `test`, `crt`).
|
|
19
|
+
* @param params - Optional parameters forwarded to the chosen filter material constructor.
|
|
20
|
+
* @returns A `WebXFilter` configured with the selected filter material, or a `WebXFilter` with no filter if the name is unknown.
|
|
21
|
+
*/
|
|
22
|
+
static Build(renderer: WebGLRenderer, screenWidth: number, screenHeight: number, name: string, params: any): WebXFilter;
|
|
23
|
+
/**
|
|
24
|
+
* Create an instance of a filter material by name.
|
|
25
|
+
*
|
|
26
|
+
* @param name - Filter name identifier.
|
|
27
|
+
* @param params - Optional parameters passed to the filter material constructor.
|
|
28
|
+
* @returns An instance of the requested filter material, or `null` if the name is unknown.
|
|
29
|
+
*/
|
|
30
|
+
private static _createFilterMaterial;
|
|
31
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ShaderMaterial, ShaderMaterialParameters, Texture } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* WebXFilterMaterial
|
|
4
|
+
*
|
|
5
|
+
* Abstract base class for post-process filter materials used by `WebXFilter`.
|
|
6
|
+
* Subclasses should provide a shader-based material that consumes a `tDiffuse`
|
|
7
|
+
* texture and updates any time-dependent or parameter-driven uniforms in `update()`.
|
|
8
|
+
*
|
|
9
|
+
* This class extends Three's `ShaderMaterial` to inherit shader and rendering
|
|
10
|
+
* behavior while enforcing a minimal API required by the filter pipeline.
|
|
11
|
+
*/
|
|
12
|
+
export declare abstract class WebXFilterMaterial extends ShaderMaterial {
|
|
13
|
+
/**
|
|
14
|
+
* Construct a new WebXFilterMaterial.
|
|
15
|
+
*
|
|
16
|
+
* The constructor is protected because this class is abstract and intended to
|
|
17
|
+
* be subclassed. Subclasses should call `super(parameters)` to initialize the
|
|
18
|
+
* underlying `ShaderMaterial` with their shader, uniforms and parameters.
|
|
19
|
+
*
|
|
20
|
+
* @param parameters - Optional `ShaderMaterialParameters` forwarded to the `ShaderMaterial` constructor.
|
|
21
|
+
*/
|
|
22
|
+
protected constructor(parameters?: ShaderMaterialParameters);
|
|
23
|
+
/**
|
|
24
|
+
* Update per-frame/stateful data used by the material.
|
|
25
|
+
*
|
|
26
|
+
* Called by the owning `WebXFilter` before the filter pass is rendered. Implementations
|
|
27
|
+
* should update time-based uniforms, animation state, or any derived values needed
|
|
28
|
+
* by the shader.
|
|
29
|
+
*/
|
|
30
|
+
abstract update(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Set the diffuse/source texture for the filter.
|
|
33
|
+
*
|
|
34
|
+
* The filter pipeline will provide the texture containing the previously rendered
|
|
35
|
+
* scene (usually an offscreen render target). Implementations must assign the
|
|
36
|
+
* provided `Texture` to the shader uniform used as the input (commonly named `tDiffuse`).
|
|
37
|
+
*
|
|
38
|
+
* @param value - Texture containing the scene to be filtered.
|
|
39
|
+
*/
|
|
40
|
+
abstract set tDiffuse(value: Texture);
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { WebXFilterMaterial } from "./WebXFilterMaterial";
|
|
2
|
+
import { Texture } from "three";
|
|
3
|
+
/**
|
|
4
|
+
* WebXTestFilterMaterial
|
|
5
|
+
*
|
|
6
|
+
* Simple test filter material used by the WebX filter pipeline. It extends
|
|
7
|
+
* `WebXFilterMaterial` and provides a shader that animates channel mixing
|
|
8
|
+
* driven by a `time` uniform.
|
|
9
|
+
*
|
|
10
|
+
* The material expects a `tDiffuse` texture (the source scene) and updates
|
|
11
|
+
* the `time` uniform each frame in `update()` to animate the effect.
|
|
12
|
+
*
|
|
13
|
+
* @extends WebXFilterMaterial
|
|
14
|
+
*/
|
|
15
|
+
export declare class WebXTestFilterMaterial extends WebXFilterMaterial {
|
|
16
|
+
/**
|
|
17
|
+
* Set the diffuse/source texture for the filter.
|
|
18
|
+
*
|
|
19
|
+
* The texture is assigned to the shader uniform `tDiffuse`.
|
|
20
|
+
*
|
|
21
|
+
* @param value - Texture containing the scene to be filtered.
|
|
22
|
+
*/
|
|
23
|
+
set tDiffuse(value: Texture);
|
|
24
|
+
/**
|
|
25
|
+
* Create a new WebXTestFilterMaterial.
|
|
26
|
+
*
|
|
27
|
+
* Accepts an optional `params` object. If `params.map` is provided it will be
|
|
28
|
+
* used as the initial `tDiffuse` texture. The material defines a `time`
|
|
29
|
+
* uniform used to animate the color-mixing effect.
|
|
30
|
+
*
|
|
31
|
+
* @param params - Optional parameters (e.g. `{ map: Texture }`).
|
|
32
|
+
*/
|
|
33
|
+
constructor(params?: any);
|
|
34
|
+
/**
|
|
35
|
+
* Update per-frame state for the material.
|
|
36
|
+
*
|
|
37
|
+
* Updates the `time` uniform to a value in the range \[0,1\] based on the
|
|
38
|
+
* current time to produce a smooth oscillation.
|
|
39
|
+
*/
|
|
40
|
+
update(): void;
|
|
41
|
+
}
|
package/dist/display/index.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Camera, ColorRepresentation, Object3D, Texture, Vector2 } from 'three';
|
|
2
|
-
import { Blob } from "buffer";
|
|
3
2
|
/**
|
|
4
3
|
* The `WebXCanvasRenderer` class is responsible for rendering a desktop-like environment
|
|
5
4
|
* using HTML elements. It integrates with the Three.js library using 3D objects (meshes, materials, textures)
|
|
@@ -1,18 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* WebXTexture
|
|
3
|
+
*
|
|
4
|
+
* Lightweight container for image or raw pixel data that can be transferred
|
|
5
|
+
* between threads (via postMessage) when backed by an ImageBitmap or ArrayBuffer.
|
|
6
|
+
*
|
|
7
|
+
* Holds either an `image` (ImageBitmap | HTMLImageElement) or raw `data` (Uint8ClampedArray).
|
|
8
|
+
*/
|
|
3
9
|
export declare class WebXTexture {
|
|
10
|
+
/**
|
|
11
|
+
* Image source when available. May be an ImageBitmap (transferable) or a
|
|
12
|
+
* regular HTMLImageElement.
|
|
13
|
+
*/
|
|
4
14
|
image: ImageBitmap | HTMLImageElement;
|
|
15
|
+
/**
|
|
16
|
+
* Raw pixel data (RGBA) when using typed array backing instead of an image.
|
|
17
|
+
*/
|
|
5
18
|
data: Uint8ClampedArray;
|
|
6
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Whether the texture data should be flipped vertically when uploaded.
|
|
21
|
+
*/
|
|
7
22
|
flipY: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Pixel width of the texture.
|
|
25
|
+
*/
|
|
8
26
|
width: number;
|
|
27
|
+
/**
|
|
28
|
+
* Pixel height of the texture.
|
|
29
|
+
*/
|
|
9
30
|
height: number;
|
|
31
|
+
/**
|
|
32
|
+
* Create a new WebXTexture.
|
|
33
|
+
*
|
|
34
|
+
* The `data` parameter accepts an object with optional fields:
|
|
35
|
+
* - `image` - an ImageBitmap or HTMLImageElement to use as the texture source.
|
|
36
|
+
* - `data` - a Uint8ClampedArray with raw pixel data (used when `image` is absent).
|
|
37
|
+
* - `width`/`height` - dimensions to use when `image` is not provided.
|
|
38
|
+
*
|
|
39
|
+
* When `image` is provided it takes precedence for `width`/`height`.
|
|
40
|
+
*
|
|
41
|
+
* @param data - Initialization object for the texture.
|
|
42
|
+
*/
|
|
10
43
|
constructor(data: {
|
|
11
44
|
image?: ImageBitmap | HTMLImageElement;
|
|
12
45
|
data?: Uint8ClampedArray;
|
|
13
46
|
width?: number;
|
|
14
47
|
height?: number;
|
|
15
48
|
});
|
|
49
|
+
/**
|
|
50
|
+
* Determine whether the texture contents are transferable (can be sent via
|
|
51
|
+
* postMessage as a Transferable).
|
|
52
|
+
*
|
|
53
|
+
* Returns true if the texture is backed by an ImageBitmap or by a typed
|
|
54
|
+
* array (`data`).
|
|
55
|
+
*/
|
|
16
56
|
isTransferable(): boolean;
|
|
17
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Retrieve the Transferable object for posting to another thread.
|
|
59
|
+
*
|
|
60
|
+
* - If backed by an ImageBitmap, the ImageBitmap itself is returned.
|
|
61
|
+
* - If using raw `data`, the underlying ArrayBuffer is returned.
|
|
62
|
+
* - Otherwise returns `null`.
|
|
63
|
+
*
|
|
64
|
+
* @returns The Transferable object or `null` if not transferable.
|
|
65
|
+
*/
|
|
66
|
+
get transferable(): Transferable | null;
|
|
18
67
|
}
|
|
@@ -9,10 +9,9 @@ export declare class WebXTextureFactory {
|
|
|
9
9
|
*
|
|
10
10
|
* @param imageData The raw image data as a Uint8Array.
|
|
11
11
|
* @param mimetype The MIME type of the image data (e.g., "image/png").
|
|
12
|
-
* @param colorSpace The color space of the image data (e.g., "srgb").
|
|
13
12
|
* @returns A promise that resolves to the created texture.
|
|
14
13
|
*/
|
|
15
|
-
createTextureFromArray(imageData: Uint8Array, mimetype: string
|
|
14
|
+
createTextureFromArray(imageData: Uint8Array, mimetype: string): Promise<WebXTexture>;
|
|
16
15
|
/**
|
|
17
16
|
* Creates a texture from a Blob object.
|
|
18
17
|
*
|