Skip to content

Commit

Permalink
Merge pull request #8318 from AnalyticalGraphicsInc/billboardFixes
Browse files Browse the repository at this point in the history
Added pixel ratio to czm_metersPerPixel
  • Loading branch information
lilleyse authored Oct 25, 2019
2 parents e0e8062 + e11540f commit a5e5566
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Source/Shaders/BillboardCollectionVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ vec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 dir
{
// Note the halfSize cannot be computed in JavaScript because it is sent via
// compressed vertex attributes that coerce it to an integer.
vec2 halfSize = imageSize * scale * czm_pixelRatio * 0.5;
vec2 halfSize = imageSize * scale * 0.5;
halfSize *= ((direction * 2.0) - 1.0);

vec2 originTranslate = origin * abs(halfSize);
Expand Down Expand Up @@ -102,7 +102,7 @@ vec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 dir
}

positionEC.xy += translate * mpp;
positionEC.xy += (pixelOffset * czm_pixelRatio) * mpp;
positionEC.xy += pixelOffset * mpp;
return positionEC;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Shaders/Builtin/Functions/metersPerPixel.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ float czm_metersPerPixel(vec4 positionEC)
pixelWidth = 2.0 * distanceToPixel * tanTheta / width;
}

return max(pixelWidth, pixelHeight);
return max(pixelWidth, pixelHeight) * czm_pixelRatio;
}
4 changes: 2 additions & 2 deletions Source/Shaders/PolylineShadowVolumeMorphVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ void main()
#endif // PER_INSTANCE_COLOR

#ifdef WIDTH_VARYING
float width = czm_batchTable_width(batchId) * czm_pixelRatio;
float width = czm_batchTable_width(batchId);
float halfWidth = width * 0.5;
v_width = width;
v_texcoordNormalizationAndHalfWidth.z = halfWidth;
#else
float halfWidth = 0.5 * czm_batchTable_width(batchId) * czm_pixelRatio;
float halfWidth = 0.5 * czm_batchTable_width(batchId);
v_texcoordNormalizationAndHalfWidth.z = halfWidth;
#endif

Expand Down
2 changes: 1 addition & 1 deletion Source/Shaders/PolylineShadowVolumeVS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void main()
// { \| }
// o---------- polyline segment ---->
//
float width = czm_batchTable_width(batchId) * czm_pixelRatio;
float width = czm_batchTable_width(batchId);
#ifdef WIDTH_VARYING
v_width = width;
#endif
Expand Down

0 comments on commit a5e5566

Please sign in to comment.