fix merge problem

This commit is contained in:
rewin
2024-01-26 22:08:37 +03:00
parent be93b20400
commit 9a648b892a
7 changed files with 51 additions and 23 deletions
+3
View File
@@ -179,6 +179,9 @@ fn process_focus_inputs(
// Zero out any existing camera velocity or interpolation
**velocity = Vec3::ZERO;
info!("Setting focus to {:?}", target);
if q_interp_vel.get(ent).is_ok() {
cmd.entity(ent).remove::<InterpVelocity>();
}
+9 -7
View File
@@ -3,9 +3,11 @@
use bevy::{app::PluginGroupBuilder, prelude::*};
use bevy_mod_picking::DefaultPickingPlugins;
use bevy_web_asset::WebAssetPlugin;
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;
mod bvh;
mod camera_controller;
mod debug;
mod design_system;
@@ -17,10 +19,10 @@ mod persistance;
mod scene;
mod skybox;
mod ui;
mod viewport;
pub mod viewport;
mod world_grid;
use crate::{
pub use crate::{
camera_controller::CameraControllerPlugin,
debug::DebugPlugin,
input::StudioInputPlugin,
@@ -188,7 +190,7 @@ pub fn start_editor(
// TODO: These `start_` functiions should be refactored to better support the
// needs of the "reaodnly viewer" vs "full studio editor" use cases. See
// notes in `studio-web/src/lib/viewer.element.ts` for more info.
#[cfg_attr(feature = "wasm", wasm_bindgen(js_name = start))]
pub fn start_internal(
object_id: &str,
skybox_id: &str,
@@ -196,7 +198,7 @@ pub fn start_internal(
canvas_alt: &str,
viewport_size: ViewportSize,
studio_mode: StudioMode,
) {
) -> App {
#[cfg(feature = "wasm")]
console_error_panic_hook::set_once();
@@ -210,6 +212,7 @@ pub fn start_internal(
app.add_plugins((
#[cfg(feature = "wasm")]
viewport::wasm::ViewportPlugin,
WebAssetPlugin,
DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
resolution: viewport_size.into(),
@@ -222,8 +225,7 @@ pub fn start_internal(
CommonPlugins,
));
if studio_mode == StudioMode::Editor {
info!("Starting in editor mode");
if matches!(studio_mode, StudioMode::Editor) {
app.add_plugins((DefaultPickingPlugins, EditorPlugins));
// Only for registering components for undo
@@ -242,5 +244,5 @@ pub fn start_internal(
#[cfg(feature = "wasm")]
wasm::initialize();
app.run();
app
}
+1 -1
View File
@@ -4,7 +4,7 @@ use studio::{StudioMode, ViewportSize};
fn main() {
// Edit the arguments here to change the default startup scene or skybox
let mut app = studio::start_internal(
"Mannequin.gltf",
"bookcase.gltf",
"gum_trees_4k",
"", // ignored for non-WASM
"Storyteller Studio",
+25 -5
View File
@@ -6,7 +6,7 @@ use bevy::{
tonemapping::Tonemapping,
},
gltf::Gltf,
math::vec2,
math::{vec2, Affine3A},
pbr::ShadowFilteringMethod,
prelude::*,
render::{mesh::skinning::SkinnedMesh, primitives::Aabb, view::NoFrustumCulling},
@@ -86,6 +86,7 @@ fn minimal_scene_setup(mut cmd: Commands) {
cmd.spawn(DirectionalLightBundle {
directional_light: DirectionalLight {
shadows_enabled: false,
illuminance: 20000.0,
..default()
},
transform: Transform::default().looking_at(Vec3::NEG_ONE, Vec3::Y),
@@ -176,6 +177,7 @@ pub struct SceneData {
#[derive(Component)]
pub struct SkeletalJoint(pub Color);
#[derive(Component)]
pub struct SceneRoot;
#[derive(Resource, Deref, DerefMut)]
pub struct TestBvh(pub Handle<Bvh>); // TODO
@@ -248,7 +250,7 @@ fn init_scene_loading(
cmd.spawn((
SpatialBundle::default(),
space_editor::prelude::GltfPrefab {
path: format!("gltf/{}.gltf", id.0),
path: format!("gltf/{}", id.0),
scene: "Scene0".to_string(),
},
PrefabMarker,
@@ -270,6 +272,9 @@ fn tick_scene_spawning(
}
}
#[derive(Component)]
pub struct NoMeshElement;
fn tag_scene_elements(
mut cmd: Commands,
// A "glTF mesh" is actually a container for one or more "glTF primitives",
@@ -280,18 +285,33 @@ fn tag_scene_elements(
// leafy parts of a plant. Here we only want to tag the elements that a user
// might want to individually address when arranging or animating a scene.
q_named_non_primitives: Query<
Entity,
(Entity,
&Children),
(
With<SceneAutoChild>,
With<Name>,
Without<Handle<Mesh>>,
Without<SceneElement>,
Without<NoMeshElement>
),
>,
q_skinned_meshes: Query<(Entity, &SkinnedMesh), Without<SkeletalJoint>>,
mut q_xforms: ParamSet<(TransformHelper, Query<&Transform>)>,
mesh_entities: Query<Entity, With<Handle<Mesh>>>,
) {
for loaded_part in q_named_non_primitives.iter() {
cmd.entity(loaded_part).insert(SceneElement);
for (e, children) in q_named_non_primitives.iter() {
let mut has_mesh = false;
for child in children {
if mesh_entities.contains(*child) {
has_mesh = true;
break;
}
}
if has_mesh {
cmd.entity(e).insert(SceneElement);
} else {
cmd.entity(e).insert(NoMeshElement);
}
}
for (ent, skinned_mesh) in q_skinned_meshes.iter()