@xeokit/xeokit-sdk 2.4.2-beta-49 → 2.5.1-beta
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/xeokit-sdk.cjs.js +136 -0
- package/dist/xeokit-sdk.es.js +136 -0
- package/dist/xeokit-sdk.es5.js +4 -4
- package/dist/xeokit-sdk.min.cjs.js +3 -3
- package/dist/xeokit-sdk.min.es.js +2 -2
- package/dist/xeokit-sdk.min.es5.js +2 -2
- package/package.json +1 -1
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +32 -0
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +1 -0
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +44 -0
- package/src/plugins/lib/html/Dot.js +23 -0
- package/src/plugins/lib/html/Label.js +18 -0
- package/src/plugins/lib/html/Wire.js +18 -0
- package/src/plugins/LODCullingPlugin/LODCullingPlugin.js +0 -209
- package/src/plugins/LODCullingPlugin/LODManager.js +0 -82
- package/src/plugins/LODCullingPlugin/LODState.js +0 -130
- package/src/plugins/LODCullingPlugin/index.js +0 -1
- package/src/viewer/scene/webgl/Renderer2.js +0 -1830
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import {math} from "../math/math.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Data structure containing pre-initialized `LOD` data.
|
|
5
|
-
*
|
|
6
|
-
* Will be used by the rest of `LOD` related code.
|
|
7
|
-
*
|
|
8
|
-
* @private
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export class LODState {
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @param {Array<number>} primLODLevels The primtive counts for the LOD levels, for example ```[ 2000, 600, 150, 80, 20 ]```
|
|
15
|
-
* @param {number} targetFps The target FPS (_Frames Per Second_) for the dynamic culling of objects in the different LOD levels.
|
|
16
|
-
*/
|
|
17
|
-
constructor(primLODLevels, targetFps) {
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* An array ordered DESC with the number of primtives allowed in each LOD bucket.
|
|
21
|
-
*
|
|
22
|
-
* @type {Array<number>}
|
|
23
|
-
*/
|
|
24
|
-
this.primLODLevels = primLODLevels;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* A computed dictionary for `primtive-number-buckets` where:
|
|
28
|
-
* - key: the number of primtives allowed for the objects in the bucket.
|
|
29
|
-
* - value: all PerformanceNodes that have the number of primtives or more.
|
|
30
|
-
*
|
|
31
|
-
* @type {Map<number, Array<DataTextureSceneModelNode>>}
|
|
32
|
-
*/
|
|
33
|
-
this.entitiesInLOD = {};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* A computed dictionary for `primtive-number-buckets` where:
|
|
37
|
-
* - key: the number of primtives allowed for the objects in the bucket.
|
|
38
|
-
* - value: the sum of primtives counts for all PeformanceNodes in the bucket.
|
|
39
|
-
*
|
|
40
|
-
* @type {Map<number, number>}
|
|
41
|
-
*/
|
|
42
|
-
this.primCountInLOD = {};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* The target FPS for the `LOD` mechanism:
|
|
46
|
-
* - if real FPS are below this number, the next `LOD` level will be applied.
|
|
47
|
-
*
|
|
48
|
-
* - if real FPS are...
|
|
49
|
-
* - above this number plus a margin
|
|
50
|
-
* - and for some consecutive frames
|
|
51
|
-
* ... then the previous `LOD` level will be applied.
|
|
52
|
-
*
|
|
53
|
-
* @type {number}
|
|
54
|
-
*/
|
|
55
|
-
this.targetFps = targetFps;
|
|
56
|
-
|
|
57
|
-
// /**
|
|
58
|
-
// * Not used at the moment.
|
|
59
|
-
// */
|
|
60
|
-
// this.restoreTime = LOD_RESTORE_TIME;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Current `LOD` level. Starts at 0.
|
|
64
|
-
*
|
|
65
|
-
* @type {number}
|
|
66
|
-
*/
|
|
67
|
-
this.lodLevelIndex = 0;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Number of consecutive frames in current `LOD` level where FPS was above `targetFps`
|
|
71
|
-
*
|
|
72
|
-
* @type {number}
|
|
73
|
-
*/
|
|
74
|
-
this.consecutiveFramesWithTargetFps = 0;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Number of consecutive frames in current `LOD` level where FPS was below `targetFps`
|
|
78
|
-
*
|
|
79
|
-
* @type {number}
|
|
80
|
-
*/
|
|
81
|
-
this.consecutiveFramesWithoutTargetFps = 0;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @param {SceneModel} sceneModel
|
|
86
|
-
*/
|
|
87
|
-
initializeLodState(sceneModel) {
|
|
88
|
-
const entityList = Object.values(sceneModel.objects);
|
|
89
|
-
if (entityList.length === 0) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const neverCullTypesMap = sceneModel.scene.lod.neverCullTypesMap;
|
|
93
|
-
const metaScene = sceneModel.scene.viewer.metaScene;
|
|
94
|
-
const entitiesInLOD = {};
|
|
95
|
-
const primCountInLOD = {};
|
|
96
|
-
const maxSize = 20;
|
|
97
|
-
const minComplexity = 25;
|
|
98
|
-
|
|
99
|
-
for (let i = 0, len = entityList.length; i < len; i++) {
|
|
100
|
-
const entity = entityList[i];
|
|
101
|
-
const metaObject = metaScene.metaObjects[entity.id];
|
|
102
|
-
if (metaObject && neverCullTypesMap[metaObject.type]) {
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
const entityComplexity = entity.numPrimitives;
|
|
106
|
-
const entitySize = math.getAABB3Diag(entity.aabb);
|
|
107
|
-
// const isCullable = ((minComplexity <= entityComplexity) && (entitySize <= maxSize));
|
|
108
|
-
// if (!isCullable) {
|
|
109
|
-
// continue;
|
|
110
|
-
// }
|
|
111
|
-
let lodLevel = 0, len;
|
|
112
|
-
for (lodLevel = 0, len = this.primLODLevels.length; lodLevel < len; lodLevel++) {
|
|
113
|
-
if (entity.numPrimitives >= this.primLODLevels [lodLevel]) {
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
const lodPrims = this.primLODLevels [lodLevel] || 0;
|
|
118
|
-
if (!(lodPrims in entitiesInLOD)) {
|
|
119
|
-
entitiesInLOD [lodPrims] = [];
|
|
120
|
-
}
|
|
121
|
-
entitiesInLOD [lodPrims].push(entity);
|
|
122
|
-
if (!(lodPrims in primCountInLOD)) {
|
|
123
|
-
primCountInLOD [lodPrims] = 0;
|
|
124
|
-
}
|
|
125
|
-
primCountInLOD [lodPrims] += entity.numPrimitives;
|
|
126
|
-
}
|
|
127
|
-
this.entitiesInLOD = entitiesInLOD;
|
|
128
|
-
this.primCountInLOD = primCountInLOD;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./LOD.js";
|