Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions apps/camera_lidar_trajectory_viewer/TrajectoryViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1425,8 +1425,8 @@ int main(int argc, char* argv[])
// binding -- reach for Cmd as "the" modifier there. Treating
// either as ctrlDown matches that expectation instead of
// requiring the literal Ctrl key.
bool ctrlDown = IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL) || IsKeyDown(KEY_LEFT_SUPER) ||
IsKeyDown(KEY_RIGHT_SUPER);
bool ctrlDown =
IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL) || IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_RIGHT_SUPER);
bool shiftDown = IsKeyDown(KEY_LEFT_SHIFT) || IsKeyDown(KEY_RIGHT_SHIFT);
if (ctrlDown && shiftDown && IsKeyPressed(KEY_O))
actionSelectCamera0Dir(s);
Expand Down Expand Up @@ -1558,11 +1558,9 @@ int main(int argc, char* argv[])
{
s.orbit.applyPerspectiveProjection((int)ImGui::GetIO().DisplaySize.x, (int)ImGui::GetIO().DisplaySize.y);

Eigen::Vector3f rotationCenter(
s.orbit.euler.rotationCenter.x, s.orbit.euler.rotationCenter.y, s.orbit.euler.rotationCenter.z);
Eigen::Vector3f rotationCenter(s.orbit.euler.rotationCenter.x, s.orbit.euler.rotationCenter.y, s.orbit.euler.rotationCenter.z);
s.viewLocal.translate(rotationCenter);
s.viewLocal.translate(
Eigen::Vector3f(s.orbit.euler.translate.x, s.orbit.euler.translate.y, s.orbit.euler.translate.z));
s.viewLocal.translate(Eigen::Vector3f(s.orbit.euler.translate.x, s.orbit.euler.translate.y, s.orbit.euler.translate.z));
if (!s.orbit.lockZ)
s.viewLocal.rotate(Eigen::AngleAxisf(s.orbit.euler.rotateX * DEG2RAD, Eigen::Vector3f::UnitX()));
else
Expand All @@ -1577,8 +1575,7 @@ int main(int argc, char* argv[])
// Still updating viewLocal for the compass -- the rest of the
// ortho projection + gizmo-view lookAt lives in
// OrbitCamera::updateOrtho().
s.viewLocal.rotate(
Eigen::AngleAxisf((s.orbit.euler.rotateX + s.orbit.euler.rotateY) * DEG2RAD, Eigen::Vector3f::UnitZ()));
s.viewLocal.rotate(Eigen::AngleAxisf((s.orbit.euler.rotateX + s.orbit.euler.rotateY) * DEG2RAD, Eigen::Vector3f::UnitZ()));
s.orbit.updateOrtho(ratio);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,10 @@ void drawMiniCompassWithRuler()
Color rulerColor =
ColorFromNormalized(Vector4{ 1.0f - app_state.bg_color.x, 1.0f - app_state.bg_color.y, 1.0f - app_state.bg_color.z, 1.0f });
raylib_widgets::drawCompassRuler(
right, up, app_state.camera.euler.translate.z, rulerColor,
right,
up,
app_state.camera.euler.translate.z,
rulerColor,
raylib_widgets::CompassAxisLabels{ "X (long.)", "Y (lat.)", "Z (vert.)" });
}

