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 resolution scaling sandcasle example #8151

Merged
merged 4 commits into from
Sep 11, 2019

Conversation

IanLilleyT
Copy link
Contributor

@IanLilleyT IanLilleyT commented Sep 11, 2019

Fixes #8102

This sandcastle example lets you set a custom resolution scale or use the device pixel resolution.

@IanLilleyT IanLilleyT requested a review from lilleyse September 11, 2019 15:53
@cesium-concierge
Copy link

Thanks for the pull request @IanLilleyT!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

@IanLilleyT IanLilleyT changed the title Added resolution scaling sandbox example Added resolution scaling sandcasle example Sep 11, 2019
@IanLilleyT IanLilleyT force-pushed the resolution-scaling-sandcastle branch from f66210f to 60785ef Compare September 11, 2019 15:57
}
update();

viewer.scene.camera.setView({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default view is already good enough, this setView isn't needed.

<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Set a custom resolution scale or enable device pixel resolution.">
<meta name="cesium-sandcastle-labels" content="Post Processing">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this in the Showcases category instead since it's not strictly post-processing related.

<div id="toolbar">
<table><tbody>
<tr>
<td>Use Device Pixel Resolution</td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better description is: Use Browser Recommended Resolution

Also edit the Sandcastle description and any variables names.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename useDevicePixelResolution

<input type="text" size="5" data-bind="value: customResolutionScale, enable: !useDevicePixelResolution">
</td>
</tr>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove empty line

viewer.resolutionScale = 1.0 / window.devicePixelRatio;
} else {
var res = Number(params.customResolutionScale);
res = Cesium.Math.clamp(res, 0.1, 8.0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
res = Cesium.Math.clamp(res, 0.1, 8.0);
res = Cesium.Math.clamp(res, 0.1, 2.0);

} else {
var res = Number(params.customResolutionScale);
res = Cesium.Math.clamp(res, 0.1, 8.0);
res = !isNaN(res) ? res : 1.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should go above the clamp.

if (params.useDevicePixelResolution) {
viewer.resolutionScale = 1.0 / window.devicePixelRatio;
} else {
var res = Number(params.customResolutionScale);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to unabbreviate, rename to resolutionScale.

//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');

var params = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This object is usually called viewModel.

@IanLilleyT
Copy link
Contributor Author

fixed latest problem

@lilleyse
Copy link
Contributor

Thanks @IanLilleyT

@lilleyse lilleyse merged commit d9e06b0 into master Sep 11, 2019
@lilleyse lilleyse deleted the resolution-scaling-sandcastle branch September 11, 2019 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create sandcastle examples for FXAA, HDR, and image scaling
3 participants