Skip to content

Commit

Permalink
Update to giro3d-0.42.beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Feb 11, 2025
1 parent 9c8f0ea commit c54c1c5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
13 changes: 8 additions & 5 deletions components/map3d/Map3D.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import Instance from '@giro3d/giro3d/core/Instance.js';
import Extent from '@giro3d/giro3d/core/geographic/Extent.js';
import ElevationLayer from '@giro3d/giro3d/core/layer/ElevationLayer.js';
import Map from '@giro3d/giro3d/entities/Map.js';
import {MapLightingMode} from '@giro3d/giro3d/entities/MapLightingOptions';
import Tiles3D from "@giro3d/giro3d/entities/Tiles3D.js";
import GeoTIFFSource from "@giro3d/giro3d/sources/GeoTIFFSource.js";
import Tiles3DSource from "@giro3d/giro3d/sources/Tiles3DSource.js";
import {fromUrl} from "geotiff";
import PropTypes from 'prop-types';
import {Vector2, CubeTextureLoader, Group, Raycaster, Mesh} from 'three';
Expand Down Expand Up @@ -388,7 +388,10 @@ class Map3D extends React.Component {
this.map = new Map({
extent: extent,
backgroundColor: "white",
hillshading: true
lighting: {
enabled: true,
mode: MapLightingMode.LightBased
}
});
this.instance.add(this.map);

Expand Down Expand Up @@ -458,9 +461,9 @@ class Map3D extends React.Component {
if (tilesUrl.startsWith(":")) {
tilesUrl = location.href.split("?")[0] + ConfigUtils.getAssetsPath() + tilesUrl.substr(1);
}
const tiles = new Tiles3D(
new Tiles3DSource(tilesUrl)
);
const tiles = new Tiles3D({
url: tilesUrl
});
tiles.userData.layertree = true;
this.instance.add(tiles);
this.objectMap[entry.name] = tiles;
Expand Down
8 changes: 4 additions & 4 deletions components/map3d/Map3DLight.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ export default class Map3DLight extends React.Component {
const alpha = Math.max(0, alt / (0.5 * Math.PI));
const intensity = 1.15 * alpha / (alpha + 0.15);

sceneContext.map.hillshading.azimuth = az / Math.PI * 180; // Azimuth is measured from South
sceneContext.map.hillshading.zenith = 90 - intensity * 30;
sceneContext.map.hillshading.intensity = 1 - 0.4 * intensity;
sceneContext.map.hillshading.elevationLayersOnly = true;
sceneContext.map.lighting.azimuth = az / Math.PI * 180; // Azimuth is measured from South
sceneContext.map.lighting.zenith = 90 - intensity * 30;
sceneContext.map.lighting.intensity = 1 - 0.4 * intensity;
sceneContext.map.lighting.elevationLayersOnly = true;

// Modulate light intensities based on sun altitude
sceneContext.getSceneObject("__ambientLight").intensity = 0.01 + 0.49 * intensity;
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "qwc2",
"version": "2025.02.10-master",
"version": "2025.02.11-master",
"description": "QGIS Web Client 2 core",
"author": "Sourcepole AG",
"license": "BSD-2-Clause",
"repository": "[email protected]:qgis/qwc2.git",
"dependencies": {
"@giro3d/giro3d": "^0.41.0",
"@giro3d/giro3d": "^0.42.0-beta.1",
"@ladjs/country-language": "^1.0.3",
"@loaders.gl/core": "^4.3.3",
"@loaders.gl/shapefile": "^4.3.3",
Expand Down Expand Up @@ -66,7 +66,7 @@
"sortablejs": "^1.15.6",
"suncalc": "^1.9.0",
"svgpath": "^2.6.0",
"three": "^0.172.0",
"three": "^0.170.0",
"url": "^0.11.4",
"utif": "^3.1.0",
"uuid": "^11.0.3"
Expand Down

0 comments on commit c54c1c5

Please sign in to comment.