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:
parent
56922a0b6e
commit
8d1a0a1a8a
6 changed files with 89 additions and 40 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue