Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pixel ratio to czm_metersPerPixel #8318

Merged
merged 1 commit into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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