@@ -267,9 +267,48 @@ uint64_t getMappedObjectId(uint64_t value) {
267
267
float alpha = uSelectedAlpha;
268
268
float saturation = uSaturation;
269
269
` ;
270
+
271
+ let getMappedIdColor = `vec4 getMappedIdColor(uint64_t value) {
272
+ ` ;
273
+ // If the value has a mapped color, use it; otherwise, compute the color.
274
+
275
+ // specific color, highlight ok
276
+ if ( parameters . hasSegmentStatedColors ) {
277
+ this . segmentStatedColorShaderManager . defineShader ( builder ) ;
278
+ getMappedIdColor += `
279
+ vec4 rgba;
280
+ if (${ this . segmentStatedColorShaderManager . getFunctionName } (value, rgba)) {
281
+ return rgba;
282
+ }
283
+ ` ;
284
+ }
285
+ if ( parameters . hasSegmentDefaultColor ) {
286
+ builder . addUniform ( "highp vec4" , "uSegmentDefaultColor" ) ;
287
+ getMappedIdColor += ` return uSegmentDefaultColor;
288
+ ` ;
289
+ } else {
290
+ this . segmentColorShaderManager . defineShader ( builder ) ;
291
+ getMappedIdColor += ` return vec4(segmentColorHash(value), 0.0);
292
+ ` ;
293
+ }
294
+ getMappedIdColor += `
295
+ }
296
+ ` ;
297
+ builder . addFragmentCode ( getMappedIdColor ) ;
298
+
270
299
if ( parameters . hideSegmentZero ) {
271
300
fragmentMain += `
272
- if (value.value[0] == 0u && value.value[1] == 0u) {
301
+ if (value.value[0] == 0u && value.value[1] == 0u) {` ;
302
+ if ( parameters . hasSegmentStatedColors ) {
303
+ fragmentMain += `
304
+ vec4 rgba;
305
+ if (${ this . segmentStatedColorShaderManager . getFunctionName } (valueForColor, rgba)) {
306
+ emit(vec4(mix(vec3(1.0,1.0,1.0), vec3(rgba), saturation), alpha));
307
+ return;
308
+ }
309
+ ` ;
310
+ }
311
+ fragmentMain += `
273
312
emit(vec4(vec4(0, 0, 0, 0)));
274
313
return;
275
314
}
@@ -297,32 +336,6 @@ uint64_t getMappedObjectId(uint64_t value) {
297
336
alpha = uNotSelectedAlpha;
298
337
}
299
338
` ;
300
- let getMappedIdColor = `vec4 getMappedIdColor(uint64_t value) {
301
- ` ;
302
- // If the value has a mapped color, use it; otherwise, compute the color.
303
- if ( parameters . hasSegmentStatedColors ) {
304
- this . segmentStatedColorShaderManager . defineShader ( builder ) ;
305
- getMappedIdColor += `
306
- vec4 rgba;
307
- if (${ this . segmentStatedColorShaderManager . getFunctionName } (value, rgba)) {
308
- return rgba;
309
- }
310
- ` ;
311
- }
312
- if ( parameters . hasSegmentDefaultColor ) {
313
- builder . addUniform ( "highp vec4" , "uSegmentDefaultColor" ) ;
314
- getMappedIdColor += ` return uSegmentDefaultColor;
315
- ` ;
316
- } else {
317
- this . segmentColorShaderManager . defineShader ( builder ) ;
318
- getMappedIdColor += ` return vec4(segmentColorHash(value), 0.0);
319
- ` ;
320
- }
321
- getMappedIdColor += `
322
- }
323
- ` ;
324
- builder . addFragmentCode ( getMappedIdColor ) ;
325
-
326
339
fragmentMain += `
327
340
vec4 rgba = getMappedIdColor(valueForColor);
328
341
if (rgba.a > 0.0) {
0 commit comments