viral-viewer-2 6.8.3 → 6.8.5
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/batcher/viral-batcher.d.ts +15 -0
- package/dist/components/custom-objects/index.d.ts +2 -2
- package/dist/components/custom-objects/{viral-merged-mesh.d.ts → viral-batched-mesh.d.ts} +5 -4
- package/dist/components/custom-objects/viral-merged-model.d.ts +7 -11
- package/dist/components/custom-objects/viral-spatial-merged-mesh.d.ts +2 -2
- package/dist/components/material/viral-material-manager.d.ts +3 -2
- package/dist/components/post-processing/post-processing-renderer.d.ts +2 -0
- package/dist/components/renderer/viral-optimized-renderer.d.ts +96 -0
- package/dist/components/worker/load-element-patch.worker.d.ts +0 -1
- package/dist/index.mjs +14452 -14271
- package/dist/utils/device.d.ts +29 -1
- package/dist/viral-viewer-api.d.ts +2 -2
- package/package.json +1 -1
- package/dist/components/custom-objects/viral-merged-edge.d.ts +0 -32
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BufferElement, ViralViewerApi } from "../..";
|
|
2
|
+
import { ViralMainModel } from "../custom-objects/viral-main.model";
|
|
3
|
+
export declare class ViralBatcher {
|
|
4
|
+
viralViewerApi: ViralViewerApi;
|
|
5
|
+
constructor(viralViewerApi: ViralViewerApi);
|
|
6
|
+
makeBatches(mainModel: ViralMainModel, modelId: number, bufferElements: BufferElement[]): void;
|
|
7
|
+
private createSingleMergedMesh;
|
|
8
|
+
private createOptimizedMaterial;
|
|
9
|
+
private get perObjectUniformVec4();
|
|
10
|
+
/** Reserve some vec4 slots for built-ins (MVP, lights, fog, etc.). Tweak if you use heavy materials. */
|
|
11
|
+
private get reservedUniformVec4();
|
|
12
|
+
private computeBatchLimits;
|
|
13
|
+
/** Split elements to chunks that satisfy both vertex and object limits. */
|
|
14
|
+
private splitByLimits;
|
|
15
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ViralInstancedMesh } from "./viral-instanced-mesh";
|
|
2
|
-
import {
|
|
2
|
+
import { ViralBatchedMesh } from "./viral-batched-mesh";
|
|
3
3
|
import { ViralMergedModel } from "./viral-merged-model";
|
|
4
|
-
export { ViralInstancedMesh, ViralMergedModel,
|
|
4
|
+
export { ViralInstancedMesh, ViralMergedModel, ViralBatchedMesh };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Box3, BufferGeometry, Color,
|
|
1
|
+
import { Box3, BufferGeometry, Color, Material, Mesh, Vector3 } from "three";
|
|
2
2
|
import { BufferElement } from "../..";
|
|
3
|
-
|
|
3
|
+
import { LineMaterial } from "three/examples/jsm/Addons";
|
|
4
|
+
export declare class ViralBatchedMesh extends Mesh {
|
|
4
5
|
globalMaterialIndex: number;
|
|
5
6
|
constructor(geometry?: BufferGeometry, material?: Material);
|
|
6
7
|
/**
|
|
@@ -32,7 +33,7 @@ export declare class ViralMergedMesh extends Mesh {
|
|
|
32
33
|
private _edgeRanges;
|
|
33
34
|
private _edgeThreshold;
|
|
34
35
|
private _edgeMaterial;
|
|
35
|
-
enableEdgePerElement(material:
|
|
36
|
+
enableEdgePerElement(material: LineMaterial, thresholdDeg?: number): void;
|
|
36
37
|
disableEdge(): void;
|
|
37
38
|
enableEdge(): void;
|
|
38
39
|
/** call this after rebuild/batch to keep edges in sync (if enabled) */
|
|
@@ -157,7 +158,7 @@ export declare class ViralMergedMesh extends Mesh {
|
|
|
157
158
|
getTotalVertexCount(): number;
|
|
158
159
|
getObjectCount(): number;
|
|
159
160
|
/**
|
|
160
|
-
* ! Disposes of the
|
|
161
|
+
* ! Disposes of the ViralBatchedMesh properly, when dispose we dont need to dispose material
|
|
161
162
|
*/
|
|
162
163
|
dispose(): void;
|
|
163
164
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Box3,
|
|
2
|
-
import {
|
|
1
|
+
import { Box3, Mesh } from "three";
|
|
2
|
+
import { ViralBatchedMesh } from "./viral-batched-mesh";
|
|
3
3
|
import { BufferElement } from "../..";
|
|
4
|
-
import {
|
|
4
|
+
import { LineMaterial } from "three/examples/jsm/lines/LineMaterial";
|
|
5
5
|
/**
|
|
6
6
|
* this class is a wrapper, it stand for a clone of bim model (optimize version to increase performance when render)
|
|
7
7
|
* it merge geometries follow material.
|
|
@@ -12,14 +12,10 @@ export declare class ViralMergedModel extends Mesh {
|
|
|
12
12
|
get bounds(): Box3;
|
|
13
13
|
isReady: boolean;
|
|
14
14
|
setReady(value: boolean): void;
|
|
15
|
-
private _mergedEdges;
|
|
16
|
-
addMergedEdge(edge: ViralMergedEdges): void;
|
|
17
|
-
getMergedEdge(globalMaterialIndex: number): ViralMergedEdges | undefined;
|
|
18
|
-
getMergedEdges(): ViralMergedEdges[];
|
|
19
15
|
private _mergedMeshes;
|
|
20
|
-
addMergedMesh(mesh:
|
|
21
|
-
getMergedMesh(globalMaterialIndex: number):
|
|
22
|
-
getMergedMeshes():
|
|
16
|
+
addMergedMesh(mesh: ViralBatchedMesh): void;
|
|
17
|
+
getMergedMesh(globalMaterialIndex: number): ViralBatchedMesh | undefined;
|
|
18
|
+
getMergedMeshes(): ViralBatchedMesh[];
|
|
23
19
|
hide(elements?: {
|
|
24
20
|
modelId: string;
|
|
25
21
|
elementId: string;
|
|
@@ -88,7 +84,7 @@ export declare class ViralMergedModel extends Mesh {
|
|
|
88
84
|
*/
|
|
89
85
|
resetVisibility(): void;
|
|
90
86
|
resetColor(): void;
|
|
91
|
-
enableEdge(material:
|
|
87
|
+
enableEdge(material: LineMaterial): void;
|
|
92
88
|
showEdge(): void;
|
|
93
89
|
hideEdge(): void;
|
|
94
90
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box3, BufferGeometry, Material } from "three";
|
|
2
|
-
import {
|
|
3
|
-
export declare class ViralSpatialMergedMesh extends
|
|
2
|
+
import { ViralBatchedMesh } from "./viral-batched-mesh";
|
|
3
|
+
export declare class ViralSpatialMergedMesh extends ViralBatchedMesh {
|
|
4
4
|
spatialBounds: Box3;
|
|
5
5
|
spatialId: string;
|
|
6
6
|
constructor(bounds: Box3, spatialId: string, geometry?: BufferGeometry, material?: Material);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Material, MeshPhongMaterial, MeshStandardMaterial } from "three";
|
|
2
2
|
import { ViralViewerApi } from "../../viral-viewer-api";
|
|
3
|
+
import { LineMaterial } from "three/examples/jsm/lines/LineMaterial";
|
|
3
4
|
export declare class ViralMaterialManager {
|
|
4
5
|
private viralViewerApi;
|
|
5
6
|
hoverMaterial: MeshPhongMaterial;
|
|
6
7
|
selectedMaterial: MeshPhongMaterial;
|
|
7
|
-
edgeMaterial:
|
|
8
|
+
edgeMaterial: LineMaterial;
|
|
8
9
|
outlineMaterial: MeshStandardMaterial;
|
|
9
10
|
materials: Material[];
|
|
10
11
|
mergeMaterials: Material[];
|
|
@@ -5,6 +5,7 @@ import { ShaderPass } from "three/examples/jsm/postprocessing/ShaderPass";
|
|
|
5
5
|
import { SAOPass, SSAARenderPass, SSAOPass, TAARenderPass } from "three/examples/jsm/Addons";
|
|
6
6
|
import { ViralViewerApi } from "../..";
|
|
7
7
|
import { OutlinePass } from "three/examples/jsm/postprocessing/OutlinePass";
|
|
8
|
+
import { DevicePerformanceChecker } from "../../utils/device";
|
|
8
9
|
export declare class PostProcessingRenderer {
|
|
9
10
|
private renderer;
|
|
10
11
|
viralViewerApi: ViralViewerApi;
|
|
@@ -22,6 +23,7 @@ export declare class PostProcessingRenderer {
|
|
|
22
23
|
shadowRemovalPass: ShaderPass | null;
|
|
23
24
|
outlinePass: OutlinePass | null;
|
|
24
25
|
n8aoPass: any;
|
|
26
|
+
perfChecker: DevicePerformanceChecker;
|
|
25
27
|
constructor(renderer: WebGLRenderer, viralViewerApi: ViralViewerApi);
|
|
26
28
|
isWebGL2Available(): boolean;
|
|
27
29
|
render(): void;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { WebGLRenderer } from "three";
|
|
2
|
+
import { ViralViewerApi } from "../../viral-viewer-api";
|
|
3
|
+
import { PostProcessingRenderer } from "../post-processing/post-processing-renderer";
|
|
4
|
+
interface PerformanceConfig {
|
|
5
|
+
antialias: boolean;
|
|
6
|
+
logarithmicDepthBuffer: boolean;
|
|
7
|
+
preserveDrawingBuffer: boolean;
|
|
8
|
+
pixelRatio: number;
|
|
9
|
+
shadowMapEnabled: boolean;
|
|
10
|
+
shadowMapType: any;
|
|
11
|
+
shadowMapSize: number;
|
|
12
|
+
shadowMapAutoUpdate: boolean;
|
|
13
|
+
enablePostProcessing: boolean;
|
|
14
|
+
enableTAA: boolean;
|
|
15
|
+
taaSamples: number;
|
|
16
|
+
enableSSAO: boolean;
|
|
17
|
+
enableBloom: boolean;
|
|
18
|
+
enableFXAA: boolean;
|
|
19
|
+
enableSMAA: boolean;
|
|
20
|
+
toneMapping: any;
|
|
21
|
+
toneMappingExposure: number;
|
|
22
|
+
performanceLogging: boolean;
|
|
23
|
+
renderStatsInterval: number;
|
|
24
|
+
enableFrustumCulling: boolean;
|
|
25
|
+
enableLOD: boolean;
|
|
26
|
+
maxDrawCalls: number;
|
|
27
|
+
maxTextureSize: number;
|
|
28
|
+
textureFilter: any;
|
|
29
|
+
showPerformanceOverlay: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare class OptimizedViralRenderer {
|
|
32
|
+
viralViewerApi: ViralViewerApi;
|
|
33
|
+
renderer: WebGLRenderer;
|
|
34
|
+
postProcessingRenderer: PostProcessingRenderer;
|
|
35
|
+
private performanceChecker;
|
|
36
|
+
private deviceType;
|
|
37
|
+
private config;
|
|
38
|
+
private _t;
|
|
39
|
+
private _lastSpatialStatsTime;
|
|
40
|
+
private _frameCount;
|
|
41
|
+
private _lastFPSCheck;
|
|
42
|
+
private _currentFPS;
|
|
43
|
+
private _adaptiveQualityEnabled;
|
|
44
|
+
constructor(viralViewerApi: ViralViewerApi);
|
|
45
|
+
private generatePerformanceConfig;
|
|
46
|
+
private initializeRenderer;
|
|
47
|
+
private initializePostProcessing;
|
|
48
|
+
private configurePostProcessingEffects;
|
|
49
|
+
private setupPerformanceMonitoring;
|
|
50
|
+
updateSize(width: number, height: number): void;
|
|
51
|
+
render(): void;
|
|
52
|
+
private performRender;
|
|
53
|
+
private updateFPSCounter;
|
|
54
|
+
private checkAdaptiveQuality;
|
|
55
|
+
private adaptQualityDown;
|
|
56
|
+
private adaptQualityUp;
|
|
57
|
+
private canImproveQuality;
|
|
58
|
+
private logPerformanceMetrics;
|
|
59
|
+
private logRenderStats;
|
|
60
|
+
private logSpatialStats;
|
|
61
|
+
getPerformanceInfo(): {
|
|
62
|
+
rendering: {
|
|
63
|
+
calls: number;
|
|
64
|
+
triangles: number;
|
|
65
|
+
points: number;
|
|
66
|
+
lines: number;
|
|
67
|
+
};
|
|
68
|
+
memory: {
|
|
69
|
+
geometries: number;
|
|
70
|
+
textures: number;
|
|
71
|
+
};
|
|
72
|
+
performance: {
|
|
73
|
+
fps: number;
|
|
74
|
+
profile: "low" | "medium" | "high" | "potato" | "ultra";
|
|
75
|
+
pixelRatio: number;
|
|
76
|
+
deviceType: "mobile" | "tablet" | "pc";
|
|
77
|
+
};
|
|
78
|
+
spatial: {
|
|
79
|
+
totalCells: number;
|
|
80
|
+
loadedCells: number;
|
|
81
|
+
visibleCells: number;
|
|
82
|
+
cullingEfficiency: string;
|
|
83
|
+
memoryEfficiency: string;
|
|
84
|
+
} | null;
|
|
85
|
+
isSpatialActive: boolean;
|
|
86
|
+
};
|
|
87
|
+
setAdaptiveQuality(enabled: boolean): void;
|
|
88
|
+
forceQualityProfile(profile: "potato" | "low" | "medium" | "high" | "ultra"): void;
|
|
89
|
+
private applyNewConfiguration;
|
|
90
|
+
getCurrentConfig(): PerformanceConfig;
|
|
91
|
+
benchmarkDevice(): Promise<number>;
|
|
92
|
+
screenshot(): string;
|
|
93
|
+
screenshotWithSpatialDebug(): string;
|
|
94
|
+
renderVisibleCellsOnly(): void;
|
|
95
|
+
}
|
|
96
|
+
export {};
|