-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
getTileDataAvailable() handling for terrain providers #2102
Changes from 12 commits
e0d0341
7a380e9
6a60a5b
427b6ac
576320a
7b3626a
e65ee54
ffbfd66
66229ac
b1c95a0
0c46ebb
25d222c
4517047
a361e49
c815459
3fbdd62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE --> | ||
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> | ||
<meta name="description" content="Use Viewer to start building new applications or easily embed Cesium into existing applications."> | ||
<meta name="cesium-sandcastle-labels" content="Profiling"> | ||
<title>Cesium Demo</title> | ||
<script type="text/javascript" src="../Sandcastle-header.js"></script> | ||
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.9/require.js"></script> | ||
<script type="text/javascript"> | ||
require.config({ | ||
baseUrl : '../../../Source', | ||
waitSeconds : 60 | ||
}); | ||
</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 cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({ | ||
url : '//cesiumjs.org/stk-terrain/tilesets/world/tiles' | ||
}); | ||
|
||
var viewer = new Cesium.Viewer('cesiumContainer'); | ||
var scene = viewer.scene; | ||
scene.terrainProvider = cesiumTerrainProviderMeshes; | ||
|
||
var setCamera = function() { | ||
var eye = new Cesium.Cartesian3(-2496304.1498512086, -4391818.97382059, 3884176.4503971986); | ||
var target = Cesium.Cartesian3.add(eye, new Cesium.Cartesian3(0.9279518715011381, -0.29488412129953234, -0.22792252890604328), new Cesium.Cartesian3()); | ||
var up = new Cesium.Cartesian3(-0.11836693744723503, -0.8130611584421428, 0.5700182635106171); | ||
scene.camera.lookAt(eye, target, up); | ||
}; | ||
|
||
setCamera(); | ||
|
||
// Keep updating the camera so it doesn't get pushed above low resolution terrain. | ||
setInterval(setCamera, 1000); | ||
//Sandcastle_End | ||
Sandcastle.finishedLoading(); | ||
} | ||
if (typeof Cesium !== "undefined") { | ||
startup(Cesium); | ||
} else if (typeof require === "function") { | ||
require(["Cesium"], startup); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,5 +192,16 @@ define([ | |
*/ | ||
TerrainProvider.prototype.getLevelMaximumGeometricError = DeveloperError.throwInstantiationError; | ||
|
||
/** | ||
* Determines whether data for a tile is available to be loaded. | ||
* @function | ||
* | ||
* @param {Number} x The X coordinate of the tile for which to request geometry. | ||
* @param {Number} y The Y coordinate of the tile for which to request geometry. | ||
* @param {Number} level The level of the tile for which to request geometry. | ||
* @returns {Number} Undefined if not supported by the terrain provider, otherwise true or false. | ||
*/ | ||
TerrainProvider.prototype.getTileDataAvailable = DeveloperError.throwInstantiationError; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a breaking change for folks who implemented We should provide a default implementation to not break them and perhaps warn if we want to eventually require this. See the Deprecation Guide. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently there are no "base classes" or inheritance in Cesium. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, right. This is still a little sketchy. It's as if we want to document this function as optional so users know they need to check to see if the function exists or we need to start using inheritance of whatever form to avoid this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I believe inheritance would have a performance cost we'd rather not pay. I agree it should be documented as optional, though. |
||
|
||
return TerrainProvider; | ||
}); |
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.
This should be
{Boolean}
, right?