Skip to content

Commit

Permalink
address final review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Molly Lloyd committed Dec 2, 2017
1 parent b922b7d commit 33aa66b
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 70 deletions.
9 changes: 1 addition & 8 deletions bench/benchmarks/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,7 @@ class LayerBenchmark extends Benchmark {
width: 1024,
height: 768,
center: [-77.032194, 38.912753],
style: this.layerStyle,
transformRequest: (url, resourceType) =>{
if (resourceType === 'Tile' && url.search('terrain')) {
return {
url: url.replace('@2x', '').replace(/(\.webp)|(\.png)/, '.pngraw')
};
}
}
style: this.layerStyle
}).then(map => {
this.map = map;
});
Expand Down
31 changes: 4 additions & 27 deletions debug/terrain-rendering.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,19 @@
<script src='/dist/mapbox-gl-dev.js'></script>
<script src='/debug/access_token_generated.js'></script>
<script>
var raster = {
var hillshadeStyle = {
"version": 8,
"light": {
"position": [1.15, 335, 60]
},
"sources": {
"streets": {
"url": 'mapbox://mapbox.mapbox-streets-v7',
type: 'vector'
"type": 'vector'
},
"rasterTerrain": {
"type": "raster-dem",
"url": "mapbox://mapbox.terrain-rgb"
// "tiles": [ `https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token=${mapboxgl.accessToken}`]
}
},
"layers": [
Expand Down Expand Up @@ -70,30 +69,8 @@
container: 'map',
zoom: 12,
center: [-112.9487, 36.2628],
style: raster, //'mapbox://styles/mollymerp/cj3e8wxmj00042so5xtkxx66y',
hash: true,
transformRequest: (url, resourceType) =>{
if (resourceType === 'Tile' && url.search('terrain')) {
return {
url: url.replace('@2x', '').replace(/(\.webp)|(\.png)/, '.pngraw')
};
}
}
});
map.on('load', ()=> {
// map.addSource('rasterTerrain',
// {
// "type": "raster-terrain",
// "tiles": [ `https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token=${mapboxgl.accessToken}`]
// }).addLayer({
// "id": "terrain",
// "source": "rasterTerrain",
// "type": "terrain",
// "paint":{
// // "terrain-shadow-color": "#c2c29d",
// // "terrain-highlight-color": "#EAE9D3"
// }
// })
style: hillshadeStyle,
hash: true
});
</script>
</body>
Expand Down
3 changes: 3 additions & 0 deletions flow-typed/style-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ declare type HillshadeLayerSpecification = {|
"visibility"?: "visible" | "none"
|},
"paint"?: {|
"hillshade-illumination-direction"?: PropertyValueSpecification<number>,
"hillshade-illumination-anchor"?: PropertyValueSpecification<"map" | "viewport">,
"hillshade-exaggeration"?: PropertyValueSpecification<number>,
"hillshade-shadow-color"?: PropertyValueSpecification<ColorSpecification>,
"hillshade-highlight-color"?: PropertyValueSpecification<ColorSpecification>,
"hillshade-accent-color"?: PropertyValueSpecification<ColorSpecification>
Expand Down
9 changes: 0 additions & 9 deletions src/shaders/hillshade.fragment.glsl
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@

#ifdef GL_ES
precision highp float;
#else
#define lowp
#define mediump
#define highp
#endif

uniform sampler2D u_image;
varying vec2 v_pos;
uniform vec2 u_latrange;
Expand Down
8 changes: 0 additions & 8 deletions src/shaders/hillshade.vertex.glsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
#ifdef GL_ES
precision highp float;
#else
#define lowp
#define mediump
#define highp
#endif

uniform mat4 u_matrix;

attribute vec2 a_pos;
Expand Down
4 changes: 0 additions & 4 deletions src/shaders/hillshade_prepare.fragment.glsl
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#ifdef GL_ES
precision highp float;
#else
#define lowp
#define mediump
#define highp
#endif

uniform sampler2D u_image;
Expand Down
8 changes: 0 additions & 8 deletions src/shaders/hillshade_prepare.vertex.glsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
#ifdef GL_ES
precision highp float;
#else
#define lowp
#define mediump
#define highp
#endif

uniform mat4 u_matrix;

attribute vec2 a_pos;
Expand Down
2 changes: 1 addition & 1 deletion src/source/raster_dem_tile_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RasterDEMTileSource extends RasterTileSource implements Source {
constructor(id: string, options: RasterSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {
super(id, options, dispatcher, eventedParent);
this.type = 'raster-dem';
this.maxzoom = 15;
this.maxzoom = 22;
this._options = util.extend({}, options);
}

Expand Down
7 changes: 2 additions & 5 deletions src/style-spec/reference/v8.json
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@
"doc": "Client-side hillshading visualization based on DEM data. Currently, the implementation only supports Mapbox Terrain RGB tiles",
"sdk-support": {
"basic functionality": {
"js": "next"
"js": "0.43.0"
}
}
},
Expand Down Expand Up @@ -1812,10 +1812,7 @@
"doc": "Whether this layer is displayed.",
"sdk-support": {
"basic functionality": {
"js": "0.10.0",
"android": "2.0.1",
"ios": "2.0.0",
"macos": "0.1.0"
"js": "0.43.0"
},
"data-driven styling": {}
}
Expand Down

0 comments on commit 33aa66b

Please sign in to comment.