コード例 #1
0
ファイル: r_entity.cpp プロジェクト: AresAndy/ufoai
/**
 * @brief Merge sort for the entity list
 *
 * @note We can't use in-place merging of the entities array because there are references
 * in this array that must stay intact (references for tagged models e.g.).
 *
 * @return the first entity to render
 */
static entity_t* R_MergeSortEntList (entity_t* c)
{
	entity_t* a, *b;

	/* list containing one or no entities is already sorted by definition */
	if (c == nullptr || c->next == nullptr)
		return c;

	/* two element or longer lists are bisected */
	a = c;
	b = c->next;
	while (b != nullptr && b->next != nullptr) {
		c = c->next;
		b = b->next->next;
	}
	b = c->next;
	c->next = nullptr;

	/* these halves are sorted recursively, and merged into one sorted list */
	return R_MergeSortMerge(R_MergeSortEntList(a), R_MergeSortEntList(b));
}
コード例 #2
0
ファイル: r_entity.cpp プロジェクト: AresAndy/ufoai
/**
 * @sa R_GetEntityLists
 */
void R_DrawBlendMeshEntities (entity_t* ents)
{
	if (!ents)
		return;

	if (!(refdef.rendererFlags & RDF_NOWORLDMODEL)) {
		R_EnableLighting(r_state.model_program, true);
	}
	R_EnableBlend(true);

	R_DrawMeshEntities(R_MergeSortEntList(ents));

	R_EnableBlend(false);
	if (!(refdef.rendererFlags & RDF_NOWORLDMODEL)) {
		R_EnableLighting(nullptr, false);
		R_EnableGlowMap(nullptr);
	}
}
コード例 #3
0
ファイル: r_entity.c プロジェクト: kevlund/ufoai
/**
 * @sa R_GetEntityLists
 */
void R_DrawBlendMeshEntities (entity_t *ents)
{
	if (!ents)
		return;

	if (!(refdef.rendererFlags & RDF_NOWORLDMODEL)) {
		R_EnableLighting(r_state.world_program, qtrue);
	}
	R_EnableBlend(qtrue);

	R_DrawMeshEntities(R_MergeSortEntList(ents));

	R_EnableBlend(qfalse);
	if (!(refdef.rendererFlags & RDF_NOWORLDMODEL)) {
		R_EnableLighting(NULL, qfalse);
		R_EnableGlowMap(NULL);
	}
}