Skip to content

Commit

Permalink
Add far plane distance property to camera (#849)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulerikf committed Apr 7, 2022
1 parent c668ff1 commit 3f5e4af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit 3f5e4af

Please sign in to comment.