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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
27 changes: 19 additions & 8 deletions cpp/pybind/visualization/rendering/rendering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,22 @@ class PyOffscreenRenderer {
void SetupCamera(float verticalFoV,
const Eigen::Vector3f &center,
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);
}

Expand Down Expand Up @@ -164,10 +170,15 @@ void pybind_rendering_classes(py::module &m) {
.def("setup_camera",
py::overload_cast<float, const Eigen::Vector3f &,
const Eigen::Vector3f &,
const Eigen::Vector3f &>(
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<const camera::PinholeCameraIntrinsic &,
const Eigen::Matrix4d &>(
Expand Down
2 changes: 1 addition & 1 deletion docs/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if errorlevel 9009 (
exit /b 1
)

python make.py %1
python make_docs.py %1
goto end

:end
Expand Down