-
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
Add geographic limit rectangle #6987
Conversation
Thanks for the pull request @likangning93!
Reviewers, don't forget to make sure that:
I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
f58f4d6
to
c94c510
Compare
Nice! Please update CHANGES. People have been asking for this feature for a while (even without projections). Does it work with both infinite scrolling and 2D map rotate modes? We should probably wait until after the release to merge this, even if we think it's ready. |
How hard would it be to get rid of the white seam at the IDL when east == west? |
I assumed the outline was for the screenshots, is there a need to have it at all in production? |
Whoops, sorry for the slow response.
Yes, outline was for screenshots and demos. I thought it would be helpful since we don't draw the backsides of terrain.
Not working, I'll try getting that fixed soon.
I think so, but using a limiter that that covers less than -180 to 180 longitude will be discontinuous: |
@@ -84,6 +84,13 @@ define([ | |||
vertexLogDepthDefine = 'DISABLE_GL_POSITION_LOG_DEPTH'; | |||
} | |||
|
|||
var geographicLimitRectangleFlag = 0; | |||
var geographicLimitRectangleDefine = ''; | |||
if (clippedByBoundaries) {//} && frameState.mode !== SceneMode.SCENE3D) { |
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.
Remove commented out code.
|
||
/** | ||
* A property specifying a {@link Rectangle} used to selectively prevent tiles outside a region from loading. | ||
* For limiting terrain in scenes that use custom projections or Proj4JS projections that cause overlapping tiles. |
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 would remove the line about custom projections since this would likely get merged before support is added for them and that is not the only use case.
Prevents tiles from loading and also clips tiles on the boundary?
It's strange that the performance drops in 2D only when showing the rectangles. I only get ~20 FPS. |
I'm seeing this in [EDIT] open here: #7018 |
Should be pretty easy in #6986, here's something that should work. Users might have to be careful with small polygons crossing the prime meridian though: [EDIT] that is a strange looking morph |
4085e92
to
5bae8b3
Compare
// Tropics of Cancer and Capricorn | ||
var coffeeBeltRectangle = Cesium.Rectangle.fromDegrees(-180, -23.43687, 180, 23.43687); | ||
|
||
viewer.scene.globe.geographicLimitRectangle = coffeeBeltRectangle; |
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.
Should this be called "cartographicLimitRectangle" given Cesium's Cartographic
type? Same question for this filename and throughout.
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.
Or just limitRectangle
, cullRectangle
, or whatever language is consistent with the rest of Cesium?
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.
Let's go with cartographicLimitRectangle
.
}); | ||
|
||
// Tropics of Cancer and Capricorn | ||
var coffeeBeltRectangle = Cesium.Rectangle.fromDegrees(-180, -23.43687, 180, 23.43687); |
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.
Append .0
when the intention is floating point.
Throughout.
@@ -155,6 +159,15 @@ vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat | |||
|
|||
void main() | |||
{ | |||
|
|||
#ifdef TILE_LIMIT_RECTANGLE |
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.
Is there a way to add a fast reject case to the vertex shader so that if the entire tile is outside the region, the vertex is moved beyond the camera like we do for billboards, etc.?
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.
It shouldn't be necessary, the limiter is tied into tileset visibility computation. Tiles completely outside bounds won't get drawn and tiles completely inside bounds won't receive shader modification.
Hi all, you forgot to update the documentation for the Globe class. The new member in the public API isn't mentioned there. It looks like it's a Rectangle that defaults to |
Can i use other shape ? |
@kenghuo only rectangle is supported at this time |
Needed for #6986, because some projections really really don't work well unless you clip out everything but the local area (EPSG 2039, for example).
This is distinct from clipping planes on the globe in that this respects curvy projections, which become possible in #6986. Keeping this separate also avoids adding extra complication to the clipping planes implementation.
Pretty pictures:
Coffee belt in 3D
Coffee belt in Columbus View