-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix footprint transform #4280
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
Open
timon-schelling
wants to merge
3
commits into
master
Choose a base branch
from
fix-footprint-transform
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix footprint transform #4280
Changes from all commits
Commits
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
This file contains hidden or 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 hidden or 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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -345,12 +345,10 @@ pub async fn render_output_cache<'a: 'n>( | |||||||||||||||||
| return data.eval(context.into_context()).await; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| let device_scale = render_params.scale; | ||||||||||||||||||
| let zoom = footprint.scale_magnitudes().x; | ||||||||||||||||||
| let zoom = footprint.scale_magnitudes().x / render_params.scale; | ||||||||||||||||||
|
Contributor
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. P1: Unvalidated Prompt for AI agents
Suggested change
|
||||||||||||||||||
| let rotation = footprint.decompose_rotation(); | ||||||||||||||||||
|
|
||||||||||||||||||
| let viewport_origin_offset = footprint.transform.translation; | ||||||||||||||||||
| let device_origin_offset = viewport_origin_offset * device_scale; | ||||||||||||||||||
| let device_origin_offset = footprint.transform.translation; | ||||||||||||||||||
| let viewport_bounds_device = AxisAlignedBbox { | ||||||||||||||||||
| start: -device_origin_offset, | ||||||||||||||||||
| end: footprint.resolution.as_dvec2() - device_origin_offset, | ||||||||||||||||||
|
|
@@ -361,7 +359,7 @@ pub async fn render_output_cache<'a: 'n>( | |||||||||||||||||
| let cache_key = CacheKey::new( | ||||||||||||||||||
| max_region_area, | ||||||||||||||||||
| render_params.render_mode as u64, | ||||||||||||||||||
| device_scale, | ||||||||||||||||||
| render_params.scale, | ||||||||||||||||||
| zoom, | ||||||||||||||||||
| rotation, | ||||||||||||||||||
| render_params.for_export, | ||||||||||||||||||
|
|
@@ -381,16 +379,7 @@ pub async fn render_output_cache<'a: 'n>( | |||||||||||||||||
| if missing_region.tiles.is_empty() { | ||||||||||||||||||
| continue; | ||||||||||||||||||
| } | ||||||||||||||||||
| let region = render_missing_region( | ||||||||||||||||||
| missing_region, | ||||||||||||||||||
| |ctx| data.eval(ctx), | ||||||||||||||||||
| ctx.clone(), | ||||||||||||||||||
| render_params, | ||||||||||||||||||
| &footprint.transform, | ||||||||||||||||||
| &viewport_origin_offset, | ||||||||||||||||||
| device_scale, | ||||||||||||||||||
| ) | ||||||||||||||||||
| .await; | ||||||||||||||||||
| let region = render_missing_region(missing_region, |ctx| data.eval(ctx), ctx.clone(), render_params, &footprint.transform, &device_origin_offset).await; | ||||||||||||||||||
| new_regions.push(region); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -406,7 +395,8 @@ pub async fn render_output_cache<'a: 'n>( | |||||||||||||||||
|
|
||||||||||||||||||
| let executor = executor.expect("GPU executor not available"); | ||||||||||||||||||
| let output_texture = executor.request_texture(physical_resolution).await; | ||||||||||||||||||
| let combined_metadata = composite_cached_regions(&all_regions, &output_texture, &device_origin_offset, &footprint.transform, &executor); | ||||||||||||||||||
|
|
||||||||||||||||||
| let combined_metadata = composite_cached_regions(&all_regions, &output_texture, &device_origin_offset, &footprint.transform, executor); | ||||||||||||||||||
|
|
||||||||||||||||||
| RenderOutput { | ||||||||||||||||||
| data: RenderOutputType::Texture(output_texture.into()), | ||||||||||||||||||
|
|
@@ -421,7 +411,6 @@ async fn render_missing_region<F, Fut>( | |||||||||||||||||
| render_params: &RenderParams, | ||||||||||||||||||
| viewport_transform: &DAffine2, | ||||||||||||||||||
| viewport_origin_offset: &DVec2, | ||||||||||||||||||
| device_scale: f64, | ||||||||||||||||||
| ) -> CachedRegion | ||||||||||||||||||
| where | ||||||||||||||||||
| F: Fn(Context<'static>) -> Fut, | ||||||||||||||||||
|
|
@@ -433,7 +422,7 @@ where | |||||||||||||||||
| let tile_count = (max_tile - min_tile) + IVec2::ONE; | ||||||||||||||||||
| let region_pixel_size = (tile_count * TILE_SIZE as i32).as_uvec2(); | ||||||||||||||||||
|
|
||||||||||||||||||
| let tile_global_offset = min_tile.as_dvec2() * (TILE_SIZE as f64 / device_scale) + *viewport_origin_offset; | ||||||||||||||||||
| let tile_global_offset = min_tile.as_dvec2() * TILE_SIZE as f64 + *viewport_origin_offset; | ||||||||||||||||||
| let region_transform = DAffine2::from_translation(-tile_global_offset) * *viewport_transform; | ||||||||||||||||||
| let region_footprint = Footprint { | ||||||||||||||||||
| transform: region_transform, | ||||||||||||||||||
|
|
||||||||||||||||||
This file contains hidden or 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 hidden or 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.
P2: Unconditional
1.0 / render_params.scalecan create non-finite transforms when scale is 0. Guard scale before inversion to avoid invalid SVG transform output.Prompt for AI agents