Skip to content

Commit

Permalink
Hot asset reloading
Browse files Browse the repository at this point in the history
  • Loading branch information
cart committed May 17, 2020
1 parent 623c8a8 commit 870f715
Show file tree
Hide file tree
Showing 20 changed files with 586 additions and 145 deletions.
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ path = "examples/app/headless.rs"
name = "plugin"
path = "examples/app/plugin.rs"

[[example]]
name = "hot_asset_reload"
path = "examples/asset/hot_asset_reload.rs"

[[example]]
name = "asset_loading"
path = "examples/asset/asset_loading.rs"

[[example]]
name = "custom_diagnostic"
path = "examples/diagnostics/custom_diagnostic.rs"
Expand Down
Binary file added assets/models/cube/cube.bin
Binary file not shown.
122 changes: 122 additions & 0 deletions assets/models/cube/cube.gltf
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"asset" : {
"generator" : "Khronos glTF Blender I/O v1.1.46",
"version" : "2.0"
},
"scene" : 0,
"scenes" : [
{
"name" : "Scene",
"nodes" : [
0
]
}
],
"nodes" : [
{
"mesh" : 0,
"name" : "Cube"
}
],
"materials" : [
{
"doubleSided" : true,
"emissiveFactor" : [
0,
0,
0
],
"name" : "Material",
"pbrMetallicRoughness" : {
"baseColorFactor" : [
0.800000011920929,
0.800000011920929,
0.800000011920929,
1
],
"metallicFactor" : 0,
"roughnessFactor" : 0.4000000059604645
}
}
],
"meshes" : [
{
"name" : "Cube",
"primitives" : [
{
"attributes" : {
"POSITION" : 0,
"NORMAL" : 1,
"TEXCOORD_0" : 2
},
"indices" : 3,
"material" : 0
}
]
}
],
"accessors" : [
{
"bufferView" : 0,
"componentType" : 5126,
"count" : 24,
"max" : [
1,
1,
1
],
"min" : [
-1,
-1,
-1
],
"type" : "VEC3"
},
{
"bufferView" : 1,
"componentType" : 5126,
"count" : 24,
"type" : "VEC3"
},
{
"bufferView" : 2,
"componentType" : 5126,
"count" : 24,
"type" : "VEC2"
},
{
"bufferView" : 3,
"componentType" : 5123,
"count" : 36,
"type" : "SCALAR"
}
],
"bufferViews" : [
{
"buffer" : 0,
"byteLength" : 288,
"byteOffset" : 0
},
{
"buffer" : 0,
"byteLength" : 288,
"byteOffset" : 288
},
{
"buffer" : 0,
"byteLength" : 192,
"byteOffset" : 576
},
{
"buffer" : 0,
"byteLength" : 72,
"byteOffset" : 768
}
],
"buffers" : [
{
"byteLength" : 840,
"uri" : "cube.bin"
}
]
}
Binary file added assets/models/sphere/sphere.bin
Binary file not shown.
100 changes: 100 additions & 0 deletions assets/models/sphere/sphere.gltf
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"asset" : {
"generator" : "Khronos glTF Blender I/O v1.1.46",
"version" : "2.0"
},
"scene" : 0,
"scenes" : [
{
"name" : "Scene",
"nodes" : [
0
]
}
],
"nodes" : [
{
"mesh" : 0,
"name" : "Sphere"
}
],
"meshes" : [
{
"name" : "Sphere",
"primitives" : [
{
"attributes" : {
"POSITION" : 0,
"NORMAL" : 1,
"TEXCOORD_0" : 2
},
"indices" : 3
}
]
}
],
"accessors" : [
{
"bufferView" : 0,
"componentType" : 5126,
"count" : 2143,
"max" : [
1.0000005960464478,
1,
1.000001072883606
],
"min" : [
-1.000000238418579,
-1,
-1
],
"type" : "VEC3"
},
{
"bufferView" : 1,
"componentType" : 5126,
"count" : 2143,
"type" : "VEC3"
},
{
"bufferView" : 2,
"componentType" : 5126,
"count" : 2143,
"type" : "VEC2"
},
{
"bufferView" : 3,
"componentType" : 5123,
"count" : 11904,
"type" : "SCALAR"
}
],
"bufferViews" : [
{
"buffer" : 0,
"byteLength" : 25716,
"byteOffset" : 0
},
{
"buffer" : 0,
"byteLength" : 25716,
"byteOffset" : 25716
},
{
"buffer" : 0,
"byteLength" : 17144,
"byteOffset" : 51432
},
{
"buffer" : 0,
"byteLength" : 23808,
"byteOffset" : 68576
}
],
"buffers" : [
{
"byteLength" : 92384,
"uri" : "sphere.bin"
}
]
}
7 changes: 6 additions & 1 deletion crates/bevy_asset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ version = "0.1.0"
authors = ["Carter Anderson <mcanders1@gmail.com>"]
edition = "2018"

[features]
default = ["filesystem_watcher"]
filesystem_watcher = ["notify"]

[dependencies]
bevy_app = { path = "../bevy_app" }
bevy_core = { path = "../bevy_core" }
Expand All @@ -12,4 +16,5 @@ legion = { path = "../bevy_legion" }
uuid = { version = "0.8", features = ["v4", "serde"] }
crossbeam-channel = "0.4.2"
anyhow = "1.0"
thiserror = "1.0"
thiserror = "1.0"
notify = { version = "5.0.0-pre.2", optional = true }
55 changes: 0 additions & 55 deletions crates/bevy_asset/src/asset_path.rs

This file was deleted.

Loading

0 comments on commit 870f715

Please sign in to comment.