insert entities into the bsp tree for later renderer queuing based on vis

rather than directly into the queue. gives a 6.6% speedup for bigass1,
maybe slight loss for demo1 and definitly minor loss for nullrendering.
However, it gives us potential access to info we wouldn't otherwise have
ready access to.
This commit is contained in:
Bill Currie 2004-03-11 04:13:12 +00:00
parent 1fe06c326b
commit 8e9da44d7d
2 changed files with 26 additions and 15 deletions

View file

@ -484,7 +484,6 @@ CL_LerpPoint (void)
static void static void
CL_RelinkEntities (void) CL_RelinkEntities (void)
{ {
entity_t **_ent;
entity_t *ent; entity_t *ent;
cl_entity_state_t *state; cl_entity_state_t *state;
dlight_t *dl; dlight_t *dl;
@ -520,7 +519,7 @@ CL_RelinkEntities (void)
for (i = 1, state = cl_baselines + 1; i < cl.num_entities; i++, state++) { for (i = 1, state = cl_baselines + 1; i < cl.num_entities; i++, state++) {
ent = state->ent; ent = state->ent;
if (!ent->model) { // empty slot if (!ent->model) { // empty slot
if (state->forcelink) if (ent->efrag)
R_RemoveEfrags (ent); // just became empty R_RemoveEfrags (ent); // just became empty
continue; continue;
} }
@ -528,15 +527,21 @@ CL_RelinkEntities (void)
if (state->msgtime != cl.mtime[0]) { if (state->msgtime != cl.mtime[0]) {
ent->model = NULL; ent->model = NULL;
ent->pose1 = ent->pose2 = -1; ent->pose1 = ent->pose2 = -1;
if (ent->efrag)
R_RemoveEfrags (ent); // just became empty
continue; continue;
} }
VectorCopy (ent->origin, ent->old_origin); if (state->forcelink) {
// The entity was not updated in the last message so move to the
if (state->forcelink) { // The entity was not updated in the last // final spot
// message so move to the final spot if (i != cl.viewentity || chase_active->int_val) {
} else { // If the delta is large, assume a teleport if (ent->efrag)
// and don't lerp R_RemoveEfrags (ent);
R_AddEfrags (ent);
}
} else {
// If the delta is large, assume a teleport and don't lerp
f = frac; f = frac;
VectorSubtract (state->msg_origins[0], VectorSubtract (state->msg_origins[0],
state->msg_origins[1], delta); state->msg_origins[1], delta);
@ -558,7 +563,19 @@ CL_RelinkEntities (void)
ent->angles[j] = state->msg_angles[1][j] + f * d; ent->angles[j] = state->msg_angles[1][j] + f * d;
} }
} }
if (i != cl.viewentity || chase_active->int_val) {
if (ent->efrag) {
if (!VectorCompare (ent->origin, ent->old_origin)) {
R_RemoveEfrags (ent);
R_AddEfrags (ent);
} }
} else {
R_AddEfrags (ent);
}
}
}
VectorCopy (ent->origin, ent->old_origin);
// rotate binary objects locally // rotate binary objects locally
if (ent->model->flags & EF_ROTATE) if (ent->model->flags & EF_ROTATE)
@ -612,12 +629,6 @@ CL_RelinkEntities (void)
R_GlowTrail (ent, state->glow_color); R_GlowTrail (ent, state->glow_color);
state->forcelink = false; state->forcelink = false;
if (i == cl.viewentity && !chase_active->int_val) {
continue;
}
if ((_ent = R_NewEntity ()))
*_ent = ent;
} }
} }

View file

@ -393,7 +393,7 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
ent = NEXT_EDICT (&sv_pr_state, sv.edicts); ent = NEXT_EDICT (&sv_pr_state, sv.edicts);
for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) { for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
// ignore if not touching a PV leaf // ignore if not touching a PV leaf
if (ent != clent) { // clent is ALLWAYS sent if (ent != clent) { // clent is ALWAYS sent
// ignore ents without visible models // ignore ents without visible models
if (!SVfloat (ent, modelindex) || if (!SVfloat (ent, modelindex) ||
!*PR_GetString (&sv_pr_state, SVstring (ent, model))) !*PR_GetString (&sv_pr_state, SVstring (ent, model)))