Guest User

Untitled

a guest
Feb 6th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. bool Frustum::testPointlight(std::pair<int, int> &result, std::vector<Plane> planes, Vector3 center, float radius) {
  2.  
  3.     int x0=-1, x1=-1;
  4.     for (int i = 0; i < planes.size(); i++) {
  5.         if (planes[i].DotCoordinate(center)   <= radius ) {
  6.             x0 = max(0,i-1);
  7.             break;
  8.         }
  9.     }
  10.     for (int i = planes.size()-1; i >= x0; i--) {
  11.         if (-planes[i].DotCoordinate(center) <= radius) {
  12.             x1 = min(i+1, planes.size() - 1);
  13.             break;
  14.         }
  15.     }
  16.    
  17.     if (x0 == -1 || x1 == -1) return false;
  18.     result.first = x0;
  19.     result.second = x1;
  20.     return true;
  21. }
Add Comment
Please, Sign In to add comment