Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool Frustum::testPointlight(std::pair<int, int> &result, std::vector<Plane> planes, Vector3 center, float radius) {
- int x0=-1, x1=-1;
- for (int i = 0; i < planes.size(); i++) {
- if (planes[i].DotCoordinate(center) <= radius ) {
- x0 = max(0,i-1);
- break;
- }
- }
- for (int i = planes.size()-1; i >= x0; i--) {
- if (-planes[i].DotCoordinate(center) <= radius) {
- x1 = min(i+1, planes.size() - 1);
- break;
- }
- }
- if (x0 == -1 || x1 == -1) return false;
- result.first = x0;
- result.second = x1;
- return true;
- }
Add Comment
Please, Sign In to add comment