WIP: load scene

This commit is contained in:
Nikolai Rodionov 2023-09-04 06:25:42 +02:00
parent 6db05b45ef
commit 182ae65e3f
Signed by: allanger
GPG Key ID: 19DB54039EBF8F10
7 changed files with 13 additions and 36 deletions

7
Cargo.lock generated
View File

@ -1821,6 +1821,7 @@ dependencies = [
"bytemuck",
"byteorder",
"color_quant",
"jpeg-decoder",
"num-rational",
"num-traits",
"png",
@ -1943,6 +1944,12 @@ dependencies = [
"libc",
]
[[package]]
name = "jpeg-decoder"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e"
[[package]]
name = "js-sys"
version = "0.3.64"

View File

@ -6,4 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bevy = "0.11.2"
bevy = {version = "0.11.2", features=["jpeg"]}

BIN
assets/models/city.glb (Stored with Git LFS)

Binary file not shown.

BIN
assets/models/mate/Mate.bin (Stored with Git LFS)

Binary file not shown.

BIN
assets/models/mate/Mate.gltf (Stored with Git LFS)

Binary file not shown.

BIN
assets/scene.glb (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,5 +1,4 @@
use bevy::prelude::*;
use bevy::gltf::Gltf;
fn main() {
App::new()
@ -17,35 +16,12 @@ fn setup(
) {
// plane
commands.spawn(SceneBundle{
scene: asset_server.load("models/city.glb#scene0"),
transform: Transform::from_xyz(0.3, 0.5, 0.3),
..default()
});
// commands.spawn(PbrBundle {
// mesh: meshes.add(shape::Plane::from_size(5.0).into()),
// material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()),
// ..default()
// });
// cube
commands.spawn(PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()),
transform: Transform::from_xyz(0.0, 0.5, 0.0),
..default()
});
// light
commands.spawn(PointLightBundle {
point_light: PointLight {
intensity: 1500.0,
shadows_enabled: true,
..default()
},
transform: Transform::from_xyz(4.0, 8.0, 4.0),
scene: asset_server.load("scene.glb#Scene0"),
..default()
});
// camera
commands.spawn(Camera3dBundle {
transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
transform: Transform::from_xyz(-10.0, 20.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
..default()
});
}