Scene loading fixes

This commit is contained in:
Daniel Bross
2025-01-09 22:02:23 +01:00
parent 4d97d7bc39
commit 040a5fa23a
5 changed files with 21 additions and 4 deletions

View File

@@ -33,6 +33,8 @@ Particle_System :: struct {
_locator: Bucket_Locator;
on_particle_update: (*Particle_System, float);
scene: *Scene;
}
create_particle_system :: (pipeline: Pipeline_State_Handle, update_func: (*Particle_System, float), owning_entity: *Entity = null, scene: *Scene = null) -> *Particle_System {
@@ -43,9 +45,15 @@ create_particle_system :: (pipeline: Pipeline_State_Handle, update_func: (*Parti
particle_system.pipeline = pipeline;
particle_system.on_particle_update = update_func;
particle_system.owning_entity = owning_entity;
particle_system.scene = scene;
return particle_system;
}
destroy_particle_system :: (system: *Particle_System) {
destroy_buffer(engine.renderer, system.vertex_buffer);
bucket_array_remove(*system.scene.particle_systems, system._locator);
}
spawn_particle :: (system: *Particle_System, position: Vector3, velocity: Vector3 = .{0,0,0}, size: float = 1.0, lifetime: float = 1.0, color: Vector4 = .{1,1,1,1}) {
particle: Particle;
particle.position = position;