#pragma once #include #include /* extracts frustum from projection matrix */ static std::array frustum(const glm::mat4& mat) { /* Left, Right, Top, Bottom, Back, Front */ std::array ret; for (size_t i = 0; i < 3; i++) for (size_t j = 0; j < 4; j++) ret[i * 2][j] = mat[j].w + mat[j][i], ret[i * 2 + 1][j] = mat[j].w - mat[j][i]; return ret; }