Scene loading fixes
This commit is contained in:
@@ -10,7 +10,7 @@ Scene :: struct {
|
||||
|
||||
entities : [..] *Entity;
|
||||
|
||||
particle_systems : Bucket_Array(Particle_System, 64);
|
||||
particle_systems : Bucket_Array(Particle_System, 128);
|
||||
|
||||
by_type : Entity_Storage;
|
||||
|
||||
@@ -20,6 +20,7 @@ Scene :: struct {
|
||||
camera : Camera;
|
||||
directional_light : Directional_Light;
|
||||
|
||||
mode: Engine_Mode;
|
||||
}
|
||||
|
||||
Entity_File_Info :: struct {
|
||||
@@ -43,6 +44,7 @@ visitor :: (info : *File_Visit_Info, files: *[..] Entity_File_Info) {
|
||||
|
||||
load_scene :: (name: string) -> *Scene {
|
||||
scene := create_scene(name, 1024);
|
||||
scene.mode = engine.mode;
|
||||
|
||||
if engine.procs.on_scene_loaded != null {
|
||||
engine.procs.on_pre_scene_loaded(scene, engine.mode);
|
||||
@@ -125,6 +127,10 @@ save_scene :: (scene: *Scene, path: string) {
|
||||
}
|
||||
|
||||
unload_scene :: (scene: *Scene) {
|
||||
if engine.procs.on_pre_scene_unloaded != null {
|
||||
engine.procs.on_pre_scene_unloaded(scene);
|
||||
}
|
||||
|
||||
for e: scene.entities {
|
||||
destroy_entity(e);
|
||||
}
|
||||
@@ -165,6 +171,7 @@ create_scene :: (name: string = "", max_entities: s64 = 256) -> *Scene {
|
||||
}
|
||||
|
||||
scene.name = copy_string(new_name);
|
||||
scene.mode = engine.mode;
|
||||
|
||||
// Setup allocator
|
||||
scene.pool = .{};
|
||||
|
||||
Reference in New Issue
Block a user