itowns 2.44.3-next.4 → 2.44.3-next.41

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.
Files changed (217) hide show
  1. package/README.md +3 -129
  2. package/examples/3dtiles_loader.html +123 -48
  3. package/examples/config.json +3 -10
  4. package/examples/copc_simple_loader.html +15 -5
  5. package/examples/effects_stereo.html +2 -2
  6. package/examples/entwine_3d_loader.html +3 -1
  7. package/examples/entwine_simple_loader.html +1 -1
  8. package/examples/images/itowns_logo.svg +123 -0
  9. package/examples/js/plugins/COGParser.js +1 -1
  10. package/examples/jsm/OGC3DTilesHelper.js +6 -1
  11. package/examples/layers/JSONLayers/GeoidMNT.json +3 -1
  12. package/examples/misc_collada.html +2 -2
  13. package/examples/source_file_geojson_3d.html +0 -1
  14. package/examples/source_file_kml_raster_usgs.html +0 -1
  15. package/examples/source_stream_wfs_raster.html +0 -7
  16. package/examples/vector_tile_mapbox_raster.html +91 -0
  17. package/examples/view_3d_map_webxr.html +3 -1
  18. package/examples/view_multi_25d.html +2 -2
  19. package/package.json +21 -75
  20. package/CODING.md +0 -120
  21. package/CONTRIBUTING.md +0 -150
  22. package/CONTRIBUTORS.md +0 -55
  23. package/LICENSE.md +0 -44
  24. package/changelog.md +0 -1361
  25. package/dist/455.js +0 -2
  26. package/dist/455.js.map +0 -1
  27. package/dist/debug.js +0 -3
  28. package/dist/debug.js.LICENSE.txt +0 -13
  29. package/dist/debug.js.map +0 -1
  30. package/dist/itowns.js +0 -3
  31. package/dist/itowns.js.LICENSE.txt +0 -7
  32. package/dist/itowns.js.map +0 -1
  33. package/dist/itowns_lasparser.js +0 -2
  34. package/dist/itowns_lasparser.js.map +0 -1
  35. package/dist/itowns_lasworker.js +0 -2
  36. package/dist/itowns_lasworker.js.map +0 -1
  37. package/dist/itowns_potree2worker.js +0 -2
  38. package/dist/itowns_potree2worker.js.map +0 -1
  39. package/dist/itowns_widgets.js +0 -2
  40. package/dist/itowns_widgets.js.map +0 -1
  41. package/examples/.eslintrc.cjs +0 -35
  42. package/examples/3dtiles_25d.html +0 -120
  43. package/examples/3dtiles_basic.html +0 -94
  44. package/examples/3dtiles_batch_table.html +0 -86
  45. package/examples/3dtiles_ion.html +0 -126
  46. package/examples/3dtiles_pointcloud.html +0 -95
  47. package/examples/jsm/.eslintrc.cjs +0 -38
  48. package/lib/Controls/FirstPersonControls.js +0 -308
  49. package/lib/Controls/FlyControls.js +0 -175
  50. package/lib/Controls/GlobeControls.js +0 -1162
  51. package/lib/Controls/PlanarControls.js +0 -1025
  52. package/lib/Controls/StateControl.js +0 -429
  53. package/lib/Controls/StreetControls.js +0 -392
  54. package/lib/Converter/Feature2Mesh.js +0 -608
  55. package/lib/Converter/Feature2Texture.js +0 -170
  56. package/lib/Converter/convertToTile.js +0 -75
  57. package/lib/Converter/textureConverter.js +0 -44
  58. package/lib/Core/3DTiles/C3DTBatchTable.js +0 -131
  59. package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +0 -96
  60. package/lib/Core/3DTiles/C3DTBoundingVolume.js +0 -157
  61. package/lib/Core/3DTiles/C3DTExtensions.js +0 -97
  62. package/lib/Core/3DTiles/C3DTFeature.js +0 -110
  63. package/lib/Core/3DTiles/C3DTilesEnums.js +0 -20
  64. package/lib/Core/3DTiles/C3DTileset.js +0 -99
  65. package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +0 -100
  66. package/lib/Core/AnimationPlayer.js +0 -142
  67. package/lib/Core/CopcNode.js +0 -174
  68. package/lib/Core/Deprecated/Undeprecator.js +0 -75
  69. package/lib/Core/EntwinePointTileNode.js +0 -126
  70. package/lib/Core/Feature.js +0 -490
  71. package/lib/Core/Geographic/CoordStars.js +0 -80
  72. package/lib/Core/Geographic/Coordinates.js +0 -320
  73. package/lib/Core/Geographic/Crs.js +0 -175
  74. package/lib/Core/Geographic/Extent.js +0 -726
  75. package/lib/Core/Geographic/GeoidGrid.js +0 -109
  76. package/lib/Core/Label.js +0 -222
  77. package/lib/Core/MainLoop.js +0 -211
  78. package/lib/Core/Math/Ellipsoid.js +0 -144
  79. package/lib/Core/Picking.js +0 -255
  80. package/lib/Core/PointCloudNode.js +0 -42
  81. package/lib/Core/Potree2Node.js +0 -206
  82. package/lib/Core/Potree2PointAttributes.js +0 -139
  83. package/lib/Core/PotreeNode.js +0 -101
  84. package/lib/Core/Prefab/Globe/Atmosphere.js +0 -299
  85. package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +0 -110
  86. package/lib/Core/Prefab/Globe/GlobeLayer.js +0 -145
  87. package/lib/Core/Prefab/Globe/SkyShader.js +0 -78
  88. package/lib/Core/Prefab/GlobeView.js +0 -161
  89. package/lib/Core/Prefab/Planar/PlanarLayer.js +0 -53
  90. package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +0 -72
  91. package/lib/Core/Prefab/PlanarView.js +0 -62
  92. package/lib/Core/Prefab/TileBuilder.js +0 -80
  93. package/lib/Core/Prefab/computeBufferTileGeometry.js +0 -183
  94. package/lib/Core/Scheduler/Cache.js +0 -256
  95. package/lib/Core/Scheduler/CancelledCommandException.js +0 -15
  96. package/lib/Core/Scheduler/Scheduler.js +0 -294
  97. package/lib/Core/Style.js +0 -1121
  98. package/lib/Core/System/Capabilities.js +0 -63
  99. package/lib/Core/TileGeometry.js +0 -40
  100. package/lib/Core/TileMesh.js +0 -108
  101. package/lib/Core/View.js +0 -1109
  102. package/lib/Layer/C3DTilesLayer.js +0 -455
  103. package/lib/Layer/ColorLayer.js +0 -128
  104. package/lib/Layer/CopcLayer.js +0 -58
  105. package/lib/Layer/ElevationLayer.js +0 -107
  106. package/lib/Layer/EntwinePointTileLayer.js +0 -64
  107. package/lib/Layer/FeatureGeometryLayer.js +0 -63
  108. package/lib/Layer/GeoidLayer.js +0 -80
  109. package/lib/Layer/GeometryLayer.js +0 -202
  110. package/lib/Layer/InfoLayer.js +0 -64
  111. package/lib/Layer/LabelLayer.js +0 -452
  112. package/lib/Layer/Layer.js +0 -304
  113. package/lib/Layer/LayerUpdateState.js +0 -89
  114. package/lib/Layer/LayerUpdateStrategy.js +0 -80
  115. package/lib/Layer/OGC3DTilesLayer.js +0 -387
  116. package/lib/Layer/OrientedImageLayer.js +0 -222
  117. package/lib/Layer/PointCloudLayer.js +0 -359
  118. package/lib/Layer/Potree2Layer.js +0 -164
  119. package/lib/Layer/PotreeLayer.js +0 -65
  120. package/lib/Layer/RasterLayer.js +0 -27
  121. package/lib/Layer/ReferencingLayerProperties.js +0 -62
  122. package/lib/Layer/TiledGeometryLayer.js +0 -403
  123. package/lib/Loader/LASLoader.js +0 -193
  124. package/lib/Loader/Potree2BrotliLoader.js +0 -261
  125. package/lib/Loader/Potree2Loader.js +0 -207
  126. package/lib/Main.js +0 -115
  127. package/lib/MainBundle.js +0 -4
  128. package/lib/Parser/B3dmParser.js +0 -174
  129. package/lib/Parser/CameraCalibrationParser.js +0 -94
  130. package/lib/Parser/GDFParser.js +0 -72
  131. package/lib/Parser/GTXParser.js +0 -75
  132. package/lib/Parser/GeoJsonParser.js +0 -212
  133. package/lib/Parser/GpxParser.js +0 -25
  134. package/lib/Parser/ISGParser.js +0 -71
  135. package/lib/Parser/KMLParser.js +0 -25
  136. package/lib/Parser/LASParser.js +0 -137
  137. package/lib/Parser/MapBoxUrlParser.js +0 -83
  138. package/lib/Parser/PntsParser.js +0 -131
  139. package/lib/Parser/Potree2BinParser.js +0 -92
  140. package/lib/Parser/PotreeBinParser.js +0 -106
  141. package/lib/Parser/PotreeCinParser.js +0 -29
  142. package/lib/Parser/ShapefileParser.js +0 -78
  143. package/lib/Parser/VectorTileParser.js +0 -202
  144. package/lib/Parser/XbilParser.js +0 -108
  145. package/lib/Parser/deprecated/LegacyGLTFLoader.js +0 -1386
  146. package/lib/Parser/iGLTFLoader.js +0 -168
  147. package/lib/Process/3dTilesProcessing.js +0 -304
  148. package/lib/Process/FeatureProcessing.js +0 -76
  149. package/lib/Process/LayeredMaterialNodeProcessing.js +0 -221
  150. package/lib/Process/ObjectRemovalHelper.js +0 -97
  151. package/lib/Process/handlerNodeError.js +0 -23
  152. package/lib/Provider/3dTilesProvider.js +0 -149
  153. package/lib/Provider/DataSourceProvider.js +0 -8
  154. package/lib/Provider/Fetcher.js +0 -229
  155. package/lib/Provider/PointCloudProvider.js +0 -45
  156. package/lib/Provider/TileProvider.js +0 -16
  157. package/lib/Provider/URLBuilder.js +0 -105
  158. package/lib/Renderer/Camera.js +0 -281
  159. package/lib/Renderer/Color.js +0 -56
  160. package/lib/Renderer/ColorLayersOrdering.js +0 -115
  161. package/lib/Renderer/CommonMaterial.js +0 -31
  162. package/lib/Renderer/Label2DRenderer.js +0 -190
  163. package/lib/Renderer/LayeredMaterial.js +0 -243
  164. package/lib/Renderer/OBB.js +0 -153
  165. package/lib/Renderer/OrientedImageCamera.js +0 -118
  166. package/lib/Renderer/OrientedImageMaterial.js +0 -167
  167. package/lib/Renderer/PointsMaterial.js +0 -485
  168. package/lib/Renderer/RasterTile.js +0 -209
  169. package/lib/Renderer/RenderMode.js +0 -31
  170. package/lib/Renderer/Shader/ShaderChunk.js +0 -160
  171. package/lib/Renderer/Shader/ShaderUtils.js +0 -47
  172. package/lib/Renderer/SphereHelper.js +0 -23
  173. package/lib/Renderer/WebXR.js +0 -51
  174. package/lib/Renderer/c3DEngine.js +0 -214
  175. package/lib/Source/C3DTilesGoogleSource.js +0 -74
  176. package/lib/Source/C3DTilesIonSource.js +0 -54
  177. package/lib/Source/C3DTilesSource.js +0 -30
  178. package/lib/Source/CopcSource.js +0 -115
  179. package/lib/Source/EntwinePointTileSource.js +0 -62
  180. package/lib/Source/FileSource.js +0 -189
  181. package/lib/Source/OGC3DTilesGoogleSource.js +0 -29
  182. package/lib/Source/OGC3DTilesIonSource.js +0 -34
  183. package/lib/Source/OGC3DTilesSource.js +0 -21
  184. package/lib/Source/OrientedImageSource.js +0 -59
  185. package/lib/Source/Potree2Source.js +0 -167
  186. package/lib/Source/PotreeSource.js +0 -82
  187. package/lib/Source/Source.js +0 -223
  188. package/lib/Source/TMSSource.js +0 -143
  189. package/lib/Source/VectorTilesSource.js +0 -178
  190. package/lib/Source/WFSSource.js +0 -165
  191. package/lib/Source/WMSSource.js +0 -130
  192. package/lib/Source/WMTSSource.js +0 -86
  193. package/lib/ThreeExtended/capabilities/WebGL.js +0 -69
  194. package/lib/ThreeExtended/libs/ktx-parse.module.js +0 -470
  195. package/lib/ThreeExtended/libs/zstddec.module.js +0 -29
  196. package/lib/ThreeExtended/loaders/DDSLoader.js +0 -200
  197. package/lib/ThreeExtended/loaders/DRACOLoader.js +0 -399
  198. package/lib/ThreeExtended/loaders/GLTFLoader.js +0 -2876
  199. package/lib/ThreeExtended/loaders/KTX2Loader.js +0 -625
  200. package/lib/ThreeExtended/utils/BufferGeometryUtils.js +0 -846
  201. package/lib/ThreeExtended/utils/WorkerPool.js +0 -70
  202. package/lib/Utils/CameraUtils.js +0 -555
  203. package/lib/Utils/DEMUtils.js +0 -350
  204. package/lib/Utils/FeaturesUtils.js +0 -156
  205. package/lib/Utils/Gradients.js +0 -16
  206. package/lib/Utils/OrientationUtils.js +0 -457
  207. package/lib/Utils/ThreeUtils.js +0 -115
  208. package/lib/Utils/gui/C3DTilesStyle.js +0 -216
  209. package/lib/Utils/gui/Main.js +0 -7
  210. package/lib/Utils/gui/Minimap.js +0 -154
  211. package/lib/Utils/gui/Navigation.js +0 -245
  212. package/lib/Utils/gui/Scale.js +0 -107
  213. package/lib/Utils/gui/Searchbar.js +0 -234
  214. package/lib/Utils/gui/Widget.js +0 -80
  215. package/lib/Utils/placeObjectOnGround.js +0 -137
  216. package/lib/Worker/LASLoaderWorker.js +0 -19
  217. package/lib/Worker/Potree2Worker.js +0 -21
