diff --git a/appveyor.yml b/appveyor.yml index ceae073969..1755b34cb2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ # version format -version: 2.9.4-{branch}-build{build} +version: 2.10.0-{branch}-build{build} os: Visual Studio 2019 @@ -41,8 +41,8 @@ install: - tree c:\tools\opencv\build /F - set OPENCVDIR=C:\tools\opencv\build\ # This variable is parsed by MRPT/cmakemodules/script_opencv.cmake: - - set OPENCV_DLLS_TO_INSTALL_DIRS=%OPENCVDIR%bin;%OPENCVDIR%x64\vc15\bin - - set PATH=%PATH%;%OPENCVDIR%\bin;%OPENCVDIR%\x64\vc15\bin + - set OPENCV_DLLS_TO_INSTALL_DIRS=%OPENCVDIR%bin;%OPENCVDIR%x64\vc16\bin + - set PATH=%PATH%;%OPENCVDIR%\bin;%OPENCVDIR%\x64\vc16\bin # ====== Install wxWidgets - cd c:\ - ps: Start-FileDownload 'https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.3/wxMSW-3.1.3_vc14x_x64_Dev.7z' diff --git a/doc/source/doxygen-docs/changelog.md b/doc/source/doxygen-docs/changelog.md index 3120a8807c..10634eaed5 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.10.0: Released July 9th, 2023 +- Changes in libraries: + - \ref mrpt_opengl_grp + - Move the parameter eyeDistance2lightShadowExtension from TRenderMatrices to mrpt::opengl::TLightParameters so it can be changed from user code (ABI change). + - New parameter mrpt::opengl::TLightParameters::minimum_shadow_map_extension_ratio +- Python: + - More pymrpt examples. +- BUG FIXES: + - pymrpt was not automatically built when invoking the python tests using `make test_legacy`. + # Version 2.9.4: Released July 1st, 2023 - Python: - pymrpt now ships stub `.pyi` files, for IDEs to autocomplete MRPT Python programs. diff --git a/doc/source/pymrpt_example_opengl-demo-gui.rst b/doc/source/pymrpt_example_opengl-demo-gui.rst new file mode 100644 index 0000000000..25e30a2c76 --- /dev/null +++ b/doc/source/pymrpt_example_opengl-demo-gui.rst @@ -0,0 +1,17 @@ +.. _pyexample_opengl-demo-gui: + +==================================================== +Python example: opengl-demo-gui.py +==================================================== + +This example illustrates how to create a 3D GUI in MRPT using the Python API +and populate it with different objects, including animating them across the scene. + +.. raw:: html + + + + +.. literalinclude:: ../../python-examples/opengl-demo-gui.py + :language: python + :linenos: diff --git a/doc/source/python_examples.rst b/doc/source/python_examples.rst index ee30742cc1..6e5907616d 100644 --- a/doc/source/python_examples.rst +++ b/doc/source/python_examples.rst @@ -19,6 +19,7 @@ C++ examples are `here `_. pymrpt_example_hwdriver_tao_imu_usb.rst pymrpt_example_lines-3d-geometry-example.rst pymrpt_example_matrices.rst + pymrpt_example_opengl-demo-gui.rst pymrpt_example_rbpf_slam.rst pymrpt_example_ros-poses-convert.rst pymrpt_example_se2-poses-example.rst diff --git a/libs/core/include/mrpt/core/common.h b/libs/core/include/mrpt/core/common.h index 337f79c842..f6b3099bfd 100644 --- a/libs/core/include/mrpt/core/common.h +++ b/libs/core/include/mrpt/core/common.h @@ -27,6 +27,8 @@ #pragma warning(disable : 4275) // DLL export class derived from STL // Warnings are emited even if a DLL export class contains a *private* STL field #pragma warning(disable : 4251) +// warning C4305: 'initializing': truncation from 'double' to 'float' +#pragma warning(disable : 4305) #if (_MSC_VER >= 1400) // MS believes they have the right to deprecate functions in the C++ Standard diff --git a/libs/opengl/include/mrpt/opengl/TLightParameters.h b/libs/opengl/include/mrpt/opengl/TLightParameters.h index 51a0e06889..b2cb170bba 100644 --- a/libs/opengl/include/mrpt/opengl/TLightParameters.h +++ b/libs/opengl/include/mrpt/opengl/TLightParameters.h @@ -38,6 +38,22 @@ struct TLightParameters float shadow_bias = 1e-5, shadow_bias_cam2frag = 1e-5, shadow_bias_normal = 1e-4; + /** Multiplier from eye distance to the length size of the squared area in + * which to evaluate shadow casting by unidirectional light. + * Unitless (meter/meter). + * \note (New in MRPT 2.10.0) + */ + double eyeDistance2lightShadowExtension = 2.0; + + /** Minimum extension (in [0,1] ratio of the light distance) of the shadow + * map square ortho frustum. Should be roughly the maximum area of the + * largest room for indoor environments to ensure no missing shadows in + * distant areas. + * + * \note (New in MRPT 2.10.0) + */ + float minimum_shadow_map_extension_ratio = 0.03f; + void writeToStream(mrpt::serialization::CArchive& out) const; void readFromStream(mrpt::serialization::CArchive& in); diff --git a/libs/opengl/include/mrpt/opengl/TRenderMatrices.h b/libs/opengl/include/mrpt/opengl/TRenderMatrices.h index c2e47bfaaf..35c4d1c76a 100644 --- a/libs/opengl/include/mrpt/opengl/TRenderMatrices.h +++ b/libs/opengl/include/mrpt/opengl/TRenderMatrices.h @@ -12,6 +12,7 @@ #include #include #include +#include namespace mrpt::opengl { @@ -84,11 +85,6 @@ struct TRenderMatrices double azimuth = .0, elev = .0; double eyeDistance = 1.0f; - /** Multiplier from eye distance to the length size of the squared area in - * which to evaluate shadow casting by unidirectional light. - */ - double eyeDistance2lightShadowExtension = 1.5; - /** In pixels. This may be smaller than the total render window. */ uint32_t viewport_width = 640, viewport_height = 480; @@ -121,7 +117,7 @@ struct TRenderMatrices /** Updates light_pv */ void computeLightProjectionMatrix( - float zmin, float zmax, const mrpt::math::TVector3Df& direction); + float zmin, float zmax, const TLightParameters& lp); /** Especial case for custom parameters of Orthographic projection. * Equivalent to `p_matrix = ortho(...);`. diff --git a/libs/opengl/src/TLightParameters.cpp b/libs/opengl/src/TLightParameters.cpp index 03a73a6f49..6dd23459b4 100644 --- a/libs/opengl/src/TLightParameters.cpp +++ b/libs/opengl/src/TLightParameters.cpp @@ -18,11 +18,13 @@ using namespace std; void TLightParameters::writeToStream(mrpt::serialization::CArchive& out) const { - const uint8_t version = 2; + const uint8_t version = 3; out << version; out << diffuse << ambient << specular << direction << color; out << shadow_bias << shadow_bias_cam2frag << shadow_bias_normal; // v2 + out << eyeDistance2lightShadowExtension + << minimum_shadow_map_extension_ratio; // v3 } void TLightParameters::readFromStream(mrpt::serialization::CArchive& in) @@ -44,11 +46,13 @@ void TLightParameters::readFromStream(mrpt::serialization::CArchive& in) break; case 1: case 2: + case 3: in >> diffuse >> ambient >> specular >> direction >> color; if (version >= 2) - { in >> shadow_bias >> shadow_bias_cam2frag >> shadow_bias_normal; - } + if (version >= 3) + in >> eyeDistance2lightShadowExtension >> + minimum_shadow_map_extension_ratio; break; default: MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(version); }; diff --git a/libs/opengl/src/TRenderMatrices.cpp b/libs/opengl/src/TRenderMatrices.cpp index 39e472535e..a17a10d669 100644 --- a/libs/opengl/src/TRenderMatrices.cpp +++ b/libs/opengl/src/TRenderMatrices.cpp @@ -12,6 +12,7 @@ #include #include // crossProduct3D() #include // dotProduct() +#include #include #include @@ -151,18 +152,22 @@ static void azimuthElevationFromDirection( } void TRenderMatrices::computeLightProjectionMatrix( - float zmin, float zmax, const mrpt::math::TVector3Df& direction) + float zmin, float zmax, const TLightParameters& lp) { m_last_light_z_near = zmin; m_last_light_z_far = zmax; - float dist = eyeDistance * eyeDistance2lightShadowExtension; + float dist = eyeDistance * lp.eyeDistance2lightShadowExtension; + + // Ensure dist is not too small: + mrpt::keep_max(dist, zmax * lp.minimum_shadow_map_extension_ratio); + light_p = OrthoProjectionMatrix(-dist, dist, -dist, dist, zmin, zmax); // "up" vector from elevation: float azim = 0, elevation = 0; - azimuthElevationFromDirection(direction, elevation, azim); + azimuthElevationFromDirection(lp.direction, elevation, azim); const auto lightUp = mrpt::math::TVector3Df( -cos(azim) * sin(elevation), // x @@ -170,7 +175,7 @@ void TRenderMatrices::computeLightProjectionMatrix( cos(elevation) // z ); - light_v = LookAt(pointing - direction * zmax * 0.5, pointing, lightUp); + light_v = LookAt(pointing - lp.direction * zmax * 0.5, pointing, lightUp); light_pv.asEigen() = light_p.asEigen() * light_v.asEigen(); diff --git a/libs/opengl/src/Viewport.cpp b/libs/opengl/src/Viewport.cpp index aa3c05ee32..63a8172951 100644 --- a/libs/opengl/src/Viewport.cpp +++ b/libs/opengl/src/Viewport.cpp @@ -1302,7 +1302,7 @@ void Viewport::updateMatricesFromCamera(const CCamera& myCamera) const // Compute the directional light projection matrix (light_pv) _.computeLightProjectionMatrix( - m_lightShadowClipMin, m_lightShadowClipMax, m_light.direction); + m_lightShadowClipMin, m_lightShadowClipMax, m_light); _.initialized = true; } diff --git a/package.xml b/package.xml index 5d9ff66e42..eef87c6d7a 100644 --- a/package.xml +++ b/package.xml @@ -7,7 +7,7 @@ mrpt2 - 2.9.4 + 2.10.0 Mobile Robot Programming Toolkit (MRPT) version 2.x Jose-Luis Blanco-Claraco diff --git a/python-examples/global_localization.py b/python-examples/global_localization.py index 2710b56a3d..8bd748b569 100755 --- a/python-examples/global_localization.py +++ b/python-examples/global_localization.py @@ -10,14 +10,12 @@ # # ./global_localization.py ../share/mrpt/config_files/pf-localization/localization_demo.ini # -from mrpt import pymrpt +from mrpt.pymrpt import mrpt import os import sys import argparse from time import sleep -mrpt = pymrpt.mrpt # namespace shortcut - # args parser = argparse.ArgumentParser() diff --git a/python-examples/hwdriver-tao-imu-usb.py b/python-examples/hwdriver-tao-imu-usb.py index 09ec6b3c6d..83aca5cd25 100755 --- a/python-examples/hwdriver-tao-imu-usb.py +++ b/python-examples/hwdriver-tao-imu-usb.py @@ -5,8 +5,7 @@ # export PYTHONPATH=$HOME/code/mrpt/build-Release/:$PYTHONPATH # --------------------------------------------------------------------- -from mrpt import pymrpt -mrpt = pymrpt.mrpt # namespace shortcut +from mrpt.pymrpt import mrpt imu = mrpt.hwdrivers.CTaoboticsIMU() diff --git a/python-examples/lines-3d-geometry-example.py b/python-examples/lines-3d-geometry-example.py index d9574c2c5a..2a238a048a 100755 --- a/python-examples/lines-3d-geometry-example.py +++ b/python-examples/lines-3d-geometry-example.py @@ -5,8 +5,7 @@ # export PYTHONPATH=$HOME/code/mrpt/build-Release/:$PYTHONPATH # --------------------------------------------------------------------- -from mrpt import pymrpt -mrpt = pymrpt.mrpt +from mrpt.pymrpt import mrpt # Aliases: TPoint3D = mrpt.math.TPoint3D_double_t diff --git a/python-examples/matrices.py b/python-examples/matrices.py index fae5280046..c2f3a46ef7 100755 --- a/python-examples/matrices.py +++ b/python-examples/matrices.py @@ -8,9 +8,8 @@ # More matrix classes available in the module mrpt.math. # See: https://mrpt.github.io/pymrpt-docs/mrpt.pymrpt.mrpt.math.html -from mrpt import pymrpt +from mrpt.pymrpt import mrpt import numpy as np -mrpt = pymrpt.mrpt # Create a numpy matrix from a list: m1_np = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) diff --git a/python-examples/opengl-demo-gui.py b/python-examples/opengl-demo-gui.py new file mode 100755 index 0000000000..6ede53d398 --- /dev/null +++ b/python-examples/opengl-demo-gui.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 + +# --------------------------------------------------------------------- +# Install python3-pymrpt, ros-$ROS_DISTRO-mrpt2, or test with a local build with: +# export PYTHONPATH=$HOME/code/mrpt/build-Release/:$PYTHONPATH +# --------------------------------------------------------------------- + +from mrpt.pymrpt import mrpt +import time +import math + +# Create GUI: +win = mrpt.gui.CDisplayWindow3D('MRPT GUI demo', 800, 600) + +# Get and lock 3D scene: +# Lock is required again each time the scene is modified, to prevent +# data race between the main and the rendering threads. +scene = win.get3DSceneAndLock() + +# A grid on the XY horizontal plane: +# ctor args: xMin: float, xMax: float, yMin: float, yMax: float, z: float, frequency: float +glGrid = mrpt.opengl.CGridPlaneXY.Create(-3, 3, -3, 3, 0, 1) +scene.insert(glGrid) + +# A couple of XYZ "corners": +glCorner = mrpt.opengl.stock_objects.CornerXYZ(2.0) +scene.insert(glCorner) + +glCorner2: mrpt.opengl.CSetOfObjects = mrpt.opengl.stock_objects.CornerXYZ(1.0) +glCorner2.setLocation(4.0, 0.0, 0.0) +scene.insert(glCorner2) + +# A 3D inverse-depth ellipsoid: +glEllip = mrpt.opengl.CEllipsoidInverseDepth3D() +cov = mrpt.math.CMatrixFixed_double_3UL_3UL_t.Zero() +cov[0, 0] = 0.01 +cov[1, 1] = 0.001 +cov[2, 2] = 0.002 +mean = mrpt.math.CMatrixFixed_double_3UL_1UL_t() +mean[0, 0] = 0.2 # inv_range +mean[1, 0] = 0.5 # yaw +mean[2, 0] = -0.6 # pitch +glEllip.setCovMatrixAndMean(cov, mean) +scene.insert(glEllip) + +# A floor "block": +glFloor = mrpt.opengl.CBox() +glFloor.setBoxCorners(mrpt.math.TPoint3D_double_t(-15, -15, 0), + mrpt.math.TPoint3D_double_t(15, 15, 0.1)) +glFloor.setLocation(0, 0, -3.0) +glFloor.setColor_u8(mrpt.img.TColor(0x70, 0x70, 0x70)) +scene.insert(glFloor) + +# A mobile box to illustrate animations: +glBox = mrpt.opengl.CBox() +glBox.setBoxCorners(mrpt.math.TPoint3D_double_t(0, 0, 0), + mrpt.math.TPoint3D_double_t(1, 1, 1)) +glBox.setBoxBorderColor(mrpt.img.TColor(0, 0, 0)) +glBox.castShadows(True) +scene.insert(glBox) + +# Shadows are disabled by default, enable them: +scene.getViewport().enableShadowCasting(True) +print('Shadow casting: ' + str(scene.getViewport().isShadowCastingEnabled())) + +# Move camera: +win.setCameraAzimuthDeg(-40.0) +win.setCameraElevationDeg(30.0) + +# end of scene lock: +win.unlockAccess3DScene() + + +print('Close the window to quit the program') +timer = mrpt.system.CTicTac() + +while win.isOpen(): + y = 5.0*math.sin(1.0*timer.Tac()) + glBox.setLocation(4.0, y, 0.0) + + win.repaint() + time.sleep(50e-3) diff --git a/python-examples/rbpf_slam.py b/python-examples/rbpf_slam.py index 8ba4fa32ba..2cc5bb0199 100755 --- a/python-examples/rbpf_slam.py +++ b/python-examples/rbpf_slam.py @@ -14,11 +14,9 @@ # ./rbpf_slam.py -c ../share/mrpt/config_files/rbpf-slam/gridmapping_optimal_sampling.ini ../share/mrpt/datasets/2006-01ENE-21-SENA_Telecom\ Faculty_one_loop_only.rawlog # -from mrpt import pymrpt +from mrpt.pymrpt import mrpt import argparse -mrpt = pymrpt.mrpt - # args parser = argparse.ArgumentParser() parser.add_argument('rawlog', help='Rawlog file.') diff --git a/python-examples/ros-poses-convert.py b/python-examples/ros-poses-convert.py index dec526e5a3..1ecbd7a237 100755 --- a/python-examples/ros-poses-convert.py +++ b/python-examples/ros-poses-convert.py @@ -8,11 +8,11 @@ # This example shows how to convert back and forth between MRPT poses # and ROS 1 or ROS 2 (both are compatible with this same code) Pose -from mrpt import pymrpt, ros_bridge +from mrpt.pymrpt import mrpt +from mrpt import ros_bridge from math import radians from geometry_msgs.msg import Pose, PoseWithCovariance -mrpt = pymrpt.mrpt # Example 1: 2D pose # -------------------------- diff --git a/python-examples/se3-poses-example.py b/python-examples/se3-poses-example.py index e8b670d502..6ba2b4dffa 100755 --- a/python-examples/se3-poses-example.py +++ b/python-examples/se3-poses-example.py @@ -5,9 +5,8 @@ # export PYTHONPATH=$HOME/code/mrpt/build-Release/:$PYTHONPATH # --------------------------------------------------------------------- +from mrpt.pymrpt import mrpt from math import radians -from mrpt import pymrpt -mrpt = pymrpt.mrpt p1 = mrpt.poses.CPose3D.FromXYZYawPitchRoll( 1.0, 2.0, 0, radians(90), radians(0), radians(0)) diff --git a/python/generate-python-stubs.sh b/python/generate-python-stubs.sh new file mode 100755 index 0000000000..07e4efd0b1 --- /dev/null +++ b/python/generate-python-stubs.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Usage: ./generate-python-stubs.sh +# To be run *after* building pymrpt. + + +# Generate stub .pyi files: +echo "Generating stub pyi files..." +export PYTHONPATH=$(realpath $(pwd)/../build-Release/) +if compgen -G "$PYTHONPATH/mrpt/pymrpt*.so" > /dev/null; then + echo "Using mrpt module found under: $PYTHONPATH" +else + echo "$PYTHONPATH does not seem to contain a compiled pymrpt module!" + exit 1 +fi +stubgen -p mrpt -p mrpt.pymrpt -o stubs-out + +# applying manual patches to stubs: +echo "Applying manual patches to stubs..." +find . -name "patch-stubs*.diff" | xargs -I FIL bash -c "echo FIL && git apply FIL" diff --git a/python/generate-python.sh b/python/generate-python.sh index 2281664882..1759f09a22 100755 --- a/python/generate-python.sh +++ b/python/generate-python.sh @@ -93,8 +93,6 @@ find $WRAP_OUT_DIR -name "*.cpp" | xargs -I FIL \ sed -i -e 's/(long)/(int64_t)/g' FIL # applying manual patches: -echo "Applying manual patches..." -find . -name "*.diff" | xargs -I FIL bash -c "git apply FIL" +echo "Applying manual patches to pybind11 code..." +find . -name "patch-0*.diff" | xargs -I FIL bash -c "echo FIL && git apply FIL" -# Generate stub .pyi files: -stubgen -p mrpt -p mrpt.pymrpt -o stubs-out diff --git a/python/patch-009.diff b/python/patch-stubs-001.diff similarity index 100% rename from python/patch-009.diff rename to python/patch-stubs-001.diff diff --git a/python/patch-stubs-002.diff b/python/patch-stubs-002.diff new file mode 100644 index 0000000000..ce284b7fa6 --- /dev/null +++ b/python/patch-stubs-002.diff @@ -0,0 +1,24 @@ +diff --git a/python/stubs-out/mrpt/pymrpt/mrpt/opengl/__init__.pyi b/python/stubs-out/mrpt/pymrpt/mrpt/opengl/__init__.pyi +index 8abd014c7..d29cf054a 100644 +--- a/python/stubs-out/mrpt/pymrpt/mrpt/opengl/__init__.pyi ++++ b/python/stubs-out/mrpt/pymrpt/mrpt/opengl/__init__.pyi +@@ -1,5 +1,7 @@ + from typing import Any, ClassVar, Dict, List, Optional, Tuple + ++from . import stock_objects ++ + from typing import overload + import mrpt.pymrpt.mrpt.containers + import mrpt.pymrpt.mrpt.img +diff --git a/python/stubs-out/mrpt/pymrpt/mrpt/poses/__init__.pyi b/python/stubs-out/mrpt/pymrpt/mrpt/poses/__init__.pyi +index 09ba314ee..6d716eb80 100644 +--- a/python/stubs-out/mrpt/pymrpt/mrpt/poses/__init__.pyi ++++ b/python/stubs-out/mrpt/pymrpt/mrpt/poses/__init__.pyi +@@ -1,5 +1,7 @@ + from typing import Any, ClassVar, Dict, Tuple + ++from . import Lie ++ + from typing import overload + import mrpt.pymrpt.mrpt + import mrpt.pymrpt.mrpt.bayes diff --git a/python/src/mrpt/opengl/DefaultShaders.cpp b/python/src/mrpt/opengl/DefaultShaders.cpp index 29f71a4b6d..df85da7cff 100644 --- a/python/src/mrpt/opengl/DefaultShaders.cpp +++ b/python/src/mrpt/opengl/DefaultShaders.cpp @@ -68,7 +68,7 @@ void bind_mrpt_opengl_DefaultShaders(std::function< pybind11::module &(std::stri pybind11::class_> cl(M("mrpt::opengl"), "DefaultShaderID", ""); cl.def( pybind11::init( [](){ return new mrpt::opengl::DefaultShaderID(); } ) ); } - { // mrpt::opengl::TRenderMatrices file:mrpt/opengl/TRenderMatrices.h line:28 + { // mrpt::opengl::TRenderMatrices file:mrpt/opengl/TRenderMatrices.h line:29 pybind11::class_> cl(M("mrpt::opengl"), "TRenderMatrices", "Rendering state related to the projection and model-view matrices.\n Used to store matrices that will be sent to shaders.\n\n The homogeneous coordinates of a rendered point comes from the product\n (from right to left) of MODEL, VIEW and PROJECTION matrices:\n\n p = p_matrix * v_matrix * m_matrix * [x y z 1.0]'\n\n \n\n "); cl.def( pybind11::init( [](){ return new mrpt::opengl::TRenderMatrices(); } ) ); cl.def( pybind11::init( [](mrpt::opengl::TRenderMatrices const &o){ return new mrpt::opengl::TRenderMatrices(o); } ) ); @@ -88,7 +88,6 @@ void bind_mrpt_opengl_DefaultShaders(std::function< pybind11::module &(std::stri cl.def_readwrite("azimuth", &mrpt::opengl::TRenderMatrices::azimuth); cl.def_readwrite("elev", &mrpt::opengl::TRenderMatrices::elev); cl.def_readwrite("eyeDistance", &mrpt::opengl::TRenderMatrices::eyeDistance); - cl.def_readwrite("eyeDistance2lightShadowExtension", &mrpt::opengl::TRenderMatrices::eyeDistance2lightShadowExtension); cl.def_readwrite("viewport_width", &mrpt::opengl::TRenderMatrices::viewport_width); cl.def_readwrite("viewport_height", &mrpt::opengl::TRenderMatrices::viewport_height); cl.def_readwrite("initialized", &mrpt::opengl::TRenderMatrices::initialized); @@ -98,7 +97,7 @@ void bind_mrpt_opengl_DefaultShaders(std::function< pybind11::module &(std::stri cl.def_readwrite("up", &mrpt::opengl::TRenderMatrices::up); cl.def("matricesSetIdentity", (void (mrpt::opengl::TRenderMatrices::*)()) &mrpt::opengl::TRenderMatrices::matricesSetIdentity, "C++: mrpt::opengl::TRenderMatrices::matricesSetIdentity() --> void"); cl.def("computeProjectionMatrix", (void (mrpt::opengl::TRenderMatrices::*)(float, float)) &mrpt::opengl::TRenderMatrices::computeProjectionMatrix, "Uses is_projective , vw,vh, etc. and computes p_matrix from either:\n - pinhole_model if set, or\n - FOV, otherwise.\n Replacement for obsolete: gluPerspective() and glOrtho() \n\nC++: mrpt::opengl::TRenderMatrices::computeProjectionMatrix(float, float) --> void", pybind11::arg("zmin"), pybind11::arg("zmax")); - cl.def("computeLightProjectionMatrix", (void (mrpt::opengl::TRenderMatrices::*)(float, float, const struct mrpt::math::TPoint3D_ &)) &mrpt::opengl::TRenderMatrices::computeLightProjectionMatrix, "Updates light_pv \n\nC++: mrpt::opengl::TRenderMatrices::computeLightProjectionMatrix(float, float, const struct mrpt::math::TPoint3D_ &) --> void", pybind11::arg("zmin"), pybind11::arg("zmax"), pybind11::arg("direction")); + cl.def("computeLightProjectionMatrix", (void (mrpt::opengl::TRenderMatrices::*)(float, float, const struct mrpt::opengl::TLightParameters &)) &mrpt::opengl::TRenderMatrices::computeLightProjectionMatrix, "Updates light_pv \n\nC++: mrpt::opengl::TRenderMatrices::computeLightProjectionMatrix(float, float, const struct mrpt::opengl::TLightParameters &) --> void", pybind11::arg("zmin"), pybind11::arg("zmax"), pybind11::arg("lp")); cl.def("computeOrthoProjectionMatrix", (void (mrpt::opengl::TRenderMatrices::*)(float, float, float, float, float, float)) &mrpt::opengl::TRenderMatrices::computeOrthoProjectionMatrix, "Especial case for custom parameters of Orthographic projection.\n Equivalent to `p_matrix = ortho(...);`.\n\n Replacement for obsolete: glOrtho()\n\nC++: mrpt::opengl::TRenderMatrices::computeOrthoProjectionMatrix(float, float, float, float, float, float) --> void", pybind11::arg("left"), pybind11::arg("right"), pybind11::arg("bottom"), pybind11::arg("top"), pybind11::arg("znear"), pybind11::arg("zfar")); cl.def_static("OrthoProjectionMatrix", (class mrpt::math::CMatrixFixed (*)(float, float, float, float, float, float)) &mrpt::opengl::TRenderMatrices::OrthoProjectionMatrix, "Computes and returns an orthographic projection matrix.\n Equivalent to obsolete glOrtho() or glm::ortho().\n\nC++: mrpt::opengl::TRenderMatrices::OrthoProjectionMatrix(float, float, float, float, float, float) --> class mrpt::math::CMatrixFixed", pybind11::arg("left"), pybind11::arg("right"), pybind11::arg("bottom"), pybind11::arg("top"), pybind11::arg("znear"), pybind11::arg("zfar")); cl.def("computeNoProjectionMatrix", (void (mrpt::opengl::TRenderMatrices::*)(float, float)) &mrpt::opengl::TRenderMatrices::computeNoProjectionMatrix, "Especial case: no projection, opengl coordinates are pixels from (0,0)\n bottom-left corner.\n\nC++: mrpt::opengl::TRenderMatrices::computeNoProjectionMatrix(float, float) --> void", pybind11::arg("znear"), pybind11::arg("zfar")); @@ -142,6 +141,8 @@ void bind_mrpt_opengl_DefaultShaders(std::function< pybind11::module &(std::stri cl.def_readwrite("shadow_bias", &mrpt::opengl::TLightParameters::shadow_bias); cl.def_readwrite("shadow_bias_cam2frag", &mrpt::opengl::TLightParameters::shadow_bias_cam2frag); cl.def_readwrite("shadow_bias_normal", &mrpt::opengl::TLightParameters::shadow_bias_normal); + cl.def_readwrite("eyeDistance2lightShadowExtension", &mrpt::opengl::TLightParameters::eyeDistance2lightShadowExtension); + cl.def_readwrite("minimum_shadow_map_extension_ratio", &mrpt::opengl::TLightParameters::minimum_shadow_map_extension_ratio); cl.def("writeToStream", (void (mrpt::opengl::TLightParameters::*)(class mrpt::serialization::CArchive &) const) &mrpt::opengl::TLightParameters::writeToStream, "C++: mrpt::opengl::TLightParameters::writeToStream(class mrpt::serialization::CArchive &) const --> void", pybind11::arg("out")); cl.def("readFromStream", (void (mrpt::opengl::TLightParameters::*)(class mrpt::serialization::CArchive &)) &mrpt::opengl::TLightParameters::readFromStream, "C++: mrpt::opengl::TLightParameters::readFromStream(class mrpt::serialization::CArchive &) --> void", pybind11::arg("in")); cl.def("assign", (struct mrpt::opengl::TLightParameters & (mrpt::opengl::TLightParameters::*)(const struct mrpt::opengl::TLightParameters &)) &mrpt::opengl::TLightParameters::operator=, "C++: mrpt::opengl::TLightParameters::operator=(const struct mrpt::opengl::TLightParameters &) --> struct mrpt::opengl::TLightParameters &", pybind11::return_value_policy::automatic, pybind11::arg("")); diff --git a/python/stubs-out/mrpt/pymrpt/mrpt/opengl/__init__.pyi b/python/stubs-out/mrpt/pymrpt/mrpt/opengl/__init__.pyi index 237845e70f..d29cf054a1 100644 --- a/python/stubs-out/mrpt/pymrpt/mrpt/opengl/__init__.pyi +++ b/python/stubs-out/mrpt/pymrpt/mrpt/opengl/__init__.pyi @@ -1,5 +1,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Tuple +from . import stock_objects + from typing import overload import mrpt.pymrpt.mrpt.containers import mrpt.pymrpt.mrpt.img @@ -3605,6 +3607,8 @@ class TLightParameters: color: mrpt.pymrpt.mrpt.img.TColorf diffuse: float direction: Any + eyeDistance2lightShadowExtension: float + minimum_shadow_map_extension_ratio: float shadow_bias: float shadow_bias_cam2frag: float shadow_bias_normal: float @@ -3660,7 +3664,6 @@ class TRenderMatrices: elev: float eye: Any eyeDistance: float - eyeDistance2lightShadowExtension: float initialized: bool is1stShadowMapPass: bool is_projective: bool @@ -3686,7 +3689,7 @@ class TRenderMatrices: def LookAt(self, *args, **kwargs) -> Any: ... def OrthoProjectionMatrix(self, *args, **kwargs) -> Any: ... def assign(self) -> TRenderMatrices: ... - def computeLightProjectionMatrix(self, zmin: float, zmax: float, direction) -> None: ... + def computeLightProjectionMatrix(self, zmin: float, zmax: float, lp) -> None: ... def computeNoProjectionMatrix(self, znear: float, zfar: float) -> None: ... def computeOrthoProjectionMatrix(self, *args, **kwargs) -> Any: ... def computeProjectionMatrix(self, *args, **kwargs) -> Any: ... diff --git a/python/stubs-out/mrpt/pymrpt/mrpt/poses/__init__.pyi b/python/stubs-out/mrpt/pymrpt/mrpt/poses/__init__.pyi index 09ba314ee5..6d716eb800 100644 --- a/python/stubs-out/mrpt/pymrpt/mrpt/poses/__init__.pyi +++ b/python/stubs-out/mrpt/pymrpt/mrpt/poses/__init__.pyi @@ -1,5 +1,7 @@ from typing import Any, ClassVar, Dict, Tuple +from . import Lie + from typing import overload import mrpt.pymrpt.mrpt import mrpt.pymrpt.mrpt.bayes diff --git a/python/stubs-out/mrpt/pymrpt/std/chrono.pyi b/python/stubs-out/mrpt/pymrpt/std/chrono.pyi index 6ab9717938..dbc88f81c0 100644 --- a/python/stubs-out/mrpt/pymrpt/std/chrono.pyi +++ b/python/stubs-out/mrpt/pymrpt/std/chrono.pyi @@ -37,6 +37,6 @@ class time_point_mrpt_Clock_std_chrono_duration_long_std_ratio_1_10000000_t: def max(self, *args, **kwargs) -> Any: ... def min(self, *args, **kwargs) -> Any: ... def time_since_epoch(self) -> duration_long_std_ratio_1_10000000_t: ... - def to_double()(self, *args, **kwargs) -> Any: ... + def to_double(self) -> float: ... def __iadd__(self, __dur: duration_long_std_ratio_1_10000000_t) -> time_point_mrpt_Clock_std_chrono_duration_long_std_ratio_1_10000000_t: ... def __isub__(self, __dur: duration_long_std_ratio_1_10000000_t) -> time_point_mrpt_Clock_std_chrono_duration_long_std_ratio_1_10000000_t: ... diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e473a7984a..c6f0f83162 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -199,6 +199,7 @@ function(mrpt_add_python_test NAME) message(STATUS "pytest cmd: ${cmd}") add_custom_target(run_test_python_${NAME} COMMAND ${cmd}) add_dependencies(test_legacy run_test_python_${NAME}) + add_dependencies(run_test_python_${NAME} pymrpt) endfunction() if (CMAKE_MRPT_HAS_PYTHON_BINDINGS) diff --git a/version_prefix.txt b/version_prefix.txt index 2618ed19e6..2bda831cc9 100644 --- a/version_prefix.txt +++ b/version_prefix.txt @@ -1,4 +1,4 @@ -2.9.4 +2.10.0 # 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