Expand Down Expand Up @@ -773,12 +776,12 @@ void getClosestTrajectoryPoint(Session& session_, int x, int y, bool gcpPicking,

const auto laser_beam = GetLaserBeam(x, y);
Ray ray;
ray.position = Vector3{
static_cast<float>(laser_beam.position.x()), static_cast<float>(laser_beam.position.y()),
static_cast<float>(laser_beam.position.z()) };
ray.direction = Vector3{
static_cast<float>(laser_beam.direction.x()), static_cast<float>(laser_beam.direction.y()),
static_cast<float>(laser_beam.direction.z()) };
ray.position = Vector3{ static_cast<float>(laser_beam.position.x()),
static_cast<float>(laser_beam.position.y()),
static_cast<float>(laser_beam.position.z()) };
ray.direction = Vector3{ static_cast<float>(laser_beam.direction.x()),
static_cast<float>(laser_beam.direction.y()),
static_cast<float>(laser_beam.direction.z()) };

std::vector<Vector3> pts;
std::vector<std::pair<int, int>> ptOwners; // (point cloud index, local_trajectory index), parallel to pts
Expand Down Expand Up @@ -1729,8 +1732,7 @@ void observation_picking_gui()

if (ImGui::Button("Reset view"))
{
app_state.camera.startEulerTransition(
0.0f, 0.0f, app_state.camera.euler.translate, app_state.camera.euler.rotationCenter);
app_state.camera.startEulerTransition(0.0f, 0.0f, app_state.camera.euler.translate, app_state.camera.euler.rotationCenter);
}
}
ImGui::EndDisabled();
Expand Down Expand Up @@ -3206,7 +3208,8 @@ void renderLoopClosure(
scanColorModeFromScheme(csPointCloud),
static_cast<float>(session_dims.z_min),
static_cast<float>(session_dims.z_max),
Eigen::Vector3d(app_state.camera.euler.rotationCenter.x, app_state.camera.euler.rotationCenter.y, app_state.camera.euler.rotationCenter.z),
Eigen::Vector3d(
app_state.camera.euler.rotationCenter.x, app_state.camera.euler.rotationCenter.y, app_state.camera.euler.rotationCenter.z),
static_cast<float>(std::max({ session_dims.length, session_dims.width, session_dims.height, 1.0 })),
1,
point_clouds_container.xz_intersection,
Expand Down Expand Up @@ -3563,7 +3566,8 @@ void renderControlPoints(const ControlPoints& control_points, PointClouds& point
ScanColorMode::Intensity,
static_cast<float>(session_dims.z_min),
static_cast<float>(session_dims.z_max),
Eigen::Vector3d(app_state.camera.euler.rotationCenter.x, app_state.camera.euler.rotationCenter.y, app_state.camera.euler.rotationCenter.z),
Eigen::Vector3d(
app_state.camera.euler.rotationCenter.x, app_state.camera.euler.rotationCenter.y, app_state.camera.euler.rotationCenter.z),
static_cast<float>(std::max({ session_dims.length, session_dims.width, session_dims.height, 1.0 })),
1,
point_clouds_container.xz_intersection,
Expand Down Expand Up @@ -3897,8 +3901,8 @@ void display()
app_state.camera.euler.rotationCenter.x, app_state.camera.euler.rotationCenter.y, app_state.camera.euler.rotationCenter.z);
app_state.viewLocal.translate(rotationCenter);

app_state.viewLocal.translate(Eigen::Vector3f(
app_state.camera.euler.translate.x, app_state.camera.euler.translate.y, app_state.camera.euler.translate.z));
app_state.viewLocal.translate(
Eigen::Vector3f(app_state.camera.euler.translate.x, app_state.camera.euler.translate.y, app_state.camera.euler.translate.z));
if (!app_state.camera.lockZ)
app_state.viewLocal.rotate(Eigen::AngleAxisf(app_state.camera.euler.rotateX * DEG_TO_RAD, Eigen::Vector3f::UnitX()));
else
Expand All @@ -3914,8 +3918,8 @@ void display()
// Still updating app_state.viewLocal for the compass -- the rest of
// the original updateOrthoView() (rlOrtho + the ortho gizmo lookAt)
// now lives in raylib_widgets::OrbitCamera::updateOrtho().
app_state.viewLocal.rotate(Eigen::AngleAxisf(
(app_state.camera.euler.rotateX + app_state.camera.euler.rotateY) * DEG_TO_RAD, Eigen::Vector3f::UnitZ()));
app_state.viewLocal.rotate(
Eigen::AngleAxisf((app_state.camera.euler.rotateX + app_state.camera.euler.rotateY) * DEG_TO_RAD, Eigen::Vector3f::UnitZ()));
app_state.camera.updateOrtho(ratio);
}

