mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 12:31:10 +00:00
[vulkan] Set entity render id correctly
It was being set to -1 unconditionally due to forgetting to use id. However, I decided I didn't like reusing the id var and did some renaming while I was at it.
This commit is contained in:
parent
9f9e21f1dc
commit
f37c31a2dc
1 changed files with 10 additions and 11 deletions
|
@ -75,21 +75,20 @@ Vulkan_Scene_AddEntity (vulkan_ctx_t *ctx, entity_t entity)
|
|||
scnframe_t *sframe = &sctx->frames.a[ctx->curFrame];
|
||||
|
||||
entdata_t *entdata = 0;
|
||||
int render_id = -1;
|
||||
//lock
|
||||
int id = Ent_Index (entity.id + 1);//nullent -> 0
|
||||
if (!set_is_member (sframe->pooled_entities, id)) {
|
||||
int ent_id = Ent_Index (entity.id + 1);//nullent -> 0
|
||||
if (!set_is_member (sframe->pooled_entities, ent_id)) {
|
||||
if (sframe->entity_pool.size < sframe->entity_pool.maxSize) {
|
||||
set_add (sframe->pooled_entities, id);
|
||||
id = sframe->entity_pool.size++;
|
||||
entdata = sframe->entity_pool.a + id;
|
||||
} else {
|
||||
id = -1;
|
||||
set_add (sframe->pooled_entities, ent_id);
|
||||
render_id = sframe->entity_pool.size++;
|
||||
entdata = sframe->entity_pool.a + render_id;
|
||||
}
|
||||
}
|
||||
if (Entity_Valid (entity)) {
|
||||
renderer_t *renderer = Ent_GetComponent (entity.id, scene_renderer,
|
||||
r_refdef.scene->reg);
|
||||
renderer->render_id = -1;
|
||||
entity.reg);
|
||||
renderer->render_id = render_id;
|
||||
}
|
||||
//unlock
|
||||
if (entdata) {
|
||||
|
@ -98,7 +97,7 @@ Vulkan_Scene_AddEntity (vulkan_ctx_t *ctx, entity_t entity)
|
|||
if (Entity_Valid (entity)) { //FIXME give world entity an entity :P
|
||||
transform_t transform = Entity_Transform (entity);
|
||||
renderer_t *renderer = Ent_GetComponent (entity.id, scene_renderer,
|
||||
r_refdef.scene->reg);
|
||||
entity.reg);
|
||||
mat4ftranspose (f, Transform_GetWorldMatrixPtr (transform));
|
||||
entdata->xform[0] = f[0];
|
||||
entdata->xform[1] = f[1];
|
||||
|
@ -112,7 +111,7 @@ Vulkan_Scene_AddEntity (vulkan_ctx_t *ctx, entity_t entity)
|
|||
}
|
||||
entdata->color = color;
|
||||
}
|
||||
return id;
|
||||
return render_id;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue