Fix level reload not working when paused
This commit is contained in:
parent
073e65265a
commit
37736753e5
BIN
assets/blender/test_level_blend/NurbsPath.glb
(Stored with Git LFS)
BIN
assets/blender/test_level_blend/NurbsPath.glb
(Stored with Git LFS)
Binary file not shown.
BIN
assets/blender/test_level_blend/Plane.glb
(Stored with Git LFS)
BIN
assets/blender/test_level_blend/Plane.glb
(Stored with Git LFS)
Binary file not shown.
@ -15,7 +15,7 @@
|
||||
:scale (1.000000 1.000000 1.000000))
|
||||
(inst
|
||||
:model "assets/blender/testblend_blend/Gas_Station_Shop.glb"
|
||||
:pos (-7.000000 0.000000 -20.000000)
|
||||
:pos (-16.000000 0.000000 -18.000000)
|
||||
:rot (0.000000 0.000000 0.000000 1.000000)
|
||||
:scale (1.000000 1.000000 1.000000))
|
||||
(inst
|
||||
|
BIN
assets/blender/testblend_blend/Bakery.glb
(Stored with Git LFS)
BIN
assets/blender/testblend_blend/Bakery.glb
(Stored with Git LFS)
Binary file not shown.
BIN
assets/blender/testblend_blend/Fire_Station.glb
(Stored with Git LFS)
BIN
assets/blender/testblend_blend/Fire_Station.glb
(Stored with Git LFS)
Binary file not shown.
BIN
assets/blender/testblend_blend/Gas_Station_Shop.glb
(Stored with Git LFS)
BIN
assets/blender/testblend_blend/Gas_Station_Shop.glb
(Stored with Git LFS)
Binary file not shown.
BIN
assets/blender/testblend_blend/Green_House.glb
(Stored with Git LFS)
BIN
assets/blender/testblend_blend/Green_House.glb
(Stored with Git LFS)
Binary file not shown.
BIN
assets/blender/testblend_blend/Hotel.glb
(Stored with Git LFS)
BIN
assets/blender/testblend_blend/Hotel.glb
(Stored with Git LFS)
Binary file not shown.
@ -778,15 +778,15 @@ get_scene_desc :: proc(
|
||||
force_no_reload := false,
|
||||
) -> (
|
||||
scene: Scene_Desc,
|
||||
reloaded: bool,
|
||||
modtime: i64,
|
||||
) {
|
||||
asset, _, res := assetman_fetch_or_load(
|
||||
asset, mtime, _ := assetman_fetch_or_load(
|
||||
assetman,
|
||||
Asset_Key{path = path, type = .Scene},
|
||||
nil,
|
||||
force_no_reload,
|
||||
)
|
||||
return asset.(Scene_Desc), (res == .Loaded || res == .Reloaded)
|
||||
return asset.(Scene_Desc), mtime
|
||||
}
|
||||
|
||||
get_convex :: proc(assetman: ^Asset_Manager, path: cstring) -> (result: Loaded_Convex) {
|
||||
|
@ -49,6 +49,7 @@ Debug_Draw_State :: struct {
|
||||
|
||||
Scene :: struct {
|
||||
scene_desc_path: name.Name,
|
||||
modtime: i64,
|
||||
level_geoms: []physics.Level_Geom_Handle,
|
||||
}
|
||||
|
||||
@ -66,12 +67,13 @@ immediate_scene :: proc(world: ^World, scene: ^Scene, path: cstring) {
|
||||
tracy.Zone()
|
||||
path_name := name.from_cstring(path)
|
||||
|
||||
desc, reloaded := assets.get_scene_desc(&g_mem.assetman, path_name)
|
||||
desc, modtime := assets.get_scene_desc(&g_mem.assetman, path_name)
|
||||
|
||||
if reloaded || scene.scene_desc_path != path_name {
|
||||
if scene.scene_desc_path != path_name || scene.modtime != modtime {
|
||||
scene_destroy(world, scene)
|
||||
|
||||
scene.scene_desc_path = path_name
|
||||
scene.modtime = modtime
|
||||
scene.level_geoms = make([]physics.Level_Geom_Handle, len(desc.instances))
|
||||
|
||||
sim_state := physics.get_sim_state(&world.physics_scene)
|
||||
|
@ -140,6 +140,7 @@ copy_sim_state :: proc(dst: ^Sim_State, src: ^Sim_State) {
|
||||
dst.first_free_engine_plus_one = src.first_free_engine_plus_one
|
||||
dst.first_free_shape_plus_one = src.first_free_shape_plus_one
|
||||
|
||||
// TODO: shrink when possible
|
||||
resize(&dst.bodies, len(src.bodies))
|
||||
resize(&dst.suspension_constraints, len(src.suspension_constraints))
|
||||
resize(&dst.engines, len(src.engines))
|
||||
@ -174,10 +175,9 @@ copy_physics_scene :: proc(dst, src: ^Scene) {
|
||||
|
||||
dst.assetman = src.assetman
|
||||
dst.simulation_state_index = src.simulation_state_index
|
||||
src_sim_state := get_sim_state(src)
|
||||
dst_sim_state := get_sim_state(dst)
|
||||
|
||||
copy_sim_state(dst_sim_state, src_sim_state)
|
||||
copy_sim_state(&dst.simulation_states[0], &src.simulation_states[0])
|
||||
copy_sim_state(&dst.simulation_states[1], &src.simulation_states[1])
|
||||
copy_solver_state(&dst.solver_state, &src.solver_state)
|
||||
}
|
||||
|
||||
|
BIN
src_assets/test_level.blend
(Stored with Git LFS)
BIN
src_assets/test_level.blend
(Stored with Git LFS)
Binary file not shown.
BIN
src_assets/test_level.blend1
(Stored with Git LFS)
BIN
src_assets/test_level.blend1
(Stored with Git LFS)
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user