Skip to content

Commit

Permalink
render tweaks: proper viewport scaling and in-plane interaction (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
strasdat authored Jul 1, 2024
1 parent e2b4608 commit 9d2f1b0
Show file tree
Hide file tree
Showing 38 changed files with 1,520 additions and 1,238 deletions.
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ include = [
]
keywords = ["robotics", "optimization"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/farm-ng/sophus-rs/"
version = "0.7.0"
repository = "https://github.com/sophus-vision/sophus-rs/"
version = "0.8.0"

[workspace.dependencies]
sophus = {path = "crates/sophus", version = "0.7.0"}
sophus_core = {path = "crates/sophus_core", version = "0.7.0"}
sophus_image = {path = "crates/sophus_image", version = "0.7.0"}
sophus_lie = {path = "crates/sophus_lie", version = "0.7.0"}
sophus_opt = {path = "crates/sophus_opt", version = "0.7.0"}
sophus_pyo3 = {path = "crates/sophus_pyo3", version = "0.7.0"}
sophus_sensor = {path = "crates/sophus_sensor", version = "0.7.0"}
sophus_viewer = {path = "crates/sophus_viewer", version = "0.7.0"}
sophus = {path = "crates/sophus", version = "0.8.0"}
sophus_core = {path = "crates/sophus_core", version = "0.8.0"}
sophus_image = {path = "crates/sophus_image", version = "0.8.0"}
sophus_lie = {path = "crates/sophus_lie", version = "0.8.0"}
sophus_opt = {path = "crates/sophus_opt", version = "0.8.0"}
sophus_pyo3 = {path = "crates/sophus_pyo3", version = "0.8.0"}
sophus_sensor = {path = "crates/sophus_sensor", version = "0.8.0"}
sophus_viewer = {path = "crates/sophus_viewer", version = "0.8.0"}

approx = "0.5"
as-any = "0.3"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sophus-rs builds on stable.

```toml
[dependencies]
sophus = "0.7.0"
sophus = "0.8.0"
```

To allow for batch types, such as BatchScalarF64, the 'simd' feature is required. This feature
Expand All @@ -38,5 +38,5 @@ are no plans to rely on any other nightly features.

```toml
[dependencies]
sophus = { version = "0.7.0", features = ["simd"] }
sophus = { version = "0.8.0", features = ["simd"] }
```
4 changes: 2 additions & 2 deletions crates/sophus/examples/pose_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use sophus_lie::Isometry3;
use sophus_sensor::camera_enum::perspective_camera::PerspectiveCameraEnum;
use sophus_sensor::dyn_camera::DynCamera;
use sophus_sensor::KannalaBrandtCamera;
use sophus_viewer::interactions::WgpuClippingPlanes;
use sophus_viewer::offscreen_renderer::renderer::ClippingPlanes;
use sophus_viewer::simple_viewer::SimpleViewer;

use crate::color::Color;
Expand Down Expand Up @@ -120,7 +120,7 @@ impl HasOnMessage for ContentGeneratorMessage {
},
);
let scene_from_camera = Isometry3::from_t(&VecF64::<3>::new(0.0, 0.0, -50.0));
let clipping_planes = WgpuClippingPlanes {
let clipping_planes = ClippingPlanes {
near: 0.1,
far: 1000.0,
};
Expand Down
6 changes: 3 additions & 3 deletions crates/sophus/examples/viewer_ex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use sophus_image::mut_image_view::IsMutImageView;
use sophus_lie::traits::IsTranslationProductGroup;
use sophus_lie::Isometry3;
use sophus_sensor::DynCamera;
use sophus_viewer::interactions::WgpuClippingPlanes;
use sophus_viewer::offscreen_renderer::renderer::ClippingPlanes;
use sophus_viewer::renderables::color::Color;
use sophus_viewer::renderables::renderable2d::Points2;
use sophus_viewer::renderables::renderable2d::Renderable2d;
Expand Down Expand Up @@ -147,7 +147,7 @@ fn create_tiny_view2_packet() -> Packet {
"lines2",
&[[[-0.5, -0.5], [0.5, 0.5]], [[0.5, -0.5], [-0.5, 0.5]]],
&Color::red(),
0.3,
2.0,
);
packet_2d.renderables2d.push(Renderable2d::Lines2(lines2));

Expand All @@ -157,7 +157,7 @@ fn create_tiny_view2_packet() -> Packet {
fn create_view3_packet() -> Packet {
let initial_camera = ViewerCamera {
intrinsics: DynCamera::default_distorted(ImageSize::new(639, 477)),
clipping_planes: WgpuClippingPlanes::default(),
clipping_planes: ClippingPlanes::default(),
scene_from_camera: Isometry3::from_t(&VecF64::<3>::new(0.0, 0.0, -5.0)),
};
let mut packet_3d = View3dPacket {
Expand Down
6 changes: 3 additions & 3 deletions crates/sophus_viewer/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use sophus_lie::traits::IsTranslationProductGroup;
use sophus_lie::Isometry3;
use sophus_sensor::dyn_camera::DynCamera;

use crate::interactions::WgpuClippingPlanes;
use crate::offscreen_renderer::renderer::ClippingPlanes;
use crate::renderables::Packets;
use crate::ViewerRenderState;

Expand All @@ -18,7 +18,7 @@ pub struct ViewerCamera {
/// Camera intrinsics
pub intrinsics: DynCamera<f64, 1>,
/// Clipping planes
pub clipping_planes: WgpuClippingPlanes,
pub clipping_planes: ClippingPlanes,
/// Scene from camera pose
pub scene_from_camera: Isometry3<f64, 1>,
}
Expand All @@ -34,7 +34,7 @@ impl ViewerCamera {
pub fn default_from(image_size: ImageSize) -> ViewerCamera {
ViewerCamera {
intrinsics: DynCamera::default_pinhole(image_size),
clipping_planes: WgpuClippingPlanes::default(),
clipping_planes: ClippingPlanes::default(),
scene_from_camera: Isometry3::from_t(&VecF64::<3>::new(0.0, 0.0, -5.0)),
}
}
Expand Down
98 changes: 0 additions & 98 deletions crates/sophus_viewer/src/interactions.rs

This file was deleted.

33 changes: 0 additions & 33 deletions crates/sophus_viewer/src/interactions/inplane_interaction.rs

This file was deleted.

8 changes: 1 addition & 7 deletions crates/sophus_viewer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@
/// The actor for the viewer.
pub mod actor;
/// Interactions
pub mod interactions;
/// The offscreen texture for rendering.
pub mod offscreen;
/// The pixel renderer for 2D rendering.
pub mod pixel_renderer;
pub mod offscreen_renderer;
/// The renderable structs.
pub mod renderables;
/// The scene renderer for 3D rendering.
pub mod scene_renderer;
/// The simple viewer.
pub mod simple_viewer;
/// The view struct.
Expand Down
11 changes: 11 additions & 0 deletions crates/sophus_viewer/src/offscreen_renderer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/// offscreen texture for rendering
pub mod textures;

/// Renderer for offscreen rendering
pub mod renderer;

/// The pixel renderer for 2D rendering.
pub mod pixel_renderer;

/// The scene renderer for 3D rendering.
pub mod scene_renderer;
Loading

0 comments on commit 9d2f1b0

Please sign in to comment.