v0.4.2: performance improvements to visibility checking
This commit is contained in:
parent
926b02ce65
commit
6627ba4736
|
@ -64,7 +64,7 @@ public class Gizmo {
|
||||||
if (camera != null) {
|
if (camera != null) {
|
||||||
return camera;
|
return camera;
|
||||||
} else if (parent != null) {
|
} else if (parent != null) {
|
||||||
return parent.camera();
|
return this.camera = parent.camera();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,10 +240,18 @@ public class Visual extends Gizmo {
|
||||||
|
|
||||||
if (c == null || !visible) return false;
|
if (c == null || !visible) return false;
|
||||||
|
|
||||||
float cx = c.scroll.x;
|
//x coord
|
||||||
float cy = c.scroll.y;
|
if (x > c.scroll.x + c.width)
|
||||||
float w = width();
|
return false;
|
||||||
float h = height();
|
else if (!(x >= c.scroll.x || x + width() >= c.scroll.x))
|
||||||
return x + w >= cx && y + h >= cy && x < cx + c.width && y < cy + c.height;
|
return false;
|
||||||
|
|
||||||
|
//y coord
|
||||||
|
if (y > c.scroll.y + c.height)
|
||||||
|
return false;
|
||||||
|
else if (!(y >= c.scroll.y || y + height() >= c.scroll.y))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user