diff --git a/apps/SceneViewer3D/_DSceneViewerMain.cpp b/apps/SceneViewer3D/_DSceneViewerMain.cpp index 0e571cad18..3cac3e0bdb 100644 --- a/apps/SceneViewer3D/_DSceneViewerMain.cpp +++ b/apps/SceneViewer3D/_DSceneViewerMain.cpp @@ -234,9 +234,9 @@ void CMyGLCanvas::OnPostRenderSwapBuffers(double At, wxPaintDC& dc) meanEstimatedFPS = 0.8 * meanEstimatedFPS + 0.2 * estimatedFPS; string str = format( - "Center=(%.02f,%.02f,%.02f) Zoom:%.02f AZ=%.02f deg EL:%.02f deg", getCameraPointingX(), - getCameraPointingY(), getCameraPointingZ(), getZoomDistance(), getAzimuthDegrees(), - getElevationDegrees()); + "Center=(%.02f,%.02f,%.02f) Zoom:%.02f AZ=%.02f deg EL:%.02f deg ROLL:%.02f", + getCameraPointingX(), getCameraPointingY(), getCameraPointingZ(), getZoomDistance(), + getAzimuthDegrees(), getElevationDegrees(), getRollDegrees()); theWindow->StatusBar1->SetStatusText(str.c_str(), 1); str = format("%.02f FPS", meanEstimatedFPS); diff --git a/appveyor.yml b/appveyor.yml index e35a6ca138..0d1c2d00ec 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ # version format -version: 2.14.5-{branch}-build{build} +version: 2.14.6-{branch}-build{build} os: Visual Studio 2019 diff --git a/doc/source/doxygen-docs/changelog.md b/doc/source/doxygen-docs/changelog.md index 4f41713b46..d6adc3d20d 100644 --- a/doc/source/doxygen-docs/changelog.md +++ b/doc/source/doxygen-docs/changelog.md @@ -1,5 +1,15 @@ \page changelog Change Log +# Version 2.14.6: Released Dec 3rd, 2024 +- Changes in libraries: + - \ref mrpt_gui_grp: + - Added a new mouse control to rotate OpenGL cameras by pressing the "Alt" key. + - \ref mrpt_opengl_grp: + - mrpt::opengl::Texture now supports rendering 16-bit images. + - mrpt::opengl::CCamera now has a "roll" angle when in orbit-view mode. +- BUG FIXES: + - mrpt::opengl::CMesh: There was a bug with texture scaling with non-square images. + # Version 2.14.5: Released Nov 4th, 2024 - Upgraded nanoflann to v1.6.2 (fixes a potential bug). - Debian files: diff --git a/doc/source/tutorial-3d-navigation-cheatsheet.rst b/doc/source/tutorial-3d-navigation-cheatsheet.rst index f3bec50174..5f8981dc80 100644 --- a/doc/source/tutorial-3d-navigation-cheatsheet.rst +++ b/doc/source/tutorial-3d-navigation-cheatsheet.rst @@ -14,6 +14,8 @@ All MRPT applications use the following convention: - **Look around** (pivot camera): CTRL+Left-button pressed + mouse move up/down. +- **Roll camera** (rotate around front-facing axis): ALT+Left-button pressed + mouse move up/down. + - **Pan** (XY plane): Right button or wheel pressed + mouse move. - **Move camera along Z axis**: SHIFT+Left-button pressed + mouse move left/right, diff --git a/libs/gui/include/mrpt/gui/CGlCanvasBase.h b/libs/gui/include/mrpt/gui/CGlCanvasBase.h index bdf1836db9..ce9ac0c807 100644 --- a/libs/gui/include/mrpt/gui/CGlCanvasBase.h +++ b/libs/gui/include/mrpt/gui/CGlCanvasBase.h @@ -39,6 +39,7 @@ class CGlCanvasBase float cameraElevationDeg = 45.f, cameraAzimuthDeg = 45.f; bool cameraIsProjective = true; float cameraFOV = 30.f; + float cameraRollDeg = .0f; }; CGlCanvasBase() = default; @@ -63,6 +64,7 @@ class CGlCanvasBase /** Sets the last mouse position */ void updateLastPos(int x, int y); + /** Calls the glViewport function*/ void resizeViewport(int w, int h); @@ -71,21 +73,25 @@ class CGlCanvasBase * and updates the zoom of the CameraParams. * See also updateZoom(CamaraParams &, float)*/ void updateZoom(CamaraParams& params, int x, int y) const; + /** This function for the wheel event * It gets a reference to CamaraParams, delta * and updates the zoom of the CameraParams. * See also updateZoom(CamaraParams &, int, int)*/ void updateZoom(CamaraParams& params, float delta) const; + /** This function for the mouse event * It gets a reference to CamaraParams, x, y * and updates the elevation and azimuth. * See also getElevationDegrees(), getAzimuthDegrees()*/ void updateRotate(CamaraParams& params, int x, int y) const; + /** This function for the mouse event * It gets a reference to CamaraParams, x, y * and updates the elevation and azimuth. * See also getElevationDegrees(), getAzimuthDegrees()*/ void updateOrbitCamera(CamaraParams& params, int x, int y) const; + /** This function for the mouse event * It gets a reference to CamaraParams, x, y * and updates the pointing of the camera. @@ -93,6 +99,9 @@ class CGlCanvasBase * getCameraPointingZ()*/ void updatePan(CamaraParams& params, int x, int y) const; + /** Updates the camera "roll" \note New in MRPT 2.14.6 */ + void updateRoll(CamaraParams& params, int x, int y, float scale = 0.15f) const; + /** Returns a copy of CamaraParams * See also getRefCameraParams(), setCameraParams(const CamaraParams &)*/ CamaraParams cameraParams() const; @@ -160,6 +169,8 @@ class CGlCanvasBase */ float getAzimuthDegrees() const; + float getRollDegrees() const; + /** Saves the degrees of the elevation camera * See also getElevationDegrees() */ diff --git a/libs/gui/src/CGlCanvasBase.cpp b/libs/gui/src/CGlCanvasBase.cpp index 3476c67f50..f833175d5c 100644 --- a/libs/gui/src/CGlCanvasBase.cpp +++ b/libs/gui/src/CGlCanvasBase.cpp @@ -9,6 +9,7 @@ #include "gui-precomp.h" // Precompiled headers // +#include #include #include @@ -147,6 +148,12 @@ void CGlCanvasBase::updatePan(CamaraParams& params, int x, int y) const D * (Ax * sin(DEG2RAD(params.cameraAzimuthDeg)) + Ay * cos(DEG2RAD(params.cameraAzimuthDeg))); } +void CGlCanvasBase::updateRoll(CamaraParams& params, int x, int y, float scale) const +{ + int Arot = mrpt::round(scale * (y - m_mouseClickY)); + params.cameraRollDeg += Arot; +} + CGlCanvasBase::CamaraParams CGlCanvasBase::cameraParams() const { return m_cameraParams; } const CGlCanvasBase::CamaraParams& CGlCanvasBase::getRefCameraParams() const @@ -169,6 +176,7 @@ CCamera& CGlCanvasBase::updateCameraParams(CCamera& cam) const cam.setPointingAt(_.cameraPointingX, _.cameraPointingY, _.cameraPointingZ); cam.setZoomDistance(_.cameraZoomDistance); cam.setAzimuthDegrees(_.cameraAzimuthDeg); + cam.setRollDegrees(_.cameraRollDeg); cam.setElevationDegrees(_.cameraElevationDeg); cam.setProjectiveModel(_.cameraIsProjective); cam.setProjectiveFOVdeg(_.cameraFOV); @@ -186,6 +194,8 @@ float CGlCanvasBase::getAzimuthDegrees() const { return m_cameraParams.cameraAzi float CGlCanvasBase::getElevationDegrees() const { return m_cameraParams.cameraElevationDeg; } +float CGlCanvasBase::getRollDegrees() const { return m_cameraParams.cameraRollDeg; } + void CGlCanvasBase::setCameraProjective(bool is) { m_cameraParams.cameraIsProjective = is; } bool CGlCanvasBase::isCameraProjective() const { return m_cameraParams.cameraIsProjective; } @@ -327,6 +337,7 @@ CGlCanvasBase::CamaraParams CGlCanvasBase::CamaraParams::FromCamera(const mrpt:: p.cameraPointingY = c.getPointingAtY(); p.cameraPointingZ = c.getPointingAtZ(); p.cameraZoomDistance = c.getZoomDistance(); + p.cameraRollDeg = c.getRollDegrees(); return p; } diff --git a/libs/gui/src/CWxGLCanvasBase.cpp b/libs/gui/src/CWxGLCanvasBase.cpp index cad848eb59..610f3c8c3f 100644 --- a/libs/gui/src/CWxGLCanvasBase.cpp +++ b/libs/gui/src/CWxGLCanvasBase.cpp @@ -102,6 +102,8 @@ void CWxGLCanvasBase::OnMouseMove(wxMouseEvent& event) updateZoom(params, X, Y); else if (event.ControlDown()) updateRotate(params, X, Y); + else if (event.AltDown()) + updateRoll(params, X, Y); else updateOrbitCamera(params, X, Y); } diff --git a/libs/gui/src/NanoGUICanvasHeadless.cpp b/libs/gui/src/NanoGUICanvasHeadless.cpp index 1739073fc4..b56faf33df 100644 --- a/libs/gui/src/NanoGUICanvasHeadless.cpp +++ b/libs/gui/src/NanoGUICanvasHeadless.cpp @@ -41,6 +41,8 @@ void NanoGUICanvasHeadless::mouseMotionEvent( updateZoom(params, X, Y); else if (modifiers & GLFW_MOD_CONTROL) updateRotate(params, X, Y); + else if (modifiers & GLFW_MOD_ALT) + updateRoll(params, X, Y, 0.30f); else updateOrbitCamera(params, X, Y); } diff --git a/libs/opengl/include/mrpt/opengl/CCamera.h b/libs/opengl/include/mrpt/opengl/CCamera.h index d3bb5ae86a..a8e034ccf2 100644 --- a/libs/opengl/include/mrpt/opengl/CCamera.h +++ b/libs/opengl/include/mrpt/opengl/CCamera.h @@ -135,12 +135,15 @@ class CCamera : public CRenderizable mrpt::math::TPoint3Df getPointingAt() const { return {m_pointingX, m_pointingY, m_pointingZ}; } - void setZoomDistance(float z) { m_eyeDistance = z; } float getZoomDistance() const { return m_eyeDistance; } float getAzimuthDegrees() const { return m_azimuthDeg; } float getElevationDegrees() const { return m_elevationDeg; } + float getRollDegrees() const { return m_eyeRollDeg; } + + void setZoomDistance(float z) { m_eyeDistance = z; } void setAzimuthDegrees(float ang) { m_azimuthDeg = ang; } void setElevationDegrees(float ang) { m_elevationDeg = ang; } + void setRollDegrees(float ang) { m_eyeRollDeg = ang; } /** Set 6DOFMode, if enabled camera is set according to its pose, set via *CRenderizable::setPose(). (default=false). @@ -168,6 +171,7 @@ class CCamera : public CRenderizable float m_pointingX{0}, m_pointingY{0}, m_pointingZ{0}; float m_eyeDistance{10}; float m_azimuthDeg{45}, m_elevationDeg{45}; + float m_eyeRollDeg{0}; /** If set to true (default), camera model is projective, otherwise, it's * orthogonal. */ diff --git a/libs/opengl/include/mrpt/opengl/TRenderMatrices.h b/libs/opengl/include/mrpt/opengl/TRenderMatrices.h index 2c3069e6e0..6b7461c81f 100644 --- a/libs/opengl/include/mrpt/opengl/TRenderMatrices.h +++ b/libs/opengl/include/mrpt/opengl/TRenderMatrices.h @@ -82,7 +82,7 @@ struct TRenderMatrices double FOV = 30.0f; /** Camera elev & azimuth, in radians. */ - double azimuth = .0, elev = .0; + double azimuth = .0, elev = .0, roll = .0; double eyeDistance = 1.0f; /** In pixels. This may be smaller than the total render window. */ diff --git a/libs/opengl/include/mrpt/opengl/Texture.h b/libs/opengl/include/mrpt/opengl/Texture.h index d521f6e29f..fec04e8dd4 100644 --- a/libs/opengl/include/mrpt/opengl/Texture.h +++ b/libs/opengl/include/mrpt/opengl/Texture.h @@ -71,6 +71,11 @@ class Texture /** How to repeat texture coordinate "T" */ Wrapping wrappingModeT = Wrapping::Repeat; + + /** If enabled, 16-bit images will be automatically bright-adjusted so they are visible + * as 8-bit image textures. Set to false to disable adjustment. + */ + bool autoScale16to8bitConversion = true; }; /** This is how an 2D texture image is loaded into this object, and a diff --git a/libs/opengl/src/CCamera.cpp b/libs/opengl/src/CCamera.cpp index cecf0bdb74..244d4c8aba 100644 --- a/libs/opengl/src/CCamera.cpp +++ b/libs/opengl/src/CCamera.cpp @@ -22,7 +22,7 @@ using namespace std; IMPLEMENTS_SERIALIZABLE(CCamera, CRenderizable, mrpt::opengl) -uint8_t CCamera::serializeGetVersion() const { return 3; } +uint8_t CCamera::serializeGetVersion() const { return 4; } void CCamera::serializeTo(mrpt::serialization::CArchive& out) const { // Save data: @@ -30,6 +30,7 @@ void CCamera::serializeTo(mrpt::serialization::CArchive& out) const << m_elevationDeg << m_projectiveModel << m_projectiveFOVdeg; out << m_pinholeModel; // v2 out << m_useNoProjection; // v3 + out << m_eyeRollDeg; // v4 } void CCamera::serializeFrom(mrpt::serialization::CArchive& in, uint8_t version) @@ -39,6 +40,7 @@ void CCamera::serializeFrom(mrpt::serialization::CArchive& in, uint8_t version) case 1: case 2: case 3: + case 4: { // Load data: in >> m_pointingX >> m_pointingY >> m_pointingZ >> m_eyeDistance >> m_azimuthDeg >> @@ -52,6 +54,11 @@ void CCamera::serializeFrom(mrpt::serialization::CArchive& in, uint8_t version) in >> m_useNoProjection; else m_useNoProjection = false; + + if (version >= 4) + in >> m_eyeRollDeg; + else + m_eyeRollDeg = 0; } break; case 0: @@ -81,6 +88,7 @@ void CCamera::toYAMLMap(mrpt::containers::yaml& p) const MCP_SAVE(p, m_projectiveModel); MCP_SAVE(p, m_projectiveFOVdeg); MCP_SAVE(p, m_useNoProjection); + MCP_SAVE(p, m_eyeRollDeg); if (m_pinholeModel) p["pinholeModel"] = m_pinholeModel->asYAML(); } diff --git a/libs/opengl/src/CMesh.cpp b/libs/opengl/src/CMesh.cpp index 1311c53605..5f708d07cd 100644 --- a/libs/opengl/src/CMesh.cpp +++ b/libs/opengl/src/CMesh.cpp @@ -371,7 +371,7 @@ void CMesh::onUpdateBuffers_TexturedTriangles() // Default: texture over the whole extension. const float textureSizeX = (m_textureSize_x != 0) ? m_textureSize_x : (m_xMax - m_xMin); - const float textureSizeY = (m_textureSize_y != 0) ? m_textureSize_y : (m_xMax - m_xMin); + const float textureSizeY = (m_textureSize_y != 0) ? m_textureSize_y : (m_yMax - m_yMin); for (auto& i : actualMesh) { diff --git a/libs/opengl/src/Texture.cpp b/libs/opengl/src/Texture.cpp index 7fe4bb0fd1..98cc050121 100644 --- a/libs/opengl/src/Texture.cpp +++ b/libs/opengl/src/Texture.cpp @@ -14,6 +14,9 @@ #include #include +// Universal include for all versions of OpenCV +#include + #include #include #include @@ -244,11 +247,45 @@ void Texture::internalAssignImage_2D( in_rgb->forceLoad(); // just in case they are lazy-load imgs if (in_alpha) in_alpha->forceLoad(); - ASSERT_(in_rgb->getPixelDepth() == mrpt::img::PixelDepth::D8U); + mrpt::img::CImage rgb; + + switch (in_rgb->getPixelDepth()) + { + // Ideal case, nothing to do: + case mrpt::img::PixelDepth::D8U: + rgb = mrpt::img::CImage(*in_rgb, mrpt::img::SHALLOW_COPY); + break; + + case mrpt::img::PixelDepth::D16U: + { +#if MRPT_HAS_OPENCV + double ratio; + if (o.autoScale16to8bitConversion) + { + // enhance brigthness: + + cv::Scalar meanColor = cv::mean(in_rgb->asCvMatRef()); + const double avrVal = meanColor.val[0]; + ratio = std::max(1.0, 2 * avrVal); + } + else + { + ratio = 65536.0; + } + + rgb.resize(in_rgb->getWidth(), in_rgb->getHeight(), mrpt::img::CH_RGB); + cv::convertScaleAbs(in_rgb->asCvMatRef(), rgb.asCvMatRef(), 255.0 / ratio); +#endif + } + break; + + default: + THROW_EXCEPTION_FMT( + "Unhandled pixel depth: PixelDepth=#%i", static_cast(in_rgb->getPixelDepth())); + }; // Shallow copy of the images, for the case we need to downsample them // below: - mrpt::img::CImage rgb(*in_rgb, mrpt::img::SHALLOW_COPY); mrpt::img::CImage alpha; if (in_alpha) alpha = mrpt::img::CImage(*in_alpha, mrpt::img::SHALLOW_COPY); @@ -299,7 +336,7 @@ void Texture::internalAssignImage_2D( glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, lmbdWrapMap(o.wrappingModeT)); CHECK_OPENGL_ERROR_IN_DEBUG(); - // Assure that the images do not overpass the maximum dimensions allowed + // Ensure that the images do not overpass the maximum dimensions allowed // by OpenGL: // ------------------------------------------------------------------------------------ GLint texSize; diff --git a/libs/opengl/src/Viewport.cpp b/libs/opengl/src/Viewport.cpp index 13c9f84a0b..bb186a8884 100644 --- a/libs/opengl/src/Viewport.cpp +++ b/libs/opengl/src/Viewport.cpp @@ -1233,6 +1233,7 @@ void Viewport::updateMatricesFromCamera(const CCamera& myCamera) const _.eyeDistance = myCamera.getZoomDistance(); _.azimuth = DEG2RAD(myCamera.getAzimuthDegrees()); _.elev = DEG2RAD(myCamera.getElevationDegrees()); + _.roll = DEG2RAD(myCamera.getRollDegrees()); if (myCamera.is6DOFMode()) { @@ -1255,14 +1256,26 @@ void Viewport::updateMatricesFromCamera(const CCamera& myCamera) const // point: _.pointing = myCamera.getPointingAt(); + const auto c2m_u = mrpt::math::TVector3D( + cos(_.azimuth) * cos(_.elev), // + sin(_.azimuth) * cos(_.elev), // + sin(_.elev) // + ); + const double dis = std::max(0.001, myCamera.getZoomDistance()); - _.eye.x = _.pointing.x + dis * cos(_.azimuth) * cos(_.elev); - _.eye.y = _.pointing.y + dis * sin(_.azimuth) * cos(_.elev); - _.eye.z = _.pointing.z + dis * sin(_.elev); + _.eye = _.pointing + c2m_u * dis; _.up.x = -cos(_.azimuth) * sin(_.elev); _.up.y = -sin(_.azimuth) * sin(_.elev); _.up.z = cos(_.elev); + + // roll? + if (_.roll != .0) + { + // _.up & c2m_u are both unit vectors and orthogonal to each other. + const auto w = mrpt::math::crossProduct3D(c2m_u, _.up); + _.up = _.up * cos(_.roll) + w * sin(_.roll); + } } // Compute the projection matrix (p_matrix): diff --git a/python/src/mrpt/gui/CDisplayWindow3D_1.cpp b/python/src/mrpt/gui/CDisplayWindow3D_1.cpp index 22884721c2..4cbf4a3353 100644 --- a/python/src/mrpt/gui/CDisplayWindow3D_1.cpp +++ b/python/src/mrpt/gui/CDisplayWindow3D_1.cpp @@ -258,6 +258,8 @@ void bind_mrpt_gui_CDisplayWindow3D_1(std::function< pybind11::module &(std::str cl.def("updateRotate", (void (mrpt::gui::CGlCanvasBase::*)(struct mrpt::gui::CGlCanvasBase::CamaraParams &, int, int) const) &mrpt::gui::CGlCanvasBase::updateRotate, "This function for the mouse event\n It gets a reference to CamaraParams, x, y\n and updates the elevation and azimuth.\n See also getElevationDegrees(), getAzimuthDegrees()\n\nC++: mrpt::gui::CGlCanvasBase::updateRotate(struct mrpt::gui::CGlCanvasBase::CamaraParams &, int, int) const --> void", pybind11::arg("params"), pybind11::arg("x"), pybind11::arg("y")); cl.def("updateOrbitCamera", (void (mrpt::gui::CGlCanvasBase::*)(struct mrpt::gui::CGlCanvasBase::CamaraParams &, int, int) const) &mrpt::gui::CGlCanvasBase::updateOrbitCamera, "This function for the mouse event\n It gets a reference to CamaraParams, x, y\n and updates the elevation and azimuth.\n See also getElevationDegrees(), getAzimuthDegrees()\n\nC++: mrpt::gui::CGlCanvasBase::updateOrbitCamera(struct mrpt::gui::CGlCanvasBase::CamaraParams &, int, int) const --> void", pybind11::arg("params"), pybind11::arg("x"), pybind11::arg("y")); cl.def("updatePan", (void (mrpt::gui::CGlCanvasBase::*)(struct mrpt::gui::CGlCanvasBase::CamaraParams &, int, int) const) &mrpt::gui::CGlCanvasBase::updatePan, "This function for the mouse event\n It gets a reference to CamaraParams, x, y\n and updates the pointing of the camera.\n See also getCameraPointingX(), getCameraPointingY(),\n getCameraPointingZ()\n\nC++: mrpt::gui::CGlCanvasBase::updatePan(struct mrpt::gui::CGlCanvasBase::CamaraParams &, int, int) const --> void", pybind11::arg("params"), pybind11::arg("x"), pybind11::arg("y")); + cl.def("updateRoll", [](mrpt::gui::CGlCanvasBase const &o, struct mrpt::gui::CGlCanvasBase::CamaraParams & a0, int const & a1, int const & a2) -> void { return o.updateRoll(a0, a1, a2); }, "", pybind11::arg("params"), pybind11::arg("x"), pybind11::arg("y")); + cl.def("updateRoll", (void (mrpt::gui::CGlCanvasBase::*)(struct mrpt::gui::CGlCanvasBase::CamaraParams &, int, int, float) const) &mrpt::gui::CGlCanvasBase::updateRoll, "Updates the camera \"roll\" \n New in MRPT 2.14.6 \n\nC++: mrpt::gui::CGlCanvasBase::updateRoll(struct mrpt::gui::CGlCanvasBase::CamaraParams &, int, int, float) const --> void", pybind11::arg("params"), pybind11::arg("x"), pybind11::arg("y"), pybind11::arg("scale")); cl.def("cameraParams", (struct mrpt::gui::CGlCanvasBase::CamaraParams (mrpt::gui::CGlCanvasBase::*)() const) &mrpt::gui::CGlCanvasBase::cameraParams, "Returns a copy of CamaraParams\n See also getRefCameraParams(), setCameraParams(const CamaraParams &)\n\nC++: mrpt::gui::CGlCanvasBase::cameraParams() const --> struct mrpt::gui::CGlCanvasBase::CamaraParams"); cl.def("getRefCameraParams", (const struct mrpt::gui::CGlCanvasBase::CamaraParams & (mrpt::gui::CGlCanvasBase::*)() const) &mrpt::gui::CGlCanvasBase::getRefCameraParams, "Returns a reference to CamaraParams\n See also cameraParams(), setCameraParams(const CamaraParams &) \n\nC++: mrpt::gui::CGlCanvasBase::getRefCameraParams() const --> const struct mrpt::gui::CGlCanvasBase::CamaraParams &", pybind11::return_value_policy::automatic); cl.def("setCameraParams", (void (mrpt::gui::CGlCanvasBase::*)(const struct mrpt::gui::CGlCanvasBase::CamaraParams &)) &mrpt::gui::CGlCanvasBase::setCameraParams, "Sets the CamaraParams\n See also cameraParams(), getRefCameraParams()\n\nC++: mrpt::gui::CGlCanvasBase::setCameraParams(const struct mrpt::gui::CGlCanvasBase::CamaraParams &) --> void", pybind11::arg("params")); @@ -272,6 +274,7 @@ void bind_mrpt_gui_CDisplayWindow3D_1(std::function< pybind11::module &(std::str cl.def("getZoomDistance", (float (mrpt::gui::CGlCanvasBase::*)() const) &mrpt::gui::CGlCanvasBase::getZoomDistance, "Returns a zoom\n See also setZoomDistance(float)\n\nC++: mrpt::gui::CGlCanvasBase::getZoomDistance() const --> float"); cl.def("setAzimuthDegrees", (void (mrpt::gui::CGlCanvasBase::*)(float)) &mrpt::gui::CGlCanvasBase::setAzimuthDegrees, "Saves the degrees of the azimuth camera\n See also getAzimuthDegrees()\n\nC++: mrpt::gui::CGlCanvasBase::setAzimuthDegrees(float) --> void", pybind11::arg("ang")); cl.def("getAzimuthDegrees", (float (mrpt::gui::CGlCanvasBase::*)() const) &mrpt::gui::CGlCanvasBase::getAzimuthDegrees, "Returns a azimuth degrees\n See also setAzimuthDegrees(float)\n\nC++: mrpt::gui::CGlCanvasBase::getAzimuthDegrees() const --> float"); + cl.def("getRollDegrees", (float (mrpt::gui::CGlCanvasBase::*)() const) &mrpt::gui::CGlCanvasBase::getRollDegrees, "C++: mrpt::gui::CGlCanvasBase::getRollDegrees() const --> float"); cl.def("setElevationDegrees", (void (mrpt::gui::CGlCanvasBase::*)(float)) &mrpt::gui::CGlCanvasBase::setElevationDegrees, "Saves the degrees of the elevation camera\n See also getElevationDegrees()\n\nC++: mrpt::gui::CGlCanvasBase::setElevationDegrees(float) --> void", pybind11::arg("ang")); cl.def("getElevationDegrees", (float (mrpt::gui::CGlCanvasBase::*)() const) &mrpt::gui::CGlCanvasBase::getElevationDegrees, "Returns a elevation degrees\n See also setElevationDegrees(float)\n\nC++: mrpt::gui::CGlCanvasBase::getElevationDegrees() const --> float"); cl.def("setCameraProjective", (void (mrpt::gui::CGlCanvasBase::*)(bool)) &mrpt::gui::CGlCanvasBase::setCameraProjective, "C++: mrpt::gui::CGlCanvasBase::setCameraProjective(bool) --> void", pybind11::arg("is")); @@ -297,6 +300,7 @@ void bind_mrpt_gui_CDisplayWindow3D_1(std::function< pybind11::module &(std::str cl.def_readwrite("cameraAzimuthDeg", &mrpt::gui::CGlCanvasBase::CamaraParams::cameraAzimuthDeg); cl.def_readwrite("cameraIsProjective", &mrpt::gui::CGlCanvasBase::CamaraParams::cameraIsProjective); cl.def_readwrite("cameraFOV", &mrpt::gui::CGlCanvasBase::CamaraParams::cameraFOV); + cl.def_readwrite("cameraRollDeg", &mrpt::gui::CGlCanvasBase::CamaraParams::cameraRollDeg); cl.def("setElevationDeg", (void (mrpt::gui::CGlCanvasBase::CamaraParams::*)(float)) &mrpt::gui::CGlCanvasBase::CamaraParams::setElevationDeg, "Changes elevation, taking care of not going out of the [-90,90]\n range \n\nC++: mrpt::gui::CGlCanvasBase::CamaraParams::setElevationDeg(float) --> void", pybind11::arg("deg")); cl.def_static("FromCamera", (struct mrpt::gui::CGlCanvasBase::CamaraParams (*)(const class mrpt::opengl::CCamera &)) &mrpt::gui::CGlCanvasBase::CamaraParams::FromCamera, "Converts from a CCamera objects \n [New in MRPT 2.1.5] \n\nC++: mrpt::gui::CGlCanvasBase::CamaraParams::FromCamera(const class mrpt::opengl::CCamera &) --> struct mrpt::gui::CGlCanvasBase::CamaraParams", pybind11::arg("c")); cl.def("assign", (struct mrpt::gui::CGlCanvasBase::CamaraParams & (mrpt::gui::CGlCanvasBase::CamaraParams::*)(const struct mrpt::gui::CGlCanvasBase::CamaraParams &)) &mrpt::gui::CGlCanvasBase::CamaraParams::operator=, "C++: mrpt::gui::CGlCanvasBase::CamaraParams::operator=(const struct mrpt::gui::CGlCanvasBase::CamaraParams &) --> struct mrpt::gui::CGlCanvasBase::CamaraParams &", pybind11::return_value_policy::automatic, pybind11::arg("")); diff --git a/python/src/mrpt/gui/CGlCanvasBase.cpp b/python/src/mrpt/gui/CGlCanvasBase.cpp index cb93467308..baf7d25352 100644 --- a/python/src/mrpt/gui/CGlCanvasBase.cpp +++ b/python/src/mrpt/gui/CGlCanvasBase.cpp @@ -28,7 +28,7 @@ PYBIND11_MAKE_OPAQUE(std::shared_ptr) #endif -// mrpt::gui::CGlCanvasBaseHeadless file:mrpt/gui/CGlCanvasBase.h line:250 +// mrpt::gui::CGlCanvasBaseHeadless file:mrpt/gui/CGlCanvasBase.h line:261 struct PyCallBack_mrpt_gui_CGlCanvasBaseHeadless : public mrpt::gui::CGlCanvasBaseHeadless { using mrpt::gui::CGlCanvasBaseHeadless::CGlCanvasBaseHeadless; @@ -205,7 +205,7 @@ struct PyCallBack_mrpt_gui_CGlCanvasBaseHeadless : public mrpt::gui::CGlCanvasBa void bind_mrpt_gui_CGlCanvasBase(std::function< pybind11::module &(std::string const &namespace_) > &M) { - { // mrpt::gui::CGlCanvasBaseHeadless file:mrpt/gui/CGlCanvasBase.h line:250 + { // mrpt::gui::CGlCanvasBaseHeadless file:mrpt/gui/CGlCanvasBase.h line:261 pybind11::class_, PyCallBack_mrpt_gui_CGlCanvasBaseHeadless, mrpt::gui::CGlCanvasBase> cl(M("mrpt::gui"), "CGlCanvasBaseHeadless", "A headless dummy implementation of CGlCanvasBase: can be used to keep track\n of user UI mouse events and update the camera parameters, with actual\n rendering being delegated to someone else. \n\n\n "); cl.def( pybind11::init( [](){ return new mrpt::gui::CGlCanvasBaseHeadless(); }, [](){ return new PyCallBack_mrpt_gui_CGlCanvasBaseHeadless(); } ) ); cl.def( pybind11::init( [](PyCallBack_mrpt_gui_CGlCanvasBaseHeadless const &o){ return new PyCallBack_mrpt_gui_CGlCanvasBaseHeadless(o); } ) ); diff --git a/python/src/mrpt/opengl/CCamera.cpp b/python/src/mrpt/opengl/CCamera.cpp index bcd58e3492..eb6da281d1 100644 --- a/python/src/mrpt/opengl/CCamera.cpp +++ b/python/src/mrpt/opengl/CCamera.cpp @@ -307,12 +307,14 @@ void bind_mrpt_opengl_CCamera(std::function< pybind11::module &(std::string cons cl.def("getPointingAtY", (float (mrpt::opengl::CCamera::*)() const) &mrpt::opengl::CCamera::getPointingAtY, "C++: mrpt::opengl::CCamera::getPointingAtY() const --> float"); cl.def("getPointingAtZ", (float (mrpt::opengl::CCamera::*)() const) &mrpt::opengl::CCamera::getPointingAtZ, "C++: mrpt::opengl::CCamera::getPointingAtZ() const --> float"); cl.def("getPointingAt", (struct mrpt::math::TPoint3D_ (mrpt::opengl::CCamera::*)() const) &mrpt::opengl::CCamera::getPointingAt, "C++: mrpt::opengl::CCamera::getPointingAt() const --> struct mrpt::math::TPoint3D_"); - cl.def("setZoomDistance", (void (mrpt::opengl::CCamera::*)(float)) &mrpt::opengl::CCamera::setZoomDistance, "C++: mrpt::opengl::CCamera::setZoomDistance(float) --> void", pybind11::arg("z")); cl.def("getZoomDistance", (float (mrpt::opengl::CCamera::*)() const) &mrpt::opengl::CCamera::getZoomDistance, "C++: mrpt::opengl::CCamera::getZoomDistance() const --> float"); cl.def("getAzimuthDegrees", (float (mrpt::opengl::CCamera::*)() const) &mrpt::opengl::CCamera::getAzimuthDegrees, "C++: mrpt::opengl::CCamera::getAzimuthDegrees() const --> float"); cl.def("getElevationDegrees", (float (mrpt::opengl::CCamera::*)() const) &mrpt::opengl::CCamera::getElevationDegrees, "C++: mrpt::opengl::CCamera::getElevationDegrees() const --> float"); + cl.def("getRollDegrees", (float (mrpt::opengl::CCamera::*)() const) &mrpt::opengl::CCamera::getRollDegrees, "C++: mrpt::opengl::CCamera::getRollDegrees() const --> float"); + cl.def("setZoomDistance", (void (mrpt::opengl::CCamera::*)(float)) &mrpt::opengl::CCamera::setZoomDistance, "C++: mrpt::opengl::CCamera::setZoomDistance(float) --> void", pybind11::arg("z")); cl.def("setAzimuthDegrees", (void (mrpt::opengl::CCamera::*)(float)) &mrpt::opengl::CCamera::setAzimuthDegrees, "C++: mrpt::opengl::CCamera::setAzimuthDegrees(float) --> void", pybind11::arg("ang")); cl.def("setElevationDegrees", (void (mrpt::opengl::CCamera::*)(float)) &mrpt::opengl::CCamera::setElevationDegrees, "C++: mrpt::opengl::CCamera::setElevationDegrees(float) --> void", pybind11::arg("ang")); + cl.def("setRollDegrees", (void (mrpt::opengl::CCamera::*)(float)) &mrpt::opengl::CCamera::setRollDegrees, "C++: mrpt::opengl::CCamera::setRollDegrees(float) --> void", pybind11::arg("ang")); cl.def("set6DOFMode", (void (mrpt::opengl::CCamera::*)(bool)) &mrpt::opengl::CCamera::set6DOFMode, "Set 6DOFMode, if enabled camera is set according to its pose, set via\nCRenderizable::setPose(). (default=false).\n Conventionally, eye is set looking towards +Z axis, \"down\" is the +Y\n axis, right is \"+X\" axis. In this mode azimuth/elevation are ignored.\n\nC++: mrpt::opengl::CCamera::set6DOFMode(bool) --> void", pybind11::arg("v")); cl.def("is6DOFMode", (bool (mrpt::opengl::CCamera::*)() const) &mrpt::opengl::CCamera::is6DOFMode, "C++: mrpt::opengl::CCamera::is6DOFMode() const --> bool"); cl.def("renderUpdateBuffers", (void (mrpt::opengl::CCamera::*)() const) &mrpt::opengl::CCamera::renderUpdateBuffers, "Render does nothing here. \n\nC++: mrpt::opengl::CCamera::renderUpdateBuffers() const --> void"); diff --git a/python/src/mrpt/opengl/DefaultShaders.cpp b/python/src/mrpt/opengl/DefaultShaders.cpp index 1ed2b7dcfd..17945fd3b2 100644 --- a/python/src/mrpt/opengl/DefaultShaders.cpp +++ b/python/src/mrpt/opengl/DefaultShaders.cpp @@ -86,6 +86,7 @@ void bind_mrpt_opengl_DefaultShaders(std::function< pybind11::module &(std::stri cl.def_readwrite("FOV", &mrpt::opengl::TRenderMatrices::FOV); cl.def_readwrite("azimuth", &mrpt::opengl::TRenderMatrices::azimuth); cl.def_readwrite("elev", &mrpt::opengl::TRenderMatrices::elev); + cl.def_readwrite("roll", &mrpt::opengl::TRenderMatrices::roll); cl.def_readwrite("eyeDistance", &mrpt::opengl::TRenderMatrices::eyeDistance); cl.def_readwrite("viewport_width", &mrpt::opengl::TRenderMatrices::viewport_width); cl.def_readwrite("viewport_height", &mrpt::opengl::TRenderMatrices::viewport_height); diff --git a/python/src/mrpt/opengl/Texture.cpp b/python/src/mrpt/opengl/Texture.cpp index d9281aa075..30c928d663 100644 --- a/python/src/mrpt/opengl/Texture.cpp +++ b/python/src/mrpt/opengl/Texture.cpp @@ -82,13 +82,14 @@ void bind_mrpt_opengl_Texture(std::function< pybind11::module &(std::string cons cl.def_readwrite("enableTransparency", &mrpt::opengl::Texture::Options::enableTransparency); cl.def_readwrite("wrappingModeS", &mrpt::opengl::Texture::Options::wrappingModeS); cl.def_readwrite("wrappingModeT", &mrpt::opengl::Texture::Options::wrappingModeT); + cl.def_readwrite("autoScale16to8bitConversion", &mrpt::opengl::Texture::Options::autoScale16to8bitConversion); } } - // mrpt::opengl::getNewTextureNumber() file:mrpt/opengl/Texture.h line:132 + // mrpt::opengl::getNewTextureNumber() file:mrpt/opengl/Texture.h line:137 M("mrpt::opengl").def("getNewTextureNumber", (unsigned int (*)()) &mrpt::opengl::getNewTextureNumber, "C++: mrpt::opengl::getNewTextureNumber() --> unsigned int"); - // mrpt::opengl::releaseTextureName(const unsigned int &) file:mrpt/opengl/Texture.h line:133 + // mrpt::opengl::releaseTextureName(const unsigned int &) file:mrpt/opengl/Texture.h line:138 M("mrpt::opengl").def("releaseTextureName", (void (*)(const unsigned int &)) &mrpt::opengl::releaseTextureName, "C++: mrpt::opengl::releaseTextureName(const unsigned int &) --> void", pybind11::arg("t")); { // mrpt::opengl::CRenderizableShaderTexturedTriangles file:mrpt/opengl/CRenderizableShaderTexturedTriangles.h line:28 diff --git a/python/stubs-out/mrpt/pymrpt/mrpt/gui.pyi b/python/stubs-out/mrpt/pymrpt/mrpt/gui.pyi index 8a44f448a0..b6e51a001b 100644 --- a/python/stubs-out/mrpt/pymrpt/mrpt/gui.pyi +++ b/python/stubs-out/mrpt/pymrpt/mrpt/gui.pyi @@ -567,6 +567,7 @@ class CGlCanvasBase: cameraPointingX: float cameraPointingY: float cameraPointingZ: float + cameraRollDeg: float cameraZoomDistance: float @overload def __init__(self) -> None: ... @@ -613,6 +614,10 @@ class CGlCanvasBase: def getOpenGLSceneRef(self, *args, **kwargs) -> Any: ... def getRefCameraParams(self, *args, **kwargs) -> Any: ... @overload + def getRollDegrees(self) -> float: ... + @overload + def getRollDegrees() -> float: ... + @overload def getUseCameraFromScene(self) -> bool: ... @overload def getUseCameraFromScene() -> bool: ... @@ -675,6 +680,10 @@ class CGlCanvasBase: def updateLastPos(self, x: int, y: int) -> None: ... def updateOrbitCamera(self, params, x: int, y: int) -> None: ... def updatePan(self, params, x: int, y: int) -> None: ... + @overload + def updateRoll(self, params, x: int, y: int) -> None: ... + @overload + def updateRoll(self, params, x: int, y: int, scale: float) -> None: ... def updateRotate(self, params, x: int, y: int) -> None: ... @overload def updateZoom(self, params, x: int, y: int) -> None: ... diff --git a/python/stubs-out/mrpt/pymrpt/mrpt/opengl/__init__.pyi b/python/stubs-out/mrpt/pymrpt/mrpt/opengl/__init__.pyi index fd21ef1880..8032948de5 100644 --- a/python/stubs-out/mrpt/pymrpt/mrpt/opengl/__init__.pyi +++ b/python/stubs-out/mrpt/pymrpt/mrpt/opengl/__init__.pyi @@ -565,6 +565,10 @@ class CCamera(CRenderizable): @overload def getProjectiveFOVdeg() -> float: ... @overload + def getRollDegrees(self) -> float: ... + @overload + def getRollDegrees() -> float: ... + @overload def getZoomDistance(self) -> float: ... @overload def getZoomDistance() -> float: ... @@ -631,6 +635,10 @@ class CCamera(CRenderizable): @overload def setProjectiveModel(bool) -> void: ... @overload + def setRollDegrees(self, ang: float) -> None: ... + @overload + def setRollDegrees(float) -> void: ... + @overload def setZoomDistance(self, z: float) -> None: ... @overload def setZoomDistance(float) -> void: ... @@ -3693,6 +3701,7 @@ class TRenderMatrices: pinhole_model: Optional[mrpt.pymrpt.mrpt.img.TCamera] pmv_matrix: Any pointing: Any + roll: float up: Any v_matrix: Any v_matrix_no_translation: Any @@ -3799,6 +3808,7 @@ class TTriangle: class Texture: class Options: + autoScale16to8bitConversion: bool enableTransparency: bool generateMipMaps: bool magnifyLinearFilter: bool diff --git a/version_prefix.txt b/version_prefix.txt index 089c9bb815..4d1c369be6 100644 --- a/version_prefix.txt +++ b/version_prefix.txt @@ -1,4 +1,4 @@ -2.14.5 +2.14.6 # IMPORTANT: This file is parsed by CMake, don't add any comment to # the first line. # This file is used in both Windows and Linux scripts to automatically