Skip to content

Commit

Permalink
Improved camera controls (#218)
Browse files Browse the repository at this point in the history
Signed-off-by: Reuben Thomas <reubenthomas123@gmail.com>
  • Loading branch information
reuben-thomas committed Jul 2, 2024
1 parent 32b8109 commit 9c44fe0
Show file tree
Hide file tree
Showing 10 changed files with 1,610 additions and 800 deletions.
1,138 changes: 486 additions & 652 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions rmf_site_editor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ gz-fuel = { git = "https://github.com/open-rmf/gz-fuel-rs", branch = "main" }
pathdiff = "*"
tera = "1.19.1"
ehttp = { version = "0.4", features = ["native-async"] }
nalgebra = "0.32.5"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
clap = { version = "4.0.10", features = ["color", "derive", "help", "usage", "suggestions"] }
Expand Down
25 changes: 25 additions & 0 deletions rmf_site_editor/src/interaction/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ use bevy_polyline::{
material::PolylineMaterial,
polyline::{Polyline, PolylineBundle},
};
use shape::UVSphere;

#[derive(Clone, Debug, Resource)]
pub struct InteractionAssets {
pub dagger_mesh: Handle<Mesh>,
pub dagger_material: Handle<StandardMaterial>,
pub halo_mesh: Handle<Mesh>,
pub halo_material: Handle<StandardMaterial>,
pub camera_control_mesh: Handle<Mesh>,
pub camera_control_orbit_material: Handle<StandardMaterial>,
pub camera_control_pan_material: Handle<StandardMaterial>,
pub arrow_mesh: Handle<Mesh>,
pub point_light_socket_mesh: Handle<Mesh>,
pub point_light_shine_mesh: Handle<Mesh>,
Expand Down Expand Up @@ -224,6 +228,10 @@ impl FromWorld for InteractionAssets {
let mut meshes = world.get_resource_mut::<Assets<Mesh>>().unwrap();
let dagger_mesh = meshes.add(make_dagger_mesh());
let halo_mesh = meshes.add(make_halo_mesh());
let camera_control_mesh = meshes.add(Mesh::from(UVSphere {
radius: 0.02,
..Default::default()
}));
let arrow_mesh = meshes.add(make_cylinder_arrow_mesh());
let point_light_socket_mesh = meshes.add(
make_cylinder(0.06, 0.02)
Expand Down Expand Up @@ -298,10 +306,24 @@ impl FromWorld for InteractionAssets {
});
let dagger_material = materials.add(StandardMaterial {
base_color: Color::WHITE,
emissive: Color::WHITE,
perceptual_roughness: 0.089,
metallic: 0.01,
..default()
});
let camera_control_orbit_material = materials.add(StandardMaterial {
base_color: Color::GREEN,
emissive: Color::GREEN,
depth_bias: f32::MAX,
unlit: true,
..default()
});
let camera_control_pan_material = materials.add(StandardMaterial {
base_color: Color::WHITE,
emissive: Color::WHITE,
unlit: true,
..default()
});
let light_cover_color = Color::rgb(0.6, 0.7, 0.8);
let physical_light_cover_material = materials.add(StandardMaterial {
base_color: light_cover_color,
Expand Down Expand Up @@ -401,6 +423,9 @@ impl FromWorld for InteractionAssets {
dagger_material,
halo_mesh,
halo_material,
camera_control_mesh,
camera_control_orbit_material,
camera_control_pan_material,
arrow_mesh,
point_light_socket_mesh,
point_light_shine_mesh,
Expand Down
Loading

0 comments on commit 9c44fe0

Please sign in to comment.