-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Clamp to 3D Tiles most detailed #7115
Merged
Merged
Changes from 13 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
eb4b83d
Move common code into Cesium3DTile
lilleyse 75d297c
Pass statistics around in preparation for offscreen statistics
lilleyse 96143eb
Merge branch 'pick-ray-2' into offscreen-picking
lilleyse 5392ed7
Merge branch 'master' into offscreen-picking
lilleyse c389629
Offscreen picking
lilleyse 8b88951
Added Sandcastle demo
lilleyse 8273d8e
Cleaned up Ray.clone
lilleyse eaa858b
Update frame number and time in main render loop so changes are refle…
lilleyse 93061df
Fix #7120 by picking through primitives that don't write depth for sa…
lilleyse 336bf3a
Merge branch 'master' into offscreen-picking
lilleyse b950f17
Merge branch 'master' into offscreen-picking
lilleyse af109b2
Added #7120 to CHANGES
lilleyse 320bf99
Modify arrays in place
lilleyse 751b138
Rename demo
lilleyse 003baa5
Merge branch 'master' into offscreen-picking
lilleyse b605450
Fix tests
lilleyse bdd2d78
Added pick tests
lilleyse 67d2a86
Remove updateAsync and use normal update
lilleyse 26a1a66
Fix tests
lilleyse a75ddf3
Merge branch 'master' into offscreen-picking
lilleyse db53e33
Minor Scene edits
lilleyse a8710ff
Undo statistics changes in Cesium3DTileset
lilleyse ebd65d9
Cleanup and fixes from #7115
lilleyse 955b098
Merge branch 'offscreen-picking-prep' into offscreen-picking
lilleyse 9e89108
Renamed Cesium3DTilesetOffscreenTraversal to Cesium3DTilesetAsyncTrav…
lilleyse 0a805d5
eslint fix
lilleyse 8d1159c
Merge branch 'offscreen-picking-prep' into offscreen-picking
lilleyse 504988a
Merge branch 'offscreen-picking-prep' into offscreen-picking
lilleyse ab58195
Remove unused include
lilleyse 12e92b5
Ignore async commands in different place
lilleyse a406d3a
Fix WebGL stub tests
lilleyse 66e626c
Added tileset tests
lilleyse a5078f5
Added updateAsync function to Cesium3DTileset
lilleyse 470bd0f
Add terrain to Sandcastle demo
lilleyse d0c16e3
Remove minimumGeometricError
lilleyse e457213
Formatting
lilleyse 9a2e7eb
Renamed asyncLoaders to asyncRayPicks
lilleyse 3d64294
Scene updates
lilleyse ac9a986
Merge branch 'master' into offscreen-picking
lilleyse b5cafd7
Add to doc
lilleyse 3876766
Merge conflict fix
lilleyse f461329
Merge branch 'master' into offscreen-picking
lilleyse d115e17
Updated CHANGES.md
lilleyse 9956a08
Merge branch 'master' into offscreen-picking
lilleyse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
104 changes: 104 additions & 0 deletions
104
Apps/Sandcastle/gallery/Clamp to 3D Tiles Offscreen.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<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="Sample the most detailed heights of a 3D Tileset."> | ||
<meta name="cesium-sandcastle-labels" content="Showcases, 3D Tiles"> | ||
<title>Cesium Demo</title> | ||
<script type="text/javascript" src="../Sandcastle-header.js"></script> | ||
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script> | ||
<script type="text/javascript"> | ||
if(typeof require === 'function') { | ||
require.config({ | ||
baseUrl : '../../../Source', | ||
waitSeconds : 120 | ||
}); | ||
} | ||
</script> | ||
</head> | ||
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html"> | ||
<style> | ||
@import url(../templates/bucket.css); | ||
</style> | ||
<div id="cesiumContainer" class="fullSize"></div> | ||
<div id="loadingOverlay"><h1>Loading...</h1></div> | ||
<div id="toolbar"></div> | ||
<script id="cesium_sandcastle_script"> | ||
function startup(Cesium) { | ||
'use strict'; | ||
//Sandcastle_Begin | ||
var viewer = new Cesium.Viewer('cesiumContainer'); | ||
var scene = viewer.scene; | ||
|
||
var tileset = scene.primitives.add( | ||
new Cesium.Cesium3DTileset({ | ||
url: Cesium.IonResource.fromAssetId(6074) | ||
}) | ||
); | ||
|
||
scene.camera.setView({ | ||
destination: new Cesium.Cartesian3(1216411.0748779264, -4736313.10747583, 4081359.5125561724), | ||
orientation: new Cesium.HeadingPitchRoll(4.239925103568368, -0.4911293834802475, 6.279849292088564), | ||
endTransform : Cesium.Matrix4.IDENTITY | ||
}); | ||
|
||
Sandcastle.addToolbarButton('Sample heights', function() { | ||
sampleHeights(); | ||
}); | ||
|
||
function sampleHeights() { | ||
if (!scene.clampToHeightSupported) { | ||
console.log('This browser does not support clampToHeightMostDetailed.'); | ||
} | ||
|
||
viewer.entities.removeAll(); | ||
|
||
var cartesian1 = new Cesium.Cartesian3(1216390.063324395, -4736314.814479433, 4081341.9787972216); | ||
var cartesian2 = new Cesium.Cartesian3(1216329.5413318684, -4736272.029009798, 4081407.9342479417); | ||
|
||
var count = 30; | ||
var cartesians = new Array(count); | ||
for (var i = 0; i < count; ++i) { | ||
var offset = i / (count - 1); | ||
cartesians[i] = Cesium.Cartesian3.lerp(cartesian1, cartesian2, offset, new Cesium.Cartesian3()); | ||
} | ||
|
||
scene.clampToHeightMostDetailed(cartesians).then(function(clampedCartesians) { | ||
for (var i = 0; i < count; ++i) { | ||
viewer.entities.add({ | ||
position: clampedCartesians[i], | ||
ellipsoid : { | ||
radii : new Cesium.Cartesian3(0.2, 0.2, 0.2), | ||
material : Cesium.Color.RED | ||
} | ||
}); | ||
} | ||
|
||
viewer.entities.add({ | ||
polyline : { | ||
positions : clampedCartesians, | ||
followSurface : false, | ||
width : 2, | ||
material : new Cesium.PolylineOutlineMaterialProperty({ | ||
color : Cesium.Color.YELLOW | ||
}), | ||
depthFailMaterial : new Cesium.PolylineOutlineMaterialProperty({ | ||
color : Cesium.Color.YELLOW | ||
}) | ||
} | ||
}); | ||
}); | ||
} | ||
//Sandcastle_End | ||
Sandcastle.finishedLoading(); | ||
} | ||
if (typeof Cesium !== 'undefined') { | ||
startup(Cesium); | ||
} else if (typeof require === 'function') { | ||
require(['Cesium'], startup); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure we should call this "off screen?" What speaks to the user best? Async? Most Detailed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really just that comment for now, this is cool, and could be used for profiles, e.g., change
30
to300
.I'll also look at the implementation when ready.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I do support having smaller, more focused Sandcastle examples in general, in this case I wonder if it would be better to combine this with the existing Clamp to 3D Tiles example, in the same way the terrain sample and sampleMostDetailed are in the same example:
http://localhost:8080/Apps/Sandcastle/index.html?src=Terrain.html
"Most detailed" is probably the most relevant to the user, but I can imagine users running into this issue when they realize sampleHeight only works for already visible tiles and want to figure out how to do it for tiles offscreen. I think in any case the goal for the user is just clamping to 3D Tiles/getting tiles height, so a combined example geared towards that use case makes the most sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think keeping them separate is better because they represent different enough use cases.
But maybe the new demo should be called
Sample Height from 3D Tiles
. The main difference being this demo samples some heights and shows the result while the first demo actually physically clamps something to the tileset.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that makes more sense! I think that naming will make it easier to find.