itowns 2.42.1-next.15 → 2.42.1-next.17
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/debug.js +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_widgets.js +1 -1
- package/dist/itowns_widgets.js.map +1 -1
- package/examples/{.eslintrc.js → .eslintrc.cjs} +1 -1
- package/lib/Controls/FirstPersonControls.js +5 -12
- package/lib/Controls/FlyControls.js +4 -13
- package/lib/Controls/GlobeControls.js +33 -43
- package/lib/Controls/PlanarControls.js +9 -20
- package/lib/Controls/StateControl.js +2 -11
- package/lib/Controls/StreetControls.js +14 -24
- package/lib/Converter/Feature2Mesh.js +28 -38
- package/lib/Converter/Feature2Texture.js +15 -25
- package/lib/Converter/convertToTile.js +13 -24
- package/lib/Converter/textureConverter.js +9 -19
- package/lib/Core/3DTiles/C3DTBatchTable.js +5 -13
- package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +1 -8
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +17 -27
- package/lib/Core/3DTiles/C3DTExtensions.js +1 -8
- package/lib/Core/3DTiles/C3DTFeature.js +3 -10
- package/lib/Core/3DTiles/C3DTilesEnums.js +3 -11
- package/lib/Core/3DTiles/C3DTileset.js +7 -16
- package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +5 -11
- package/lib/Core/AnimationPlayer.js +2 -11
- package/lib/Core/Deprecated/Undeprecator.js +8 -19
- package/lib/Core/EntwinePointTileNode.js +6 -16
- package/lib/Core/Feature.js +16 -30
- package/lib/Core/Geographic/CoordStars.js +3 -12
- package/lib/Core/Geographic/Coordinates.js +12 -22
- package/lib/Core/Geographic/Crs.js +7 -15
- package/lib/Core/Geographic/Extent.js +36 -47
- package/lib/Core/Geographic/GeoidGrid.js +6 -16
- package/lib/Core/Label.js +7 -17
- package/lib/Core/MainLoop.js +7 -16
- package/lib/Core/Math/Ellipsoid.js +6 -17
- package/lib/Core/Picking.js +10 -20
- package/lib/Core/PointCloudNode.js +2 -11
- package/lib/Core/PotreeNode.js +4 -13
- package/lib/Core/Prefab/Globe/Atmosphere.js +17 -26
- package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +6 -16
- package/lib/Core/Prefab/Globe/GlobeLayer.js +19 -28
- package/lib/Core/Prefab/Globe/SkyShader.js +2 -11
- package/lib/Core/Prefab/GlobeView.js +27 -37
- package/lib/Core/Prefab/Planar/PlanarLayer.js +11 -20
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +6 -16
- package/lib/Core/Prefab/PlanarView.js +10 -20
- package/lib/Core/Prefab/TileBuilder.js +10 -19
- package/lib/Core/Prefab/computeBufferTileGeometry.js +3 -12
- package/lib/Core/Scheduler/Cache.js +2 -10
- package/lib/Core/Scheduler/CancelledCommandException.js +1 -8
- package/lib/Core/Scheduler/Scheduler.js +15 -23
- package/lib/Core/Style.js +21 -34
- package/lib/Core/System/Capabilities.js +2 -9
- package/lib/Core/TileGeometry.js +5 -14
- package/lib/Core/TileMesh.js +6 -15
- package/lib/Core/View.js +43 -53
- package/lib/Layer/C3DTilesLayer.js +25 -37
- package/lib/Layer/ColorLayer.js +10 -16
- package/lib/Layer/ElevationLayer.js +7 -14
- package/lib/Layer/EntwinePointTileLayer.js +8 -18
- package/lib/Layer/FeatureGeometryLayer.js +9 -16
- package/lib/Layer/GeoidLayer.js +6 -15
- package/lib/Layer/GeometryLayer.js +11 -17
- package/lib/Layer/InfoLayer.js +5 -14
- package/lib/Layer/LabelLayer.js +22 -32
- package/lib/Layer/Layer.js +16 -26
- package/lib/Layer/LayerUpdateState.js +1 -8
- package/lib/Layer/LayerUpdateStrategy.js +7 -18
- package/lib/Layer/OrientedImageLayer.js +15 -25
- package/lib/Layer/PointCloudLayer.js +9 -19
- package/lib/Layer/PotreeLayer.js +8 -18
- package/lib/Layer/RasterLayer.js +9 -17
- package/lib/Layer/ReferencingLayerProperties.js +1 -8
- package/lib/Layer/TiledGeometryLayer.js +21 -31
- package/lib/Main.js +86 -720
- package/lib/MainBundle.js +4 -34
- package/lib/Parser/B3dmParser.js +20 -28
- package/lib/Parser/CameraCalibrationParser.js +5 -14
- package/lib/Parser/GDFParser.js +11 -22
- package/lib/Parser/GLTFParser.js +13 -28
- package/lib/Parser/GTXParser.js +9 -21
- package/lib/Parser/GeoJsonParser.js +13 -21
- package/lib/Parser/GpxParser.js +7 -14
- package/lib/Parser/ISGParser.js +19 -28
- package/lib/Parser/KMLParser.js +7 -14
- package/lib/Parser/LASLoader.js +11 -16
- package/lib/Parser/LASParser.js +5 -15
- package/lib/Parser/MapBoxUrlParser.js +2 -9
- package/lib/Parser/PntsParser.js +4 -14
- package/lib/Parser/PotreeBinParser.js +3 -11
- package/lib/Parser/PotreeCinParser.js +3 -12
- package/lib/Parser/ShapefileParser.js +11 -18
- package/lib/Parser/VectorTileParser.js +18 -26
- package/lib/Parser/XbilParser.js +5 -13
- package/lib/Parser/deprecated/LegacyGLTFLoader.js +2 -12
- package/lib/Process/3dTilesProcessing.js +14 -27
- package/lib/Process/FeatureProcessing.js +14 -22
- package/lib/Process/LayeredMaterialNodeProcessing.js +14 -26
- package/lib/Process/ObjectRemovalHelper.js +2 -9
- package/lib/Process/handlerNodeError.js +1 -7
- package/lib/Provider/3dTilesProvider.js +16 -27
- package/lib/Provider/DataSourceProvider.js +2 -9
- package/lib/Provider/Fetcher.js +6 -13
- package/lib/Provider/PointCloudProvider.js +5 -15
- package/lib/Provider/TileProvider.js +4 -12
- package/lib/Provider/URLBuilder.js +4 -12
- package/lib/Renderer/Camera.js +7 -17
- package/lib/Renderer/Color.js +3 -11
- package/lib/Renderer/ColorLayersOrdering.js +14 -22
- package/lib/Renderer/CommonMaterial.js +3 -12
- package/lib/Renderer/Label2DRenderer.js +5 -16
- package/lib/Renderer/LayeredMaterial.js +27 -41
- package/lib/Renderer/OBB.js +10 -19
- package/lib/Renderer/OrientedImageCamera.js +2 -11
- package/lib/Renderer/OrientedImageMaterial.js +7 -17
- package/lib/Renderer/PointsMaterial.js +34 -48
- package/lib/Renderer/RasterTile.js +15 -28
- package/lib/Renderer/RenderMode.js +2 -9
- package/lib/Renderer/Shader/ShaderChunk.js +2 -11
- package/lib/Renderer/Shader/ShaderUtils.js +2 -9
- package/lib/Renderer/SphereHelper.js +2 -11
- package/lib/Renderer/WebXR.js +2 -11
- package/lib/Renderer/c3DEngine.js +18 -28
- package/lib/Source/C3DTilesGoogleSource.js +5 -13
- package/lib/Source/C3DTilesIonSource.js +6 -13
- package/lib/Source/C3DTilesSource.js +5 -12
- package/lib/Source/EntwinePointTileSource.js +12 -19
- package/lib/Source/FileSource.js +7 -14
- package/lib/Source/OrientedImageSource.js +6 -13
- package/lib/Source/PotreeSource.js +9 -16
- package/lib/Source/Source.js +17 -26
- package/lib/Source/TMSSource.js +11 -21
- package/lib/Source/VectorTilesSource.js +18 -26
- package/lib/Source/WFSSource.js +7 -14
- package/lib/Source/WMSSource.js +5 -12
- package/lib/Source/WMTSSource.js +3 -10
- package/lib/ThreeExtended/capabilities/WebGL.js +1 -8
- package/lib/ThreeExtended/libs/ktx-parse.module.js +2 -256
- package/lib/ThreeExtended/libs/zstddec.module.js +2 -8
- package/lib/ThreeExtended/loaders/DDSLoader.js +10 -16
- package/lib/ThreeExtended/loaders/DRACOLoader.js +14 -19
- package/lib/ThreeExtended/loaders/GLTFLoader.js +124 -129
- package/lib/ThreeExtended/loaders/KTX2Loader.js +73 -78
- package/lib/ThreeExtended/utils/BufferGeometryUtils.js +40 -59
- package/lib/ThreeExtended/utils/WorkerPool.js +2 -9
- package/lib/Utils/CameraUtils.js +32 -44
- package/lib/Utils/DEMUtils.js +8 -19
- package/lib/Utils/FeaturesUtils.js +8 -16
- package/lib/Utils/Gradients.js +3 -12
- package/lib/Utils/OrientationUtils.js +8 -18
- package/lib/Utils/ThreeUtils.js +2 -9
- package/lib/Utils/gui/C3DTilesStyle.js +7 -15
- package/lib/Utils/gui/Main.js +7 -48
- package/lib/Utils/gui/Minimap.js +12 -20
- package/lib/Utils/gui/Navigation.js +6 -14
- package/lib/Utils/gui/Scale.js +11 -19
- package/lib/Utils/gui/Searchbar.js +5 -13
- package/lib/Utils/gui/Widget.js +1 -8
- package/lib/Utils/placeObjectOnGround.js +13 -23
- package/package.json +10 -7
|
@@ -1,30 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.colorLayerEffects = exports.ELEVATION_MODES = void 0;
|
|
8
|
-
exports.getMaxColorSamplerUnitsCount = getMaxColorSamplerUnitsCount;
|
|
9
|
-
exports.unpack1K = unpack1K;
|
|
10
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
-
var _ShaderUtils = _interopRequireDefault(require("./Shader/ShaderUtils"));
|
|
12
|
-
var _Capabilities = _interopRequireDefault(require("../Core/System/Capabilities"));
|
|
13
|
-
var _RenderMode = _interopRequireDefault(require("./RenderMode"));
|
|
14
|
-
var _CommonMaterial = _interopRequireDefault(require("./CommonMaterial"));
|
|
15
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
-
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; }
|
|
1
|
+
import * as THREE from 'three';
|
|
17
2
|
/* babel-plugin-inline-import './Shader/TileVS.glsl' */
|
|
18
3
|
const 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";
|
|
19
4
|
/* babel-plugin-inline-import './Shader/TileFS.glsl' */
|
|
20
5
|
const 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";
|
|
6
|
+
import ShaderUtils from "./Shader/ShaderUtils.js";
|
|
7
|
+
import Capabilities from "../Core/System/Capabilities.js";
|
|
8
|
+
import RenderMode from "./RenderMode.js";
|
|
9
|
+
import CommonMaterial from "./CommonMaterial.js";
|
|
21
10
|
const identityOffsetScale = new THREE.Vector4(0.0, 0.0, 1.0, 1.0);
|
|
22
11
|
const defaultTex = new THREE.Texture();
|
|
23
12
|
|
|
24
13
|
// from three.js packDepthToRGBA
|
|
25
14
|
const UnpackDownscale = 255 / 256; // 0..1 -> fraction (excluding 1)
|
|
26
15
|
const bitSh = new THREE.Vector4(UnpackDownscale / (256.0 * 256.0 * 256.0), UnpackDownscale / (256.0 * 256.0), UnpackDownscale / 256.0, UnpackDownscale);
|
|
27
|
-
function unpack1K(color, factor) {
|
|
16
|
+
export function unpack1K(color, factor) {
|
|
28
17
|
return factor ? bitSh.dot(color) * factor : bitSh.dot(color);
|
|
29
18
|
}
|
|
30
19
|
|
|
@@ -32,17 +21,16 @@ function unpack1K(color, factor) {
|
|
|
32
21
|
// Because there's a statement limitation to unroll, in getColorAtIdUv method
|
|
33
22
|
const maxSamplersColorCount = 15;
|
|
34
23
|
const samplersElevationCount = 1;
|
|
35
|
-
function getMaxColorSamplerUnitsCount() {
|
|
36
|
-
const maxSamplerUnitsCount =
|
|
24
|
+
export function getMaxColorSamplerUnitsCount() {
|
|
25
|
+
const maxSamplerUnitsCount = Capabilities.getMaxTextureUnitsCount();
|
|
37
26
|
return Math.min(maxSamplerUnitsCount - samplersElevationCount, maxSamplersColorCount);
|
|
38
27
|
}
|
|
39
|
-
const colorLayerEffects = {
|
|
28
|
+
export const colorLayerEffects = {
|
|
40
29
|
noEffect: 0,
|
|
41
30
|
removeLightColor: 1,
|
|
42
31
|
removeWhiteColor: 2,
|
|
43
32
|
customEffect: 3
|
|
44
33
|
};
|
|
45
|
-
exports.colorLayerEffects = colorLayerEffects;
|
|
46
34
|
const defaultStructLayer = {
|
|
47
35
|
bias: 0,
|
|
48
36
|
noDataValue: -99999,
|
|
@@ -90,12 +78,11 @@ function updateLayersUniforms(uniforms, olayers, max) {
|
|
|
90
78
|
layers[i] = defaultStructLayer;
|
|
91
79
|
}
|
|
92
80
|
}
|
|
93
|
-
const ELEVATION_MODES = {
|
|
81
|
+
export const ELEVATION_MODES = {
|
|
94
82
|
RGBA: 0,
|
|
95
83
|
COLOR: 1,
|
|
96
84
|
DATA: 2
|
|
97
85
|
};
|
|
98
|
-
exports.ELEVATION_MODES = ELEVATION_MODES;
|
|
99
86
|
let nbSamplers;
|
|
100
87
|
const fragmentShader = [];
|
|
101
88
|
class LayeredMaterial extends THREE.RawShaderMaterial {
|
|
@@ -109,38 +96,38 @@ class LayeredMaterial extends THREE.RawShaderMaterial {
|
|
|
109
96
|
this.defines.NUM_FS_TEXTURES = nbSamplers[1];
|
|
110
97
|
this.defines.USE_FOG = 1;
|
|
111
98
|
this.defines.NUM_CRS = crsCount;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (
|
|
99
|
+
CommonMaterial.setDefineMapping(this, 'ELEVATION', ELEVATION_MODES);
|
|
100
|
+
CommonMaterial.setDefineMapping(this, 'MODE', RenderMode.MODES);
|
|
101
|
+
CommonMaterial.setDefineProperty(this, 'mode', 'MODE', RenderMode.MODES.FINAL);
|
|
102
|
+
if (Capabilities.isLogDepthBufferSupported()) {
|
|
116
103
|
this.defines.USE_LOGDEPTHBUF = 1;
|
|
117
104
|
this.defines.USE_LOGDEPTHBUF_EXT = 1;
|
|
118
105
|
}
|
|
119
106
|
this.vertexShader = TileVS;
|
|
120
|
-
fragmentShader[crsCount] = fragmentShader[crsCount] ||
|
|
107
|
+
fragmentShader[crsCount] = fragmentShader[crsCount] || ShaderUtils.unrollLoops(TileFS, this.defines);
|
|
121
108
|
this.fragmentShader = fragmentShader[crsCount];
|
|
122
109
|
|
|
123
110
|
// Color uniforms
|
|
124
|
-
|
|
125
|
-
|
|
111
|
+
CommonMaterial.setUniformProperty(this, 'diffuse', new THREE.Color(0.04, 0.23, 0.35));
|
|
112
|
+
CommonMaterial.setUniformProperty(this, 'opacity', this.opacity);
|
|
126
113
|
|
|
127
114
|
// Lighting uniforms
|
|
128
|
-
|
|
129
|
-
|
|
115
|
+
CommonMaterial.setUniformProperty(this, 'lightingEnabled', false);
|
|
116
|
+
CommonMaterial.setUniformProperty(this, 'lightPosition', new THREE.Vector3(-0.5, 0.0, 1.0));
|
|
130
117
|
|
|
131
118
|
// Misc properties
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
119
|
+
CommonMaterial.setUniformProperty(this, 'fogDistance', 1000000000.0);
|
|
120
|
+
CommonMaterial.setUniformProperty(this, 'fogColor', new THREE.Color(0.76, 0.85, 1.0));
|
|
121
|
+
CommonMaterial.setUniformProperty(this, 'overlayAlpha', 0);
|
|
122
|
+
CommonMaterial.setUniformProperty(this, 'overlayColor', new THREE.Color(1.0, 0.3, 0.0));
|
|
123
|
+
CommonMaterial.setUniformProperty(this, 'objectId', 0);
|
|
124
|
+
CommonMaterial.setUniformProperty(this, 'geoidHeight', 0.0);
|
|
138
125
|
|
|
139
126
|
// > 0 produces gaps,
|
|
140
127
|
// < 0 causes oversampling of textures
|
|
141
128
|
// = 0 causes sampling artefacts due to bad estimation of texture-uv gradients
|
|
142
129
|
// best is a small negative number
|
|
143
|
-
|
|
130
|
+
CommonMaterial.setUniformProperty(this, 'minBorderDistance', -0.01);
|
|
144
131
|
|
|
145
132
|
// LayeredMaterialLayers
|
|
146
133
|
this.layers = [];
|
|
@@ -259,5 +246,4 @@ class LayeredMaterial extends THREE.RawShaderMaterial {
|
|
|
259
246
|
}
|
|
260
247
|
}
|
|
261
248
|
}
|
|
262
|
-
|
|
263
|
-
exports.default = _default;
|
|
249
|
+
export default LayeredMaterial;
|
package/lib/Renderer/OBB.js
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import TileGeometry from "../Core/TileGeometry.js";
|
|
3
|
+
import BuilderEllipsoidTile from "../Core/Prefab/Globe/BuilderEllipsoidTile.js";
|
|
4
|
+
import Coordinates from "../Core/Geographic/Coordinates.js";
|
|
5
|
+
import CRS from "../Core/Geographic/Crs.js";
|
|
2
6
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _TileGeometry = _interopRequireDefault(require("../Core/TileGeometry"));
|
|
10
|
-
var _BuilderEllipsoidTile = _interopRequireDefault(require("../Core/Prefab/Globe/BuilderEllipsoidTile"));
|
|
11
|
-
var _Coordinates = _interopRequireDefault(require("../Core/Geographic/Coordinates"));
|
|
12
|
-
var _Crs = _interopRequireDefault(require("../Core/Geographic/Crs"));
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
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; }
|
|
15
7
|
// get oriented bounding box of tile
|
|
16
|
-
const builder = new
|
|
8
|
+
const builder = new BuilderEllipsoidTile({
|
|
17
9
|
crs: 'EPSG:4978',
|
|
18
10
|
uvCount: 1
|
|
19
11
|
});
|
|
20
12
|
const size = new THREE.Vector3();
|
|
21
13
|
const dimension = new THREE.Vector2();
|
|
22
14
|
const center = new THREE.Vector3();
|
|
23
|
-
const coord = new
|
|
15
|
+
const coord = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
24
16
|
let obb;
|
|
25
17
|
|
|
26
18
|
// it could be considered to remove THREE.Object3D extend.
|
|
@@ -127,7 +119,7 @@ class OBB extends THREE.Object3D {
|
|
|
127
119
|
} = builder.computeSharableExtent(extent);
|
|
128
120
|
// Compute the minimum count of segment to build tile
|
|
129
121
|
const segments = Math.max(Math.floor(sharableExtent.planarDimensions(dimension).x / 90 + 1), 2);
|
|
130
|
-
const geometry = new
|
|
122
|
+
const geometry = new TileGeometry({
|
|
131
123
|
extent: sharableExtent,
|
|
132
124
|
level: 0,
|
|
133
125
|
segments,
|
|
@@ -144,7 +136,7 @@ class OBB extends THREE.Object3D {
|
|
|
144
136
|
this.position.copy(position);
|
|
145
137
|
this.quaternion.copy(quaternion);
|
|
146
138
|
this.updateMatrixWorld(true);
|
|
147
|
-
} else if (!
|
|
139
|
+
} else if (!CRS.isTms(extent.crs) && CRS.isMetricUnit(extent.crs)) {
|
|
148
140
|
extent.center(coord).toVector3(this.position);
|
|
149
141
|
extent.planarDimensions(dimension);
|
|
150
142
|
size.set(dimension.x, dimension.y, Math.abs(maxHeight - minHeight));
|
|
@@ -157,5 +149,4 @@ class OBB extends THREE.Object3D {
|
|
|
157
149
|
}
|
|
158
150
|
}
|
|
159
151
|
obb = new OBB();
|
|
160
|
-
|
|
161
|
-
exports.default = _default;
|
|
152
|
+
export default OBB;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
8
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
-
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; }
|
|
1
|
+
import * as THREE from 'three';
|
|
10
2
|
class Distortion {
|
|
11
3
|
constructor(size) {
|
|
12
4
|
this.size = size;
|
|
@@ -124,5 +116,4 @@ class OrientedImageCamera extends THREE.PerspectiveCamera {
|
|
|
124
116
|
return this;
|
|
125
117
|
}
|
|
126
118
|
}
|
|
127
|
-
|
|
128
|
-
exports.default = _default;
|
|
119
|
+
export default OrientedImageCamera;
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _Capabilities = _interopRequireDefault(require("../Core/System/Capabilities"));
|
|
10
|
-
var _ShaderUtils = _interopRequireDefault(require("./Shader/ShaderUtils"));
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
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; }
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import Capabilities from "../Core/System/Capabilities.js";
|
|
13
3
|
/* babel-plugin-inline-import './Shader/ProjectiveTextureVS.glsl' */
|
|
14
4
|
const textureVS = "#include <itowns/WebGL2_pars_vertex>\n#include <itowns/precision_qualifier>\n#include <itowns/project_pars_vertex>\n#include <itowns/projective_texturing_pars_vertex>\n#include <common>\n#include <logdepthbuf_pars_vertex>\n\nvarying vec3 vNormal;\nattribute vec3 normal;\n\nvoid main() {\n #include <begin_vertex>\n #include <project_vertex>\n vNormal = normal;\n #include <itowns/projective_texturing_vertex>\n #include <logdepthbuf_vertex>\n}\n";
|
|
15
5
|
/* babel-plugin-inline-import './Shader/ProjectiveTextureFS.glsl' */
|
|
16
6
|
const 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";
|
|
7
|
+
import ShaderUtils from "./Shader/ShaderUtils.js";
|
|
17
8
|
const ndcToTextureMatrix = new THREE.Matrix4(1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 2, 0, 0, 0, 0, 2);
|
|
18
9
|
const noMask = new THREE.DataTexture(new Uint8Array([255, 255, 255, 255]), 1, 1, THREE.RGBAFormat, THREE.UnsignedByteType);
|
|
19
10
|
noMask.needsUpdate = true;
|
|
@@ -76,7 +67,7 @@ class OrientedImageMaterial extends THREE.RawShaderMaterial {
|
|
|
76
67
|
this.defines.ORIENTED_IMAGES_COUNT = options.OrientedImagesCount ?? cameras.length;
|
|
77
68
|
|
|
78
69
|
// verify that number of textures doesn't exceed GPU capabilities
|
|
79
|
-
const maxTexturesUnits =
|
|
70
|
+
const maxTexturesUnits = Capabilities.getMaxTextureUnitsCount();
|
|
80
71
|
if (this.defines.ORIENTED_IMAGES_COUNT > maxTexturesUnits) {
|
|
81
72
|
console.warn(`OrientedImageMaterial: Can't project ${cameras.length} textures, because it's more than GPU capabilities maximum texture units (${maxTexturesUnits})`);
|
|
82
73
|
|
|
@@ -116,12 +107,12 @@ class OrientedImageMaterial extends THREE.RawShaderMaterial {
|
|
|
116
107
|
ambient: new THREE.Color(0.1, 0.1, 0.1),
|
|
117
108
|
opacity: 0.75
|
|
118
109
|
});
|
|
119
|
-
if (
|
|
110
|
+
if (Capabilities.isLogDepthBufferSupported()) {
|
|
120
111
|
this.defines.USE_LOGDEPTHBUF = 1;
|
|
121
112
|
this.defines.USE_LOGDEPTHBUF_EXT = 1;
|
|
122
113
|
}
|
|
123
114
|
this.vertexShader = textureVS;
|
|
124
|
-
this.fragmentShader =
|
|
115
|
+
this.fragmentShader = ShaderUtils.unrollLoops(textureFS, this.defines);
|
|
125
116
|
}
|
|
126
117
|
onBeforeCompile(shader, renderer) {
|
|
127
118
|
if (renderer.capabilities.isWebGL2) {
|
|
@@ -182,5 +173,4 @@ class OrientedImageMaterial extends THREE.RawShaderMaterial {
|
|
|
182
173
|
}
|
|
183
174
|
}
|
|
184
175
|
}
|
|
185
|
-
|
|
186
|
-
exports.default = _default;
|
|
176
|
+
export default OrientedImageMaterial;
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.PNTS_SIZE_MODE = exports.PNTS_SHAPE = exports.PNTS_MODE = exports.ClassificationScheme = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _Capabilities = _interopRequireDefault(require("../Core/System/Capabilities"));
|
|
10
|
-
var _ShaderUtils = _interopRequireDefault(require("./Shader/ShaderUtils"));
|
|
11
|
-
var _CommonMaterial = _interopRequireDefault(require("./CommonMaterial"));
|
|
12
|
-
var _Gradients = _interopRequireDefault(require("../Utils/Gradients"));
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
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; }
|
|
1
|
+
import * as THREE from 'three';
|
|
15
2
|
/* babel-plugin-inline-import './Shader/PointsVS.glsl' */
|
|
16
3
|
const PointsVS = "#include <itowns/WebGL2_pars_vertex>\n#include <itowns/precision_qualifier>\n#include <itowns/project_pars_vertex>\n#if defined(USE_TEXTURES_PROJECTIVE)\n#include <itowns/projective_texturing_pars_vertex>\n#endif\n#include <common>\n#include <logdepthbuf_pars_vertex>\n\n#define NB_CLASS 8.\n\nuniform float size;\nuniform float scale;\n\nuniform bool picking;\nuniform int mode;\nuniform float opacity;\nuniform vec4 overlayColor;\n\nuniform vec2 elevationRange;\nuniform vec2 intensityRange;\nuniform vec2 angleRange;\n\nuniform bool applyOpacityClassication;\n\nuniform sampler2D classificationTexture;\nuniform sampler2D discreteTexture;\nuniform sampler2D gradientTexture;\nuniform int sizeMode;\nuniform float minAttenuatedSize;\nuniform float maxAttenuatedSize;\n\nattribute vec3 color;\nattribute vec2 range;\nattribute vec4 unique_id;\nattribute float intensity;\nattribute float classification;\nattribute float pointSourceID;\n\nattribute float returnNumber;\nattribute float numberOfReturns;\nattribute float scanAngle;\n\n#if defined(NORMAL_OCT16)\nattribute vec2 oct16Normal;\n#elif defined(NORMAL_SPHEREMAPPED)\nattribute vec2 sphereMappedNormal;\n#else\nattribute vec3 normal;\n#endif\n\nvarying vec4 vColor;\n\n// see https://web.archive.org/web/20150303053317/http://lgdv.cs.fau.de/get/1602\n// and implementation in PotreeConverter (BINPointReader.cpp) and potree (BinaryDecoderWorker.js)\n#if defined(NORMAL_OCT16)\nvec3 decodeOct16Normal(vec2 encodedNormal) {\n vec2 nNorm = 2. * (encodedNormal / 255.) - 1.;\n vec3 n;\n n.z = 1. - abs(nNorm.x) - abs(nNorm.y);\n if (n.z >= 0.) {\n n.x = nNorm.x;\n n.y = nNorm.y;\n } else {\n n.x = sign(nNorm.x) - sign(nNorm.x) * sign(nNorm.y) * nNorm.y;\n n.y = sign(nNorm.y) - sign(nNorm.y) * sign(nNorm.x) * nNorm.x;\n }\n return normalize(n);\n}\n#elif defined(NORMAL_SPHEREMAPPED)\n// see http://aras-p.info/texts/CompactNormalStorage.html method #4\n// or see potree's implementation in BINPointReader.cpp\nvec3 decodeSphereMappedNormal(vec2 encodedNormal) {\n vec2 fenc = 2. * encodedNormal / 255. - 1.;\n float f = dot(fenc,fenc);\n float g = 2. * sqrt(1. - f);\n vec3 n;\n n.xy = fenc * g;\n n.z = 1. - 2. * f;\n return n;\n}\n#endif\n\nvoid main() {\n\n#if defined(NORMAL_OCT16)\n vec3 normal = decodeOct16Normal(oct16Normal);\n#elif defined(NORMAL_SPHEREMAPPED)\n vec3 normal = decodeSphereMappedNormal(sphereMappedNormal);\n#elif defined(NORMAL)\n // nothing to do\n#else\n // default to color\n vec3 normal = color;\n#endif\n\n if (picking) {\n vColor = unique_id;\n } else {\n vColor.a = opacity;\n if (applyOpacityClassication || mode == PNTS_MODE_CLASSIFICATION) {\n vec2 uv = vec2(classification/255., 0.5);\n vColor = texture2D(classificationTexture, uv);\n vColor.a *= opacity;\n }\n\n if (mode == PNTS_MODE_NORMAL) {\n vColor.rgb = abs(normal);\n } else if (mode == PNTS_MODE_COLOR) {\n // default to color mode\n vColor.rgb = mix(color, overlayColor.rgb, overlayColor.a);\n } else if (mode == PNTS_MODE_RETURN_NUMBER) {\n vec2 uv = vec2(returnNumber/255., 0.5);\n vColor = texture2D(discreteTexture, uv);\n } else if (mode == PNTS_MODE_RETURN_TYPE) {\n float returnType;\n if (returnNumber > numberOfReturns) {\n returnType = 4.;\n } else if (returnNumber == 1.) {\n if (numberOfReturns == 1.) {\n // single\n returnType = 0.;\n } else {\n // first\n returnType = 1.;\n }\n } else {\n if (returnNumber == numberOfReturns) {\n // last\n returnType = 3.;\n } else {\n // intermediate\n returnType = 2.;\n }\n }\n vec2 uv = vec2(returnType/255., 0.5);\n vColor = texture2D(discreteTexture, uv);\n } else if (mode == PNTS_MODE_RETURN_COUNT) {\n vec2 uv = vec2(numberOfReturns/255., 0.5);\n vColor = texture2D(discreteTexture, uv);\n } else if (mode == PNTS_MODE_POINT_SOURCE_ID) {\n vec2 uv = vec2(mod(pointSourceID, NB_CLASS)/255., 0.5);\n vColor = texture2D(discreteTexture, uv);\n } else if (mode == PNTS_MODE_SCAN_ANGLE) {\n float i = (scanAngle - angleRange.x) / (angleRange.y - angleRange.x);\n vec2 uv = vec2(i, (1. - i));\n vColor = texture2D(gradientTexture, uv);\n } else if (mode == PNTS_MODE_INTENSITY) {\n float i = (intensity - intensityRange.x) / (intensityRange.y - intensityRange.x);\n vec2 uv = vec2(i, (1. - i));\n vColor = texture2D(gradientTexture, uv);\n } else if (mode == PNTS_MODE_ELEVATION) {\n float i = (position.z - elevationRange.x) / (elevationRange.y - elevationRange.x);\n vec2 uv = vec2(i, (1. - i));\n vColor = texture2D(gradientTexture, uv);\n }\n }\n\n #include <begin_vertex>\n #include <project_vertex>\n\n gl_PointSize = size;\n\n if (sizeMode == PNTS_SIZE_MODE_ATTENUATED) {\n bool isPerspective = isPerspectiveMatrix(projectionMatrix);\n\n if (isPerspective) {\n gl_PointSize *= scale / -mvPosition.z;\n gl_PointSize = clamp(gl_PointSize, minAttenuatedSize, maxAttenuatedSize);\n }\n }\n\n#if defined(USE_TEXTURES_PROJECTIVE)\n #include <itowns/projective_texturing_vertex>\n#endif\n #include <logdepthbuf_vertex>\n}\n";
|
|
17
4
|
/* babel-plugin-inline-import './Shader/PointsFS.glsl' */
|
|
18
5
|
const PointsFS = "#include <itowns/WebGL2_pars_fragment>\n#include <itowns/precision_qualifier>\n#include <logdepthbuf_pars_fragment>\n#if defined(USE_TEXTURES_PROJECTIVE)\n#include <itowns/projective_texturing_pars_fragment>\n#endif\n\nvarying vec4 vColor;\nuniform bool picking;\nuniform int shape;\n\nvoid main() {\n #include <logdepthbuf_fragment>\n //square shape does not require any change.\n if (shape == PNTS_SHAPE_CIRCLE) {\n //circular rendering in glsl\n if ((length(gl_PointCoord - 0.5) > 0.5) || (vColor.a == 0.0)) {\n discard;\n }\n }\n\n#if defined(USE_TEXTURES_PROJECTIVE)\n vec4 color = vColor;\n if (!picking) {\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 gl_FragColor = vec4(color.rgb, color.a * opacity);\n } else {\n gl_FragColor = color;\n }\n#else\n gl_FragColor = vColor;\n#endif\n}\n";
|
|
19
|
-
|
|
6
|
+
import Capabilities from "../Core/System/Capabilities.js";
|
|
7
|
+
import ShaderUtils from "./Shader/ShaderUtils.js";
|
|
8
|
+
import CommonMaterial from "./CommonMaterial.js";
|
|
9
|
+
import Gradients from "../Utils/Gradients.js";
|
|
10
|
+
export const PNTS_MODE = {
|
|
20
11
|
COLOR: 0,
|
|
21
12
|
INTENSITY: 1,
|
|
22
13
|
CLASSIFICATION: 2,
|
|
@@ -28,17 +19,14 @@ const PNTS_MODE = {
|
|
|
28
19
|
SCAN_ANGLE: 8,
|
|
29
20
|
NORMAL: 9
|
|
30
21
|
};
|
|
31
|
-
|
|
32
|
-
const PNTS_SHAPE = {
|
|
22
|
+
export const PNTS_SHAPE = {
|
|
33
23
|
CIRCLE: 0,
|
|
34
24
|
SQUARE: 1
|
|
35
25
|
};
|
|
36
|
-
|
|
37
|
-
const PNTS_SIZE_MODE = {
|
|
26
|
+
export const PNTS_SIZE_MODE = {
|
|
38
27
|
VALUE: 0,
|
|
39
28
|
ATTENUATED: 1
|
|
40
29
|
};
|
|
41
|
-
exports.PNTS_SIZE_MODE = PNTS_SIZE_MODE;
|
|
42
30
|
const white = new THREE.Color(1.0, 1.0, 1.0);
|
|
43
31
|
|
|
44
32
|
/**
|
|
@@ -56,7 +44,7 @@ const white = new THREE.Color(1.0, 1.0, 1.0);
|
|
|
56
44
|
*/
|
|
57
45
|
// eslint-disable-next-line
|
|
58
46
|
class /* istanbul ignore next */Classification {}
|
|
59
|
-
const ClassificationScheme = {
|
|
47
|
+
export const ClassificationScheme = {
|
|
60
48
|
DEFAULT: {
|
|
61
49
|
0: {
|
|
62
50
|
visible: true,
|
|
@@ -144,7 +132,6 @@ const ClassificationScheme = {
|
|
|
144
132
|
}
|
|
145
133
|
}
|
|
146
134
|
};
|
|
147
|
-
exports.ClassificationScheme = ClassificationScheme;
|
|
148
135
|
const DiscreteScheme = {
|
|
149
136
|
DEFAULT: {
|
|
150
137
|
0: {
|
|
@@ -314,11 +301,11 @@ class PointsMaterial extends THREE.RawShaderMaterial {
|
|
|
314
301
|
const sizeMode = size === 0 ? PNTS_SIZE_MODE.ATTENUATED : options.sizeMode || PNTS_SIZE_MODE.VALUE;
|
|
315
302
|
const minAttenuatedSize = options.minAttenuatedSize || 3;
|
|
316
303
|
const maxAttenuatedSize = options.maxAttenuatedSize || 10;
|
|
317
|
-
let gradients =
|
|
304
|
+
let gradients = Gradients;
|
|
318
305
|
if (options.gradient) {
|
|
319
306
|
gradients = {
|
|
320
307
|
...options.gradient,
|
|
321
|
-
...
|
|
308
|
+
...Gradients
|
|
322
309
|
};
|
|
323
310
|
}
|
|
324
311
|
delete options.intensityRange;
|
|
@@ -341,37 +328,37 @@ class PointsMaterial extends THREE.RawShaderMaterial {
|
|
|
341
328
|
this.vertexShader = PointsVS;
|
|
342
329
|
const scale = options.scale || 0.05 * 0.5 / Math.tan(1.0 / 2.0); // autosizing scale
|
|
343
330
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
331
|
+
CommonMaterial.setDefineMapping(this, 'PNTS_MODE', PNTS_MODE);
|
|
332
|
+
CommonMaterial.setDefineMapping(this, 'PNTS_SHAPE', PNTS_SHAPE);
|
|
333
|
+
CommonMaterial.setDefineMapping(this, 'PNTS_SIZE_MODE', PNTS_SIZE_MODE);
|
|
334
|
+
CommonMaterial.setUniformProperty(this, 'size', size);
|
|
335
|
+
CommonMaterial.setUniformProperty(this, 'mode', mode);
|
|
336
|
+
CommonMaterial.setUniformProperty(this, 'shape', shape);
|
|
337
|
+
CommonMaterial.setUniformProperty(this, 'picking', false);
|
|
338
|
+
CommonMaterial.setUniformProperty(this, 'opacity', this.opacity);
|
|
339
|
+
CommonMaterial.setUniformProperty(this, 'overlayColor', options.overlayColor || new THREE.Vector4(0, 0, 0, 0));
|
|
340
|
+
CommonMaterial.setUniformProperty(this, 'intensityRange', intensityRange);
|
|
341
|
+
CommonMaterial.setUniformProperty(this, 'elevationRange', elevationRange);
|
|
342
|
+
CommonMaterial.setUniformProperty(this, 'angleRange', angleRange);
|
|
343
|
+
CommonMaterial.setUniformProperty(this, 'applyOpacityClassication', applyOpacityClassication);
|
|
344
|
+
CommonMaterial.setUniformProperty(this, 'sizeMode', sizeMode);
|
|
345
|
+
CommonMaterial.setUniformProperty(this, 'scale', scale);
|
|
346
|
+
CommonMaterial.setUniformProperty(this, 'minAttenuatedSize', minAttenuatedSize);
|
|
347
|
+
CommonMaterial.setUniformProperty(this, 'maxAttenuatedSize', maxAttenuatedSize);
|
|
361
348
|
|
|
362
349
|
// add classification texture to apply classification lut.
|
|
363
350
|
const data = new Uint8Array(256 * 4);
|
|
364
351
|
const texture = new THREE.DataTexture(data, 256, 1, THREE.RGBAFormat);
|
|
365
352
|
texture.needsUpdate = true;
|
|
366
353
|
texture.magFilter = THREE.NearestFilter;
|
|
367
|
-
|
|
354
|
+
CommonMaterial.setUniformProperty(this, 'classificationTexture', texture);
|
|
368
355
|
|
|
369
356
|
// add texture to applying the discrete lut.
|
|
370
357
|
const dataLUT = new Uint8Array(256 * 4);
|
|
371
358
|
const textureLUT = new THREE.DataTexture(dataLUT, 256, 1, THREE.RGBAFormat);
|
|
372
359
|
textureLUT.needsUpdate = true;
|
|
373
360
|
textureLUT.magFilter = THREE.NearestFilter;
|
|
374
|
-
|
|
361
|
+
CommonMaterial.setUniformProperty(this, 'discreteTexture', textureLUT);
|
|
375
362
|
|
|
376
363
|
// Classification and other discrete values scheme
|
|
377
364
|
this.classificationScheme = classificationScheme;
|
|
@@ -383,7 +370,7 @@ class PointsMaterial extends THREE.RawShaderMaterial {
|
|
|
383
370
|
|
|
384
371
|
// Gradient texture for continuous values
|
|
385
372
|
this.gradient = Object.values(gradients)[0];
|
|
386
|
-
|
|
373
|
+
CommonMaterial.setUniformProperty(this, 'gradientTexture', this.gradientTexture);
|
|
387
374
|
if (oiMaterial) {
|
|
388
375
|
this.uniforms.projectiveTextureAlphaBorder = oiMaterial.uniforms.projectiveTextureAlphaBorder;
|
|
389
376
|
this.uniforms.projectiveTextureDistortion = oiMaterial.uniforms.projectiveTextureDistortion;
|
|
@@ -396,11 +383,11 @@ class PointsMaterial extends THREE.RawShaderMaterial {
|
|
|
396
383
|
this.defines.DEBUG_ALPHA_BORDER = oiMaterial.defines.DEBUG_ALPHA_BORDER;
|
|
397
384
|
this.defines.USE_TEXTURES_PROJECTIVE = true;
|
|
398
385
|
this.defines.USE_BASE_MATERIAL = true;
|
|
399
|
-
this.fragmentShader =
|
|
386
|
+
this.fragmentShader = ShaderUtils.unrollLoops(PointsFS, this.defines);
|
|
400
387
|
} else {
|
|
401
388
|
this.fragmentShader = PointsFS;
|
|
402
389
|
}
|
|
403
|
-
if (
|
|
390
|
+
if (Capabilities.isLogDepthBufferSupported()) {
|
|
404
391
|
this.defines.USE_LOGDEPTHBUF = 1;
|
|
405
392
|
this.defines.USE_LOGDEPTHBUF_EXT = 1;
|
|
406
393
|
}
|
|
@@ -466,5 +453,4 @@ class PointsMaterial extends THREE.RawShaderMaterial {
|
|
|
466
453
|
this.gradientTexture = generateGradientTexture(value);
|
|
467
454
|
}
|
|
468
455
|
}
|
|
469
|
-
|
|
470
|
-
exports.default = _default;
|
|
456
|
+
export default PointsMaterial;
|
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.RasterElevationTile = exports.RasterColorTile = exports.EMPTY_TEXTURE_ZOOM = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _LayeredMaterial = require("./LayeredMaterial");
|
|
10
|
-
var _XbilParser = require("../Parser/XbilParser");
|
|
11
|
-
var _Crs = _interopRequireDefault(require("../Core/Geographic/Crs"));
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
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; }
|
|
14
|
-
const EMPTY_TEXTURE_ZOOM = -1;
|
|
15
|
-
exports.EMPTY_TEXTURE_ZOOM = EMPTY_TEXTURE_ZOOM;
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { ELEVATION_MODES } from "./LayeredMaterial.js";
|
|
3
|
+
import { checkNodeElevationTextureValidity, insertSignificantValuesFromParent, computeMinMaxElevation } from "../Parser/XbilParser.js";
|
|
4
|
+
import CRS from "../Core/Geographic/Crs.js";
|
|
5
|
+
export const EMPTY_TEXTURE_ZOOM = -1;
|
|
16
6
|
const pitch = new THREE.Vector4();
|
|
17
7
|
function getIndiceWithPitch(i, pitch, w) {
|
|
18
8
|
// Return corresponding indice in parent tile using pitch
|
|
@@ -39,7 +29,7 @@ class RasterTile extends THREE.EventDispatcher {
|
|
|
39
29
|
constructor(material, layer) {
|
|
40
30
|
super();
|
|
41
31
|
this.layer = layer;
|
|
42
|
-
this.crs = layer.parent.tileMatrixSets.indexOf(
|
|
32
|
+
this.crs = layer.parent.tileMatrixSets.indexOf(CRS.formatToTms(layer.crs));
|
|
43
33
|
if (this.crs == -1) {
|
|
44
34
|
console.error('Unknown crs:', layer.crs);
|
|
45
35
|
}
|
|
@@ -107,9 +97,8 @@ class RasterTile extends THREE.EventDispatcher {
|
|
|
107
97
|
}
|
|
108
98
|
}
|
|
109
99
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
class RasterColorTile extends RasterTile {
|
|
100
|
+
export default RasterTile;
|
|
101
|
+
export class RasterColorTile extends RasterTile {
|
|
113
102
|
get effect_type() {
|
|
114
103
|
return this.layer.effect_type;
|
|
115
104
|
}
|
|
@@ -120,13 +109,12 @@ class RasterColorTile extends RasterTile {
|
|
|
120
109
|
return this.layer.transparent;
|
|
121
110
|
}
|
|
122
111
|
}
|
|
123
|
-
|
|
124
|
-
class RasterElevationTile extends RasterTile {
|
|
112
|
+
export class RasterElevationTile extends RasterTile {
|
|
125
113
|
constructor(material, layer) {
|
|
126
114
|
super(material, layer);
|
|
127
115
|
const defaultEle = {
|
|
128
116
|
bias: 0,
|
|
129
|
-
mode:
|
|
117
|
+
mode: ELEVATION_MODES.DATA,
|
|
130
118
|
zmin: -Infinity,
|
|
131
119
|
zmax: Infinity
|
|
132
120
|
};
|
|
@@ -134,12 +122,12 @@ class RasterElevationTile extends RasterTile {
|
|
|
134
122
|
|
|
135
123
|
// Define elevation properties
|
|
136
124
|
if (layer.useRgbaTextureElevation) {
|
|
137
|
-
defaultEle.mode =
|
|
125
|
+
defaultEle.mode = ELEVATION_MODES.RGBA;
|
|
138
126
|
defaultEle.zmax = 5000;
|
|
139
127
|
throw new Error('Restore this feature');
|
|
140
128
|
} else if (layer.useColorTextureElevation) {
|
|
141
129
|
this.scaleFactor = layer.colorTextureElevationMaxZ - layer.colorTextureElevationMinZ;
|
|
142
|
-
defaultEle.mode =
|
|
130
|
+
defaultEle.mode = ELEVATION_MODES.COLOR;
|
|
143
131
|
defaultEle.bias = layer.colorTextureElevationMinZ;
|
|
144
132
|
this.min = this.layer.colorTextureElevationMinZ;
|
|
145
133
|
this.max = this.layer.colorTextureElevationMaxZ;
|
|
@@ -190,7 +178,7 @@ class RasterElevationTile extends RasterTile {
|
|
|
190
178
|
const {
|
|
191
179
|
min,
|
|
192
180
|
max
|
|
193
|
-
} =
|
|
181
|
+
} = computeMinMaxElevation(this.textures[0], this.offsetScales[0], {
|
|
194
182
|
noDataValue: this.layer.noDataValue,
|
|
195
183
|
zmin: this.layer.zmin,
|
|
196
184
|
zmax: this.layer.zmax
|
|
@@ -210,12 +198,11 @@ class RasterElevationTile extends RasterTile {
|
|
|
210
198
|
const parentTexture = this.textures[0];
|
|
211
199
|
const parentDataElevation = parentTexture && parentTexture.image && parentTexture.image.data;
|
|
212
200
|
const dataElevation = texture.image && texture.image.data;
|
|
213
|
-
if (dataElevation && !
|
|
214
|
-
|
|
201
|
+
if (dataElevation && !checkNodeElevationTextureValidity(dataElevation, nodatavalue)) {
|
|
202
|
+
insertSignificantValuesFromParent(dataElevation, parentDataElevation && dataParent(texture, parentTexture, parentDataElevation, pitch), nodatavalue);
|
|
215
203
|
}
|
|
216
204
|
}
|
|
217
205
|
}
|
|
218
|
-
exports.RasterElevationTile = RasterElevationTile;
|
|
219
206
|
function dataParent(texture, parentTexture, parentDataElevation, pitch) {
|
|
220
207
|
texture.extent.offsetToParent(parentTexture.extent, pitch);
|
|
221
208
|
return i => parentDataElevation[getIndiceWithPitch(i, pitch, 256)];
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
1
|
const MODES = {
|
|
8
2
|
FINAL: 0,
|
|
9
3
|
// final color
|
|
@@ -32,8 +26,7 @@ function push(object3d, mode) {
|
|
|
32
26
|
// Rendering mode
|
|
33
27
|
// According to the rendering mode, the material's object switches
|
|
34
28
|
// the mode property of the materials
|
|
35
|
-
|
|
29
|
+
export default {
|
|
36
30
|
MODES,
|
|
37
31
|
push
|
|
38
|
-
};
|
|
39
|
-
exports.default = _default;
|
|
32
|
+
};
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
8
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
-
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; }
|
|
1
|
+
import * as THREE from 'three';
|
|
10
2
|
/* babel-plugin-inline-import './Chunk/color_layers_pars_fragment.glsl' */
|
|
11
3
|
const 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) {\n float a = dot(color.rgb, vec3(0.333333333));\n if (a >= tolerance) {\n color.a = 0.0;\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);\n }\n }\n color.a *= layer.opacity;\n return color;\n}\n";
|
|
12
4
|
/* babel-plugin-inline-import './Chunk/elevation_pars_vertex.glsl' */
|
|
@@ -174,5 +166,4 @@ class ShaderChunkManager {
|
|
|
174
166
|
}
|
|
175
167
|
}
|
|
176
168
|
const ShaderChunk = new ShaderChunkManager(THREE.ShaderChunk, 'itowns/');
|
|
177
|
-
|
|
178
|
-
exports.default = _default;
|
|
169
|
+
export default ShaderChunk;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
1
|
const pattern_gl_Position = 'gl_Position.*(?![^]*gl_Position)';
|
|
8
2
|
const pattern_Main = '[^\\w]*main[^\\w]*(void)?[^\\w]*{';
|
|
9
3
|
const rePosition = new RegExp(pattern_gl_Position);
|
|
10
4
|
const reMain = new RegExp(pattern_Main);
|
|
11
|
-
|
|
5
|
+
export default {
|
|
12
6
|
patchMaterialForLogDepthSupport(material) {
|
|
13
7
|
// Check if the shader does not already use the log depth buffer
|
|
14
8
|
if (material.vertexShader.includes('USE_LOGDEPTHBUF') || material.vertexShader.includes('logdepthbuf_pars_vertex')) {
|
|
@@ -50,5 +44,4 @@ var _default = {
|
|
|
50
44
|
}
|
|
51
45
|
return string.replace(/#pragma unroll_loop\s+for\s*\(\s*int\s+i\s*=\s*([\w\d]+);\s*i\s+<\s+([\w\d]+);\s*i\s*\+\+\s*\)\s*\{\n([^}]*)\}/g, replace);
|
|
52
46
|
}
|
|
53
|
-
};
|
|
54
|
-
exports.default = _default;
|
|
47
|
+
};
|