Skip to content

Commit 55c1c10

Browse files
committed
Snapshot build
1 parent e2eb6c6 commit 55c1c10

File tree

77 files changed

+1357
-1437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1357
-1437
lines changed

build/xeogl.js

+25-39
Original file line numberDiff line numberDiff line change
@@ -5383,7 +5383,6 @@ const componentClasses = {
53835383
@param [cfg] {*} DepthBuf configuration
53845384
@param [cfg.id] {String} Optional ID, unique among all components in the parent {{#crossLink "Scene"}}Scene{{/crossLink}}, generated automatically when omitted.
53855385
@param [cfg.meta] {String:Object} Optional map of user-defined metadata to attach to this Component.
5386-
@param [cfg.isDefault] {Boolean} Set true when this is one of xeogl's default components.
53875386
*/
53885387

53895388
const type = "xeogl.Component";
@@ -5456,7 +5455,7 @@ class Component {
54565455
this._renderer = this.scene._renderer;
54575456
}
54585457

5459-
this._dontClear = !!cfg.dontClear;
5458+
this._dontClear = !!cfg.dontClear; // Prevent Scene#clear from destroying this component
54605459

54615460
this._model = null;
54625461
this._renderer = this.scene._renderer;
@@ -19706,18 +19705,14 @@ const Renderer = function ( scene, options) {
1970619705
let i;
1970719706
let len;
1970819707
let mesh;
19709-
const pickTransparent = !!params.pickTransparent;
19710-
const includeMeshIds = !!params.includeMeshIds;
19711-
const excludeMeshIds = !!params.excludeMeshIds;
19708+
const includeMeshIds = params.includeMeshIds;
19709+
const excludeMeshIds = params.excludeMeshIds;
1971219710

1971319711
for (i = 0, len = meshListLen; i < len; i++) {
1971419712
mesh = meshList[i];
1971519713
if (mesh._state.culled === true || mesh._state.visible === false || mesh._state.pickable === false) {
1971619714
continue;
1971719715
}
19718-
if (!pickTransparent && mesh._material._state.alpha < 0) {
19719-
continue;
19720-
}
1972119716
if (includeMeshIds && !includeMeshIds[mesh.id]) {
1972219717
continue;
1972319718
}
@@ -27289,7 +27284,6 @@ class Scene extends Component {
2728927284
return this.components["default.geometry"] ||
2729027285
new BoxGeometry(this, {
2729127286
id: "default.geometry",
27292-
isDefault: true,
2729327287
dontClear: true
2729427288
});
2729527289
}
@@ -27310,7 +27304,6 @@ class Scene extends Component {
2731027304
get material() {
2731127305
return this.components["default.material"] || new PhongMaterial(this, {
2731227306
id: "default.material",
27313-
isDefault: true,
2731427307
emissive: [0.4, 0.4, 0.4], // Visible by default on geometry without normals
2731527308
dontClear: true
2731627309
});
@@ -27333,7 +27326,6 @@ class Scene extends Component {
2733327326
return this.components["default.ghostMaterial"] || new EmphasisMaterial(this, {
2733427327
id: "default.ghostMaterial",
2733527328
preset: "sepia",
27336-
isDefault: true,
2733727329
dontClear: true
2733827330
});
2733927331
}
@@ -27355,7 +27347,6 @@ class Scene extends Component {
2735527347
return this.components["default.highlightMaterial"] || new EmphasisMaterial(this, {
2735627348
id: "default.highlightMaterial",
2735727349
preset: "yellowHighlight",
27358-
isDefault: true,
2735927350
dontClear: true
2736027351
});
2736127352
}
@@ -27377,7 +27368,6 @@ class Scene extends Component {
2737727368
return this.components["default.selectedMaterial"] || new EmphasisMaterial(this, {
2737827369
id: "default.selectedMaterial",
2737927370
preset: "greenSelected",
27380-
isDefault: true,
2738127371
dontClear: true
2738227372
});
2738327373
}
@@ -27402,7 +27392,6 @@ class Scene extends Component {
2740227392
edgeColor: [0.0, 0.0, 0.0],
2740327393
edgeAlpha: 1.0,
2740427394
edgeWidth: 1,
27405-
isDefault: true,
2740627395
dontClear: true
2740727396
});
2740827397
}
@@ -27423,7 +27412,6 @@ class Scene extends Component {
2742327412
get outlineMaterial() {
2742427413
return this.components["default.outlineMaterial"] || new OutlineMaterial(this, {
2742527414
id: "default.outlineMaterial",
27426-
isDefault: true,
2742727415
dontClear: true
2742827416
});
2742927417
}
@@ -27618,7 +27606,6 @@ class Scene extends Component {
2761827606

2761927607
@param {*} params Picking parameters.
2762027608
@param {Boolean} [params.pickSurface=false] Whether to find the picked position on the surface of the Mesh.
27621-
@param {Boolean} [params.pickTransparent=true] Whether to pick transparent objects (true) or pick through them as if they did not exist (false).
2762227609
@param {Float32Array} [params.canvasPos] Canvas-space coordinates. When ray-picking, this will override the
2762327610
**origin** and ** direction** parameters and will cause the ray to be fired through the canvas at this position,
2762427611
directly along the negative View-space Z-axis.
@@ -27967,17 +27954,15 @@ class Scene extends Component {
2796727954

2796827955
@method clear
2796927956
*/
27970-
clear() { // FIXME: should only clear user-created components
27957+
clear() {
2797127958
var component;
2797227959
for (const id in this.components) {
2797327960
if (this.components.hasOwnProperty(id)) {
2797427961
// Each component fires "destroyed" as it is destroyed,
2797527962
// which this Scene handles by removing the component
2797627963
component = this.components[id];
27977-
if (!component._dontClear) { // Don't destroy components like xeogl.Camera, xeogl.Input, xeogl.Viewport
27964+
if (!component._dontClear) { // Don't destroy components like xeogl.Camera, xeogl.Input, xeogl.Viewport etc.
2797827965
component.destroy();
27979-
} else {
27980-
this.log("Not clearing: " + component.type);
2798127966
}
2798227967
}
2798327968
}
@@ -28238,7 +28223,11 @@ class Scene extends Component {
2823828223

2823928224
super.destroy();
2824028225

28241-
this.clear();
28226+
for (const id in this.components) {
28227+
if (this.components.hasOwnProperty(id)) {
28228+
this.components[id].destroy();
28229+
}
28230+
}
2824228231

2824328232
this.canvas.gl = null;
2824428233

@@ -28448,26 +28437,23 @@ const numFPSSamples = 30;
2844828437
let lastTime = 0;
2844928438
let elapsedTime;
2845028439
let totalFPS = 0;
28451-
let suspended = false;
2845228440

2845328441
const frame = function () {
28454-
if (!suspended) {
28455-
let time = Date.now();
28456-
if (lastTime > 0) { // Log FPS stats
28457-
elapsedTime = time - lastTime;
28458-
var newFPS = 1000 / elapsedTime; // Moving average of FPS
28459-
totalFPS += newFPS;
28460-
fpsSamples.push(newFPS);
28461-
if (fpsSamples.length >= numFPSSamples) {
28462-
totalFPS -= fpsSamples.shift();
28463-
}
28464-
stats.frame.fps = Math.round(totalFPS / fpsSamples.length);
28465-
}
28466-
runTasks(time);
28467-
fireTickEvents(time);
28468-
renderScenes();
28469-
lastTime = time;
28470-
}
28442+
let time = Date.now();
28443+
if (lastTime > 0) { // Log FPS stats
28444+
elapsedTime = time - lastTime;
28445+
var newFPS = 1000 / elapsedTime; // Moving average of FPS
28446+
totalFPS += newFPS;
28447+
fpsSamples.push(newFPS);
28448+
if (fpsSamples.length >= numFPSSamples) {
28449+
totalFPS -= fpsSamples.shift();
28450+
}
28451+
stats.frame.fps = Math.round(totalFPS / fpsSamples.length);
28452+
}
28453+
runTasks(time);
28454+
fireTickEvents(time);
28455+
renderScenes();
28456+
lastTime = time;
2847128457
window.requestAnimationFrame(frame);
2847228458
};
2847328459

build/xeogl.module.js

+25-39
Original file line numberDiff line numberDiff line change
@@ -5377,7 +5377,6 @@ const componentClasses = {
53775377
@param [cfg] {*} DepthBuf configuration
53785378
@param [cfg.id] {String} Optional ID, unique among all components in the parent {{#crossLink "Scene"}}Scene{{/crossLink}}, generated automatically when omitted.
53795379
@param [cfg.meta] {String:Object} Optional map of user-defined metadata to attach to this Component.
5380-
@param [cfg.isDefault] {Boolean} Set true when this is one of xeogl's default components.
53815380
*/
53825381

53835382
const type = "xeogl.Component";
@@ -5450,7 +5449,7 @@ class Component {
54505449
this._renderer = this.scene._renderer;
54515450
}
54525451

5453-
this._dontClear = !!cfg.dontClear;
5452+
this._dontClear = !!cfg.dontClear; // Prevent Scene#clear from destroying this component
54545453

54555454
this._model = null;
54565455
this._renderer = this.scene._renderer;
@@ -19700,18 +19699,14 @@ const Renderer = function ( scene, options) {
1970019699
let i;
1970119700
let len;
1970219701
let mesh;
19703-
const pickTransparent = !!params.pickTransparent;
19704-
const includeMeshIds = !!params.includeMeshIds;
19705-
const excludeMeshIds = !!params.excludeMeshIds;
19702+
const includeMeshIds = params.includeMeshIds;
19703+
const excludeMeshIds = params.excludeMeshIds;
1970619704

1970719705
for (i = 0, len = meshListLen; i < len; i++) {
1970819706
mesh = meshList[i];
1970919707
if (mesh._state.culled === true || mesh._state.visible === false || mesh._state.pickable === false) {
1971019708
continue;
1971119709
}
19712-
if (!pickTransparent && mesh._material._state.alpha < 0) {
19713-
continue;
19714-
}
1971519710
if (includeMeshIds && !includeMeshIds[mesh.id]) {
1971619711
continue;
1971719712
}
@@ -27283,7 +27278,6 @@ class Scene extends Component {
2728327278
return this.components["default.geometry"] ||
2728427279
new BoxGeometry(this, {
2728527280
id: "default.geometry",
27286-
isDefault: true,
2728727281
dontClear: true
2728827282
});
2728927283
}
@@ -27304,7 +27298,6 @@ class Scene extends Component {
2730427298
get material() {
2730527299
return this.components["default.material"] || new PhongMaterial(this, {
2730627300
id: "default.material",
27307-
isDefault: true,
2730827301
emissive: [0.4, 0.4, 0.4], // Visible by default on geometry without normals
2730927302
dontClear: true
2731027303
});
@@ -27327,7 +27320,6 @@ class Scene extends Component {
2732727320
return this.components["default.ghostMaterial"] || new EmphasisMaterial(this, {
2732827321
id: "default.ghostMaterial",
2732927322
preset: "sepia",
27330-
isDefault: true,
2733127323
dontClear: true
2733227324
});
2733327325
}
@@ -27349,7 +27341,6 @@ class Scene extends Component {
2734927341
return this.components["default.highlightMaterial"] || new EmphasisMaterial(this, {
2735027342
id: "default.highlightMaterial",
2735127343
preset: "yellowHighlight",
27352-
isDefault: true,
2735327344
dontClear: true
2735427345
});
2735527346
}
@@ -27371,7 +27362,6 @@ class Scene extends Component {
2737127362
return this.components["default.selectedMaterial"] || new EmphasisMaterial(this, {
2737227363
id: "default.selectedMaterial",
2737327364
preset: "greenSelected",
27374-
isDefault: true,
2737527365
dontClear: true
2737627366
});
2737727367
}
@@ -27396,7 +27386,6 @@ class Scene extends Component {
2739627386
edgeColor: [0.0, 0.0, 0.0],
2739727387
edgeAlpha: 1.0,
2739827388
edgeWidth: 1,
27399-
isDefault: true,
2740027389
dontClear: true
2740127390
});
2740227391
}
@@ -27417,7 +27406,6 @@ class Scene extends Component {
2741727406
get outlineMaterial() {
2741827407
return this.components["default.outlineMaterial"] || new OutlineMaterial(this, {
2741927408
id: "default.outlineMaterial",
27420-
isDefault: true,
2742127409
dontClear: true
2742227410
});
2742327411
}
@@ -27612,7 +27600,6 @@ class Scene extends Component {
2761227600

2761327601
@param {*} params Picking parameters.
2761427602
@param {Boolean} [params.pickSurface=false] Whether to find the picked position on the surface of the Mesh.
27615-
@param {Boolean} [params.pickTransparent=true] Whether to pick transparent objects (true) or pick through them as if they did not exist (false).
2761627603
@param {Float32Array} [params.canvasPos] Canvas-space coordinates. When ray-picking, this will override the
2761727604
**origin** and ** direction** parameters and will cause the ray to be fired through the canvas at this position,
2761827605
directly along the negative View-space Z-axis.
@@ -27961,17 +27948,15 @@ class Scene extends Component {
2796127948

2796227949
@method clear
2796327950
*/
27964-
clear() { // FIXME: should only clear user-created components
27951+
clear() {
2796527952
var component;
2796627953
for (const id in this.components) {
2796727954
if (this.components.hasOwnProperty(id)) {
2796827955
// Each component fires "destroyed" as it is destroyed,
2796927956
// which this Scene handles by removing the component
2797027957
component = this.components[id];
27971-
if (!component._dontClear) { // Don't destroy components like xeogl.Camera, xeogl.Input, xeogl.Viewport
27958+
if (!component._dontClear) { // Don't destroy components like xeogl.Camera, xeogl.Input, xeogl.Viewport etc.
2797227959
component.destroy();
27973-
} else {
27974-
this.log("Not clearing: " + component.type);
2797527960
}
2797627961
}
2797727962
}
@@ -28232,7 +28217,11 @@ class Scene extends Component {
2823228217

2823328218
super.destroy();
2823428219

28235-
this.clear();
28220+
for (const id in this.components) {
28221+
if (this.components.hasOwnProperty(id)) {
28222+
this.components[id].destroy();
28223+
}
28224+
}
2823628225

2823728226
this.canvas.gl = null;
2823828227

@@ -28442,26 +28431,23 @@ const numFPSSamples = 30;
2844228431
let lastTime = 0;
2844328432
let elapsedTime;
2844428433
let totalFPS = 0;
28445-
let suspended = false;
2844628434

2844728435
const frame = function () {
28448-
if (!suspended) {
28449-
let time = Date.now();
28450-
if (lastTime > 0) { // Log FPS stats
28451-
elapsedTime = time - lastTime;
28452-
var newFPS = 1000 / elapsedTime; // Moving average of FPS
28453-
totalFPS += newFPS;
28454-
fpsSamples.push(newFPS);
28455-
if (fpsSamples.length >= numFPSSamples) {
28456-
totalFPS -= fpsSamples.shift();
28457-
}
28458-
stats.frame.fps = Math.round(totalFPS / fpsSamples.length);
28459-
}
28460-
runTasks(time);
28461-
fireTickEvents(time);
28462-
renderScenes();
28463-
lastTime = time;
28464-
}
28436+
let time = Date.now();
28437+
if (lastTime > 0) { // Log FPS stats
28438+
elapsedTime = time - lastTime;
28439+
var newFPS = 1000 / elapsedTime; // Moving average of FPS
28440+
totalFPS += newFPS;
28441+
fpsSamples.push(newFPS);
28442+
if (fpsSamples.length >= numFPSSamples) {
28443+
totalFPS -= fpsSamples.shift();
28444+
}
28445+
stats.frame.fps = Math.round(totalFPS / fpsSamples.length);
28446+
}
28447+
runTasks(time);
28448+
fireTickEvents(time);
28449+
renderScenes();
28450+
lastTime = time;
2846528451
window.requestAnimationFrame(frame);
2846628452
};
2846728453

0 commit comments

Comments
 (0)