Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add far plane distance property to camera #849

Merged
merged 1 commit into from
Apr 7, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ private Q_SLOTS:
rviz_common::properties::FloatProperty * alpha_property_;
rviz_common::properties::EnumProperty * image_position_property_;
rviz_common::properties::FloatProperty * zoom_property_;
rviz_common::properties::FloatProperty * far_plane_property_;
rviz_common::properties::DisplayGroupVisibilityProperty * visibility_property_;

sensor_msgs::msg::CameraInfo::ConstSharedPtr current_caminfo_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ CameraDisplay::CameraDisplay()
this);
zoom_property_->setMin(0.00001f);
zoom_property_->setMax(100000.0f);

far_plane_property_ = new rviz_common::properties::FloatProperty(
"Far Plane Distance", 100.0f,
"Geometry beyond the camera's far plane will not be rendered.",
this);
far_plane_property_->setMin(0.00001f);
far_plane_property_->setMax(100000.0f);
}

CameraDisplay::~CameraDisplay()
Expand Down Expand Up @@ -593,7 +600,7 @@ Ogre::Matrix4 CameraDisplay::calculateProjectionMatrix(
auto fx = static_cast<float>(info->p[0]);
auto fy = static_cast<float>(info->p[5]);

float far_plane = 100.0f;
float far_plane = far_plane_property_->getFloat();
float near_plane = 0.01f;

Ogre::Matrix4 proj_matrix;
Expand Down