|
@@ -38,7 +38,6 @@ varying vec4 vBoundingSphere;
|
|
|
varying mat4 vTransform;
|
|
|
|
|
|
uniform mat4 uInvView;
|
|
|
-uniform vec2 uIsoValue;
|
|
|
uniform vec3 uGridDim;
|
|
|
uniform vec3 uBboxSize;
|
|
|
uniform sampler2D tTransferTex;
|
|
@@ -76,11 +75,9 @@ uniform float uXrayEdgeFalloff;
|
|
|
uniform float uInteriorDarkening;
|
|
|
uniform bool uInteriorColorFlag;
|
|
|
uniform vec3 uInteriorColor;
|
|
|
-bool interior;
|
|
|
|
|
|
uniform bool uRenderWboit;
|
|
|
uniform bool uDoubleSided;
|
|
|
-uniform int uPickType;
|
|
|
|
|
|
uniform float uNear;
|
|
|
uniform float uFar;
|
|
@@ -104,27 +101,22 @@ uniform mat4 uCartnToUnit;
|
|
|
uniform sampler3D tGridTex;
|
|
|
#endif
|
|
|
|
|
|
-#if defined(dRenderVariant_color)
|
|
|
- #if defined(dColorType_uniform)
|
|
|
- uniform vec3 uColor;
|
|
|
- #elif defined(dColorType_texture)
|
|
|
- uniform vec2 uColorTexDim;
|
|
|
- uniform sampler2D tColor;
|
|
|
- #endif
|
|
|
+#if defined(dColorType_uniform)
|
|
|
+ uniform vec3 uColor;
|
|
|
+#elif defined(dColorType_texture)
|
|
|
+ uniform vec2 uColorTexDim;
|
|
|
+ uniform sampler2D tColor;
|
|
|
+#endif
|
|
|
|
|
|
- #ifdef dOverpaint
|
|
|
- #if defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)
|
|
|
- uniform vec2 uOverpaintTexDim;
|
|
|
- uniform sampler2D tOverpaint;
|
|
|
- #endif
|
|
|
+#ifdef dOverpaint
|
|
|
+ #if defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)
|
|
|
+ uniform vec2 uOverpaintTexDim;
|
|
|
+ uniform sampler2D tOverpaint;
|
|
|
#endif
|
|
|
+#endif
|
|
|
|
|
|
- #ifdef dSubstance
|
|
|
- #if defined(dSubstanceType_groupInstance) || defined(dSubstanceType_vertexInstance)
|
|
|
- uniform vec2 uSubstanceTexDim;
|
|
|
- uniform sampler2D tSubstance;
|
|
|
- #endif
|
|
|
- #endif
|
|
|
+#ifdef dUsePalette
|
|
|
+ uniform sampler2D tPalette;
|
|
|
#endif
|
|
|
|
|
|
#if defined(dGridTexType_2d)
|
|
@@ -148,8 +140,8 @@ float calcDepth(const in vec3 pos) {
|
|
|
return 0.5 + 0.5 * clipZW.x / clipZW.y;
|
|
|
}
|
|
|
|
|
|
-vec4 transferFunction(float value) {
|
|
|
- return texture2D(tTransferTex, vec2(value, 0.0));
|
|
|
+float transferFunction(float value) {
|
|
|
+ return texture2D(tTransferTex, vec2(value, 0.0)).a;
|
|
|
}
|
|
|
|
|
|
float getDepth(const in vec2 coords) {
|
|
@@ -174,7 +166,7 @@ vec3 v3m4(vec3 p, mat4 m) {
|
|
|
float preFogAlphaBlended = 0.0;
|
|
|
|
|
|
vec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {
|
|
|
- #if defined(dRenderVariant_color) && !defined(dIgnoreLight)
|
|
|
+ #if !defined(dIgnoreLight)
|
|
|
mat3 normalMatrix = transpose3(inverse3(mat3(uModelView * vTransform)));
|
|
|
#endif
|
|
|
mat4 cartnToUnit = uCartnToUnit * inverse4(vTransform);
|
|
@@ -190,21 +182,18 @@ vec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {
|
|
|
float value = 0.0;
|
|
|
vec4 src = vec4(0.0);
|
|
|
vec4 dst = vec4(0.0);
|
|
|
- bool hit = false;
|
|
|
float fragmentDepth;
|
|
|
|
|
|
vec3 posMin = vec3(0.0);
|
|
|
vec3 posMax = vec3(1.0) - vec3(1.0) / uGridDim;
|
|
|
|
|
|
vec3 unitPos;
|
|
|
- vec3 isoPos;
|
|
|
|
|
|
vec3 nextPos;
|
|
|
float nextValue;
|
|
|
|
|
|
- vec3 color = vec3(0.45, 0.55, 0.8);
|
|
|
- vec4 overpaint = vec4(0.0);
|
|
|
- vec3 substance = vec3(0.0);
|
|
|
+ vec4 material;
|
|
|
+ vec4 overpaint;
|
|
|
float metalness = uMetalness;
|
|
|
float roughness = uRoughness;
|
|
|
|
|
@@ -227,7 +216,6 @@ vec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {
|
|
|
if (unitPos.x > posMax.x || unitPos.y > posMax.y || unitPos.z > posMax.z ||
|
|
|
unitPos.x < posMin.x || unitPos.y < posMin.y || unitPos.z < posMin.z
|
|
|
) {
|
|
|
- if (hit) break;
|
|
|
prevValue = value;
|
|
|
pos += step;
|
|
|
continue;
|
|
@@ -246,226 +234,108 @@ vec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- #if defined(dRenderMode_isosurface)
|
|
|
- if (prevValue > 0.0 && ( // there was a prev Value
|
|
|
- (prevValue < uIsoValue.x && value > uIsoValue.x) || // entering isosurface
|
|
|
- (prevValue > uIsoValue.x && value < uIsoValue.x) // leaving isosurface
|
|
|
- )) {
|
|
|
- isoPos = v3m4(mix(pos - step, pos, ((prevValue - uIsoValue.x) / ((prevValue - uIsoValue.x) - (value - uIsoValue.x)))), cartnToUnit);
|
|
|
-
|
|
|
- vec4 mvPosition = modelViewTransform * vec4(isoPos * uGridDim, 1.0);
|
|
|
-
|
|
|
- #if defined(dClipVariant_pixel) && dClipObjectCount != 0
|
|
|
- vec3 vModelPosition = v3m4(isoPos * uGridDim, modelTransform);
|
|
|
- if (clipTest(vec4(vModelPosition, 0.0), 0)) {
|
|
|
- prevValue = value;
|
|
|
- pos += step;
|
|
|
- continue;
|
|
|
- }
|
|
|
- #endif
|
|
|
+ vec4 mvPosition = modelViewTransform * vec4(unitPos * uGridDim, 1.0);
|
|
|
+ if (calcDepth(mvPosition.xyz) > getDepth(gl_FragCoord.xy / uDrawingBufferSize))
|
|
|
+ break;
|
|
|
|
|
|
- float depth = calcDepth(mvPosition.xyz);
|
|
|
- if (depth > getDepth(gl_FragCoord.xy / uDrawingBufferSize))
|
|
|
- break;
|
|
|
+ #if defined(dClipVariant_pixel) && dClipObjectCount != 0
|
|
|
+ vec3 vModelPosition = v3m4(unitPos * uGridDim, modelTransform);
|
|
|
+ if (clipTest(vec4(vModelPosition, 0.0), 0)) {
|
|
|
+ prevValue = value;
|
|
|
+ pos += step;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ #endif
|
|
|
|
|
|
- #ifdef enabledFragDepth
|
|
|
- if (!hit) {
|
|
|
- gl_FragDepthEXT = depth;
|
|
|
- }
|
|
|
- #endif
|
|
|
+ vec3 vViewPosition = mvPosition.xyz;
|
|
|
+ material.a = transferFunction(value);
|
|
|
|
|
|
- #if defined(dRenderVariant_pick)
|
|
|
- if (uPickType == 1) {
|
|
|
- return vec4(encodeFloatRGB(float(uObjectId)), 1.0);
|
|
|
- } else if (uPickType == 2) {
|
|
|
- return vec4(encodeFloatRGB(vInstance), 1.0);
|
|
|
- } else {
|
|
|
- #ifdef dPackedGroup
|
|
|
- return vec4(textureGroup(floor(isoPos * uGridDim + 0.5) / uGridDim).rgb, 1.0);
|
|
|
- #else
|
|
|
- vec3 g = floor(isoPos * uGridDim + 0.5);
|
|
|
- return vec4(encodeFloatRGB(g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y), 1.0);
|
|
|
- #endif
|
|
|
- }
|
|
|
- #elif defined(dRenderVariant_depth)
|
|
|
- #ifdef enabledFragDepth
|
|
|
- return packDepthToRGBA(gl_FragDepthEXT);
|
|
|
- #else
|
|
|
- return packDepthToRGBA(depth);
|
|
|
- #endif
|
|
|
- #elif defined(dRenderVariant_color)
|
|
|
- #ifdef dPackedGroup
|
|
|
- float group = decodeFloatRGB(textureGroup(floor(isoPos * uGridDim + 0.5) / uGridDim).rgb);
|
|
|
- #else
|
|
|
- vec3 g = floor(isoPos * uGridDim + 0.5);
|
|
|
- float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y;
|
|
|
- #endif
|
|
|
-
|
|
|
- #if defined(dColorType_uniform)
|
|
|
- color = uColor;
|
|
|
- #elif defined(dColorType_instance)
|
|
|
- color = readFromTexture(tColor, vInstance, uColorTexDim).rgb;
|
|
|
- #elif defined(dColorType_group)
|
|
|
- color = readFromTexture(tColor, group, uColorTexDim).rgb;
|
|
|
- #elif defined(dColorType_groupInstance)
|
|
|
- color = readFromTexture(tColor, vInstance * float(uGroupCount) + group, uColorTexDim).rgb;
|
|
|
- #elif defined(dColorType_vertex)
|
|
|
- color = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, 0.0).rgb;
|
|
|
- #elif defined(dColorType_vertexInstance)
|
|
|
- color = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, vInstance * float(uVertexCount)).rgb;
|
|
|
- #endif
|
|
|
-
|
|
|
- #ifdef dOverpaint
|
|
|
- #if defined(dOverpaintType_groupInstance)
|
|
|
- overpaint = readFromTexture(tOverpaint, vInstance * float(uGroupCount) + group, uOverpaintTexDim);
|
|
|
- #elif defined(dOverpaintType_vertexInstance)
|
|
|
- overpaint = texture3dFrom1dTrilinear(tOverpaint, isoPos, uGridDim, uOverpaintTexDim, vInstance * float(uVertexCount));
|
|
|
- #endif
|
|
|
-
|
|
|
- color = mix(color, overpaint.rgb, overpaint.a);
|
|
|
- #endif
|
|
|
-
|
|
|
- // handle flipping and negative isosurfaces
|
|
|
- #ifdef dFlipSided
|
|
|
- bool flipped = value < uIsoValue.y; // flipped
|
|
|
- #else
|
|
|
- bool flipped = value > uIsoValue.y;
|
|
|
- #endif
|
|
|
- interior = value < uIsoValue.x && flipped;
|
|
|
- if (uDoubleSided) {
|
|
|
- if (interior) {
|
|
|
- prevValue = value;
|
|
|
- pos += step;
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- vec3 vViewPosition = mvPosition.xyz;
|
|
|
- vec4 material = vec4(color, uAlpha);
|
|
|
-
|
|
|
- #ifdef dIgnoreLight
|
|
|
- gl_FragColor = material;
|
|
|
- #else
|
|
|
- #if defined(dFlatShaded)
|
|
|
- // nearest grid point
|
|
|
- isoPos = floor(isoPos * uGridDim + 0.5) / uGridDim;
|
|
|
- #endif
|
|
|
- #ifdef dPackedGroup
|
|
|
- // compute gradient by central differences
|
|
|
- gradient.x = textureVal(isoPos - dx).a - textureVal(isoPos + dx).a;
|
|
|
- gradient.y = textureVal(isoPos - dy).a - textureVal(isoPos + dy).a;
|
|
|
- gradient.z = textureVal(isoPos - dz).a - textureVal(isoPos + dz).a;
|
|
|
- #else
|
|
|
- gradient = textureVal(isoPos).xyz * 2.0 - 1.0;
|
|
|
- #endif
|
|
|
- vec3 normal = -normalize(normalMatrix * normalize(gradient));
|
|
|
- normal = normal * (float(flipped) * 2.0 - 1.0);
|
|
|
- normal = normal * -(float(interior) * 2.0 - 1.0);
|
|
|
- #ifdef dSubstance
|
|
|
- #if defined(dSubstanceType_groupInstance)
|
|
|
- substance = readFromTexture(tSubstance, vInstance * float(uGroupCount) + group, uSubstanceTexDim).rgb;
|
|
|
- #elif defined(dSubstanceType_vertexInstance)
|
|
|
- substance = texture3dFrom1dTrilinear(tSubstance, isoPos, uGridDim, uSubstanceTexDim, vInstance * float(uVertexCount)).rgb;
|
|
|
- #endif
|
|
|
- metalness = mix(metalness, substance.r, substance.b);
|
|
|
- roughness = mix(roughness, substance.g, substance.b);
|
|
|
- #endif
|
|
|
- #include apply_light_color
|
|
|
- #endif
|
|
|
-
|
|
|
- float marker = uMarker;
|
|
|
- if (uMarker == -1.0) {
|
|
|
- marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;
|
|
|
- marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win
|
|
|
- }
|
|
|
- #include apply_interior_color
|
|
|
- #include apply_marker_color
|
|
|
-
|
|
|
- preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;
|
|
|
- fragmentDepth = depth;
|
|
|
- #include apply_fog
|
|
|
-
|
|
|
- src = gl_FragColor;
|
|
|
-
|
|
|
- if (!uTransparentBackground) {
|
|
|
- // done in 'apply_fog' otherwise
|
|
|
- src.rgb *= src.a;
|
|
|
- }
|
|
|
- dst = (1.0 - dst.a) * src + dst; // standard blending
|
|
|
- #endif
|
|
|
+ #ifdef dPackedGroup
|
|
|
+ float group = unpackRGBToInt(textureGroup(floor(unitPos * uGridDim + 0.5) / uGridDim).rgb);
|
|
|
+ #else
|
|
|
+ vec3 g = floor(unitPos * uGridDim + 0.5);
|
|
|
+ // note that we swap x and z because the texture is flipped around y
|
|
|
+ #if defined(dAxisOrder_012)
|
|
|
+ float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y; // 210
|
|
|
+ #elif defined(dAxisOrder_021)
|
|
|
+ float group = g.y + g.z * uGridDim.y + g.x * uGridDim.y * uGridDim.z; // 120
|
|
|
+ #elif defined(dAxisOrder_102)
|
|
|
+ float group = g.z + g.x * uGridDim.z + g.y * uGridDim.z * uGridDim.x; // 201
|
|
|
+ #elif defined(dAxisOrder_120)
|
|
|
+ float group = g.x + g.z * uGridDim.x + g.y * uGridDim.x * uGridDim.z; // 021
|
|
|
+ #elif defined(dAxisOrder_201)
|
|
|
+ float group = g.y + g.x * uGridDim.y + g.z * uGridDim.y * uGridDim.x; // 102
|
|
|
+ #elif defined(dAxisOrder_210)
|
|
|
+ float group = g.x + g.y * uGridDim.x + g.z * uGridDim.x * uGridDim.y; // 012
|
|
|
+ #endif
|
|
|
+ #endif
|
|
|
|
|
|
- #ifdef dSingleLayer
|
|
|
- break;
|
|
|
- #endif
|
|
|
+ #if defined(dColorType_direct) && defined(dUsePalette)
|
|
|
+ material.rgb = texture2D(tPalette, vec2(value, 0.0)).rgb;
|
|
|
+ #elif defined(dColorType_uniform)
|
|
|
+ material.rgb = uColor;
|
|
|
+ #elif defined(dColorType_instance)
|
|
|
+ material.rgb = readFromTexture(tColor, vInstance, uColorTexDim).rgb;
|
|
|
+ #elif defined(dColorType_group)
|
|
|
+ material.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;
|
|
|
+ #elif defined(dColorType_groupInstance)
|
|
|
+ material.rgb = readFromTexture(tColor, vInstance * float(uGroupCount) + group, uColorTexDim).rgb;
|
|
|
+ #elif defined(dColorType_vertex)
|
|
|
+ material.rgb = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, 0.0).rgb;
|
|
|
+ #elif defined(dColorType_vertexInstance)
|
|
|
+ material.rgb = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, vInstance * float(uVertexCount)).rgb;
|
|
|
+ #endif
|
|
|
|
|
|
- hit = true;
|
|
|
- }
|
|
|
- prevValue = value;
|
|
|
- #elif defined(dRenderMode_volume)
|
|
|
- vec4 mvPosition = modelViewTransform * vec4(unitPos * uGridDim, 1.0);
|
|
|
- if (calcDepth(mvPosition.xyz) > getDepth(gl_FragCoord.xy / uDrawingBufferSize))
|
|
|
- break;
|
|
|
-
|
|
|
- #if defined(dClipVariant_pixel) && dClipObjectCount != 0
|
|
|
- vec3 vModelPosition = v3m4(unitPos * uGridDim, modelTransform);
|
|
|
- if (clipTest(vec4(vModelPosition, 0.0), 0)) {
|
|
|
- prevValue = value;
|
|
|
- pos += step;
|
|
|
- continue;
|
|
|
- }
|
|
|
+ #ifdef dOverpaint
|
|
|
+ #if defined(dOverpaintType_groupInstance)
|
|
|
+ overpaint = readFromTexture(tOverpaint, vInstance * float(uGroupCount) + group, uOverpaintTexDim);
|
|
|
+ #elif defined(dOverpaintType_vertexInstance)
|
|
|
+ overpaint = texture3dFrom1dTrilinear(tOverpaint, isoPos, uGridDim, uOverpaintTexDim, vInstance * float(uVertexCount));
|
|
|
#endif
|
|
|
|
|
|
- #if defined(dRenderVariant_color)
|
|
|
- vec3 vViewPosition = mvPosition.xyz;
|
|
|
- vec4 material = transferFunction(value);
|
|
|
+ material.rgb = mix(material.rgb, overpaint.rgb, overpaint.a);
|
|
|
+ #endif
|
|
|
|
|
|
- #ifdef dIgnoreLight
|
|
|
- gl_FragColor.rgb = material.rgb;
|
|
|
+ #ifdef dIgnoreLight
|
|
|
+ gl_FragColor.rgb = material.rgb;
|
|
|
+ #else
|
|
|
+ if (material.a >= 0.01) {
|
|
|
+ #ifdef dPackedGroup
|
|
|
+ // compute gradient by central differences
|
|
|
+ gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a;
|
|
|
+ gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a;
|
|
|
+ gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a;
|
|
|
#else
|
|
|
- if (material.a >= 0.01) {
|
|
|
- #ifdef dPackedGroup
|
|
|
- // compute gradient by central differences
|
|
|
- gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a;
|
|
|
- gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a;
|
|
|
- gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a;
|
|
|
- #else
|
|
|
- gradient = cell.xyz * 2.0 - 1.0;
|
|
|
- #endif
|
|
|
- vec3 normal = -normalize(normalMatrix * normalize(gradient));
|
|
|
- #include apply_light_color
|
|
|
- } else {
|
|
|
- gl_FragColor.rgb = material.rgb;
|
|
|
- }
|
|
|
+ gradient = cell.xyz * 2.0 - 1.0;
|
|
|
#endif
|
|
|
-
|
|
|
- gl_FragColor.a = material.a * uAlpha * uTransferScale;
|
|
|
-
|
|
|
- float marker = uMarker;
|
|
|
- if (uMarker == -1.0) {
|
|
|
- #ifdef dPackedGroup
|
|
|
- float group = decodeFloatRGB(textureGroup(floor(unitPos * uGridDim + 0.5) / uGridDim).rgb);
|
|
|
- #else
|
|
|
- vec3 g = floor(unitPos * uGridDim + 0.5);
|
|
|
- float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y;
|
|
|
- #endif
|
|
|
- marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;
|
|
|
- marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win
|
|
|
- }
|
|
|
- #include apply_marker_color
|
|
|
-
|
|
|
- preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;
|
|
|
- fragmentDepth = calcDepth(mvPosition.xyz);
|
|
|
- #include apply_fog
|
|
|
-
|
|
|
- src = gl_FragColor;
|
|
|
-
|
|
|
- if (!uTransparentBackground) {
|
|
|
- // done in 'apply_fog' otherwise
|
|
|
- src.rgb *= src.a;
|
|
|
- }
|
|
|
- dst = (1.0 - dst.a) * src + dst; // standard blending
|
|
|
- #endif
|
|
|
+ vec3 normal = -normalize(normalMatrix * normalize(gradient));
|
|
|
+ #include apply_light_color
|
|
|
+ } else {
|
|
|
+ gl_FragColor.rgb = material.rgb;
|
|
|
+ }
|
|
|
#endif
|
|
|
|
|
|
+ gl_FragColor.a = material.a * uAlpha * uTransferScale;
|
|
|
+
|
|
|
+ float marker = uMarker;
|
|
|
+ if (uMarker == -1.0) {
|
|
|
+ marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;
|
|
|
+ marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win
|
|
|
+ }
|
|
|
+ #include apply_marker_color
|
|
|
+
|
|
|
+ preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;
|
|
|
+ fragmentDepth = calcDepth(mvPosition.xyz);
|
|
|
+ #include apply_fog
|
|
|
+
|
|
|
+ src = gl_FragColor;
|
|
|
+
|
|
|
+ if (!uTransparentBackground) {
|
|
|
+ // done in 'apply_fog' otherwise
|
|
|
+ src.rgb *= src.a;
|
|
|
+ }
|
|
|
+ dst = (1.0 - dst.a) * src + dst; // standard blending
|
|
|
+
|
|
|
// break if the color is opaque enough
|
|
|
if (dst.a > 0.95)
|
|
|
break;
|
|
@@ -473,12 +343,6 @@ vec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {
|
|
|
pos += step;
|
|
|
}
|
|
|
|
|
|
- #if defined(dRenderMode_isosurface) && defined(enabledFragDepth)
|
|
|
- // ensure depth is written everywhere
|
|
|
- if (!hit)
|
|
|
- gl_FragDepthEXT = 1.0;
|
|
|
- #endif
|
|
|
-
|
|
|
return dst;
|
|
|
}
|
|
|
|
|
@@ -489,21 +353,6 @@ void main() {
|
|
|
if (gl_FrontFacing)
|
|
|
discard;
|
|
|
|
|
|
- #ifdef dRenderVariant_marking
|
|
|
- // not supported
|
|
|
- discard;
|
|
|
- #endif
|
|
|
-
|
|
|
- #if defined(dRenderVariant_pick) || defined(dRenderVariant_depth)
|
|
|
- #if defined(dRenderMode_volume)
|
|
|
- // always ignore pick & depth for volume
|
|
|
- discard;
|
|
|
- #elif defined(dRenderMode_isosurface)
|
|
|
- if (uAlpha < uPickingAlphaThreshold)
|
|
|
- discard; // ignore so the element below can be picked
|
|
|
- #endif
|
|
|
- #endif
|
|
|
-
|
|
|
vec3 rayDir = mix(normalize(vOrigPos - uCameraPosition), uCameraDir, uIsOrtho);
|
|
|
vec3 step = rayDir * uStepScale;
|
|
|
|
|
@@ -512,21 +361,9 @@ void main() {
|
|
|
vec3 start = mix(uCameraPosition, vOrigPos, uIsOrtho) + (d * rayDir);
|
|
|
gl_FragColor = raymarch(start, step, rayDir);
|
|
|
|
|
|
- #if defined(dRenderVariant_pick) || defined(dRenderVariant_depth)
|
|
|
- // discard when nothing was hit
|
|
|
- if (gl_FragColor == vec4(0.0))
|
|
|
- discard;
|
|
|
- #endif
|
|
|
-
|
|
|
- #if defined(dRenderVariant_color)
|
|
|
- #if defined(dRenderMode_isosurface) && defined(enabledFragDepth)
|
|
|
- float fragmentDepth = gl_FragDepthEXT;
|
|
|
- #else
|
|
|
- float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);
|
|
|
- #endif
|
|
|
- float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);
|
|
|
- interior = false;
|
|
|
- #include wboit_write
|
|
|
- #endif
|
|
|
+ float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);
|
|
|
+ float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);
|
|
|
+ bool interior = false;
|
|
|
+ #include wboit_write
|
|
|
}
|
|
|
`;
|