Skip to content

Commit 67836bd

Browse files
committed
1 parent 56dfef7 commit 67836bd

8 files changed

Lines changed: 150 additions & 7 deletions

File tree

itowns/dev/dist/itowns.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

itowns/dev/dist/itowns.umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

itowns/dev/docs/api/Base/Style.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,26 @@ <h3>
313313

314314

315315

316+
<div class="property">
317+
<h3>
318+
<span class="property-name">fill.levelled_roofs</span>
319+
: <span class="type">boolean</span>
320+
</h3>
321+
322+
323+
<div class="description">
324+
<p>Only for <a onclick="window.parent.goTo('api/Layer/GeometryLayer.html','api/Layer/GeometryLayer')" title="GeometryLayer">GeometryLayer</a> with extrusion.
325+
When true, all roof vertices are placed at a uniform height equal to the polygon's minimum
326+
base altitude plus the extrusion height, producing flat-topped extrusions even over uneven
327+
terrain. Cannot be set to a function.</p>
328+
</div>
329+
330+
</div>
331+
332+
<hr/>
333+
334+
335+
316336
<div class="property">
317337
<h3>
318338
<span class="property-name">stroke</span>

itowns/dev/examples/3dtiles_loader.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,6 @@
200200
.then(() => debug.createOGC3DTilesDebugUI(gui, view, window.layer));
201201
}
202202

203-
// ---------- Realistic lighting & DATE/TIME CONTROLS ----------
204-
debug.createRealisticLightingDebugUI(gui,view);
205-
206203
function loadLyon() {
207204
setUrl("https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/refs/heads/master/3DTiles/lyon1-4978/tileset.json");
208205
}

itowns/dev/examples/config.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@
6464
"id": "3dtiles_loader",
6565
"label": "3D Tiles loader",
6666
"description": "Native support for the OGC 3D Tiles standard for massive 3D dataset streaming."
67+
},
68+
{
69+
"id": "realistic_lighting",
70+
"label": "Realistic lighting",
71+
"description": "Physically-based sun lighting and shadows on a 3D Tiles mesh dataset."
6772
}
6873
]
6974
},
@@ -422,4 +427,4 @@
422427
}
423428
]
424429
}
425-
]
430+
]

itowns/dev/examples/demo/dist/demo/tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
62.6 KB
Loading
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<html>
2+
<head>
3+
<title>Itowns - 3D Tiles loader (Realistic Lighting)</title>
4+
5+
<script type="importmap">
6+
{
7+
"imports": {
8+
"itowns": "../dist/itowns.js",
9+
"debug": "../dist/debug.js",
10+
"dat": "https://unpkg.com/dat.gui@0.7.9/build/dat.gui.module.js",
11+
"LoadingScreen": "./jsm/GUI/LoadingScreen.js",
12+
"three": "https://unpkg.com/three@0.182.0/build/three.module.js"
13+
}
14+
}
15+
</script>
16+
17+
<meta charset="UTF-8">
18+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
19+
20+
<link rel="stylesheet" type="text/css" href="css/example.css">
21+
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
22+
23+
</head>
24+
<body>
25+
<div id="viewerDiv"></div>
26+
27+
28+
<script type="module">
29+
import * as THREE from 'three';
30+
import dat from 'dat';
31+
import setupLoadingScreen from 'LoadingScreen';
32+
import * as itowns from 'itowns';
33+
import * as debug from 'debug';
34+
35+
import { zoomToLayer } from './jsm/OGC3DTilesHelper.js';
36+
37+
const {
38+
WMTSSource, OGC3DTilesSource,
39+
ColorLayer, ElevationLayer, OGC3DTilesLayer,
40+
GlobeView, Coordinates, Fetcher,
41+
} = itowns;
42+
43+
window.gui = new dat.GUI();
44+
45+
46+
// ---- Create a GlobeView ----
47+
48+
// Define camera initial position
49+
const placement = {
50+
coord: new Coordinates('EPSG:4326', 2.351323, 48.856712),
51+
range: 12500000,
52+
};
53+
54+
// `viewerDiv` will contain iTowns' rendering area (`<canvas>`)
55+
const viewerDiv = document.getElementById('viewerDiv');
56+
57+
// Create a GlobeView
58+
const view = new GlobeView(viewerDiv, placement, {
59+
shadows: true,
60+
controls: {
61+
minDistance: 100,
62+
},
63+
realisticLighting: true,
64+
});
65+
66+
// Setup loading screen
67+
setupLoadingScreen(viewerDiv, view);
68+
69+
// ---- Add a basemap ----
70+
71+
Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
72+
config.source = new WMTSSource(config.source);
73+
view.addLayer(new ColorLayer('Ortho', config));
74+
});
75+
76+
// ---- Add 3D terrain ----
77+
78+
// Add two elevation layers: world terrain and a more precise terrain for france
79+
// These will deform iTowns globe geometry to represent terrain elevation.
80+
function addElevationLayerFromConfig(config) {
81+
config.source = new WMTSSource(config.source);
82+
const elevationLayer = new ElevationLayer(config.id, config);
83+
view.addLayer(elevationLayer);
84+
}
85+
itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
86+
itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
87+
88+
// ---------- 3D Tiles loading
89+
90+
function load(url) {
91+
const source = new OGC3DTilesSource({ url });
92+
93+
window.layer = new OGC3DTilesLayer('3DTiles', {
94+
source,
95+
sseThreshold: 2,
96+
});
97+
98+
// Add the layer to our view
99+
view.addLayer(window.layer).then((layer) => {
100+
zoomToLayer(view, layer);
101+
});
102+
103+
window.layer.whenReady
104+
.then(() => debug.createOGC3DTilesDebugUI(gui, view, window.layer));
105+
}
106+
107+
// ---------- Realistic lighting & DATE/TIME CONTROLS ----------
108+
debug.createRealisticLightingDebugUI(gui, view);
109+
110+
window.layer = null; // 3D Tiles layer
111+
112+
// ---------- Load Lille dataset ----------
113+
load("https://webimaging.lillemetropole.fr/externe/maillage/2020_mel_5cm/tileset.json");
114+
115+
window.view = view;
116+
window.itowns = itowns;
117+
window.THREE = THREE;
118+
119+
</script>
120+
</body>
121+
</html>

0 commit comments

Comments
 (0)