Added dynamic size for max particles in particle systems, added fallback texture

This commit is contained in:
2025-06-15 15:07:16 +02:00
parent 69bafff6e9
commit 0692e0c8b7
2 changed files with 18 additions and 6 deletions

View File

@@ -37,11 +37,11 @@ Particle_System :: struct {
scene: *Scene;
}
create_particle_system :: (pipeline: Pipeline_State_Handle, update_func: (*Particle_System, float), owning_entity: *Entity = null, scene: *Scene = null) -> *Particle_System {
create_particle_system :: (pipeline: Pipeline_State_Handle, update_func: (*Particle_System, float), owning_entity: *Entity = null, scene: *Scene = null, max_particles := MAX_PARTICLES) -> *Particle_System {
lvl := ifx scene == null then engine.current_scene else scene;
particle_system, locator := find_and_occupy_empty_slot(*scene.particle_systems);
particle_system._locator = locator;
particle_system.vertex_buffer = create_vertex_buffer(engine.renderer, null, size_of(Particle_Vertex) * MAX_PARTICLES, stride=size_of(Particle_Vertex), mappable=true);
particle_system.vertex_buffer = create_vertex_buffer(engine.renderer, null, xx (size_of(Particle_Vertex) * max_particles), stride=size_of(Particle_Vertex), mappable=true);
particle_system.pipeline = pipeline;
particle_system.on_particle_update = update_func;
particle_system.owning_entity = owning_entity;