Skip to content

Commit

Permalink
Merge branch 'main' into arjo/feat/offscreen_rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
arjo129 authored Aug 4, 2023
2 parents 366adce + d2fb61f commit 795ca6e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 16 deletions.
23 changes: 13 additions & 10 deletions rmf_site_editor/src/interaction/outline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,20 @@ impl OutlineVisualization {
}
}

// A strange issue is causing outlines to diverge at certain camera angles
// for objects that use the Flat depth. The issue doesn't seem to happen
// for objects with Real depth, so we are switching most objects to use the
// Real outline setting. However, I don't think this looks good for certain
// types of objects so we will keep the Flat setting for them and accept
// that certain camera angles can make their outline look strange.
//
// The relevant upstream issue is being tracked here: https://github.com/komadori/bevy_mod_outline/issues/14
// Flat outlines look better but are subject to glitches in wasm, use a feature flag to use
// Real outline depth in wasm and flat in other platforms.
// Tracking issue here https://github.com/komadori/bevy_mod_outline/issues/19
// TODO(luca) revisit once issue is solved
pub fn depth(&self) -> SetOutlineDepth {
SetOutlineDepth::Flat {
model_origin: Vec3::ZERO,
#[cfg(target_arch = "wasm32")]
{
SetOutlineDepth::Real
}
#[cfg(not(target_arch = "wasm32"))]
{
SetOutlineDepth::Flat {
model_origin: Vec3::ZERO,
}
}
}

Expand Down
30 changes: 24 additions & 6 deletions rmf_site_format/src/legacy/lift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ impl Lift {
// TODO(MXG): Rewrite this with glam now that we've accepted it as a dependency
let x = self.x as f32;
let y = self.y as f32;
let d = self.depth as f32 / 2.0;
let w = self.width as f32 / 2.0;
// NOTE: Coordinate axes changed between the legacy format and the
// new format. Width used to be along the local x axis, and depth
// used to be along the local y axis, but now that is flipped to
// better align with the robotics convention of the local x axis
// being forward/backward while the local y axis is the lateral
// direction (side-to-side).
let d = self.width as f32 / 2.0;
let w = self.depth as f32 / 2.0;
let theta = self.yaw as f32;
let rotate = |x, y| {
(
Expand Down Expand Up @@ -95,8 +101,14 @@ impl Lift {

let dx = door.x as f32;
let dy = door.y as f32;
let half_width = self.width as f32 / 2.0;
let half_depth = self.depth as f32 / 2.0;
// NOTE: Coordinate axes changed between the legacy format and the
// new format. Width used to be along the local x axis, and depth
// used to be along the local y axis, but now that is flipped to
// better align with the robotics convention of the local x axis
// being forward/backward while the local y axis is the lateral
// direction (side-to-side).
let half_width = self.depth as f32 / 2.0;
let half_depth = self.width as f32 / 2.0;

let cabin_face = if dx.abs() < 1e-3 {
// Very small x value means the door must be on the left or right face
Expand Down Expand Up @@ -208,8 +220,14 @@ impl Lift {
}
}

let width = self.width as f32;
let depth = self.depth as f32;
// NOTE: Coordinate axes changed between the legacy format and the
// new format. Width used to be along the local x axis, and depth
// used to be along the local y axis, but now that is flipped to
// better align with the robotics convention of the local x axis
// being forward/backward while the local y axis is the lateral
// direction (side-to-side).
let width = self.depth as f32;
let depth = self.width as f32;
let cabin = RectangularLiftCabin {
width,
depth,
Expand Down

0 comments on commit 795ca6e

Please sign in to comment.