-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Globe Projection (PR2) #4640
Globe Projection (PR2) #4640
Conversation
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.
Nice, this looks like a fairly limited change. You have already done a good job making sure there are docs and tests, though I think adding a "Usage" section to the doc or a "project module developer's guide" would probably be a good idea. Just a bit more context on the use case to make it easy to understand why this function is there and how it should be used would be good.
In the background I also think it might be worth at start thinking about introducing WGS84 coordinates and just about how these project module functions would look. I am hoping we can take that opportunity to "conceptually generalize" this module.
@@ -53,6 +53,8 @@ const float TILE_SIZE = 512.0; | |||
const float PI = 3.1415926536; | |||
const float WORLD_SCALE = TILE_SIZE / (PI * 2.0); | |||
const vec3 ZERO_64_LOW = vec3(0.0); | |||
const float EARTH_RADIUS = 6370972.0; | |||
const float GLOBE_RADIUS = 256.0; |
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.
Add comments about units etc. Especially globe radius is not automatically clear. Why do we want globes to be in 256 units, some relation to flat WebMercator probably and maybe some choices we make in common space?
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.
1 common unit maps to 1 screen pixel at zoom=0. It is indeed arbitrary but offers roughly the same "zoom level" expectation as the web mercator projection.
@@ -123,6 +138,14 @@ vec4 project_position(vec4 position, vec3 position64Low) { | |||
); | |||
} | |||
} | |||
if (project_uProjectionMode == PROJECTION_MODE_GLOBE) { |
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.
Nit: These nested if statements are getting pretty big, may read cleaner if we have helper functions projectGlobe
projectFlat
etc.
For #4638
Change List
project_get_orientation_matrix
shader function