@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/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -7474,8 +7474,28 @@ function Core() {
|
|
|
7474
7474
|
*/
|
|
7475
7475
|
const core = new Core();
|
|
7476
7476
|
|
|
7477
|
-
|
|
7478
7477
|
const frame = function () {
|
|
7478
|
+
let time = Date.now();
|
|
7479
|
+
elapsedTime = time - lastTime;
|
|
7480
|
+
if (lastTime > 0 && elapsedTime > 0) { // Log FPS stats
|
|
7481
|
+
var newFPS = 1000 / elapsedTime; // Moving average of FPS
|
|
7482
|
+
totalFPS += newFPS;
|
|
7483
|
+
fpsSamples.push(newFPS);
|
|
7484
|
+
if (fpsSamples.length >= numFPSSamples) {
|
|
7485
|
+
totalFPS -= fpsSamples.shift();
|
|
7486
|
+
}
|
|
7487
|
+
stats.frame.fps = Math.round(totalFPS / fpsSamples.length);
|
|
7488
|
+
}
|
|
7489
|
+
for (let id in core.scenes) {
|
|
7490
|
+
core.scenes[id].compile();
|
|
7491
|
+
}
|
|
7492
|
+
runTasks(time);
|
|
7493
|
+
lastTime = time;
|
|
7494
|
+
};
|
|
7495
|
+
|
|
7496
|
+
window.setInterval(frame, 1000 / 30);
|
|
7497
|
+
|
|
7498
|
+
const renderFrame = function () {
|
|
7479
7499
|
let time = Date.now();
|
|
7480
7500
|
elapsedTime = time - lastTime;
|
|
7481
7501
|
if (lastTime > 0 && elapsedTime > 0) { // Log FPS stats
|
|
@@ -7490,10 +7510,11 @@ const frame = function () {
|
|
|
7490
7510
|
runTasks(time);
|
|
7491
7511
|
fireTickEvents(time);
|
|
7492
7512
|
renderScenes();
|
|
7493
|
-
|
|
7494
|
-
(window.requestPostAnimationFrame !== undefined) ? window.requestPostAnimationFrame(frame) : requestAnimationFrame(frame);
|
|
7513
|
+
(window.requestPostAnimationFrame !== undefined) ? window.requestPostAnimationFrame(frame) : requestAnimationFrame(renderFrame);
|
|
7495
7514
|
};
|
|
7496
7515
|
|
|
7516
|
+
renderFrame();
|
|
7517
|
+
|
|
7497
7518
|
function runTasks(time) { // Process as many enqueued tasks as we can within the per-frame task budget
|
|
7498
7519
|
const tasksRun = core.runTasks(time + taskBudget);
|
|
7499
7520
|
const tasksScheduled = core.getNumTasks();
|
|
@@ -7567,17 +7588,6 @@ function renderScenes() {
|
|
|
7567
7588
|
}
|
|
7568
7589
|
}
|
|
7569
7590
|
|
|
7570
|
-
(window.requestPostAnimationFrame !== undefined) ? window.requestPostAnimationFrame(frame) : requestAnimationFrame(frame);
|
|
7571
|
-
|
|
7572
|
-
function compileScenes() {
|
|
7573
|
-
|
|
7574
|
-
for (let id in core.scenes) {
|
|
7575
|
-
core.scenes[id].compile();
|
|
7576
|
-
}
|
|
7577
|
-
}
|
|
7578
|
-
|
|
7579
|
-
window.setInterval(compileScenes, 1000 / 60);
|
|
7580
|
-
|
|
7581
7591
|
/**
|
|
7582
7592
|
* @desc Base class for all xeokit components.
|
|
7583
7593
|
*
|
|
@@ -12922,7 +12932,7 @@ class Annotation extends Marker {
|
|
|
12922
12932
|
if (utils.isArray(markerHTML)) {
|
|
12923
12933
|
markerHTML = markerHTML.join("");
|
|
12924
12934
|
}
|
|
12925
|
-
markerHTML = this._renderTemplate(markerHTML);
|
|
12935
|
+
markerHTML = this._renderTemplate(markerHTML.trim());
|
|
12926
12936
|
const markerFragment = document.createRange().createContextualFragment(markerHTML);
|
|
12927
12937
|
this._marker = markerFragment.firstChild;
|
|
12928
12938
|
this._container.appendChild(this._marker);
|
|
@@ -12949,7 +12959,7 @@ class Annotation extends Marker {
|
|
|
12949
12959
|
if (utils.isArray(labelHTML)) {
|
|
12950
12960
|
labelHTML = labelHTML.join("");
|
|
12951
12961
|
}
|
|
12952
|
-
labelHTML = this._renderTemplate(labelHTML);
|
|
12962
|
+
labelHTML = this._renderTemplate(labelHTML.trim());
|
|
12953
12963
|
const labelFragment = document.createRange().createContextualFragment(labelHTML);
|
|
12954
12964
|
this._label = labelFragment.firstChild;
|
|
12955
12965
|
this._container.appendChild(this._label);
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -7470,8 +7470,28 @@ function Core() {
|
|
|
7470
7470
|
*/
|
|
7471
7471
|
const core = new Core();
|
|
7472
7472
|
|
|
7473
|
-
|
|
7474
7473
|
const frame = function () {
|
|
7474
|
+
let time = Date.now();
|
|
7475
|
+
elapsedTime = time - lastTime;
|
|
7476
|
+
if (lastTime > 0 && elapsedTime > 0) { // Log FPS stats
|
|
7477
|
+
var newFPS = 1000 / elapsedTime; // Moving average of FPS
|
|
7478
|
+
totalFPS += newFPS;
|
|
7479
|
+
fpsSamples.push(newFPS);
|
|
7480
|
+
if (fpsSamples.length >= numFPSSamples) {
|
|
7481
|
+
totalFPS -= fpsSamples.shift();
|
|
7482
|
+
}
|
|
7483
|
+
stats.frame.fps = Math.round(totalFPS / fpsSamples.length);
|
|
7484
|
+
}
|
|
7485
|
+
for (let id in core.scenes) {
|
|
7486
|
+
core.scenes[id].compile();
|
|
7487
|
+
}
|
|
7488
|
+
runTasks(time);
|
|
7489
|
+
lastTime = time;
|
|
7490
|
+
};
|
|
7491
|
+
|
|
7492
|
+
window.setInterval(frame, 1000 / 30);
|
|
7493
|
+
|
|
7494
|
+
const renderFrame = function () {
|
|
7475
7495
|
let time = Date.now();
|
|
7476
7496
|
elapsedTime = time - lastTime;
|
|
7477
7497
|
if (lastTime > 0 && elapsedTime > 0) { // Log FPS stats
|
|
@@ -7486,10 +7506,11 @@ const frame = function () {
|
|
|
7486
7506
|
runTasks(time);
|
|
7487
7507
|
fireTickEvents(time);
|
|
7488
7508
|
renderScenes();
|
|
7489
|
-
|
|
7490
|
-
(window.requestPostAnimationFrame !== undefined) ? window.requestPostAnimationFrame(frame) : requestAnimationFrame(frame);
|
|
7509
|
+
(window.requestPostAnimationFrame !== undefined) ? window.requestPostAnimationFrame(frame) : requestAnimationFrame(renderFrame);
|
|
7491
7510
|
};
|
|
7492
7511
|
|
|
7512
|
+
renderFrame();
|
|
7513
|
+
|
|
7493
7514
|
function runTasks(time) { // Process as many enqueued tasks as we can within the per-frame task budget
|
|
7494
7515
|
const tasksRun = core.runTasks(time + taskBudget);
|
|
7495
7516
|
const tasksScheduled = core.getNumTasks();
|
|
@@ -7563,17 +7584,6 @@ function renderScenes() {
|
|
|
7563
7584
|
}
|
|
7564
7585
|
}
|
|
7565
7586
|
|
|
7566
|
-
(window.requestPostAnimationFrame !== undefined) ? window.requestPostAnimationFrame(frame) : requestAnimationFrame(frame);
|
|
7567
|
-
|
|
7568
|
-
function compileScenes() {
|
|
7569
|
-
|
|
7570
|
-
for (let id in core.scenes) {
|
|
7571
|
-
core.scenes[id].compile();
|
|
7572
|
-
}
|
|
7573
|
-
}
|
|
7574
|
-
|
|
7575
|
-
window.setInterval(compileScenes, 1000 / 60);
|
|
7576
|
-
|
|
7577
7587
|
/**
|
|
7578
7588
|
* @desc Base class for all xeokit components.
|
|
7579
7589
|
*
|
|
@@ -12918,7 +12928,7 @@ class Annotation extends Marker {
|
|
|
12918
12928
|
if (utils.isArray(markerHTML)) {
|
|
12919
12929
|
markerHTML = markerHTML.join("");
|
|
12920
12930
|
}
|
|
12921
|
-
markerHTML = this._renderTemplate(markerHTML);
|
|
12931
|
+
markerHTML = this._renderTemplate(markerHTML.trim());
|
|
12922
12932
|
const markerFragment = document.createRange().createContextualFragment(markerHTML);
|
|
12923
12933
|
this._marker = markerFragment.firstChild;
|
|
12924
12934
|
this._container.appendChild(this._marker);
|
|
@@ -12945,7 +12955,7 @@ class Annotation extends Marker {
|
|
|
12945
12955
|
if (utils.isArray(labelHTML)) {
|
|
12946
12956
|
labelHTML = labelHTML.join("");
|
|
12947
12957
|
}
|
|
12948
|
-
labelHTML = this._renderTemplate(labelHTML);
|
|
12958
|
+
labelHTML = this._renderTemplate(labelHTML.trim());
|
|
12949
12959
|
const labelFragment = document.createRange().createContextualFragment(labelHTML);
|
|
12950
12960
|
this._label = labelFragment.firstChild;
|
|
12951
12961
|
this._container.appendChild(this._label);
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -1627,7 +1627,9 @@ var time=new Date().getTime();var callback;var scope;var tasksRun=0;while(taskQu
|
|
|
1627
1627
|
* @type {Core}
|
|
1628
1628
|
*/var core=new Core();var frame=function frame(){var time=Date.now();elapsedTime=time-lastTime;if(lastTime>0&&elapsedTime>0){// Log FPS stats
|
|
1629
1629
|
var newFPS=1000/elapsedTime;// Moving average of FPS
|
|
1630
|
-
totalFPS+=newFPS;fpsSamples.push(newFPS);if(fpsSamples.length>=numFPSSamples){totalFPS-=fpsSamples.shift();}stats.frame.fps=Math.round(totalFPS/fpsSamples.length);}
|
|
1630
|
+
totalFPS+=newFPS;fpsSamples.push(newFPS);if(fpsSamples.length>=numFPSSamples){totalFPS-=fpsSamples.shift();}stats.frame.fps=Math.round(totalFPS/fpsSamples.length);}for(var id in core.scenes){core.scenes[id].compile();}runTasks(time);lastTime=time;};window.setInterval(frame,1000/30);var renderFrame=function renderFrame(){var time=Date.now();elapsedTime=time-lastTime;if(lastTime>0&&elapsedTime>0){// Log FPS stats
|
|
1631
|
+
var newFPS=1000/elapsedTime;// Moving average of FPS
|
|
1632
|
+
totalFPS+=newFPS;fpsSamples.push(newFPS);if(fpsSamples.length>=numFPSSamples){totalFPS-=fpsSamples.shift();}stats.frame.fps=Math.round(totalFPS/fpsSamples.length);}runTasks(time);fireTickEvents(time);renderScenes();window.requestPostAnimationFrame!==undefined?window.requestPostAnimationFrame(frame):requestAnimationFrame(renderFrame);};renderFrame();function runTasks(time){// Process as many enqueued tasks as we can within the per-frame task budget
|
|
1631
1633
|
var tasksRun=core.runTasks(time+taskBudget);var tasksScheduled=core.getNumTasks();stats.frame.tasksRun=tasksRun;stats.frame.tasksScheduled=tasksScheduled;stats.frame.tasksBudget=taskBudget;}function fireTickEvents(time){// Fire tick event on each Scene
|
|
1632
1634
|
tickEvent.time=time;for(var id in core.scenes){if(core.scenes.hasOwnProperty(id)){var scene=core.scenes[id];tickEvent.sceneId=id;tickEvent.startTime=scene.startTime;tickEvent.deltaTime=tickEvent.prevTime!=null?tickEvent.time-tickEvent.prevTime:0;/**
|
|
1633
1635
|
* Fired on each game loop iteration.
|
|
@@ -1639,7 +1641,7 @@ tickEvent.time=time;for(var id in core.scenes){if(core.scenes.hasOwnProperty(id)
|
|
|
1639
1641
|
* @param {Number} prevTime The time of the previous "tick" event from this Scene.
|
|
1640
1642
|
* @param {Number} deltaTime The time in seconds since the previous "tick" event from this Scene.
|
|
1641
1643
|
*/scene.fire("tick",tickEvent,true);}}tickEvent.prevTime=time;}function renderScenes(){var scenes=core.scenes;var forceRender=false;var scene;var renderInfo;var ticksPerOcclusionTest;var ticksPerRender;var id;for(id in scenes){if(scenes.hasOwnProperty(id)){scene=scenes[id];renderInfo=scenesRenderInfo[id];if(!renderInfo){renderInfo=scenesRenderInfo[id]={};// FIXME
|
|
1642
|
-
}ticksPerOcclusionTest=scene.ticksPerOcclusionTest;if(renderInfo.ticksPerOcclusionTest!==ticksPerOcclusionTest){renderInfo.ticksPerOcclusionTest=ticksPerOcclusionTest;renderInfo.renderCountdown=ticksPerOcclusionTest;}if(--scene.occlusionTestCountdown<=0){scene.doOcclusionTest();scene.occlusionTestCountdown=ticksPerOcclusionTest;}ticksPerRender=scene.ticksPerRender;if(renderInfo.ticksPerRender!==ticksPerRender){renderInfo.ticksPerRender=ticksPerRender;renderInfo.renderCountdown=ticksPerRender;}if(--renderInfo.renderCountdown===0){scene.render(forceRender);renderInfo.renderCountdown=ticksPerRender;}}}}
|
|
1644
|
+
}ticksPerOcclusionTest=scene.ticksPerOcclusionTest;if(renderInfo.ticksPerOcclusionTest!==ticksPerOcclusionTest){renderInfo.ticksPerOcclusionTest=ticksPerOcclusionTest;renderInfo.renderCountdown=ticksPerOcclusionTest;}if(--scene.occlusionTestCountdown<=0){scene.doOcclusionTest();scene.occlusionTestCountdown=ticksPerOcclusionTest;}ticksPerRender=scene.ticksPerRender;if(renderInfo.ticksPerRender!==ticksPerRender){renderInfo.ticksPerRender=ticksPerRender;renderInfo.renderCountdown=ticksPerRender;}if(--renderInfo.renderCountdown===0){scene.render(forceRender);renderInfo.renderCountdown=ticksPerRender;}}}}/**
|
|
1643
1645
|
* @desc Base class for all xeokit components.
|
|
1644
1646
|
*
|
|
1645
1647
|
* ## Component IDs
|
|
@@ -3283,8 +3285,8 @@ _this18._initMarkerDiv();_this18._onMouseHoverSurface=null;_this18._onHoverNothi
|
|
|
3283
3285
|
*/_this22.projection=cfg.projection;return _this22;}/**
|
|
3284
3286
|
* @private
|
|
3285
3287
|
*/_createClass(Annotation,[{key:"_buildHTML",value:function _buildHTML(){var _this23=this;if(!this._markerExternal){if(this._marker){this._container.removeChild(this._marker);this._marker=null;}var markerHTML=this._markerHTML||"<p></p>";// Make marker
|
|
3286
|
-
if(utils.isArray(markerHTML)){markerHTML=markerHTML.join("");}markerHTML=this._renderTemplate(markerHTML);var markerFragment=document.createRange().createContextualFragment(markerHTML);this._marker=markerFragment.firstChild;this._container.appendChild(this._marker);this._marker.style.visibility=this._markerShown?"visible":"hidden";this._marker.addEventListener("click",function(){_this23.plugin.fire("markerClicked",_this23);});this._marker.addEventListener("mouseenter",function(){_this23.plugin.fire("markerMouseEnter",_this23);});this._marker.addEventListener("mouseleave",function(){_this23.plugin.fire("markerMouseLeave",_this23);});this._marker.addEventListener('wheel',function(event){_this23.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel',event));});}if(!this._labelExternal){if(this._label){this._container.removeChild(this._label);this._label=null;}var labelHTML=this._labelHTML||"<p></p>";// Make label
|
|
3287
|
-
if(utils.isArray(labelHTML)){labelHTML=labelHTML.join("");}labelHTML=this._renderTemplate(labelHTML);var labelFragment=document.createRange().createContextualFragment(labelHTML);this._label=labelFragment.firstChild;this._container.appendChild(this._label);this._label.style.visibility=this._markerShown&&this._labelShown?"visible":"hidden";this._label.addEventListener('wheel',function(event){_this23.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel',event));});}}/**
|
|
3288
|
+
if(utils.isArray(markerHTML)){markerHTML=markerHTML.join("");}markerHTML=this._renderTemplate(markerHTML.trim());var markerFragment=document.createRange().createContextualFragment(markerHTML);this._marker=markerFragment.firstChild;this._container.appendChild(this._marker);this._marker.style.visibility=this._markerShown?"visible":"hidden";this._marker.addEventListener("click",function(){_this23.plugin.fire("markerClicked",_this23);});this._marker.addEventListener("mouseenter",function(){_this23.plugin.fire("markerMouseEnter",_this23);});this._marker.addEventListener("mouseleave",function(){_this23.plugin.fire("markerMouseLeave",_this23);});this._marker.addEventListener('wheel',function(event){_this23.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel',event));});}if(!this._labelExternal){if(this._label){this._container.removeChild(this._label);this._label=null;}var labelHTML=this._labelHTML||"<p></p>";// Make label
|
|
3289
|
+
if(utils.isArray(labelHTML)){labelHTML=labelHTML.join("");}labelHTML=this._renderTemplate(labelHTML.trim());var labelFragment=document.createRange().createContextualFragment(labelHTML);this._label=labelFragment.firstChild;this._container.appendChild(this._label);this._label.style.visibility=this._markerShown&&this._labelShown?"visible":"hidden";this._label.addEventListener('wheel',function(event){_this23.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel',event));});}}/**
|
|
3288
3290
|
* @private
|
|
3289
3291
|
*/},{key:"_updatePosition",value:function _updatePosition(){var boundary=this.scene.canvas.boundary;var left=boundary[0];var top=boundary[1];var canvasPos=this.canvasPos;this._marker.style.left=Math.floor(left+canvasPos[0])-12+"px";this._marker.style.top=Math.floor(top+canvasPos[1])-12+"px";this._marker.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;var offsetX=20;var offsetY=-17;this._label.style.left=20+Math.floor(left+canvasPos[0]+offsetX)+"px";this._label.style.top=Math.floor(top+canvasPos[1]+offsetY)+"px";this._label.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;}/**
|
|
3290
3292
|
* @private
|