diff --git a/.gitignore b/.gitignore index cff8396..ae80c13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ target assets/tmp assets/external -*.blend *.blend1 diff --git a/Cargo.lock b/Cargo.lock index f5cc033..87e7a5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -294,6 +294,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "611dd99f412e862610adb43e2243b16436c6d8009f6d9dbe8ce3d6d840b34029" dependencies = [ + "bevy_dylib", "bevy_internal", ] @@ -470,6 +471,15 @@ dependencies = [ "sysinfo", ] +[[package]] +name = "bevy_dylib" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3b3b76f0d7a4da8f944e5316f2d2d2af3bbb40d87508355993ea69afbc9411c" +dependencies = [ + "bevy_internal", +] + [[package]] name = "bevy_ecs" version = "0.13.0" diff --git a/Cargo.toml b/Cargo.toml index b1569b0..43d3a02 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -#bevy = { version = "0.13.0", features = ["dynamic_linking"] } -bevy = "0.13.0" +bevy = { version = "0.13.0", features = ["dynamic_linking"] } +#bevy = "0.13.0" # Enable a small amount of optimization in debug mode [profile.dev] diff --git a/assets/models/asteroid.blend b/assets/models/asteroid.blend new file mode 100644 index 0000000..49b788f Binary files /dev/null and b/assets/models/asteroid.blend differ diff --git a/assets/models/asteroid.glb b/assets/models/asteroid.glb new file mode 100644 index 0000000..f644685 Binary files /dev/null and b/assets/models/asteroid.glb differ diff --git a/assets/models/asteroid2.blend b/assets/models/asteroid2.blend new file mode 100644 index 0000000..5fcdd04 Binary files /dev/null and b/assets/models/asteroid2.blend differ diff --git a/assets/models/asteroid2.glb b/assets/models/asteroid2.glb new file mode 100644 index 0000000..e35c841 Binary files /dev/null and b/assets/models/asteroid2.glb differ diff --git a/assets/models/pizzeria.glb b/assets/models/pizzeria.glb index 5d11c4d..992824c 100644 Binary files a/assets/models/pizzeria.glb and b/assets/models/pizzeria.glb differ diff --git a/src/world.rs b/src/world.rs index bb1adf6..18ce81b 100644 --- a/src/world.rs +++ b/src/world.rs @@ -19,6 +19,8 @@ const PIZZERIA_SIZE: f32 = 30.0; //const ASSET_CUBEMAP: &str = "textures/cubemap-fs8.png"; //const ASSET_CUBEMAP_AR: &str = "textures/out.png"; const ASSET_ASTRONAUT: &str = "external/alien.glb#Scene0"; +const ASSET_ASTEROID1: &str = "models/asteroid.glb#Scene0"; +const ASSET_ASTEROID2: &str = "models/asteroid2.glb#Scene0"; const ASSET_PIZZERIA: &str = "models/pizzeria.glb#Scene0"; pub struct WorldPlugin; @@ -138,31 +140,37 @@ pub fn setup( )); // Generate a bunch of asteriods - let asteroid_color_handle = materials.add(StandardMaterial { - base_color: Color::rgb(0.25, 0.2, 0.2), - perceptual_roughness: 1.0, - ..default() - }); let maxdist = 10; for i in -maxdist..maxdist { for j in -maxdist..maxdist { for k in -maxdist..maxdist { let offset = 500.0; - let dist = 3e4; + let dist = 8e3; let wobble = dist/2.0; let (i, j, k) = (i as f32, j as f32, k as f32); + let asset = match ((i+j+k) as i32) % 2 { + 0 => ASSET_ASTEROID1, + _ => ASSET_ASTEROID2, + }; commands.spawn(( - actor::Actor::default(), - PbrBundle { - mesh: sphere_handle.clone(), - material: asteroid_color_handle.clone(), - transform: Transform::from_xyz( - offset + dist * i + wobble * (j+k/PI).sin() * (k+j/PI).cos(), - offset + dist * j + wobble * (k+i/PI).sin() * (i+k/PI).cos(), - offset + dist * k + wobble * (i+j/PI).sin() * (j+i/PI).cos(), - ).with_scale(Vec3::splat(ASTEROID_SIZE)), + actor::Actor { + v: Vec3::new(-0.00, 0.0, 0.35), + angular_momentum: Quat::from_euler(EulerRot::XYZ, 0.01, 0.01, 0.003), ..default() - } + }, + SceneBundle { + transform: Transform { + translation: Vec3::new( + offset + dist * i + wobble * (j+k/PI).sin() * (k+j/PI).cos(), + offset + dist * j + wobble * (k+i/PI).sin() * (i+k/PI).cos(), + offset + dist * k + wobble * (i+j/PI).sin() * (j+i/PI).cos(), + ), + rotation: Quat::from_rotation_y(-PI / 3.), + scale: Vec3::splat(ASTEROID_SIZE), + }, + scene: asset_server.load(asset), + ..default() + }, )); } }