@mapcatch/util 2.0.3-b → 2.0.4
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/CHANGELOG.md +5 -1
- package/dist/catchUtil.min.esm.js +4080 -3875
- package/dist/catchUtil.min.js +42 -36
- package/package.json +1 -1
- package/src/constants/default_layers.js +153 -10
- package/src/constants/index.js +1 -0
- package/src/constants/layer_groups_multispectral.js +34 -0
- package/src/constants/layer_icons.js +1 -0
- package/src/gl-operations/index.js +14 -2
- package/src/gl-operations/reglCommands/default.js +2 -0
- package/src/gl-operations/reglCommands/hillshading.js +10 -2
- package/src/gl-operations/reglCommands/multiLayers.js +3 -1
- package/src/gl-operations/reglCommands/transitions.js +2 -0
- package/src/gl-operations/renderer.js +21 -4
- package/src/gl-operations/shaders/fragment/drawResult.js +6 -1
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvDirect.js +6 -1
- package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalColorscale.js +6 -1
- package/src/gl-operations/shaders/fragment/hillshading/hsPregen.js +6 -1
- package/src/gl-operations/shaders/fragment/interpolateColor.js +7 -4
- package/src/gl-operations/shaders/fragment/interpolateColorOnly.js +7 -4
- package/src/gl-operations/shaders/fragment/interpolateValue.js +18 -5
- package/src/gl-operations/shaders/fragment/single.js +6 -1
- package/src/gl-operations/shaders/util/computeColor.glsl +5 -4
package/package.json
CHANGED
|
@@ -5,7 +5,10 @@ export default [
|
|
|
5
5
|
group: 'output',
|
|
6
6
|
visible: true,
|
|
7
7
|
opacity: 1,
|
|
8
|
-
class: 'image2d'
|
|
8
|
+
class: 'image2d',
|
|
9
|
+
metadata: {
|
|
10
|
+
folder: 'dom_tiles'
|
|
11
|
+
}
|
|
9
12
|
},
|
|
10
13
|
{
|
|
11
14
|
type: 'tmp',
|
|
@@ -13,7 +16,10 @@ export default [
|
|
|
13
16
|
group: 'output',
|
|
14
17
|
visible: true,
|
|
15
18
|
opacity: 1,
|
|
16
|
-
class: 'tmp'
|
|
19
|
+
class: 'tmp',
|
|
20
|
+
metadata: {
|
|
21
|
+
folder: 'tem_tiles'
|
|
22
|
+
}
|
|
17
23
|
},
|
|
18
24
|
{
|
|
19
25
|
type: 'dsm',
|
|
@@ -21,7 +27,12 @@ export default [
|
|
|
21
27
|
group: 'output',
|
|
22
28
|
visible: false,
|
|
23
29
|
opacity: 0.5,
|
|
24
|
-
class: 'image2d'
|
|
30
|
+
class: 'image2d',
|
|
31
|
+
metadata: {
|
|
32
|
+
folder: 'dsm_tiles',
|
|
33
|
+
borderStyle: 'transparent',
|
|
34
|
+
colorType: 'turbo'
|
|
35
|
+
}
|
|
25
36
|
},
|
|
26
37
|
{
|
|
27
38
|
type: 'mesh3d',
|
|
@@ -39,20 +50,152 @@ export default [
|
|
|
39
50
|
opacity: 1,
|
|
40
51
|
class: 'pnts'
|
|
41
52
|
},
|
|
53
|
+
{
|
|
54
|
+
type: 'photos',
|
|
55
|
+
name: '照片',
|
|
56
|
+
group: 'dataset',
|
|
57
|
+
visible: false,
|
|
58
|
+
opacity: 1,
|
|
59
|
+
class: 'photos'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'bndvi',
|
|
63
|
+
name: '植被指数(BNDVI)',
|
|
64
|
+
group: 'index',
|
|
65
|
+
visible: true,
|
|
66
|
+
opacity: 1,
|
|
67
|
+
class: 'bndvi',
|
|
68
|
+
metadata: {
|
|
69
|
+
folder: 'bndvi_tiles',
|
|
70
|
+
borderStyle: 'transparent',
|
|
71
|
+
colorType: 'red-green',
|
|
72
|
+
bands: ['NIR', 'Blue']
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: 'gndvi',
|
|
77
|
+
name: '植被指数(GNDVI)',
|
|
78
|
+
group: 'index',
|
|
79
|
+
visible: true,
|
|
80
|
+
opacity: 1,
|
|
81
|
+
class: 'gndvi',
|
|
82
|
+
metadata: {
|
|
83
|
+
folder: 'gndvi_tiles',
|
|
84
|
+
borderStyle: 'transparent',
|
|
85
|
+
colorType: 'red-green',
|
|
86
|
+
bands: ['NIR', 'Green']
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
type: 'lci',
|
|
91
|
+
name: '植被指数(LCI)',
|
|
92
|
+
group: 'index',
|
|
93
|
+
visible: true,
|
|
94
|
+
opacity: 1,
|
|
95
|
+
class: 'lci',
|
|
96
|
+
metadata: {
|
|
97
|
+
folder: 'lci_tiles',
|
|
98
|
+
borderStyle: 'transparent',
|
|
99
|
+
colorType: 'glow',
|
|
100
|
+
bands: ['NIR', 'RedEdge', 'Red']
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: 'mcari',
|
|
105
|
+
name: '植被指数(MCARI)',
|
|
106
|
+
group: 'index',
|
|
107
|
+
visible: true,
|
|
108
|
+
opacity: 1,
|
|
109
|
+
class: 'mcari',
|
|
110
|
+
metadata: {
|
|
111
|
+
folder: 'mcari_tiles',
|
|
112
|
+
borderStyle: 'transparent',
|
|
113
|
+
colorType: 'turbo',
|
|
114
|
+
bands: ['NIR', 'Red', 'Green']
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: 'ndre',
|
|
119
|
+
name: '植被指数(NDRE)',
|
|
120
|
+
group: 'index',
|
|
121
|
+
visible: true,
|
|
122
|
+
opacity: 1,
|
|
123
|
+
class: 'ndre',
|
|
124
|
+
metadata: {
|
|
125
|
+
folder: 'ndre_tiles',
|
|
126
|
+
borderStyle: 'transparent',
|
|
127
|
+
colorType: 'red-green',
|
|
128
|
+
bands: ['NIR', 'RedEdge']
|
|
129
|
+
}
|
|
130
|
+
},
|
|
42
131
|
{
|
|
43
132
|
type: 'ndvi',
|
|
44
133
|
name: '植被指数(NDVI)',
|
|
45
|
-
group: '
|
|
134
|
+
group: 'index',
|
|
46
135
|
visible: true,
|
|
47
136
|
opacity: 1,
|
|
48
|
-
class: 'ndvi'
|
|
137
|
+
class: 'ndvi',
|
|
138
|
+
metadata: {
|
|
139
|
+
folder: 'ndvi_tiles',
|
|
140
|
+
borderStyle: 'transparent',
|
|
141
|
+
colorType: 'red-green',
|
|
142
|
+
bands: ['NIR', 'Red']
|
|
143
|
+
}
|
|
49
144
|
},
|
|
50
145
|
{
|
|
51
|
-
type: '
|
|
52
|
-
name: '
|
|
53
|
-
group: '
|
|
54
|
-
visible:
|
|
146
|
+
type: 'sipi2',
|
|
147
|
+
name: '植被指数(SIPI2)',
|
|
148
|
+
group: 'index',
|
|
149
|
+
visible: true,
|
|
55
150
|
opacity: 1,
|
|
56
|
-
class: '
|
|
151
|
+
class: 'sipi2',
|
|
152
|
+
metadata: {
|
|
153
|
+
folder: 'sipi2_tiles',
|
|
154
|
+
borderStyle: 'transparent',
|
|
155
|
+
colorType: 'glow',
|
|
156
|
+
bands: ['NIR', 'Green']
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
type: 'tgi',
|
|
161
|
+
name: '植被指数(TGI)',
|
|
162
|
+
group: 'index',
|
|
163
|
+
visible: true,
|
|
164
|
+
opacity: 1,
|
|
165
|
+
class: 'tgi',
|
|
166
|
+
metadata: {
|
|
167
|
+
folder: 'tgi_tiles',
|
|
168
|
+
borderStyle: 'transparent',
|
|
169
|
+
colorType: 'turbo',
|
|
170
|
+
bands: ['Red', 'Green', 'Blue']
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
type: 'vari',
|
|
175
|
+
name: '植被指数(VARI)',
|
|
176
|
+
group: 'index',
|
|
177
|
+
visible: true,
|
|
178
|
+
opacity: 1,
|
|
179
|
+
class: 'vari',
|
|
180
|
+
metadata: {
|
|
181
|
+
folder: 'vari_tiles',
|
|
182
|
+
borderStyle: 'transparent',
|
|
183
|
+
colorType: 'red-green',
|
|
184
|
+
bands: ['Red', 'Green', 'Blue']
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
type: 'ndmi',
|
|
189
|
+
name: '植被指数(NDMI)',
|
|
190
|
+
group: 'index',
|
|
191
|
+
visible: true,
|
|
192
|
+
opacity: 1,
|
|
193
|
+
class: 'ndmi',
|
|
194
|
+
metadata: {
|
|
195
|
+
folder: 'ndmi_tiles',
|
|
196
|
+
borderStyle: 'transparent',
|
|
197
|
+
colorType: 'glow',
|
|
198
|
+
bands: ['NIR', 'SWIR_1613', 'Blue']
|
|
199
|
+
}
|
|
57
200
|
}
|
|
58
201
|
]
|
package/src/constants/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export {default as cameras} from './cameras'
|
|
2
2
|
export {default as layerGroups} from './layer_groups'
|
|
3
|
+
export {default as layerGroupsMultispectral} from './layer_groups_multispectral'
|
|
3
4
|
export {default as bmapTypes} from './bmap_types'
|
|
4
5
|
export {default as dsmColors} from './dsm_colors'
|
|
5
6
|
export {default as defaultLayers} from './default_layers'
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
id: 'output',
|
|
4
|
+
type: 'output',
|
|
5
|
+
name: '基础成果',
|
|
6
|
+
collapsed: false,
|
|
7
|
+
visible: true,
|
|
8
|
+
opacity: 1
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: 'index',
|
|
12
|
+
type: 'index',
|
|
13
|
+
name: '植被指数',
|
|
14
|
+
collapsed: false,
|
|
15
|
+
visible: true,
|
|
16
|
+
opacity: 1
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: 'dataset',
|
|
20
|
+
type: 'dataset',
|
|
21
|
+
name: '数据集',
|
|
22
|
+
collapsed: false,
|
|
23
|
+
visible: true,
|
|
24
|
+
opacity: 1
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'overlay',
|
|
28
|
+
type: 'overlay',
|
|
29
|
+
name: '覆盖物',
|
|
30
|
+
collapsed: false,
|
|
31
|
+
visible: true,
|
|
32
|
+
opacity: 1
|
|
33
|
+
}
|
|
34
|
+
]
|
|
@@ -20,7 +20,9 @@ export default class GLOperations {
|
|
|
20
20
|
this.options.colorScale,
|
|
21
21
|
this.options.sentinelValues,
|
|
22
22
|
this.options.colorscaleMaxLength,
|
|
23
|
-
this.options.sentinelMaxLength
|
|
23
|
+
this.options.sentinelMaxLength,
|
|
24
|
+
this.options.aboveColor,
|
|
25
|
+
this.options.belowColor
|
|
24
26
|
)
|
|
25
27
|
|
|
26
28
|
this._renderer.generateAmbientDirections(this.options.hsAdvAmbientIterations)
|
|
@@ -30,6 +32,11 @@ export default class GLOperations {
|
|
|
30
32
|
)
|
|
31
33
|
}
|
|
32
34
|
|
|
35
|
+
destroy () {
|
|
36
|
+
if (this._renderer) this._renderer.destroy()
|
|
37
|
+
this._renderer = null
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
updateOptions (options) {
|
|
34
41
|
const {
|
|
35
42
|
url: prevUrl,
|
|
@@ -45,7 +52,9 @@ export default class GLOperations {
|
|
|
45
52
|
hsAdvSunRadiusMultiplier: prevHsAdvSunRadiusMultiplier,
|
|
46
53
|
hsAdvBaselayerUrl: prevHsAdvBaselayerUrl,
|
|
47
54
|
colorscaleMaxLength: prevScaleMaxLength,
|
|
48
|
-
sentinelMaxLength: prevSentinelMaxLength
|
|
55
|
+
sentinelMaxLength: prevSentinelMaxLength,
|
|
56
|
+
aboveColor: prevAboveColor,
|
|
57
|
+
belowColor: prevBelowColor
|
|
49
58
|
} = this.options
|
|
50
59
|
Object.assign(this.options, options)
|
|
51
60
|
// create new renderer if max length of sentinels or colorscale changes
|
|
@@ -73,6 +82,9 @@ export default class GLOperations {
|
|
|
73
82
|
if (this.options.colorScale !== prevColorScale) {
|
|
74
83
|
this._renderer.updateColorscale(this.options.colorScale)
|
|
75
84
|
}
|
|
85
|
+
if (this.options.aboveColor !== prevAboveColor || this.options.belowColor !== prevBelowColor) {
|
|
86
|
+
this._renderer.updateOuteRangeColor(this.options.aboveColor, this.options.belowColor)
|
|
87
|
+
}
|
|
76
88
|
if (this.options.sentinelValues !== prevSentinelValues) {
|
|
77
89
|
this._renderer.updateSentinels(this.options.sentinelValues)
|
|
78
90
|
}
|
|
@@ -24,6 +24,8 @@ export function createDrawTileCommand (regl, commonConfig, fragMacros) {
|
|
|
24
24
|
sentinelLength: regl.prop('sentinelLength'),
|
|
25
25
|
scaleColormap: regl.prop('scaleColormap'),
|
|
26
26
|
sentinelColormap: regl.prop('sentinelColormap'),
|
|
27
|
+
aboveColor: regl.prop('aboveColor'),
|
|
28
|
+
belowColor: regl.prop('belowColor'),
|
|
27
29
|
texture: (_, { texture }) => texture,
|
|
28
30
|
enableSimpleHillshade: (_, { enableSimpleHillshade }) => enableSimpleHillshade,
|
|
29
31
|
offset: 0,
|
|
@@ -38,6 +38,8 @@ export function createDrawTileHsSimpleCommand (regl, commonConfig, fragMacros) {
|
|
|
38
38
|
sentinelLength: regl.prop('sentinelLength'),
|
|
39
39
|
scaleColormap: regl.prop('scaleColormap'),
|
|
40
40
|
sentinelColormap: regl.prop('sentinelColormap'),
|
|
41
|
+
aboveColor: regl.prop('aboveColor'),
|
|
42
|
+
belowColor: regl.prop('belowColor'),
|
|
41
43
|
texture: (_, { texture }) => texture,
|
|
42
44
|
enableSimpleHillshade: (_, { enableSimpleHillshade }) => enableSimpleHillshade,
|
|
43
45
|
azimuth: (_, { azimuth }) => azimuth,
|
|
@@ -80,6 +82,8 @@ export function createDrawTileHsPregenCommand (regl, commonConfig, fragMacros) {
|
|
|
80
82
|
sentinelLength: regl.prop('sentinelLength'),
|
|
81
83
|
scaleColormap: regl.prop('scaleColormap'),
|
|
82
84
|
sentinelColormap: regl.prop('sentinelColormap'),
|
|
85
|
+
aboveColor: regl.prop('aboveColor'),
|
|
86
|
+
belowColor: regl.prop('belowColor'),
|
|
83
87
|
texture: (_, { texture }) => texture,
|
|
84
88
|
hillshadePregenTexture: (_, { hillshadePregenTexture }) => hillshadePregenTexture
|
|
85
89
|
},
|
|
@@ -203,7 +207,9 @@ export function createHsAdvDirectLightning (
|
|
|
203
207
|
tInput: regl.prop('tInput'),
|
|
204
208
|
tNormal: regl.prop('tNormal'),
|
|
205
209
|
floatScale: regl.prop('floatScale'),
|
|
206
|
-
sunDirection: regl.prop('sunDirection')
|
|
210
|
+
sunDirection: regl.prop('sunDirection'),
|
|
211
|
+
aboveColor: regl.prop('aboveColor'),
|
|
212
|
+
belowColor: regl.prop('belowColor')
|
|
207
213
|
},
|
|
208
214
|
attributes: {
|
|
209
215
|
position: [[-1, 1], [1, 1], [-1, -1], [1, -1]],
|
|
@@ -293,7 +299,9 @@ export function createHsAdvFinalColorscale (
|
|
|
293
299
|
tAmbient: regl.prop('tAmbient'),
|
|
294
300
|
floatScale: regl.prop('floatScale'),
|
|
295
301
|
finalSoftMultiplier: regl.prop('finalSoftMultiplier'),
|
|
296
|
-
finalAmbientMultiplier: regl.prop('finalAmbientMultiplier')
|
|
302
|
+
finalAmbientMultiplier: regl.prop('finalAmbientMultiplier'),
|
|
303
|
+
aboveColor: regl.prop('aboveColor'),
|
|
304
|
+
belowColor: regl.prop('belowColor')
|
|
297
305
|
},
|
|
298
306
|
attributes: {
|
|
299
307
|
...commonConfig.attributes,
|
|
@@ -291,7 +291,9 @@ export function createDrawResultCommand (
|
|
|
291
291
|
sentinelLength: regl.prop('sentinelLength'),
|
|
292
292
|
scaleColormap: regl.prop('scaleColormap'),
|
|
293
293
|
sentinelColormap: regl.prop('sentinelColormap'),
|
|
294
|
-
texture: regl.prop('texture')
|
|
294
|
+
texture: regl.prop('texture'),
|
|
295
|
+
aboveColor: regl.prop('aboveColor'),
|
|
296
|
+
belowColor: regl.prop('belowColor')
|
|
295
297
|
},
|
|
296
298
|
attributes: {
|
|
297
299
|
...commonConfig.attributes,
|
|
@@ -27,6 +27,8 @@ export function createDrawTileInterpolateValueCommand (
|
|
|
27
27
|
sentinelLength: regl.prop('sentinelLength'),
|
|
28
28
|
scaleColormap: regl.prop('scaleColormap'),
|
|
29
29
|
sentinelColormap: regl.prop('sentinelColormap'),
|
|
30
|
+
aboveColor: regl.prop('aboveColor'),
|
|
31
|
+
belowColor: regl.prop('belowColor'),
|
|
30
32
|
textureA: (_, { textureA }) => textureA,
|
|
31
33
|
textureB: (_, { textureB }) => textureB,
|
|
32
34
|
interpolationFraction: (_, { interpolationFraction }) => interpolationFraction
|
|
@@ -13,7 +13,7 @@ import * as reglCommands from './reglCommands'
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
export default class Renderer {
|
|
16
|
-
constructor (gloperations, tileSize, nodataValue, scaleInput, sentinelInput, colorscaleMaxLength, sentinelMaxLength) {
|
|
16
|
+
constructor (gloperations, tileSize, nodataValue, scaleInput, sentinelInput, colorscaleMaxLength, sentinelMaxLength, aboveColor, belowColor) {
|
|
17
17
|
const canvas = document.createElement('canvas')
|
|
18
18
|
let maxTextureDimension = MAX_TEXTURE_DIMENSION
|
|
19
19
|
let normalTextureDimension = 1024
|
|
@@ -73,10 +73,17 @@ export default class Renderer {
|
|
|
73
73
|
scaleColormap: util.createColormapTexture(scaleInput, regl),
|
|
74
74
|
sentinelColormap: util.createColormapTexture(sentinelInput, regl),
|
|
75
75
|
textureManager: new TextureManager(regl, tileSize, normalTextureDimension, false),
|
|
76
|
-
drawTile: reglCommands.createDrawTileCommand(regl, commonDrawConfig, fragMacros)
|
|
76
|
+
drawTile: reglCommands.createDrawTileCommand(regl, commonDrawConfig, fragMacros),
|
|
77
|
+
aboveColor: util.colorStringToInts(aboveColor || '#00000000').map(i => i / 255.0),
|
|
78
|
+
belowColor: util.colorStringToInts(belowColor || '#00000000').map(i => i / 255.0)
|
|
77
79
|
})
|
|
78
80
|
}
|
|
79
81
|
|
|
82
|
+
destroy () {
|
|
83
|
+
if (this.regl) this.regl.destroy()
|
|
84
|
+
this.regl = null
|
|
85
|
+
}
|
|
86
|
+
|
|
80
87
|
renderTile ({ coords, pixelData }, _hillshadeOptions, zoom) {
|
|
81
88
|
const {
|
|
82
89
|
regl,
|
|
@@ -104,7 +111,9 @@ export default class Renderer {
|
|
|
104
111
|
sentinelLength: this.sentinelInput.length,
|
|
105
112
|
scaleColormap: this.scaleColormap,
|
|
106
113
|
sentinelColormap: this.sentinelColormap,
|
|
107
|
-
enableSimpleHillshade: false
|
|
114
|
+
enableSimpleHillshade: false,
|
|
115
|
+
aboveColor: this.aboveColor,
|
|
116
|
+
belowColor: this.belowColor
|
|
108
117
|
})
|
|
109
118
|
} else if (_hillshadeOptions.hillshadeType === 'simple') {
|
|
110
119
|
this.drawTileHsSimple({
|
|
@@ -123,7 +132,9 @@ export default class Renderer {
|
|
|
123
132
|
// elevationScale: _hillshadeOptions.hsElevationScale,
|
|
124
133
|
azimuth: _hillshadeOptions.hsSimpleAzimuth,
|
|
125
134
|
altitude: _hillshadeOptions.hsSimpleAltitude,
|
|
126
|
-
slopescale: _hillshadeOptions.hsSimpleSlopescale
|
|
135
|
+
slopescale: _hillshadeOptions.hsSimpleSlopescale,
|
|
136
|
+
aboveColor: this.aboveColor,
|
|
137
|
+
belowColor: this.belowColor
|
|
127
138
|
})
|
|
128
139
|
}
|
|
129
140
|
|
|
@@ -170,6 +181,12 @@ export default class Renderer {
|
|
|
170
181
|
this.scaleColormapPrevious = this.scaleColormap
|
|
171
182
|
this.scaleColormap = util.createColormapTexture(scaleInput, this.regl)
|
|
172
183
|
}
|
|
184
|
+
updateOuteRangeColor (aboveColor, belowColor) {
|
|
185
|
+
this.aboveColorPrevious = this.aboveColor
|
|
186
|
+
this.aboveColor = util.colorStringToInts(aboveColor || '#00000000').map(i => i / 255.0)
|
|
187
|
+
this.belowColorPrevious = this.belowColor
|
|
188
|
+
this.belowColor = util.colorStringToInts(belowColor || '#00000000').map(i => i / 255.0)
|
|
189
|
+
}
|
|
173
190
|
updateSentinels (sentinelInput) {
|
|
174
191
|
this.sentinelInputPrevious = this.sentinelInput
|
|
175
192
|
this.sentinelInput = sentinelInput
|
|
@@ -21,6 +21,9 @@ uniform float nodataValue;
|
|
|
21
21
|
uniform sampler2D texture;
|
|
22
22
|
uniform bool littleEndian;
|
|
23
23
|
|
|
24
|
+
uniform vec4 aboveColor;
|
|
25
|
+
uniform vec4 belowColor;
|
|
26
|
+
|
|
24
27
|
varying vec2 vTexCoord;
|
|
25
28
|
|
|
26
29
|
void main() {
|
|
@@ -35,7 +38,9 @@ void main() {
|
|
|
35
38
|
sentinelColormap,
|
|
36
39
|
scaleLength,
|
|
37
40
|
sentinelLength,
|
|
38
|
-
littleEndian
|
|
41
|
+
littleEndian,
|
|
42
|
+
aboveColor,
|
|
43
|
+
belowColor
|
|
39
44
|
);
|
|
40
45
|
}
|
|
41
46
|
}
|
|
@@ -17,6 +17,9 @@ uniform float nodataValue;
|
|
|
17
17
|
uniform bool littleEndian;
|
|
18
18
|
varying vec2 vTexCoord;
|
|
19
19
|
|
|
20
|
+
uniform vec4 aboveColor;
|
|
21
|
+
uniform vec4 belowColor;
|
|
22
|
+
|
|
20
23
|
uniform int scaleLength;
|
|
21
24
|
uniform int sentinelLength;
|
|
22
25
|
uniform sampler2D scaleColormap;
|
|
@@ -35,7 +38,9 @@ void main() {
|
|
|
35
38
|
sentinelColormap,
|
|
36
39
|
scaleLength,
|
|
37
40
|
sentinelLength,
|
|
38
|
-
littleEndian
|
|
41
|
+
littleEndian,
|
|
42
|
+
aboveColor,
|
|
43
|
+
belowColor
|
|
39
44
|
);
|
|
40
45
|
|
|
41
46
|
vec3 n = texture2D(tNormal, vTexCoord).rgb;
|
|
@@ -24,6 +24,9 @@ uniform sampler2D sentinelColormap;
|
|
|
24
24
|
varying vec2 vTexCoordA;
|
|
25
25
|
varying vec2 vTexCoordB;
|
|
26
26
|
|
|
27
|
+
uniform vec4 aboveColor;
|
|
28
|
+
uniform vec4 belowColor;
|
|
29
|
+
|
|
27
30
|
void main() {
|
|
28
31
|
float f = texture2D(tInput, vTexCoordA).r;
|
|
29
32
|
|
|
@@ -37,7 +40,9 @@ void main() {
|
|
|
37
40
|
sentinelColormap,
|
|
38
41
|
scaleLength,
|
|
39
42
|
sentinelLength,
|
|
40
|
-
littleEndian
|
|
43
|
+
littleEndian,
|
|
44
|
+
aboveColor,
|
|
45
|
+
belowColor
|
|
41
46
|
);
|
|
42
47
|
|
|
43
48
|
float softShadow = texture2D(tSoftShadow, vTexCoordB).r;
|
|
@@ -15,6 +15,9 @@ uniform int sentinelLength;
|
|
|
15
15
|
uniform sampler2D scaleColormap;
|
|
16
16
|
uniform sampler2D sentinelColormap;
|
|
17
17
|
|
|
18
|
+
uniform vec4 aboveColor;
|
|
19
|
+
uniform vec4 belowColor;
|
|
20
|
+
|
|
18
21
|
uniform float nodataValue;
|
|
19
22
|
uniform sampler2D texture;
|
|
20
23
|
uniform bool littleEndian;
|
|
@@ -36,7 +39,9 @@ void main() {
|
|
|
36
39
|
sentinelColormap,
|
|
37
40
|
scaleLength,
|
|
38
41
|
sentinelLength,
|
|
39
|
-
littleEndian
|
|
42
|
+
littleEndian,
|
|
43
|
+
aboveColor,
|
|
44
|
+
belowColor
|
|
40
45
|
);
|
|
41
46
|
|
|
42
47
|
// Hillshade
|
|
@@ -29,6 +29,9 @@ uniform float nodataValue;
|
|
|
29
29
|
uniform bool littleEndian;
|
|
30
30
|
uniform float interpolationFraction;
|
|
31
31
|
|
|
32
|
+
uniform vec4 aboveColor;
|
|
33
|
+
uniform vec4 belowColor;
|
|
34
|
+
|
|
32
35
|
varying vec2 vTexCoordA;
|
|
33
36
|
varying vec2 vTexCoordB;
|
|
34
37
|
|
|
@@ -38,25 +41,25 @@ void main() {
|
|
|
38
41
|
if (isCloseEnough(texelFloat, nodataValue)) {
|
|
39
42
|
discard;
|
|
40
43
|
}
|
|
41
|
-
gl_FragColor = computeColor(texelFloat, scaleColormapA, sentinelColormapA, scaleLengthA, sentinelLengthA, littleEndian);
|
|
44
|
+
gl_FragColor = computeColor(texelFloat, scaleColormapA, sentinelColormapA, scaleLengthA, sentinelLengthA, littleEndian, aboveColor, belowColor);
|
|
42
45
|
} else if (interpolationFraction >= 1.0) {
|
|
43
46
|
float texelFloat = getTexelValue(textureB, vTexCoordB, littleEndian);
|
|
44
47
|
if (isCloseEnough(texelFloat, nodataValue)) {
|
|
45
48
|
discard;
|
|
46
49
|
}
|
|
47
|
-
gl_FragColor = computeColor(texelFloat, scaleColormapB, sentinelColormapB, scaleLengthB, sentinelLengthB, littleEndian);
|
|
50
|
+
gl_FragColor = computeColor(texelFloat, scaleColormapB, sentinelColormapB, scaleLengthB, sentinelLengthB, littleEndian, aboveColor, belowColor);
|
|
48
51
|
} else {
|
|
49
52
|
float texelFloatA = getTexelValue(textureA, vTexCoordA, littleEndian);
|
|
50
53
|
float texelFloatB = getTexelValue(textureB, vTexCoordB, littleEndian);
|
|
51
54
|
vec4 colorA = (
|
|
52
55
|
isCloseEnough(texelFloatA, nodataValue)
|
|
53
56
|
? TRANSPARENT
|
|
54
|
-
: computeColor(texelFloatA, scaleColormapA, sentinelColormapA, scaleLengthA, sentinelLengthA, littleEndian)
|
|
57
|
+
: computeColor(texelFloatA, scaleColormapA, sentinelColormapA, scaleLengthA, sentinelLengthA, littleEndian, aboveColor, belowColor)
|
|
55
58
|
);
|
|
56
59
|
vec4 colorB = (
|
|
57
60
|
isCloseEnough(texelFloatB, nodataValue)
|
|
58
61
|
? TRANSPARENT
|
|
59
|
-
: computeColor(texelFloatB, scaleColormapB, sentinelColormapB, scaleLengthB, sentinelLengthB, littleEndian)
|
|
62
|
+
: computeColor(texelFloatB, scaleColormapB, sentinelColormapB, scaleLengthB, sentinelLengthB, littleEndian, aboveColor, belowColor)
|
|
60
63
|
);
|
|
61
64
|
gl_FragColor = mix(colorA, colorB, interpolationFraction);
|
|
62
65
|
}
|
|
@@ -26,6 +26,9 @@ uniform float nodataValue;
|
|
|
26
26
|
uniform bool littleEndian;
|
|
27
27
|
uniform float interpolationFraction;
|
|
28
28
|
|
|
29
|
+
uniform vec4 aboveColor;
|
|
30
|
+
uniform vec4 belowColor;
|
|
31
|
+
|
|
29
32
|
varying vec2 vTexCoord;
|
|
30
33
|
|
|
31
34
|
void main() {
|
|
@@ -36,12 +39,12 @@ void main() {
|
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
if (interpolationFraction <= 0.0) {
|
|
39
|
-
gl_FragColor = computeColor(texelFloat, scaleColormapA, sentinelColormapA, scaleLengthA, sentinelLengthA, littleEndian);
|
|
42
|
+
gl_FragColor = computeColor(texelFloat, scaleColormapA, sentinelColormapA, scaleLengthA, sentinelLengthA, littleEndian, aboveColor, belowColor);
|
|
40
43
|
} else if (interpolationFraction >= 1.0) {
|
|
41
|
-
gl_FragColor = computeColor(texelFloat, scaleColormapB, sentinelColormapB, scaleLengthB, sentinelLengthB, littleEndian);
|
|
44
|
+
gl_FragColor = computeColor(texelFloat, scaleColormapB, sentinelColormapB, scaleLengthB, sentinelLengthB, littleEndian, aboveColor, belowColor);
|
|
42
45
|
} else {
|
|
43
|
-
vec4 colorA = computeColor(texelFloat, scaleColormapA, sentinelColormapA, scaleLengthA, sentinelLengthA, littleEndian);
|
|
44
|
-
vec4 colorB = computeColor(texelFloat, scaleColormapB, sentinelColormapB, scaleLengthB, sentinelLengthB, littleEndian);
|
|
46
|
+
vec4 colorA = computeColor(texelFloat, scaleColormapA, sentinelColormapA, scaleLengthA, sentinelLengthA, littleEndian, aboveColor, belowColor);
|
|
47
|
+
vec4 colorB = computeColor(texelFloat, scaleColormapB, sentinelColormapB, scaleLengthB, sentinelLengthB, littleEndian, aboveColor, belowColor);
|
|
45
48
|
gl_FragColor = mix(colorA, colorB, interpolationFraction);
|
|
46
49
|
}
|
|
47
50
|
}`
|
|
@@ -23,6 +23,9 @@ uniform sampler2D textureB;
|
|
|
23
23
|
uniform bool littleEndian;
|
|
24
24
|
uniform float interpolationFraction;
|
|
25
25
|
|
|
26
|
+
uniform vec4 aboveColor;
|
|
27
|
+
uniform vec4 belowColor;
|
|
28
|
+
|
|
26
29
|
varying vec2 vTexCoordA;
|
|
27
30
|
varying vec2 vTexCoordB;
|
|
28
31
|
|
|
@@ -53,7 +56,9 @@ void main() {
|
|
|
53
56
|
sentinelColormap,
|
|
54
57
|
scaleLength,
|
|
55
58
|
sentinelLength,
|
|
56
|
-
littleEndian
|
|
59
|
+
littleEndian,
|
|
60
|
+
aboveColor,
|
|
61
|
+
belowColor
|
|
57
62
|
);
|
|
58
63
|
} else if (interpolationFraction >= 1.0) {
|
|
59
64
|
float texelFloat = getTexelValue(textureB, vTexCoordB, littleEndian);
|
|
@@ -66,7 +71,9 @@ void main() {
|
|
|
66
71
|
sentinelColormap,
|
|
67
72
|
scaleLength,
|
|
68
73
|
sentinelLength,
|
|
69
|
-
littleEndian
|
|
74
|
+
littleEndian,
|
|
75
|
+
aboveColor,
|
|
76
|
+
belowColor
|
|
70
77
|
);
|
|
71
78
|
} else {
|
|
72
79
|
// retrieve and decode pixel value from both tiles
|
|
@@ -92,7 +99,9 @@ void main() {
|
|
|
92
99
|
sentinelColormap,
|
|
93
100
|
scaleLength,
|
|
94
101
|
sentinelLength,
|
|
95
|
-
littleEndian
|
|
102
|
+
littleEndian,
|
|
103
|
+
aboveColor,
|
|
104
|
+
belowColor
|
|
96
105
|
)
|
|
97
106
|
);
|
|
98
107
|
vec4 colorB = (
|
|
@@ -104,7 +113,9 @@ void main() {
|
|
|
104
113
|
sentinelColormap,
|
|
105
114
|
scaleLength,
|
|
106
115
|
sentinelLength,
|
|
107
|
-
littleEndian
|
|
116
|
+
littleEndian,
|
|
117
|
+
aboveColor,
|
|
118
|
+
belowColor
|
|
108
119
|
)
|
|
109
120
|
);
|
|
110
121
|
gl_FragColor = mix(colorA, colorB, interpolationFraction);
|
|
@@ -116,7 +127,9 @@ void main() {
|
|
|
116
127
|
sentinelColormap,
|
|
117
128
|
scaleLength,
|
|
118
129
|
sentinelLength,
|
|
119
|
-
littleEndian
|
|
130
|
+
littleEndian,
|
|
131
|
+
aboveColor,
|
|
132
|
+
belowColor
|
|
120
133
|
);
|
|
121
134
|
}
|
|
122
135
|
}
|
|
@@ -32,6 +32,9 @@ uniform float deg2rad;
|
|
|
32
32
|
uniform float azimuth;
|
|
33
33
|
uniform float altitude;
|
|
34
34
|
|
|
35
|
+
uniform vec4 aboveColor;
|
|
36
|
+
uniform vec4 belowColor;
|
|
37
|
+
|
|
35
38
|
float getRelativeHeight(vec2 pos, float v, vec4 textureBounds) {
|
|
36
39
|
float pixelFloatValue = getTexelValue(texture, pos, littleEndian);
|
|
37
40
|
float test = step(0.0, pixelFloatValue);
|
|
@@ -76,7 +79,9 @@ void main() {
|
|
|
76
79
|
sentinelColormap,
|
|
77
80
|
scaleLength,
|
|
78
81
|
sentinelLength,
|
|
79
|
-
littleEndian
|
|
82
|
+
littleEndian,
|
|
83
|
+
aboveColor,
|
|
84
|
+
belowColor
|
|
80
85
|
);
|
|
81
86
|
|
|
82
87
|
if (enableSimpleHillshade) {
|