use bevy::prelude::*;
use bevy_third_person_camera::ThirdPersonCameraTarget;

use crate::cleanup;

pub fn setup(
    mut c: Commands,
    asset_server: Res<AssetServer>,
    mut meshes: ResMut<Assets<Mesh>>,
    mut materials: ResMut<Assets<StandardMaterial>>,
) {
    let scene_handle = asset_server.load(GltfAssetLabel::Scene(0).from_asset("gltf/test.glb"));
    c.spawn((
        Mesh3d(meshes.add(Cuboid::new(1., 1., 1.))),
        MeshMaterial3d(materials.add(Color::BLACK)),
        ThirdPersonCameraTarget,
        cleanup::Scene,
    ));
    c.spawn(SceneRoot(scene_handle));
    info!("Scene spawned!")
}
