Skip to content

Commit 32a216d

Browse files
authored
Feat/geojson draping (#169)
* GeoJSON Draping: experimental feature. Also fixes #162 * Shader options optinal * added attribution * Remove a comment * Update examples and README * Changelog for new version * 1.2.4
1 parent dcb51cb commit 32a216d

34 files changed

+702
-115
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## v1.2
22

3+
## v1.2.4
4+
- Experimental feature: real time draping of GeoJSON overlays (see example).
5+
- Add a `Viewport` structure required on initial load and updated via the `setViewport()` function. Contains `width`, `height`, and `devicePixelRatio`.
6+
37
## v1.2.3
48
- runtime.update() now takes `viewportSize:Vector2` rather than `viewportHeight:number` (for future features that will require viewport width).
59
- Preliminary support and example for loading GeoJSON and overlaying on Google 3D Tiles.

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Development of this library started at The New York Times R&D as an effort to cr
2525
* [LiDAR Point Cloud hosted as 3D Tiles in Cesium ION](https://nytimes.github.io/three-loader-3dtiles/dist/web/examples/demos/cesium)
2626
* [Map overlay with OpenStreetMap](https://nytimes.github.io/three-loader-3dtiles/dist/web/examples/demos/map-overlay)
2727
* [Google Maps Photorealistic 3D Tiles (requires API key)](https://nytimes.github.io/three-loader-3dtiles/dist/web/examples/demos/google-3dtiles)
28+
* [Google 3D Tiles with GeoJSON Draping (experimental, requires API key)](https://nytimes.github.io/three-loader-3dtiles/dist/web/examples/demos/google-3dtiles)
2829

2930
---
3031

@@ -53,7 +54,11 @@ let tilesRuntime = null;
5354
async function loadTileset() {
5455
const result = await Loader3DTiles.load(
5556
url: 'https://<TILESET URL>/tileset.json',
56-
renderer: renderer,
57+
viewport: {
58+
width: window.innerWidth,
59+
height: window.innerHeight,
60+
devicePixelRatio: window.devicePixelRatio
61+
}
5762
options: {
5863
dracoDecoderPath: 'https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/libs/draco',
5964
basisTranscoderPath: 'https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/libs/basis',
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [three-loader-3dtiles](./three-loader-3dtiles.md) &gt; [DrapingShaderOptions](./three-loader-3dtiles.drapingshaderoptions.md) &gt; [blendingType](./three-loader-3dtiles.drapingshaderoptions.blendingtype.md)
4+
5+
## DrapingShaderOptions.blendingType property
6+
7+
Blending algoritum of the draped colors. Default: `THREE.NormalBlending`
8+
9+
**Signature:**
10+
11+
```typescript
12+
blendingType: Blending;
13+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [three-loader-3dtiles](./three-loader-3dtiles.md) &gt; [DrapingShaderOptions](./three-loader-3dtiles.drapingshaderoptions.md) &gt; [maxHeight](./three-loader-3dtiles.drapingshaderoptions.maxheight.md)
4+
5+
## DrapingShaderOptions.maxHeight property
6+
7+
Maximum terrain height when searching for a matching vertex to the GEOJson overlay. Default: `300`
8+
9+
**Signature:**
10+
11+
```typescript
12+
maxHeight: number;
13+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [three-loader-3dtiles](./three-loader-3dtiles.md) &gt; [DrapingShaderOptions](./three-loader-3dtiles.drapingshaderoptions.md)
4+
5+
## DrapingShaderOptions interface
6+
7+
**Signature:**
8+
9+
```typescript
10+
interface DrapingShaderOptions
11+
```
12+
13+
## Properties
14+
15+
| Property | Modifiers | Type | Description |
16+
| --- | --- | --- | --- |
17+
| [blendingType](./three-loader-3dtiles.drapingshaderoptions.blendingtype.md) | | Blending | Blending algoritum of the draped colors. Default: <code>THREE.NormalBlending</code> |
18+
| [maxHeight](./three-loader-3dtiles.drapingshaderoptions.maxheight.md) | | number | Maximum terrain height when searching for a matching vertex to the GEOJson overlay. Default: <code>300</code> |
19+
| [minHeight](./three-loader-3dtiles.drapingshaderoptions.minheight.md) | | number | Minimum terrain height when searching for a matching vertex to the GEOJson overlay. Default: <code>0</code> |
20+
| [opacity](./three-loader-3dtiles.drapingshaderoptions.opacity.md) | | number | Opacity of the draped colors. Default: <code>0.5</code> |
21+
| [samples](./three-loader-3dtiles.drapingshaderoptions.samples.md) | | number | Number of samples to average around the render target cordinate when draping the GEOJson overlay. Default: <code>4</code> |
22+
| [sampleStep](./three-loader-3dtiles.drapingshaderoptions.samplestep.md) | | number | Number of pixels to step toward each sample when averaging the samples. Default: 4.0 |
23+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [three-loader-3dtiles](./three-loader-3dtiles.md) &gt; [DrapingShaderOptions](./three-loader-3dtiles.drapingshaderoptions.md) &gt; [minHeight](./three-loader-3dtiles.drapingshaderoptions.minheight.md)
4+
5+
## DrapingShaderOptions.minHeight property
6+
7+
Minimum terrain height when searching for a matching vertex to the GEOJson overlay. Default: `0`
8+
9+
**Signature:**
10+
11+
```typescript
12+
minHeight: number;
13+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [three-loader-3dtiles](./three-loader-3dtiles.md) &gt; [DrapingShaderOptions](./three-loader-3dtiles.drapingshaderoptions.md) &gt; [opacity](./three-loader-3dtiles.drapingshaderoptions.opacity.md)
4+
5+
## DrapingShaderOptions.opacity property
6+
7+
Opacity of the draped colors. Default: `0.5`
8+
9+
**Signature:**
10+
11+
```typescript
12+
opacity: number;
13+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [three-loader-3dtiles](./three-loader-3dtiles.md) &gt; [DrapingShaderOptions](./three-loader-3dtiles.drapingshaderoptions.md) &gt; [samples](./three-loader-3dtiles.drapingshaderoptions.samples.md)
4+
5+
## DrapingShaderOptions.samples property
6+
7+
Number of samples to average around the render target cordinate when draping the GEOJson overlay. Default: `4`
8+
9+
**Signature:**
10+
11+
```typescript
12+
samples: number;
13+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [three-loader-3dtiles](./three-loader-3dtiles.md) &gt; [DrapingShaderOptions](./three-loader-3dtiles.drapingshaderoptions.md) &gt; [sampleStep](./three-loader-3dtiles.drapingshaderoptions.samplestep.md)
4+
5+
## DrapingShaderOptions.sampleStep property
6+
7+
Number of pixels to step toward each sample when averaging the samples. Default: 4.0
8+
9+
**Signature:**
10+
11+
```typescript
12+
sampleStep: number;
13+
```

docs/three-loader-3dtiles.loaderprops.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ interface LoaderProps
1818
| --- | --- | --- | --- |
1919
| [loadingManager?](./three-loader-3dtiles.loaderprops.loadingmanager.md) | | LoadingManager | _(Optional)_ Use a Three JS loading manager |
2020
| [options?](./three-loader-3dtiles.loaderprops.options.md) | | [LoaderOptions](./three-loader-3dtiles.loaderoptions.md) | _(Optional)_ Advanced options for loading the tileset ([LoaderOptions](./three-loader-3dtiles.loaderoptions.md)<!-- -->) |
21-
| [renderer?](./three-loader-3dtiles.loaderprops.renderer.md) | | WebGLRenderer | _(Optional)_ Required when using compressed textures (basis universal) for GPU feature detection. |
21+
| [renderer?](./three-loader-3dtiles.loaderprops.renderer.md) | | WebGLRenderer | _(Optional)_ An existing renderer reference. Required for shader processing. |
2222
| [url](./three-loader-3dtiles.loaderprops.url.md) | | string | The URL of the tileset. For example if using Cesium ION, it would have the form: <code>https://assets.cesium.com/[ASSET_ID]/tileset.json</code>. |
23+
| [viewport](./three-loader-3dtiles.loaderprops.viewport.md) | | Viewport | Viewport properties. Use <code>setViewport()</code> to update |
2324

2425
## Methods
2526

0 commit comments

Comments
 (0)