Exemplo n.º 1
0
/**
 * @brief Sorts the draw elements for the current frame. Once elements are
 * sorted, particles for the current frame are also updated.
 */
void R_SortElements(void *data) {

	R_AddBspSurfaceElements(&r_model_state.world->bsp->sorted_surfaces->blend, ELEMENT_BSP_SURFACE_BLEND);
	R_AddBspSurfaceElements(&r_model_state.world->bsp->sorted_surfaces->blend_warp, ELEMENT_BSP_SURFACE_BLEND_WARP);

	if (!r_element_state.count) {
		return;
	}

	R_SortElements_(r_element_state.elements, r_element_state.count);

	R_UpdateParticleState();

	R_SortParticles_(r_element_state.elements, r_element_state.count);
}
Exemplo n.º 2
0
/*
 * @brief Generates primitives for the specified particle elements. Each
 * particle's index into the shared array is written to the element's data
 * field.
 */
void R_UpdateParticles(r_element_t *e, const size_t count) {
	size_t i, j;

	R_UpdateParticleState();

	for (i = j = 0; i < count; i++, e++) {

		if (e->type == ELEMENT_PARTICLE) {
			r_particle_t *p = (r_particle_t *) e->element;

			R_ParticleVerts(p, &r_particle_state.verts[j * 3 * 4]);
			R_ParticleTexcoords(p, &r_particle_state.texcoords[j * 2 * 4]);
			R_ParticleColor(p, &r_particle_state.colors[j * 4 * 4]);

			e->data = (void *) (uintptr_t) j++;
		}
	}
}