Fix component pool entity removal

This commit is contained in:
Hugo Mårdbrink 2025-08-26 22:01:28 +02:00
parent 77c5c23cf5
commit 6d43f30c09
5 changed files with 48 additions and 18 deletions

View file

@ -218,7 +218,6 @@ render_system_update :: proc(render_system: ^RenderSystem, coordinator: ^Coordin
for entity in render_system.entities {
transform := coordinator_get_component(TransformComponent, coordinator, entity)
color := coordinator_get_component(ColorComponent, coordinator, entity)
mesh_id := coordinator_get_component(MeshComponent, coordinator, entity).mesh_id
mesh := render_system.meshes[mesh_id]
@ -226,9 +225,17 @@ render_system_update :: proc(render_system: ^RenderSystem, coordinator: ^Coordin
material_id := coordinator_get_component(MaterialComponent, coordinator, entity).material_id
material := render_system.materials[material_id]
color := coordinator_get_component(ColorComponent, coordinator, entity)
scale_mat := linalg.matrix4_scale_f32(transform.scale)
rot_mat := linalg.matrix4_from_yaw_pitch_roll_f32(
transform.rotation.y,
transform.rotation.x,
transform.rotation.z
)
pos_mat := linalg.matrix4_translate_f32(transform.position)
rot_mat := linalg.matrix4_from_yaw_pitch_roll_f32(transform.rotation.y, transform.rotation.x, transform.rotation.z)
model := pos_mat * rot_mat
model := pos_mat * rot_mat * scale_mat
mvp := proj * view * model
sg.apply_pipeline(material.pipeline)
sg.apply_bindings({
@ -240,8 +247,8 @@ render_system_update :: proc(render_system: ^RenderSystem, coordinator: ^Coordin
})
sg.apply_uniforms(shaders.UB_VsParams, sg_range(&shaders.Vsparams{
mvp = proj * view * model,
col = color.color
mvp = mvp,
col = color.color,
}))
sg.draw(0, 36, 1)