ulfben

Clipping test - Viewport::inView()

Feb 14th, 2017
819
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. //the fixed clipping test. :)
  2. public boolean inView(final PointF worldPos, final float objectWidth, final float objectHeight) {
  3.     float maxX = (mCurrentViewportWorldCentre.x + mHalfDistX);
  4.     float minX = (mCurrentViewportWorldCentre.x - mHalfDistX)-objectWidth;
  5.     float maxY = (mCurrentViewportWorldCentre.y + mHalfDistY);
  6.     float minY  = (mCurrentViewportWorldCentre.y - mHalfDistY)-objectHeight;
  7.     if((worldPos.x > minX && worldPos.x < maxX)
  8.             && (worldPos.y > minY && worldPos.y < maxY)){
  9.         return true;
  10.     }
  11.     mClippedCount++; //for debugging
  12.     return false;
  13. }
Advertisement
Comments
  • Gyqizv
    17 days
    # text 0.21 KB | 0 0
    1. Best t33n active cpx link daily updates!
    2.  
    3. Copy and paste the link in a new browser tab and then hit enter!
    4.  
    5. https://crazyporn.@xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400
    6.  
    7. Remove the @
Add Comment
Please, Sign In to add comment