Skip to content

Commit

Permalink
Fix disable depth test distance.
Browse files Browse the repository at this point in the history
  • Loading branch information
bagnell committed Feb 15, 2018
1 parent 7d716e9 commit 567a110
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Source/Shaders/BillboardCollectionVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ void main()

vec4 positionWC = computePositionWindowCoordinates(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters);
gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);
v_inverse_depth = -1.0 / positionEC.z;
v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w;
v_textureCoordinates = textureCoordinates;

#ifdef DISABLE_DEPTH_DISTANCE
Expand All @@ -277,6 +277,7 @@ void main()
{
// Position z on the near plane.
gl_Position.z = -gl_Position.w;
v_inverse_depth = 1.0 / czm_currentFrustum.x;
}
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions Source/Shaders/PointPrimitiveCollectionVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ void main()
vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);

gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);
v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w;

#ifdef DISABLE_DEPTH_DISTANCE
float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;
Expand All @@ -168,6 +169,7 @@ void main()
{
// Position z on the near plane.
gl_Position.z = -gl_Position.w;
v_inverse_depth = 1.0 / czm_currentFrustum.x;
}
}
#endif
Expand All @@ -181,8 +183,6 @@ void main()
v_pixelDistance = 2.0 / totalSize;
gl_PointSize = totalSize;

v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w;

#ifdef RENDER_FOR_PICK
v_pickColor = pickColor;
#endif
Expand Down

0 comments on commit 567a110

Please sign in to comment.