|
@@ -1,5 +1,5 @@
|
|
|
/**
|
|
|
- * Copyright (c) 2017-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
|
+ * Copyright (c) 2017-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
|
|
*
|
|
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
|
* @author Michael Krone <michael.krone@uni-tuebingen.de>
|
|
@@ -258,7 +258,7 @@ vec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {
|
|
|
#ifdef enabledFragDepth
|
|
|
return packDepthToRGBA(gl_FragDepthEXT);
|
|
|
#else
|
|
|
- return packDepthToRGBA(gl_FragCoord.z);
|
|
|
+ return packDepthToRGBA(depth);
|
|
|
#endif
|
|
|
#elif defined(dRenderVariant_color)
|
|
|
#ifdef dPackedGroup
|
|
@@ -442,8 +442,9 @@ void main () {
|
|
|
vec3 step = rayDir * uStepScale;
|
|
|
|
|
|
float boundingSphereNear = distance(vBoundingSphere.xyz, uCameraPosition) - vBoundingSphere.w;
|
|
|
- float d = max(uNear, boundingSphereNear);
|
|
|
- gl_FragColor = raymarch(uCameraPosition + (d * rayDir), step, rayDir);
|
|
|
+ float d = max(uNear, boundingSphereNear) - mix(0.0, distance(vOrigPos, uCameraPosition), uIsOrtho);
|
|
|
+ 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
|
|
@@ -455,7 +456,7 @@ void main () {
|
|
|
#if defined(dRenderMode_isosurface) && defined(enabledFragDepth)
|
|
|
float fragmentDepth = gl_FragDepthEXT;
|
|
|
#else
|
|
|
- float fragmentDepth = calcDepth((uView * vec4(uCameraPosition + (d * rayDir), 1.0)).xyz);
|
|
|
+ float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);
|
|
|
#endif
|
|
|
float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);
|
|
|
interior = false;
|