@x-viewer/core 0.21.11 → 0.21.12
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/chunks/libredwg-web-C9tIOt6T.js +9 -0
- package/dist/index.esm.js +990 -990
- package/dist/types/core/components/index.d.ts +0 -1
- package/dist/types/core/effect/EffectManager.d.ts +13 -1
- package/dist/types/core/effect/WatermarkShader.d.ts +33 -0
- package/dist/types/core/text-texture/TextTexture.d.ts +5 -0
- package/dist/types/core/viewers/BaseViewer.d.ts +9 -2
- package/dist/types/core/viewers/BimTilesViewer.d.ts +0 -2
- package/dist/types/core/viewers/Viewer3d.d.ts +0 -3
- package/package.json +2 -2
- package/dist/chunks/libredwg-web-Dr5l5_Db.js +0 -9
- package/dist/types/core/components/Watermark.d.ts +0 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
|
-
import {
|
|
2
|
+
import type { BaseViewer } from "../viewers/BaseViewer";
|
|
3
3
|
/**
|
|
4
4
|
* Visual effect manager for viewers.
|
|
5
5
|
*/
|
|
@@ -15,6 +15,8 @@ export declare class EffectManager {
|
|
|
15
15
|
private ssaaRenderPass?;
|
|
16
16
|
private bloomPass?;
|
|
17
17
|
private unrealBloomPass?;
|
|
18
|
+
/** Last pass: tone mapping + output color space (composer RT is linear / half-float). */
|
|
19
|
+
private composerOutputPass?;
|
|
18
20
|
private vertexNormalsHelpers?;
|
|
19
21
|
constructor(viewer: BaseViewer);
|
|
20
22
|
get enabled(): boolean;
|
|
@@ -66,4 +68,14 @@ export declare class EffectManager {
|
|
|
66
68
|
private syncPostprocessingCamera;
|
|
67
69
|
render(): void;
|
|
68
70
|
destroy(): void;
|
|
71
|
+
private createWatermarkPass;
|
|
72
|
+
/** Creates the watermark pass, enables it, and applies the default text and layout. */
|
|
73
|
+
private initWatermark;
|
|
74
|
+
private syncWatermarkResolution;
|
|
75
|
+
private ensureComposerOutputPass;
|
|
76
|
+
/**
|
|
77
|
+
* Keep {@link composerOutputPass} last (screen output), and the GLSL watermark pass immediately before it
|
|
78
|
+
* so it composites in linear space; OutputPass applies renderer tone mapping and output color space to the canvas.
|
|
79
|
+
*/
|
|
80
|
+
private ensurePostprocessPassOrder;
|
|
69
81
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* Full-screen composite: draws {@link tWatermark} in the top-left region over {@link tDiffuse}.
|
|
4
|
+
* Replace `tWatermark` with your texture; keep alpha for blending.
|
|
5
|
+
*/
|
|
6
|
+
export declare const WatermarkShader: {
|
|
7
|
+
name: string;
|
|
8
|
+
uniforms: {
|
|
9
|
+
tDiffuse: {
|
|
10
|
+
value: null;
|
|
11
|
+
};
|
|
12
|
+
tWatermark: {
|
|
13
|
+
value: null;
|
|
14
|
+
};
|
|
15
|
+
uResolution: {
|
|
16
|
+
value: THREE.Vector2;
|
|
17
|
+
};
|
|
18
|
+
/** Left and top margin in pixels. */
|
|
19
|
+
uMarginPx: {
|
|
20
|
+
value: THREE.Vector2;
|
|
21
|
+
};
|
|
22
|
+
/** Draw region size in pixels (image is stretched to this rect). */
|
|
23
|
+
uAreaPx: {
|
|
24
|
+
value: THREE.Vector2;
|
|
25
|
+
};
|
|
26
|
+
/** Extra multiplier on texture alpha (0–1). */
|
|
27
|
+
uOpacity: {
|
|
28
|
+
value: number;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
vertexShader: string;
|
|
32
|
+
fragmentShader: string;
|
|
33
|
+
};
|
|
@@ -16,6 +16,11 @@ export interface TextTextureConfig {
|
|
|
16
16
|
padding?: number;
|
|
17
17
|
strokeColor?: string;
|
|
18
18
|
strokeWidth?: number;
|
|
19
|
+
/**
|
|
20
|
+
* When true, clears the canvas to transparent instead of filling {@link backgroundColor}.
|
|
21
|
+
* Use for overlays (e.g. GLSL watermarks) where only the glyphs should be visible.
|
|
22
|
+
*/
|
|
23
|
+
clearBackground?: boolean;
|
|
19
24
|
}
|
|
20
25
|
export declare function toCssFont(family: string, size: number, style: string, variant: string, weight: string): string;
|
|
21
26
|
export declare class TextTexture extends THREE.Texture {
|
|
@@ -3,11 +3,12 @@ import { CSS2DRenderer } from "three/examples/jsm/renderers/CSS2DRenderer.js";
|
|
|
3
3
|
import { ViewerName } from "./Constants";
|
|
4
4
|
import type { Plugin } from "./Plugin";
|
|
5
5
|
import { ViewerEvent } from "./ViewerEvent";
|
|
6
|
-
import { ProgressBar, Spinner
|
|
6
|
+
import { ProgressBar, Spinner } from "../components";
|
|
7
7
|
import { BaseViewerConfig, CameraInfo, CameraProjection, ModelConfig, Viewpoint } from "../../core/Configs";
|
|
8
8
|
import { CameraManager } from "../../core/camera";
|
|
9
9
|
import { CanvasRender } from "../../core/canvas";
|
|
10
10
|
import { Container } from "../../core/components/Container";
|
|
11
|
+
import { EffectManager } from "../../core/effect";
|
|
11
12
|
import { FontManager } from "../../core/font";
|
|
12
13
|
import { ZoomToRectHelper } from "../../core/helpers";
|
|
13
14
|
import { InputManager } from "../../core/input-manager";
|
|
@@ -44,7 +45,6 @@ export declare abstract class BaseViewer<BaseViewerEvents extends ViewerEvents =
|
|
|
44
45
|
protected css2dRenderer: CSS2DRenderer;
|
|
45
46
|
protected spinner: Spinner;
|
|
46
47
|
protected progressBar?: ProgressBar;
|
|
47
|
-
protected watermark?: Watermark;
|
|
48
48
|
protected loaderManager: ModelLoaderManager;
|
|
49
49
|
protected zoomToRectHelper?: ZoomToRectHelper;
|
|
50
50
|
protected interaction?: Interaction;
|
|
@@ -86,6 +86,13 @@ export declare abstract class BaseViewer<BaseViewerEvents extends ViewerEvents =
|
|
|
86
86
|
abstract clearHighlight(): void;
|
|
87
87
|
getRaycaster(): THREE.Raycaster;
|
|
88
88
|
getPickManager(): PickManager;
|
|
89
|
+
/**
|
|
90
|
+
* Post-processing (GLSL watermark, optional FXAA/SSAO, …). Shared by 2D and 3D viewers.
|
|
91
|
+
* Created on first access so construction never runs before {@link BaseViewer.cameraManager} exists.
|
|
92
|
+
*/
|
|
93
|
+
protected get effect(): EffectManager;
|
|
94
|
+
/** Visual effects / composer (same instance as {@link BaseViewer.effect}). */
|
|
95
|
+
get effectManager(): EffectManager;
|
|
89
96
|
getViewerConfig(): BaseViewerConfig;
|
|
90
97
|
getSpinner(): Spinner;
|
|
91
98
|
getFontManager(): FontManager | undefined;
|
|
@@ -2,7 +2,6 @@ import * as THREE from "three";
|
|
|
2
2
|
import { BaseViewer } from "./BaseViewer";
|
|
3
3
|
import { ViewerName } from "./Constants";
|
|
4
4
|
import { Viewer3dConfig, ModelConfig, Viewpoint } from "../../core/Configs";
|
|
5
|
-
import { EffectManager } from "../../core/effect";
|
|
6
5
|
import { EventInfo } from "../../core/input-manager/InputManager";
|
|
7
6
|
import { BimTilesModel, TileObject } from "../../core/model";
|
|
8
7
|
/**
|
|
@@ -11,7 +10,6 @@ import { BimTilesModel, TileObject } from "../../core/model";
|
|
|
11
10
|
export declare class BimTilesViewer extends BaseViewer {
|
|
12
11
|
name: ViewerName;
|
|
13
12
|
protected pickUsageScene: THREE.Scene;
|
|
14
|
-
protected effect: EffectManager;
|
|
15
13
|
loadedModels: BimTilesModel[];
|
|
16
14
|
selectedObject?: TileObject;
|
|
17
15
|
/**
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
import { BaseViewer } from "./BaseViewer";
|
|
3
3
|
import { ViewerName } from "./Constants";
|
|
4
|
-
import { EffectManager } from "../effect";
|
|
5
4
|
import { Model3d } from "../model";
|
|
6
5
|
import { Viewer3dConfig, ModelConfig, Viewpoint } from "../../core/Configs";
|
|
7
6
|
export declare class Viewer3d extends BaseViewer {
|
|
8
7
|
name: ViewerName;
|
|
9
8
|
loadedModels: Model3d[];
|
|
10
9
|
distanceCullingFactor: number;
|
|
11
|
-
protected effect: EffectManager;
|
|
12
10
|
private shouldDispatchModelLoadEvent;
|
|
13
11
|
constructor(viewerCfg: Viewer3dConfig, homeView?: Viewpoint);
|
|
14
12
|
protected setDefaultBackground(): void;
|
|
15
13
|
is3d(): boolean;
|
|
16
|
-
get effectManager(): EffectManager;
|
|
17
14
|
loadLocalModel(url: string, modelCfg: ModelConfig, manager?: THREE.LoadingManager, onProgress?: (event: ProgressEvent) => void): Promise<void>;
|
|
18
15
|
loadModel(modelCfg: ModelConfig, onProgress?: ((event: ProgressEvent<EventTarget>) => void) | undefined): Promise<void>;
|
|
19
16
|
private loadModelInternal;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x-viewer/core",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.12",
|
|
4
4
|
"homepage": "https://dwg.thingraph.site/",
|
|
5
5
|
"description": "WebGL-based 2D/3D viewer engine built on Three.js. View DWG/DXF/PDF files in the browser with no server required. Supports glTF, OBJ, FBX, IFC, STL and BimTiles formats.",
|
|
6
|
-
"author": "
|
|
6
|
+
"author": "Thingraph",
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"dwg",
|