- // create a temporary brush describing the area the light can affect in worldspace
- VectorNegate(r_view.frustum[0].normal, planes[ 0].normal);planes[ 0].dist = -r_view.frustum[0].dist;
- VectorNegate(r_view.frustum[1].normal, planes[ 1].normal);planes[ 1].dist = -r_view.frustum[1].dist;
- VectorNegate(r_view.frustum[2].normal, planes[ 2].normal);planes[ 2].dist = -r_view.frustum[2].dist;
- VectorNegate(r_view.frustum[3].normal, planes[ 3].normal);planes[ 3].dist = -r_view.frustum[3].dist;
- VectorNegate(r_view.frustum[4].normal, planes[ 4].normal);planes[ 4].dist = -r_view.frustum[4].dist;
- VectorSet (planes[ 5].normal, 1, 0, 0); planes[ 5].dist = maxs[0];
- VectorSet (planes[ 6].normal, -1, 0, 0); planes[ 6].dist = -mins[0];
- VectorSet (planes[ 7].normal, 0, 1, 0); planes[ 7].dist = maxs[1];
- VectorSet (planes[ 8].normal, 0, -1, 0); planes[ 8].dist = -mins[1];
- VectorSet (planes[ 9].normal, 0, 0, 1); planes[ 9].dist = maxs[2];
- VectorSet (planes[10].normal, 0, 0, -1); planes[10].dist = -mins[2];
-
- // turn the brush into a mesh
- memset(&mesh, 0, sizeof(rmesh_t));
- mesh.maxvertices = 256;
- mesh.vertex3f = vertex3f;
- mesh.epsilon2 = (1.0f / (32.0f * 32.0f));
- R_Mesh_AddBrushMeshFromPlanes(&mesh, 11, planes);
-
- // if that mesh is empty, the light is not visible at all
- if (!mesh.numvertices)
- return true;