@webviz/subsurface-viewer 2.3.13 → 2.3.14
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "#version 300 es\n#define SHADER_NAME texture-fragment-shader\n\nuniform sampler2D valueTexture;\nuniform sampler2D colormap;\n\nin vec3 cameraPosition;\n\nin vec4 vPosition;\nin vec3 vNormal;\nin vec2 vTexCoords;\nin vec4 vColor;\n\nout vec4 fragColor;\n\n// Normalize the value to the range [0, 1]\nfloat normalizeValue(float value) {\n if(isNanValue(value)) {\n return value;\n }\n return (value - triangles.colormapRange[0]) / (triangles.colormapRange[1] - triangles.colormapRange[0]);\n}\n\nfloat normalizePickValue(float value) {\n if(isNanValue(value)) {\n return value;\n }\n float range = triangles.pickRange[1] - triangles.pickRange[0];\n return range == 0.0 ? 0.5 : (value - triangles.pickRange[0]) / range;\n}\n \nvec4 valueColor(float value) {\n if(isNanValue(value) || value == triangles.undefinedValue) {\n return triangles.undefinedColor;\n }\n if(triangles.useClampColors) {\n if(value < triangles.clampRange[0]) {\n return triangles.lowClampColor;\n } else if(value > triangles.clampRange[1]) {\n return triangles.highClampColor;\n }\n }\n float normalizedValue = normalizeValue(value);\n // apply colormap\n return texture(colormap, vec2(normalizedValue, 0.0));\n}\n\nvoid main(void) {\n\n //Picking pass.\n if (picking.isActive > 0.5 && !(picking.isAttribute > 0.5)) {\n float value = texture(valueTexture, vTexCoords).r;\n float normalizedValue = normalizePickValue(value);\n fragColor = encodeNormalizedValueWithNaNToRGB(normalizedValue);\n return;\n }\n\n vec3 normal = vNormal;\n\n if (!triangles.smoothShading) {\n normal = normalize(cross(dFdx(vPosition.xyz), dFdy(vPosition.xyz)));\n }\n\n vec4 color = vColor;\n \n // Use two sided phong lighting. This has no effect if \"material\" property is not set.\n vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, vPosition.xyz, normal);\n\n // get value from texture\n float value = texture(valueTexture, vTexCoords).r;\n // compute color\n vec4 colormapColor = valueColor(value);\n\n // multiply by colormap color and apply alpha\n fragColor = vec4(lightColor * colormapColor.rgb, colormapColor.a * vColor.a);\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n";
|
|
1
|
+
declare const _default: "#version 300 es\n#define SHADER_NAME texture-fragment-shader\n\nuniform sampler2D valueTexture;\nuniform sampler2D colormap;\n\nin vec3 cameraPosition;\n\nin vec4 vPosition;\nin vec3 vNormal;\nin vec2 vTexCoords;\nin vec4 vColor;\n\nout vec4 fragColor;\n\n// Note about the use of isNanValue(value + triangles.pickRange[0])\n// During development, isNanValue(value) fails to recognize NaN values correctly.\n// Adding triangles.pickRange[0] helps to work around this issue, probably by forcing the GPU to perform\n// an arithmetic operation that reveals the NaN correctly.\n\n// Normalize the value to the range [0, 1]\nfloat normalizeValue(float value) {\n if(isNanValue(value + triangles.pickRange[0])) {\n return value;\n }\n return (value - triangles.colormapRange[0]) / (triangles.colormapRange[1] - triangles.colormapRange[0]);\n}\n\nfloat normalizePickValue(float value) {\n if(isNanValue(value + triangles.pickRange[0])) {\n return value;\n }\n float range = triangles.pickRange[1] - triangles.pickRange[0];\n return range == 0.0 ? 0.5 : (value - triangles.pickRange[0]) / range;\n}\n \nvec4 valueColor(float value) {\n if(isNanValue(value + triangles.pickRange[0]) || value == triangles.undefinedValue) {\n return triangles.undefinedColor;\n }\n if(triangles.useClampColors) {\n if(value < triangles.clampRange[0]) {\n return triangles.lowClampColor;\n } else if(value > triangles.clampRange[1]) {\n return triangles.highClampColor;\n }\n }\n float normalizedValue = normalizeValue(value);\n // apply colormap\n return texture(colormap, vec2(normalizedValue, 0.0));\n}\n\nvoid main(void) {\n\n //Picking pass.\n if (picking.isActive > 0.5 && !(picking.isAttribute > 0.5)) {\n float value = texture(valueTexture, vTexCoords).r;\n float normalizedValue = normalizePickValue(value);\n fragColor = encodeNormalizedValueWithNaNToRGB(normalizedValue);\n return;\n }\n\n vec3 normal = vNormal;\n\n if (!triangles.smoothShading) {\n normal = normalize(cross(dFdx(vPosition.xyz), dFdy(vPosition.xyz)));\n }\n\n vec4 color = vColor;\n \n // Use two sided phong lighting. This has no effect if \"material\" property is not set.\n vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, vPosition.xyz, normal);\n\n // get value from texture\n float value = texture(valueTexture, vTexCoords).r;\n // compute color\n vec4 colormapColor = valueColor(value);\n\n // multiply by colormap color and apply alpha\n fragColor = vec4(lightColor * colormapColor.rgb, colormapColor.a * vColor.a);\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n";
|
|
2
2
|
export default _default;
|
|
@@ -13,16 +13,21 @@ in vec4 vColor;
|
|
|
13
13
|
|
|
14
14
|
out vec4 fragColor;
|
|
15
15
|
|
|
16
|
+
// Note about the use of isNanValue(value + triangles.pickRange[0])
|
|
17
|
+
// During development, isNanValue(value) fails to recognize NaN values correctly.
|
|
18
|
+
// Adding triangles.pickRange[0] helps to work around this issue, probably by forcing the GPU to perform
|
|
19
|
+
// an arithmetic operation that reveals the NaN correctly.
|
|
20
|
+
|
|
16
21
|
// Normalize the value to the range [0, 1]
|
|
17
22
|
float normalizeValue(float value) {
|
|
18
|
-
if(isNanValue(value)) {
|
|
23
|
+
if(isNanValue(value + triangles.pickRange[0])) {
|
|
19
24
|
return value;
|
|
20
25
|
}
|
|
21
26
|
return (value - triangles.colormapRange[0]) / (triangles.colormapRange[1] - triangles.colormapRange[0]);
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
float normalizePickValue(float value) {
|
|
25
|
-
if(isNanValue(value)) {
|
|
30
|
+
if(isNanValue(value + triangles.pickRange[0])) {
|
|
26
31
|
return value;
|
|
27
32
|
}
|
|
28
33
|
float range = triangles.pickRange[1] - triangles.pickRange[0];
|
|
@@ -30,7 +35,7 @@ float normalizePickValue(float value) {
|
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
vec4 valueColor(float value) {
|
|
33
|
-
if(isNanValue(value) || value == triangles.undefinedValue) {
|
|
38
|
+
if(isNanValue(value + triangles.pickRange[0]) || value == triangles.undefinedValue) {
|
|
34
39
|
return triangles.undefinedColor;
|
|
35
40
|
}
|
|
36
41
|
if(triangles.useClampColors) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texTriangle.fs.glsl.js","sourceRoot":"","sources":["../../../src/layers/gpglLayers/texTriangle.fs.glsl.ts"],"names":[],"mappings":"AAAA,eAAe
|
|
1
|
+
{"version":3,"file":"texTriangle.fs.glsl.js","sourceRoot":"","sources":["../../../src/layers/gpglLayers/texTriangle.fs.glsl.ts"],"names":[],"mappings":"AAAA,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFd,CAAC"}
|