diff --git a/CHANGELOG.md b/CHANGELOG.md index d91ac41c3c2..ac4526be541 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ * Check for support of CUDA Memory Pools at runtime (#4679) * Fix `toString`, `CreateFromPoints` methods and improve docs in `AxisAlignedBoundingBox`. 🐛📝 * Migrate Open3d documentation to furo theme ✨ (#6470) +* Expose Near Clip + Far Clip parameters to setup_camera in OffscreenRenderer (#6520) ## 0.13 diff --git a/cpp/pybind/visualization/rendering/rendering.cpp b/cpp/pybind/visualization/rendering/rendering.cpp index b80590710f4..51619f5cc68 100644 --- a/cpp/pybind/visualization/rendering/rendering.cpp +++ b/cpp/pybind/visualization/rendering/rendering.cpp @@ -81,16 +81,22 @@ class PyOffscreenRenderer { void SetupCamera(float verticalFoV, const Eigen::Vector3f ¢er, const Eigen::Vector3f &eye, - const Eigen::Vector3f &up) { + const Eigen::Vector3f &up, + float nearClip = -1.0f, + float farClip = -1.0f) { float aspect = 1.0f; if (height_ > 0) { aspect = float(width_) / float(height_); } auto *camera = scene_->GetCamera(); - auto far_plane = - Camera::CalcFarPlane(*camera, scene_->GetBoundingBox()); - camera->SetProjection(verticalFoV, aspect, Camera::CalcNearPlane(), - far_plane, rendering::Camera::FovType::Vertical); + auto far_plane = farClip > 0.0 + ? farClip + : Camera::CalcFarPlane( + *camera, scene_->GetBoundingBox()); + camera->SetProjection( + verticalFoV, aspect, + nearClip > 0.0 ? nearClip : Camera::CalcNearPlane(), far_plane, + rendering::Camera::FovType::Vertical); camera->LookAt(center, eye, up); } @@ -164,10 +170,15 @@ void pybind_rendering_classes(py::module &m) { .def("setup_camera", py::overload_cast( + const Eigen::Vector3f &, float, float>( &PyOffscreenRenderer::SetupCamera), - "setup_camera(vertical_field_of_view, center, eye, up): " - "sets camera view using bounding box of current geometry") + "setup_camera(vertical_field_of_view, center, eye, up, " + "near_clip, far_clip): " + "sets camera view using bounding box of current geometry " + "if the near_clip and far_clip parameters are not set", + py::arg("verticalFoV"), py::arg("center"), py::arg("eye"), + py::arg("up"), py::arg("nearClip") = -1.0f, + py::arg("farClip") = -1.0f) .def("setup_camera", py::overload_cast( diff --git a/docs/make.bat b/docs/make.bat index f21f1e1cf7a..7db5aa6b4c8 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -21,7 +21,7 @@ if errorlevel 9009 ( exit /b 1 ) -python make.py %1 +python make_docs.py %1 goto end :end