1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-08-30 18:25:36 +00:00

don't update render water surface framebuffer when off screen

more accurate check than previously; because the normal isOnScreen()
uses a bounding circle check... which gets pretty large for something
that spans the entire screen width.
This commit is contained in:
fgenesis 2024-04-28 04:04:30 +02:00
commit 8d1a0a1a8a
6 changed files with 89 additions and 40 deletions

View file

@ -645,6 +645,32 @@ Vector Core::getWindowPosition(const Vector &worldpos) const
return (worldpos - cameraPos) * globalScale.x;
}
bool Core::isRectInWindowCoordsPartiallyOnScreen(const Vector& center, const Vector& wh) const
{
const float xo = getVirtualOffX();
const float yo = getVirtualOffY();
const Vector topleft(-xo, -yo);
const Vector bottomright(800 + xo, 600 + yo);
const Vector half = wh * 0.5f;
const Vector a = topleft - half;
const Vector b = bottomright + half;
return center.x >= a.x && center.x <= b.x
&& center.y >= a.y && center.y <= b.y;
}
bool Core::isRectInWindowCoordsFullyOnScreen(const Vector& center, const Vector& wh) const
{
const float xo = getVirtualOffX();
const float yo = getVirtualOffY();
const Vector topleft(-xo, -yo);
const Vector bottomright(800 + xo, 600 + yo);
const Vector half = wh * 0.5f;
const Vector a = topleft + half;
const Vector b = bottomright - half;
return center.x >= a.x && center.x <= b.x
&& center.y >= a.y && center.y <= b.y;
}
bool Core::getMouseButtonState(int m)
{
int mcode=m;