Attention ! Gitlab fournissant maintenant nativement des certificats Let’s Encrypt aux domaines personnalisés des Gitlab Pages, nous avons coupé notre service qui le faisait automatiquement pour vous.

Il est impératif, pour que votre domaine personnalisé continue à avoir un certificat Let’s Encrypt à jour, d’activer la fonctionnalité native dans les paramètres de votre projet. Cette activation remplacera votre certificat actuel par un nouveau certificat Let’s Encrypt géré par Gitlab.

Voir les détails sur https://docs.framasoft.org/fr/gitlab/gitlab-pages-le.html

Commit 1aa5b7ea authored by Clément Igonet's avatar Clément Igonet

Optimize preload.

parent 4d54b738
......@@ -27,7 +27,7 @@ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
var MAX_TEXTURE_REQUEST = 10;
OpenEarthView.TileLoader = function() {
this.textureLoader = new THREE.TextureLoader();
this.textureLoader.crossOrigin = '';
// this.textureLoader.crossOrigin = '';
// this.textureLoader
};
......@@ -65,7 +65,9 @@ OpenEarthView.TileLoader.prototype = {
function(texture) {
textures[id] = texture;
if (textureAliveRequests.hasOwnProperty(id)) {
textureAliveRequests[id].onLoaded(texture);
if (textureAliveRequests[id].onLoaded !== undefined) {
textureAliveRequests[id].onLoaded(texture);
}
delete textureAliveRequests[id];
scope.textureAliveRequestsCount--;
// console.log('(0) scope.textureAliveRequestsCount: ', scope.textureAliveRequestsCount);
......@@ -99,7 +101,8 @@ OpenEarthView.TileLoader.prototype = {
var textureRequests = scope.textureRequests;
var textureAliveRequests = scope.textureAliveRequests;
var id = zoom + '/' + xtile + '/' + ytile;
for (var diff = 0; diff < zoom; diff++) {
// for (var diff = 0; diff < zoom; diff++) {
for (var diff = 0; diff <= Math.min(5, zoom); diff++) {
var power = Math.pow(2, diff);
var idZoomOther = (+zoom - diff) + '/' + Math.floor(xtile / power) + '/' + Math.floor(ytile / power);
// console.log('Looking for texture: ', idZoomOther);
......@@ -110,14 +113,15 @@ OpenEarthView.TileLoader.prototype = {
tex.repeat.x = 1 / power;
tex.repeat.y = 1 / power;
var xOffset = xtile - Math.floor(xtile / power) * power
// console.log('xOffset: ', xOffset);
// console.log('xOffset: ', xOffset);
var yOffset = (power - 1) - (ytile - Math.floor(ytile / power) * power);
// console.log('yOffset: ', yOffset);
tex.offset.x = xOffset * tex.repeat.x;
tex.offset.y = yOffset * tex.repeat.y;
tex.needsUpdate = true;
onLoaded(tex);
return;
// return;
break;
}
}
// for (var diff = Math.min(zoom - 19, -8); diff < Math.min(zoom - 1, -1); diff++) {
......@@ -144,6 +148,10 @@ OpenEarthView.TileLoader.prototype = {
},
tileFactory: function(url, zoom, xtile, ytile, onLoaded) {
var scope = this;
// if (onLoaded === undefined) {
// scope.loadNextTile();
// return;
// }
var textures = scope.textures;
var textureRequests = scope.textureRequests;
var textureAliveRequests = scope.textureAliveRequests;
......@@ -151,6 +159,7 @@ OpenEarthView.TileLoader.prototype = {
// var myUrl = new URL(url);
var id = zoom + '/' + xtile + '/' + ytile;
if (textures.hasOwnProperty(id)) {
// Covered by preload
// onLoaded(textures[id]);
} else {
scope.textureRequestsCount = scope.textureRequestsCount + (textureRequests.hasOwnProperty(id) ? 0 : 1);
......
......@@ -36,32 +36,33 @@ OpenEarthView.World = function(domElement) {
delete scope.layers["defaultLayer"];
}
scope.layers[openEarthViewLayer.getName()] = openEarthViewLayer;
for (var xtile = 0; xtile < 4; xtile++) {
for (var ytile = 0; ytile < 4; ytile++) {
if (openEarthViewLayer.type === 'tile') {
tileLoader.tileFactory(
openEarthViewLayer.getUrl(2, xtile, ytile),
2,
xtile,
ytile,
function(texture) {
// Do nothing
}
);
}
}
}
// for (var xtile = 0; xtile < 4; xtile++) {
// for (var ytile = 0; ytile < 4; ytile++) {
// if (openEarthViewLayer.type === 'tile') {
// tileLoader.tileFactory(
// openEarthViewLayer.getUrl(2, xtile, ytile),
// 2,
// xtile,
// ytile,
// function(texture) {
// // Do nothing
// }
// );
// }
// }
// }
tileLoader.tileFactory(openEarthViewLayer.getUrl(0, 0, 0), 0, 0, 0);
}
this.terrains = {};
this.terrains["defaultTerrain"] = new OpenEarthView.Terrain.FlatTerrain("FlatTerrain");
this.addTerrain = function(openEarthViewTerrain) {
console.log('Add terrain:', openEarthViewTerrain.getName());
if (scope.terrains.hasOwnProperty("defaultTerrain")) {
delete scope.terrains["defaultTerrain"];
}
scope.terrains[openEarthViewTerrain.getName()] = openEarthViewTerrain;
console.log('Add terrain:', openEarthViewTerrain.getName());
if (scope.terrains.hasOwnProperty("defaultTerrain")) {
delete scope.terrains["defaultTerrain"];
}
scope.terrains[openEarthViewTerrain.getName()] = openEarthViewTerrain;
}
var toolbox = OpenEarthView.toolbox;
var tileLoader = new OpenEarthView.TileLoader();
......@@ -247,8 +248,9 @@ OpenEarthView.World = function(domElement) {
xtile: scope.xtile,
ytile: scope.ytile
}));
for (var zoom_ = Math.max(scope.zoom, scope.ZOOM_MIN); zoom_ > Math.max(scope.zoom - scope.ZOOM_SHIFT_SIZE, scope.ZOOM_MIN); zoom_--) {
var zoomMax = Math.max(scope.zoom, scope.ZOOM_MIN);
var zoomMin = Math.max(scope.zoom - scope.ZOOM_SHIFT_SIZE, scope.ZOOM_MIN);
for (var zoom_ = zoomMax; zoom_ > zoomMin; zoom_--) {
var zShift = scope.zoom - zoom_;
scope.tileGroup[zShift] = new THREE.Object3D(); //create an empty container
scope.tileGroups.add(scope.tileGroup[zShift]);
......@@ -273,16 +275,29 @@ OpenEarthView.World = function(domElement) {
var modulus = (zoom_ > 0) ? Math.pow(2, zoom_) : 0;
for (var atile = minXtile; atile <= maxXtile; atile++) {
for (var btile = minYtile; btile <= maxYtile; btile++) {
var id = 'z_' + zoom_ + '_' + (atile % modulus) + "_" + (btile % modulus);
var id = '' + zoom_ + '/' + (atile % modulus) + '/' + (btile % modulus);
for (var zzz = 1; zzz <= 2; zzz++) {
var idNext = 'z_' + (zoom_ - zzz) + '_' + Math.floor((atile % modulus) / Math.pow(2, zzz)) + "_" + Math.floor((btile % modulus) / Math.pow(2, zzz));
var zoom__ = (zoom_ - zzz);
var xtile__ = Math.floor((atile % modulus) / Math.pow(2, zzz));
var ytile__ = Math.floor((btile % modulus) / Math.pow(2, zzz));
var idNext = '' + zoom__ + '/' + xtile__ + '/' + ytile__;
tiles[idNext] = {};
for (var terrainId in scope.terrains) {
switch (scope.terrains[terrainId].type) {
case 'tile':
tileLoader.tileFactory(
scope.terrains[terrainId].getUrl(zoom__, xtile__, ytile__),
zoom__,
xtile__,
ytile__);
break;
}
}
}
if (!tiles.hasOwnProperty(id)) {
var tileSupport = new THREE.Object3D(); //create an empty container
var tileMesh = new THREE.Mesh();
tileSupport.add(tileMesh);
// tileMesh.position.set(0, 0, -10);
if (zoom_ < scope.ZOOM_FLAT) {
var tileEarth = new THREE.Object3D(); //create an empty container
......@@ -350,6 +365,20 @@ OpenEarthView.World = function(domElement) {
opacity: scope.layers[layerId].opacity
});
scope.render();
// (function(zoom, xtile, ytile) {
// if (zoom_ === Math.max(zoomMin - 5, 0) && xtile === scope.xtile && ytile === scope.ytile) {
// tileLoader.tileFactory(
// scope.layers[layerId].getUrl(zoom_, xtile, ytile),
// zoom_,
// xtile,
// ytile
// );
// }
// })(zoom_, atile % modulus, btile % modulus);
//
//
//
tileLoader.tilePreload(
zoom_,
atile % modulus,
......@@ -360,6 +389,7 @@ OpenEarthView.World = function(domElement) {
scope.render();
}
);
(function(tileMesh, zoom, xtile, ytile, layerId) {
var url = scope.layers[layerId].getUrl(
zoom,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment