@@ -267,9 +267,48 @@ uint64_t getMappedObjectId(uint64_t value) {
267267 float alpha = uSelectedAlpha;
268268 float saturation = uSaturation;
269269` ;
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+
270299 if ( parameters . hideSegmentZero ) {
271300 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 += `
273312 emit(vec4(vec4(0, 0, 0, 0)));
274313 return;
275314 }
@@ -297,32 +336,6 @@ uint64_t getMappedObjectId(uint64_t value) {
297336 alpha = uNotSelectedAlpha;
298337 }
299338` ;
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-
326339 fragmentMain += `
327340 vec4 rgba = getMappedIdColor(valueForColor);
328341 if (rgba.a > 0.0) {
0 commit comments