itowns 2.45.1 → 2.45.2-next.0
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/455.js +1 -1
- package/dist/455.js.map +1 -1
- package/dist/debug.js +1 -1
- package/dist/debug.js.LICENSE.txt +8 -2
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.LICENSE.txt +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_lasparser.js +1 -1
- package/dist/itowns_lasparser.js.map +1 -1
- package/dist/itowns_lasworker.js +1 -1
- package/dist/itowns_lasworker.js.map +1 -1
- package/dist/itowns_potree2worker.js +1 -1
- package/dist/itowns_potree2worker.js.map +1 -1
- package/dist/itowns_widgets.js +1 -1
- package/dist/itowns_widgets.js.map +1 -1
- package/examples/copc_simple_loader.html +3 -3
- package/examples/entwine_3d_loader.html +2 -2
- package/examples/entwine_simple_loader.html +10 -6
- package/examples/view_3d_map_webxr.html +2 -5
- package/lib/Controls/FirstPersonControls.d.ts +90 -0
- package/lib/Controls/FlyControls.d.ts +36 -0
- package/lib/Controls/GlobeControls.d.ts +274 -0
- package/lib/Controls/PlanarControls.d.ts +339 -0
- package/lib/Controls/StateControl.d.ts +140 -0
- package/lib/Controls/StreetControls.d.ts +134 -0
- package/lib/Controls/VRControls.d.ts +56 -0
- package/lib/Controls/VRControls.js +409 -0
- package/lib/Converter/Feature2Mesh.d.ts +42 -0
- package/lib/Converter/Feature2Texture.d.ts +5 -0
- package/lib/Converter/convertToTile.d.ts +5 -0
- package/lib/Converter/convertToTile.js +2 -2
- package/lib/Converter/textureConverter.d.ts +4 -0
- package/lib/Core/3DTiles/C3DTBatchTable.d.ts +49 -0
- package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.d.ts +37 -0
- package/lib/Core/3DTiles/C3DTBoundingVolume.d.ts +39 -0
- package/lib/Core/3DTiles/C3DTExtensions.d.ts +75 -0
- package/lib/Core/3DTiles/C3DTFeature.d.ts +47 -0
- package/lib/Core/3DTiles/C3DTilesEnums.d.ts +14 -0
- package/lib/Core/3DTiles/C3DTileset.d.ts +46 -0
- package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.d.ts +14 -0
- package/lib/Core/AnimationPlayer.d.ts +53 -0
- package/lib/Core/CopcNode.d.ts +67 -0
- package/lib/Core/CopcNode.js +50 -69
- package/lib/Core/Deprecated/Undeprecator.d.ts +6 -0
- package/lib/Core/EntwinePointTileNode.d.ts +58 -0
- package/lib/Core/EntwinePointTileNode.js +6 -34
- package/lib/Core/Feature.d.ts +323 -0
- package/lib/Core/Geographic/GeoidGrid.d.ts +86 -0
- package/lib/Core/Label.d.ts +86 -0
- package/lib/Core/MainLoop.d.ts +23 -0
- package/lib/Core/Picking.d.ts +6 -0
- package/lib/Core/Picking.js +4 -0
- package/lib/Core/PointCloudNode.d.ts +14 -0
- package/lib/Core/PointCloudNode.js +28 -0
- package/lib/Core/Potree2Node.d.ts +11 -0
- package/lib/Core/Potree2Node.js +3 -57
- package/lib/Core/Potree2PointAttributes.d.ts +97 -0
- package/lib/Core/PotreeNode.d.ts +13 -0
- package/lib/Core/PotreeNode.js +17 -17
- package/lib/Core/Prefab/Globe/Atmosphere.d.ts +66 -0
- package/lib/Core/Prefab/Globe/Atmosphere.js +10 -5
- package/lib/Core/Prefab/Globe/GlobeLayer.d.ts +48 -0
- package/lib/Core/Prefab/Globe/GlobeTileBuilder.d.ts +38 -0
- package/lib/Core/Prefab/Globe/SkyShader.d.ts +5 -0
- package/lib/Core/Prefab/Globe/SkyShader.js +3 -3
- package/lib/Core/Prefab/GlobeView.d.ts +65 -0
- package/lib/Core/Prefab/GlobeView.js +9 -0
- package/lib/Core/Prefab/Planar/PlanarLayer.d.ts +38 -0
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.d.ts +32 -0
- package/lib/Core/Prefab/PlanarView.d.ts +33 -0
- package/lib/Core/Prefab/TileBuilder.d.ts +63 -0
- package/lib/Core/Prefab/computeBufferTileGeometry.d.ts +17 -0
- package/lib/Core/Scheduler/Cache.d.ts +25 -0
- package/lib/Core/Scheduler/CancelledCommandException.d.ts +12 -0
- package/lib/Core/Scheduler/Scheduler.d.ts +106 -0
- package/lib/Core/Style.d.ts +248 -0
- package/lib/Core/StyleOptions.d.ts +455 -0
- package/lib/Core/System/Capabilities.d.ts +9 -0
- package/lib/Core/Tile/Tile.d.ts +70 -0
- package/lib/Core/Tile/TileGrid.d.ts +12 -0
- package/lib/Core/TileGeometry.d.ts +46 -0
- package/lib/Core/TileMesh.d.ts +50 -0
- package/lib/Core/TileMesh.js +2 -4
- package/lib/Core/View.d.ts +403 -0
- package/lib/Core/View.js +1 -7
- package/lib/Layer/C3DTilesLayer.d.ts +140 -0
- package/lib/Layer/ColorLayer.d.ts +128 -0
- package/lib/Layer/ColorLayer.js +4 -4
- package/lib/Layer/CopcLayer.d.ts +42 -0
- package/lib/Layer/CopcLayer.js +3 -6
- package/lib/Layer/ElevationLayer.d.ts +96 -0
- package/lib/Layer/ElevationLayer.js +3 -3
- package/lib/Layer/EntwinePointTileLayer.d.ts +56 -0
- package/lib/Layer/EntwinePointTileLayer.js +4 -3
- package/lib/Layer/FeatureGeometryLayer.d.ts +62 -0
- package/lib/Layer/GeoidLayer.d.ts +41 -0
- package/lib/Layer/GeometryLayer.d.ts +120 -0
- package/lib/Layer/InfoLayer.d.ts +24 -0
- package/lib/Layer/InfoLayer.js +1 -1
- package/lib/Layer/LabelLayer.d.ts +93 -0
- package/lib/Layer/LabelLayer.js +2 -2
- package/lib/Layer/Layer.d.ts +185 -0
- package/lib/Layer/LayerUpdateState.d.ts +24 -0
- package/lib/Layer/LayerUpdateStrategy.d.ts +11 -0
- package/lib/Layer/LayerUpdateStrategy.js +2 -7
- package/lib/Layer/OGC3DTilesLayer.d.ts +277 -0
- package/lib/Layer/OGC3DTilesLayer.js +21 -0
- package/lib/Layer/OrientedImageLayer.d.ts +53 -0
- package/lib/Layer/PointCloudLayer.d.ts +103 -0
- package/lib/Layer/PointCloudLayer.js +1 -1
- package/lib/Layer/Potree2Layer.d.ts +56 -0
- package/lib/Layer/PotreeLayer.d.ts +55 -0
- package/lib/Layer/RasterLayer.d.ts +8 -0
- package/lib/Layer/RasterLayer.js +2 -2
- package/lib/Layer/ReferencingLayerProperties.d.ts +2 -0
- package/lib/Layer/ReferencingLayerProperties.js +0 -12
- package/lib/Layer/TiledGeometryLayer.d.ts +192 -0
- package/lib/Layer/TiledGeometryLayer.js +4 -3
- package/lib/Main.d.ts +89 -0
- package/lib/Main.js +3 -1
- package/lib/Parser/B3dmParser.d.ts +26 -0
- package/lib/Parser/CameraCalibrationParser.d.ts +32 -0
- package/lib/Parser/GDFParser.d.ts +24 -0
- package/lib/Parser/GTXParser.d.ts +28 -0
- package/lib/Parser/GeoJsonParser.d.ts +12 -0
- package/lib/Parser/GpxParser.d.ts +12 -0
- package/lib/Parser/ISGParser.d.ts +23 -0
- package/lib/Parser/KMLParser.d.ts +12 -0
- package/lib/Parser/LASParser.d.ts +61 -0
- package/lib/Parser/MapBoxUrlParser.d.ts +9 -0
- package/lib/Parser/PntsParser.d.ts +4 -0
- package/lib/Parser/Potree2BinParser.d.ts +8 -0
- package/lib/Parser/PotreeBinParser.d.ts +4 -0
- package/lib/Parser/PotreeCinParser.d.ts +4 -0
- package/lib/Parser/ShapefileParser.d.ts +25 -0
- package/lib/Parser/VectorTileParser.d.ts +34 -0
- package/lib/Parser/XbilParser.d.ts +18 -0
- package/lib/Parser/deprecated/LegacyGLTFLoader.d.ts +32 -0
- package/lib/Parser/iGLTFLoader.d.ts +104 -0
- package/lib/Process/3dTilesProcessing.d.ts +43 -0
- package/lib/Process/FeatureProcessing.d.ts +4 -0
- package/lib/Process/LayeredMaterialNodeProcessing.d.ts +3 -0
- package/lib/Process/LayeredMaterialNodeProcessing.js +12 -12
- package/lib/Process/ObjectRemovalHelper.d.ts +32 -0
- package/lib/Process/handlerNodeError.d.ts +1 -0
- package/lib/Provider/3dTilesProvider.d.ts +7 -0
- package/lib/Provider/DataSourceProvider.d.ts +4 -0
- package/lib/Provider/Fetcher.d.ts +101 -0
- package/lib/Provider/PointCloudProvider.d.ts +4 -0
- package/lib/Provider/TileProvider.d.ts +4 -0
- package/lib/Provider/URLBuilder.d.ts +28 -0
- package/lib/Renderer/Camera.d.ts +95 -0
- package/lib/Renderer/Color.d.ts +3 -0
- package/lib/Renderer/ColorLayersOrdering.d.ts +38 -0
- package/lib/Renderer/ColorLayersOrdering.js +2 -2
- package/lib/Renderer/CommonMaterial.d.ts +6 -0
- package/lib/Renderer/Label2DRenderer.d.ts +31 -0
- package/lib/Renderer/LayeredMaterial.d.ts +121 -0
- package/lib/Renderer/LayeredMaterial.js +221 -141
- package/lib/Renderer/OBB.d.ts +65 -0
- package/lib/Renderer/OrientedImageCamera.d.ts +36 -0
- package/lib/Renderer/OrientedImageMaterial.d.ts +68 -0
- package/lib/Renderer/PointsMaterial.d.ts +226 -0
- package/lib/Renderer/PointsMaterial.js +60 -22
- package/lib/Renderer/RasterTile.d.ts +53 -0
- package/lib/Renderer/RasterTile.js +8 -9
- package/lib/Renderer/RenderMode.d.ts +11 -0
- package/lib/Renderer/RenderMode.js +1 -0
- package/lib/Renderer/Shader/ShaderChunk.d.ts +78 -0
- package/lib/Renderer/Shader/ShaderUtils.d.ts +5 -0
- package/lib/Renderer/WebXR.d.ts +33 -0
- package/lib/Renderer/WebXR.js +128 -47
- package/lib/Renderer/c3DEngine.d.ts +55 -0
- package/lib/Renderer/c3DEngine.js +5 -1
- package/lib/Source/C3DTilesGoogleSource.d.ts +38 -0
- package/lib/Source/C3DTilesIonSource.d.ts +31 -0
- package/lib/Source/C3DTilesSource.d.ts +17 -0
- package/lib/Source/CopcSource.d.ts +79 -0
- package/lib/Source/EntwinePointTileSource.d.ts +40 -0
- package/lib/Source/EntwinePointTileSource.js +0 -5
- package/lib/Source/FileSource.d.ts +118 -0
- package/lib/Source/OGC3DTilesGoogleSource.d.ts +24 -0
- package/lib/Source/OGC3DTilesIonSource.d.ts +26 -0
- package/lib/Source/OGC3DTilesSource.d.ts +21 -0
- package/lib/Source/OrientedImageSource.d.ts +48 -0
- package/lib/Source/Potree2Source.d.ts +157 -0
- package/lib/Source/PotreeSource.d.ts +69 -0
- package/lib/Source/Source.d.ts +122 -0
- package/lib/Source/TMSSource.d.ts +77 -0
- package/lib/Source/VectorTilesSource.d.ts +56 -0
- package/lib/Source/WFSSource.d.ts +110 -0
- package/lib/Source/WMSSource.d.ts +85 -0
- package/lib/Source/WMTSSource.d.ts +65 -0
- package/lib/ThreeExtended/capabilities/WebGL.d.ts +9 -0
- package/lib/ThreeExtended/libs/ktx-parse.module.d.ts +274 -0
- package/lib/ThreeExtended/libs/motion-controllers.module.d.ts +64 -0
- package/lib/ThreeExtended/libs/motion-controllers.module.js +375 -0
- package/lib/ThreeExtended/libs/zstddec.module.d.ts +6 -0
- package/lib/ThreeExtended/loaders/DDSLoader.js +40 -1
- package/lib/ThreeExtended/loaders/DRACOLoader.d.ts +41 -0
- package/lib/ThreeExtended/loaders/GLTFLoader.d.ts +16 -0
- package/lib/ThreeExtended/loaders/GLTFLoader.js +22 -3
- package/lib/ThreeExtended/loaders/KTX2Loader.d.ts +116 -0
- package/lib/ThreeExtended/loaders/KTX2Loader.js +9 -2
- package/lib/ThreeExtended/math/ColorSpaces.d.ts +56 -0
- package/lib/ThreeExtended/utils/BufferGeometryUtils.d.ts +62 -0
- package/lib/ThreeExtended/utils/BufferGeometryUtils.js +2 -2
- package/lib/ThreeExtended/utils/WorkerPool.d.ts +19 -0
- package/lib/ThreeExtended/webxr/XRControllerModelFactory.d.ts +25 -0
- package/lib/ThreeExtended/webxr/XRControllerModelFactory.js +209 -0
- package/lib/Utils/CameraUtils.d.ts +132 -0
- package/lib/Utils/DEMUtils.d.ts +84 -0
- package/lib/Utils/DEMUtils.js +2 -2
- package/lib/Utils/FeaturesUtils.d.ts +17 -0
- package/lib/Utils/Gradients.d.ts +13 -0
- package/lib/Utils/ThreeUtils.d.ts +14 -0
- package/lib/Utils/placeObjectOnGround.d.ts +28 -0
- package/lib/global.d.js +0 -0
- package/package.json +18 -15
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
+
/* babel-plugin-inline-import './Shader/TileVS.glsl' */
|
|
3
|
+
const TileVS = "#include <itowns/precision_qualifier>\n#include <common>\n#include <itowns/elevation_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#if NUM_CRS > 1\nattribute float uv_1;\n#endif\n\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 #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, (uv_1 > 0.) ? uv_1 : uv.y); // set uv_1 = uv if uv_1 is undefined\n #else\n vUv = vec3(uv, 0.0);\n #endif\n vNormal = normalize ( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\n#endif\n}\n";
|
|
4
|
+
/* babel-plugin-inline-import './Shader/TileFS.glsl' */
|
|
5
|
+
const TileFS = "#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.x/uv_1.x, uv.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 DEBUG == 1\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";
|
|
2
6
|
import ShaderUtils from "./Shader/ShaderUtils.js";
|
|
3
7
|
import Capabilities from "../Core/System/Capabilities.js";
|
|
4
8
|
import RenderMode from "./RenderMode.js";
|
|
5
|
-
import CommonMaterial from "./CommonMaterial.js";
|
|
6
|
-
/* babel-plugin-inline-import '../Renderer/Shader/TileVS.glsl' */
|
|
7
|
-
const TileVS = "#include <itowns/precision_qualifier>\n#include <common>\n#include <itowns/elevation_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#if NUM_CRS > 1\nattribute float uv_1;\n#endif\n\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 #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, (uv_1 > 0.) ? uv_1 : uv.y); // set uv_1 = uv if uv_1 is undefined\n #else\n vUv = vec3(uv, 0.0);\n #endif\n vNormal = normalize ( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\n#endif\n}\n";
|
|
8
|
-
/* babel-plugin-inline-import '../Renderer/Shader/TileFS.glsl' */
|
|
9
|
-
const TileFS = "#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.x/uv_1.x, uv.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";
|
|
10
9
|
const identityOffsetScale = new THREE.Vector4(0.0, 0.0, 1.0, 1.0);
|
|
11
10
|
const defaultTex = new THREE.Texture();
|
|
12
11
|
|
|
@@ -31,146 +30,215 @@ export const colorLayerEffects = {
|
|
|
31
30
|
removeWhiteColor: 2,
|
|
32
31
|
customEffect: 3
|
|
33
32
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
|
|
34
|
+
/** GPU struct for color layers */
|
|
35
|
+
|
|
36
|
+
/** GPU struct for elevation layers */
|
|
37
|
+
|
|
38
|
+
/** Default GPU struct values for initialization QoL */
|
|
39
|
+
const defaultStructLayers = {
|
|
40
|
+
color: {
|
|
41
|
+
textureOffset: 0,
|
|
42
|
+
crs: 0,
|
|
43
|
+
opacity: 0,
|
|
44
|
+
effect_parameter: 0,
|
|
45
|
+
effect_type: colorLayerEffects.noEffect,
|
|
46
|
+
transparent: false
|
|
47
|
+
},
|
|
48
|
+
elevation: {
|
|
49
|
+
scale: 0,
|
|
50
|
+
bias: 0,
|
|
51
|
+
mode: 0,
|
|
52
|
+
zmin: 0,
|
|
53
|
+
zmax: 0
|
|
54
|
+
}
|
|
47
55
|
};
|
|
48
|
-
function updateLayersUniforms(uniforms,
|
|
49
|
-
//
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
//
|
|
56
|
+
function updateLayersUniforms(uniforms, tiles, max) {
|
|
57
|
+
// Aliases for readability
|
|
58
|
+
const uLayers = uniforms.layers.value;
|
|
59
|
+
const uTextures = uniforms.textures.value;
|
|
60
|
+
const uOffsetScales = uniforms.offsetScales.value;
|
|
61
|
+
const uTextureCount = uniforms.textureCount;
|
|
62
|
+
|
|
63
|
+
// Flatten the 2d array: [i, j] -> layers[_layerIds[i]].textures[j]
|
|
56
64
|
let count = 0;
|
|
57
|
-
for (const
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
for (const tile of tiles) {
|
|
66
|
+
// FIXME: RasterElevationTile are always passed to this function alone
|
|
67
|
+
// so this works, but it's really not great even ignoring the dynamic
|
|
68
|
+
// addition of a field.
|
|
69
|
+
// @ts-expect-error: adding field to passed layer
|
|
70
|
+
tile.textureOffset = count;
|
|
71
|
+
for (let i = 0; i < tile.textures.length && count < max; ++i, ++count) {
|
|
72
|
+
uOffsetScales[count] = tile.offsetScales[i];
|
|
73
|
+
uTextures[count] = tile.textures[i];
|
|
74
|
+
uLayers[count] = tile;
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
77
|
if (count > max) {
|
|
69
|
-
console.warn(`LayeredMaterial: Not enough texture units (${max} < ${count})
|
|
70
|
-
}
|
|
71
|
-
textureCount.value = count;
|
|
72
|
-
|
|
73
|
-
// WebGL 2.0 doesn't support the undefined uniforms.
|
|
74
|
-
// So the undefined uniforms are defined by default value.
|
|
75
|
-
for (let i = count; i < textures.length; i++) {
|
|
76
|
-
textures[i] = defaultTex;
|
|
77
|
-
offsetScales[i] = identityOffsetScale;
|
|
78
|
-
layers[i] = defaultStructLayer;
|
|
78
|
+
console.warn(`LayeredMaterial: Not enough texture units (${max} < ${count}),` + 'excess textures have been discarded.');
|
|
79
79
|
}
|
|
80
|
+
uTextureCount.value = count;
|
|
80
81
|
}
|
|
81
82
|
export const ELEVATION_MODES = {
|
|
82
83
|
RGBA: 0,
|
|
83
84
|
COLOR: 1,
|
|
84
85
|
DATA: 2
|
|
85
86
|
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Convenience type that wraps all of the generic type's fields in
|
|
90
|
+
* [THREE.IUniform]s.
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/** List of the uniform types required for a LayeredMaterial. */
|
|
94
|
+
|
|
86
95
|
let nbSamplers;
|
|
87
96
|
const fragmentShader = [];
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
|
|
98
|
+
/** Replacing the default uniforms dynamic type with our own static map. */
|
|
99
|
+
|
|
100
|
+
/** Fills in a Partial object's field and narrows the type accordingly. */
|
|
101
|
+
function fillInProp(obj, name, value) {
|
|
102
|
+
if (obj[name] === undefined) {
|
|
103
|
+
obj[name] = value;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Initialiszes elevation and render mode defines and narrows the type
|
|
108
|
+
* accordingly.
|
|
109
|
+
*/
|
|
110
|
+
function initModeDefines(defines) {
|
|
111
|
+
Object.keys(ELEVATION_MODES).forEach(key => fillInProp(defines, `ELEVATION_${key}`, ELEVATION_MODES[key]));
|
|
112
|
+
Object.keys(RenderMode.MODES).forEach(key => fillInProp(defines, `MODE_${key}`, RenderMode.MODES[key]));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Material that handles the overlap of multiple raster tiles. */
|
|
116
|
+
export class LayeredMaterial extends THREE.ShaderMaterial {
|
|
117
|
+
_visible = true;
|
|
90
118
|
constructor() {
|
|
91
119
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
92
120
|
let crsCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
93
121
|
super(options);
|
|
94
|
-
nbSamplers
|
|
95
|
-
|
|
96
|
-
|
|
122
|
+
nbSamplers ??= [samplersElevationCount, getMaxColorSamplerUnitsCount()];
|
|
123
|
+
const defines = {};
|
|
124
|
+
fillInProp(defines, 'NUM_VS_TEXTURES', nbSamplers[0]);
|
|
125
|
+
fillInProp(defines, 'NUM_FS_TEXTURES', nbSamplers[1]);
|
|
97
126
|
// TODO: We do not use the fog from the scene, is this a desired
|
|
98
127
|
// behavior?
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
128
|
+
fillInProp(defines, 'USE_FOG', 1);
|
|
129
|
+
fillInProp(defines, 'NUM_CRS', crsCount);
|
|
130
|
+
initModeDefines(defines);
|
|
131
|
+
fillInProp(defines, 'MODE', RenderMode.MODES.FINAL);
|
|
132
|
+
fillInProp(defines, 'DEBUG', +false);
|
|
133
|
+
this.defines = defines;
|
|
104
134
|
this.vertexShader = TileVS;
|
|
105
135
|
// three loop unrolling of ShaderMaterial only supports integer bounds,
|
|
106
136
|
// see https://github.com/mrdoob/three.js/issues/28020
|
|
107
|
-
fragmentShader[crsCount]
|
|
137
|
+
fragmentShader[crsCount] ??= ShaderUtils.unrollLoops(TileFS, defines);
|
|
108
138
|
this.fragmentShader = fragmentShader[crsCount];
|
|
139
|
+
this.initUniforms({
|
|
140
|
+
// Color uniforms
|
|
141
|
+
diffuse: new THREE.Color(0.04, 0.23, 0.35),
|
|
142
|
+
opacity: this.opacity,
|
|
143
|
+
// Lighting uniforms
|
|
144
|
+
lightingEnabled: false,
|
|
145
|
+
lightPosition: new THREE.Vector3(-0.5, 0.0, 1.0),
|
|
146
|
+
// Misc properties
|
|
147
|
+
fogDistance: 1000000000.0,
|
|
148
|
+
fogColor: new THREE.Color(0.76, 0.85, 1.0),
|
|
149
|
+
overlayAlpha: 0,
|
|
150
|
+
overlayColor: new THREE.Color(1.0, 0.3, 0.0),
|
|
151
|
+
objectId: 0,
|
|
152
|
+
geoidHeight: 0.0,
|
|
153
|
+
// > 0 produces gaps,
|
|
154
|
+
// < 0 causes oversampling of textures
|
|
155
|
+
// = 0 causes sampling artefacts due to bad estimation of texture-uv
|
|
156
|
+
// gradients
|
|
157
|
+
// best is a small negative number
|
|
158
|
+
minBorderDistance: -0.01
|
|
159
|
+
});
|
|
109
160
|
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
161
|
+
// LayeredMaterialLayers
|
|
162
|
+
this.colorTiles = [];
|
|
163
|
+
this.colorTileIds = [];
|
|
164
|
+
this.layersNeedUpdate = false;
|
|
113
165
|
|
|
114
|
-
//
|
|
115
|
-
|
|
116
|
-
|
|
166
|
+
// elevation/color layer uniforms, to be updated using updateUniforms()
|
|
167
|
+
this.initUniforms({
|
|
168
|
+
elevationLayers: new Array(nbSamplers[0]).fill(defaultStructLayers.elevation),
|
|
169
|
+
elevationTextures: new Array(nbSamplers[0]).fill(defaultTex),
|
|
170
|
+
elevationOffsetScales: new Array(nbSamplers[0]).fill(identityOffsetScale),
|
|
171
|
+
elevationTextureCount: 0,
|
|
172
|
+
colorLayers: new Array(nbSamplers[1]).fill(defaultStructLayers.color),
|
|
173
|
+
colorTextures: new Array(nbSamplers[1]).fill(defaultTex),
|
|
174
|
+
colorOffsetScales: new Array(nbSamplers[1]).fill(identityOffsetScale),
|
|
175
|
+
colorTextureCount: 0
|
|
176
|
+
});
|
|
117
177
|
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
178
|
+
// Can't do an ES6 getter/setter here because it would override the
|
|
179
|
+
// Material::visible property with accessors, which is not allowed.
|
|
180
|
+
Object.defineProperty(this, 'visible', {
|
|
181
|
+
// Knowing the visibility of a `LayeredMaterial` is useful. For
|
|
182
|
+
// example in a `GlobeView`, if you zoom in, "parent" tiles seems
|
|
183
|
+
// hidden; in fact, there are not, it is only their material (so
|
|
184
|
+
// `LayeredMaterial`) that is set to not visible.
|
|
125
185
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
// best is a small negative number
|
|
130
|
-
CommonMaterial.setUniformProperty(this, 'minBorderDistance', -0.01);
|
|
186
|
+
// Adding an event when changing this property can be useful to
|
|
187
|
+
// hide others things, like in `TileDebug`, or in later PR to come
|
|
188
|
+
// (#1303 for example).
|
|
131
189
|
|
|
132
|
-
// LayeredMaterialLayers
|
|
133
|
-
this.layers = [];
|
|
134
|
-
this.elevationLayerIds = [];
|
|
135
|
-
this.colorLayerIds = [];
|
|
136
|
-
|
|
137
|
-
// elevation layer uniforms, to be updated using updateUniforms()
|
|
138
|
-
this.uniforms.elevationLayers = new THREE.Uniform(new Array(nbSamplers[0]).fill(defaultStructLayer));
|
|
139
|
-
this.uniforms.elevationTextures = new THREE.Uniform(new Array(nbSamplers[0]).fill(defaultTex));
|
|
140
|
-
this.uniforms.elevationOffsetScales = new THREE.Uniform(new Array(nbSamplers[0]).fill(identityOffsetScale));
|
|
141
|
-
this.uniforms.elevationTextureCount = new THREE.Uniform(0);
|
|
142
|
-
|
|
143
|
-
// color layer uniforms, to be updated using updateUniforms()
|
|
144
|
-
this.uniforms.colorLayers = new THREE.Uniform(new Array(nbSamplers[1]).fill(defaultStructLayer));
|
|
145
|
-
this.uniforms.colorTextures = new THREE.Uniform(new Array(nbSamplers[1]).fill(defaultTex));
|
|
146
|
-
this.uniforms.colorOffsetScales = new THREE.Uniform(new Array(nbSamplers[1]).fill(identityOffsetScale));
|
|
147
|
-
this.uniforms.colorTextureCount = new THREE.Uniform(0);
|
|
148
|
-
|
|
149
|
-
// can't do an ES6 setter/getter here
|
|
150
|
-
Object.defineProperty(this, 'visible', {
|
|
151
|
-
// Knowing the visibility of a `LayeredMaterial` is useful. For example in a
|
|
152
|
-
// `GlobeView`, if you zoom in, "parent" tiles seems hidden; in fact, there
|
|
153
|
-
// are not, it is only their material (so `LayeredMaterial`) that is set to
|
|
154
|
-
// not visible.
|
|
155
|
-
|
|
156
|
-
// Adding an event when changing this property can be useful to hide others
|
|
157
|
-
// things, like in `TileDebug`, or in later PR to come (#1303 for example).
|
|
158
|
-
//
|
|
159
190
|
// TODO : verify if there is a better mechanism to avoid this event
|
|
160
191
|
get() {
|
|
161
|
-
return this
|
|
192
|
+
return this._visible;
|
|
162
193
|
},
|
|
163
194
|
set(v) {
|
|
164
|
-
if (this
|
|
165
|
-
this
|
|
195
|
+
if (this._visible != v) {
|
|
196
|
+
this._visible = v;
|
|
166
197
|
this.dispatchEvent({
|
|
167
198
|
type: v ? 'shown' : 'hidden'
|
|
168
199
|
});
|
|
169
200
|
}
|
|
170
201
|
}
|
|
171
202
|
});
|
|
203
|
+
|
|
204
|
+
// setTimeout(() => console.log(this), 2);
|
|
205
|
+
}
|
|
206
|
+
get mode() {
|
|
207
|
+
return this.defines.MODE;
|
|
208
|
+
}
|
|
209
|
+
set mode(mode) {
|
|
210
|
+
if (this.defines.MODE != mode) {
|
|
211
|
+
this.defines.MODE = mode;
|
|
212
|
+
this.needsUpdate = true;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
getUniform(name) {
|
|
216
|
+
return this.uniforms[name]?.value;
|
|
217
|
+
}
|
|
218
|
+
setUniform(name, value) {
|
|
219
|
+
const uniform = this.uniforms[name];
|
|
220
|
+
if (uniform === undefined) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (uniform.value !== value) {
|
|
224
|
+
uniform.value = value;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
initUniforms(uniforms) {
|
|
228
|
+
for (const [name, value] of Object.entries(uniforms)) {
|
|
229
|
+
if (this.uniforms[name] === undefined) {
|
|
230
|
+
this.uniforms[name] = {
|
|
231
|
+
value
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
setUniforms(uniforms) {
|
|
237
|
+
for (const [name, value] of Object.entries(uniforms)) {
|
|
238
|
+
this.setUniform(name, value);
|
|
239
|
+
}
|
|
172
240
|
}
|
|
173
|
-
|
|
241
|
+
getLayerUniforms(type) {
|
|
174
242
|
return {
|
|
175
243
|
layers: this.uniforms[`${type}Layers`],
|
|
176
244
|
textures: this.uniforms[`${type}Textures`],
|
|
@@ -179,12 +247,13 @@ class LayeredMaterial extends THREE.ShaderMaterial {
|
|
|
179
247
|
};
|
|
180
248
|
}
|
|
181
249
|
updateLayersUniforms() {
|
|
182
|
-
const colorlayers = this.
|
|
183
|
-
colorlayers.sort((a, b) => this.
|
|
184
|
-
updateLayersUniforms(this.
|
|
185
|
-
if (this.
|
|
186
|
-
|
|
187
|
-
|
|
250
|
+
const colorlayers = this.colorTiles.filter(rt => rt.visible && rt.opacity > 0);
|
|
251
|
+
colorlayers.sort((a, b) => this.colorTileIds.indexOf(a.id) - this.colorTileIds.indexOf(b.id));
|
|
252
|
+
updateLayersUniforms(this.getLayerUniforms('color'), colorlayers, this.defines.NUM_FS_TEXTURES);
|
|
253
|
+
if (this.elevationTileId !== undefined && this.getElevationTile()) {
|
|
254
|
+
if (this.elevationTile !== undefined) {
|
|
255
|
+
updateLayersUniforms(this.getLayerUniforms('elevation'), [this.elevationTile], this.defines.NUM_VS_TEXTURES);
|
|
256
|
+
}
|
|
188
257
|
}
|
|
189
258
|
this.layersNeedUpdate = false;
|
|
190
259
|
}
|
|
@@ -192,52 +261,63 @@ class LayeredMaterial extends THREE.ShaderMaterial {
|
|
|
192
261
|
this.dispatchEvent({
|
|
193
262
|
type: 'dispose'
|
|
194
263
|
});
|
|
195
|
-
this.
|
|
196
|
-
this.
|
|
264
|
+
this.colorTiles.forEach(l => l.dispose(true));
|
|
265
|
+
this.colorTiles.length = 0;
|
|
266
|
+
this.elevationTile?.dispose(true);
|
|
197
267
|
this.layersNeedUpdate = true;
|
|
198
268
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
setSequence(sequenceLayer) {
|
|
202
|
-
this.colorLayerIds = sequenceLayer;
|
|
269
|
+
setColorTileIds(ids) {
|
|
270
|
+
this.colorTileIds = ids;
|
|
203
271
|
this.layersNeedUpdate = true;
|
|
204
272
|
}
|
|
205
|
-
|
|
206
|
-
this.
|
|
273
|
+
setElevationTileId(id) {
|
|
274
|
+
this.elevationTileId = id;
|
|
207
275
|
this.layersNeedUpdate = true;
|
|
208
276
|
}
|
|
209
|
-
|
|
210
|
-
const index = this.
|
|
277
|
+
removeTile(tileId) {
|
|
278
|
+
const index = this.colorTiles.findIndex(l => l.id === tileId);
|
|
211
279
|
if (index > -1) {
|
|
212
|
-
this.
|
|
213
|
-
this.
|
|
214
|
-
const idSeq = this.
|
|
280
|
+
this.colorTiles[index].dispose();
|
|
281
|
+
this.colorTiles.splice(index, 1);
|
|
282
|
+
const idSeq = this.colorTileIds.indexOf(tileId);
|
|
215
283
|
if (idSeq > -1) {
|
|
216
|
-
this.
|
|
284
|
+
this.colorTileIds.splice(idSeq, 1);
|
|
217
285
|
} else {
|
|
218
|
-
this.
|
|
286
|
+
this.elevationTileId = undefined;
|
|
219
287
|
}
|
|
220
288
|
}
|
|
221
289
|
}
|
|
222
|
-
|
|
223
|
-
if (
|
|
224
|
-
console.warn('
|
|
290
|
+
addColorTile(rasterTile) {
|
|
291
|
+
if (rasterTile.layer.id in this.colorTiles) {
|
|
292
|
+
console.warn('Layer "{layer.id}" already present in material, overwriting.');
|
|
225
293
|
}
|
|
226
|
-
this.
|
|
294
|
+
this.colorTiles.push(rasterTile);
|
|
227
295
|
}
|
|
228
|
-
|
|
229
|
-
|
|
296
|
+
setElevationTile(rasterTile) {
|
|
297
|
+
const old = this.elevationTile;
|
|
298
|
+
if (old !== undefined) {
|
|
299
|
+
old.dispose();
|
|
300
|
+
}
|
|
301
|
+
this.elevationTile = rasterTile;
|
|
230
302
|
}
|
|
231
|
-
|
|
232
|
-
return this.
|
|
303
|
+
getColorTile(id) {
|
|
304
|
+
return this.colorTiles.find(l => l.id === id);
|
|
233
305
|
}
|
|
234
|
-
|
|
235
|
-
return this.
|
|
306
|
+
getElevationTile() {
|
|
307
|
+
return this.elevationTile;
|
|
236
308
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
309
|
+
getTile(id) {
|
|
310
|
+
return this.elevationTile?.id === id ? this.elevationTile : this.colorTiles.find(l => l.id === id);
|
|
311
|
+
}
|
|
312
|
+
getTiles(ids) {
|
|
313
|
+
// NOTE: this could instead be a mapping with an undefined in place of
|
|
314
|
+
// unfound IDs. Need to identify a use case for it though as it would
|
|
315
|
+
// probably have a performance cost (albeit minor in the grand scheme of
|
|
316
|
+
// things).
|
|
317
|
+
const res = this.colorTiles.filter(l => ids.includes(l.id));
|
|
318
|
+
if (this.elevationTile !== undefined && ids.includes(this.elevationTile?.id)) {
|
|
319
|
+
res.push(this.elevationTile);
|
|
240
320
|
}
|
|
321
|
+
return res;
|
|
241
322
|
}
|
|
242
|
-
}
|
|
243
|
-
export default LayeredMaterial;
|
|
323
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export default OBB;
|
|
2
|
+
/**
|
|
3
|
+
* Oriented bounding box
|
|
4
|
+
* @extends THREE.Object3D
|
|
5
|
+
*/
|
|
6
|
+
declare class OBB extends THREE.Object3D<THREE.Object3DEventMap> {
|
|
7
|
+
/**
|
|
8
|
+
* @param {THREE.Vector3} min representing the lower (x, y, z) boundary of the box. Default is ( + Infinity, + Infinity, + Infinity ).
|
|
9
|
+
* @param {THREE.Vector3} max representing the lower upper (x, y, z) boundary of the box. Default is ( - Infinity, - Infinity, - Infinity ).
|
|
10
|
+
*/
|
|
11
|
+
constructor(min?: THREE.Vector3, max?: THREE.Vector3);
|
|
12
|
+
box3D: THREE.Box3;
|
|
13
|
+
natBox: THREE.Box3;
|
|
14
|
+
z: {
|
|
15
|
+
min: number;
|
|
16
|
+
max: number;
|
|
17
|
+
scale: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new instance of the object with same properties than original.
|
|
21
|
+
*
|
|
22
|
+
* @return {OBB} Copy of this object.
|
|
23
|
+
*/
|
|
24
|
+
clone(): OBB;
|
|
25
|
+
/**
|
|
26
|
+
* Copy the property of OBB
|
|
27
|
+
*
|
|
28
|
+
* @param {OBB} cOBB OBB to copy
|
|
29
|
+
* @return {OBB} the copy
|
|
30
|
+
*/
|
|
31
|
+
copy(cOBB: OBB): OBB;
|
|
32
|
+
/**
|
|
33
|
+
* Update z min, z max and z scale of oriented bounding box
|
|
34
|
+
*
|
|
35
|
+
* @param {Object} [elevation={}]
|
|
36
|
+
* @param {number} [elevation.min] The minimum of oriented bounding box
|
|
37
|
+
* @param {number} [elevation.max] The maximum of oriented bounding box
|
|
38
|
+
* @param {number} [elevation.scale] The scale of oriented bounding box Z axis
|
|
39
|
+
* @param {number} [elevation.geoidHeight] The geoid height added to ellipsoid.
|
|
40
|
+
*/
|
|
41
|
+
updateZ(elevation?: {
|
|
42
|
+
min?: number | undefined;
|
|
43
|
+
max?: number | undefined;
|
|
44
|
+
scale?: number | undefined;
|
|
45
|
+
geoidHeight?: number | undefined;
|
|
46
|
+
}): void;
|
|
47
|
+
/**
|
|
48
|
+
* Determines if the sphere is above the XY space of the box
|
|
49
|
+
*
|
|
50
|
+
* @param {Sphere} sphere The sphere
|
|
51
|
+
* @return {boolean} True if sphere is above the XY space of the box, False otherwise.
|
|
52
|
+
*/
|
|
53
|
+
isSphereAboveXYBox(sphere: Sphere): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Compute OBB from extent.
|
|
56
|
+
* The OBB resulted can be only in the system 'EPSG:3946'.
|
|
57
|
+
*
|
|
58
|
+
* @param {Extent} extent The extent (with crs 'EPSG:4326') to compute oriented bounding box
|
|
59
|
+
* @param {number} minHeight The minimum height of OBB
|
|
60
|
+
* @param {number} maxHeight The maximum height of OBB
|
|
61
|
+
* @return {OBB} return this object
|
|
62
|
+
*/
|
|
63
|
+
setFromExtent(extent: Extent, minHeight?: number, maxHeight?: number): OBB;
|
|
64
|
+
}
|
|
65
|
+
import * as THREE from 'three';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export default OrientedImageCamera;
|
|
2
|
+
/**
|
|
3
|
+
* OrientedImageCamera is a ThreeJs camera adapted to photogrammetric description.
|
|
4
|
+
* So we can build a ThreeJs perspective camera from size and focal information.
|
|
5
|
+
*/
|
|
6
|
+
declare class OrientedImageCamera extends THREE.PerspectiveCamera {
|
|
7
|
+
/**
|
|
8
|
+
* @param {number|Vector2} size - image size in pixels (default: x=1024, y=x)
|
|
9
|
+
* @param {number|Vector2} focal - focal length in pixels (default: x=1024, y=x)
|
|
10
|
+
* @param {Vector2} center - principal point in pixels (default: size/2)
|
|
11
|
+
* @param {number} near - Camera frustum near plane (default: see THREE.PerspectiveCamera).
|
|
12
|
+
* @param {number} far - Camera frustum far plane (default: see THREE.PerspectiveCamera).
|
|
13
|
+
* @param {number} skew - shear transform parameter (default: 0)
|
|
14
|
+
* @param {number} aspect - aspect ratio of the camera (default: size.x/size.y).
|
|
15
|
+
*/
|
|
16
|
+
constructor(size: number | Vector2, focal: number | Vector2, center: Vector2, near: number | undefined, far: number | undefined, skew: number, aspect: number);
|
|
17
|
+
size: any;
|
|
18
|
+
focal: any;
|
|
19
|
+
center: any;
|
|
20
|
+
skew: number;
|
|
21
|
+
textureMatrixWorldInverse: THREE.Matrix4;
|
|
22
|
+
distortion: Distortion;
|
|
23
|
+
maskPath: any;
|
|
24
|
+
mask: any;
|
|
25
|
+
copy(source: any, recursive: any): this;
|
|
26
|
+
}
|
|
27
|
+
import * as THREE from 'three';
|
|
28
|
+
declare class Distortion {
|
|
29
|
+
constructor(size: any);
|
|
30
|
+
size: any;
|
|
31
|
+
pps: THREE.Vector2 | null;
|
|
32
|
+
polynom: THREE.Vector4 | null;
|
|
33
|
+
l1l2: THREE.Vector3 | null;
|
|
34
|
+
setFromMicmacCalibration(distortion: any, imageYDown?: boolean): void;
|
|
35
|
+
clone(): Distortion;
|
|
36
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export default OrientedImageMaterial;
|
|
2
|
+
/**
|
|
3
|
+
* OrientedImageMaterial is a custom shader material used to do projective texture mapping.<br/>
|
|
4
|
+
*
|
|
5
|
+
* This Material is designed to project many textures simultaneously.
|
|
6
|
+
* Each projected texture setting is stored as an {@link OrientedImageCamera}.<br/>
|
|
7
|
+
* <br/>
|
|
8
|
+
* All cameras settings, like distorsion, can be specified in a configuration file.
|
|
9
|
+
* See [CameraCalibrationParser]{@link module:CameraCalibrationParser.parse}
|
|
10
|
+
* used to parse a configuration file and create an array of camera.<br/>
|
|
11
|
+
* <br/>
|
|
12
|
+
* The current implementation supports the following distortion models : <br/>
|
|
13
|
+
* - no distortion (polynom==vec3(0),l1l2==vec2(0))<br/>
|
|
14
|
+
* - radial distortion (polynom!=vec3(0),l1l2==vec2(0)) (see <b>15.2.2 Radial Model</b> in [MicMac doc](https://github.com/micmacIGN/Documentation/blob/master/DocMicMac.pdf)) </br>
|
|
15
|
+
* - equilinear fish eye distortion (polynom!=vec3(0),l1l2 != vec2(0)) (see <b>15.3.4 Fish eye models</b> in [MicMac doc](https://github.com/micmacIGN/Documentation/blob/master/DocMicMac.pdf)) </br>
|
|
16
|
+
* (Note: radial decentric parameters P1 are P2 not supported and assumed to be 0).<br/>
|
|
17
|
+
* <br/>
|
|
18
|
+
* To get a more comprehensive support of camera Micmac models, you can consider using [three-photogrammetric-camera]{@link https://github.com/mbredif/three-photogrammetric-camera} instead.
|
|
19
|
+
*/
|
|
20
|
+
declare class OrientedImageMaterial extends THREE.ShaderMaterial {
|
|
21
|
+
/**
|
|
22
|
+
* @param { OrientedImageCamera[]} cameras - Array of {@link OrientedImageCamera}. Each camera will project a texture.
|
|
23
|
+
* [CameraCalibrationParser]{@link module:CameraCalibrationParser.parse} can used to create this array of camera from a configuration file.
|
|
24
|
+
* @param {Object} [options={}] - Object with one or more properties defining the material's appearance.
|
|
25
|
+
* Any property of the material (including any property inherited from
|
|
26
|
+
* [THREE.Material]{@link https://threejs.org/docs/#api/en/materials/Material} and
|
|
27
|
+
* [THREE.ShaderMaterial]{@link https://threejs.org/docs/#api/en/materials/ShaderMaterial}) can be passed in here.
|
|
28
|
+
* @param {Number} [options.side=THREE.DoubleSide] - We override default
|
|
29
|
+
* [THREE.Material.side]{@link https://threejs.org/docs/#api/en/materials/Material.side} from FrontSide to DoubleSide.
|
|
30
|
+
* @param {Boolean} [options.transparent=true] - We override default
|
|
31
|
+
* [THREE.Material.transparent]{@link https://threejs.org/docs/#api/en/materials/Material.transparent} from false to true.
|
|
32
|
+
* @param {Number} [options.opacity=0.1] - We override default
|
|
33
|
+
* [THREE.Material.opacity]{@link https://threejs.org/docs/#api/en/materials/Material.opacity} from 1 to 0.1.
|
|
34
|
+
* @param {Number} [options.alphaBorder=20] - Part of the texture that is blended, when texture crosses each other.
|
|
35
|
+
* For example, 10 means a border as large as 1 / 10 of the size of the texture is used to blend colors.
|
|
36
|
+
* @param {Number} [options.debugAlphaBorder=0] - Set this option to 1 to see influence of alphaBorder option.
|
|
37
|
+
*/
|
|
38
|
+
constructor(cameras: OrientedImageCamera[], options?: {
|
|
39
|
+
side?: number | undefined;
|
|
40
|
+
transparent?: boolean | undefined;
|
|
41
|
+
opacity?: number | undefined;
|
|
42
|
+
alphaBorder?: number | undefined;
|
|
43
|
+
debugAlphaBorder?: number | undefined;
|
|
44
|
+
});
|
|
45
|
+
alphaBorder: number;
|
|
46
|
+
cameras: OrientedImageCamera[];
|
|
47
|
+
group: THREE.Group<THREE.Object3DEventMap>;
|
|
48
|
+
fragmentShader: any;
|
|
49
|
+
/**
|
|
50
|
+
* Set new textures and new position/orientation of the camera set.
|
|
51
|
+
* @param {THREE.Texture} textures - Array of [THREE.Texture]{@link https://threejs.org/docs/#api/en/textures/Texture}.
|
|
52
|
+
* @param {Object} feature - New position / orientation of the set of cameras
|
|
53
|
+
* @param {THREE.Vector3} feature.position - New position.
|
|
54
|
+
* @param {THREE.Quaternion} feature.quaternion - New orientation.
|
|
55
|
+
* @param {Array} camerasNames - camera names of panoramic feature
|
|
56
|
+
*/
|
|
57
|
+
setTextures(textures: THREE.Texture, feature: {
|
|
58
|
+
position: THREE.Vector3;
|
|
59
|
+
quaternion: THREE.Quaternion;
|
|
60
|
+
}, camerasNames: any[]): void;
|
|
61
|
+
/**
|
|
62
|
+
* Udate the uniforms using the current value of camera.matrixWorld.
|
|
63
|
+
* Need to be called when the camera of the scene has changed.
|
|
64
|
+
* @param {THREE.Camera} viewCamera - Camera of the scene.
|
|
65
|
+
*/
|
|
66
|
+
updateUniforms(viewCamera: THREE.Camera): void;
|
|
67
|
+
}
|
|
68
|
+
import * as THREE from 'three';
|