@xeokit/xeokit-sdk 2.5.2-beta-8 → 2.5.2-beta-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/xeokit-sdk.cjs.js +26 -16
- package/dist/xeokit-sdk.es.js +26 -16
- package/dist/xeokit-sdk.es5.js +6 -4
- package/dist/xeokit-sdk.min.cjs.js +5 -5
- package/dist/xeokit-sdk.min.es.js +5 -5
- package/dist/xeokit-sdk.min.es5.js +4 -4
- package/package.json +1 -1
- package/src/plugins/AnnotationsPlugin/Annotation.js +2 -2
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV11.js +663 -0
- package/src/viewer/scene/core.js +24 -14
package/src/viewer/scene/core.js
CHANGED
|
@@ -135,8 +135,28 @@ function Core() {
|
|
|
135
135
|
*/
|
|
136
136
|
const core = new Core();
|
|
137
137
|
|
|
138
|
-
|
|
139
138
|
const frame = function () {
|
|
139
|
+
let time = Date.now();
|
|
140
|
+
elapsedTime = time - lastTime;
|
|
141
|
+
if (lastTime > 0 && elapsedTime > 0) { // Log FPS stats
|
|
142
|
+
var newFPS = 1000 / elapsedTime; // Moving average of FPS
|
|
143
|
+
totalFPS += newFPS;
|
|
144
|
+
fpsSamples.push(newFPS);
|
|
145
|
+
if (fpsSamples.length >= numFPSSamples) {
|
|
146
|
+
totalFPS -= fpsSamples.shift();
|
|
147
|
+
}
|
|
148
|
+
stats.frame.fps = Math.round(totalFPS / fpsSamples.length);
|
|
149
|
+
}
|
|
150
|
+
for (let id in core.scenes) {
|
|
151
|
+
core.scenes[id].compile();
|
|
152
|
+
}
|
|
153
|
+
runTasks(time);
|
|
154
|
+
lastTime = time;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
window.setInterval(frame, 1000 / 30);
|
|
158
|
+
|
|
159
|
+
const renderFrame = function () {
|
|
140
160
|
let time = Date.now();
|
|
141
161
|
elapsedTime = time - lastTime;
|
|
142
162
|
if (lastTime > 0 && elapsedTime > 0) { // Log FPS stats
|
|
@@ -151,10 +171,11 @@ const frame = function () {
|
|
|
151
171
|
runTasks(time);
|
|
152
172
|
fireTickEvents(time);
|
|
153
173
|
renderScenes();
|
|
154
|
-
|
|
155
|
-
(window.requestPostAnimationFrame !== undefined) ? window.requestPostAnimationFrame(frame) : requestAnimationFrame(frame);
|
|
174
|
+
(window.requestPostAnimationFrame !== undefined) ? window.requestPostAnimationFrame(frame) : requestAnimationFrame(renderFrame);
|
|
156
175
|
};
|
|
157
176
|
|
|
177
|
+
renderFrame();
|
|
178
|
+
|
|
158
179
|
function runTasks(time) { // Process as many enqueued tasks as we can within the per-frame task budget
|
|
159
180
|
const tasksRun = core.runTasks(time + taskBudget);
|
|
160
181
|
const tasksScheduled = core.getNumTasks();
|
|
@@ -228,15 +249,4 @@ function renderScenes() {
|
|
|
228
249
|
}
|
|
229
250
|
}
|
|
230
251
|
|
|
231
|
-
(window.requestPostAnimationFrame !== undefined) ? window.requestPostAnimationFrame(frame) : requestAnimationFrame(frame);
|
|
232
|
-
|
|
233
|
-
function compileScenes() {
|
|
234
|
-
|
|
235
|
-
for (let id in core.scenes) {
|
|
236
|
-
core.scenes[id].compile();
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
window.setInterval(compileScenes, 1000 / 60);
|
|
241
|
-
|
|
242
252
|
export {core};
|