Skip to content

Commit f06983d

Browse files
Fix texture cache region size and broken rendering when tilting the viewport (#3867)
* Fix rotation for render cache * Simplify code and fix zoom not invalidating cache * Add constant for quantization amount * fix region size * print error when splitting oversized region fails --------- Co-authored-by: Timon <me@timon.zip>
1 parent 52d2b38 commit f06983d

2 files changed

Lines changed: 93 additions & 109 deletions

File tree

node-graph/libraries/core-types/src/transform.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,15 @@ impl Footprint {
123123

124124
pub fn viewport_bounds_in_local_space(&self) -> AxisAlignedBbox {
125125
let inverse = self.transform.inverse();
126-
let start = inverse.transform_point2((0., 0.).into());
127-
let end = inverse.transform_point2(self.resolution.as_dvec2());
128-
AxisAlignedBbox { start, end }
126+
let res = self.resolution.as_dvec2();
127+
let c0 = inverse.transform_point2(DVec2::ZERO);
128+
let c1 = inverse.transform_point2(DVec2::new(res.x, 0.));
129+
let c2 = inverse.transform_point2(res);
130+
let c3 = inverse.transform_point2(DVec2::new(0., res.y));
131+
AxisAlignedBbox {
132+
start: c0.min(c1).min(c2).min(c3),
133+
end: c0.max(c1).max(c2).max(c3),
134+
}
129135
}
130136

131137
pub fn scale(&self) -> DVec2 {

0 commit comments

Comments
 (0)