itowns 2.37.0 → 2.38.2
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/README.md +12 -1
- package/changelog.md +101 -0
- package/dist/debug.js +1 -1
- package/dist/debug.js.LICENSE.txt +2 -2
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.LICENSE.txt +2 -2
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_widgets.js +1 -1
- package/dist/itowns_widgets.js.map +1 -1
- package/examples/config.json +4 -1
- package/examples/css/example.css +21 -1
- package/examples/css/widgets.css +118 -6
- package/examples/images/code-logo.svg +43 -0
- package/examples/index.html +5 -5
- package/examples/mars.html +0 -1
- package/examples/misc_orthographic_camera.html +7 -19
- package/examples/vector_tile_3d_mesh.html +155 -0
- package/examples/vector_tile_raster_3d.html +0 -5
- package/examples/view_25d_map.html +6 -19
- package/examples/view_2d_map.html +6 -19
- package/examples/view_3d_map.html +106 -81
- package/examples/widgets_minimap.html +3 -1
- package/examples/widgets_navigation.html +6 -1
- package/examples/widgets_scale.html +96 -0
- package/examples/widgets_searchbar.html +124 -0
- package/lib/Controls/PlanarControls.js +10 -42
- package/lib/Converter/Feature2Mesh.js +225 -61
- package/lib/Converter/Feature2Texture.js +4 -3
- package/lib/Converter/convertToTile.js +10 -5
- package/lib/Core/Feature.js +57 -30
- package/lib/Core/MainLoop.js +136 -62
- package/lib/Core/TileMesh.js +21 -5
- package/lib/Core/View.js +46 -15
- package/lib/Layer/FeatureGeometryLayer.js +37 -10
- package/lib/Layer/GeoidLayer.js +17 -6
- package/lib/Layer/GeometryLayer.js +6 -54
- package/lib/Layer/OrientedImageLayer.js +1 -0
- package/lib/Layer/RasterLayer.js +3 -1
- package/lib/Layer/ReferencingLayerProperties.js +50 -0
- package/lib/Main.js +1 -1
- package/lib/Parser/B3dmParser.js +3 -2
- package/lib/Parser/GeoJsonParser.js +29 -7
- package/lib/Parser/VectorTileParser.js +5 -4
- package/lib/Parser/deprecated/LegacyGLTFLoader.js +3 -3
- package/lib/Process/3dTilesProcessing.js +3 -3
- package/lib/Process/FeatureProcessing.js +36 -86
- package/lib/Process/LayeredMaterialNodeProcessing.js +9 -3
- package/lib/Process/ObjectRemovalHelper.js +4 -0
- package/lib/Provider/3dTilesProvider.js +2 -7
- package/lib/Provider/Fetcher.js +5 -2
- package/lib/Provider/TileProvider.js +18 -2
- package/lib/Renderer/Camera.js +33 -12
- package/lib/Renderer/ColorLayersOrdering.js +3 -1
- package/lib/Renderer/LayeredMaterial.js +32 -7
- package/lib/Renderer/OBB.js +8 -4
- package/lib/Renderer/OrientedImageMaterial.js +8 -5
- package/lib/Renderer/PointsMaterial.js +1 -0
- package/lib/Renderer/RenderMode.js +3 -1
- package/lib/Renderer/Shader/ShaderChunk.js +5 -1
- package/lib/Renderer/c3DEngine.js +9 -6
- package/lib/Source/FileSource.js +8 -1
- package/lib/Source/VectorTilesSource.js +5 -0
- package/lib/Source/WFSSource.js +9 -3
- package/lib/ThreeExtended/{WebGL.js → capabilities/WebGL.js} +8 -7
- package/lib/ThreeExtended/loaders/GLTFLoader.js +3 -4
- package/lib/Utils/DEMUtils.js +3 -1
- package/lib/Utils/gui/Main.js +39 -0
- package/lib/Utils/gui/Minimap.js +195 -0
- package/lib/Utils/gui/Navigation.js +322 -0
- package/lib/Utils/gui/Scale.js +154 -0
- package/lib/Utils/gui/Searchbar.js +299 -0
- package/lib/Utils/gui/Widget.js +119 -0
- package/package.json +27 -22
- package/examples/images/compass.svg +0 -60
- package/examples/images/widget-logo.svg +0 -66
- package/examples/js/Scale.js +0 -41
|
@@ -2,17 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
9
|
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
15
|
-
|
|
16
10
|
var _LayerUpdateState = _interopRequireDefault(require("../Layer/LayerUpdateState"));
|
|
17
11
|
|
|
18
12
|
var _ObjectRemovalHelper = _interopRequireDefault(require("./ObjectRemovalHelper"));
|
|
@@ -21,48 +15,9 @@ var _handlerNodeError = _interopRequireDefault(require("./handlerNodeError"));
|
|
|
21
15
|
|
|
22
16
|
var _Coordinates = _interopRequireDefault(require("../Core/Geographic/Coordinates"));
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
29
|
-
|
|
30
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
31
|
-
|
|
32
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
18
|
+
var _GeoidLayer = require("../Layer/GeoidLayer");
|
|
33
19
|
|
|
34
20
|
var coord = new _Coordinates["default"]('EPSG:4326', 0, 0, 0);
|
|
35
|
-
|
|
36
|
-
function assignLayer(object, layer) {
|
|
37
|
-
if (object) {
|
|
38
|
-
object.layer = layer;
|
|
39
|
-
|
|
40
|
-
if (object.material) {
|
|
41
|
-
object.material.transparent = layer.opacity < 1.0;
|
|
42
|
-
object.material.opacity = layer.opacity;
|
|
43
|
-
object.material.wireframe = layer.wireframe;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
object.layers.set(layer.threejsLayer);
|
|
47
|
-
|
|
48
|
-
var _iterator = _createForOfIteratorHelper(object.children),
|
|
49
|
-
_step;
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
53
|
-
var c = _step.value;
|
|
54
|
-
assignLayer(c, layer);
|
|
55
|
-
}
|
|
56
|
-
} catch (err) {
|
|
57
|
-
_iterator.e(err);
|
|
58
|
-
} finally {
|
|
59
|
-
_iterator.f();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return object;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
21
|
var _default = {
|
|
67
22
|
update: function update(context, layer, node) {
|
|
68
23
|
if (!node.parent && node.children.length) {
|
|
@@ -79,17 +34,19 @@ var _default = {
|
|
|
79
34
|
if (node.layerUpdateState[layer.id] === undefined) {
|
|
80
35
|
node.layerUpdateState[layer.id] = new _LayerUpdateState["default"]();
|
|
81
36
|
} else if (!node.layerUpdateState[layer.id].canTryUpdate()) {
|
|
37
|
+
// toggle visibility features
|
|
38
|
+
node.link.forEach(function (f) {
|
|
39
|
+
var _f$layer;
|
|
40
|
+
|
|
41
|
+
if (((_f$layer = f.layer) === null || _f$layer === void 0 ? void 0 : _f$layer.id) == layer.id) {
|
|
42
|
+
f.layer.object3d.add(f);
|
|
43
|
+
f.meshes.position.z = (0, _GeoidLayer.geoidLayerIsVisible)(layer.parent) ? node.geoidHeight : 0;
|
|
44
|
+
f.meshes.updateMatrixWorld();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
82
47
|
return;
|
|
83
48
|
}
|
|
84
49
|
|
|
85
|
-
var features = node.children.filter(function (n) {
|
|
86
|
-
return n.layer == layer;
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
if (features.length > 0) {
|
|
90
|
-
return features;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
50
|
var extentsDestination = node.getExtentsByProjection(layer.source.crs) || [node.extent];
|
|
94
51
|
var zoomDest = extentsDestination[0].zoom; // check if it's tile level is equal to display level layer.
|
|
95
52
|
|
|
@@ -109,39 +66,32 @@ var _default = {
|
|
|
109
66
|
threejsLayer: layer.threejsLayer,
|
|
110
67
|
requester: node
|
|
111
68
|
};
|
|
112
|
-
return context.scheduler.execute(command).then(function (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
layer.onMeshCreated
|
|
69
|
+
return context.scheduler.execute(command).then(function (featureMeshes) {
|
|
70
|
+
node.layerUpdateState[layer.id].noMoreUpdatePossible();
|
|
71
|
+
featureMeshes.forEach(function (featureMesh) {
|
|
72
|
+
if (featureMesh) {
|
|
73
|
+
featureMesh.as(context.view.referenceCrs);
|
|
74
|
+
featureMesh.meshes.position.z = (0, _GeoidLayer.geoidLayerIsVisible)(layer.parent) ? node.geoidHeight : 0;
|
|
75
|
+
featureMesh.updateMatrixWorld();
|
|
76
|
+
|
|
77
|
+
if (layer.onMeshCreated) {
|
|
78
|
+
layer.onMeshCreated(featureMesh, context);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!node.parent) {
|
|
82
|
+
// TODO: Clean cache needs a refactory, because it isn't really efficient and used
|
|
83
|
+
_ObjectRemovalHelper["default"].removeChildrenAndCleanupRecursively(layer, featureMesh);
|
|
84
|
+
} else {
|
|
85
|
+
layer.object3d.add(featureMesh);
|
|
86
|
+
node.link.push(featureMesh);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
featureMesh.layer = layer;
|
|
90
|
+
} else {
|
|
91
|
+
// TODO: verify if it's possible the featureMesh is undefined.
|
|
92
|
+
node.layerUpdateState[layer.id].failure(1, true);
|
|
121
93
|
}
|
|
122
|
-
|
|
123
|
-
node.layerUpdateState[layer.id].success();
|
|
124
|
-
|
|
125
|
-
if (!node.parent) {
|
|
126
|
-
_ObjectRemovalHelper["default"].removeChildrenAndCleanupRecursively(layer, result);
|
|
127
|
-
|
|
128
|
-
return;
|
|
129
|
-
} // remove old group layer
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
node.remove.apply(node, (0, _toConsumableArray2["default"])(node.children.filter(function (c) {
|
|
133
|
-
return c.layer && c.layer.id == layer.id;
|
|
134
|
-
})));
|
|
135
|
-
var group = new THREE.Group();
|
|
136
|
-
group.layer = layer;
|
|
137
|
-
group.matrixWorld.copy(node.matrixWorld).invert();
|
|
138
|
-
group.matrixWorld.decompose(group.position, group.quaternion, group.scale);
|
|
139
|
-
group.position.z += node.geoidHeight;
|
|
140
|
-
node.add(group.add(result));
|
|
141
|
-
group.updateMatrixWorld(true);
|
|
142
|
-
} else {
|
|
143
|
-
node.layerUpdateState[layer.id].failure(1, true);
|
|
144
|
-
}
|
|
94
|
+
});
|
|
145
95
|
}, function (err) {
|
|
146
96
|
return (0, _handlerNodeError["default"])(err, node, layer, node.level, context.view);
|
|
147
97
|
});
|
|
@@ -91,10 +91,12 @@ function updateLayeredMaterialNodeImagery(context, layer, node, parent) {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
if (!nodeLayer) {
|
|
94
|
+
var _parent$material;
|
|
95
|
+
|
|
94
96
|
// Create new raster node
|
|
95
97
|
nodeLayer = layer.setupRasterNode(node); // Init the node by parent
|
|
96
98
|
|
|
97
|
-
var parentLayer =
|
|
99
|
+
var parentLayer = (_parent$material = parent.material) === null || _parent$material === void 0 ? void 0 : _parent$material.getLayer(layer.id);
|
|
98
100
|
nodeLayer.initFromParent(parentLayer, extentsDestination);
|
|
99
101
|
} // Proposed new process, two separate processes:
|
|
100
102
|
// * FIRST PASS: initNodeXXXFromParent and get out of the function
|
|
@@ -199,8 +201,10 @@ function updateLayeredMaterialNodeElevation(context, layer, node, parent) {
|
|
|
199
201
|
}
|
|
200
202
|
|
|
201
203
|
if (node.layerUpdateState[layer.id] === undefined) {
|
|
204
|
+
var _parent$material2;
|
|
205
|
+
|
|
202
206
|
node.layerUpdateState[layer.id] = new _LayerUpdateState["default"]();
|
|
203
|
-
var parentLayer = parent.material
|
|
207
|
+
var parentLayer = (_parent$material2 = parent.material) === null || _parent$material2 === void 0 ? void 0 : _parent$material2.getLayer(layer.id);
|
|
204
208
|
nodeLayer.initFromParent(parentLayer, extentsDestination);
|
|
205
209
|
|
|
206
210
|
if (nodeLayer.level >= layer.source.zoom.min) {
|
|
@@ -259,7 +263,9 @@ function updateLayeredMaterialNodeElevation(context, layer, node, parent) {
|
|
|
259
263
|
|
|
260
264
|
function removeLayeredMaterialNodeLayer(layerId) {
|
|
261
265
|
return function (node) {
|
|
262
|
-
|
|
266
|
+
var _node$material;
|
|
267
|
+
|
|
268
|
+
if ((_node$material = node.material) !== null && _node$material !== void 0 && _node$material.removeLayer) {
|
|
263
269
|
node.material.removeLayer(layerId);
|
|
264
270
|
|
|
265
271
|
if (node.material.elevationLayerIds[0] == layerId) {
|
|
@@ -32,7 +32,8 @@ function b3dmToMesh(data, layer, url) {
|
|
|
32
32
|
overrideMaterials: layer.overrideMaterials,
|
|
33
33
|
doNotPatchMaterial: layer.doNotPatchMaterial,
|
|
34
34
|
opacity: layer.opacity,
|
|
35
|
-
registeredExtensions: layer.registeredExtensions
|
|
35
|
+
registeredExtensions: layer.registeredExtensions,
|
|
36
|
+
layer: layer
|
|
36
37
|
};
|
|
37
38
|
return _B3dmParser["default"].parse(data, options).then(function (result) {
|
|
38
39
|
var batchTable = result.batchTable; // object3d is actually a THREE.Scene
|
|
@@ -104,12 +105,6 @@ function executeCommand(command) {
|
|
|
104
105
|
obj.layers.set(layer.threejsLayer);
|
|
105
106
|
obj.userData.metadata = metadata;
|
|
106
107
|
obj.layer = layer;
|
|
107
|
-
|
|
108
|
-
if (obj.material) {
|
|
109
|
-
obj.material.transparent = layer.opacity < 1.0;
|
|
110
|
-
obj.material.opacity = layer.opacity;
|
|
111
|
-
obj.material.wireframe = layer.wireframe;
|
|
112
|
-
}
|
|
113
108
|
};
|
|
114
109
|
|
|
115
110
|
if (path) {
|
package/lib/Provider/Fetcher.js
CHANGED
|
@@ -38,9 +38,12 @@ function getTextureFloat(buffer) {
|
|
|
38
38
|
if (isWebGL2) {
|
|
39
39
|
var texture = new _three.DataTexture(buffer, SIZE_TEXTURE_TILE, SIZE_TEXTURE_TILE, _three.RedFormat, _three.FloatType);
|
|
40
40
|
texture.internalFormat = 'R32F';
|
|
41
|
+
texture.needsUpdate = true;
|
|
41
42
|
return texture;
|
|
42
43
|
} else {
|
|
43
|
-
|
|
44
|
+
var _texture = new _three.DataTexture(buffer, SIZE_TEXTURE_TILE, SIZE_TEXTURE_TILE, _three.AlphaFormat, _three.FloatType);
|
|
45
|
+
|
|
46
|
+
return _texture;
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
49
|
/**
|
|
@@ -215,7 +218,7 @@ var _default = {
|
|
|
215
218
|
_step;
|
|
216
219
|
|
|
217
220
|
try {
|
|
218
|
-
var _loop = function () {
|
|
221
|
+
var _loop = function _loop() {
|
|
219
222
|
var extension = _step.value;
|
|
220
223
|
url = "".concat(baseUrl, ".").concat(extension);
|
|
221
224
|
promises.push(_this[fetchType](url, options).then(function (result) {
|
|
@@ -9,6 +9,12 @@ exports["default"] = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _CancelledCommandException = _interopRequireDefault(require("../Core/Scheduler/CancelledCommandException"));
|
|
11
11
|
|
|
12
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
13
|
+
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
17
|
+
|
|
12
18
|
var _default = {
|
|
13
19
|
executeCommand: function executeCommand(command) {
|
|
14
20
|
var promises = [];
|
|
@@ -20,8 +26,18 @@ var _default = {
|
|
|
20
26
|
return Promise.reject(new _CancelledCommandException["default"](command));
|
|
21
27
|
}
|
|
22
28
|
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
var _iterator = _createForOfIteratorHelper(extentsSource),
|
|
30
|
+
_step;
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
34
|
+
var extent = _step.value;
|
|
35
|
+
promises.push(layer.convert(requester, extent));
|
|
36
|
+
}
|
|
37
|
+
} catch (err) {
|
|
38
|
+
_iterator.e(err);
|
|
39
|
+
} finally {
|
|
40
|
+
_iterator.f();
|
|
25
41
|
}
|
|
26
42
|
|
|
27
43
|
return Promise.all(promises);
|
package/lib/Renderer/Camera.js
CHANGED
|
@@ -13,6 +13,10 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
13
13
|
|
|
14
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
15
|
|
|
16
|
+
var _classPrivateFieldGet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldGet"));
|
|
17
|
+
|
|
18
|
+
var _classPrivateFieldSet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldSet"));
|
|
19
|
+
|
|
16
20
|
var THREE = _interopRequireWildcard(require("three"));
|
|
17
21
|
|
|
18
22
|
var _Coordinates = _interopRequireDefault(require("../Core/Geographic/Coordinates"));
|
|
@@ -23,6 +27,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
23
27
|
|
|
24
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
29
|
|
|
30
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
31
|
+
|
|
32
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
33
|
+
|
|
26
34
|
/**
|
|
27
35
|
* @typedef {object} Camera~CAMERA_TYPE
|
|
28
36
|
* Stores the different types of camera usable in iTowns.
|
|
@@ -97,6 +105,10 @@ function updatePreSse(camera, height, fov) {
|
|
|
97
105
|
*/
|
|
98
106
|
|
|
99
107
|
|
|
108
|
+
var _viewMatrixNeedsUpdate = /*#__PURE__*/new WeakMap();
|
|
109
|
+
|
|
110
|
+
var _viewMatrix = /*#__PURE__*/new WeakMap();
|
|
111
|
+
|
|
100
112
|
var Camera = /*#__PURE__*/function () {
|
|
101
113
|
/**
|
|
102
114
|
* @param {string} crs The camera's coordinate projection system.
|
|
@@ -112,10 +124,22 @@ var Camera = /*#__PURE__*/function () {
|
|
|
112
124
|
* @constructor
|
|
113
125
|
*/
|
|
114
126
|
function Camera(crs, width, height) {
|
|
115
|
-
var _this
|
|
127
|
+
var _this$camera3D$aspect,
|
|
128
|
+
_this = this;
|
|
116
129
|
|
|
117
130
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
118
131
|
(0, _classCallCheck2["default"])(this, Camera);
|
|
132
|
+
|
|
133
|
+
_classPrivateFieldInitSpec(this, _viewMatrixNeedsUpdate, {
|
|
134
|
+
writable: true,
|
|
135
|
+
value: true
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
_classPrivateFieldInitSpec(this, _viewMatrix, {
|
|
139
|
+
writable: true,
|
|
140
|
+
value: new THREE.Matrix4()
|
|
141
|
+
});
|
|
142
|
+
|
|
119
143
|
this.crs = crs;
|
|
120
144
|
|
|
121
145
|
if (options.isCamera) {
|
|
@@ -136,11 +160,9 @@ var Camera = /*#__PURE__*/function () {
|
|
|
136
160
|
}
|
|
137
161
|
}
|
|
138
162
|
|
|
139
|
-
this.camera3D.aspect = this.camera3D.aspect !==
|
|
140
|
-
this._viewMatrix = new THREE.Matrix4();
|
|
163
|
+
this.camera3D.aspect = (_this$camera3D$aspect = this.camera3D.aspect) !== null && _this$camera3D$aspect !== void 0 ? _this$camera3D$aspect : 1;
|
|
141
164
|
this.width = width;
|
|
142
165
|
this.height = height;
|
|
143
|
-
this._viewMatrixNeedsUpdate = true;
|
|
144
166
|
this.resize(width, height);
|
|
145
167
|
this._preSSE = Infinity;
|
|
146
168
|
|
|
@@ -189,7 +211,7 @@ var Camera = /*#__PURE__*/function () {
|
|
|
189
211
|
|
|
190
212
|
if (this.camera3D.updateProjectionMatrix) {
|
|
191
213
|
this.camera3D.updateProjectionMatrix();
|
|
192
|
-
this
|
|
214
|
+
(0, _classPrivateFieldSet2["default"])(this, _viewMatrixNeedsUpdate, true);
|
|
193
215
|
}
|
|
194
216
|
}
|
|
195
217
|
}, {
|
|
@@ -197,7 +219,7 @@ var Camera = /*#__PURE__*/function () {
|
|
|
197
219
|
value: function update() {
|
|
198
220
|
// update matrix
|
|
199
221
|
this.camera3D.updateMatrixWorld();
|
|
200
|
-
this
|
|
222
|
+
(0, _classPrivateFieldSet2["default"])(this, _viewMatrixNeedsUpdate, true);
|
|
201
223
|
}
|
|
202
224
|
/**
|
|
203
225
|
* Return the position in the requested CRS, or in camera's CRS if undefined.
|
|
@@ -232,18 +254,17 @@ var Camera = /*#__PURE__*/function () {
|
|
|
232
254
|
}, {
|
|
233
255
|
key: "isSphereVisible",
|
|
234
256
|
value: function isSphereVisible(sphere, matrixWorld) {
|
|
235
|
-
if (this
|
|
257
|
+
if ((0, _classPrivateFieldGet2["default"])(this, _viewMatrixNeedsUpdate)) {
|
|
236
258
|
// update visibility testing matrix
|
|
237
|
-
this
|
|
238
|
-
|
|
239
|
-
this._viewMatrixNeedsUpdate = false;
|
|
259
|
+
(0, _classPrivateFieldGet2["default"])(this, _viewMatrix).multiplyMatrices(this.camera3D.projectionMatrix, this.camera3D.matrixWorldInverse);
|
|
260
|
+
(0, _classPrivateFieldSet2["default"])(this, _viewMatrixNeedsUpdate, false);
|
|
240
261
|
}
|
|
241
262
|
|
|
242
263
|
if (matrixWorld) {
|
|
243
|
-
tmp.matrix.multiplyMatrices(this
|
|
264
|
+
tmp.matrix.multiplyMatrices((0, _classPrivateFieldGet2["default"])(this, _viewMatrix), matrixWorld);
|
|
244
265
|
tmp.frustum.setFromProjectionMatrix(tmp.matrix);
|
|
245
266
|
} else {
|
|
246
|
-
tmp.frustum.setFromProjectionMatrix(this
|
|
267
|
+
tmp.frustum.setFromProjectionMatrix((0, _classPrivateFieldGet2["default"])(this, _viewMatrix));
|
|
247
268
|
}
|
|
248
269
|
|
|
249
270
|
return tmp.frustum.intersectsSphere(sphere);
|
|
@@ -17,7 +17,9 @@ function updateLayersOrdering(geometryLayer, imageryLayers) {
|
|
|
17
17
|
var sequence = _Layer.ImageryLayers.getColorLayersIdOrderedBySequence(imageryLayers);
|
|
18
18
|
|
|
19
19
|
var cO = function (object) {
|
|
20
|
-
|
|
20
|
+
var _object$material;
|
|
21
|
+
|
|
22
|
+
if ((_object$material = object.material) !== null && _object$material !== void 0 && _object$material.setSequence) {
|
|
21
23
|
object.material.setSequence(sequence);
|
|
22
24
|
}
|
|
23
25
|
};
|
|
@@ -23,6 +23,10 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
23
23
|
|
|
24
24
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
25
|
|
|
26
|
+
var _classPrivateFieldSet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldSet"));
|
|
27
|
+
|
|
28
|
+
var _classPrivateFieldGet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldGet"));
|
|
29
|
+
|
|
26
30
|
var THREE = _interopRequireWildcard(require("three"));
|
|
27
31
|
|
|
28
32
|
var _ShaderUtils = _interopRequireDefault(require("./Shader/ShaderUtils"));
|
|
@@ -41,6 +45,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
41
45
|
|
|
42
46
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
47
|
|
|
48
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
49
|
+
|
|
50
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
51
|
+
|
|
44
52
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
45
53
|
|
|
46
54
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -48,7 +56,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
48
56
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
49
57
|
|
|
50
58
|
/* babel-plugin-inline-import './Shader/TileVS.glsl' */
|
|
51
|
-
var TileVS = "#include <itowns/WebGL2_pars_vertex>\n#include <itowns/precision_qualifier>\n#include <common>\n#include <itowns/project_pars_vertex>\n#include <itowns/elevation_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nattribute vec2 uv_0;\n#if NUM_CRS > 1\nattribute float uv_1;\n#endif\nattribute vec3 normal;\n\nuniform mat4 modelMatrix;\nuniform bool lightingEnabled;\nvarying vec2 vHighPrecisionZW;\n\n#if MODE == MODE_FINAL\n#include <fog_pars_vertex>\nvarying vec3 vUv;\nvarying vec3 vNormal;\n#endif\nvoid main() {\n vec2 uv = vec2(uv_0.x, 1.0 - uv_0.y);\n\n #include <begin_vertex>\n #include <itowns/elevation_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n vHighPrecisionZW = gl_Position.zw;\n#if MODE == MODE_FINAL\n #include <fog_vertex>\n #if NUM_CRS > 1\n vUv = vec3(uv_0, (uv_1 > 0.) ? uv_1 : uv_0.y); // set uv_1 = uv_0 if uv_1 is undefined\n #else\n vUv = vec3(uv_0, 0.0);\n #endif\n vNormal = normalize ( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\n#endif\n}\n";
|
|
59
|
+
var TileVS = "#include <itowns/WebGL2_pars_vertex>\n#include <itowns/precision_qualifier>\n#include <common>\n#include <itowns/project_pars_vertex>\n#include <itowns/elevation_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nattribute vec2 uv_0;\n#if NUM_CRS > 1\nattribute float uv_1;\n#endif\nattribute vec3 normal;\n\nuniform mat4 modelMatrix;\nuniform bool lightingEnabled;\nvarying vec2 vHighPrecisionZW;\n\n#if MODE == MODE_FINAL\n#include <fog_pars_vertex>\nvarying vec3 vUv;\nvarying vec3 vNormal;\n#endif\nvoid main() {\n vec2 uv = vec2(uv_0.x, 1.0 - uv_0.y);\n\n #include <begin_vertex>\n #include <itowns/elevation_vertex>\n #include <itowns/geoid_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n vHighPrecisionZW = gl_Position.zw;\n#if MODE == MODE_FINAL\n #include <fog_vertex>\n #if NUM_CRS > 1\n vUv = vec3(uv_0, (uv_1 > 0.) ? uv_1 : uv_0.y); // set uv_1 = uv_0 if uv_1 is undefined\n #else\n vUv = vec3(uv_0, 0.0);\n #endif\n vNormal = normalize ( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\n#endif\n}\n";
|
|
52
60
|
|
|
53
61
|
/* babel-plugin-inline-import './Shader/TileFS.glsl' */
|
|
54
62
|
var TileFS = "#include <itowns/WebGL2_pars_fragment>\n#include <itowns/precision_qualifier>\n#include <logdepthbuf_pars_fragment>\n#include <itowns/pitUV>\n#include <itowns/color_layers_pars_fragment>\n#if MODE == MODE_FINAL\n#include <itowns/fog_pars_fragment>\n#include <itowns/overlay_pars_fragment>\n#include <itowns/lighting_pars_fragment>\n#endif\n#include <itowns/mode_pars_fragment>\n\nuniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vUv; // uv_0.x/uv_1.x, uv_0.y, uv_1.y\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n #include <logdepthbuf_fragment>\n\n#if MODE == MODE_ID\n\n #include <itowns/mode_id_fragment>\n\n#elif MODE == MODE_DEPTH\n\n #include <itowns/mode_depth_fragment>\n\n#else\n\n gl_FragColor = vec4(diffuse, opacity);\n\n uvs[0] = vec3(vUv.xy, 0.);\n\n#if NUM_CRS > 1\n uvs[1] = vec3(vUv.x, fract(vUv.z), floor(vUv.z));\n#endif\n\n vec4 color;\n #pragma unroll_loop\n for ( int i = 0; i < NUM_FS_TEXTURES; i ++ ) {\n color = getLayerColor( i , colorTextures[ i ], colorOffsetScales[ i ], colorLayers[ i ]);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, color.rgb, color.a);\n }\n\n #if defined(DEBUG)\n if (showOutline) {\n #pragma unroll_loop\n for ( int i = 0; i < NUM_CRS; i ++) {\n color = getOutlineColor( outlineColors[ i ], uvs[ i ].xy);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, color.rgb, color.a);\n }\n }\n #endif\n\n #include <itowns/fog_fragment>\n #include <itowns/lighting_fragment>\n #include <itowns/overlay_fragment>\n\n#endif\n}\n";
|
|
@@ -150,6 +158,8 @@ exports.ELEVATION_MODES = ELEVATION_MODES;
|
|
|
150
158
|
var nbSamplers;
|
|
151
159
|
var fragmentShader = [];
|
|
152
160
|
|
|
161
|
+
var _visible = /*#__PURE__*/new WeakMap();
|
|
162
|
+
|
|
153
163
|
var LayeredMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) {
|
|
154
164
|
(0, _inherits2["default"])(LayeredMaterial, _THREE$RawShaderMater);
|
|
155
165
|
|
|
@@ -162,6 +172,12 @@ var LayeredMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) {
|
|
|
162
172
|
var crsCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
163
173
|
(0, _classCallCheck2["default"])(this, LayeredMaterial);
|
|
164
174
|
_this = _super.call(this, options);
|
|
175
|
+
|
|
176
|
+
_classPrivateFieldInitSpec((0, _assertThisInitialized2["default"])(_this), _visible, {
|
|
177
|
+
writable: true,
|
|
178
|
+
value: true
|
|
179
|
+
});
|
|
180
|
+
|
|
165
181
|
nbSamplers = nbSamplers || [samplersElevationCount, getMaxColorSamplerUnitsCount()];
|
|
166
182
|
_this.defines.NUM_VS_TEXTURES = nbSamplers[0];
|
|
167
183
|
_this.defines.NUM_FS_TEXTURES = nbSamplers[1];
|
|
@@ -201,7 +217,9 @@ var LayeredMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) {
|
|
|
201
217
|
|
|
202
218
|
_CommonMaterial["default"].setUniformProperty((0, _assertThisInitialized2["default"])(_this), 'overlayColor', new THREE.Color(1.0, 0.3, 0.0));
|
|
203
219
|
|
|
204
|
-
_CommonMaterial["default"].setUniformProperty((0, _assertThisInitialized2["default"])(_this), 'objectId', 0);
|
|
220
|
+
_CommonMaterial["default"].setUniformProperty((0, _assertThisInitialized2["default"])(_this), 'objectId', 0);
|
|
221
|
+
|
|
222
|
+
_CommonMaterial["default"].setUniformProperty((0, _assertThisInitialized2["default"])(_this), 'geoidHeight', 0.0); // > 0 produces gaps,
|
|
205
223
|
// < 0 causes oversampling of textures
|
|
206
224
|
// = 0 causes sampling artefacts due to bad estimation of texture-uv gradients
|
|
207
225
|
// best is a small negative number
|
|
@@ -222,16 +240,23 @@ var LayeredMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) {
|
|
|
222
240
|
_this.uniforms.colorLayers = new THREE.Uniform(new Array(nbSamplers[1]).fill(defaultStructLayer));
|
|
223
241
|
_this.uniforms.colorTextures = new THREE.Uniform(new Array(nbSamplers[1]).fill(defaultTex));
|
|
224
242
|
_this.uniforms.colorOffsetScales = new THREE.Uniform(new Array(nbSamplers[1]).fill(identityOffsetScale));
|
|
225
|
-
_this.uniforms.colorTextureCount = new THREE.Uniform(0);
|
|
226
|
-
var _visible = _this.visible; // can't do an ES6 setter/getter here
|
|
243
|
+
_this.uniforms.colorTextureCount = new THREE.Uniform(0); // can't do an ES6 setter/getter here
|
|
227
244
|
|
|
228
245
|
Object.defineProperty((0, _assertThisInitialized2["default"])(_this), 'visible', {
|
|
246
|
+
// Knowing the visibility of a `LayeredMaterial` is useful. For example in a
|
|
247
|
+
// `GlobeView`, if you zoom in, "parent" tiles seems hidden; in fact, there
|
|
248
|
+
// are not, it is only their material (so `LayeredMaterial`) that is set to
|
|
249
|
+
// not visible.
|
|
250
|
+
// Adding an event when changing this property can be useful to hide others
|
|
251
|
+
// things, like in `TileDebug`, or in later PR to come (#1303 for example).
|
|
252
|
+
//
|
|
253
|
+
// TODO : verify if there is a better mechanism to avoid this event
|
|
229
254
|
get: function get() {
|
|
230
|
-
return _visible;
|
|
255
|
+
return (0, _classPrivateFieldGet2["default"])(this, _visible);
|
|
231
256
|
},
|
|
232
257
|
set: function set(v) {
|
|
233
|
-
if (_visible != v) {
|
|
234
|
-
_visible
|
|
258
|
+
if ((0, _classPrivateFieldGet2["default"])(this, _visible) != v) {
|
|
259
|
+
(0, _classPrivateFieldSet2["default"])(this, _visible, v);
|
|
235
260
|
this.dispatchEvent({
|
|
236
261
|
type: v ? 'shown' : 'hidden'
|
|
237
262
|
});
|
package/lib/Renderer/OBB.js
CHANGED
|
@@ -125,18 +125,22 @@ var OBB = /*#__PURE__*/function (_THREE$Object3D) {
|
|
|
125
125
|
* @param {number} [elevation.min] The minimum of oriented bounding box
|
|
126
126
|
* @param {number} [elevation.max] The maximum of oriented bounding box
|
|
127
127
|
* @param {number} [elevation.scale] The scale of oriented bounding box Z axis
|
|
128
|
+
* @param {number} [elevation.geoidHeight] The geoid height added to ellipsoid.
|
|
128
129
|
*/
|
|
129
130
|
|
|
130
131
|
}, {
|
|
131
132
|
key: "updateZ",
|
|
132
133
|
value: function updateZ() {
|
|
134
|
+
var _elevation$min, _elevation$max;
|
|
135
|
+
|
|
133
136
|
var elevation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
134
|
-
this.z.min = elevation.min !==
|
|
135
|
-
this.z.max = elevation.max !==
|
|
137
|
+
this.z.min = (_elevation$min = elevation.min) !== null && _elevation$min !== void 0 ? _elevation$min : this.z.min;
|
|
138
|
+
this.z.max = (_elevation$max = elevation.max) !== null && _elevation$max !== void 0 ? _elevation$max : this.z.max;
|
|
136
139
|
this.z.scale = elevation.scale > 0 ? elevation.scale : this.z.scale;
|
|
137
140
|
this.z.delta = Math.abs(this.z.max - this.z.min) * this.z.scale;
|
|
138
|
-
|
|
139
|
-
this.box3D.
|
|
141
|
+
var geoidHeight = elevation.geoidHeight || 0;
|
|
142
|
+
this.box3D.min.z = this.natBox.min.z + this.z.min * this.z.scale + geoidHeight;
|
|
143
|
+
this.box3D.max.z = this.natBox.max.z + this.z.max * this.z.scale + geoidHeight;
|
|
140
144
|
}
|
|
141
145
|
/**
|
|
142
146
|
* Determines if the sphere is above the XY space of the box
|
|
@@ -39,7 +39,8 @@ var textureVS = "#include <itowns/WebGL2_pars_vertex>\n#include <itowns/precisio
|
|
|
39
39
|
/* babel-plugin-inline-import './Shader/ProjectiveTextureFS.glsl' */
|
|
40
40
|
var textureFS = "#include <itowns/WebGL2_pars_fragment>\n#include <itowns/precision_qualifier>\n#include <logdepthbuf_pars_fragment>\n#include <itowns/projective_texturing_pars_fragment>\nvarying vec3 vNormal;\n\n#ifdef USE_BASE_MATERIAL\nstruct noPT {\n vec3 lightDirection;\n vec3 ambient;\n float opacity;\n};\n\nuniform noPT noProjectiveMaterial;\n#endif\n\nvoid main(void)\n{\n #include <logdepthbuf_fragment>\n #ifdef USE_BASE_MATERIAL\n float nDotVP = (max(0.1, dot(vNormal, normalize(noProjectiveMaterial.lightDirection))));\n vec4 color = vec4(noProjectiveMaterial.ambient + nDotVP, 0.0);\n #else\n vec4 color = vec4(0.0);\n #endif\n\n #pragma unroll_loop\n for (int i = 0; i < ORIENTED_IMAGES_COUNT; i++) {\n color = projectiveTextureColor(projectiveTextureCoords[ ORIENTED_IMAGES_COUNT - 1 - i ], projectiveTextureDistortion[ ORIENTED_IMAGES_COUNT - 1 - i ], projectiveTexture[ ORIENTED_IMAGES_COUNT - 1 - i ], mask[ORIENTED_IMAGES_COUNT - 1 - i], color);\n }\n\n #ifdef USE_BASE_MATERIAL\n color.a = color.a < 1.0 ? max(noProjectiveMaterial.opacity, color.a) : 1.0 ;\n gl_FragColor = vec4(color.rgb, color.a * opacity);\n #else\n gl_FragColor = vec4(color.rgb / color.a, opacity);\n #endif\n\n}\n";
|
|
41
41
|
var ndcToTextureMatrix = new THREE.Matrix4().set(1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 2, 0, 0, 0, 0, 2);
|
|
42
|
-
var noMask = new THREE.DataTexture(new Uint8Array([255, 255, 255]), 1, 1, THREE.
|
|
42
|
+
var noMask = new THREE.DataTexture(new Uint8Array([255, 255, 255, 255]), 1, 1, THREE.RGBAFormat, THREE.UnsignedByteType);
|
|
43
|
+
noMask.needsUpdate = true;
|
|
43
44
|
var noTexture = new THREE.Texture();
|
|
44
45
|
var rawShaderMaterial = new THREE.RawShaderMaterial();
|
|
45
46
|
/**
|
|
@@ -85,13 +86,15 @@ var OrientedImageMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) {
|
|
|
85
86
|
* @param {Number} [options.debugAlphaBorder=0] - Set this option to 1 to see influence of alphaBorder option.
|
|
86
87
|
*/
|
|
87
88
|
function OrientedImageMaterial(cameras) {
|
|
89
|
+
var _options$side, _options$transparent, _options$opacity, _options$OrientedImag;
|
|
90
|
+
|
|
88
91
|
var _this;
|
|
89
92
|
|
|
90
93
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
91
94
|
(0, _classCallCheck2["default"])(this, OrientedImageMaterial);
|
|
92
|
-
options.side = options.side !==
|
|
93
|
-
options.transparent = options.transparent !==
|
|
94
|
-
options.opacity = options.opacity !==
|
|
95
|
+
options.side = (_options$side = options.side) !== null && _options$side !== void 0 ? _options$side : THREE.DoubleSide;
|
|
96
|
+
options.transparent = (_options$transparent = options.transparent) !== null && _options$transparent !== void 0 ? _options$transparent : true;
|
|
97
|
+
options.opacity = (_options$opacity = options.opacity) !== null && _options$opacity !== void 0 ? _options$opacity : 1; // Filter the rawShaderMaterial options
|
|
95
98
|
|
|
96
99
|
var rawShaderMaterialOptions = {};
|
|
97
100
|
|
|
@@ -106,7 +109,7 @@ var OrientedImageMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) {
|
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
_this = _super.call(this, rawShaderMaterialOptions);
|
|
109
|
-
_this.defines.ORIENTED_IMAGES_COUNT = options.OrientedImagesCount !==
|
|
112
|
+
_this.defines.ORIENTED_IMAGES_COUNT = (_options$OrientedImag = options.OrientedImagesCount) !== null && _options$OrientedImag !== void 0 ? _options$OrientedImag : cameras.length; // verify that number of textures doesn't exceed GPU capabilities
|
|
110
113
|
|
|
111
114
|
var maxTexturesUnits = _Capabilities["default"].getMaxTextureUnitsCount();
|
|
112
115
|
|
|
@@ -220,6 +220,7 @@ var PointsMaterial = /*#__PURE__*/function (_THREE$RawShaderMater) {
|
|
|
220
220
|
|
|
221
221
|
var data = new Uint8Array(256 * 4);
|
|
222
222
|
var texture = new THREE.DataTexture(data, 256, 1, THREE.RGBAFormat);
|
|
223
|
+
texture.needsUpdate = true;
|
|
223
224
|
texture.magFilter = THREE.NearestFilter;
|
|
224
225
|
|
|
225
226
|
_CommonMaterial["default"].setUniformProperty((0, _assertThisInitialized2["default"])(_this), 'classificationLUT', texture); // Classification scheme
|
|
@@ -14,7 +14,9 @@ var MODES = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
function push(object3d, mode) {
|
|
17
|
-
var
|
|
17
|
+
var _object3d$mode;
|
|
18
|
+
|
|
19
|
+
var _mode = (_object3d$mode = object3d.mode) !== null && _object3d$mode !== void 0 ? _object3d$mode : MODES.FINAL;
|
|
18
20
|
|
|
19
21
|
if (_mode == mode) {
|
|
20
22
|
return function () {};
|
|
@@ -23,11 +23,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
23
23
|
var color_layers_pars_fragment = "struct Layer {\n int textureOffset;\n int crs;\n int effect_type;\n float effect_parameter;\n float opacity;\n bool transparent;\n};\n\n#include <itowns/custom_header_colorLayer>\n\nuniform sampler2D colorTextures[NUM_FS_TEXTURES];\nuniform vec4 colorOffsetScales[NUM_FS_TEXTURES];\nuniform Layer colorLayers[NUM_FS_TEXTURES];\nuniform int colorTextureCount;\n\nvec3 uvs[NUM_CRS];\n\nfloat getBorderDistance(vec2 uv) {\n vec2 p2 = min(uv, 1. -uv);\n return min(p2.x, p2.y);\n}\n\nfloat tolerance = 0.99;\n\nvec4 applyWhiteToInvisibleEffect(vec4 color, float intensity) {\n float a = dot(color.rgb, vec3(0.333333333));\n if (a >= tolerance) {\n color.a *= 1.0 - pow(abs(a), intensity);\n }\n return color;\n}\n\nvec4 applyLightColorToInvisibleEffect(vec4 color, float intensity) {\n float a = max(0.05,1. - length(color.xyz - 1.));\n color.a *= 1.0 - pow(abs(a), intensity);\n color.rgb *= color.rgb * color.rgb;\n return color;\n}\n\n#if defined(DEBUG)\nuniform bool showOutline;\nuniform vec3 outlineColors[NUM_CRS];\nuniform float outlineWidth;\n\nvec4 getOutlineColor(vec3 outlineColor, vec2 uv) {\n float alpha = 1. - clamp(getBorderDistance(uv) / outlineWidth, 0., 1.);\n return vec4(outlineColor, alpha);\n}\n#endif\n\nuniform float minBorderDistance;\nvec4 getLayerColor(int textureOffset, sampler2D tex, vec4 offsetScale, Layer layer) {\n if ( textureOffset >= colorTextureCount ) return vec4(0);\n\n vec3 uv;\n // #pragma unroll_loop\n for ( int i = 0; i < NUM_CRS; i ++ ) {\n if ( i == layer.crs ) uv = uvs[ i ];\n }\n\n float borderDistance = getBorderDistance(uv.xy);\n if (textureOffset != layer.textureOffset + int(uv.z) || borderDistance < minBorderDistance ) return vec4(0);\n vec4 color = texture2D(tex, pitUV(uv.xy, offsetScale));\n if (layer.effect_type == 3) {\n #include <itowns/custom_body_colorLayer>\n } else {\n if (layer.transparent && color.a != 0.0) {\n color.rgb /= color.a;\n }\n\n if (layer.effect_type == 1) {\n color = applyLightColorToInvisibleEffect(color, layer.effect_parameter);\n } else if (layer.effect_type == 2) {\n color = applyWhiteToInvisibleEffect(color, layer.effect_parameter);\n }\n }\n color.a *= layer.opacity;\n return color;\n}\n";
|
|
24
24
|
|
|
25
25
|
/* babel-plugin-inline-import './Chunk/elevation_pars_vertex.glsl' */
|
|
26
|
-
var elevation_pars_vertex = "#if NUM_VS_TEXTURES > 0\n struct Layer {\n float scale;\n float bias;\n int mode;\n float zmin;\n float zmax;\n };\n\n uniform Layer elevationLayers[NUM_VS_TEXTURES];\n uniform sampler2D elevationTextures[NUM_VS_TEXTURES];\n uniform vec4 elevationOffsetScales[NUM_VS_TEXTURES];\n uniform int elevationTextureCount;\n\n highp float decode32(highp vec4 rgba) {\n highp float Sign = 1.0 - step(128.0,rgba[0])*2.0;\n highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0;\n highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000);\n highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 ));\n return Result;\n }\n\n float getElevationMode(vec2 uv, sampler2D tex, int mode) {\n if (mode == ELEVATION_RGBA)\n return decode32(texture2D( tex, uv ).abgr * 255.0);\n if (mode == ELEVATION_DATA || mode == ELEVATION_COLOR)\n #if defined(WEBGL2)\n return texture2D( tex, uv ).r;\n #else\n return texture2D( tex, uv ).w;\n #endif\n return 0.;\n }\n\n float getElevation(vec2 uv, sampler2D tex, vec4 offsetScale, Layer layer) {\n uv = uv * offsetScale.zw + offsetScale.xy;\n float d = getElevationMode(uv, tex, layer.mode);\n if (d < layer.zmin || d > layer.zmax) d = 0.;\n return d * layer.scale + layer.bias;\n }\n#endif\n";
|
|
26
|
+
var elevation_pars_vertex = "#if NUM_VS_TEXTURES > 0\n struct Layer {\n float scale;\n float bias;\n int mode;\n float zmin;\n float zmax;\n };\n\n uniform Layer elevationLayers[NUM_VS_TEXTURES];\n uniform sampler2D elevationTextures[NUM_VS_TEXTURES];\n uniform vec4 elevationOffsetScales[NUM_VS_TEXTURES];\n uniform int elevationTextureCount;\n uniform float geoidHeight;\n\n highp float decode32(highp vec4 rgba) {\n highp float Sign = 1.0 - step(128.0,rgba[0])*2.0;\n highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0;\n highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000);\n highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 ));\n return Result;\n }\n\n float getElevationMode(vec2 uv, sampler2D tex, int mode) {\n if (mode == ELEVATION_RGBA)\n return decode32(texture2D( tex, uv ).abgr * 255.0);\n if (mode == ELEVATION_DATA || mode == ELEVATION_COLOR)\n #if defined(WEBGL2)\n return texture2D( tex, uv ).r;\n #else\n return texture2D( tex, uv ).w;\n #endif\n return 0.;\n }\n\n float getElevation(vec2 uv, sampler2D tex, vec4 offsetScale, Layer layer) {\n uv = uv * offsetScale.zw + offsetScale.xy;\n float d = getElevationMode(uv, tex, layer.mode);\n if (d < layer.zmin || d > layer.zmax) d = 0.;\n return d * layer.scale + layer.bias;\n }\n#endif\n";
|
|
27
27
|
|
|
28
28
|
/* babel-plugin-inline-import './Chunk/elevation_vertex.glsl' */
|
|
29
29
|
var elevation_vertex = "#if NUM_VS_TEXTURES > 0\n if(elevationTextureCount > 0) {\n float elevation = getElevation(uv, elevationTextures[0], elevationOffsetScales[0], elevationLayers[0]);\n transformed += elevation * normal;\n }\n#endif\n";
|
|
30
30
|
|
|
31
|
+
/* babel-plugin-inline-import './Chunk/geoid_vertex.glsl' */
|
|
32
|
+
var geoid_vertex = "transformed += geoidHeight * normal;\n";
|
|
33
|
+
|
|
31
34
|
/* babel-plugin-inline-import './Chunk/fog_fragment.glsl' */
|
|
32
35
|
var fog_fragment = "#if defined(USE_FOG)\n float fogFactor = 1. - min( exp(-vFogDepth / fogDistance), 1.);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor);\n#endif\n";
|
|
33
36
|
|
|
@@ -86,6 +89,7 @@ var itownsShaderChunk = {
|
|
|
86
89
|
custom_header_colorLayer: custom_header_colorLayer,
|
|
87
90
|
elevation_pars_vertex: elevation_pars_vertex,
|
|
88
91
|
elevation_vertex: elevation_vertex,
|
|
92
|
+
geoid_vertex: geoid_vertex,
|
|
89
93
|
fog_fragment: fog_fragment,
|
|
90
94
|
fog_pars_fragment: fog_pars_fragment,
|
|
91
95
|
lighting_fragment: lighting_fragment,
|