mat4 view, proj;
vec3 frustumBox[2], boxInFrustum[2], finalBox[2];
glm_vec_broadcast(FLT_MAX, boxInFrustum[0]);
glm_vec_broadcast(-FLT_MAX, boxInFrustum[1]);
for (i = 0; i < objCount; i++)
glm_aabb_merge(boxInFrustum, objects[i]->bbox->world, boxInFrustum);
glm_look_anyup(cam->frustum.center, light->dir, view);
glm_frustum_box(cam->frustum.corners, view, frustumBox);
glm_aabb_transform(boxInFrustum, view, boxInFrustum);
glm_aabb_crop(frustumBox, boxInFrustum, finalBox);
glm_ortho_aabb(finalBox, proj);
glm_mat4_mul(proj, view, viewProj);