ulfben icon

Clipping test - Viewport::inView()

ulfben | PRO | 02/14/17 10:50:56 PM UTC | 0 ⭐ | 1134 👁️ | Never ⏰ | []
Java |

560 B

|

None

|

0 👍

/

0 👎

//the fixed clipping test. :)
public boolean inView(final PointF worldPos, final float objectWidth, final float objectHeight) {
    float maxX = (mCurrentViewportWorldCentre.x + mHalfDistX);
    float minX = (mCurrentViewportWorldCentre.x - mHalfDistX)-objectWidth;
    float maxY = (mCurrentViewportWorldCentre.y + mHalfDistY);
    float minY  = (mCurrentViewportWorldCentre.y - mHalfDistY)-objectHeight;
    if((worldPos.x > minX && worldPos.x < maxX)
            && (worldPos.y > minY && worldPos.y < maxY)){
        return true;
    }
    mClippedCount++; //for debugging
    return false;
}

Comments

  • Gyqizv icon
    04/02/26 05:41:42 PM UTC
    text |

    0 B

    |

    0 👍

    /

    0 👎

    Best t33n active cpx link daily updates!
     Copy and paste the link in a new browser tab and then hit enter!
     https://crazyporn.@xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400
     Remove the @ 
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