mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-22 20:00:53 +00:00
Merge branch 'janhohenheim-light-processing' into bevy_main
This commit is contained in:
commit
6378aa9706
28
Cargo.toml
28
Cargo.toml
@ -1,22 +1,12 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"crates/bevy_gltf_components",
|
"crates/*",
|
||||||
"crates/bevy_gltf_blueprints",
|
"examples/common",
|
||||||
"crates/bevy_gltf_save_load",
|
"examples/bevy_gltf_components/*",
|
||||||
"crates/bevy_registry_export",
|
"examples/bevy_gltf_blueprints/*",
|
||||||
|
"examples/bevy_gltf_save_load/*",
|
||||||
"examples/common/",
|
"examples/bevy_registry_export/*",
|
||||||
|
"testing/bevy_example/",
|
||||||
"examples/bevy_gltf_components/basic/",
|
|
||||||
"examples/bevy_gltf_blueprints/basic/",
|
|
||||||
"examples/bevy_gltf_blueprints/basic_xpbd_physics/",
|
|
||||||
"examples/bevy_gltf_blueprints/animation/",
|
|
||||||
"examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles",
|
|
||||||
"examples/bevy_gltf_blueprints/materials/",
|
|
||||||
"examples/bevy_gltf_save_load/basic/",
|
|
||||||
"examples/bevy_registry_export/basic",
|
|
||||||
|
|
||||||
"testing/bevy_example"
|
|
||||||
]
|
]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
@ -30,6 +20,10 @@ match_same_arms = "warn"
|
|||||||
semicolon_if_nothing_returned = "warn"
|
semicolon_if_nothing_returned = "warn"
|
||||||
|
|
||||||
#### --------------------Dev/ debug-------------------------------
|
#### --------------------Dev/ debug-------------------------------
|
||||||
|
# Enable a small amount of optimization in debug mode
|
||||||
|
[profile.dev]
|
||||||
|
opt-level = 1
|
||||||
|
|
||||||
# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
|
# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
|
||||||
[profile.dev.package."*"]
|
[profile.dev.package."*"]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
|
@ -13,10 +13,9 @@ license = "MIT OR Apache-2.0"
|
|||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dev-dependencies]
|
[dependencies]
|
||||||
|
bevy_gltf_components = { version = "0.5", path = "../bevy_gltf_components" }
|
||||||
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] }
|
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] }
|
||||||
|
|
||||||
[dependencies]
|
[dev-dependencies]
|
||||||
#bevy_gltf_components = "0.3"
|
bevy = { version = "0.13", default-features = false, features = ["dynamic_linking"] }
|
||||||
bevy_gltf_components = { path = "../bevy_gltf_components" }
|
|
||||||
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] }
|
|
@ -13,10 +13,10 @@ license = "MIT OR Apache-2.0"
|
|||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
|
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
|
||||||
serde = "1.0.188"
|
serde = "1.0.188"
|
||||||
ron = "0.8.1"
|
ron = "0.8.1"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
bevy = { version = "0.13", default-features = false, features = ["dynamic_linking"] }
|
8
crates/bevy_gltf_components/src/blender_settings.rs
Normal file
8
crates/bevy_gltf_components/src/blender_settings.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
use bevy::prelude::*;
|
||||||
|
|
||||||
|
mod lighting;
|
||||||
|
pub use lighting::*;
|
||||||
|
|
||||||
|
pub(crate) fn plugin(app: &mut App) {
|
||||||
|
app.add_plugins(lighting::plugin);
|
||||||
|
}
|
69
crates/bevy_gltf_components/src/blender_settings/lighting.rs
Normal file
69
crates/bevy_gltf_components/src/blender_settings/lighting.rs
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
use bevy::pbr::DirectionalLightShadowMap;
|
||||||
|
use bevy::prelude::*;
|
||||||
|
|
||||||
|
pub(crate) fn plugin(app: &mut App) {
|
||||||
|
app.register_type::<BlenderBackgroundShader>()
|
||||||
|
.register_type::<BlenderShadowSettings>()
|
||||||
|
.add_systems(
|
||||||
|
Update,
|
||||||
|
(process_lights, process_shadowmap, process_background_shader),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The background color as described by Blender's [background shader](https://docs.blender.org/manual/en/latest/render/shader_nodes/shader/background.html).
|
||||||
|
#[derive(Component, Reflect, Default, Debug, PartialEq, Clone)]
|
||||||
|
#[reflect(Component)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
pub struct BlenderBackgroundShader {
|
||||||
|
pub color: Color,
|
||||||
|
pub strength: f32,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The settings used by EEVEE's [shadow rendering](https://docs.blender.org/manual/en/latest/render/eevee/render_settings/shadows.html).
|
||||||
|
#[derive(Component, Reflect, Default, Debug, PartialEq, Clone)]
|
||||||
|
#[reflect(Component)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
pub struct BlenderShadowSettings {
|
||||||
|
pub cascade_size: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn process_lights(
|
||||||
|
mut directional_lights: Query<&mut DirectionalLight, Added<DirectionalLight>>,
|
||||||
|
mut spot_lights: Query<&mut SpotLight, Added<SpotLight>>,
|
||||||
|
mut point_lights: Query<&mut PointLight, Added<PointLight>>,
|
||||||
|
) {
|
||||||
|
for mut light in directional_lights.iter_mut() {
|
||||||
|
light.shadows_enabled = true;
|
||||||
|
}
|
||||||
|
for mut light in spot_lights.iter_mut() {
|
||||||
|
light.shadows_enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for mut light in point_lights.iter_mut() {
|
||||||
|
light.shadows_enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn process_shadowmap(
|
||||||
|
shadowmaps: Query<&BlenderShadowSettings, Added<BlenderShadowSettings>>,
|
||||||
|
mut commands: Commands,
|
||||||
|
) {
|
||||||
|
for shadowmap in shadowmaps.iter() {
|
||||||
|
commands.insert_resource(DirectionalLightShadowMap {
|
||||||
|
size: shadowmap.cascade_size,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn process_background_shader(
|
||||||
|
background_shaders: Query<&BlenderBackgroundShader, Added<BlenderBackgroundShader>>,
|
||||||
|
mut commands: Commands,
|
||||||
|
) {
|
||||||
|
for background_shader in background_shaders.iter() {
|
||||||
|
commands.insert_resource(AmbientLight {
|
||||||
|
color: background_shader.color,
|
||||||
|
// Just a guess, see <https://github.com/bevyengine/bevy/issues/12280>
|
||||||
|
brightness: background_shader.strength * 400.0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,8 @@ pub use ronstring_to_reflect_component::*;
|
|||||||
pub mod process_gltfs;
|
pub mod process_gltfs;
|
||||||
pub use process_gltfs::*;
|
pub use process_gltfs::*;
|
||||||
|
|
||||||
|
pub mod blender_settings;
|
||||||
|
|
||||||
use bevy::{
|
use bevy::{
|
||||||
app::Startup,
|
app::Startup,
|
||||||
ecs::{component::Component, reflect::ReflectComponent, system::{Res, Resource}},
|
ecs::{component::Component, reflect::ReflectComponent, system::{Res, Resource}},
|
||||||
@ -82,7 +84,8 @@ fn check_for_legacy_mode(gltf_components_config: Res<GltfComponentsConfig>) {
|
|||||||
|
|
||||||
impl Plugin for ComponentsFromGltfPlugin {
|
impl Plugin for ComponentsFromGltfPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.register_type::<GltfProcessed>()
|
app.add_plugins(blender_settings::plugin)
|
||||||
|
.register_type::<GltfProcessed>()
|
||||||
.insert_resource(GltfComponentsConfig {
|
.insert_resource(GltfComponentsConfig {
|
||||||
legacy_mode: self.legacy_mode,
|
legacy_mode: self.legacy_mode,
|
||||||
})
|
})
|
||||||
|
@ -13,10 +13,10 @@ license = "MIT OR Apache-2.0"
|
|||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
|
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
|
||||||
#bevy_gltf_blueprints = "0.9"
|
#bevy_gltf_blueprints = "0.9"
|
||||||
bevy_gltf_blueprints = { path = "../bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { version = "0.9", path = "../bevy_gltf_blueprints" }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
bevy = { version = "0.13", default-features = false, features = ["dynamic_linking"] }
|
||||||
|
@ -10,12 +10,12 @@ categories = ["game-development"]
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = { version = "0.13", default-features = false, features = ["bevy_scene"] }
|
bevy = { version = "0.13", default-features = false, features = ["bevy_scene"] }
|
||||||
bevy_reflect = { version = "0.13", default-features = false }
|
bevy_reflect = { version = "0.13", default-features = false }
|
||||||
bevy_app = { version = "0.13", default-features = false, features = ["bevy_reflect"] }
|
bevy_app = { version = "0.13", default-features = false, features = ["bevy_reflect"] }
|
||||||
bevy_ecs = { version = "0.13", default-features = false, features = ["bevy_reflect"] }
|
bevy_ecs = { version = "0.13", default-features = false, features = ["bevy_reflect"] }
|
||||||
serde_json = "1.0.108"
|
serde_json = "1.0.108"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
bevy = { version = "0.13", default-features = false, features = ["dynamic_linking"] }
|
@ -17,7 +17,7 @@ pub fn export_types(world: &mut World) {
|
|||||||
|
|
||||||
let asset_root = world.resource::<AssetRoot>();
|
let asset_root = world.resource::<AssetRoot>();
|
||||||
let registry_save_path = Path::join(&asset_root.0, &config.save_path);
|
let registry_save_path = Path::join(&asset_root.0, &config.save_path);
|
||||||
println!("registry_save_path {:?}", registry_save_path);
|
println!("registry_save_path {}", registry_save_path.display());
|
||||||
let writer = File::create(registry_save_path).expect("should have created schema file");
|
let writer = File::create(registry_save_path).expect("should have created schema file");
|
||||||
|
|
||||||
let types = world.resource_mut::<AppTypeRegistry>();
|
let types = world.resource_mut::<AppTypeRegistry>();
|
||||||
|
@ -5,8 +5,8 @@ edition = "2021"
|
|||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.13"
|
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
@ -5,8 +5,8 @@ edition = "2021"
|
|||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.13"
|
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
Binary file not shown.
@ -5,8 +5,8 @@ edition = "2021"
|
|||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.13"
|
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" , default-features = false, features = ["blueprints", "physics_xpbd"]}
|
bevy_gltf_worlflow_examples_common = { path = "../../common", default-features = false, features = ["blueprints", "physics_xpbd"] }
|
||||||
bevy_xpbd_3d = "0.4"
|
bevy_xpbd_3d = "0.4"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
@ -5,8 +5,8 @@ edition = "2021"
|
|||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.13"
|
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
@ -5,8 +5,8 @@ edition = "2021"
|
|||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.13"
|
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -5,6 +5,6 @@ edition = "2021"
|
|||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.13"
|
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||||
bevy_gltf_components = { path = "../../../crates/bevy_gltf_components" }
|
bevy_gltf_components = { path = "../../../crates/bevy_gltf_components" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
|
@ -5,13 +5,12 @@ edition = "2021"
|
|||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.13"
|
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||||
#bevy_gltf_blueprints = "0.7"
|
|
||||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_gltf_save_load = { path = "../../../crates/bevy_gltf_save_load" }
|
bevy_gltf_save_load = { path = "../../../crates/bevy_gltf_save_load" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
|
|
||||||
serde_json="1.0.108"
|
serde_json = "1.0.108"
|
||||||
serde="1.0.193"
|
serde = "1.0.193"
|
||||||
bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
@ -5,9 +5,9 @@ edition = "2021"
|
|||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.13"
|
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_registry_export = { path = "../../../crates/bevy_registry_export" }
|
bevy_registry_export = { path = "../../../crates/bevy_registry_export" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||||
bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
@ -3455,6 +3455,50 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"typeInfo": "Struct"
|
"typeInfo": "Struct"
|
||||||
},
|
},
|
||||||
|
"bevy_gltf_components::blender_settings::lighting::BlenderBackgroundShader": {
|
||||||
|
"additionalProperties": false,
|
||||||
|
"isComponent": true,
|
||||||
|
"isResource": false,
|
||||||
|
"properties": {
|
||||||
|
"color": {
|
||||||
|
"type": {
|
||||||
|
"$ref": "#/$defs/bevy_render::color::Color"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strength": {
|
||||||
|
"type": {
|
||||||
|
"$ref": "#/$defs/f32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"color",
|
||||||
|
"strength"
|
||||||
|
],
|
||||||
|
"short_name": "BlenderBackgroundShader",
|
||||||
|
"title": "bevy_gltf_components::blender_settings::lighting::BlenderBackgroundShader",
|
||||||
|
"type": "object",
|
||||||
|
"typeInfo": "Struct"
|
||||||
|
},
|
||||||
|
"bevy_gltf_components::blender_settings::lighting::BlenderShadowSettings": {
|
||||||
|
"additionalProperties": false,
|
||||||
|
"isComponent": true,
|
||||||
|
"isResource": false,
|
||||||
|
"properties": {
|
||||||
|
"cascade_size": {
|
||||||
|
"type": {
|
||||||
|
"$ref": "#/$defs/usize"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"cascade_size"
|
||||||
|
],
|
||||||
|
"short_name": "BlenderShadowSettings",
|
||||||
|
"title": "bevy_gltf_components::blender_settings::lighting::BlenderShadowSettings",
|
||||||
|
"type": "object",
|
||||||
|
"typeInfo": "Struct"
|
||||||
|
},
|
||||||
"bevy_gltf_worlflow_examples_common::core::camera::camera_replace_proxies::SSAOSettings": {
|
"bevy_gltf_worlflow_examples_common::core::camera::camera_replace_proxies::SSAOSettings": {
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"isComponent": true,
|
"isComponent": true,
|
||||||
@ -3512,7 +3556,7 @@
|
|||||||
"type": "array",
|
"type": "array",
|
||||||
"typeInfo": "TupleStruct"
|
"typeInfo": "TupleStruct"
|
||||||
},
|
},
|
||||||
"bevy_gltf_worlflow_examples_common::core::lighting::lighting_replace_proxies::AmbientLightSettings": {
|
"bevy_gltf_worlflow_examples_common::core::lighting::lighting_replace_proxies::BlenderBackgroundShader": {
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"isComponent": true,
|
"isComponent": true,
|
||||||
"isResource": false,
|
"isResource": false,
|
||||||
@ -3532,12 +3576,12 @@
|
|||||||
"color",
|
"color",
|
||||||
"brightness"
|
"brightness"
|
||||||
],
|
],
|
||||||
"short_name": "AmbientLightSettings",
|
"short_name": "BlenderBackgroundShader",
|
||||||
"title": "bevy_gltf_worlflow_examples_common::core::lighting::lighting_replace_proxies::AmbientLightSettings",
|
"title": "bevy_gltf_worlflow_examples_common::core::lighting::lighting_replace_proxies::BlenderBackgroundShader",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"typeInfo": "Struct"
|
"typeInfo": "Struct"
|
||||||
},
|
},
|
||||||
"bevy_gltf_worlflow_examples_common::core::lighting::lighting_replace_proxies::ShadowmapSettings": {
|
"bevy_gltf_worlflow_examples_common::core::lighting::lighting_replace_proxies::BlenderShadowSettings": {
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"isComponent": true,
|
"isComponent": true,
|
||||||
"isResource": false,
|
"isResource": false,
|
||||||
@ -3551,8 +3595,8 @@
|
|||||||
"required": [
|
"required": [
|
||||||
"size"
|
"size"
|
||||||
],
|
],
|
||||||
"short_name": "ShadowmapSettings",
|
"short_name": "BlenderShadowSettings",
|
||||||
"title": "bevy_gltf_worlflow_examples_common::core::lighting::lighting_replace_proxies::ShadowmapSettings",
|
"title": "bevy_gltf_worlflow_examples_common::core::lighting::lighting_replace_proxies::BlenderShadowSettings",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"typeInfo": "Struct"
|
"typeInfo": "Struct"
|
||||||
},
|
},
|
||||||
|
@ -5,17 +5,17 @@ edition = "2021"
|
|||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
blueprints=["dep:bevy_gltf_blueprints"]
|
blueprints = ["dep:bevy_gltf_blueprints"]
|
||||||
physics_rapier = ["dep:bevy_rapier3d"]
|
physics_rapier = ["dep:bevy_rapier3d"]
|
||||||
physics_xpbd = ["dep:bevy_xpbd_3d"]
|
physics_xpbd = ["dep:bevy_xpbd_3d"]
|
||||||
default = ["blueprints", "physics_rapier"]
|
default = ["blueprints", "physics_rapier"]
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.13"
|
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||||
bevy_gltf_blueprints = { path = "../../crates/bevy_gltf_blueprints", optional = true }
|
bevy_gltf_blueprints = { path = "../../crates/bevy_gltf_blueprints", optional = true }
|
||||||
bevy_rapier3d = { version = "0.25", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] , optional = true }
|
bevy_rapier3d = { version = "0.25", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"], optional = true }
|
||||||
bevy_xpbd_3d = { version = "0.4", optional = true }
|
bevy_xpbd_3d = { version = "0.4", optional = true }
|
||||||
bevy_asset_loader = { version = "0.20", features = ["standard_dynamic_assets" ]}
|
bevy_asset_loader = { version = "0.20", features = ["standard_dynamic_assets"] }
|
||||||
bevy_editor_pls = { version = "0.8" }
|
bevy_editor_pls = { version = "0.8" }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
use bevy::prelude::*;
|
|
||||||
|
|
||||||
use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder, DirectionalLightShadowMap};
|
|
||||||
|
|
||||||
#[derive(Component, Reflect, Default, Debug)]
|
|
||||||
#[reflect(Component)]
|
|
||||||
pub struct AmbientLightSettings {
|
|
||||||
pub color: Color,
|
|
||||||
pub brightness: f32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Component, Reflect, Default, Debug)]
|
|
||||||
#[reflect(Component)]
|
|
||||||
pub struct ShadowmapSettings {
|
|
||||||
pub size: usize,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn lighting_replace_proxies(
|
|
||||||
mut added_dirights: Query<(Entity, &mut DirectionalLight), Added<DirectionalLight>>,
|
|
||||||
mut added_spotlights: Query<&mut SpotLight, Added<SpotLight>>,
|
|
||||||
mut added_pointlights: Query<&mut PointLight, Added<PointLight>>,
|
|
||||||
|
|
||||||
added_ambient_proxies: Query<&AmbientLightSettings, Added<AmbientLightSettings>>,
|
|
||||||
added_shadowmap_settings: Query<&ShadowmapSettings, Added<ShadowmapSettings>>,
|
|
||||||
|
|
||||||
mut commands: Commands,
|
|
||||||
) {
|
|
||||||
for (entity, mut light) in added_dirights.iter_mut() {
|
|
||||||
// light.illuminance *= 5.0; // arbitrary/ eyeballed to match the levels of Blender
|
|
||||||
light.shadows_enabled = true;
|
|
||||||
let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder {
|
|
||||||
first_cascade_far_bound: 15.0,
|
|
||||||
maximum_distance: 135.0,
|
|
||||||
..default()
|
|
||||||
}
|
|
||||||
.into();
|
|
||||||
commands.entity(entity).insert(shadow_config);
|
|
||||||
}
|
|
||||||
for mut light in added_spotlights.iter_mut() {
|
|
||||||
light.shadows_enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for mut light in added_pointlights.iter_mut() {
|
|
||||||
// light.intensity *= 0.001; // arbitrary/ eyeballed to match the levels of Blender
|
|
||||||
light.shadows_enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for setting in added_shadowmap_settings.iter() {
|
|
||||||
commands.insert_resource(DirectionalLightShadowMap { size: setting.size });
|
|
||||||
}
|
|
||||||
|
|
||||||
for ambient in added_ambient_proxies.iter() {
|
|
||||||
println!("AMBIENT {:?} {}", ambient.color, ambient.brightness);
|
|
||||||
commands.insert_resource(AmbientLight {
|
|
||||||
color: ambient.color,
|
|
||||||
brightness: ambient.brightness, // * 4000.,
|
|
||||||
});
|
|
||||||
// FIXME: does this belong here ?
|
|
||||||
commands.insert_resource(ClearColor(ambient.color * ambient.brightness));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
mod lighting_replace_proxies;
|
|
||||||
use lighting_replace_proxies::*;
|
|
||||||
|
|
||||||
use bevy::pbr::NotShadowCaster;
|
|
||||||
use bevy::prelude::*;
|
|
||||||
|
|
||||||
pub struct LightingPlugin;
|
|
||||||
impl Plugin for LightingPlugin {
|
|
||||||
fn build(&self, app: &mut App) {
|
|
||||||
app.register_type::<AmbientLightSettings>()
|
|
||||||
.register_type::<ShadowmapSettings>()
|
|
||||||
// FIXME: adding these since they are missing
|
|
||||||
.register_type::<NotShadowCaster>()
|
|
||||||
.add_systems(PreUpdate, lighting_replace_proxies);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +1,6 @@
|
|||||||
pub mod camera;
|
pub mod camera;
|
||||||
pub use camera::*;
|
pub use camera::*;
|
||||||
|
|
||||||
pub mod lighting;
|
|
||||||
pub use lighting::*;
|
|
||||||
|
|
||||||
//pub mod relationships;
|
//pub mod relationships;
|
||||||
//pub use relationships::*;
|
//pub use relationships::*;
|
||||||
|
|
||||||
@ -22,6 +19,6 @@ use bevy::prelude::*;
|
|||||||
pub struct CorePlugin;
|
pub struct CorePlugin;
|
||||||
impl Plugin for CorePlugin {
|
impl Plugin for CorePlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_plugins((LightingPlugin, CameraPlugin, PhysicsPlugin));
|
app.add_plugins((CameraPlugin, PhysicsPlugin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = '1.76.0'
|
channel = 'stable'
|
||||||
|
@ -5,12 +5,12 @@ edition = "2021"
|
|||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy="0.12"
|
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||||
bevy_gltf_blueprints = { path = "../../crates/bevy_gltf_blueprints" }
|
bevy_gltf_blueprints = { path = "../../crates/bevy_gltf_blueprints" }
|
||||||
bevy_registry_export = { path = "../../crates/bevy_registry_export" }
|
bevy_registry_export = { path = "../../crates/bevy_registry_export" }
|
||||||
bevy_gltf_worlflow_examples_common = { path = "../../examples/common" }
|
bevy_gltf_worlflow_examples_common = { path = "../../examples/common" }
|
||||||
|
|
||||||
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||||
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
|
bevy_asset_loader = { version = "0.20", features = ["standard_dynamic_assets"] }
|
||||||
bevy_editor_pls = { version = "0.6" }
|
bevy_editor_pls = { version = "0.8" }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -6,10 +6,7 @@ pub struct CorePlugin;
|
|||||||
impl Plugin for CorePlugin {
|
impl Plugin for CorePlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_plugins((
|
app.add_plugins((
|
||||||
ExportRegistryPlugin {
|
ExportRegistryPlugin::default(),
|
||||||
save_path: "assets/registry.json".into(),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
BlueprintsPlugin {
|
BlueprintsPlugin {
|
||||||
legacy_mode: false,
|
legacy_mode: false,
|
||||||
library_folder: "models/library".into(),
|
library_folder: "models/library".into(),
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_editor_pls::prelude::*;
|
|
||||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||||
|
|
||||||
mod core;
|
mod core;
|
||||||
@ -15,8 +14,6 @@ fn main() {
|
|||||||
App::new()
|
App::new()
|
||||||
.add_plugins((
|
.add_plugins((
|
||||||
DefaultPlugins.set(AssetPlugin::default()),
|
DefaultPlugins.set(AssetPlugin::default()),
|
||||||
// editor
|
|
||||||
EditorPlugin::default(),
|
|
||||||
// our custom plugins
|
// our custom plugins
|
||||||
CommonPlugin,
|
CommonPlugin,
|
||||||
CorePlugin, // reusable plugins
|
CorePlugin, // reusable plugins
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
expected_custom_property_values = {'AComponentWithAnExtremlyExageratedOrMaybeNotButCouldBeNameOrWut': '()',
|
expected_custom_property_values = {'AComponentWithAnExtremlyExageratedOrMaybeNotButCouldBeNameOrWut': '()',
|
||||||
'Aabb': '(center: Vec3A(x:0.0, y:0.0, z:0.0), half_extents: Vec3A(x:0.0, y:0.0, z:0.0))',
|
'Aabb': '(center: Vec3A(x:0.0, y:0.0, z:0.0), half_extents: Vec3A(x:0.0, y:0.0, z:0.0))',
|
||||||
'AdditionalMassProperties': 'Mass(0.0)',
|
'AdditionalMassProperties': 'Mass(0.0)',
|
||||||
'AmbientLightSettings': '(brightness: 0.0, color: Rgba(red:1.0, green:1.0, blue:0.0, alpha:1.0))',
|
'BlenderBackgroundShader': '(strength: 0.0, color: Rgba(red:1.0, green:1.0, blue:0.0, alpha:1.0))',
|
||||||
'AnimationPlayer': '(animation: "", paused: true)',
|
'AnimationPlayer': '(animation: "", paused: true)',
|
||||||
'Animations': '(named_animations: "")',
|
'Animations': '(named_animations: "")',
|
||||||
'AutoAABBCollider': 'Cuboid',
|
'AutoAABBCollider': 'Cuboid',
|
||||||
@ -126,7 +126,7 @@ expected_custom_property_values = {'AComponentWithAnExtremlyExageratedOrMaybeNot
|
|||||||
'ScreenSpaceAmbientOcclusionSettings': '(quality_level: "")',
|
'ScreenSpaceAmbientOcclusionSettings': '(quality_level: "")',
|
||||||
'Sensor': '()',
|
'Sensor': '()',
|
||||||
'ShadowFilteringMethod': 'Hardware2x2',
|
'ShadowFilteringMethod': 'Hardware2x2',
|
||||||
'ShadowmapSettings': '(size: 0)',
|
'BlenderShadowSettings': '(cascade_size: 0)',
|
||||||
'SkinnedMesh': '(inverse_bindposes: Strong(""), joints: [])',
|
'SkinnedMesh': '(inverse_bindposes: Strong(""), joints: [])',
|
||||||
'Sleeping': '(angular_threshold: 0.0, linear_threshold: 0.0, sleeping: true)',
|
'Sleeping': '(angular_threshold: 0.0, linear_threshold: 0.0, sleeping: true)',
|
||||||
'SolverGroups': '(filters: (0), memberships: (0))',
|
'SolverGroups': '(filters: (0), memberships: (0))',
|
||||||
@ -193,7 +193,7 @@ expected_custom_property_values_randomized = {'AComponentWithAnExtremlyExagerate
|
|||||||
'Aabb': '(center: Vec3A(x:0.5714026093482971, y:0.42888906598091125, z:0.5780913233757019), half_extents: '
|
'Aabb': '(center: Vec3A(x:0.5714026093482971, y:0.42888906598091125, z:0.5780913233757019), half_extents: '
|
||||||
'Vec3A(x:0.20609822869300842, y:0.8133212327957153, z:0.8235888481140137))',
|
'Vec3A(x:0.20609822869300842, y:0.8133212327957153, z:0.8235888481140137))',
|
||||||
'AdditionalMassProperties': 'Mass(0.42888906598091125)',
|
'AdditionalMassProperties': 'Mass(0.42888906598091125)',
|
||||||
'AmbientLightSettings': '(brightness: 0.5714026093482971, color: Rgba(red:0.42888906598091125, '
|
'BlenderBackgroundShader': '(strength: 0.5714026093482971, color: Rgba(red:0.42888906598091125, '
|
||||||
'green:0.5780913233757019, blue:0.20609822869300842, alpha:0.8133212327957153))',
|
'green:0.5780913233757019, blue:0.20609822869300842, alpha:0.8133212327957153))',
|
||||||
'AnimationPlayer': '(animation: "", paused: true)',
|
'AnimationPlayer': '(animation: "", paused: true)',
|
||||||
'Animations': '(named_animations: "")',
|
'Animations': '(named_animations: "")',
|
||||||
@ -347,7 +347,7 @@ expected_custom_property_values_randomized = {'AComponentWithAnExtremlyExagerate
|
|||||||
'ScreenSpaceAmbientOcclusionSettings': '(quality_level: "")',
|
'ScreenSpaceAmbientOcclusionSettings': '(quality_level: "")',
|
||||||
'Sensor': '()',
|
'Sensor': '()',
|
||||||
'ShadowFilteringMethod': 'Jimenez14',
|
'ShadowFilteringMethod': 'Jimenez14',
|
||||||
'ShadowmapSettings': '(size: 73)',
|
'BlenderShadowSettings': '(cascade_size: 73)',
|
||||||
'SkinnedMesh': '(inverse_bindposes: Strong(""), joints: [0, 0])',
|
'SkinnedMesh': '(inverse_bindposes: Strong(""), joints: [0, 0])',
|
||||||
'Sleeping': '(angular_threshold: 0.5714026093482971, linear_threshold: 0.42888906598091125, sleeping: true)',
|
'Sleeping': '(angular_threshold: 0.5714026093482971, linear_threshold: 0.42888906598091125, sleeping: true)',
|
||||||
'SolverGroups': '(filters: (73), memberships: (4))',
|
'SolverGroups': '(filters: (73), memberships: (4))',
|
||||||
|
@ -17,9 +17,9 @@ def upsert_scene_components(scene, world, main_scene_names):
|
|||||||
lighting_components = make_empty('lighting_components_'+scene.name, [0,0,0], [0,0,0], [0,0,0], root_collection)
|
lighting_components = make_empty('lighting_components_'+scene.name, [0,0,0], [0,0,0], [0,0,0], root_collection)
|
||||||
|
|
||||||
if world is not None:
|
if world is not None:
|
||||||
lighting_components['AmbientLightSettings'] = ambient_color_to_component(world)
|
lighting_components['BlenderBackgroundShader'] = ambient_color_to_component(world)
|
||||||
|
|
||||||
lighting_components['ShadowmapSettings'] = scene_shadows_to_component(scene)
|
lighting_components['BlenderShadowSettings'] = scene_shadows_to_component(scene)
|
||||||
|
|
||||||
|
|
||||||
if scene.eevee.use_bloom:
|
if scene.eevee.use_bloom:
|
||||||
@ -40,22 +40,22 @@ def ambient_color_to_component(world):
|
|||||||
color = world.node_tree.nodes['Background'].inputs[0].default_value
|
color = world.node_tree.nodes['Background'].inputs[0].default_value
|
||||||
strength = world.node_tree.nodes['Background'].inputs[1].default_value
|
strength = world.node_tree.nodes['Background'].inputs[1].default_value
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print("failed to parse ambient color: Only backgroud is supported")
|
print("failed to parse ambient color: Only background is supported")
|
||||||
|
|
||||||
|
|
||||||
if color is not None and strength is not None:
|
if color is not None and strength is not None:
|
||||||
colorRgba = "Rgba(red: "+ str(color[0]) + ", green: "+ str(color[1]) + ", blue: " + str(color[2]) + ", alpha: "+ str(color[3]) + ")" # TODO: YIKES clean this up
|
colorRgba = f"Rgba(red: {color[0]}, green: {color[1]}, blue: {color[2]}, alpha: {color[3]})"
|
||||||
component = "( color:"+ str(colorRgba) +", brightness:"+str(strength)+")"
|
component = f"( color: {colorRgba}, strength: {strength})"
|
||||||
return component
|
return component
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def scene_shadows_to_component(scene):
|
def scene_shadows_to_component(scene):
|
||||||
cascade_resolution = scene.eevee.shadow_cascade_size
|
cascade_size = scene.eevee.shadow_cascade_size
|
||||||
component = "(size: "+ cascade_resolution +")"
|
component = f"(cascade_size: {cascade_size})"
|
||||||
return component
|
return component
|
||||||
|
|
||||||
def scene_bloom_to_component(scene):
|
def scene_bloom_to_component(scene):
|
||||||
component = "BloomSettings(intensity: "+ str(scene.eevee.bloom_intensity) +")"
|
component = f"BloomSettings(intensity: {scene.eevee.bloom_intensity})"
|
||||||
return component
|
return component
|
||||||
|
|
||||||
def scene_ao_to_component(scene):
|
def scene_ao_to_component(scene):
|
||||||
|
Loading…
Reference in New Issue
Block a user