mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-30 08:00:51 +00:00
d69355f521
While there's currently only the one still, this will allow the entities to be multiply queued for multi-pass rendering (eg, shadows). As the avoidance of putting an entity in the same queue more than once relies on the entity id, all entities now come from the scene (which is stored in cl_world in the client code for nq and qw), thus the extensive changes in the clients.
71 lines
1.6 KiB
C
71 lines
1.6 KiB
C
/*
|
|
entity.c
|
|
|
|
Entity management
|
|
|
|
Copyright (C) 2022 Bill Currke
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License
|
|
as published by the Free Software Foundation; either version 2
|
|
of the License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to:
|
|
|
|
Free Software Foundation, Inc.
|
|
59 Temple Place - Suite 330
|
|
Boston, MA 02111-1307, USA
|
|
|
|
*/
|
|
#ifdef HAVE_CONFIG_H
|
|
# include "config.h"
|
|
#endif
|
|
|
|
#include "QF/set.h"
|
|
|
|
#define IMPLEMENT_ENTITY_Funcs
|
|
|
|
#include "QF/scene/entity.h"
|
|
#include "QF/scene/scene.h"
|
|
|
|
#include "scn_internal.h"
|
|
|
|
entqueue_t *
|
|
EntQueue_New (int num_queues)
|
|
{
|
|
int size = sizeof (entqueue_t) + num_queues * sizeof (entityset_t);
|
|
entqueue_t *queue = calloc (1, size);
|
|
queue->queued_ents = set_new ();
|
|
queue->ent_queues = (entityset_t *) (queue + 1);
|
|
queue->num_queues = num_queues;
|
|
for (int i = 0; i < num_queues; i++) {
|
|
queue->ent_queues[i].grow = 64;
|
|
}
|
|
return queue;
|
|
}
|
|
|
|
void
|
|
EntQueue_Delete (entqueue_t *queue)
|
|
{
|
|
for (int i = 0; i < queue->num_queues; i++) {
|
|
DARRAY_CLEAR (&queue->ent_queues[i]);
|
|
}
|
|
set_delete (queue->queued_ents);
|
|
free (queue);
|
|
}
|
|
|
|
void
|
|
EntQueue_Clear (entqueue_t *queue)
|
|
{
|
|
for (int i = 0; i < queue->num_queues; i++) {
|
|
queue->ent_queues[i].size = 0;
|
|
}
|
|
set_empty (queue->queued_ents);
|
|
}
|