@@ -1,261 +0,0 @@
1
- /*
2
- ============
3
- == POTREE ==
4
- ============
5
-
6
- http://potree.org
7
-
8
- Copyright (c) 2011-2020, Markus Schütz
9
- All rights reserved.
10
-
11
- Redistribution and use in source and binary forms, with or without
12
- modification, are permitted provided that the following conditions are met:
13
-
14
- 1. Redistributions of source code must retain the above copyright notice, this
15
- list of conditions and the following disclaimer.
16
- 2. Redistributions in binary form must reproduce the above copyright notice,
17
- this list of conditions and the following disclaimer in the documentation
18
- and/or other materials provided with the distribution.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
24
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
-
31
- The views and conclusions contained in the software and documentation are those
32
- of the authors and should not be interpreted as representing official policies,
33
- either expressed or implied, of the FreeBSD Project.
34
- */
35
-
36
- import { PointAttribute, PointAttributeTypes } from "../Core/Potree2PointAttributes.js";
37
- import { decompress } from 'brotli-compress/js.mjs';
38
- const typedArrayMapping = {
39
- int8: Int8Array,
40
- int16: Int16Array,
41
- int32: Int32Array,
42
- int64: Float64Array,
43
- uint8: Uint8Array,
44
- uint16: Uint16Array,
45
- uint32: Uint32Array,
46
- uint64: Float64Array,
47
- float: Float32Array,
48
- double: Float64Array
49
- };
50
- function dealign24b(mortoncode) {
51
- // see https://stackoverflow.com/questions/45694690/how-i-can-remove-all-odds-bits-in-c
52
-
53
- // input alignment of desired bits
54
- // ..a..b..c..d..e..f..g..h..i..j..k..l..m..n..o..p
55
- let x = mortoncode;
56
-
57
- // ..a..b..c..d..e..f..g..h..i..j..k..l..m..n..o..p ..a..b..c..d..e..f..g..h..i..j..k..l..m..n..o..p
58
- // ..a.....c.....e.....g.....i.....k.....m.....o... .....b.....d.....f.....h.....j.....l.....n.....p
59
- // ....a.....c.....e.....g.....i.....k.....m.....o. .....b.....d.....f.....h.....j.....l.....n.....p
60
- x = (x & 0b001000001000001000001000) >> 2 | (x & 0b000001000001000001000001) >> 0;
61
- // ....ab....cd....ef....gh....ij....kl....mn....op ....ab....cd....ef....gh....ij....kl....mn....op
62
- // ....ab..........ef..........ij..........mn...... ..........cd..........gh..........kl..........op
63
- // ........ab..........ef..........ij..........mn.. ..........cd..........gh..........kl..........op
64
- x = (x & 0b000011000000000011000000) >> 4 | (x & 0b000000000011000000000011) >> 0;
65
- // ........abcd........efgh........ijkl........mnop ........abcd........efgh........ijkl........mnop
66
- // ........abcd....................ijkl............ ....................efgh....................mnop
67
- // ................abcd....................ijkl.... ....................efgh....................mnop
68
- x = (x & 0b000000001111000000000000) >> 8 | (x & 0b000000000000000000001111) >> 0;
69
- // ................abcdefgh................ijklmnop ................abcdefgh................ijklmnop
70
- // ................abcdefgh........................ ........................................ijklmnop
71
- // ................................abcdefgh........ ........................................ijklmnop
72
- x = (x & 0b000000000000000000000000) >> 16 | (x & 0b000000000000000011111111) >> 0;
73
-
74
- // sucessfully realigned!
75
- // ................................abcdefghijklmnop
76
-
77
- return x;
78
- }
79
- export default async function load(buffer, options) {
80
- const {
81
- pointAttributes,
82
- scale,
83
- min,
84
- size,
85
- offset,
86
- numPoints
87
- } = options;
88
- let bytes;
89
- if (numPoints === 0) {
90
- bytes = {
91
- buffer: new ArrayBuffer(0)
92
- };
93
- } else {
94
- try {
95
- bytes = await decompress(new Int8Array(buffer));
96
- } catch (e) {
97
- bytes = {
98
- buffer: new ArrayBuffer(numPoints * (pointAttributes.byteSize + 12))
99
- };
100
- console.error(`problem with node ${name}: `, e);
101
- }
102
- }
103
- const view = new DataView(bytes.buffer);
104
- const attributeBuffers = {};
105
- const gridSize = 32;
106
- const grid = new Uint32Array(gridSize ** 3);
107
- const toIndex = (x, y, z) => {
108
- // min is already subtracted
109
- const dx = gridSize * x / size.x;
110
- const dy = gridSize * y / size.y;
111
- const dz = gridSize * z / size.z;
112
- const ix = Math.min(parseInt(dx, 10), gridSize - 1);
113
- const iy = Math.min(parseInt(dy, 10), gridSize - 1);
114
- const iz = Math.min(parseInt(dz, 10), gridSize - 1);
115
- return ix + iy * gridSize + iz * gridSize * gridSize;
116
- };
117
- let numOccupiedCells = 0;
118
- let byteOffset = 0;
119
- for (const pointAttribute of pointAttributes.attributes) {
120
- if (['POSITION_CARTESIAN', 'position'].includes(pointAttribute.name)) {
121
- const buff = new ArrayBuffer(numPoints * 4 * 3);
122
- const positions = new Float32Array(buff);
123
- for (let j = 0; j < numPoints; j++) {
124
- const mc_0 = view.getUint32(byteOffset + 4, true);
125
- const mc_1 = view.getUint32(byteOffset + 0, true);
126
- const mc_2 = view.getUint32(byteOffset + 12, true);
127
- const mc_3 = view.getUint32(byteOffset + 8, true);
128
- byteOffset += 16;
129
- let X = dealign24b((mc_3 & 0x00FFFFFF) >>> 0) | dealign24b((mc_3 >>> 24 | mc_2 << 8) >>> 0) << 8;
130
- let Y = dealign24b((mc_3 & 0x00FFFFFF) >>> 1) | dealign24b((mc_3 >>> 24 | mc_2 << 8) >>> 1) << 8;
131
- let Z = dealign24b((mc_3 & 0x00FFFFFF) >>> 2) | dealign24b((mc_3 >>> 24 | mc_2 << 8) >>> 2) << 8;
132
- if (mc_1 != 0 || mc_2 != 0) {
133
- X = X | dealign24b((mc_1 & 0x00FFFFFF) >>> 0) << 16 | dealign24b((mc_1 >>> 24 | mc_0 << 8) >>> 0) << 24;
134
- Y = Y | dealign24b((mc_1 & 0x00FFFFFF) >>> 1) << 16 | dealign24b((mc_1 >>> 24 | mc_0 << 8) >>> 1) << 24;
135
- Z = Z | dealign24b((mc_1 & 0x00FFFFFF) >>> 2) << 16 | dealign24b((mc_1 >>> 24 | mc_0 << 8) >>> 2) << 24;
136
- }
137
- const x = parseInt(X, 10) * scale[0] + offset[0] - min.x;
138
- const y = parseInt(Y, 10) * scale[1] + offset[1] - min.y;
139
- const z = parseInt(Z, 10) * scale[2] + offset[2] - min.z;
140
- const index = toIndex(x, y, z);
141
- const count = grid[index]++;
142
- if (count === 0) {
143
- numOccupiedCells++;
144
- }
145
- positions[3 * j + 0] = x;
146
- positions[3 * j + 1] = y;
147
- positions[3 * j + 2] = z;
148
- }
149
- attributeBuffers[pointAttribute.name] = {
150
- buffer: buff,
151
- attribute: pointAttribute
152
- };
153
- } else if (['RGBA', 'rgba'].includes(pointAttribute.name)) {
154
- const buff = new ArrayBuffer(numPoints * 4);
155
- const colors = new Uint8Array(buff);
156
- for (let j = 0; j < numPoints; j++) {
157
- const mc_0 = view.getUint32(byteOffset + 4, true);
158
- const mc_1 = view.getUint32(byteOffset + 0, true);
159
- byteOffset += 8;
160
- const r = dealign24b((mc_1 & 0x00FFFFFF) >>> 0) | dealign24b((mc_1 >>> 24 | mc_0 << 8) >>> 0) << 8;
161
- const g = dealign24b((mc_1 & 0x00FFFFFF) >>> 1) | dealign24b((mc_1 >>> 24 | mc_0 << 8) >>> 1) << 8;
162
- const b = dealign24b((mc_1 & 0x00FFFFFF) >>> 2) | dealign24b((mc_1 >>> 24 | mc_0 << 8) >>> 2) << 8;
163
- colors[4 * j + 0] = r > 255 ? r / 256 : r;
164
- colors[4 * j + 1] = g > 255 ? g / 256 : g;
165
- colors[4 * j + 2] = b > 255 ? b / 256 : b;
166
- }
167
- attributeBuffers[pointAttribute.name] = {
168
- buffer: buff,
169
- attribute: pointAttribute
170
- };
171
- } else {
172
- const buff = new ArrayBuffer(numPoints * 4);
173
- const f32 = new Float32Array(buff);
174
- const TypedArray = typedArrayMapping[pointAttribute.type.name];
175
- const preciseBuffer = new TypedArray(numPoints);
176
- let [offset, scale] = [0, 1];
177
- const getterMap = {
178
- int8: view.getInt8,
179
- int16: view.getInt16,
180
- int32: view.getInt32,
181
- uint8: view.getUint8,
182
- uint16: view.getUint16,
183
- uint32: view.getUint32,
184
- float: view.getFloat32,
185
- double: view.getFloat64
186
- };
187
- const getter = getterMap[pointAttribute.type.name].bind(view);
188
-
189
- // compute offset and scale to pack larger types into 32 bit floats
190
- if (pointAttribute.type.size > 4) {
191
- const [amin, amax] = pointAttribute.range;
192
- offset = amin;
193
- scale = 1 / (amax - amin);
194
- }
195
- for (let j = 0; j < numPoints; j++) {
196
- const value = getter(byteOffset, true);
197
- byteOffset += pointAttribute.byteSize;
198
- f32[j] = (value - offset) * scale;
199
- preciseBuffer[j] = value;
200
- }
201
- attributeBuffers[pointAttribute.name] = {
202
- buffer: buff,
203
- preciseBuffer,
204
- attribute: pointAttribute,
205
- offset,
206
- scale
207
- };
208
- }
209
- }
210
- const occupancy = parseInt(numPoints / numOccupiedCells, 10);
211
- {
212
- // add indices
213
- const buff = new ArrayBuffer(numPoints * 4);
214
- const indices = new Uint32Array(buff);
215
- for (let i = 0; i < numPoints; i++) {
216
- indices[i] = i;
217
- }
218
- attributeBuffers.INDICES = {
219
- buffer: buff,
220
- attribute: PointAttribute.INDICES
221
- };
222
- }
223
- {
224
- // handle attribute vectors
225
- const vectors = pointAttributes.vectors;
226
- for (const vector of vectors) {
227
- const {
228
- name,
229
- attributes
230
- } = vector;
231
- const numVectorElements = attributes.length;
232
- const buffer = new ArrayBuffer(numVectorElements * numPoints * 4);
233
- const f32 = new Float32Array(buffer);
234
- let iElement = 0;
235
- for (const sourceName of attributes) {
236
- const sourceBuffer = attributeBuffers[sourceName];
237
- const {
238
- offset,
239
- scale
240
- } = sourceBuffer;
241
- const view = new DataView(sourceBuffer.buffer);
242
- const getter = view.getFloat32.bind(view);
243
- for (let j = 0; j < numPoints; j++) {
244
- const value = getter(j * 4, true);
245
- f32[j * numVectorElements + iElement] = value / scale + offset;
246
- }
247
- iElement++;
248
- }
249
- const vecAttribute = new PointAttribute(name, PointAttributeTypes.DATA_TYPE_FLOAT, 3);
250
- attributeBuffers[name] = {
251
- buffer,
252
- attribute: vecAttribute
253
- };
254
- }
255
- }
256
- return {
257
- buffer,
258
- attributeBuffers,
259
- density: occupancy
260
- };
261
- }
@@ -1,207 +0,0 @@
1
- /*
2
- ============
3
- == POTREE ==
4
- ============
5
-
6
- http://potree.org
7
-
8
- Copyright (c) 2011-2020, Markus Schütz
9
- All rights reserved.
10
-
11
- Redistribution and use in source and binary forms, with or without
12
- modification, are permitted provided that the following conditions are met:
13
-
14
- 1. Redistributions of source code must retain the above copyright notice, this
15
- list of conditions and the following disclaimer.
16
- 2. Redistributions in binary form must reproduce the above copyright notice,
17
- this list of conditions and the following disclaimer in the documentation
18
- and/or other materials provided with the distribution.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
24
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
-
31
- The views and conclusions contained in the software and documentation are those
32
- of the authors and should not be interpreted as representing official policies,
33
- either expressed or implied, of the FreeBSD Project.
34
- */
35
-
36
- import { PointAttribute, PointAttributeTypes } from "../Core/Potree2PointAttributes.js";
37
- const typedArrayMapping = {
38
- int8: Int8Array,
39
- int16: Int16Array,
40
- int32: Int32Array,
41
- int64: Float64Array,
42
- uint8: Uint8Array,
43
- uint16: Uint16Array,
44
- uint32: Uint32Array,
45
- uint64: Float64Array,
46
- float: Float32Array,
47
- double: Float64Array
48
- };
49
- export default function load(buffer, options) {
50
- const {
51
- pointAttributes,
52
- scale,
53
- min,
54
- size,
55
- offset,
56
- numPoints
57
- } = options;
58
- const view = new DataView(buffer);
59
- const attributeBuffers = {};
60
- let attributeOffset = 0;
61
- let bytesPerPoint = 0;
62
- for (const pointAttribute of pointAttributes.attributes) {
63
- bytesPerPoint += pointAttribute.byteSize;
64
- }
65
- const gridSize = 32;
66
- const grid = new Uint32Array(gridSize ** 3);
67
- const toIndex = (x, y, z) => {
68
- // min is already subtracted
69
- const dx = gridSize * x / size.x;
70
- const dy = gridSize * y / size.y;
71
- const dz = gridSize * z / size.z;
72
- const ix = Math.min(parseInt(dx, 10), gridSize - 1);
73
- const iy = Math.min(parseInt(dy, 10), gridSize - 1);
74
- const iz = Math.min(parseInt(dz, 10), gridSize - 1);
75
- return ix + iy * gridSize + iz * gridSize * gridSize;
76
- };
77
- let numOccupiedCells = 0;
78
- for (const pointAttribute of pointAttributes.attributes) {
79
- if (['POSITION_CARTESIAN', 'position'].includes(pointAttribute.name)) {
80
- const buff = new ArrayBuffer(numPoints * 4 * 3);
81
- const positions = new Float32Array(buff);
82
- for (let j = 0; j < numPoints; j++) {
83
- const pointOffset = j * bytesPerPoint;
84
- const x = view.getInt32(pointOffset + attributeOffset + 0, true) * scale[0] + offset[0] - min.x;
85
- const y = view.getInt32(pointOffset + attributeOffset + 4, true) * scale[1] + offset[1] - min.y;
86
- const z = view.getInt32(pointOffset + attributeOffset + 8, true) * scale[2] + offset[2] - min.z;
87
- const index = toIndex(x, y, z);
88
- const count = grid[index]++;
89
- if (count === 0) {
90
- numOccupiedCells++;
91
- }
92
- positions[3 * j + 0] = x;
93
- positions[3 * j + 1] = y;
94
- positions[3 * j + 2] = z;
95
- }
96
- attributeBuffers[pointAttribute.name] = {
97
- buffer: buff,
98
- attribute: pointAttribute
99
- };
100
- } else if (['RGBA', 'rgba'].includes(pointAttribute.name)) {
101
- const buff = new ArrayBuffer(numPoints * 4);
102
- const colors = new Uint8Array(buff);
103
- for (let j = 0; j < numPoints; j++) {
104
- const pointOffset = j * bytesPerPoint;
105
- const r = view.getUint16(pointOffset + attributeOffset + 0, true);
106
- const g = view.getUint16(pointOffset + attributeOffset + 2, true);
107
- const b = view.getUint16(pointOffset + attributeOffset + 4, true);
108
- colors[4 * j + 0] = r > 255 ? r / 256 : r;
109
- colors[4 * j + 1] = g > 255 ? g / 256 : g;
110
- colors[4 * j + 2] = b > 255 ? b / 256 : b;
111
- }
112
- attributeBuffers[pointAttribute.name] = {
113
- buffer: buff,
114
- attribute: pointAttribute
115
- };
116
- } else {
117
- const buff = new ArrayBuffer(numPoints * 4);
118
- const f32 = new Float32Array(buff);
119
- const TypedArray = typedArrayMapping[pointAttribute.type.name];
120
- const preciseBuffer = new TypedArray(numPoints);
121
- let [offset, scale] = [0, 1];
122
- const getterMap = {
123
- int8: view.getInt8,
124
- int16: view.getInt16,
125
- int32: view.getInt32,
126
- uint8: view.getUint8,
127
- uint16: view.getUint16,
128
- uint32: view.getUint32,
129
- float: view.getFloat32,
130
- double: view.getFloat64
131
- };
132
- const getter = getterMap[pointAttribute.type.name].bind(view);
133
-
134
- // compute offset and scale to pack larger types into 32 bit floats
135
- if (pointAttribute.type.size > 4) {
136
- const [amin, amax] = pointAttribute.range;
137
- offset = amin;
138
- scale = 1 / (amax - amin);
139
- }
140
- for (let j = 0; j < numPoints; j++) {
141
- const pointOffset = j * bytesPerPoint;
142
- const value = getter(pointOffset + attributeOffset, true);
143
- f32[j] = (value - offset) * scale;
144
- preciseBuffer[j] = value;
145
- }
146
- attributeBuffers[pointAttribute.name] = {
147
- buffer: buff,
148
- preciseBuffer,
149
- attribute: pointAttribute,
150
- offset,
151
- scale
152
- };
153
- }
154
- attributeOffset += pointAttribute.byteSize;
155
- }
156
- const occupancy = parseInt(numPoints / numOccupiedCells, 10);
157
- {
158
- // add indices
159
- const buff = new ArrayBuffer(numPoints * 4);
160
- const indices = new Uint32Array(buff);
161
- for (let i = 0; i < numPoints; i++) {
162
- indices[i] = i;
163
- }
164
- attributeBuffers.INDICES = {
165
- buffer: buff,
166
- attribute: PointAttribute.INDICES
167
- };
168
- }
169
- {
170
- // handle attribute vectors
171
- const vectors = pointAttributes.vectors;
172
- for (const vector of vectors) {
173
- const {
174
- name,
175
- attributes
176
- } = vector;
177
- const numVectorElements = attributes.length;
178
- const buffer = new ArrayBuffer(numVectorElements * numPoints * 4);
179
- const f32 = new Float32Array(buffer);
180
- let iElement = 0;
181
- for (const sourceName of attributes) {
182
- const sourceBuffer = attributeBuffers[sourceName];
183
- const {
184
- offset,
185
- scale
186
- } = sourceBuffer;
187
- const view = new DataView(sourceBuffer.buffer);
188
- const getter = view.getFloat32.bind(view);
189
- for (let j = 0; j < numPoints; j++) {
190
- const value = getter(j * 4, true);
191
- f32[j * numVectorElements + iElement] = value / scale + offset;
192
- }
193
- iElement++;
194
- }
195
- const vecAttribute = new PointAttribute(name, PointAttributeTypes.DATA_TYPE_FLOAT, 3);
196
- attributeBuffers[name] = {
197
- buffer,
198
- attribute: vecAttribute
199
- };
200
- }
201
- }
202
- return {
203
- buffer,
204
- attributeBuffers,
205
- density: occupancy
206
- };
207
- }
package/lib/Main.js DELETED
@@ -1,115 +0,0 @@
1
- const conf = {
2
- version: '2.44.2'
3
- };
4
- export const REVISION = conf.version;
5
-
6
- // Geographic tools
7
- export { default as Extent } from "./Core/Geographic/Extent.js";
8
- export { default as Coordinates } from "./Core/Geographic/Coordinates.js";
9
- export { default as GeoidGrid } from "./Core/Geographic/GeoidGrid.js";
10
- export { default as CRS } from "./Core/Geographic/Crs.js";
11
- export { default as Ellipsoid, ellipsoidSizes } from "./Core/Math/Ellipsoid.js";
12
- export { default as GlobeView, GLOBE_VIEW_EVENTS } from "./Core/Prefab/GlobeView.js";
13
- export { default as PlanarView } from "./Core/Prefab/PlanarView.js";
14
- export { default as Fetcher } from "./Provider/Fetcher.js";
15
- export { MAIN_LOOP_EVENTS } from "./Core/MainLoop.js";
16
- export { default as View } from "./Core/View.js";
17
- export { VIEW_EVENTS } from "./Core/View.js";
18
- export { default as FeatureProcessing } from "./Process/FeatureProcessing.js";
19
- export { updateLayeredMaterialNodeImagery, updateLayeredMaterialNodeElevation } from "./Process/LayeredMaterialNodeProcessing.js";
20
- export { default as OrientedImageCamera } from "./Renderer/OrientedImageCamera.js";
21
- export { default as PointsMaterial, PNTS_MODE, PNTS_SHAPE, PNTS_SIZE_MODE, ClassificationScheme } from "./Renderer/PointsMaterial.js";
22
- export { default as GlobeControls } from "./Controls/GlobeControls.js";
23
- export { default as FlyControls } from "./Controls/FlyControls.js";
24
- export { default as FirstPersonControls } from "./Controls/FirstPersonControls.js";
25
- export { default as StreetControls } from "./Controls/StreetControls.js";
26
- export { default as PlanarControls } from "./Controls/PlanarControls.js";
27
- export { CONTROL_EVENTS } from "./Controls/GlobeControls.js";
28
- export { PLANAR_CONTROL_EVENT } from "./Controls/PlanarControls.js";
29
- export { default as Feature2Mesh } from "./Converter/Feature2Mesh.js";
30
- export { default as FeaturesUtils } from "./Utils/FeaturesUtils.js";
31
- export { default as DEMUtils } from "./Utils/DEMUtils.js";
32
- export { default as CameraUtils } from "./Utils/CameraUtils.js";
33
- export { default as OrientationUtils } from "./Utils/OrientationUtils.js";
34
- export { default as ShaderChunk } from "./Renderer/Shader/ShaderChunk.js";
35
- export { getMaxColorSamplerUnitsCount, colorLayerEffects } from "./Renderer/LayeredMaterial.js";
36
- export { default as Capabilities } from "./Core/System/Capabilities.js";
37
- export { CAMERA_TYPE } from "./Renderer/Camera.js";
38
-
39
- // Internal itowns format
40
- export { default as Feature, FeatureCollection, FeatureGeometry, FEATURE_TYPES } from "./Core/Feature.js";
41
- export { default as Style } from "./Core/Style.js";
42
- export { default as Label } from "./Core/Label.js";
43
-
44
- // Layers provided by default in iTowns
45
- // A custom layer should at least implements Layer
46
- // See http://www.itowns-project.org/itowns/docs/#api/Layer/Layer
47
- export { default as Layer, ImageryLayers } from "./Layer/Layer.js";
48
- export { default as ColorLayer } from "./Layer/ColorLayer.js";
49
- export { default as ElevationLayer } from "./Layer/ElevationLayer.js";
50
- export { default as GeometryLayer } from "./Layer/GeometryLayer.js";
51
- export { default as FeatureGeometryLayer } from "./Layer/FeatureGeometryLayer.js";
52
- export { default as PointCloudLayer } from "./Layer/PointCloudLayer.js";
53
- export { default as PotreeLayer } from "./Layer/PotreeLayer.js";
54
- export { default as Potree2Layer } from "./Layer/Potree2Layer.js";
55
- export { default as C3DTilesLayer, C3DTILES_LAYER_EVENTS } from "./Layer/C3DTilesLayer.js";
56
- export { default as OGC3DTilesLayer, OGC3DTILES_LAYER_EVENTS, enableDracoLoader, enableKtx2Loader } from "./Layer/OGC3DTilesLayer.js";
57
- export { default as TiledGeometryLayer } from "./Layer/TiledGeometryLayer.js";
58
- export { default as OrientedImageLayer } from "./Layer/OrientedImageLayer.js";
59
- export { STRATEGY_MIN_NETWORK_TRAFFIC, STRATEGY_GROUP, STRATEGY_PROGRESSIVE, STRATEGY_DICHOTOMY } from "./Layer/LayerUpdateStrategy.js";
60
- export { default as ColorLayersOrdering } from "./Renderer/ColorLayersOrdering.js";
61
- export { default as GlobeLayer } from "./Core/Prefab/Globe/GlobeLayer.js";
62
- export { default as PlanarLayer } from "./Core/Prefab/Planar/PlanarLayer.js";
63
- export { default as LabelLayer } from "./Layer/LabelLayer.js";
64
- export { default as EntwinePointTileLayer } from "./Layer/EntwinePointTileLayer.js";
65
- export { default as CopcLayer } from "./Layer/CopcLayer.js";
66
- export { default as GeoidLayer } from "./Layer/GeoidLayer.js";
67
-
68
- // Sources provided by default in iTowns
69
- // A custom source should at least implements Source
70
- // See http://www.itowns-project.org/itowns/docs/#api/Source/Source
71
- export { default as Source } from "./Source/Source.js";
72
- export { default as FileSource } from "./Source/FileSource.js";
73
- export { default as TMSSource } from "./Source/TMSSource.js";
74
- export { default as WFSSource } from "./Source/WFSSource.js";
75
- export { default as WMSSource } from "./Source/WMSSource.js";
76
- export { default as WMTSSource } from "./Source/WMTSSource.js";
77
- export { default as VectorTilesSource } from "./Source/VectorTilesSource.js";
78
- export { default as OrientedImageSource } from "./Source/OrientedImageSource.js";
79
- export { default as PotreeSource } from "./Source/PotreeSource.js";
80
- export { default as Potree2Source } from "./Source/Potree2Source.js";
81
- export { default as C3DTilesSource } from "./Source/C3DTilesSource.js";
82
- export { default as C3DTilesIonSource } from "./Source/C3DTilesIonSource.js";
83
- export { default as C3DTilesGoogleSource } from "./Source/C3DTilesGoogleSource.js";
84
- export { default as OGC3DTilesSource } from "./Source/OGC3DTilesSource.js";
85
- export { default as OGC3DTilesIonSource } from "./Source/OGC3DTilesIonSource.js";
86
- export { default as OGC3DTilesGoogleSource } from "./Source/OGC3DTilesGoogleSource.js";
87
- export { default as EntwinePointTileSource } from "./Source/EntwinePointTileSource.js";
88
- export { default as CopcSource } from "./Source/CopcSource.js";
89
-
90
- // Parsers provided by default in iTowns
91
- // Custom parser can be implemented as wanted, as long as the main function
92
- // takes the data as the first argument and options as the second.
93
- export { default as GpxParser } from "./Parser/GpxParser.js";
94
- export { default as GeoJsonParser } from "./Parser/GeoJsonParser.js";
95
- export { default as KMLParser } from "./Parser/KMLParser.js";
96
- export { default as CameraCalibrationParser } from "./Parser/CameraCalibrationParser.js";
97
- export { default as ShapefileParser } from "./Parser/ShapefileParser.js";
98
- export { default as LASParser } from "./Parser/LASParser.js";
99
- export { default as ISGParser } from "./Parser/ISGParser.js";
100
- export { default as GDFParser } from "./Parser/GDFParser.js";
101
- export { default as GTXParser } from "./Parser/GTXParser.js";
102
- export { default as B3dmParser } from "./Parser/B3dmParser.js";
103
- export { default as iGLTFLoader } from "./Parser/iGLTFLoader.js";
104
-
105
- // 3D Tiles classes and extensions
106
- // Exported to allow one to implement its own 3D Tiles extension which needs to
107
- // know the classes it extends
108
- export { default as C3DTFeature } from "./Core/3DTiles/C3DTFeature.js";
109
- export { default as C3DTileset } from "./Core/3DTiles/C3DTileset.js";
110
- export { default as C3DTBoundingVolume } from "./Core/3DTiles/C3DTBoundingVolume.js";
111
- export { default as C3DTBatchTable } from "./Core/3DTiles/C3DTBatchTable.js";
112
- export { default as C3DTExtensions } from "./Core/3DTiles/C3DTExtensions.js";
113
- export { C3DTilesTypes, C3DTilesBoundingVolumeTypes } from "./Core/3DTiles/C3DTilesEnums.js";
114
- export { default as C3DTBatchTableHierarchyExtension } from "./Core/3DTiles/C3DTBatchTableHierarchyExtension.js";
115
- export { process3dTilesNode, $3dTilesCulling, $3dTilesSubdivisionControl } from "./Process/3dTilesProcessing.js";
package/lib/MainBundle.js DELETED
@@ -1,4 +0,0 @@
1
- import * as THREE from 'three';
2
- export { THREE };
3
- export { default as proj4 } from 'proj4';
4
- export * from "./Main.js";