mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-18 00:23:14 +00:00
Load test model from glTF
This commit is contained in:
@@ -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
@@ -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()
|
||||
},
|
||||
|
||||
@@ -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()
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user