Load test model from glTF

This commit is contained in:
Danny McGee
2023-10-03 18:07:42 -04:00
parent 82157bd54a
commit 90e504501d
4 changed files with 29048 additions and 10 deletions
@@ -28,6 +28,7 @@ const mimeTypes = {
".png": "image/png",
".jpg": "image/jpeg",
".gif": "image/gif",
".gltf": "model/gltf+json",
".hdr": "image/vnd.radiance",
".ktx": "image/ktx",
".ktx2": "image/ktx",
File diff suppressed because one or more lines are too long
+4 -1
View File
@@ -2,6 +2,7 @@ use std::f32::consts;
use bevy::{
input::mouse::{MouseButton, MouseMotion},
math::vec3,
prelude::*,
window::{CursorGrabMode, PrimaryWindow},
};
@@ -46,7 +47,8 @@ enum ControlMode {
}
fn spawn_camera(mut cmd: Commands) {
let camera_xform = Transform::from_xyz(-2.5, 3.0, 5.0).looking_at(Vec3::ZERO, Vec3::Y);
let focus = vec3(0., 1.5, 0.);
let camera_xform = Transform::from_xyz(-2.5, 4.5, 5.0).looking_at(focus, Vec3::Y);
cmd.spawn((
Camera3dBundle {
@@ -58,6 +60,7 @@ fn spawn_camera(mut cmd: Commands) {
..default()
},
OrbitCam {
focus,
radius: camera_xform.translation.length(),
..default()
},
+4 -9
View File
@@ -27,18 +27,13 @@ struct WorldGridPlane;
fn spawn_scene(
mut cmd: Commands,
assets: Res<AssetServer>,
mut meshes: ResMut<Assets<Mesh>>,
mut std_mats: ResMut<Assets<StandardMaterial>>,
mut mat_proc_grid: ResMut<Assets<ProceduralGridMaterial>>,
) {
// Sphere
cmd.spawn(PbrBundle {
mesh: meshes.add(Mesh::try_from(shape::Icosphere::default()).unwrap()),
material: std_mats.add(StandardMaterial {
base_color: Color::WHITE,
..default()
}),
transform: Transform::IDENTITY,
// Skeletal mesh
cmd.spawn(SceneBundle {
scene: assets.load("gltf/base_human_male.gltf#Scene0"),
..default()
});