Пример #1
0
/*
 * R_MarkLights
 *
 * Iterates the world surfaces (and those of BSP sub-models), populating the
 * light source bit masks so that we know which light sources each surface
 * should receive.
 */
void R_MarkLights(void) {
	int i, j;

	r_locals.light_frame++;

	if (r_locals.light_frame == 0x7fff) // avoid overflows
		r_locals.light_frame = 0;

	R_AddSustainedLights();

	// flag all surfaces for each light source
	for (i = 0; i < r_view.num_lights; i++) {

		r_light_t *light = &r_view.lights[i];

		// world surfaces
		R_MarkLights_(light, vec3_origin, 1 << i, r_world_model->nodes);

		// and bsp entity surfaces
		for (j = 0; j < r_view.num_entities; j++) {

			r_entity_t *e = &r_view.entities[j];

			if (e->model && e->model->type == mod_bsp_submodel) {
				e->model->lights = 0;
				R_MarkLights_(light, e->origin, 1 << i, e->model->nodes);
			}
		}
	}
}
Пример #2
0
/*
 * @brief Recurses the world, populating the light source bit masks of surfaces
 * that receive light.
 */
void R_MarkLights(void) {
	const r_bsp_model_t *bsp = r_model_state.world->bsp;
	const r_light_t *l = r_view.lights;

	R_AddSustainedLights();

	r_locals.light_frame++;

	if (r_locals.light_frame == INT16_MAX) // avoid overflows
		r_locals.light_frame = 0;

	// mark each light against the world

	for (uint16_t i = 0; i < r_view.num_lights; i++, l++) {
		R_MarkLight(l, bsp->nodes);
	}
}