viral-viewer-2 6.7.7 → 6.7.9
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/components/camera/viral-camera.d.ts +6 -0
- package/dist/components/custom-objects/viral-merged-mesh.d.ts +47 -8
- package/dist/components/custom-objects/viral-merged-model.d.ts +34 -2
- package/dist/components/data-manager/viral-data-manager.d.ts +24 -1
- package/dist/components/post-processing/post-processing-renderer.d.ts +6 -1
- package/dist/components/renderer/viral-renderer.d.ts +7 -0
- package/dist/components/scene/viral-scene.d.ts +5 -1
- package/dist/components/visibility-manager/viral-visibility-manager.d.ts +21 -0
- package/dist/components/worker/bounding-box-intersect.worker.d.ts +18 -0
- package/dist/components/worker/bounding-box.worker.d.ts +10 -0
- package/dist/components/worker/check-clash.worker.d.ts +9 -0
- package/dist/components/worker-script/bounding-box-intersect.script.d.ts +1 -0
- package/dist/components/worker-script/bounding-box.script.d.ts +1 -0
- package/dist/components/worker-script/check-clash.script.d.ts +1 -0
- package/dist/const/colors.d.ts +4 -0
- package/dist/index.mjs +12779 -11755
- package/dist/types.d.ts +11 -0
- package/dist/utils/math.d.ts +44 -0
- package/dist/utils/threejs.d.ts +1 -0
- package/package.json +1 -1
|
@@ -28,6 +28,12 @@ export declare class ViralCamera {
|
|
|
28
28
|
focusModelByName(objectName?: string): void;
|
|
29
29
|
getState(): ViralViewerState | null;
|
|
30
30
|
restoreState(state: ViralViewerState): void;
|
|
31
|
+
modelId: string;
|
|
32
|
+
elementId: string;
|
|
33
|
+
zoomTo(element?: {
|
|
34
|
+
modelId: string;
|
|
35
|
+
elementId: string;
|
|
36
|
+
}): void;
|
|
31
37
|
clientToWorld(items?: Object3D[]): import("three").Intersection<Object3D<import("three").Object3DEventMap>>[] | null;
|
|
32
38
|
worldToClient(point: Vector3): Vector3 | null;
|
|
33
39
|
worldToClient2(point: Vector3): Vector3 | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BufferGeometry, Color, LineBasicMaterial, Material, Mesh, Vector3 } from "three";
|
|
1
|
+
import { Box3, BufferGeometry, Color, LineBasicMaterial, Material, Mesh, Vector3 } from "three";
|
|
2
2
|
import { BufferElement } from "../..";
|
|
3
3
|
export declare class ViralMergedMesh extends Mesh {
|
|
4
4
|
globalMaterialIndex: number;
|
|
@@ -22,6 +22,7 @@ export declare class ViralMergedMesh extends Mesh {
|
|
|
22
22
|
modelId: string;
|
|
23
23
|
elementId: string;
|
|
24
24
|
}[]): BufferElement[];
|
|
25
|
+
getElementsByModel(modelIndex: number): BufferElement[];
|
|
25
26
|
private _edgeLines;
|
|
26
27
|
enableEdge(material: LineBasicMaterial): void;
|
|
27
28
|
disableEdge(): void;
|
|
@@ -29,6 +30,16 @@ export declare class ViralMergedMesh extends Mesh {
|
|
|
29
30
|
select(elements: {
|
|
30
31
|
modelId: string;
|
|
31
32
|
elementId: string;
|
|
33
|
+
}[], excepts?: {
|
|
34
|
+
elements: {
|
|
35
|
+
modelId: string;
|
|
36
|
+
elementId: string;
|
|
37
|
+
}[];
|
|
38
|
+
color: {
|
|
39
|
+
r: number;
|
|
40
|
+
g: number;
|
|
41
|
+
b: number;
|
|
42
|
+
};
|
|
32
43
|
}[]): void;
|
|
33
44
|
private _hidingElements;
|
|
34
45
|
hide(elements?: {
|
|
@@ -40,6 +51,14 @@ export declare class ViralMergedMesh extends Mesh {
|
|
|
40
51
|
modelId: string;
|
|
41
52
|
elementId: string;
|
|
42
53
|
}[]): void;
|
|
54
|
+
/**
|
|
55
|
+
* Isolate whole model
|
|
56
|
+
* @param modelIds
|
|
57
|
+
*/
|
|
58
|
+
isolateModel(modelIds: string[]): void;
|
|
59
|
+
/**
|
|
60
|
+
* reset visibility also color
|
|
61
|
+
*/
|
|
43
62
|
reset(): void;
|
|
44
63
|
updateVisibility(bufferElements: BufferElement[]): void;
|
|
45
64
|
findElementByFaceIndex(faceIndex: number): {
|
|
@@ -47,13 +66,13 @@ export declare class ViralMergedMesh extends Mesh {
|
|
|
47
66
|
elementId: string;
|
|
48
67
|
} | null;
|
|
49
68
|
/**
|
|
50
|
-
*
|
|
51
|
-
* @param modelId
|
|
52
|
-
* @param elementId
|
|
53
|
-
* @param color
|
|
54
|
-
* @returns
|
|
69
|
+
* Changes the color of multiple elements in the merged mesh.
|
|
70
|
+
* @param elements - An array of elements, each containing `modelId`, `elementId`, and `color`.
|
|
55
71
|
*/
|
|
56
|
-
changeColor(
|
|
72
|
+
changeColor(elements: {
|
|
73
|
+
modelId: string;
|
|
74
|
+
elementId: string;
|
|
75
|
+
}[], color: {
|
|
57
76
|
r: number;
|
|
58
77
|
g: number;
|
|
59
78
|
b: number;
|
|
@@ -61,7 +80,23 @@ export declare class ViralMergedMesh extends Mesh {
|
|
|
61
80
|
/**
|
|
62
81
|
* Reset color of an element back to the original color
|
|
63
82
|
*/
|
|
64
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Resets the color of an element back to the original color or the entire mesh if no element is specified.
|
|
85
|
+
* @param modelId - The model ID to reset. Pass `null` to reset the entire mesh.
|
|
86
|
+
* @param elementId - The element ID to reset. Ignored if `modelId` is `null`.
|
|
87
|
+
* @param excepts - In case we dont want to convert back to original color
|
|
88
|
+
*/
|
|
89
|
+
resetColor(modelId: string | null, elementId?: string, excepts?: {
|
|
90
|
+
elements: {
|
|
91
|
+
modelId: string;
|
|
92
|
+
elementId: string;
|
|
93
|
+
}[];
|
|
94
|
+
color: {
|
|
95
|
+
r: number;
|
|
96
|
+
g: number;
|
|
97
|
+
b: number;
|
|
98
|
+
};
|
|
99
|
+
}[]): void;
|
|
65
100
|
assignUniqueFaceColors(): void;
|
|
66
101
|
/**
|
|
67
102
|
* Assigns a random color to each element in the merged geometry.
|
|
@@ -84,6 +119,10 @@ export declare class ViralMergedMesh extends Mesh {
|
|
|
84
119
|
disableLights(): void;
|
|
85
120
|
calculateCenter(buffer: Float32Array): Vector3 | null;
|
|
86
121
|
getFarthestDistance(centerPoint: Vector3, placePoints: Vector3[]): number;
|
|
122
|
+
getElementBox(element: {
|
|
123
|
+
modelId: string;
|
|
124
|
+
elementId: string;
|
|
125
|
+
}): Box3 | null;
|
|
87
126
|
/**
|
|
88
127
|
* ! Disposes of the ViralMergedMesh properly, when dispose we dont need to dispose material
|
|
89
128
|
*/
|
|
@@ -23,20 +23,52 @@ export declare class ViralMergedModel extends Mesh {
|
|
|
23
23
|
modelId: string;
|
|
24
24
|
elementId: string;
|
|
25
25
|
}[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* Isolate whole model
|
|
28
|
+
* @param modelIds
|
|
29
|
+
*/
|
|
30
|
+
isolateModel(modelIds: string[]): void;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param elements
|
|
34
|
+
* @param excepts exeception list
|
|
35
|
+
*/
|
|
26
36
|
select(elements: {
|
|
27
37
|
modelId: string;
|
|
28
38
|
elementId: string;
|
|
39
|
+
}[], excepts?: {
|
|
40
|
+
elements: {
|
|
41
|
+
modelId: string;
|
|
42
|
+
elementId: string;
|
|
43
|
+
}[];
|
|
44
|
+
color: {
|
|
45
|
+
r: number;
|
|
46
|
+
g: number;
|
|
47
|
+
b: number;
|
|
48
|
+
};
|
|
29
49
|
}[]): void;
|
|
30
50
|
getElements(elements: {
|
|
31
51
|
modelId: string;
|
|
32
52
|
elementId: string;
|
|
33
53
|
}[]): BufferElement[];
|
|
34
|
-
|
|
54
|
+
getElementsByModel(modelIndex: number): BufferElement[];
|
|
55
|
+
changeColor(elements: {
|
|
56
|
+
modelId: string;
|
|
57
|
+
elementId: string;
|
|
58
|
+
}[], color: {
|
|
35
59
|
r: number;
|
|
36
60
|
g: number;
|
|
37
61
|
b: number;
|
|
38
62
|
}): void;
|
|
39
|
-
|
|
63
|
+
getElementBox(element: {
|
|
64
|
+
modelId: string;
|
|
65
|
+
elementId: string;
|
|
66
|
+
}): Box3;
|
|
67
|
+
/**
|
|
68
|
+
* reset visibility/ geometries only not reset color
|
|
69
|
+
*/
|
|
70
|
+
resetVisibility(): void;
|
|
71
|
+
resetColor(): void;
|
|
40
72
|
enableEdge(material: LineBasicMaterial): void;
|
|
41
73
|
disableEdge(): void;
|
|
42
74
|
/**
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { DataTree, ViralViewerApi } from "../..";
|
|
1
|
+
import { CheckClashResult, CompareModelsResult, DataTree, ViralViewerApi } from "../..";
|
|
2
2
|
export declare class ViralDataManager {
|
|
3
3
|
viralViewerApi: ViralViewerApi;
|
|
4
4
|
dataTree: DataTree[];
|
|
5
5
|
private fetchDataWorker;
|
|
6
6
|
private buildTreeNodeWorker;
|
|
7
|
+
private _boundingBoxWorker;
|
|
8
|
+
private _boundingBoxIntersectWorker;
|
|
9
|
+
private _checkClashWorker;
|
|
7
10
|
constructor(viralViewerApi: ViralViewerApi);
|
|
8
11
|
normalFetch(url: string, byteRangeStart?: number, byteRangeEnd?: number): Promise<Response>;
|
|
9
12
|
/**
|
|
@@ -31,4 +34,24 @@ export declare class ViralDataManager {
|
|
|
31
34
|
modelId: string;
|
|
32
35
|
elementId: string;
|
|
33
36
|
}[];
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param oldModelIndex old model, default is 0
|
|
40
|
+
* @param newModelIndex current model, default is 1
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
compareModels(oldModelIndex?: number, newModelIndex?: number): CompareModelsResult;
|
|
44
|
+
uncompareModels(): void;
|
|
45
|
+
private _getDiffKeys;
|
|
46
|
+
private _areListsEqual;
|
|
47
|
+
private _areObjectsEqual;
|
|
48
|
+
firstElementId: string;
|
|
49
|
+
secondElementId: string;
|
|
50
|
+
checkClash(firstElementId?: string, secondElementId?: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Check model it self or check with other model
|
|
53
|
+
* @param firstModelIndex
|
|
54
|
+
* @param secondModelIndex
|
|
55
|
+
*/
|
|
56
|
+
checkClashModels(firstModelIndex?: number, secondModelIndex?: number): Promise<CheckClashResult>;
|
|
34
57
|
}
|
|
@@ -2,7 +2,7 @@ import { Camera, Scene, WebGLRenderer } from "three";
|
|
|
2
2
|
import { EffectComposer } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
3
3
|
import { SMAAPass } from "three/examples/jsm/postprocessing/SMAAPass";
|
|
4
4
|
import { ShaderPass } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
5
|
-
import { SSAARenderPass, SSAOPass } from "three/examples/jsm/Addons";
|
|
5
|
+
import { SSAARenderPass, SSAOPass, TAARenderPass } from "three/examples/jsm/Addons";
|
|
6
6
|
import { ViralViewerApi } from "../..";
|
|
7
7
|
import { OutlinePass } from "three/examples/jsm/postprocessing/OutlinePass";
|
|
8
8
|
export declare class PostProcessingRenderer {
|
|
@@ -15,12 +15,14 @@ export declare class PostProcessingRenderer {
|
|
|
15
15
|
smaaPass: SMAAPass | null;
|
|
16
16
|
ssaaPass: SSAARenderPass | null;
|
|
17
17
|
fxaaPass: ShaderPass | null;
|
|
18
|
+
taaPass: TAARenderPass | null;
|
|
18
19
|
sobelPass: ShaderPass | null;
|
|
19
20
|
whitePass: ShaderPass | null;
|
|
20
21
|
shadowRemovalPass: ShaderPass | null;
|
|
21
22
|
outlinePass: OutlinePass | null;
|
|
22
23
|
n8aoPass: any;
|
|
23
24
|
constructor(renderer: WebGLRenderer, viralViewerApi: ViralViewerApi);
|
|
25
|
+
isWebGL2Available(): boolean;
|
|
24
26
|
render(): void;
|
|
25
27
|
initRenderPass(scene: Scene, camera: Camera): void;
|
|
26
28
|
initGammaPass(): void;
|
|
@@ -32,6 +34,9 @@ export declare class PostProcessingRenderer {
|
|
|
32
34
|
initSMAAPass(): void;
|
|
33
35
|
initSSAAPass(scene: Scene, camera: Camera): void;
|
|
34
36
|
initFXAAPass(): void;
|
|
37
|
+
initTAAPass(scene: Scene, camera: Camera): void;
|
|
38
|
+
enableTAA(): void;
|
|
39
|
+
disableTAA(): void;
|
|
35
40
|
initSSAOPass(scene: Scene, camera: Camera): void;
|
|
36
41
|
enableSSAO(): void;
|
|
37
42
|
disableSSAO(): void;
|
|
@@ -9,6 +9,13 @@ export declare class ViralRenderer {
|
|
|
9
9
|
updateSize(width: number, height: number): void;
|
|
10
10
|
private renderTimeout;
|
|
11
11
|
render(): void;
|
|
12
|
+
private _t;
|
|
12
13
|
private performRender;
|
|
14
|
+
private jitterOffsets;
|
|
15
|
+
private jitterIndex;
|
|
16
|
+
private size;
|
|
17
|
+
private samples;
|
|
18
|
+
applyJitter(): void;
|
|
19
|
+
generateJitterOffsets(samples?: number): number[][];
|
|
13
20
|
screenshot(): string;
|
|
14
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Scene, DirectionalLight, Mesh, Object3D, Light, CameraHelper, OrthographicCamera, PerspectiveCamera } from "three";
|
|
1
|
+
import { Scene, DirectionalLight, Mesh, Object3D, MeshBasicMaterial, Light, CameraHelper, Box3, OrthographicCamera, PerspectiveCamera } from "three";
|
|
2
2
|
import { ViralViewerApi } from "../../viral-viewer-api";
|
|
3
3
|
import { ViralMergedModel } from "../custom-objects/viral-merged-model";
|
|
4
4
|
import { ViralMainModel } from "../custom-objects/viral-main.model";
|
|
@@ -40,4 +40,8 @@ export declare class ViralScene {
|
|
|
40
40
|
* Add box helper to check mesh
|
|
41
41
|
*/
|
|
42
42
|
addBoxHelper(mesh: Object3D): void;
|
|
43
|
+
addBox3Helper(mesh: Box3): void;
|
|
44
|
+
fullScreenQuadMaterial: MeshBasicMaterial;
|
|
45
|
+
fullScreenQuad: Mesh<any, MeshBasicMaterial> | null;
|
|
46
|
+
addFullscreenQuad(): void;
|
|
43
47
|
}
|
|
@@ -33,6 +33,24 @@ export declare class ViralVisibilityManager {
|
|
|
33
33
|
modelId: string;
|
|
34
34
|
elementId: string;
|
|
35
35
|
}[]): void;
|
|
36
|
+
exceptElements: {
|
|
37
|
+
elements: {
|
|
38
|
+
modelId: string;
|
|
39
|
+
elementId: string;
|
|
40
|
+
}[];
|
|
41
|
+
color: {
|
|
42
|
+
r: number;
|
|
43
|
+
g: number;
|
|
44
|
+
b: number;
|
|
45
|
+
};
|
|
46
|
+
}[];
|
|
47
|
+
selectElements(elements: {
|
|
48
|
+
modelId: string;
|
|
49
|
+
elementId: string;
|
|
50
|
+
}[]): void;
|
|
51
|
+
unselectElements(): void;
|
|
52
|
+
isolateModelId: string;
|
|
53
|
+
isolateModel(isolateModelIds?: string[]): void;
|
|
36
54
|
enableSun(): void;
|
|
37
55
|
disableSun(): void;
|
|
38
56
|
enableShadow(): void;
|
|
@@ -80,4 +98,7 @@ export declare class ViralVisibilityManager {
|
|
|
80
98
|
private _isGeneratedRain;
|
|
81
99
|
enableRain(): void;
|
|
82
100
|
disableRain(): void;
|
|
101
|
+
enableAntiAlias(): void;
|
|
102
|
+
disableAntiAlias(): void;
|
|
103
|
+
generateLOD(): void;
|
|
83
104
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WorkerThreadPool } from "./base/worker-pool";
|
|
2
|
+
import { ViralPoint } from "../../types";
|
|
3
|
+
export declare class BoundingBoxIntersectWorker {
|
|
4
|
+
workerPool: WorkerThreadPool;
|
|
5
|
+
constructor();
|
|
6
|
+
checkIntersect(buffer: {
|
|
7
|
+
element: {
|
|
8
|
+
elementId: number;
|
|
9
|
+
min: ViralPoint;
|
|
10
|
+
max: ViralPoint;
|
|
11
|
+
};
|
|
12
|
+
elements: {
|
|
13
|
+
elementId: number;
|
|
14
|
+
min: ViralPoint;
|
|
15
|
+
max: ViralPoint;
|
|
16
|
+
}[];
|
|
17
|
+
}, callbackOnSuccess?: (response: number[]) => void): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WorkerThreadPool } from "./base/worker-pool";
|
|
2
|
+
import { ViralPoint } from "../../types";
|
|
3
|
+
export declare class BoundingBoxWorker {
|
|
4
|
+
workerPool: WorkerThreadPool;
|
|
5
|
+
constructor();
|
|
6
|
+
getBoundingBox(buffer: number[], callbackOnSuccess?: (response: {
|
|
7
|
+
min: ViralPoint;
|
|
8
|
+
max: ViralPoint;
|
|
9
|
+
}) => void): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WorkerThreadPool } from "./base/worker-pool";
|
|
2
|
+
export declare class CheckClashWorker {
|
|
3
|
+
workerPool: WorkerThreadPool;
|
|
4
|
+
constructor();
|
|
5
|
+
checkClash(buffer: {
|
|
6
|
+
buffer1: number[];
|
|
7
|
+
buffer2: number[];
|
|
8
|
+
}, callbackOnSuccess?: (response: boolean) => void): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const workerCode: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const workerCode: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const workerCode: any;
|
package/dist/const/colors.d.ts
CHANGED