- if (!mq_count)
- return;
- for (mq = mq_listhead;mq;mq = mq->next)
- mq->callback(mq->ent, mq->surfacenumber, mq->rtlight);
- mq_count = 0;
- mq_listhead = NULL;
-}
-
-static void R_MeshQueue_EnlargeTransparentArray(int newtotal)
-{
- meshqueue_t *newarray;
- newarray = (meshqueue_t *)Mem_Alloc(cls.permanentmempool, newtotal * sizeof(meshqueue_t));
- if (mqt_array)
- {
- memcpy(newarray, mqt_array, mqt_total * sizeof(meshqueue_t));
- Mem_Free(mqt_array);
- }
- mqt_array = newarray;
- mqt_total = newtotal;
-}
-
-void R_MeshQueue_Add(void (*callback)(const entity_render_t *ent, int surfacenumber, const rtlight_t *rtlight), const entity_render_t *ent, int surfacenumber, const rtlight_t *rtlight)
-{
- meshqueue_t *mq, **mqnext;
- if (r_meshqueue_immediaterender.integer)
- {
- callback(ent, surfacenumber, rtlight);
- return;
- }
- if (mq_count >= mq_total)
- R_MeshQueue_Render();
- mq = &mq_array[mq_count++];
- mq->callback = callback;
- mq->ent = ent;
- mq->surfacenumber = surfacenumber;
- mq->rtlight = rtlight;
-
- if (r_meshqueue_sort.integer)