Added gltf asset load, plugin call for bevy_blender and GlftAssetType
This commit is contained in:
parent
50539f2ac9
commit
bb681decf5
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -759,6 +759,17 @@ dependencies = [
|
|||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bevy_gltf_components"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cd745a2988c631286404e12d184d4a30a634fbbba1deceaaa1ca7fcbc607cc7a"
|
||||||
|
dependencies = [
|
||||||
|
"bevy",
|
||||||
|
"ron",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bevy_hanabi"
|
name = "bevy_hanabi"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
@ -1914,6 +1925,7 @@ dependencies = [
|
|||||||
"bevy-inspector-egui",
|
"bevy-inspector-egui",
|
||||||
"bevy-trait-query",
|
"bevy-trait-query",
|
||||||
"bevy_editor_pls",
|
"bevy_editor_pls",
|
||||||
|
"bevy_gltf_components",
|
||||||
"bevy_hanabi",
|
"bevy_hanabi",
|
||||||
"bevy_rapier3d",
|
"bevy_rapier3d",
|
||||||
]
|
]
|
||||||
|
@ -21,3 +21,4 @@ bevy_editor_pls = "0.6"
|
|||||||
bevy_rapier3d = { version = "0.23", features = ["debug-render-3d"] }
|
bevy_rapier3d = { version = "0.23", features = ["debug-render-3d"] }
|
||||||
bevy_hanabi = { version = "0.8", default-features = false, features = [ "3d" ] }
|
bevy_hanabi = { version = "0.8", default-features = false, features = [ "3d" ] }
|
||||||
bevy-trait-query = "0.4.0"
|
bevy-trait-query = "0.4.0"
|
||||||
|
bevy_gltf_components = "0.2.0"
|
||||||
|
@ -7,3 +7,4 @@ pub mod inventory_screen;
|
|||||||
pub mod muzzle_flash;
|
pub mod muzzle_flash;
|
||||||
pub mod player;
|
pub mod player;
|
||||||
pub mod settings_screen;
|
pub mod settings_screen;
|
||||||
|
pub mod proxy;
|
0
src/comps/core/markers/proxy/mod.rs
Normal file
0
src/comps/core/markers/proxy/mod.rs
Normal file
@ -2,6 +2,7 @@
|
|||||||
#![feature(trivial_bounds)]
|
#![feature(trivial_bounds)]
|
||||||
#![feature(return_position_impl_trait_in_trait)]
|
#![feature(return_position_impl_trait_in_trait)]
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
|
use bevy_gltf_components::ComponentsFromGltfPlugin;
|
||||||
use bevy_rapier3d::prelude::*;
|
use bevy_rapier3d::prelude::*;
|
||||||
use scenes::scene1;
|
use scenes::scene1;
|
||||||
use ui::{editor::plugin::MainEditorUiPlugin, game::plugin::MainGameUIPlugin};
|
use ui::{editor::plugin::MainEditorUiPlugin, game::plugin::MainGameUIPlugin};
|
||||||
@ -27,6 +28,7 @@ fn main() {
|
|||||||
fn setup_plugins(application: &mut App) {
|
fn setup_plugins(application: &mut App) {
|
||||||
application
|
application
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(DefaultPlugins)
|
||||||
|
.add_plugins(ComponentsFromGltfPlugin)
|
||||||
//.add_plugins(DefaultInspectorConfigPlugin)
|
//.add_plugins(DefaultInspectorConfigPlugin)
|
||||||
.add_plugins(RapierPhysicsPlugin::<NoUserData>::default())
|
.add_plugins(RapierPhysicsPlugin::<NoUserData>::default())
|
||||||
//.add_plugins(bevy_egui::EguiPlugin)
|
//.add_plugins(bevy_egui::EguiPlugin)
|
||||||
|
@ -10,6 +10,7 @@ use super::load_state::GameLoadState;
|
|||||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Reflect)]
|
#[derive(PartialEq, Eq, PartialOrd, Ord, Reflect)]
|
||||||
pub enum GltfAssetType {
|
pub enum GltfAssetType {
|
||||||
Firearm(Firearm),
|
Firearm(Firearm),
|
||||||
|
Character,
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
Enemy,
|
Enemy,
|
||||||
}
|
}
|
||||||
@ -44,8 +45,12 @@ pub fn load_all_assets(
|
|||||||
asset_type: GltfAssetType::Firearm(Firearm::Glock17),
|
asset_type: GltfAssetType::Firearm(Firearm::Glock17),
|
||||||
asset: asset_server.load(Firearm::Glock17.firearm_data().asset_path),
|
asset: asset_server.load(Firearm::Glock17.firearm_data().asset_path),
|
||||||
};
|
};
|
||||||
|
let main_character_asset = GltfAsset {
|
||||||
|
asset_type: GltfAssetType::Character,
|
||||||
|
asset: asset_server.load("character/main_character.glb"),
|
||||||
|
};
|
||||||
commands.insert_resource(GltfAssets {
|
commands.insert_resource(GltfAssets {
|
||||||
assets: Vec::from([m4a1_gltf_asset, glock17_gltf_asset]),
|
assets: Vec::from([m4a1_gltf_asset, glock17_gltf_asset, main_character_asset]),
|
||||||
});
|
});
|
||||||
game_load_state.assets_loaded = true;
|
game_load_state.assets_loaded = true;
|
||||||
// This works becaue this system is called on startup, so commands will finish running when game starts the update phase.
|
// This works becaue this system is called on startup, so commands will finish running when game starts the update phase.
|
||||||
|
Loading…
Reference in New Issue
Block a user