Expand Down Expand Up @@ -3999,8 +4003,7 @@ void display()
session.control_points.imgui(
session.point_clouds_container,
Eigen::Vector3f(
app_state.camera.euler.rotationCenter.x, app_state.camera.euler.rotationCenter.y,
app_state.camera.euler.rotationCenter.z));
app_state.camera.euler.rotationCenter.x, app_state.camera.euler.rotationCenter.y, app_state.camera.euler.rotationCenter.z));

if (session.ground_control_points.is_imgui)
session.ground_control_points.imgui(session.point_clouds_container);
Expand Down Expand Up @@ -4127,16 +4130,22 @@ void display()
scanColorModeFromScheme(csPointCloud),
static_cast<float>(session_dims.z_min),
static_cast<float>(session_dims.z_max),
Eigen::Vector3d(app_state.camera.euler.rotationCenter.x, app_state.camera.euler.rotationCenter.y, app_state.camera.euler.rotationCenter.z),
Eigen::Vector3d(
app_state.camera.euler.rotationCenter.x,
app_state.camera.euler.rotationCenter.y,
app_state.camera.euler.rotationCenter.z),
static_cast<float>(std::max({ session_dims.length, session_dims.width, session_dims.height, 1.0 })),
app_state.viewer_decimate_point_cloud,
session.point_clouds_container.xz_intersection,
session.point_clouds_container.yz_intersection,
session.point_clouds_container.xy_intersection,
static_cast<float>(session.point_clouds_container.intersection_width));
scan_renderer.drawTrajectories(
session.point_clouds_container.point_clouds, 1, session.point_clouds_container.show_imu_to_lio_diff,
session.point_clouds_container.xz_intersection, session.point_clouds_container.yz_intersection,
session.point_clouds_container.point_clouds,
1,
session.point_clouds_container.show_imu_to_lio_diff,
session.point_clouds_container.xz_intersection,
session.point_clouds_container.yz_intersection,
session.point_clouds_container.xy_intersection);

observationPickingRender(observation_picking);
Expand Down Expand Up @@ -5694,8 +5703,7 @@ void translate_gui()
translate_tool.transform = Eigen::Affine3d::Identity();

app_state.camera.isOrtho = true;
app_state.camera.startEulerTransition(
0.0f, 0.0f, app_state.camera.euler.translate, app_state.camera.euler.rotationCenter);
app_state.camera.startEulerTransition(0.0f, 0.0f, app_state.camera.euler.translate, app_state.camera.euler.rotationCenter);

SetMouseCursor(MOUSE_CURSOR_CROSSHAIR);
}
Expand Down
8 changes: 6 additions & 2 deletions core/include/Core/raylib_render.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ class ScanRenderer
// yzIntersection/xyIntersection is set, so a cross-section view isn't
// cluttered by trajectory points/markers outside the slab.
void drawTrajectories(
const std::vector<PointCloud>& pointClouds, int reduceRenderedTrajectory, bool visibleImuDiff, bool xzIntersection = false,
bool yzIntersection = false, bool xyIntersection = false) const;
const std::vector<PointCloud>& pointClouds,
int reduceRenderedTrajectory,
bool visibleImuDiff,
bool xzIntersection = false,
bool yzIntersection = false,
bool xyIntersection = false) const;

// Draws a single already-cached scan (see rebuild()) straight from its
// persistent, full-resolution GPU buffer -- no CPU re-transform or
Expand Down
8 changes: 6 additions & 2 deletions core/src/raylib_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,12 @@ void ScanRenderer::rebuildTrajectoryGPU(TrajGPU& traj, const PointCloud& pc, int
}

void ScanRenderer::drawTrajectories(
const std::vector<PointCloud>& pointClouds, int reduceRenderedTrajectory, bool visibleImuDiff, bool xzIntersection,
bool yzIntersection, bool xyIntersection) const
const std::vector<PointCloud>& pointClouds,
int reduceRenderedTrajectory,
bool visibleImuDiff,
bool xzIntersection,
bool yzIntersection,
bool xyIntersection) const
{
int stride = reduceRenderedTrajectory < 1 ? 1 : reduceRenderedTrajectory;

Expand Down
Loading