Skip to content

Commit

Permalink
Use eye coordinates instead of window coordinates in the billboard ve…
Browse files Browse the repository at this point in the history
…rtex shader.
  • Loading branch information
bagnell committed Apr 9, 2018
1 parent e17dbcc commit 6e9fc3e
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Source/Shaders/BillboardCollectionVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@ vec4 computePositionWindowCoordinates(vec4 positionEC, vec2 imageSize, float sca
positionEC.xy += halfSize;
}

vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
float mpp = czm_metersPerPixel(positionEC);

if (sizeInMeters)
if (!sizeInMeters)
{
originTranslate /= czm_metersPerPixel(positionEC);
originTranslate *= mpp;
}

positionWC.xy += originTranslate;
positionEC.xy += originTranslate;
if (!sizeInMeters)
{
positionWC.xy += halfSize;
positionEC.xy += halfSize * mpp;
}

positionWC.xy += translate;
positionWC.xy += (pixelOffset * czm_resolutionScale);
positionEC.xy += translate * mpp;
positionEC.xy += (pixelOffset * czm_resolutionScale) * mpp;

return positionWC;
return positionEC;
}

void main()
Expand Down Expand Up @@ -255,14 +255,14 @@ void main()
}
#endif

#ifdef LOG_DEPTH
czm_vertexLogDepth(czm_projection * positionEC);
#endif

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);
gl_Position = czm_projection * positionWC;
v_textureCoordinates = textureCoordinates;

#ifdef LOG_DEPTH
czm_vertexLogDepth();
#endif

#ifdef DISABLE_DEPTH_DISTANCE
float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;
if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
Expand Down

0 comments on commit 6e9fc3e

Please sign in to comment.