├── .clang-format ├── .github └── workflows │ ├── bloom.yml │ ├── build.yml │ └── colcon-workspace.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENCE ├── README.md ├── cmake ├── AndroidUtils.cmake ├── CreateMethodCallFile.cmake ├── EmbedBinaryFiles.cmake ├── EmbedShaderFiles.cmake ├── EmscriptenUtils.cmake ├── FindDC1394.cmake ├── FindDepthSense.cmake ├── FindFFMPEG.cmake ├── FindGLEW.cmake ├── FindGLUES.cmake ├── FindLibraw.cmake ├── FindLz4.cmake ├── FindMediaFoundation.cmake ├── FindOculus.cmake ├── FindOpenEXR.cmake ├── FindOpenNI.cmake ├── FindOpenNI2.cmake ├── FindPleora.cmake ├── FindRealSense.cmake ├── FindRealSense2.cmake ├── FindTeliCam.cmake ├── FindTooN.cmake ├── FindXrandr.cmake ├── Findepoxy.cmake ├── Findlibusb1.cmake ├── Findpthread.cmake ├── Finduvc.cmake ├── Findzstd.cmake ├── MakePythonWheel.cmake ├── PangolinConfig.cmake.in ├── PangolinConfigVersion.cmake.in ├── PangolinFactory.cmake ├── SetPlatformVars.cmake ├── cmake_uninstall.cmake.in └── wheel-dist-info │ ├── METADATA │ ├── WHEEL │ └── top_level.txt ├── components ├── pango_core │ ├── CMakeLists.txt │ ├── include │ │ ├── NaturalSort │ │ │ ├── LICENSE.md │ │ │ ├── README.md │ │ │ └── natural_sort.hpp │ │ ├── dynalo │ │ │ ├── detail │ │ │ │ ├── config.hpp │ │ │ │ ├── linux │ │ │ │ │ └── dynalo.hpp │ │ │ │ ├── macos │ │ │ │ │ └── dynalo.hpp │ │ │ │ └── windows │ │ │ │ │ └── dynalo.hpp │ │ │ ├── dynalo.hpp │ │ │ └── symbol_helper.hpp │ │ ├── pangolin │ │ │ ├── compat │ │ │ │ ├── glutbitmap.h │ │ │ │ └── type_traits.h │ │ │ ├── factory │ │ │ │ ├── factory.h │ │ │ │ ├── factory_help.h │ │ │ │ └── factory_registry.h │ │ │ ├── pangolin.h │ │ │ ├── platform.h │ │ │ └── utils │ │ │ │ ├── argagg.hpp │ │ │ │ ├── assert.h │ │ │ │ ├── avx_math.h │ │ │ │ ├── bitmask.h │ │ │ │ ├── compontent_cast.h │ │ │ │ ├── file_extension.h │ │ │ │ ├── file_utils.h │ │ │ │ ├── fix_size_buffer_queue.h │ │ │ │ ├── format_string.h │ │ │ │ ├── is_streamable.h │ │ │ │ ├── log.h │ │ │ │ ├── memstreambuf.h │ │ │ │ ├── param_set.h │ │ │ │ ├── params.h │ │ │ │ ├── parse.h │ │ │ │ ├── picojson.h │ │ │ │ ├── posix │ │ │ │ ├── condition_variable.h │ │ │ │ ├── semaphore.h │ │ │ │ └── shared_memory_buffer.h │ │ │ │ ├── range.h │ │ │ │ ├── signal_slot.h │ │ │ │ ├── sigstate.h │ │ │ │ ├── simple_math.h │ │ │ │ ├── threadedfilebuf.h │ │ │ │ ├── timer.h │ │ │ │ ├── transform.h │ │ │ │ ├── true_false_toggle.h │ │ │ │ ├── type_convert.h │ │ │ │ ├── uri.h │ │ │ │ ├── variadic_all.h │ │ │ │ └── xml │ │ │ │ ├── license.txt │ │ │ │ ├── rapidxml.hpp │ │ │ │ ├── rapidxml_iterators.hpp │ │ │ │ ├── rapidxml_print.hpp │ │ │ │ └── rapidxml_utils.hpp │ │ └── sigslot │ │ │ ├── LICENCE │ │ │ ├── README.md │ │ │ └── signal.hpp │ ├── src │ │ ├── avx_math.cpp │ │ ├── dummy.cpp │ │ ├── factory │ │ │ ├── factory_help.cpp │ │ │ └── factory_registry.cpp │ │ ├── file_extension.cpp │ │ ├── file_utils.cpp │ │ ├── param_set.cpp │ │ ├── posix │ │ │ ├── condition_variable.cpp │ │ │ ├── semaphore.cpp │ │ │ └── shared_memory_buffer.cpp │ │ ├── sigstate.cpp │ │ ├── threadedfilebuf.cpp │ │ └── uri.cpp │ └── tests │ │ └── tests_uri.cpp ├── pango_display │ ├── CMakeLists.txt │ ├── include │ │ └── pangolin │ │ │ ├── console │ │ │ ├── ConsoleView.h │ │ │ └── InterpreterInterface.h │ │ │ ├── display │ │ │ ├── attach.h │ │ │ ├── default_font.h │ │ │ ├── display.h │ │ │ ├── display.hpp │ │ │ ├── image_view.h │ │ │ ├── process.h │ │ │ ├── user_app.h │ │ │ ├── view.h │ │ │ └── widgets.h │ │ │ └── handler │ │ │ ├── handler.h │ │ │ ├── handler_glbuffer.h │ │ │ └── handler_image.h │ └── src │ │ ├── ConsoleView.cpp │ │ ├── default_font.cpp │ │ ├── display.cpp │ │ ├── handler.cpp │ │ ├── handler_glbuffer.cpp │ │ ├── handler_image.cpp │ │ ├── image_view.cpp │ │ ├── pangolin_gl.cpp │ │ ├── pangolin_gl.h │ │ ├── process.cpp │ │ ├── view.cpp │ │ └── widgets.cpp ├── pango_geometry │ ├── CMakeLists.txt │ ├── include │ │ └── pangolin │ │ │ └── geometry │ │ │ ├── geometry.h │ │ │ ├── geometry_obj.h │ │ │ └── geometry_ply.h │ └── src │ │ ├── geometry.cpp │ │ ├── geometry_obj.cpp │ │ └── geometry_ply.cpp ├── pango_glgeometry │ ├── CMakeLists.txt │ ├── include │ │ └── pangolin │ │ │ └── geometry │ │ │ └── glgeometry.h │ └── src │ │ └── glgeometry.cpp ├── pango_image │ ├── CMakeLists.txt │ ├── include │ │ └── pangolin │ │ │ └── image │ │ │ ├── copy.h │ │ │ ├── image.h │ │ │ ├── image_convert.h │ │ │ ├── image_io.h │ │ │ ├── image_utils.h │ │ │ ├── managed_image.h │ │ │ ├── memcpy.h │ │ │ ├── pixel_format.h │ │ │ ├── shared_image.h │ │ │ └── typed_image.h │ └── src │ │ ├── image_io.cpp │ │ ├── image_io_bmp.cpp │ │ ├── image_io_exr.cpp │ │ ├── image_io_jpg.cpp │ │ ├── image_io_libraw.cpp │ │ ├── image_io_lz4.cpp │ │ ├── image_io_packed12bit.cpp │ │ ├── image_io_pango.cpp │ │ ├── image_io_png.cpp │ │ ├── image_io_ppm.cpp │ │ ├── image_io_raw.cpp │ │ ├── image_io_tga.cpp │ │ ├── image_io_tiff.cpp │ │ ├── image_io_zstd.cpp │ │ └── pixel_format.cpp ├── pango_opengl │ ├── CMakeLists.txt │ ├── include │ │ └── pangolin │ │ │ └── gl │ │ │ ├── cg.h │ │ │ ├── colour.h │ │ │ ├── compat │ │ │ ├── gl2engine.h │ │ │ └── gl_es_compat.h │ │ │ ├── gl.h │ │ │ ├── gl.hpp │ │ │ ├── glchar.h │ │ │ ├── glcuda.h │ │ │ ├── gldraw.h │ │ │ ├── glfont.h │ │ │ ├── glformattraits.h │ │ │ ├── glinclude.h │ │ │ ├── glpangoglu.h │ │ │ ├── glpixformat.h │ │ │ ├── glplatform.h │ │ │ ├── glsl.h │ │ │ ├── glsl.hpp │ │ │ ├── glsl_utilities.h │ │ │ ├── glstate.h │ │ │ ├── gltext.h │ │ │ ├── gltexturecache.h │ │ │ ├── glvbo.h │ │ │ ├── opengl_render_state.h │ │ │ └── viewport.h │ ├── shaders │ │ ├── colormaps.glsl.h │ │ ├── font.glsl.h │ │ ├── main_experiments.glsl │ │ ├── main_text.glsl │ │ ├── main_widgets.glsl │ │ ├── matcap.glsl.h │ │ ├── noise.glsl.h │ │ ├── sdf.glsl.h │ │ └── utils.glsl.h │ └── src │ │ ├── compat │ │ └── gl2engine.cpp │ │ ├── fonts │ │ ├── AnonymousPro.ttf │ │ └── AnonymousPro.txt │ │ ├── glchar.cpp │ │ ├── gldraw.cpp │ │ ├── glfont.cpp │ │ ├── glpangoglu.cpp │ │ ├── gltext.cpp │ │ ├── gltexturecache.cpp │ │ ├── opengl_render_state.cpp │ │ ├── stb_truetype.h │ │ └── viewport.cpp ├── pango_packetstream │ ├── CMakeLists.txt │ ├── include │ │ └── pangolin │ │ │ └── log │ │ │ ├── packet.h │ │ │ ├── packetstream.h │ │ │ ├── packetstream_reader.h │ │ │ ├── packetstream_source.h │ │ │ ├── packetstream_tags.h │ │ │ ├── packetstream_writer.h │ │ │ ├── playback_session.h │ │ │ └── sync_time.h │ └── src │ │ ├── packet.cpp │ │ ├── packetstream.cpp │ │ ├── packetstream_reader.cpp │ │ ├── packetstream_writer.cpp │ │ └── playback_session.cpp ├── pango_plot │ ├── CMakeLists.txt │ ├── include │ │ └── pangolin │ │ │ └── plot │ │ │ ├── datalog.h │ │ │ ├── loaders │ │ │ ├── csv_table_loader.h │ │ │ └── table_loader.h │ │ │ └── plotter.h │ └── src │ │ ├── datalog.cpp │ │ ├── loaders │ │ └── csv_table_loader.cpp │ │ └── plotter.cpp ├── pango_python │ ├── CMakeLists.txt │ ├── include │ │ └── pangolin │ │ │ └── python │ │ │ └── pyinterpreter.h │ └── src │ │ ├── pyinterpreter.cpp │ │ ├── pypangolin │ │ ├── attach.cpp │ │ ├── attach.hpp │ │ ├── colour.cpp │ │ ├── colour.hpp │ │ ├── datalog.cpp │ │ ├── datalog.hpp │ │ ├── display.cpp │ │ ├── display.hpp │ │ ├── gl.cpp │ │ ├── gl.hpp │ │ ├── gl_draw.cpp │ │ ├── gl_draw.hpp │ │ ├── glfont.cpp │ │ ├── glfont.hpp │ │ ├── glsl.cpp │ │ ├── glsl.hpp │ │ ├── gltext.cpp │ │ ├── gltext.hpp │ │ ├── glvbo.cpp │ │ ├── glvbo.hpp │ │ ├── handler.cpp │ │ ├── handler.hpp │ │ ├── image.cpp │ │ ├── image.hpp │ │ ├── image_view.cpp │ │ ├── image_view.hpp │ │ ├── opengl_render_state.cpp │ │ ├── opengl_render_state.hpp │ │ ├── params.cpp │ │ ├── params.hpp │ │ ├── pixel_format.cpp │ │ ├── pixel_format.hpp │ │ ├── plotter.cpp │ │ ├── plotter.hpp │ │ ├── pypangoio.cpp │ │ ├── pypangoio.h │ │ ├── pypangolin.h │ │ ├── var.cpp │ │ ├── var.hpp │ │ ├── video.cpp │ │ ├── video.hpp │ │ ├── view.cpp │ │ ├── view.hpp │ │ ├── viewport.cpp │ │ ├── viewport.hpp │ │ ├── widget.cpp │ │ ├── widget.hpp │ │ ├── window.cpp │ │ └── window.hpp │ │ ├── pypangolin_embed.cpp │ │ └── pypangolin_module.cpp ├── pango_scene │ ├── CMakeLists.txt │ ├── include │ │ └── pangolin │ │ │ └── scene │ │ │ ├── axis.h │ │ │ ├── interactive.h │ │ │ ├── interactive_index.h │ │ │ ├── renderable.h │ │ │ ├── scenehandler.h │ │ │ └── tree.h │ └── src │ │ └── renderable.cpp ├── pango_tools │ ├── CMakeLists.txt │ ├── include │ │ └── pangolin │ │ │ └── tools │ │ │ └── video_viewer.h │ └── src │ │ └── video_viewer.cpp ├── pango_vars │ ├── CMakeLists.txt │ ├── include │ │ └── pangolin │ │ │ └── var │ │ │ ├── var.h │ │ │ ├── varextra.h │ │ │ ├── varinit.h │ │ │ ├── varstate.h │ │ │ ├── varvalue.h │ │ │ ├── varvaluegeneric.h │ │ │ ├── varvaluet.h │ │ │ └── varwrapper.h │ ├── src │ │ ├── vars.cpp │ │ └── varstate.cpp │ └── tests │ │ └── test_all.cpp ├── pango_video │ ├── CMakeLists.txt │ ├── include │ │ └── pangolin │ │ │ └── video │ │ │ ├── drivers │ │ │ ├── debayer.h │ │ │ ├── deinterlace.h │ │ │ ├── depthsense.h │ │ │ ├── ffmpeg.h │ │ │ ├── ffmpeg_common.h │ │ │ ├── ffmpeg_convert.h │ │ │ ├── ffmpeg_output.h │ │ │ ├── firewire.h │ │ │ ├── gamma.h │ │ │ ├── images.h │ │ │ ├── images_out.h │ │ │ ├── join.h │ │ │ ├── merge.h │ │ │ ├── mjpeg.h │ │ │ ├── openni.h │ │ │ ├── openni2.h │ │ │ ├── openni_common.h │ │ │ ├── pack.h │ │ │ ├── pango.h │ │ │ ├── pango_video_output.h │ │ │ ├── pleora.h │ │ │ ├── realsense.h │ │ │ ├── realsense2.h │ │ │ ├── shared_memory.h │ │ │ ├── shift.h │ │ │ ├── split.h │ │ │ ├── teli.h │ │ │ ├── test.h │ │ │ ├── thread.h │ │ │ ├── transform.h │ │ │ ├── truncate.h │ │ │ ├── unpack.h │ │ │ ├── uvc.h │ │ │ ├── uvc_mediafoundation.h │ │ │ └── v4l.h │ │ │ ├── iostream_operators.h │ │ │ ├── stream_encoder_factory.h │ │ │ ├── stream_info.h │ │ │ ├── video.h │ │ │ ├── video_exception.h │ │ │ ├── video_help.h │ │ │ ├── video_input.h │ │ │ ├── video_interface.h │ │ │ ├── video_output.h │ │ │ ├── video_output_interface.h │ │ │ └── video_record_repeat.h │ ├── src │ │ ├── drivers │ │ │ ├── debayer.cpp │ │ │ ├── deinterlace.cpp │ │ │ ├── depthsense.cpp │ │ │ ├── ffmpeg.cpp │ │ │ ├── ffmpeg_convert.cpp │ │ │ ├── ffmpeg_output.cpp │ │ │ ├── firewire.cpp │ │ │ ├── gamma.cpp │ │ │ ├── images.cpp │ │ │ ├── images_out.cpp │ │ │ ├── join.cpp │ │ │ ├── json.cpp │ │ │ ├── merge.cpp │ │ │ ├── mjpeg.cpp │ │ │ ├── openni.cpp │ │ │ ├── openni2.cpp │ │ │ ├── pack.cpp │ │ │ ├── pango.cpp │ │ │ ├── pango_video_output.cpp │ │ │ ├── pleora.cpp │ │ │ ├── realsense.cpp │ │ │ ├── realsense2.cpp │ │ │ ├── shared_memory.cpp │ │ │ ├── shift.cpp │ │ │ ├── split.cpp │ │ │ ├── teli.cpp │ │ │ ├── test.cpp │ │ │ ├── thread.cpp │ │ │ ├── transform.cpp │ │ │ ├── truncate.cpp │ │ │ ├── unpack.cpp │ │ │ ├── uvc.cpp │ │ │ ├── uvc_mediafoundation.cpp │ │ │ └── v4l.cpp │ │ ├── stream_encoder_factory.cpp │ │ ├── video.cpp │ │ ├── video_help.cpp │ │ ├── video_input.cpp │ │ └── video_output.cpp │ └── tests │ │ ├── tests_video_loading.cpp │ │ └── tests_video_uri.cpp ├── pango_windowing │ ├── CMakeLists.txt │ ├── include │ │ └── pangolin │ │ │ └── windowing │ │ │ ├── EmscriptenWindow.h │ │ │ ├── OsxWindow.h │ │ │ ├── PangolinNSApplication.h │ │ │ ├── PangolinNSGLView.h │ │ │ ├── WinWindow.h │ │ │ ├── X11Window.h │ │ │ ├── display_android.h │ │ │ ├── handler_bitsets.h │ │ │ ├── handler_enums.h │ │ │ └── window.h │ └── src │ │ ├── PangolinNSApplication.mm │ │ ├── PangolinNSGLView.mm │ │ ├── display_android.cpp │ │ ├── display_emscripten.cpp │ │ ├── display_headless.cpp │ │ ├── display_osx.mm │ │ ├── display_wayland.cpp │ │ ├── display_win.cpp │ │ ├── display_x11.cpp │ │ └── window.cpp └── tinyobj │ ├── CMakeLists.txt │ ├── include │ └── tinyobj │ │ └── tiny_obj_loader.h │ └── src │ └── tinyobj.cpp ├── examples ├── BasicOpenGL │ ├── 1_gl_intro_classic_triangle.cpp │ ├── 1_gl_intro_pango_triangle.cpp │ ├── 2_gl_intro_classic_triangle_vbo.cpp │ ├── 2_gl_intro_pango_triangle_vbo.cpp │ ├── 3_gl_intro_classic_triangle_vbo_shader.cpp │ ├── 3_gl_intro_pango_triangle_vbo_shader.cpp │ ├── 4_gl_intro_viewport.cpp │ ├── 5_gl_intro_view_transforms.cpp │ ├── CMakeLists.txt │ └── README.md ├── CMakeLists.txt ├── HelloPangolin │ ├── CMakeLists.txt │ └── main.cpp ├── HelloPangolinOffscreen │ ├── CMakeLists.txt │ └── main.cpp ├── HelloPangolinThreads │ ├── CMakeLists.txt │ └── main.cpp ├── PythonExamples │ ├── SimpleDisplay.py │ ├── SimplePlot.py │ └── SimpleVideo.py ├── SharedMemoryCamera │ ├── CMakeLists.txt │ └── main.cpp ├── SimpleDisplay │ ├── CMakeLists.txt │ ├── app.cfg │ └── main.cpp ├── SimpleDisplayImage │ ├── CMakeLists.txt │ └── main.cpp ├── SimpleMultiDisplay │ ├── CMakeLists.txt │ ├── app.cfg │ └── main.cpp ├── SimplePlot │ ├── CMakeLists.txt │ └── main.cpp ├── SimpleRecord │ ├── CMakeLists.txt │ └── main.cpp ├── SimpleScene │ ├── CMakeLists.txt │ └── main.cpp ├── SimpleVideo │ ├── CMakeLists.txt │ └── main.cpp └── VBODisplay │ ├── CMakeLists.txt │ ├── kernal.cu │ └── main.cpp ├── package.xml ├── scripts ├── install_prerequisites.sh └── utils │ └── ansi2html.sh └── tools ├── CMakeLists.txt ├── ModelViewer ├── CMakeLists.txt ├── main.cpp ├── rendertree.h ├── shader.h └── util.h ├── Plotter ├── CMakeLists.txt ├── application-x-pangoplot.xml └── main.cpp ├── VideoConvert ├── CMakeLists.txt └── main.cpp ├── VideoJson ├── CMakeLists.txt ├── main-print.cpp └── main-transform.cpp └── VideoViewer ├── CMakeLists.txt ├── application-x-pango.svg ├── application-x-pango.xml └── main.cpp /.clang-format: -------------------------------------------------------------------------------- 1 | DisableFormat: true 2 | SortIncludes: false 3 | -------------------------------------------------------------------------------- /.github/workflows/bloom.yml: -------------------------------------------------------------------------------- 1 | name: bloom 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build_linux: 7 | name: "Ubuntu (${{ matrix.ros_distribution }})" 8 | 9 | runs-on: ubuntu-latest 10 | 11 | strategy: 12 | matrix: 13 | include: 14 | - docker_image: ubuntu:22.04 15 | ros_distribution: humble 16 | 17 | - docker_image: ubuntu:24.04 18 | ros_distribution: jazzy 19 | 20 | container: 21 | image: ${{ matrix.docker_image }} 22 | 23 | env: 24 | DEBIAN_FRONTEND: noninteractive 25 | 26 | steps: 27 | - name: install core dependencies 28 | run: | 29 | apt update 30 | apt install -y --no-install-recommends git ca-certificates 31 | 32 | - uses: actions/checkout@v4 33 | 34 | - uses: ros-tooling/setup-ros@v0.7 35 | 36 | - name: install build tool dependencies 37 | run: | 38 | apt install -y --no-install-recommends devscripts equivs python3-bloom 39 | 40 | - name: bloom 41 | run: | 42 | rosdep update 43 | bloom-generate rosdebian --ros-distro ${{ matrix.ros_distribution }} 44 | mk-build-deps 45 | apt install -y --no-install-recommends ./ros-${{ matrix.ros_distribution }}-*-build-deps_*_all.deb 46 | dpkg-buildpackage -b 47 | 48 | - name: install bloomed packages 49 | run: | 50 | apt install -y --no-install-recommends ../ros-${{ matrix.ros_distribution }}-*_*.deb ../ros-${{ matrix.ros_distribution }}-*-dbgsym_*.ddeb 51 | -------------------------------------------------------------------------------- /.github/workflows/colcon-workspace.yml: -------------------------------------------------------------------------------- 1 | name: colcon workspace 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | # test multiple Ubuntu and ROS distributions 8 | # https://github.com/ros-tooling/setup-ros#iterating-on-all-ros-distributions-for-all-platforms 9 | runs-on: ubuntu-latest 10 | strategy: 11 | matrix: 12 | include: 13 | - docker_image: ubuntu:20.04 14 | ros_distribution: noetic 15 | ros_version: 1 16 | 17 | - docker_image: ubuntu:22.04 18 | ros_distribution: humble 19 | ros_version: 2 20 | 21 | - docker_image: ubuntu:24.04 22 | ros_distribution: jazzy 23 | ros_version: 2 24 | 25 | container: 26 | image: ${{ matrix.docker_image }} 27 | 28 | steps: 29 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 30 | - uses: actions/checkout@v4 31 | 32 | - name: Setup ROS environment 33 | uses: ros-tooling/setup-ros@v0.7 34 | 35 | - name: ROS 1 CI Action 36 | if: ${{ matrix.ros_version == 1 }} 37 | uses: ros-tooling/action-ros-ci@v0.4 38 | with: 39 | package-name: pangolin 40 | target-ros1-distro: ${{ matrix.ros_distribution }} 41 | 42 | - name: ROS 2 CI Action 43 | if: ${{ matrix.ros_version == 2 }} 44 | uses: ros-tooling/action-ros-ci@v0.4 45 | with: 46 | package-name: pangolin 47 | target-ros2-distro: ${{ matrix.ros_distribution }} 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | CMakeLists.txt.user 3 | build* 4 | _builds 5 | _logs 6 | .vscode 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "scripts/vcpkg"] 2 | path = scripts/vcpkg 3 | url = https://github.com/microsoft/vcpkg.git 4 | [submodule "components/pango_python/pybind11"] 5 | path = components/pango_python/pybind11 6 | url = https://github.com/pybind/pybind11.git 7 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Steven Lovegrove and Richard Newcombe 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /cmake/CreateMethodCallFile.cmake: -------------------------------------------------------------------------------- 1 | macro( CreateMethodCallFile filename namespace function symbols) 2 | file(WRITE ${filename} "// CMake generated file. Do Not Edit.\n\n#pragma once\n\nnamespace ${namespace} {\n\n") 3 | foreach( symbol ${symbols} ) 4 | file(APPEND ${filename} "void ${symbol}();\n") 5 | endforeach() 6 | file(APPEND ${filename} "\ninline bool ${function}()\n{\n") 7 | foreach( symbol ${symbols} ) 8 | file(APPEND ${filename} " ${symbol}();\n") 9 | endforeach() 10 | file(APPEND ${filename} " return true;\n}\n\n} // ${namespace}\n") 11 | endmacro() 12 | -------------------------------------------------------------------------------- /cmake/EmbedBinaryFiles.cmake: -------------------------------------------------------------------------------- 1 | # Creates C resources file from specified files 2 | # Based on http://stackoverflow.com/a/27206982 3 | function(embed_binary_files_now output binary_files) 4 | # Create empty output file 5 | file(WRITE ${output} "") 6 | # Iterate through input files 7 | foreach(bin ${binary_files}) 8 | # Get short filename 9 | string(REGEX MATCH "([^/]+)$" filename ${bin}) 10 | # Replace filename spaces & extension separator for C compatibility 11 | string(REGEX REPLACE "\\.| " "_" filename ${filename}) 12 | # Read hex data from file 13 | file(READ ${bin} filedata HEX) 14 | # Convert hex data for C compatibility 15 | string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," filedata ${filedata}) 16 | # Append data to output file 17 | file(APPEND ${output} "extern const unsigned char ${filename}[] = {${filedata}};\nextern const unsigned ${filename}_size = sizeof(${filename});\n") 18 | endforeach() 19 | endfunction() 20 | 21 | # Sets up rule for embedding files when they are newer than the output file (or it doesn't exist yet) 22 | function(embed_binary_files_rule output binary_files) 23 | add_custom_command( 24 | OUTPUT ${output} 25 | DEPENDS ${binary_files} 26 | COMMAND 27 | ${CMAKE_COMMAND} -DINPUT_BINARY_FILES=${binary_files} 28 | -DOUTPUT_SRC_FILE=${output} 29 | -P ${PROJECT_SOURCE_DIR}/cmake/EmbedBinaryFiles.cmake 30 | COMMENT "Embedding ${binary_files} into ${output}" 31 | ) 32 | endfunction() 33 | 34 | if(CMAKE_SCRIPT_MODE_FILE AND NOT CMAKE_PARENT_LIST_FILE) 35 | # Running in script mode as part of build-time procedure to actually to the embedding 36 | embed_binary_files_now(${OUTPUT_SRC_FILE} ${INPUT_BINARY_FILES} ) 37 | endif() -------------------------------------------------------------------------------- /cmake/EmscriptenUtils.cmake: -------------------------------------------------------------------------------- 1 | if(EMSCRIPTEN) 2 | macro( create_host_index_html filename prog_name) 3 | file( WRITE ${filename} 4 | " 5 | 6 | 7 | ${prog_name} 8 | 9 | 10 | 11 | 26 | 27 | 28 | ") 29 | endmacro() 30 | 31 | # Override add_executable to make webpage instead 32 | macro( add_executable prog_name) 33 | # Create manifest required for APK 34 | create_host_index_html("${CMAKE_CURRENT_BINARY_DIR}/index.html" "${prog_name}") 35 | _add_executable(${prog_name} ${ARGN}) 36 | endmacro() 37 | endif() 38 | -------------------------------------------------------------------------------- /cmake/FindDC1394.cmake: -------------------------------------------------------------------------------- 1 | # Try to find the dc1394 v2 lib and include files 2 | # 3 | # DC1394_INCLUDE_DIR 4 | # DC1394_LIBRARIES 5 | # DC1394_FOUND 6 | 7 | FIND_PATH( DC1394_INCLUDE_DIR dc1394/control.h 8 | /usr/include 9 | /usr/local/include 10 | ) 11 | 12 | FIND_LIBRARY( DC1394_LIBRARY dc1394 13 | /usr/lib64 14 | /usr/lib 15 | /usr/local/lib 16 | ) 17 | 18 | IF(DC1394_INCLUDE_DIR AND DC1394_LIBRARY) 19 | SET( DC1394_FOUND TRUE ) 20 | SET( DC1394_LIBRARIES ${DC1394_LIBRARY} ) 21 | ENDIF(DC1394_INCLUDE_DIR AND DC1394_LIBRARY) 22 | 23 | IF(DC1394_FOUND) 24 | IF(NOT DC1394_FIND_QUIETLY) 25 | MESSAGE(STATUS "Found DC1394: ${DC1394_LIBRARY}") 26 | ENDIF(NOT DC1394_FIND_QUIETLY) 27 | ELSE(DC1394_FOUND) 28 | IF(DC1394_FIND_REQUIRED) 29 | MESSAGE(FATAL_ERROR "Could not find libdc1394") 30 | ENDIF(DC1394_FIND_REQUIRED) 31 | ENDIF(DC1394_FOUND) 32 | 33 | -------------------------------------------------------------------------------- /cmake/FindDepthSense.cmake: -------------------------------------------------------------------------------- 1 | # Try to find the DepthSense SDK For SoftKinetic Cameras 2 | # 3 | # DepthSense_INCLUDE_DIRS 4 | # DepthSense_LIBRARIES 5 | # DepthSense_FOUND 6 | 7 | FIND_PATH( DepthSense_INCLUDE_DIR DepthSense.hxx 8 | PATHS 9 | "${PROGRAM_FILES}/SoftKinetic/DepthSenseSDK/include" 10 | "${PROGRAM_FILES}/Meta/DepthSenseSDK/include" 11 | /usr/include 12 | /usr/local/include 13 | /opt/local/include 14 | /opt/softkinetic/DepthSenseSDK/include 15 | ) 16 | 17 | FIND_LIBRARY( DepthSense_LIBRARY DepthSense 18 | PATHS 19 | "${PROGRAM_FILES}/SoftKinetic/DepthSenseSDK/lib" 20 | "${PROGRAM_FILES}/Meta/DepthSenseSDK/lib" 21 | /usr/lib64 22 | /usr/lib 23 | /usr/local/lib 24 | /opt/local/lib 25 | /opt/softkinetic/DepthSenseSDK/lib 26 | ) 27 | 28 | IF(DepthSense_INCLUDE_DIR AND DepthSense_LIBRARY) 29 | SET( DepthSense_FOUND TRUE ) 30 | SET( DepthSense_LIBRARIES ${DepthSense_LIBRARY} ) 31 | SET( DepthSense_INCLUDE_DIRS ${DepthSense_INCLUDE_DIR} ) 32 | ENDIF() 33 | 34 | IF(DepthSense_FOUND) 35 | IF(NOT DepthSense_FIND_QUIETLY) 36 | MESSAGE(STATUS "Found DepthSense: ${DepthSense_LIBRARY}") 37 | ENDIF() 38 | ELSE() 39 | IF(DepthSense_FIND_REQUIRED) 40 | MESSAGE(FATAL_ERROR "Could not find DepthSense") 41 | ENDIF() 42 | ENDIF() 43 | 44 | -------------------------------------------------------------------------------- /cmake/FindGLEW.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find GLEW library and include path. 3 | # Once done this will define 4 | # 5 | # GLEW_FOUND 6 | # GLEW_INCLUDE_DIR 7 | # GLEW_LIBRARY 8 | # 9 | 10 | IF (WIN32) 11 | FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h 12 | $ENV{PROGRAMFILES}/GLEW/include 13 | ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include 14 | DOC "The directory where GL/glew.h resides") 15 | FIND_LIBRARY( GLEW_LIBRARY 16 | NAMES glew GLEW glew32 glew32s 17 | PATHS 18 | $ENV{PROGRAMFILES}/GLEW/lib 19 | ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin 20 | ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib 21 | DOC "The GLEW library") 22 | ELSE (WIN32) 23 | FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h 24 | /usr/include 25 | /usr/local/include 26 | /sw/include 27 | /opt/local/include 28 | DOC "The directory where GL/glew.h resides") 29 | FIND_LIBRARY( GLEW_LIBRARY 30 | NAMES GLEW glew 31 | PATHS 32 | /usr/lib64 33 | /usr/lib 34 | /usr/local/lib64 35 | /usr/local/lib 36 | /sw/lib 37 | /opt/local/lib 38 | DOC "The GLEW library") 39 | ENDIF (WIN32) 40 | 41 | IF (GLEW_INCLUDE_DIR AND GLEW_LIBRARY) 42 | SET( GLEW_FOUND TRUE ) 43 | ENDIF (GLEW_INCLUDE_DIR AND GLEW_LIBRARY) 44 | 45 | IF (GLEW_FOUND) 46 | IF (NOT GLEW_FIND_QUIETLY) 47 | MESSAGE(STATUS "Found GLEW: ${GLEW_LIBRARY}") 48 | ENDIF (NOT GLEW_FIND_QUIETLY) 49 | ELSE (GLEW_FOUND) 50 | IF (GLEW_FIND_REQUIRED) 51 | MESSAGE(FATAL_ERROR "Could not find GLEW") 52 | ENDIF (GLEW_FIND_REQUIRED) 53 | ENDIF (GLEW_FOUND) 54 | -------------------------------------------------------------------------------- /cmake/FindGLUES.cmake: -------------------------------------------------------------------------------- 1 | # Try to find the GLUES lib and include files 2 | # 3 | # GLUES_INCLUDE_DIR 4 | # GLUES_LIBRARIES 5 | # GLUES_FOUND 6 | 7 | FIND_PATH( GLUES_INCLUDE_DIR glues/glues.h 8 | /usr/include 9 | /usr/local/include 10 | /opt/include 11 | /opt/local/include 12 | ${CMAKE_INSTALL_PREFIX}/include 13 | ) 14 | 15 | FIND_LIBRARY( GLUES_LIBRARY glues 16 | /usr/lib64 17 | /usr/lib 18 | /usr/local/lib 19 | /opt/local/lib 20 | /opt/local/lib64 21 | ${CMAKE_INSTALL_PREFIX}/lib 22 | ) 23 | 24 | IF(GLUES_INCLUDE_DIR AND GLUES_LIBRARY) 25 | SET( GLUES_FOUND TRUE ) 26 | SET( GLUES_LIBRARIES ${GLUES_LIBRARY} ) 27 | ENDIF(GLUES_INCLUDE_DIR AND GLUES_LIBRARY) 28 | 29 | IF(GLUES_FOUND) 30 | IF(NOT GLUES_FIND_QUIETLY) 31 | MESSAGE(STATUS "Found GLUES: ${GLUES_LIBRARY}") 32 | ENDIF(NOT GLUES_FIND_QUIETLY) 33 | ELSE(GLUES_FOUND) 34 | IF(GLUES_FIND_REQUIRED) 35 | MESSAGE(FATAL_ERROR "Could not find GLUES") 36 | ENDIF(GLUES_FIND_REQUIRED) 37 | ENDIF(GLUES_FOUND) 38 | 39 | -------------------------------------------------------------------------------- /cmake/FindLibraw.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find libraw 2 | # 3 | # libraw_FOUND - system has libraw 4 | # libraw_INCLUDE_DIRS - the libraw include directories 5 | # libraw_LIBRARIES - link these to use libraw 6 | 7 | FIND_PATH( 8 | libraw_INCLUDE_DIRS 9 | NAMES libraw/libraw.h 10 | PATHS 11 | ${LIBRAW_DIR} 12 | ${LIBRAW_DIR}/include 13 | /usr/include/ 14 | /usr/local/include 15 | /opt/local/include 16 | ) 17 | 18 | FIND_LIBRARY( 19 | libraw_LIBRARIES 20 | NAMES raw_r 21 | PATHS 22 | ${LIBRAW_DIR} 23 | ${LIBRAW_DIR}/lib 24 | /usr/lib 25 | /usr/local/lib 26 | /opt/local/lib 27 | ) 28 | 29 | IF (libraw_INCLUDE_DIRS AND libraw_LIBRARIES) 30 | SET(libraw_FOUND TRUE) 31 | ENDIF (libraw_INCLUDE_DIRS AND libraw_LIBRARIES) 32 | 33 | IF (libraw_FOUND) 34 | IF (NOT libraw_FIND_QUIETLY) 35 | MESSAGE(STATUS "Found libraw: ${libraw_LIBRARIES}") 36 | ENDIF (NOT libraw_FIND_QUIETLY) 37 | ELSE (libraw_FOUND) 38 | IF (libraw_FIND_REQUIRED) 39 | MESSAGE(FATAL_ERROR "Could not find libraw") 40 | ENDIF (libraw_FIND_REQUIRED) 41 | ENDIF (libraw_FOUND) 42 | -------------------------------------------------------------------------------- /cmake/FindLz4.cmake: -------------------------------------------------------------------------------- 1 | 2 | find_path(Lz4_INCLUDE_DIRS 3 | NAMES lz4frame.h 4 | PATHS 5 | /opt/local/include 6 | /usr/local/include 7 | /usr/include 8 | ) 9 | 10 | find_library(Lz4_LIBRARIES 11 | NAMES lz4 12 | PATHS 13 | /usr/local/lib 14 | /opt/local/lib 15 | /user/local/lib 16 | /usr/lib 17 | ) 18 | 19 | include(FindPackageHandleStandardArgs) 20 | find_package_handle_standard_args(Lz4 REQUIRED_VARS Lz4_LIBRARIES Lz4_INCLUDE_DIRS) 21 | 22 | mark_as_advanced( 23 | Lz4_INCLUDE_DIRS 24 | Lz4_LIBRARIES 25 | Lz4_FOUND 26 | ) 27 | -------------------------------------------------------------------------------- /cmake/FindMediaFoundation.cmake: -------------------------------------------------------------------------------- 1 | # - Find MediaFoundation 2 | # Find the Windows SDK MediaFoundation libraries 3 | # 4 | # MediaFoundation_LIBRARIES - List of libraries when using MediaFoundation 5 | # MediaFoundation_FOUND - True if MediaFoundation found 6 | 7 | IF (MSVC) 8 | SET( MediaFoundation_LIBRARIES mf.lib mfplat.lib mfreadwrite.lib mfuuid.lib strmiids.lib ) 9 | SET( MediaFoundation_FOUND true ) 10 | ENDIF (MSVC) 11 | 12 | IF (MediaFoundation_FOUND) 13 | IF (NOT MediaFoundation_FIND_QUIETLY) 14 | MESSAGE(STATUS "Found MediaFoundation: ${MediaFoundation_LIBRARIES}") 15 | ENDIF (NOT MediaFoundation_FIND_QUIETLY) 16 | ELSE (MediaFoundation_FOUND) 17 | IF (MediaFoundation_FIND_REQUIRED) 18 | MESSAGE(FATAL_ERROR "Could not find MediaFoundation") 19 | ENDIF (MediaFoundation_FIND_REQUIRED) 20 | ENDIF (MediaFoundation_FOUND) 21 | -------------------------------------------------------------------------------- /cmake/FindOpenEXR.cmake: -------------------------------------------------------------------------------- 1 | # Try to find the OpenEXR v2 lib and include files 2 | # 3 | # OpenEXR_INCLUDE_DIR 4 | # OpenEXR_LIBRARIES 5 | # OpenEXR_FOUND 6 | 7 | FIND_PATH( OpenEXR_INCLUDE_DIR ImfHeader.h 8 | /usr/include 9 | /usr/local/include 10 | PATH_SUFFIXES OpenEXR 11 | ) 12 | 13 | FIND_LIBRARY( OpenEXR_LIBRARY IlmImf 14 | /usr/lib64 15 | /usr/lib 16 | /usr/local/lib 17 | ) 18 | 19 | IF(OpenEXR_INCLUDE_DIR AND OpenEXR_LIBRARY) 20 | SET( OpenEXR_FOUND TRUE ) 21 | SET( OpenEXR_LIBRARIES ${OpenEXR_LIBRARY} ) 22 | ENDIF() 23 | 24 | IF(OpenEXR_FOUND) 25 | IF(NOT OpenEXR_FIND_QUIETLY) 26 | MESSAGE(STATUS "Found OpenEXR: ${OpenEXR_LIBRARY}") 27 | ENDIF(NOT OpenEXR_FIND_QUIETLY) 28 | ELSE(OpenEXR_FOUND) 29 | IF(OpenEXR_FIND_REQUIRED) 30 | MESSAGE(FATAL_ERROR "Could not find libOpenEXR") 31 | ENDIF(OpenEXR_FIND_REQUIRED) 32 | ENDIF(OpenEXR_FOUND) 33 | 34 | -------------------------------------------------------------------------------- /cmake/FindOpenNI.cmake: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Find OpenNI 3 | # 4 | # find_package(OpenNI) 5 | # 6 | # Variables defined by this module: 7 | # 8 | # OPENNI_FOUND True if OpenNI was found 9 | # OPENNI_INCLUDE_DIRS The location(s) of OpenNI headers 10 | # OPENNI_LIBRARIES Libraries needed to use OpenNI 11 | # OPENNI_DEFINITIONS Compiler flags for OpenNI 12 | 13 | find_package(PkgConfig QUIET) 14 | pkg_check_modules(PC_OPENNI QUIET libopenni) 15 | 16 | set(OPENNI_DEFINITIONS ${PC_OPENNI_CFLAGS_OTHER}) 17 | 18 | set(OPENNI_SUFFIX) 19 | if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8) 20 | set(OPENNI_SUFFIX 64) 21 | endif() 22 | 23 | # Add a hint so that it can find it without the pkg-config 24 | find_path(OPENNI_INCLUDE_DIR XnStatus.h 25 | HINTS ${PC_OPENNI_INCLUDEDIR} 26 | ${PC_OPENNI_INCLUDE_DIRS} 27 | /usr/include/openni 28 | /usr/include/ni 29 | /opt/local/include/ni 30 | "${OPENNI_ROOT}" 31 | "$ENV{OPENNI_ROOT}" 32 | PATHS "$ENV{OPEN_NI_INSTALL_PATH${OPENNI_SUFFIX}}/Include" 33 | PATH_SUFFIXES openni include Include) 34 | 35 | # Add a hint so that it can find it without the pkg-config 36 | find_library(OPENNI_LIBRARY 37 | NAMES OpenNI${OPENNI_SUFFIX} 38 | HINTS ${PC_OPENNI_LIBDIR} 39 | ${PC_OPENNI_LIBRARY_DIRS} 40 | /usr/lib 41 | "${OPENNI_ROOT}" 42 | "$ENV{OPENNI_ROOT}" 43 | PATHS "$ENV{OPEN_NI_LIB${OPENNI_SUFFIX}}" 44 | PATH_SUFFIXES lib Lib Lib64) 45 | 46 | if(OPENNI_INCLUDE_DIR AND OPENNI_LIBRARY) 47 | set(OPENNI_INCLUDE_DIRS ${OPENNI_INCLUDE_DIR}) 48 | mark_as_advanced(OPENNI_INCLUDE_DIRS) 49 | 50 | set(OPENNI_LIBRARIES ${OPENNI_LIBRARY}) 51 | mark_as_advanced(OPENNI_LIBRARIES) 52 | endif() 53 | 54 | include(FindPackageHandleStandardArgs) 55 | find_package_handle_standard_args(OpenNI 56 | FOUND_VAR OPENNI_FOUND 57 | REQUIRED_VARS OPENNI_LIBRARIES OPENNI_INCLUDE_DIRS 58 | ) 59 | -------------------------------------------------------------------------------- /cmake/FindOpenNI2.cmake: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Find OpenNI2 3 | # 4 | # This sets the following variables: 5 | # OPENNI2_FOUND - True if OPENNI was found. 6 | # OPENNI2_INCLUDE_DIRS - Directories containing the OPENNI include files. 7 | # OPENNI2_LIBRARIES - Libraries needed to use OPENNI. 8 | 9 | find_package(PkgConfig) 10 | if(${CMAKE_VERSION} VERSION_LESS 2.8.2) 11 | pkg_check_modules(PC_OPENNI openni2-dev) 12 | else() 13 | pkg_check_modules(PC_OPENNI QUIET openni2-dev) 14 | endif() 15 | 16 | set(OPENNI2_DEFINITIONS ${PC_OPENNI_CFLAGS_OTHER}) 17 | 18 | #add a hint so that it can find it without the pkg-config 19 | find_path(OPENNI2_INCLUDE_DIR OpenNI.h 20 | HINTS 21 | ${PC_OPENNI_INCLUDEDIR} 22 | ${PC_OPENNI_INCLUDE_DIRS} 23 | PATHS 24 | "${PROGRAM_FILES}/OpenNI2/Include" 25 | "${CMAKE_SOURCE_DIR}/../OpenNI2/Include" 26 | /usr/include 27 | /user/include 28 | PATH_SUFFIXES openni2 ni2 29 | ) 30 | 31 | if(${CMAKE_CL_64}) 32 | set(OPENNI_PATH_SUFFIXES lib64 lib) 33 | else() 34 | set(OPENNI_PATH_SUFFIXES lib) 35 | endif() 36 | 37 | #add a hint so that it can find it without the pkg-config 38 | find_library(OPENNI2_LIBRARY 39 | NAMES OpenNI2 40 | HINTS 41 | ${PC_OPENNI_LIBDIR} 42 | ${PC_OPENNI_LIBRARY_DIRS} 43 | PATHS 44 | "${PROGRAM_FILES}/OpenNI2/Redist" 45 | "${PROGRAM_FILES}/OpenNI2" 46 | "${CMAKE_SOURCE_DIR}/../OpenNI2/Bin/x64-Release" 47 | /usr/lib 48 | /user/lib 49 | PATH_SUFFIXES ${OPENNI_PATH_SUFFIXES} 50 | ) 51 | 52 | set(OPENNI2_INCLUDE_DIRS ${OPENNI2_INCLUDE_DIR}) 53 | set(OPENNI2_LIBRARIES ${OPENNI2_LIBRARY}) 54 | 55 | include(FindPackageHandleStandardArgs) 56 | find_package_handle_standard_args(OpenNI2 DEFAULT_MSG 57 | OPENNI2_LIBRARY OPENNI2_INCLUDE_DIR) 58 | 59 | mark_as_advanced(OPENNI2_LIBRARY OPENNI2_INCLUDE_DIR) 60 | -------------------------------------------------------------------------------- /cmake/FindRealSense.cmake: -------------------------------------------------------------------------------- 1 | # -*- mode: cmake; -*- 2 | ############################################################################### 3 | # Find realsense https://github.com/IntelRealSense/librealsense 4 | # 5 | # This sets the following variables: 6 | # REALSENSE_FOUND - True if RealSense was found. 7 | # REALSENSE_INCLUDE_DIRS - Directories containing the RealSense include files. 8 | # REALSENSE_LIBRARIES - Libraries needed to use RealSense. 9 | # REALSENSE_DEFINITIONS - Compiler flags for RealSense. 10 | # 11 | # File forked from augmented_dev, project of alantrrs 12 | # (https://github.com/alantrrs/augmented_dev). 13 | 14 | find_package(PkgConfig) 15 | if(${CMAKE_VERSION} VERSION_LESS 2.8.2) 16 | endif() 17 | 18 | #add a hint so that it can find it without the pkg-config 19 | find_path(REALSENSE_INCLUDE_DIR librealsense/rs.h 20 | HINTS /usr/include/ /usr/local/include) 21 | #add a hint so that it can find it without the pkg-config 22 | find_library(REALSENSE_LIBRARY 23 | NAMES realsense 24 | HINTS /usr/lib /usr/local/lib ) 25 | 26 | set(REALSENSE_INCLUDE_DIRS ${REALSENSE_INCLUDE_DIR}) 27 | set(REALSENSE_LIBRARIES ${REALSENSE_LIBRARY}) 28 | 29 | include(FindPackageHandleStandardArgs) 30 | find_package_handle_standard_args(RealSense DEFAULT_MSG 31 | REALSENSE_LIBRARY REALSENSE_INCLUDE_DIR) 32 | 33 | mark_as_advanced(REALSENSE_LIBRARY REALSENSE_INCLUDE_DIR) 34 | -------------------------------------------------------------------------------- /cmake/FindRealSense2.cmake: -------------------------------------------------------------------------------- 1 | # -*- mode: cmake; -*- 2 | ############################################################################### 3 | # Find realsense2 https://github.com/IntelRealSense/librealsense 4 | # 5 | # This sets the following variables: 6 | # REALSENSE2_FOUND - True if REALSENSE2 was found. 7 | # REALSENSE2_INCLUDE_DIRS - Directories containing the REALSENSE2 include files. 8 | # REALSENSE2_LIBRARIES - Libraries needed to use REALSENSE2. 9 | # REALSENSE2_DEFINITIONS - Compiler flags for REALSENSE2. 10 | # 11 | # File forked from augmented_dev, project of alantrrs 12 | # (https://github.com/alantrrs/augmented_dev). 13 | 14 | find_package(PkgConfig) 15 | if(${CMAKE_VERSION} VERSION_LESS 2.8.2) 16 | endif() 17 | 18 | #add a hint so that it can find it without the pkg-config 19 | find_path(REALSENSE2_INCLUDE_DIR librealsense2/rs.h 20 | HINTS /usr/include/ /usr/local/include) 21 | #add a hint so that it can find it without the pkg-config 22 | find_library(REALSENSE2_LIBRARY 23 | NAMES realsense2 24 | HINTS /usr/lib /usr/local/lib ) 25 | 26 | set(REALSENSE2_INCLUDE_DIRS ${REALSENSE2_INCLUDE_DIR}) 27 | set(REALSENSE2_LIBRARIES ${REALSENSE2_LIBRARY}) 28 | 29 | include(FindPackageHandleStandardArgs) 30 | find_package_handle_standard_args(RealSense2 DEFAULT_MSG 31 | REALSENSE2_LIBRARY REALSENSE2_INCLUDE_DIR) 32 | 33 | mark_as_advanced(REALSENSE2_LIBRARY REALSENSE2_INCLUDE_DIR) 34 | -------------------------------------------------------------------------------- /cmake/FindTeliCam.cmake: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Find Toshiba TeliCam 3 | # 4 | # This sets the following variables: 5 | # TeliCam_FOUND - True if TeliCam was found. 6 | # TeliCam_INCLUDE_DIRS - Directories containing the TeliCam include files. 7 | # TeliCam_LIBRARIES - Libraries needed to use TeliCam. 8 | 9 | find_path( 10 | TeliCam_INCLUDE_DIR TeliCamApi.h 11 | PATHS 12 | "${PROGRAM_FILES}/Toshiba Teli/TeliCamSDK/TeliCamApi/Include" 13 | "${CMAKE_SOURCE_DIR}/../TeliCamSDK/TeliCamApi/Include" 14 | /usr/include 15 | /user/include 16 | /opt/TeliCamSDK/include 17 | PATH_SUFFIXES TeliCam 18 | ) 19 | 20 | if(${CMAKE_CL_64}) 21 | set(TELI_PATH_SUFFIXES x64) 22 | else() 23 | set(TELI_PATH_SUFFIXES x86) 24 | endif() 25 | 26 | find_library( 27 | TeliCamApi_LIBRARY 28 | NAMES TeliCamApi TeliCamApi64 TeliCamApi_64 29 | PATHS 30 | "${PROGRAM_FILES}/Toshiba Teli/TeliCamSDK/TeliCamApi/lib" 31 | "${CMAKE_SOURCE_DIR}/../TeliCamSDK/TeliCamApi/lib" 32 | /usr/lib 33 | /user/lib 34 | /opt/TeliCamSDK/lib 35 | PATH_SUFFIXES ${TELI_PATH_SUFFIXES} 36 | ) 37 | 38 | find_library( 39 | TeliCamUtl_LIBRARY 40 | NAMES TeliCamUtl TeliCamUtl64 TeliCamUtl_64 41 | PATHS 42 | "${PROGRAM_FILES}/Toshiba Teli/TeliCamSDK/TeliCamApi/lib" 43 | "${CMAKE_SOURCE_DIR}/../TeliCamSDK/TeliCamApi/lib" 44 | /usr/lib 45 | /user/lib 46 | /opt/TeliCamSDK/lib 47 | PATH_SUFFIXES ${TELI_PATH_SUFFIXES} 48 | ) 49 | 50 | set(TeliCam_INCLUDE_DIRS ${TeliCam_INCLUDE_DIR}) 51 | set(TeliCam_LIBRARY "${TeliCamApi_LIBRARY}" "${TeliCamUtl_LIBRARY}") 52 | set(TeliCam_LIBRARIES ${TeliCam_LIBRARY}) 53 | 54 | include(FindPackageHandleStandardArgs) 55 | find_package_handle_standard_args( TeliCam 56 | FOUND_VAR TeliCam_FOUND 57 | REQUIRED_VARS TeliCamApi_LIBRARY TeliCamUtl_LIBRARY TeliCam_INCLUDE_DIR 58 | ) 59 | -------------------------------------------------------------------------------- /cmake/FindTooN.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find libTooN 2 | # 3 | # TooN_FOUND - system has libTooN 4 | # TooN_INCLUDE_DIR - the libTooN include directories 5 | 6 | FIND_PATH( 7 | TooN_INCLUDE_DIR 8 | NAMES TooN/TooN.h 9 | PATHS 10 | ${CMAKE_SOURCE_DIR} 11 | ${CMAKE_SOURCE_DIR}/.. 12 | /usr/include 13 | /usr/local/include 14 | ) 15 | 16 | IF(TooN_INCLUDE_DIR) 17 | SET(TooN_FOUND TRUE) 18 | ENDIF() 19 | 20 | IF(TooN_FOUND) 21 | IF(NOT TooN_FIND_QUIETLY) 22 | MESSAGE(STATUS "Found TooN: ${TooN_INCLUDE_DIR}") 23 | ENDIF() 24 | ELSE() 25 | IF(TooN_FIND_REQUIRED) 26 | MESSAGE(FATAL_ERROR "Could not find TooN") 27 | ENDIF() 28 | ENDIF() 29 | -------------------------------------------------------------------------------- /cmake/FindXrandr.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find Xrandr 2 | # 3 | # Xrandr_FOUND - system has libXrandr 4 | # Xrandr_INCLUDE_DIRS - the libXrandr include directories 5 | # Xrandr_LIBRARIES - link these to use libXrandr 6 | 7 | FIND_PATH( 8 | Xrandr_INCLUDE_DIRS 9 | NAMES X11/extensions/Xrandr.h 10 | PATH_SUFFIXES X11/extensions 11 | DOC "The Xrandr include directory" 12 | ) 13 | 14 | FIND_LIBRARY( 15 | Xrandr_LIBRARIES 16 | NAMES Xrandr 17 | DOC "The Xrandr library" 18 | ) 19 | 20 | IF (Xrandr_INCLUDE_DIRS AND Xrandr_LIBRARIES) 21 | SET(Xrandr_FOUND TRUE) 22 | ENDIF (Xrandr_INCLUDE_DIRS AND Xrandr_LIBRARIES) 23 | 24 | IF (Xrandr_FOUND) 25 | IF (NOT Xrandr_FIND_QUIETLY) 26 | MESSAGE(STATUS "Found Xrandr: ${Xrandr_LIBRARIES}") 27 | ENDIF (NOT Xrandr_FIND_QUIETLY) 28 | ELSE (Xrandr_FOUND) 29 | IF (Xrandr_FIND_REQUIRED) 30 | MESSAGE(FATAL_ERROR "Could not find Xrandr") 31 | ENDIF (Xrandr_FIND_REQUIRED) 32 | ENDIF (Xrandr_FOUND) 33 | -------------------------------------------------------------------------------- /cmake/Findlibusb1.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find libusb1 2 | # 3 | # libusb1_FOUND - system has libusb1 4 | # libusb1_INCLUDE_DIRS - the libusb1 include directories 5 | # libusb1_LIBRARIES - link these to use libusb1 6 | 7 | FIND_PATH( 8 | libusb1_INCLUDE_DIRS 9 | NAMES libusb-1.0/libusb.h 10 | PATHS 11 | c:/dev/sysroot32/usr/include 12 | ${CMAKE_SOURCE_DIR}/../libusb1/include 13 | /usr/include/ 14 | /usr/local/include 15 | /opt/local/include 16 | ) 17 | 18 | FIND_LIBRARY( 19 | libusb1_LIBRARIES 20 | NAMES usb-1.0 21 | PATHS 22 | c:/dev/sysroot32/usr/lib 23 | ${CMAKE_SOURCE_DIR}/../libusb1/lib 24 | /usr/lib 25 | /usr/lib64 26 | /usr/local/lib 27 | /opt/local/lib 28 | ) 29 | 30 | IF(libusb1_INCLUDE_DIRS AND libusb1_LIBRARIES) 31 | SET(libusb1_FOUND TRUE) 32 | ENDIF(libusb1_INCLUDE_DIRS AND libusb1_LIBRARIES) 33 | 34 | IF(libusb1_FOUND) 35 | IF(NOT libusb1_FIND_QUIETLY) 36 | MESSAGE(STATUS "Found libusb1: ${libusb1_LIBRARIES}") 37 | ENDIF(NOT libusb1_FIND_QUIETLY) 38 | ELSE(libusb1_FOUND) 39 | message(STATUS "libusb1 NOT found") 40 | IF(libusb1_FIND_REQUIRED) 41 | MESSAGE(FATAL_ERROR "Could not find libusb1") 42 | ENDIF(libusb1_FIND_REQUIRED) 43 | ENDIF(libusb1_FOUND) 44 | -------------------------------------------------------------------------------- /cmake/Findpthread.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find pthread 2 | # 3 | # pthread_FOUND - system has pthread 4 | # pthread_INCLUDE_DIRS - the pthread include directories 5 | # pthread_LIBRARIES - link these to use pthread 6 | 7 | FIND_PATH( 8 | pthread_INCLUDE_DIRS 9 | NAMES pthread.h 10 | PATHS 11 | c:/dev/sysroot32/usr/include 12 | ${CMAKE_SOURCE_DIR}/../pthread/include 13 | /usr/include/ 14 | /usr/local/include 15 | /opt/local/include 16 | ) 17 | 18 | FIND_LIBRARY( 19 | pthread_LIBRARIES 20 | NAMES pthreadVSE2 pthread 21 | PATHS 22 | c:/dev/sysroot32/usr/lib 23 | ${CMAKE_SOURCE_DIR}/../pthread/lib 24 | /usr/lib 25 | /usr/local/lib 26 | /opt/local/lib 27 | ) 28 | 29 | IF(pthread_INCLUDE_DIRS AND pthread_LIBRARIES) 30 | SET(pthread_FOUND TRUE) 31 | ENDIF(pthread_INCLUDE_DIRS AND pthread_LIBRARIES) 32 | 33 | IF(pthread_FOUND) 34 | IF(NOT pthread_FIND_QUIETLY) 35 | MESSAGE(STATUS "Found pthread: ${pthread_LIBRARIES}") 36 | ENDIF(NOT pthread_FIND_QUIETLY) 37 | ELSE(pthread_FOUND) 38 | message(STATUS "pthread NOT found") 39 | IF(pthread_FIND_REQUIRED) 40 | MESSAGE(FATAL_ERROR "Could not find pthread") 41 | ENDIF(pthread_FIND_REQUIRED) 42 | ENDIF(pthread_FOUND) 43 | -------------------------------------------------------------------------------- /cmake/Finduvc.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find uvc 2 | # 3 | # uvc_FOUND - system has libuvc 4 | # uvc_INCLUDE_DIRS - the libuvc include directories 5 | # uvc_LIBRARIES - link these to use libuvc 6 | 7 | FIND_PATH( 8 | uvc_INCLUDE_DIRS 9 | NAMES libuvc/libuvc.h 10 | PATHS 11 | ${CMAKE_SOURCE_DIR}/.. 12 | /usr/include/ 13 | /usr/local/include 14 | /opt/local/include 15 | ) 16 | 17 | FIND_LIBRARY( 18 | uvc_LIBRARIES 19 | NAMES uvc 20 | PATHS 21 | ${CMAKE_SOURCE_DIR}/../uvc/build 22 | /usr/lib 23 | /usr/local/lib 24 | /opt/local/lib 25 | ) 26 | 27 | IF (uvc_INCLUDE_DIRS AND uvc_LIBRARIES) 28 | SET(uvc_FOUND TRUE) 29 | ENDIF (uvc_INCLUDE_DIRS AND uvc_LIBRARIES) 30 | 31 | IF (uvc_FOUND) 32 | IF (NOT uvc_FIND_QUIETLY) 33 | MESSAGE(STATUS "Found uvc: ${uvc_LIBRARIES}") 34 | ENDIF (NOT uvc_FIND_QUIETLY) 35 | ELSE (uvc_FOUND) 36 | IF (uvc_FIND_REQUIRED) 37 | MESSAGE(FATAL_ERROR "Could not find uvc") 38 | ENDIF (uvc_FIND_REQUIRED) 39 | ENDIF (uvc_FOUND) 40 | -------------------------------------------------------------------------------- /cmake/Findzstd.cmake: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Find Toshiba TeliCam 3 | # 4 | # This sets the following variables: 5 | # TeliCam_FOUND - True if TeliCam was found. 6 | # TeliCam_INCLUDE_DIRS - Directories containing the TeliCam include files. 7 | # TeliCam_LIBRARIES - Libraries needed to use TeliCam. 8 | 9 | find_path( 10 | zstd_INCLUDE_DIR zstd.h 11 | PATHS 12 | /opt/local/include 13 | /usr/local/include 14 | /usr/include 15 | PATH_SUFFIXES TeliCam 16 | ) 17 | 18 | find_library( 19 | zstd_LIBRARY 20 | NAMES zstd 21 | PATHS 22 | /opt/local/lib 23 | /user/local/lib 24 | /usr/lib 25 | ) 26 | 27 | # Plural forms 28 | set(zstd_INCLUDE_DIRS ${zstd_INCLUDE_DIR}) 29 | set(zstd_LIBRARIES ${zstd_LIBRARY}) 30 | 31 | include(FindPackageHandleStandardArgs) 32 | find_package_handle_standard_args( zstd 33 | FOUND_VAR zstd_FOUND 34 | REQUIRED_VARS zstd_INCLUDE_DIR zstd_LIBRARY 35 | ) 36 | -------------------------------------------------------------------------------- /cmake/PangolinConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # Compute paths 2 | get_filename_component( PROJECT_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH ) 3 | 4 | # Library dependencies (contains definitions for IMPORTED targets) 5 | if( NOT @PROJECT_NAME@_BINARY_DIR ) 6 | include( "${PROJECT_CMAKE_DIR}/@PROJECT_NAME@Targets.cmake" ) 7 | endif() 8 | 9 | SET( Pangolin_CMAKEMODULES @CMAKE_CURRENT_SOURCE_DIR@/cmake ) 10 | SET( Pangolin_LIBRARIES @component_list@ ) 11 | SET( Pangolin_LIBRARY "${Pangolin_LIBRARIES}" ) 12 | 13 | include(CMakeFindDependencyMacro) 14 | find_dependency(Eigen3) 15 | 16 | if (UNIX) 17 | find_dependency(Threads) 18 | endif() 19 | 20 | if (NOT EMSCRIPTEN) 21 | find_dependency(OpenGL REQUIRED COMPONENTS OpenGL) 22 | endif() 23 | 24 | if(_LINUX_) 25 | find_dependency(OpenGL REQUIRED COMPONENTS EGL) 26 | endif() 27 | -------------------------------------------------------------------------------- /cmake/PangolinConfigVersion.cmake.in: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION "@PANGOLIN_VERSION@") 2 | 3 | # Check build type is valid 4 | if( "System:${CMAKE_SYSTEM_NAME},Win64:${CMAKE_CL_64},Android:${ANDROID},iOS:${IOS}" STREQUAL 5 | "System:@CMAKE_SYSTEM_NAME@,Win64:@CMAKE_CL_64@,Android:@ANDROID@,iOS:@IOS@" ) 6 | # Check whether the requested PACKAGE_FIND_VERSION is compatible 7 | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") 8 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 9 | else() 10 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 11 | if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") 12 | set(PACKAGE_VERSION_EXACT TRUE) 13 | endif() 14 | endif() 15 | else() 16 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 17 | endif() 18 | -------------------------------------------------------------------------------- /cmake/SetPlatformVars.cmake: -------------------------------------------------------------------------------- 1 | ## Compiler configuration 2 | IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) 3 | SET(_GCC_ 1) 4 | ENDIF() 5 | 6 | IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") 7 | SET(_CLANG_ 1) 8 | ENDIF() 9 | 10 | IF(MSVC) 11 | SET(_MSVC_ 1) 12 | ENDIF() 13 | 14 | ## Platform configuration 15 | 16 | IF(WIN32 OR WIN64) 17 | SET(_WIN_ 1) 18 | ENDIF() 19 | 20 | IF(UNIX) 21 | SET(_UNIX_ 1) 22 | ENDIF() 23 | 24 | IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 25 | SET(_OSX_ 1) 26 | ENDIF() 27 | 28 | IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") 29 | SET(_LINUX_ 1) 30 | ENDIF() 31 | 32 | IF(ANDROID) 33 | SET(_ANDROID_ 1) 34 | ENDIF() 35 | 36 | IF(IOS) 37 | SET(_APPLE_IOS_ 1) 38 | ENDIF() 39 | 40 | 41 | 42 | ## Default search paths 43 | 44 | IF(_WIN_) 45 | IF(${CMAKE_CL_64}) 46 | LIST(APPEND CMAKE_INCLUDE_PATH "c:/dev/sysroot64/usr/include") 47 | LIST(APPEND CMAKE_LIBRARY_PATH "c:/dev/sysroot64/usr/lib") 48 | LIST(APPEND CMAKE_LIBRARY_PATH "c:/dev/sysroot64/usr/bin") 49 | set(PROGRAM_FILES "$ENV{PROGRAMW6432}" ) 50 | ELSE() 51 | LIST(APPEND CMAKE_INCLUDE_PATH "c:/dev/sysroot32/usr/include") 52 | LIST(APPEND CMAKE_LIBRARY_PATH "c:/dev/sysroot32/usr/lib") 53 | LIST(APPEND CMAKE_LIBRARY_PATH "c:/dev/sysroot32/usr/bin") 54 | set(PROGRAM_FILES "$ENV{PROGRAMFILES}" ) 55 | ENDIF() 56 | ENDIF() 57 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") 3 | endif() 4 | 5 | file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach(file ${files}) 8 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 9 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 10 | exec_program( 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 12 | OUTPUT_VARIABLE rm_out 13 | RETURN_VALUE rm_retval 14 | ) 15 | if(NOT "${rm_retval}" STREQUAL 0) 16 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 17 | endif() 18 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 19 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 20 | endif() 21 | endforeach() 22 | -------------------------------------------------------------------------------- /cmake/wheel-dist-info/METADATA: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.1 2 | Name: @python_module@ 3 | Version: @MAKEWHEEL_VERSION@ 4 | Summary: @MAKEWHEEL_SUMMARY@ 5 | Home-page: @MAKEWHEEL_HOMEPAGE@ 6 | Author: @MAKEWHEEL_AUTHOR@ 7 | Author-email: @MAKEWHEEL_EMAIL@ 8 | License: @MAKEWHEEL_LICENCE@ 9 | Description-Content-Type: text/markdown 10 | @MAKEWHEEL_REQUIRES@ 11 | 12 | @MAKEWHEEL_DESCRIPTION@ 13 | -------------------------------------------------------------------------------- /cmake/wheel-dist-info/WHEEL: -------------------------------------------------------------------------------- 1 | Wheel-Version: 1.0 2 | Generator: @wheel_generator_string@ 3 | Root-Is-Purelib: false 4 | Tag: @complete_tag@ 5 | 6 | -------------------------------------------------------------------------------- /cmake/wheel-dist-info/top_level.txt: -------------------------------------------------------------------------------- 1 | @python_module@ 2 | -------------------------------------------------------------------------------- /components/pango_core/include/NaturalSort/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Gagan Kumar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /components/pango_core/include/NaturalSort/README.md: -------------------------------------------------------------------------------- 1 | # NaturalSort 2 | C++ Header File for Natural Comparison and Natural Sort 3 | 4 | 5 | ##### Calling Methods 6 | 7 | * __For Natural Sorting__ 8 | 9 | void SI::natural::sort(Container); 10 | 11 | void SI::natural::sort(IteratorBegin,IteratorEnd); 12 | 13 | void SI::natural::sort(CArray); 14 | 15 | 16 | * __For Natural Comparision__ 17 | 18 | bool SI::natural::compare(String lhs,String rhs); 19 | bool SI::natural::compare(char *const lhs,char *const rhs); 20 | 21 | Here we can have 22 | 23 | std::vector as Container 24 | String as std::string 25 | CArray as std::string[CArraySize] 26 | 27 | 28 | 29 | 30 | 31 | ##### Example 32 | 33 | * __Inputs__ 34 | 35 | Hello 100 36 | Hello 34 37 | Hello 9 38 | Hello 25 39 | Hello 10 40 | Hello 8 41 | 42 | * __Normal Sort Output__ 43 | 44 | Hello 10 45 | Hello 100 46 | Hello 25 47 | Hello 34 48 | Hello 8 49 | Hello 9 50 | 51 | * __Natural Sort Output__ 52 | 53 | Hello 8 54 | Hello 9 55 | Hello 10 56 | Hello 25 57 | Hello 34 58 | Hello 100 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /components/pango_core/include/dynalo/detail/config.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if defined(__linux__) || defined(__linux) || defined(linux) || defined(_LINUX) 4 | #define DYNALO_HAS_LINUX 5 | #elif defined(_WIN32) || defined(_WIN64) 6 | #define DYNALO_HAS_WINDOWS 7 | #elif defined(__APPLE__) 8 | #define DYNALO_HAS_MACOS 9 | #else 10 | #error "dynalo/detail/config.hpp OS Not Supported" 11 | #endif 12 | 13 | #define DYNALO_VERSION_MAJOR 1 14 | #define DYNALO_VERSION_MINOR 0 15 | #define DYNALO_VERSION_PATCH 3 16 | #define DYNALO_VERSION 0x010003 /**< major minor patch*/ 17 | -------------------------------------------------------------------------------- /components/pango_core/include/dynalo/detail/linux/dynalo.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace dynalo { namespace detail 9 | { 10 | 11 | inline 12 | std::string last_error() 13 | { 14 | return std::string(::dlerror()); 15 | } 16 | 17 | namespace native 18 | { 19 | 20 | using handle = void*; 21 | 22 | inline handle invalid_handle() { return nullptr; } 23 | 24 | enum class resolve 25 | { 26 | now = RTLD_NOW, 27 | lazy = RTLD_LAZY, 28 | }; 29 | 30 | namespace name 31 | { 32 | 33 | inline std::string prefix() { return std::string("lib"); } 34 | inline std::string suffix() { return std::string(); } 35 | inline std::string extension() { return std::string("so"); } 36 | 37 | } 38 | 39 | } 40 | 41 | inline 42 | native::handle open(const std::string& dyn_lib_path, native::resolve symbol_resolution) 43 | { 44 | native::handle lib_handle = ::dlopen(dyn_lib_path.c_str(), static_cast(symbol_resolution)); 45 | if (lib_handle == nullptr) 46 | { 47 | throw std::runtime_error(std::string("Failed to open [dyn_lib_path:") + dyn_lib_path + "]: " + last_error()); 48 | } 49 | 50 | return lib_handle; 51 | } 52 | 53 | inline 54 | void close(native::handle lib_handle) 55 | { 56 | const int rc = ::dlclose(lib_handle); 57 | if (rc != 0) 58 | { 59 | throw std::runtime_error(std::string("Failed to close the dynamic library: ") + last_error()); 60 | } 61 | } 62 | 63 | template 64 | inline 65 | FunctionSignature* get_function(native::handle lib_handle, const std::string& func_name) 66 | { 67 | void* func_ptr = ::dlsym(lib_handle, func_name.c_str()); 68 | if (func_ptr == nullptr) 69 | { 70 | throw std::runtime_error(std::string("Failed to get [func_name:") + func_name + "]: " + last_error()); 71 | } 72 | 73 | return reinterpret_cast(func_ptr); 74 | } 75 | 76 | }} 77 | -------------------------------------------------------------------------------- /components/pango_core/include/dynalo/detail/macos/dynalo.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace dynalo { namespace detail 9 | { 10 | 11 | inline 12 | std::string last_error() 13 | { 14 | return std::string(::dlerror()); 15 | } 16 | 17 | namespace native 18 | { 19 | 20 | using handle = void*; 21 | 22 | inline handle invalid_handle() { return nullptr; } 23 | 24 | enum class resolve 25 | { 26 | now = RTLD_NOW, 27 | lazy = RTLD_LAZY, 28 | }; 29 | 30 | namespace name 31 | { 32 | 33 | inline std::string prefix() { return std::string("lib"); } 34 | inline std::string suffix() { return std::string(); } 35 | inline std::string extension() { return std::string("dylib"); } 36 | 37 | } 38 | 39 | } 40 | 41 | inline 42 | native::handle open(const std::string& dyn_lib_path, native::resolve symbol_resolution) 43 | { 44 | native::handle lib_handle = ::dlopen(dyn_lib_path.c_str(), static_cast(symbol_resolution) ); 45 | if (lib_handle == nullptr) 46 | { 47 | throw std::runtime_error(std::string("Failed to open [dyn_lib_path:") + dyn_lib_path + "]: " + last_error()); 48 | } 49 | 50 | return lib_handle; 51 | } 52 | 53 | inline 54 | void close(native::handle lib_handle) 55 | { 56 | const int rc = ::dlclose(lib_handle); 57 | if (rc != 0) 58 | { 59 | throw std::runtime_error(std::string("Failed to close the dynamic library: ") + last_error()); 60 | } 61 | } 62 | 63 | template 64 | inline 65 | FunctionSignature* get_function(native::handle lib_handle, const std::string& func_name) 66 | { 67 | void* func_ptr = ::dlsym(lib_handle, func_name.c_str()); 68 | if (func_ptr == nullptr) 69 | { 70 | throw std::runtime_error(std::string("Failed to get [func_name:") + func_name + "]: " + last_error()); 71 | } 72 | 73 | return reinterpret_cast(func_ptr); 74 | } 75 | 76 | }} 77 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/compat/type_traits.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | #include 33 | 34 | #include 35 | 36 | // enable_if From Boost 37 | namespace pangolin 38 | { 39 | template 40 | struct enable_if_c { 41 | typedef T type; 42 | }; 43 | 44 | template 45 | struct enable_if_c {}; 46 | 47 | template 48 | struct enable_if : public enable_if_c {}; 49 | } 50 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/factory/factory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace pangolin 8 | { 9 | 10 | class FactoryInterface { 11 | public: 12 | using Name = std::string; 13 | using Precedence = int32_t; 14 | 15 | virtual ~FactoryInterface(){}; 16 | 17 | virtual std::map Schemes() const = 0; 18 | 19 | virtual const char* Description() const = 0; 20 | 21 | virtual ParamSet Params() const = 0; 22 | }; 23 | 24 | template 25 | class TypedFactoryInterface : public FactoryInterface 26 | { 27 | public: 28 | virtual std::unique_ptr Open(const Uri& uri) = 0; 29 | }; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/factory/factory_help.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace pangolin { 6 | 7 | /// The level of detail to use when printing 8 | enum HelpVerbosity{ 9 | SUMMARY = 0, // Short description 10 | SYNOPSIS, // + examples, aliases 11 | PARAMS // + list all arguments 12 | }; 13 | 14 | /// Print to \p out general guidance on how to use Pangolin factory URL's 15 | /// \p out the stream to stream the help message to 16 | /// \p color whether ANSI Color codes should be used for formatting 17 | void PrintSchemeHelp(std::ostream& out = std::cout, bool color = true); 18 | 19 | /// Print to \p out Factories registered to \p registry that match \p scheme_filter. 20 | /// \p out the stream to stream the help message to 21 | /// \p registry the registy to use 22 | /// \p factory_type the typeid(T) of the FactoryInterface T to list 23 | /// \p scheme_filter a constraint on schemes to print, or empty if all should be listed 24 | /// \p level the level of detail to use when printing (see enum above) 25 | /// \p color whether ANSI Color codes should be used for formatting 26 | void PrintFactoryRegistryDetails( 27 | std::ostream& out, const pangolin::FactoryRegistry& registry, std::type_index factory_type, 28 | const std::string& scheme_filter = "", HelpVerbosity level = HelpVerbosity::SYNOPSIS, bool color = true 29 | ); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/utils/avx_math.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Hauke Strasdat, Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | #ifdef __AVX2__ 30 | #include 31 | #endif 32 | 33 | namespace pangolin 34 | { 35 | #ifdef __AVX2__ 36 | __m256 pow256_ps(__m256 x, __m256 y); 37 | #endif 38 | } 39 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/utils/compontent_cast.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #ifdef HAVE_EIGEN 6 | # include 7 | #endif 8 | 9 | namespace pangolin 10 | { 11 | 12 | // Scalar / Vector agnostic static_cast-like thing 13 | // 14 | // e.g. Promote float to double: 15 | // ComponentCast::cast(0.14f); 16 | // 17 | // e.g. Promote Eigen::Vector2f to Eigen::Vector2d: 18 | // ComponentCast::cast(Eigen::Vector2f(0.1,0.2); 19 | 20 | template 21 | struct ComponentCast 22 | { 23 | PANGO_HOST_DEVICE 24 | static To cast(const From& val) 25 | { 26 | return static_cast(val); 27 | } 28 | }; 29 | 30 | #ifdef HAVE_EIGEN 31 | template 32 | struct ComponentCast > 33 | { 34 | PANGO_HOST_DEVICE 35 | static To cast(const Eigen::MatrixBase& val) 36 | { 37 | return val.template cast(); 38 | } 39 | }; 40 | #endif 41 | 42 | } 43 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/utils/is_streamable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace pangolin { 9 | 10 | // Provide SFINAE test for if type T is streamable into S 11 | // Example usage: 12 | // template 13 | // typename std::enable_if::value, S>::type 14 | // Example(const S& src) noexcept 15 | // { 16 | // std::cout << src; 17 | // return src; 18 | // } 19 | template 20 | class is_streamable 21 | { 22 | template 23 | static auto test(int) 24 | -> decltype( std::declval() << std::declval(), std::true_type() ); 25 | 26 | template 27 | static auto test(...) -> std::false_type; 28 | 29 | public: 30 | static const bool value = decltype(test(0))::value; 31 | }; 32 | 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/utils/memstreambuf.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace pangolin { 7 | 8 | // A simple streambuf wrapper around std::vector for memory buffer use 9 | struct memstreambuf : public std::streambuf 10 | { 11 | public: 12 | memstreambuf(size_t initial_buffer_size) 13 | { 14 | buffer.reserve(initial_buffer_size); 15 | } 16 | 17 | // Avoiding use of std::streambuf's move constructor, since it is missing for old GCC 18 | memstreambuf(memstreambuf&& o) 19 | : buffer(std::move(o.buffer)) 20 | { 21 | pubseekpos(o.pubseekoff(0, std::ios_base::cur)); 22 | } 23 | 24 | size_t size() const 25 | { 26 | return buffer.size(); 27 | } 28 | 29 | const unsigned char* data() const 30 | { 31 | return buffer.data(); 32 | } 33 | 34 | void clear() 35 | { 36 | buffer.clear(); 37 | } 38 | 39 | std::vector buffer; 40 | 41 | protected: 42 | std::streamsize xsputn(const char_type* __s, std::streamsize __n) override 43 | { 44 | buffer.insert(buffer.end(), __s, __s + __n); 45 | return __n; 46 | } 47 | 48 | int_type overflow(int_type __c) override 49 | { 50 | buffer.push_back( static_cast(__c) ); 51 | return __c; 52 | } 53 | }; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/utils/posix/condition_variable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace pangolin 8 | { 9 | 10 | class ConditionVariableInterface 11 | { 12 | public: 13 | virtual ~ConditionVariableInterface() 14 | { 15 | } 16 | 17 | virtual void wait() = 0; 18 | virtual bool wait(timespec t) = 0; 19 | virtual void signal() = 0; 20 | virtual void broadcast() = 0; 21 | }; 22 | 23 | std::shared_ptr create_named_condition_variable(const 24 | std::string& name); 25 | std::shared_ptr open_named_condition_variable(const 26 | std::string& name); 27 | } 28 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/utils/posix/semaphore.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace pangolin 8 | { 9 | 10 | class SemaphoreInterface 11 | { 12 | public: 13 | 14 | virtual ~SemaphoreInterface() { 15 | } 16 | 17 | virtual bool tryAcquire() = 0; 18 | virtual void acquire() = 0; 19 | virtual void release() = 0; 20 | }; 21 | 22 | std::shared_ptr create_named_semaphore(const std::string& name, 23 | unsigned int value); 24 | std::shared_ptr open_named_semaphore(const std::string& name); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/utils/posix/shared_memory_buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace pangolin 8 | { 9 | class SharedMemoryBufferInterface 10 | { 11 | public: 12 | virtual ~SharedMemoryBufferInterface() { 13 | } 14 | virtual bool tryLock() = 0; 15 | virtual void lock() = 0; 16 | virtual void unlock() = 0; 17 | virtual unsigned char *ptr() = 0; 18 | virtual std::string name() = 0; 19 | }; 20 | 21 | std::shared_ptr create_named_shared_memory_buffer(const 22 | std::string& name, size_t size); 23 | std::shared_ptr open_named_shared_memory_buffer(const 24 | std::string& name, bool readwrite); 25 | } 26 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/utils/signal_slot.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/utils/true_false_toggle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace pangolin { 4 | 5 | enum class TrueFalseToggle 6 | { 7 | False=0, 8 | True=1, 9 | Toggle=2 10 | }; 11 | 12 | inline bool to_bool(const TrueFalseToggle on_off_toggle, const bool current_value) 13 | { 14 | switch (on_off_toggle) { 15 | case TrueFalseToggle::True: return true; 16 | case TrueFalseToggle::False: return false; 17 | case TrueFalseToggle::Toggle: return !current_value; 18 | default: return false; 19 | } 20 | } 21 | 22 | inline bool should_toggle(const TrueFalseToggle on_off_toggle, const bool current_value) 23 | { 24 | return ( (on_off_toggle == TrueFalseToggle::Toggle) || 25 | (current_value != (on_off_toggle==TrueFalseToggle::True)) 26 | ); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/utils/uri.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | namespace pangolin 35 | { 36 | 37 | struct PANGOLIN_EXPORT Uri : public Params 38 | { 39 | std::string scheme; 40 | std::string url; 41 | std::string full_uri; 42 | }; 43 | 44 | //! Parse string as Video URI 45 | PANGOLIN_EXPORT 46 | Uri ParseUri(const std::string& str_uri); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /components/pango_core/include/pangolin/utils/variadic_all.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace pangolin { 6 | 7 | template 8 | bool all_of(TPred pred, const T& i) 9 | { 10 | return pred(i); 11 | } 12 | 13 | template 14 | bool all_of(const TPred& pred, const T& i, const Targs& ... ins) 15 | { 16 | return pred(i) && all_of(pred, ins...); 17 | } 18 | 19 | template 20 | bool any_of(TPred pred, const T& i) 21 | { 22 | return pred(i); 23 | } 24 | 25 | template 26 | bool any_of(const TPred& pred, const T& i, Targs& ... ins) 27 | { 28 | return pred(i) || any_of(pred, ins...); 29 | } 30 | 31 | template 32 | bool all_found(const TContainer& c, const Targs& ... its) 33 | { 34 | using T1 = typename std::tuple_element<0, std::tuple>::type; 35 | return all_of([&c](const T1& it){return it != c.end();}, its...); 36 | } 37 | 38 | template 39 | bool all_equal(const T& v1, const Targs& ... its) 40 | { 41 | return all_of([v1](const T& o){return v1 == o;}, its...); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /components/pango_core/include/sigslot/LICENCE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Pierre-Antoine Lacaze 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /components/pango_core/src/dummy.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stevenlovegrove/Pangolin/122bb3ee8b8b06761e9738e6bb747f81bfa74002/components/pango_core/src/dummy.cpp -------------------------------------------------------------------------------- /components/pango_core/src/factory/factory_registry.cpp: -------------------------------------------------------------------------------- 1 | #include "pangolin/factory/factory_registry.h" 2 | 3 | namespace pangolin { 4 | 5 | std::shared_ptr FactoryRegistry::I() 6 | { 7 | static std::shared_ptr registry(new FactoryRegistry()); 8 | return registry; 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /components/pango_core/src/param_set.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace pangolin 4 | { 5 | 6 | bool ParamReader::Contains( const std::string& param_name ) 7 | { 8 | const ParamSet::Param* param = GetMatchingParamFromParamSet( param_name ); 9 | if( param ){ 10 | return uri_.Contains( param_name ); 11 | } 12 | throw ParamReaderException( param_name ); 13 | } 14 | 15 | std::unordered_set ParamReader::FindUnrecognizedUriParams() 16 | { 17 | std::unordered_set result; 18 | for(const auto& param_pair: uri_.params){ 19 | if(GetMatchingParamFromParamSet( param_pair.first ) == nullptr ){ 20 | result.insert( param_pair.first ); 21 | } 22 | } 23 | return result; 24 | } 25 | 26 | const ParamSet::Param* ParamReader::GetMatchingParamFromParamSet( const std::string& param_name ) const 27 | { 28 | for(const auto& param : param_set_.params){ 29 | std::regex name_regex( param.name_regex ); 30 | if (std::regex_match ( param_name, name_regex )){ 31 | return ¶m; 32 | } 33 | } 34 | return nullptr; 35 | } 36 | 37 | std::string ParamSet::str() const 38 | { 39 | std::stringstream ss; 40 | if( params.size() > 0){ 41 | ss << "["; 42 | size_t count = 0; 43 | for(const auto& param : params){ 44 | ss << param.name_regex; 45 | if(!param.default_value.empty()){ 46 | ss << "=" << param.default_value; 47 | } 48 | if(count < (params.size()-1)){ 49 | ss << ","; 50 | } 51 | count++; 52 | } 53 | ss << "]"; 54 | } 55 | return ss.str(); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /components/pango_core/src/posix/semaphore.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | using namespace std; 10 | 11 | namespace pangolin 12 | { 13 | 14 | // TODO(shaheen) register a signal handler for SIGTERM and unlink shared 15 | // semaphores. 16 | class PosixSemaphore : public SemaphoreInterface 17 | { 18 | public: 19 | PosixSemaphore(sem_t *semaphore, bool ownership, const string& name) : 20 | _semaphore(semaphore), 21 | _ownership(ownership), 22 | _name(name) 23 | { 24 | } 25 | 26 | ~PosixSemaphore() override 27 | { 28 | if (_ownership) { 29 | sem_unlink(_name.c_str()); 30 | } else { 31 | sem_close(_semaphore); 32 | } 33 | } 34 | 35 | bool tryAcquire() override 36 | { 37 | int err = sem_trywait(_semaphore); 38 | return err == 0; 39 | } 40 | 41 | void acquire() override 42 | { 43 | sem_wait(_semaphore); 44 | } 45 | 46 | void release() override 47 | { 48 | sem_post(_semaphore); 49 | } 50 | 51 | private: 52 | sem_t *_semaphore; 53 | bool _ownership; 54 | string _name; 55 | }; 56 | 57 | std::shared_ptr create_named_semaphore(const string& name, unsigned int value) 58 | { 59 | std::shared_ptr ptr; 60 | sem_t *semaphore = sem_open(name.c_str(), O_CREAT | O_EXCL, 61 | S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, value); 62 | if (NULL == semaphore) { 63 | return ptr; 64 | } 65 | 66 | ptr.reset(new PosixSemaphore(semaphore, true, name)); 67 | return ptr; 68 | } 69 | 70 | std::shared_ptr open_named_semaphore(const string& name) 71 | { 72 | std::shared_ptr ptr; 73 | sem_t *semaphore = sem_open(name.c_str(), 0); 74 | 75 | if (NULL == semaphore) { 76 | return ptr; 77 | } 78 | 79 | ptr.reset(new PosixSemaphore(semaphore, false, name)); 80 | return ptr; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /components/pango_core/src/sigstate.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | using namespace std; 34 | 35 | namespace pangolin 36 | { 37 | 38 | SigState& SigState::I() { 39 | static SigState singleton; 40 | return singleton; 41 | } 42 | 43 | SigState::SigState() 44 | { 45 | } 46 | 47 | SigState::~SigState() { 48 | Clear(); 49 | } 50 | 51 | void SigState::Clear() { 52 | sig_callbacks.clear(); 53 | } 54 | 55 | void RegisterNewSigCallback(SigCallbackFn callback, void* data, const int signal) 56 | { 57 | SigState::I().sig_callbacks.insert(std::pair(signal, SigCallback(signal, callback, data))); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /components/pango_display/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(COMPONENT ${CMAKE_CURRENT_LIST_DIR} NAME) 2 | 3 | target_sources( ${COMPONENT} 4 | PRIVATE 5 | ${CMAKE_CURRENT_LIST_DIR}/src/display.cpp 6 | ${CMAKE_CURRENT_LIST_DIR}/src/process.cpp 7 | ${CMAKE_CURRENT_LIST_DIR}/src/pangolin_gl.cpp 8 | ${CMAKE_CURRENT_LIST_DIR}/src/handler.cpp 9 | ${CMAKE_CURRENT_LIST_DIR}/src/handler_image.cpp 10 | ${CMAKE_CURRENT_LIST_DIR}/src/handler_glbuffer.cpp 11 | ${CMAKE_CURRENT_LIST_DIR}/src/view.cpp 12 | ${CMAKE_CURRENT_LIST_DIR}/src/widgets.cpp 13 | ${CMAKE_CURRENT_LIST_DIR}/src/image_view.cpp 14 | ${CMAKE_CURRENT_LIST_DIR}/src/ConsoleView.cpp 15 | ${CMAKE_CURRENT_LIST_DIR}/src/default_font.cpp 16 | ${CMAKE_CURRENT_BINARY_DIR}/fonts.cpp 17 | ) 18 | 19 | set_target_properties( 20 | ${COMPONENT} PROPERTIES VERSION ${PANGOLIN_VERSION} SOVERSION ${PANGOLIN_VERSION_MAJOR} 21 | ) 22 | 23 | target_link_libraries(${COMPONENT} PUBLIC pango_core pango_opengl pango_windowing pango_vars ) 24 | 25 | target_include_directories(${COMPONENT} PUBLIC 26 | $ 27 | $ 28 | ) 29 | install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include" 30 | DESTINATION ${CMAKE_INSTALL_PREFIX} 31 | ) 32 | -------------------------------------------------------------------------------- /components/pango_display/include/pangolin/display/default_font.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace pangolin { 6 | GlFont& default_font(); 7 | } 8 | -------------------------------------------------------------------------------- /components/pango_display/include/pangolin/display/display.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove, Richard Newcombe 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | namespace pangolin 31 | { 32 | 33 | PANGOLIN_DEPRECATED("Use ShowFullscreen(...) instead") 34 | inline void ToggleFullscreen() { 35 | ShowFullscreen(TrueFalseToggle::Toggle); 36 | } 37 | PANGOLIN_DEPRECATED("Use ShowFullscreen(...) instead") 38 | inline void SetFullscreen(bool fullscreen = true) { 39 | ShowFullscreen( (TrueFalseToggle)fullscreen); 40 | } 41 | PANGOLIN_DEPRECATED("Use ShowConsole(...) instead") 42 | inline void ToggleConsole() 43 | { 44 | ShowConsole(TrueFalseToggle::Toggle); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /components/pango_display/include/pangolin/display/user_app.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace pangolin 33 | { 34 | 35 | class PANGOLIN_EXPORT UserApp 36 | { 37 | public: 38 | virtual ~UserApp() {} 39 | virtual void Init() {} 40 | virtual void Render() = 0; 41 | }; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /components/pango_display/include/pangolin/handler/handler_glbuffer.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef HANDLER_GLBUFFER_H 29 | #define HANDLER_GLBUFFER_H 30 | 31 | #include 32 | #include 33 | 34 | namespace pangolin 35 | { 36 | 37 | struct PANGOLIN_EXPORT Handler3DFramebuffer : public pangolin::HandlerBase3D 38 | { 39 | Handler3DFramebuffer(GlFramebuffer& fb, pangolin::OpenGlRenderState& cam_state, pangolin::AxisDirection enforce_up=pangolin::AxisNone, float trans_scale=0.01f); 40 | void GetPosNormal(pangolin::View& view, int x, int y, GLprecision p[3], GLprecision Pw[3], GLprecision Pc[3], GLprecision /*n*/[3], GLprecision default_z); 41 | 42 | protected: 43 | GlFramebuffer& fb; 44 | }; 45 | 46 | } 47 | 48 | #endif // HANDLER_GLBUFFER_H 49 | -------------------------------------------------------------------------------- /components/pango_display/src/default_font.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "pangolin_gl.h" 4 | 5 | extern const unsigned char AnonymousPro_ttf[]; 6 | 7 | namespace pangolin { 8 | 9 | GlFont& default_font() 10 | { 11 | PangolinGl* context = GetCurrentContext(); 12 | PANGO_ASSERT(context); 13 | if(!context->font) { 14 | context->font = std::make_shared(AnonymousPro_ttf, 18); 15 | } 16 | return *(context->font.get()); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /components/pango_display/src/handler_glbuffer.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | #include 30 | 31 | namespace pangolin { 32 | 33 | Handler3DFramebuffer::Handler3DFramebuffer(GlFramebuffer& fb, pangolin::OpenGlRenderState& cam_state, pangolin::AxisDirection enforce_up, float trans_scale) 34 | : pangolin::HandlerBase3D(cam_state,enforce_up, trans_scale), fb(fb) 35 | { 36 | } 37 | 38 | void Handler3DFramebuffer::GetPosNormal(pangolin::View& view, int x, int y, GLprecision p[3], GLprecision Pw[3], GLprecision Pc[3], GLprecision n[3], GLprecision default_z) 39 | { 40 | fb.Bind(); 41 | HandlerBase3D::GetPosNormal(view,x,y,p,Pw,Pc,n,default_z); 42 | fb.Unbind(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /components/pango_geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(COMPONENT ${CMAKE_CURRENT_LIST_DIR} NAME) 2 | 3 | find_package(Eigen3 REQUIRED NO_MODULE) 4 | target_compile_definitions(${COMPONENT} PUBLIC HAVE_EIGEN) 5 | 6 | target_sources( ${COMPONENT} 7 | PRIVATE 8 | ${CMAKE_CURRENT_LIST_DIR}/src/geometry.cpp 9 | ${CMAKE_CURRENT_LIST_DIR}/src/geometry_obj.cpp 10 | ${CMAKE_CURRENT_LIST_DIR}/src/geometry_ply.cpp 11 | ) 12 | 13 | set_target_properties( 14 | ${COMPONENT} PROPERTIES VERSION ${PANGOLIN_VERSION} SOVERSION ${PANGOLIN_VERSION_MAJOR} 15 | ) 16 | 17 | target_link_libraries(${COMPONENT} pango_core pango_image tinyobj Eigen3::Eigen) 18 | target_include_directories(${COMPONENT} PUBLIC 19 | $ 20 | $ 21 | ) 22 | install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include" 23 | DESTINATION ${CMAKE_INSTALL_PREFIX} 24 | ) 25 | -------------------------------------------------------------------------------- /components/pango_geometry/include/pangolin/geometry/geometry_obj.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | 30 | namespace pangolin { 31 | 32 | pangolin::Geometry LoadGeometryObj(const std::string& filename); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /components/pango_glgeometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(COMPONENT ${CMAKE_CURRENT_LIST_DIR} NAME) 2 | 3 | target_sources( ${COMPONENT} 4 | PRIVATE 5 | ${CMAKE_CURRENT_LIST_DIR}/src/glgeometry.cpp 6 | ) 7 | 8 | set_target_properties( 9 | ${COMPONENT} PROPERTIES VERSION ${PANGOLIN_VERSION} SOVERSION ${PANGOLIN_VERSION_MAJOR} 10 | ) 11 | 12 | target_link_libraries(${COMPONENT} pango_geometry pango_opengl) 13 | target_include_directories(${COMPONENT} PUBLIC 14 | $ 15 | $ 16 | ) 17 | install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include" 18 | DESTINATION ${CMAKE_INSTALL_PREFIX} 19 | ) 20 | -------------------------------------------------------------------------------- /components/pango_image/include/pangolin/image/copy.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | namespace pangolin { 31 | 32 | // Hold a reference to an object to be copied 33 | template 34 | struct CopyObject { 35 | CopyObject(const T& obj) : obj(obj) { } 36 | const T& obj; 37 | }; 38 | 39 | // Return copy wrapper for assignment to another object. 40 | template 41 | typename pangolin::CopyObject Copy(const T& obj) { 42 | return typename pangolin::CopyObject(obj); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /components/pango_image/include/pangolin/image/image_convert.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace pangolin 7 | { 8 | 9 | template 10 | void ImageConvert(Image& dst, const Image& src, To scale = 1.0) 11 | { 12 | for(unsigned int y = 0; y < dst.h; ++y) 13 | { 14 | const T* prs = src.RowPtr(y); 15 | To* prd = dst.RowPtr(y); 16 | for(unsigned int x = 0; x < dst.w; ++x) 17 | { 18 | *(prd++) = scale * ComponentCast::cast(*(prs++)); 19 | } 20 | } 21 | } 22 | 23 | template 24 | ManagedImage ImageConvert(const Image& src, To scale = 1.0) 25 | { 26 | ManagedImage dst(src.w, src.h); 27 | ImageConvert(dst,src,scale); 28 | return dst; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /components/pango_image/src/image_io_libraw.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifdef HAVE_LIBRAW 5 | # include 6 | #endif 7 | 8 | namespace pangolin { 9 | 10 | TypedImage LoadLibRaw( 11 | const std::string& filename 12 | ) { 13 | #ifdef HAVE_LIBRAW 14 | static LibRaw RawProcessor; 15 | 16 | int ret; 17 | 18 | if ((ret = RawProcessor.open_file(filename.c_str())) != LIBRAW_SUCCESS) 19 | { 20 | throw std::runtime_error(libraw_strerror(ret)); 21 | } 22 | 23 | if ((ret = RawProcessor.unpack()) != LIBRAW_SUCCESS) 24 | { 25 | throw std::runtime_error(libraw_strerror(ret)); 26 | } 27 | 28 | const auto& S = RawProcessor.imgdata.sizes; 29 | TypedImage image(S.width, S.height, PixelFormatFromString("GRAY16LE"), sizeof(uint16_t) * S.raw_width); 30 | PitchedCopy((char*)image.ptr, image.pitch, (char*)RawProcessor.imgdata.rawdata.raw_image, sizeof(uint16_t) * S.raw_width, sizeof(uint16_t) * image.w, image.h); 31 | 32 | // TODO: Support image metadata so that we can extract these fields. 33 | // RawProcessor.imgdata.other.iso_speed 34 | // RawProcessor.imgdata.other.aperture 35 | // RawProcessor.imgdata.other.focal_len 36 | // RawProcessor.imgdata.other.shutter 37 | // RawProcessor.imgdata.other.timestamp 38 | // RawProcessor.imgdata.makernotes.common.exifCameraElevationAngle 39 | // RawProcessor.imgdata.makernotes.sony.SonyDateTime 40 | 41 | return image; 42 | #else 43 | PANGOLIN_UNUSED(filename); 44 | throw std::runtime_error("Rebuild Pangolin for libraw support."); 45 | #endif 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /components/pango_image/src/image_io_tga.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace pangolin { 6 | 7 | PixelFormat TgaFormat(int depth, int color_type, int color_map) 8 | { 9 | if(color_map == 0) { 10 | if(color_type == 2) { 11 | // Colour 12 | if(depth == 24) { 13 | return PixelFormatFromString("RGB24"); 14 | }else if(depth == 32) { 15 | return PixelFormatFromString("RGBA32"); 16 | } 17 | }else if(color_type == 3){ 18 | // Greyscale 19 | if(depth == 8) { 20 | return PixelFormatFromString("GRAY8"); 21 | }else if(depth == 16) { 22 | return PixelFormatFromString("Y400A"); 23 | } 24 | } 25 | } 26 | throw std::runtime_error("Unsupported TGA format"); 27 | } 28 | 29 | TypedImage LoadTga(std::istream& in) 30 | { 31 | unsigned char type[4]; 32 | unsigned char info[6]; 33 | 34 | in.read((char*)type, 3*sizeof(char)); 35 | in.seekg(12); 36 | in.read((char*)info,6*sizeof(char)); 37 | 38 | const int width = info[0] + (info[1] * 256); 39 | const int height = info[2] + (info[3] * 256); 40 | 41 | if(in.good()) { 42 | TypedImage img(width, height, TgaFormat(info[4], type[2], type[1]) ); 43 | 44 | //read in image data 45 | const size_t data_size = img.h * img.pitch; 46 | in.read((char*)img.ptr, sizeof(char)*data_size); 47 | return img; 48 | } 49 | 50 | throw std::runtime_error("Unable to load TGA file"); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /components/pango_opengl/include/pangolin/gl/compat/gl_es_compat.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define GLdouble GLfloat 6 | #define glClearDepth glClearDepthf 7 | #define glFrustum glFrustumf 8 | 9 | #define glColor4fv(a) glColor4f(a[0], a[1], a[2], a[3]) 10 | #define glColor3fv(a) glColor4f(a[0], a[1], a[2], 1.0f) 11 | #define glColor3f(a,b,c) glColor4f(a, b, c, 1.0f) 12 | 13 | #define glGenFramebuffersEXT glGenFramebuffers 14 | #define glDeleteFramebuffersEXT glDeleteFramebuffers 15 | #define glBindFramebufferEXT glBindFramebuffer 16 | #define glFramebufferTexture2DEXT glFramebufferTexture2D 17 | 18 | #define glGetDoublev glGetFloatv 19 | 20 | #include 21 | 22 | inline void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) 23 | { 24 | GLfloat verts[] = { x1,y1, x2,y1, x2,y2, x1,y2 }; 25 | glEnableClientState(GL_VERTEX_ARRAY); 26 | glVertexPointer(2, GL_FLOAT, 0, verts); 27 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); 28 | glDisableClientState(GL_VERTEX_ARRAY); 29 | } 30 | 31 | inline void glRecti(int x1, int y1, int x2, int y2) 32 | { 33 | GLfloat verts[] = { (float)x1,(float)y1, (float)x2,(float)y1, 34 | (float)x2,(float)y2, (float)x1,(float)y2 }; 35 | glEnableClientState(GL_VERTEX_ARRAY); 36 | glVertexPointer(2, GL_FLOAT, 0, verts); 37 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); 38 | glDisableClientState(GL_VERTEX_ARRAY); 39 | } 40 | -------------------------------------------------------------------------------- /components/pango_opengl/include/pangolin/gl/glinclude.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove, Richard Newcombe 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | #ifdef HAVE_GLES 33 | #include 34 | #endif 35 | 36 | #define CheckGlDieOnError() pangolin::_CheckGlDieOnError( __FILE__, __LINE__ ); 37 | namespace pangolin { 38 | inline void _CheckGlDieOnError( const char *sFile, const int nLine ) 39 | { 40 | const GLenum glError = glGetError(); 41 | if( glError != GL_NO_ERROR ) { 42 | pango_print_error( "OpenGL Error: %s (%d)\n", glErrorString(glError), glError ); 43 | pango_print_error("In: %s, line %d\n", sFile, nLine); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /components/pango_opengl/shaders/font.glsl.h: -------------------------------------------------------------------------------- 1 | uniform sampler2D u_font_atlas; 2 | uniform sampler2D u_font_offsets; 3 | 4 | const float font_height = 32.0; 5 | 6 | float screenPxRange(vec2 tex_coord) { 7 | const float pxRange = 2.0; 8 | vec2 unitRange = vec2(pxRange)/vec2(textureSize(u_font_atlas, 0)); 9 | vec2 screenTexSize = vec2(1.0)/fwidth(tex_coord); 10 | return max(0.5*dot(unitRange, screenTexSize), 1.0); 11 | } 12 | 13 | float sdf_font(vec4 atlas_offset, vec2 pos) 14 | { 15 | float atlas_dim = textureSize(u_font_atlas, 0).x; 16 | 17 | vec2 p = vec2(1,-1) * clamp2( 18 | pos/atlas_dim, vec2(0.0, 0.0), 19 | vec2(atlas_offset.z, -atlas_offset.w) 20 | ); 21 | 22 | vec2 uv = atlas_offset.xy + p; 23 | vec2 tex = vec2(uv.x, uv.y); 24 | vec3 msd = texture(u_font_atlas, tex).xyz; 25 | float sd = median(msd.r, msd.g, msd.b); 26 | return screenPxRange(tex)*(sd - 0.5); 27 | } 28 | 29 | float sdf_font(int char_id, vec2 pos ) 30 | { 31 | vec4 font_offset = texelFetch(u_font_offsets, ivec2(char_id, 0), 0); 32 | vec2 screen_offset = texelFetch(u_font_offsets, ivec2(char_id, 1), 0).xy; 33 | return sdf_font(font_offset, pos - vec2(font_height/2.0) - screen_offset*font_height); 34 | } 35 | 36 | float font_color(vec4 atlas_offset, vec2 pos ) 37 | { 38 | return clamp(sdf_font(atlas_offset, pos) + 0.5, 0.0, 1.0); 39 | } 40 | 41 | float font_color(int char_id, vec2 pos ) 42 | { 43 | return clamp(sdf_font(char_id, pos) + 0.5, 0.0, 1.0); 44 | } 45 | -------------------------------------------------------------------------------- /components/pango_opengl/shaders/main_text.glsl: -------------------------------------------------------------------------------- 1 | @start vertex 2 | #version 150 core 3 | 4 | in vec3 a_position; 5 | in uint a_char_index; 6 | out vec3 pos; 7 | out uint index; 8 | 9 | void main() { 10 | pos = a_position; 11 | index = a_char_index; 12 | } 13 | 14 | @start geometry 15 | #version 150 core 16 | layout (points) in; 17 | layout (triangle_strip, max_vertices = 4) out; 18 | 19 | uniform mat4 u_T_cm; 20 | 21 | in vec3 pos[]; 22 | in uint index[]; 23 | out vec2 v_pos; 24 | out vec2 v_win; 25 | flat out uint char_id; 26 | 27 | const bool flip_y = true; 28 | 29 | uniform float u_scale; 30 | 31 | void main() { 32 | float w = u_scale * 32.0; 33 | float h = u_scale * 32.0; 34 | 35 | float expand = 0.0; 36 | 37 | // vec2 corners[4] = vec2[]( 38 | // vec2(0.0,0.0), vec2(w,0.0), 39 | // vec2(0.0,h), vec2(w,h) 40 | // ); 41 | vec2 corners[4] = vec2[]( 42 | vec2(-expand,-expand), vec2(w+expand,-expand), 43 | vec2(-expand,h+expand), vec2(w+expand,h+expand) 44 | ); 45 | 46 | char_id = index[0]; 47 | 48 | for(uint i=0u; i < 4u; ++i) { 49 | v_win = pos[0].xy + corners[i]; 50 | v_pos = corners[i]; 51 | if(flip_y) v_pos.y = h - v_pos.y; 52 | gl_Position = u_T_cm * vec4(v_win, pos[0].z, 1.0); 53 | EmitVertex(); 54 | } 55 | 56 | EndPrimitive();} 57 | 58 | @start fragment 59 | #version 150 core 60 | #include "utils.glsl.h" 61 | #include "sdf.glsl.h" 62 | #include "font.glsl.h" 63 | 64 | in vec2 v_pos; 65 | flat in uint char_id; 66 | out vec4 FragColor; 67 | 68 | uniform float u_scale; 69 | 70 | void main() { 71 | vec2 pos = v_pos / u_scale - vec2(0,8); 72 | float sdf = sdf_font(int(char_id), pos); 73 | float opacity = clamp( sdf + 0.5, 0.0, 1.0); 74 | FragColor = vec4( vec3(0.0), opacity ); 75 | } 76 | -------------------------------------------------------------------------------- /components/pango_opengl/shaders/matcap.glsl.h: -------------------------------------------------------------------------------- 1 | uniform sampler2D u_matcap; 2 | 3 | vec3 matcap(vec3 normal) 4 | { 5 | vec2 t = (normal.xy + vec2(1.0,1.0)) / 2.0; 6 | return texture(u_matcap, t).xyz; 7 | } 8 | -------------------------------------------------------------------------------- /components/pango_opengl/shaders/noise.glsl.h: -------------------------------------------------------------------------------- 1 | vec2 grid_noise( ivec2 z ) // replace this anything that returns a random vector 2 | { 3 | // 2D to 1D (feel free to replace by some other) 4 | int n = z.x+z.y*11111; 5 | 6 | // Hugo Elias hash (feel free to replace by another one) 7 | n = (n<<13)^n; 8 | n = (n*(n*n*15731+789221)+1376312589)>>16; 9 | 10 | // Perlin style vectors 11 | n &= 7; 12 | vec2 gr = vec2(n&1,n>>1)*2.0-1.0; 13 | return ( n>=6 ) ? vec2(0.0,gr.x) : 14 | ( n>=4 ) ? vec2(gr.x,0.0) : 15 | gr; 16 | } 17 | 18 | float perlin_noise( in vec2 p ) 19 | { 20 | ivec2 i = ivec2(floor( p )); 21 | vec2 f = fract( p ); 22 | 23 | vec2 u = f*f*(3.0-2.0*f); // feel free to replace by a quintic smoothstep instead 24 | 25 | return mix( mix( dot( grid_noise( i+ivec2(0,0) ), f-vec2(0.0,0.0) ), 26 | dot( grid_noise( i+ivec2(1,0) ), f-vec2(1.0,0.0) ), u.x), 27 | mix( dot( grid_noise( i+ivec2(0,1) ), f-vec2(0.0,1.0) ), 28 | dot( grid_noise( i+ivec2(1,1) ), f-vec2(1.0,1.0) ), u.x), u.y); 29 | } 30 | -------------------------------------------------------------------------------- /components/pango_opengl/shaders/utils.glsl.h: -------------------------------------------------------------------------------- 1 | float median(float r, float g, float b) { 2 | return max(min(r, g), min(max(r, g), b)); 3 | } 4 | 5 | vec2 clamp2(vec2 v, vec2 low, vec2 high) 6 | { 7 | return vec2( 8 | clamp(v.x, low.x, high.x), 9 | clamp(v.y, low.y, high.y) 10 | ); 11 | } 12 | 13 | vec4 composite(vec4 top_layer, vec4 bottom_layer) 14 | { 15 | float alpha = top_layer.a; 16 | // return alpha * top_layer + (1.0 - alpha) * bottom_layer; 17 | return vec4(alpha * top_layer.xyz + (1.0 - alpha) * bottom_layer.xyz, max(alpha,bottom_layer.a)); 18 | } 19 | -------------------------------------------------------------------------------- /components/pango_opengl/src/compat/gl2engine.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | 30 | namespace pangolin 31 | { 32 | 33 | GlEngine& glEngine() 34 | { 35 | static GlEngine engine; 36 | return engine; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /components/pango_opengl/src/fonts/AnonymousPro.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stevenlovegrove/Pangolin/122bb3ee8b8b06761e9738e6bb747f81bfa74002/components/pango_opengl/src/fonts/AnonymousPro.ttf -------------------------------------------------------------------------------- /components/pango_opengl/src/gldraw.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove, Richard Newcombe 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | 29 | #include 30 | #include 31 | 32 | namespace pangolin 33 | { 34 | 35 | void glRecordGraphic(float x, float y, float radius) 36 | { 37 | const int ticks = static_cast(TimeNow_s()); 38 | if( ticks % 2 ) 39 | { 40 | // now, render a little red "recording" dot 41 | #ifndef HAVE_GLES 42 | glPushAttrib(GL_ENABLE_BIT); 43 | #endif 44 | glDisable(GL_LIGHTING); 45 | glDisable(GL_DEPTH_TEST); 46 | glColor3f( 1.0f, 0.0f, 0.0f ); 47 | glDrawCircle( x, y, radius ); 48 | #ifndef HAVE_GLES 49 | glPopAttrib(); 50 | #endif 51 | } 52 | 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /components/pango_opengl/src/gltexturecache.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | 30 | namespace pangolin 31 | { 32 | 33 | TextureCache& TextureCache::I() { 34 | static TextureCache instance; 35 | return instance; 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /components/pango_packetstream/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(COMPONENT ${CMAKE_CURRENT_LIST_DIR} NAME) 2 | 3 | target_sources( ${COMPONENT} 4 | PRIVATE 5 | ${CMAKE_CURRENT_LIST_DIR}/src/packet.cpp 6 | ${CMAKE_CURRENT_LIST_DIR}/src/packetstream.cpp 7 | ${CMAKE_CURRENT_LIST_DIR}/src/packetstream_reader.cpp 8 | ${CMAKE_CURRENT_LIST_DIR}/src/packetstream_writer.cpp 9 | ${CMAKE_CURRENT_LIST_DIR}/src/playback_session.cpp 10 | ) 11 | 12 | set_target_properties( 13 | ${COMPONENT} PROPERTIES VERSION ${PANGOLIN_VERSION} SOVERSION ${PANGOLIN_VERSION_MAJOR} 14 | ) 15 | 16 | target_compile_definitions(${COMPONENT} PRIVATE "PANGOLIN_VERSION_STRING=\"${PANGOLIN_VERSION}\"") 17 | target_link_libraries(${COMPONENT} PUBLIC pango_core) 18 | target_include_directories(${COMPONENT} PUBLIC 19 | $ 20 | $ 21 | ) 22 | install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include" 23 | DESTINATION ${CMAKE_INSTALL_PREFIX} 24 | ) 25 | -------------------------------------------------------------------------------- /components/pango_packetstream/include/pangolin/log/packetstream_source.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace pangolin { 8 | 9 | using PacketStreamSourceId = size_t; 10 | 11 | struct PANGOLIN_EXPORT PacketStreamSource 12 | { 13 | struct PacketInfo 14 | { 15 | std::streampos pos; 16 | int64_t capture_time; 17 | }; 18 | 19 | PacketStreamSource() 20 | : id(static_cast(-1)), 21 | version(0), 22 | data_alignment_bytes(1), 23 | data_size_bytes(0), 24 | next_packet_id(0) 25 | { 26 | } 27 | 28 | std::streampos FindSeekLocation(size_t packet_id) 29 | { 30 | if(packet_id < index.size()) { 31 | return index[packet_id].pos; 32 | }else{ 33 | return std::streampos(-1); 34 | } 35 | 36 | } 37 | 38 | int64_t NextPacketTime() const 39 | { 40 | if(next_packet_id < index.size()) { 41 | return index[next_packet_id].capture_time; 42 | }else{ 43 | return 0; 44 | } 45 | } 46 | 47 | std::string driver; 48 | size_t id; 49 | std::string uri; 50 | picojson::value info; 51 | int64_t version; 52 | int64_t data_alignment_bytes; 53 | std::string data_definitions; 54 | int64_t data_size_bytes; 55 | 56 | // Index keyed by packet_id 57 | std::vector index; 58 | 59 | // Based on current position in stream 60 | size_t next_packet_id; 61 | }; 62 | 63 | } 64 | -------------------------------------------------------------------------------- /components/pango_packetstream/include/pangolin/log/packetstream_tags.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace pangolin { 8 | 9 | using PangoTagType = uint32_t; 10 | 11 | const static std::string PANGO_MAGIC = "PANGO"; 12 | 13 | const static std::string pss_src_driver = "driver"; 14 | const static std::string pss_src_id = "id"; 15 | const static std::string pss_src_info = "info"; 16 | const static std::string pss_src_uri = "uri"; 17 | const static std::string pss_src_packet = "packet"; 18 | const static std::string pss_src_version = "version"; 19 | const static std::string pss_pkt_alignment_bytes = "alignment_bytes"; 20 | const static std::string pss_pkt_definitions = "definitions"; 21 | const static std::string pss_pkt_size_bytes = "size_bytes"; 22 | const static std::string pss_pkt_format_written = "format_written"; 23 | 24 | const unsigned int TAG_LENGTH = 3; 25 | 26 | #define PANGO_TAG(a,b,c) ( (c<<16) | (b<<8) | a) 27 | const PangoTagType TAG_PANGO_HDR = PANGO_TAG('L', 'I', 'N'); 28 | const PangoTagType TAG_PANGO_MAGIC = PANGO_TAG('P', 'A', 'N'); 29 | const PangoTagType TAG_PANGO_SYNC = PANGO_TAG('S', 'Y', 'N'); 30 | const PangoTagType TAG_PANGO_STATS = PANGO_TAG('S', 'T', 'A'); 31 | const PangoTagType TAG_PANGO_FOOTER = PANGO_TAG('F', 'T', 'R'); 32 | const PangoTagType TAG_ADD_SOURCE = PANGO_TAG('S', 'R', 'C'); 33 | const PangoTagType TAG_SRC_JSON = PANGO_TAG('J', 'S', 'N'); 34 | const PangoTagType TAG_SRC_PACKET = PANGO_TAG('P', 'K', 'T'); 35 | const PangoTagType TAG_END = PANGO_TAG('E', 'N', 'D'); 36 | #undef PANGO_TAG 37 | 38 | inline std::string tagName(int v) 39 | { 40 | char b[4]; 41 | b[0] = v&0xff; 42 | b[1] = (v>>8)&0xff; 43 | b[2] = (v>>16)&0xff; 44 | b[3] = 0x00; 45 | return std::string(b); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /components/pango_packetstream/include/pangolin/log/playback_session.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace pangolin { 11 | 12 | struct Params; 13 | 14 | class PlaybackSession 15 | { 16 | public: 17 | // Singleton Instance 18 | static std::shared_ptr Default(); 19 | 20 | // Return thread-safe, shared instance of PacketStreamReader, providing 21 | // serialised read for PacketStreamReader 22 | std::shared_ptr Open(const std::string& filename) 23 | { 24 | const std::string path = SanitizePath(PathExpand(filename)); 25 | 26 | auto i = readers.find(path); 27 | if(i == readers.end()) { 28 | auto psr = std::make_shared(path); 29 | readers[path] = psr; 30 | return psr; 31 | }else{ 32 | return i->second; 33 | } 34 | } 35 | 36 | // Should only be called if there's no playbacks 37 | // in flight 38 | void Clear() { 39 | readers.clear(); 40 | time.Reset(); 41 | } 42 | 43 | SyncTime& Time() 44 | { 45 | return time; 46 | } 47 | static std::shared_ptr ChooseFromParams(const ParamReader& reader); 48 | static std::shared_ptr ChooseFromParams(const Params& params); 49 | private: 50 | static std::shared_ptr Choose(bool ordered_playback); 51 | std::map> readers; 52 | SyncTime time; 53 | }; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /components/pango_packetstream/src/playback_session.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace pangolin { 4 | 5 | std::shared_ptr PlaybackSession::Default() 6 | { 7 | static std::shared_ptr instance = std::make_shared(); 8 | return instance; 9 | } 10 | 11 | std::shared_ptr PlaybackSession::ChooseFromParams(const ParamReader& reader) 12 | { 13 | return Choose(reader.Get("OrderedPlayback")); 14 | } 15 | 16 | std::shared_ptr PlaybackSession::ChooseFromParams(const Params& params) 17 | { 18 | return Choose(params.Get("OrderedPlayback", false)); 19 | } 20 | 21 | std::shared_ptr PlaybackSession::Choose(bool use_ordered_playback) 22 | { 23 | if(use_ordered_playback) 24 | { 25 | return Default(); 26 | } 27 | else 28 | { 29 | return std::make_shared(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /components/pango_plot/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(COMPONENT ${CMAKE_CURRENT_LIST_DIR} NAME) 2 | 3 | target_sources( ${COMPONENT} 4 | PRIVATE 5 | ${CMAKE_CURRENT_LIST_DIR}/src/datalog.cpp 6 | ${CMAKE_CURRENT_LIST_DIR}/src/plotter.cpp 7 | ${CMAKE_CURRENT_LIST_DIR}/src/loaders/csv_table_loader.cpp 8 | ) 9 | 10 | set_target_properties( 11 | ${COMPONENT} PROPERTIES VERSION ${PANGOLIN_VERSION} SOVERSION ${PANGOLIN_VERSION_MAJOR} 12 | ) 13 | 14 | target_link_libraries(${COMPONENT} pango_display) 15 | target_include_directories(${COMPONENT} PUBLIC 16 | $ 17 | $ 18 | ) 19 | install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include" 20 | DESTINATION ${CMAKE_INSTALL_PREFIX} 21 | ) 22 | -------------------------------------------------------------------------------- /components/pango_plot/include/pangolin/plot/loaders/csv_table_loader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "table_loader.h" 6 | 7 | namespace pangolin { 8 | 9 | class CsvTableLoader : public TableLoaderInterface 10 | { 11 | public: 12 | /// Construct to read from the set of files \param csv_files such that 13 | /// each row consists of the columns of each file in the provided order 14 | /// 15 | /// \param csv_files a list of CSV files to read from 16 | /// \param delim the field delimiter between columns, normally ',' for CSV 17 | CsvTableLoader(const std::vector& csv_files, char delim = ',', char comment = '#'); 18 | 19 | bool SkipLines(const std::vector& lines_per_input); 20 | 21 | bool ReadRow(std::vector& row) override; 22 | 23 | private: 24 | static bool AppendColumns(std::vector& cols, std::istream& s, char delim, char comment); 25 | 26 | char delim; 27 | char comment; 28 | std::vector streams; 29 | std::vector> owned_streams; 30 | }; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /components/pango_plot/include/pangolin/plot/loaders/table_loader.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | namespace pangolin { 6 | 7 | struct TableLoaderInterface 8 | { 9 | virtual bool ReadRow(std::vector& row) = 0; 10 | }; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/attach.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_attach(pybind11::module &m); 35 | 36 | } // py_pangolin 37 | 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/colour.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_colour(pybind11::module& m); 35 | 36 | } // py_pangolin 37 | 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/datalog.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_datalog(pybind11::module& m); 35 | 36 | } // py_pangolin 37 | 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/display.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_display(pybind11::module &m); 35 | 36 | } // py_pangolin 37 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/gl.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_gl(pybind11::module &m); 35 | 36 | } // py_pangolin 37 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/gl_draw.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_gl_draw(pybind11::module &m); 35 | 36 | } // py_pangolin 37 | 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/glfont.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include "glfont.hpp" 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | namespace py_pangolin { 35 | 36 | void bind_glfont(pybind11::module &m){ 37 | 38 | pybind11::class_ glFontClass(m, "GlFont"); 39 | glFontClass.def(pybind11::init()) 40 | .def("Text", (pangolin::GlText (pangolin::GlFont::*)(const std::string&))&pangolin::GlFont::Text) 41 | .def("Height", &pangolin::GlFont::Height) 42 | .def("MaxWidth", &pangolin::GlFont::MaxWidth) 43 | .def_static("DefaultFont", &pangolin::default_font, pybind11::return_value_policy::reference); 44 | } 45 | 46 | 47 | } // py_pangolin 48 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/glfont.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_glfont(pybind11::module &m); 35 | 36 | } // py_pangolin 37 | 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/glsl.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_glsl(pybind11::module &m); 35 | 36 | } // py_pangolin 37 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/gltext.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_gltext(pybind11::module &m); 35 | 36 | 37 | } // py_pangolin 38 | 39 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/glvbo.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_glvbo(pybind11::module &m); 35 | 36 | } // py_pangolin 37 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/image.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include "image.hpp" 29 | #include 30 | 31 | namespace py_pangolin { 32 | 33 | } // py_pangolin 34 | 35 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/image_view.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | 33 | namespace py_pangolin{ 34 | 35 | void bind_image_view(pybind11::module &m); 36 | 37 | } // py_pangolin 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/opengl_render_state.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_opengl_render_state(pybind11::module &m); 35 | 36 | } // py_pangolin 37 | 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/params.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include "params.hpp" 29 | #include 30 | 31 | namespace py_pangolin { 32 | 33 | void bind_params(pybind11::module &m) { 34 | pybind11::class_(m, "Params") 35 | .def(pybind11::init<>()) 36 | .def("Contains", &pangolin::Params::Contains) 37 | .def("Set", &pangolin::Params::Set) 38 | .def("Get", &pangolin::Params::Get) 39 | .def("Set", &pangolin::Params::Set) 40 | .def("Get", &pangolin::Params::Get); 41 | } 42 | 43 | } // py_pangolin 44 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/params.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_params(pybind11::module &m); 35 | 36 | } // py_pangolin 37 | 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/pixel_format.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include "pixel_format.hpp" 29 | #include 30 | 31 | namespace py_pangolin { 32 | 33 | void bind_pixel_format(pybind11::module& m){ 34 | pybind11::class_(m, "PixelFormat") 35 | .def_readwrite("format", &pangolin::PixelFormat::format) 36 | .def_readwrite("channels", &pangolin::PixelFormat::channels) 37 | // .def_readwrite("channel_bits", &pangolin::PixelFormat::channel_bits) //channel_bits[4] 38 | .def_readwrite("bpp", &pangolin::PixelFormat::bpp) 39 | .def_readwrite("planar", &pangolin::PixelFormat::planar); 40 | 41 | m.def("PixelFormatFromString", &pangolin::PixelFormatFromString); 42 | } 43 | } // py_pangolin 44 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/pixel_format.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_pixel_format(pybind11::module& m); 35 | 36 | } // py_pangolin 37 | 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/plotter.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_plotter(pybind11::module& m); 35 | 36 | } // py_pangolin 37 | 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/pypangoio.cpp: -------------------------------------------------------------------------------- 1 | #include "pypangoio.h" 2 | 3 | namespace py_pangolin 4 | { 5 | 6 | PyPangoIO::PyPangoIO(std::queue& line_queue, InterpreterLineType line_type) 7 | : line_queue(line_queue), line_type(line_type) 8 | { 9 | } 10 | 11 | void PyPangoIO::write(const std::string& text) 12 | { 13 | buffer += text; 14 | size_t nl = buffer.find_first_of('\n'); 15 | while(nl != std::string::npos) { 16 | const std::string line = buffer.substr(0,nl); 17 | line_queue.push(InterpreterLine(line,line_type)); 18 | buffer = buffer.substr(nl+1); 19 | nl = buffer.find_first_of('\n'); 20 | } 21 | } 22 | 23 | void PyPangoIO::flush() 24 | { 25 | // Do nothing 26 | } 27 | 28 | void bind_pango_write_object(pybind11::module& m) 29 | { 30 | pybind11::class_(m, "PyPangoIO") 31 | .def("write", &PyPangoIO::write) 32 | .def("flush", &PyPangoIO::flush); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/pypangoio.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | namespace py_pangolin 38 | { 39 | 40 | using namespace pangolin; 41 | 42 | void bind_pango_write_object(pybind11::module& m); 43 | 44 | struct PyPangoIO { 45 | PyPangoIO(std::queue& line_queue, InterpreterLineType line_type); 46 | 47 | void write(const std::string& text); 48 | 49 | void flush(); 50 | 51 | std::string buffer; 52 | std::queue& line_queue; 53 | InterpreterLineType line_type; 54 | }; 55 | 56 | 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/video.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_video(pybind11::module& m); 35 | 36 | } // py_pangolin 37 | 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/view.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_view(pybind11::module &m); 35 | 36 | } // py_pangolin 37 | 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/viewport.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | 33 | namespace py_pangolin{ 34 | 35 | void bind_viewport(pybind11::module &m); 36 | 37 | } // py_pangolin 38 | 39 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/widget.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include "widget.hpp" 29 | #include 30 | 31 | namespace py_pangolin { 32 | 33 | void bind_widget(pybind11::module &m){ 34 | m.def("CreatePanel", &pangolin::CreatePanel, pybind11::return_value_policy::reference); 35 | } 36 | } // py_pangolin 37 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/widget.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_widget(pybind11::module &m); 35 | 36 | } // py_pangolin 37 | 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin/window.hpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Andrey Mnatsakanov 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | namespace py_pangolin { 33 | 34 | void bind_window(pybind11::module &m); 35 | 36 | } // py_pangolin 37 | 38 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin_embed.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include "pypangolin/pypangolin.h" 29 | 30 | PYBIND11_EMBEDDED_MODULE(pypangolin, m) { 31 | pypangolin::PopulateModule(m); 32 | } 33 | -------------------------------------------------------------------------------- /components/pango_python/src/pypangolin_module.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include "pypangolin/pypangolin.h" 29 | 30 | PYBIND11_MODULE(pypangolin, m) { 31 | pypangolin::PopulateModule(m); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /components/pango_scene/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(COMPONENT ${CMAKE_CURRENT_LIST_DIR} NAME) 2 | 3 | target_sources( ${COMPONENT} 4 | PRIVATE 5 | ${CMAKE_CURRENT_LIST_DIR}/src/renderable.cpp 6 | ) 7 | 8 | set_target_properties( 9 | ${COMPONENT} PROPERTIES VERSION ${PANGOLIN_VERSION} SOVERSION ${PANGOLIN_VERSION_MAJOR} 10 | ) 11 | 12 | target_link_libraries(${COMPONENT} PUBLIC pango_opengl) 13 | target_include_directories(${COMPONENT} PUBLIC 14 | $ 15 | $ 16 | ) 17 | install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include" 18 | DESTINATION ${CMAKE_INSTALL_PREFIX} 19 | ) 20 | -------------------------------------------------------------------------------- /components/pango_scene/include/pangolin/scene/tree.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace pangolin { 7 | 8 | template 9 | struct TreeNode 10 | { 11 | struct Edge 12 | { 13 | TEdge parent_child; 14 | TreeNode node; 15 | }; 16 | 17 | T item; 18 | std::vector edges; 19 | }; 20 | 21 | template 22 | using NodeFunction = std::function&,const TEdge&)>; 23 | 24 | //template 25 | //void VisitDepthFirst(TreeNode& node, const NodeFunction& func, const TEdge& T_root_node = TEdge()) 26 | //{ 27 | // func(node, T_root_node); 28 | // for(auto& e : node.edges) { 29 | // const TEdge T_root_child = T_root_node * e.parent_child; 30 | // VisitDepthFirst(e.node, func, T_root_child); 31 | // } 32 | //} 33 | 34 | //void Eg() 35 | //{ 36 | // using RenderNode = TreeNode,OpenGlMatrix>; 37 | 38 | // RenderNode root; 39 | // VisitDepthFirst,OpenGlMatrix>( 40 | // root, [](RenderNode& node, const OpenGlMatrix& T_root_node) { 41 | // if(node.item) { 42 | // node.item->DoRender(); 43 | // } 44 | // }, IdentityMatrix()); 45 | 46 | //} 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /components/pango_scene/src/renderable.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace pangolin { 4 | 5 | 6 | Renderable::guid_t Renderable::UniqueGuid() 7 | { 8 | static std::random_device rd; 9 | static std::mt19937 gen(rd()); 10 | return (guid_t)gen(); 11 | } 12 | 13 | Renderable::Renderable(const std::weak_ptr& parent) 14 | : guid(UniqueGuid()), parent(parent), T_pc(IdentityMatrix()), should_show(true) 15 | { 16 | } 17 | 18 | Renderable::~Renderable() 19 | { 20 | } 21 | 22 | // Default implementation simply renders children. 23 | void Renderable::Render(const RenderParams& params) { 24 | RenderChildren(params); 25 | } 26 | 27 | void Renderable::RenderChildren(const RenderParams& params) 28 | { 29 | for(auto& p : children) { 30 | Renderable& r = *p.second; 31 | if(r.should_show) { 32 | glPushMatrix(); 33 | r.T_pc.Multiply(); 34 | r.Render(params); 35 | if(r.manipulator) { 36 | r.manipulator->Render(params); 37 | } 38 | glPopMatrix(); 39 | } 40 | } 41 | } 42 | 43 | std::shared_ptr Renderable::FindChild(guid_t guid) 44 | { 45 | auto o = children.find(guid); 46 | if(o != children.end()) { 47 | return o->second; 48 | } 49 | 50 | for(auto& kv : children ) { 51 | std::shared_ptr c = kv.second->FindChild(guid); 52 | if(c) return c; 53 | } 54 | 55 | return std::shared_ptr(); 56 | } 57 | 58 | Renderable& Renderable::Add(const std::shared_ptr& child) 59 | { 60 | if(child) { 61 | children[child->guid] = child; 62 | }; 63 | return *this; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /components/pango_tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(COMPONENT ${CMAKE_CURRENT_LIST_DIR} NAME) 2 | 3 | target_sources( ${COMPONENT} 4 | PRIVATE 5 | ${CMAKE_CURRENT_LIST_DIR}/src/video_viewer.cpp 6 | ) 7 | 8 | set_target_properties( 9 | ${COMPONENT} PROPERTIES VERSION ${PANGOLIN_VERSION} SOVERSION ${PANGOLIN_VERSION_MAJOR} 10 | ) 11 | 12 | target_link_libraries(${COMPONENT} PUBLIC pango_display pango_video) 13 | target_include_directories(${COMPONENT} PUBLIC 14 | $ 15 | $ 16 | ) 17 | install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include" 18 | DESTINATION ${CMAKE_INSTALL_PREFIX} 19 | ) 20 | -------------------------------------------------------------------------------- /components/pango_vars/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | get_filename_component(COMPONENT ${CMAKE_CURRENT_LIST_DIR} NAME) 2 | 3 | target_sources( ${COMPONENT} 4 | PRIVATE 5 | ${CMAKE_CURRENT_LIST_DIR}/src/vars.cpp 6 | ${CMAKE_CURRENT_LIST_DIR}/src/varstate.cpp 7 | ) 8 | 9 | set_target_properties( 10 | ${COMPONENT} PROPERTIES VERSION ${PANGOLIN_VERSION} SOVERSION ${PANGOLIN_VERSION_MAJOR} 11 | ) 12 | 13 | target_link_libraries(${COMPONENT} PUBLIC pango_core) 14 | target_include_directories(${COMPONENT} PUBLIC 15 | $ 16 | $ 17 | ) 18 | install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include" 19 | DESTINATION ${CMAKE_INSTALL_PREFIX} 20 | ) 21 | 22 | if(BUILD_TESTS) 23 | add_executable(test_vars ${CMAKE_CURRENT_LIST_DIR}/tests/test_all.cpp) 24 | target_link_libraries(test_vars PRIVATE Catch2::Catch2WithMain ${COMPONENT}) 25 | catch_discover_tests(test_vars) 26 | endif() 27 | -------------------------------------------------------------------------------- /components/pango_vars/include/pangolin/var/varvaluet.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | #include 32 | 33 | namespace pangolin 34 | { 35 | 36 | template 37 | class VarValueT : public VarValueGeneric 38 | { 39 | public: 40 | typedef typename std::remove_reference::type VarT; 41 | 42 | virtual const VarT& Get() const = 0; 43 | virtual void Set(const VarT& val) = 0; 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /components/pango_vars/src/vars.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | using namespace std; 38 | 39 | namespace pangolin 40 | { 41 | 42 | void ParseVarsFile(const string& filename) 43 | { 44 | VarState::I().LoadFromFile(filename, VarState::FileKind::config); 45 | } 46 | 47 | void LoadJsonFile(const std::string& filename) 48 | { 49 | VarState::I().LoadFromFile(filename, VarState::FileKind::json); 50 | } 51 | 52 | void SaveJsonFile(const std::string& filename) 53 | { 54 | VarState::I().SaveToFile(filename, VarState::FileKind::json); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /components/pango_video/include/pangolin/video/drivers/shared_memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | namespace pangolin 11 | { 12 | 13 | class SharedMemoryVideo : public VideoInterface 14 | { 15 | public: 16 | SharedMemoryVideo(size_t w, size_t h, std::string pix_fmt, 17 | const std::shared_ptr& shared_memory, 18 | const std::shared_ptr& buffer_full); 19 | ~SharedMemoryVideo(); 20 | 21 | size_t SizeBytes() const; 22 | const std::vector& Streams() const; 23 | void Start(); 24 | void Stop(); 25 | bool GrabNext(unsigned char *image, bool wait); 26 | bool GrabNewest(unsigned char *image, bool wait); 27 | 28 | private: 29 | PixelFormat _fmt; 30 | size_t _frame_size; 31 | std::vector _streams; 32 | std::shared_ptr _shared_memory; 33 | std::shared_ptr _buffer_full; 34 | }; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /components/pango_video/include/pangolin/video/stream_encoder_factory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace pangolin { 8 | 9 | using ImageEncoderFunc = std::function&)>; 10 | using ImageDecoderFunc = std::function; 11 | 12 | class StreamEncoderFactory 13 | { 14 | public: 15 | static StreamEncoderFactory& I(); 16 | 17 | ImageEncoderFunc GetEncoder(const std::string& encoder_spec, const PixelFormat& fmt); 18 | 19 | ImageDecoderFunc GetDecoder(const std::string& encoder_spec, const PixelFormat& fmt); 20 | }; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /components/pango_video/include/pangolin/video/video_exception.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace pangolin { 8 | 9 | struct PANGOLIN_EXPORT VideoException : std::exception 10 | { 11 | VideoException(std::string str) : desc(str) {} 12 | VideoException(std::string str, std::string detail) { 13 | desc = str + "\n\t" + detail; 14 | } 15 | ~VideoException() throw() {} 16 | const char* what() const throw() { return desc.c_str(); } 17 | std::string desc; 18 | }; 19 | 20 | struct PANGOLIN_EXPORT VideoExceptionNoKnownHandler : public VideoException 21 | { 22 | VideoExceptionNoKnownHandler(const std::string& scheme) 23 | : VideoException("No known video handler for URI '" + scheme + "'") 24 | { 25 | } 26 | }; 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /components/pango_video/include/pangolin/video/video_help.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace pangolin { 7 | 8 | /// Print to \p out supported pixel format codes 9 | /// \p color whether ANSI Color codes should be used for formatting 10 | void PrintPixelFormats(std::ostream& out = std::cout, bool color = true); 11 | 12 | /// Print to \p out general Video URL usage and registered VideoFactories 13 | /// \p out the stream to stream the help message to 14 | /// \p scheme_filter a constraint on schemes to print, or empty if all should be listed 15 | /// \p level the level of detail to use when printing (see enum above) 16 | void VideoHelp( 17 | std::ostream& out = std::cout, const std::string& scheme_filter="", 18 | HelpVerbosity verbosity = HelpVerbosity::SYNOPSIS 19 | ); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /components/pango_video/include/pangolin/video/video_record_repeat.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | // VideoInput subsumes the previous VideoRecordRepeat class. 31 | #include 32 | -------------------------------------------------------------------------------- /components/pango_video/src/video_help.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | namespace pangolin 8 | { 9 | 10 | void PrintPixelFormats(std::ostream& out, bool color) 11 | { 12 | const std::string c_normal = color ? "\033[0m" : ""; 13 | const std::string c_alias = color ? "\033[32m" : ""; 14 | 15 | out << "Supported pixel format codes (and their respective bits-per-pixel):" << std::endl; 16 | std::vector pixelFormats = pangolin::GetSupportedPixelFormats(); 17 | for(const auto& format: pixelFormats ){ 18 | out << c_alias << format.format << c_normal << " (" << format.bpp << "), "; 19 | } 20 | out << std::endl; 21 | } 22 | 23 | void VideoHelp( std::ostream& out, const std::string& scheme_filter, HelpVerbosity verbosity) 24 | { 25 | RegisterFactoriesVideoInterface(); 26 | 27 | #ifndef _WIN32_ 28 | const bool use_color = true; 29 | #else 30 | const bool use_color = false; 31 | #endif 32 | 33 | if( verbosity >= HelpVerbosity::SYNOPSIS ) { 34 | PrintSchemeHelp(out, use_color); 35 | out << std::endl; 36 | } 37 | 38 | PrintFactoryRegistryDetails(out, *FactoryRegistry::I(), typeid(VideoInterface), scheme_filter, verbosity, use_color); 39 | 40 | if( verbosity >= HelpVerbosity::PARAMS ) { 41 | PrintPixelFormats(out, use_color); 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /components/pango_video/tests/tests_video_loading.cpp: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_MAIN 2 | #if __has_include() 3 | #include 4 | #else 5 | #include 6 | #endif 7 | 8 | #include 9 | #include 10 | 11 | TEST_CASE( "Loading built in video driver" ) { 12 | // If this throws, we've probably messed up the factory loading stuff again... 13 | auto video = pangolin::OpenVideo("test:[size=123x345,n=1,fmt=RGB24]//"); 14 | 15 | REQUIRE(video.get()); 16 | REQUIRE(video->SizeBytes() == 123*345*3); 17 | REQUIRE(video->Streams().size() == 1); 18 | REQUIRE(video->Streams()[0].PixFormat().format == "RGB24"); 19 | REQUIRE(video->Streams()[0].Width() == 123); 20 | REQUIRE(video->Streams()[0].Height() == 345); 21 | 22 | std::unique_ptr image(new unsigned char[video->SizeBytes()]); 23 | const bool success = video->GrabNext(image.get()); 24 | REQUIRE(success); 25 | } 26 | 27 | TEST_CASE( "Error when providing the wrong arguments" ) 28 | { 29 | REQUIRE_THROWS_AS(pangolin::OpenVideo("test:[width=123,height=345,n=3,fmt=RGB24]//"), pangolin::FactoryRegistry::ParameterMismatchException); 30 | } 31 | -------------------------------------------------------------------------------- /components/pango_windowing/include/pangolin/windowing/PangolinNSGLView.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #import 31 | #import 32 | #include 33 | 34 | //////////////////////////////////////////////////////////////////// 35 | // PangolinNSGLView 36 | //////////////////////////////////////////////////////////////////// 37 | 38 | @interface PangolinNSGLView : NSOpenGLView 39 | { 40 | float backing_scale; 41 | @public pangolin::WindowInterface* osx_window; 42 | } 43 | @end 44 | 45 | -------------------------------------------------------------------------------- /components/pango_windowing/include/pangolin/windowing/handler_bitsets.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | #include 32 | 33 | namespace pangolin 34 | { 35 | 36 | using MouseButtonBitmask = bitmask; 37 | 38 | using KeyModifierBitmask = bitmask; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /components/pango_windowing/src/window.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | namespace pangolin 6 | { 7 | 8 | std::unique_ptr ConstructWindow(const Uri& uri) 9 | { 10 | RegisterFactoriesWindowInterface(); 11 | return FactoryRegistry::I()->Construct(uri); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /components/tinyobj/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(COMPONENT tinyobj) 2 | 3 | target_sources( ${COMPONENT} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/src/tinyobj.cpp") 4 | 5 | set_target_properties( 6 | ${COMPONENT} PROPERTIES VERSION ${PANGOLIN_VERSION} SOVERSION ${PANGOLIN_VERSION_MAJOR} 7 | ) 8 | 9 | set_property(TARGET ${COMPONENT} PROPERTY CXX_STANDARD 11) 10 | target_include_directories(${COMPONENT} PUBLIC 11 | $ 12 | $ 13 | ) 14 | install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include" 15 | DESTINATION ${CMAKE_INSTALL_PREFIX} 16 | ) 17 | -------------------------------------------------------------------------------- /components/tinyobj/src/tinyobj.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #define TINYOBJLOADER_IMPLEMENTATION 29 | #include 30 | -------------------------------------------------------------------------------- /examples/BasicOpenGL/1_gl_intro_pango_triangle.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void sample() 6 | { 7 | // Create a 500x500 pixel application window with an OpenGL Context 8 | // By default the window is double buffered if available. 9 | // Load any available OpenGL Extensions (through GLEW) 10 | pangolin::CreateWindowAndBind("Pango GL Triangle", 500, 500); 11 | 12 | // List coordinates of a triangle 13 | // These vertices will be relative to the coordinates of the window 14 | // which default in OpenGL to +/- 1.0 in X and Y (first two vertex ordinates) 15 | std::vector vertices = { 16 | {-0.5f, -0.5f, 0.0f}, 17 | {0.5f, -0.5f, 0.0f }, 18 | {0.0f, 0.5f, 0.0f } 19 | }; 20 | 21 | // We want the background to be purple 22 | glClearColor(0.64f, 0.5f, 0.81f, 0.0f); 23 | 24 | // We want our triangle to be a pleasant shade of blue! 25 | glColor3f(0.29f, 0.71f, 1.0f); 26 | 27 | // We keep rendering in a loop so that the triangle will keep showing 28 | // and get adjusted as the window is resized. Press Escape or close the 29 | // window to exit the Pangolin loop. 30 | while( !pangolin::ShouldQuit() ) 31 | { 32 | // Clear the window 33 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 34 | 35 | // Connect the first 3 vertices to form a triangle! 36 | pangolin::glDrawVertices(vertices, GL_TRIANGLES); 37 | 38 | // Process any windowing events and swap the back and front 39 | // OpenGL buffers if available. 40 | pangolin::FinishFrame(); 41 | } 42 | } 43 | 44 | int main( int /*argc*/, char** /*argv*/ ) 45 | { 46 | sample(); 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /examples/BasicOpenGL/2_gl_intro_classic_triangle_vbo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Here is an example of Pangolin being used *just* for windowing. 4 | // We're using 5 | void sample() 6 | { 7 | pangolin::CreateWindowAndBind("Classic GL Triangle with VBO", 500, 500); 8 | 9 | // List coordinates of a triangle 10 | const float vertices[] = { 11 | -0.5f, -0.5f, 0.0f, 12 | 0.5f, -0.5f, 0.0f, 13 | 0.0f, 0.5f, 0.0f 14 | }; 15 | 16 | // Create an OpenGL Buffer to store these coordinates 17 | unsigned int VBO; 18 | glGenBuffers(1, &VBO); 19 | 20 | // Set that buffer as the current GL buffer 21 | glBindBuffer(GL_ARRAY_BUFFER, VBO); 22 | 23 | // Copy our host data into the currently bound OpenGL buffer 24 | // GL_STATIC_DRAW is a hint about how we'll use the buffer 25 | glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); 26 | 27 | glClearColor(0.64f, 0.5f, 0.81f, 0.0f); 28 | glColor3f(0.29f, 0.71f, 1.0f); 29 | 30 | while( !pangolin::ShouldQuit() ) 31 | { 32 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 33 | 34 | // Set our buffer as the current one for OpenGL 35 | glBindBuffer(GL_ARRAY_BUFFER, VBO); 36 | 37 | // This buffer contains floating point vertices with 3 dimensions. 38 | // They starts from the 0th element and are packed without padding. 39 | glVertexPointer(3, GL_FLOAT, 0, 0); 40 | 41 | // Use Them! 42 | glEnableClientState(GL_VERTEX_ARRAY); 43 | 44 | // Connect the first 3 of these vertices to form a triangle! 45 | glDrawArrays(GL_TRIANGLES, 0, 3); 46 | 47 | // Disable the stuff we enabled... 48 | glDisableClientState(GL_VERTEX_ARRAY); 49 | glBindBuffer(GL_ARRAY_BUFFER, 0); 50 | 51 | pangolin::FinishFrame(); 52 | } 53 | 54 | // Deallocate the OpenGL buffer we made 55 | glDeleteBuffers(1, &VBO); 56 | } 57 | 58 | int main( int /*argc*/, char** /*argv*/ ) 59 | { 60 | sample(); 61 | return 0; 62 | } 63 | -------------------------------------------------------------------------------- /examples/BasicOpenGL/2_gl_intro_pango_triangle_vbo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void sample() 5 | { 6 | pangolin::CreateWindowAndBind("Pango GL Triangle with VBO", 500, 500); 7 | 8 | // Create an OpenGL Buffer containing the vertices of a triangle 9 | pangolin::GlBuffer vbo(pangolin::GlArrayBuffer, 10 | std::vector{ 11 | {-0.5f, -0.5f, 0.0f}, 12 | { 0.5f, -0.5f, 0.0f }, 13 | { 0.0f, 0.5f, 0.0f } 14 | } 15 | ); 16 | 17 | glClearColor(0.64f, 0.5f, 0.81f, 0.0f); 18 | glColor3f(0.29f, 0.71f, 1.0f); 19 | 20 | while( !pangolin::ShouldQuit() ) 21 | { 22 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 23 | 24 | // Connect the first 3 vertices in the GL Buffer to form a triangle! 25 | pangolin::RenderVbo(vbo, GL_TRIANGLES); 26 | 27 | pangolin::FinishFrame(); 28 | } 29 | } 30 | 31 | int main( int /*argc*/, char** /*argv*/ ) 32 | { 33 | sample(); 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /examples/BasicOpenGL/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.8 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | set(sample_srcs 6 | 1_gl_intro_classic_triangle.cpp 7 | 1_gl_intro_pango_triangle.cpp 8 | 2_gl_intro_classic_triangle_vbo.cpp 9 | 2_gl_intro_pango_triangle_vbo.cpp 10 | 3_gl_intro_classic_triangle_vbo_shader.cpp 11 | 3_gl_intro_pango_triangle_vbo_shader.cpp 12 | 4_gl_intro_viewport.cpp 13 | 5_gl_intro_view_transforms.cpp 14 | ) 15 | 16 | foreach( sample_src ${sample_srcs}) 17 | get_filename_component(sample_name ${sample_src} NAME_WE) 18 | set(target_name "tutorial_${sample_name}") 19 | add_executable(${target_name} ${sample_src}) 20 | target_link_libraries(${target_name} pango_display) 21 | endforeach() 22 | 23 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(BasicOpenGL) 2 | 3 | add_subdirectory(HelloPangolin) 4 | add_subdirectory(HelloPangolinThreads) 5 | add_subdirectory(SimpleDisplay) 6 | add_subdirectory(SimpleMultiDisplay) 7 | add_subdirectory(SimpleDisplayImage) 8 | add_subdirectory(SimplePlot) 9 | add_subdirectory(SimpleVideo) 10 | add_subdirectory(SimpleRecord) 11 | 12 | if(NOT EMSCRIPTEN) 13 | add_subdirectory(HelloPangolinOffscreen) 14 | add_subdirectory(SimpleScene) # undefined symbol: glInitNames 15 | endif() 16 | -------------------------------------------------------------------------------- /examples/HelloPangolin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.8 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(HelloPangolin main.cpp) 6 | target_link_libraries(HelloPangolin pango_display pango_python) 7 | -------------------------------------------------------------------------------- /examples/HelloPangolin/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main( int /*argc*/, char** /*argv*/ ) 7 | { 8 | pangolin::CreateWindowAndBind("Main",640,480); 9 | glEnable(GL_DEPTH_TEST); 10 | 11 | // Define Projection and initial ModelView matrix 12 | pangolin::OpenGlRenderState s_cam( 13 | pangolin::ProjectionMatrix(640,480,420,420,320,240,0.2,100), 14 | pangolin::ModelViewLookAt(-2,2,-2, 0,0,0, pangolin::AxisY) 15 | ); 16 | 17 | // Create Interactive View in window 18 | pangolin::Handler3D handler(s_cam); 19 | pangolin::View& d_cam = pangolin::CreateDisplay() 20 | .SetBounds(0.0, 1.0, 0.0, 1.0, -640.0f/480.0f) 21 | .SetHandler(&handler); 22 | 23 | while( !pangolin::ShouldQuit() ) 24 | { 25 | // Clear screen and activate view to render into 26 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 27 | d_cam.Activate(s_cam); 28 | 29 | // Render OpenGL Cube 30 | pangolin::glDrawColouredCube(); 31 | 32 | // Swap frames and Process Events 33 | pangolin::FinishFrame(); 34 | } 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /examples/HelloPangolinOffscreen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.5 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(HelloPangolinOffscreen main.cpp) 6 | target_link_libraries(HelloPangolinOffscreen pango_display) 7 | -------------------------------------------------------------------------------- /examples/HelloPangolinOffscreen/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main( int /*argc*/, char** /*argv*/ ) 7 | { 8 | static const int w = 640; 9 | static const int h = 480; 10 | 11 | pangolin::CreateWindowAndBind("Main",w,h,pangolin::Params({{"scheme", "headless"}})); 12 | glEnable(GL_DEPTH_TEST); 13 | 14 | // Define Projection and initial ModelView matrix 15 | pangolin::OpenGlRenderState s_cam( 16 | pangolin::ProjectionMatrix(w,h,420,420,320,240,0.2,100), 17 | pangolin::ModelViewLookAt(-2,2,-2, 0,0,0, pangolin::AxisY) 18 | ); 19 | 20 | // create a frame buffer object with colour and depth buffer 21 | pangolin::GlTexture color_buffer(w,h); 22 | pangolin::GlRenderBuffer depth_buffer(w,h); 23 | pangolin::GlFramebuffer fbo_buffer(color_buffer, depth_buffer); 24 | 25 | fbo_buffer.Bind(); 26 | { 27 | // Clear screen and activate view to render into 28 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 29 | glViewport(0,0,w,h); 30 | s_cam.Apply(); 31 | 32 | // Render OpenGL Cube 33 | pangolin::glDrawColouredCube(); 34 | 35 | // Swap frames and Process Events 36 | pangolin::FinishFrame(); 37 | } 38 | fbo_buffer.Unbind(); 39 | 40 | // download and save the colour buffer 41 | color_buffer.Save("fbo.png", false); 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /examples/HelloPangolinThreads/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.5 REQUIRED) 3 | find_package(Threads QUIET) 4 | 5 | if(Theads_FOUND) 6 | add_executable(HelloPangolinThreads main.cpp) 7 | target_include_directories(HelloPangolinThreads ${Pangolin_INCLUDE_DIRS}) 8 | target_link_libraries(HelloPangolinThreads pango_display Threads::Threads) 9 | endif() 10 | -------------------------------------------------------------------------------- /examples/PythonExamples/SimpleDisplay.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import sys 3 | 4 | import pypangolin as pango 5 | from OpenGL.GL import * 6 | 7 | 8 | def a_callback(): 9 | print("a pressed") 10 | 11 | 12 | def main(): 13 | win = pango.CreateWindowAndBind("pySimpleDisplay", 640, 480) 14 | glEnable(GL_DEPTH_TEST) 15 | 16 | pm = pango.ProjectionMatrix(640, 480, 420, 420, 320, 240, 0.1, 1000) 17 | mv = pango.ModelViewLookAt(-0, 0.5, -3, 0, 0, 0, pango.AxisY) 18 | s_cam = pango.OpenGlRenderState(pm, mv) 19 | 20 | ui_width = 180 21 | 22 | handler = pango.Handler3D(s_cam) 23 | d_cam = ( 24 | pango.CreateDisplay() 25 | .SetBounds( 26 | pango.Attach(0), 27 | pango.Attach(1), 28 | pango.Attach.Pix(ui_width), 29 | pango.Attach(1), 30 | -640.0 / 480.0, 31 | ) 32 | .SetHandler(handler) 33 | ) 34 | 35 | pango.CreatePanel("ui").SetBounds( 36 | pango.Attach(0), pango.Attach(1), pango.Attach(0), pango.Attach.Pix(ui_width) 37 | ) 38 | var_ui = pango.Var("ui") 39 | var_ui.a_Button = False 40 | var_ui.a_Toggle = (False, pango.VarMeta(toggle=True)) 41 | var_ui.a_double = (0.0, pango.VarMeta(0, 5)) 42 | var_ui.an_int = (2, pango.VarMeta(0, 5)) 43 | var_ui.a_double_log = (3.0, pango.VarMeta(1, 1e4, logscale=True)) 44 | var_ui.a_checkbox = (False, pango.VarMeta(toggle=True)) 45 | var_ui.an_int_no_input = 2 46 | var_ui.a_str = "sss" 47 | 48 | ctrl = -96 49 | pango.RegisterKeyPressCallback(ctrl + ord("a"), a_callback) 50 | 51 | while not pango.ShouldQuit(): 52 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) 53 | 54 | if var_ui.a_checkbox: 55 | var_ui.an_int = var_ui.a_double 56 | 57 | if var_ui.GuiChanged('an_int'): 58 | var_ui.an_int_no_input = var_ui.an_int 59 | 60 | d_cam.Activate(s_cam) 61 | pango.glDrawColouredCube() 62 | pango.FinishFrame() 63 | 64 | 65 | if __name__ == "__main__": 66 | main() 67 | -------------------------------------------------------------------------------- /examples/PythonExamples/SimplePlot.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import sys 3 | sys.path.append('../build/src') 4 | 5 | from OpenGL.GL import * 6 | import pypangolin as pango 7 | import math 8 | 9 | def main(): 10 | win = pango.CreateWindowAndBind("main py_pangolin", 640, 480) 11 | log = pango.DataLog() 12 | log.SetLabels(["sin(t)", "cos(t)", "sin(t)+cos(t)"]) 13 | 14 | t=0; 15 | tinc=0.01 16 | 17 | plotter = pango.Plotter(log,0,4*math.pi/tinc,-2,2,math.pi/(4*tinc),0.5); 18 | plotter.Track("$i") 19 | plotter.AddMarker(pango.Marker.Vertical, -1000, pango.Marker.LessThan, pango.Colour.Blue().WithAlpha(0.2)) 20 | plotter.AddMarker(pango.Marker.Horizontal, 100, pango.Marker.GreaterThan, pango.Colour.Red().WithAlpha(0.2)) 21 | plotter.AddMarker(pango.Marker.Horizontal, 10, pango.Marker.Equal, pango.Colour.Green().WithAlpha(0.2)) 22 | plotter.SetBounds(pango.Attach(0), pango.Attach(1), 23 | pango.Attach(0), pango.Attach(1)) 24 | 25 | pango.DisplayBase().AddDisplay(plotter) 26 | 27 | while not pango.ShouldQuit(): 28 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) 29 | 30 | log.Log(math.sin(t), math.cos(t), math.sin(t)+math.cos(t)) 31 | t+=tinc 32 | 33 | pango.FinishFrame() 34 | 35 | if __name__ == "__main__": 36 | main() 37 | -------------------------------------------------------------------------------- /examples/PythonExamples/SimpleVideo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import sys 3 | import os 4 | import argparse 5 | import numpy as np 6 | import time 7 | import json 8 | 9 | # If this example doesn't work, it's probably because this path is wrong... 10 | sys.path.append('../build/src') 11 | 12 | import pypangolin as pango 13 | 14 | def main(flags): 15 | vid_uri = flags.pango 16 | vout_uri = flags.pangoOut 17 | 18 | vid = pango.VideoInput(vid_uri) 19 | vout = pango.VideoOutput(vout_uri) if vout_uri else None 20 | 21 | device_properties = vid.DeviceProperties() 22 | 23 | # print metadata 24 | print("Opened video uri: '{}' with {} x {} dimensions".format( vid_uri,vid.Width(),vid.Height())) 25 | 26 | # user specified initial frame 27 | vid.Seek(flags.startFrame) 28 | 29 | # show each frame 30 | streamsBitDepth = vid.GetStreamsBitDepth() 31 | 32 | for frame in vid: 33 | if vout: 34 | vout.WriteStreams(frame, streamsBitDepth, vid.FrameProperties(), device_properties); 35 | 36 | # frame is a list of Images! One per stream 37 | # process(frame) 38 | 39 | # printing 40 | sys.stdout.write('\rframe: {} / {}'.format(vid.GetCurrentFrameId(), vid.GetTotalFrames())) 41 | 42 | print('\nDONE') 43 | 44 | if __name__ == "__main__": 45 | # input flags 46 | parser = argparse.ArgumentParser('Read a .pango file frame by frame. Optionally stream to another video output.') 47 | parser.add_argument( 48 | '--pango', type=str, 49 | help='path to the input pango file.') 50 | parser.add_argument( 51 | '--startFrame', type=int, default=0, 52 | help='index of the start frame (inclusive)') 53 | parser.add_argument( 54 | '--pangoOut', type=str, default=None, 55 | help='path to the output pango file.') 56 | 57 | # main function 58 | main(parser.parse_args()) 59 | -------------------------------------------------------------------------------- /examples/SharedMemoryCamera/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(UNIX) 2 | find_package(Pangolin 0.8 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SharedMemoryCamera main.cpp) 6 | target_link_libraries(SharedMemoryCamera pango_display) 7 | endif() 8 | -------------------------------------------------------------------------------- /examples/SharedMemoryCamera/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | // This sample acts as a soft camera. It writes a pattern of GRAY8 pixels to the 11 | // shared memory space. It can be seen in Pangolin's SimpleVideo sample using 12 | // the shmem:[size=640x480]//example video URI. 13 | 14 | using namespace pangolin; 15 | 16 | unsigned char generate_value(double t) 17 | { 18 | // 10s sinusoid 19 | const double d = std::sin(t * 10.0 / M_PI) * 128.0 + 128.0; 20 | return static_cast(d); 21 | } 22 | 23 | int main(/*int argc, char *argv[]*/) 24 | { 25 | std::string shmem_name = "/example"; 26 | 27 | std::shared_ptr shmem_buffer = 28 | create_named_shared_memory_buffer(shmem_name, 640 * 480); 29 | if (!shmem_buffer) { 30 | perror("Unable to create shared memory buffer"); 31 | exit(1); 32 | } 33 | 34 | std::string cond_name = shmem_name + "_cond"; 35 | std::shared_ptr buffer_full = 36 | create_named_condition_variable(cond_name); 37 | 38 | // Sit in a loop and write gray values based on some timing pattern. 39 | while (true) { 40 | shmem_buffer->lock(); 41 | unsigned char *ptr = shmem_buffer->ptr(); 42 | unsigned char value = generate_value(std::chrono::system_clock::now().time_since_epoch().count()); 43 | 44 | for (int i = 0; i < 640*480; ++i) { 45 | ptr[i] = value; 46 | } 47 | 48 | shmem_buffer->unlock(); 49 | buffer_full->signal(); 50 | 51 | std::this_thread::sleep_for(std::chrono::milliseconds(10)); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /examples/SimpleDisplay/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.8 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimpleDisplay main.cpp) 6 | target_link_libraries(SimpleDisplay pango_display pango_python ) 7 | 8 | -------------------------------------------------------------------------------- /examples/SimpleDisplay/app.cfg: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Pangolin Sample configuration file 3 | % Comments start with '%' or '#' 4 | % 5 | % Declarations are name value pairs, 6 | % seperated with '=' and terminated with ';' 7 | 8 | % We can set any variable referenced in code directly 9 | ui.A Double = 3.2; 10 | ui.A Checkbox = false; 11 | 12 | % We can set unreferenced variables too 13 | a.b = 1; 14 | a.c = 2; 15 | z.b = 3; 16 | z.c = 4; 17 | start = z; 18 | 19 | % Which we might refer to by reference 20 | ui.An Int = ${${start}.c}; 21 | 22 | % Declarations can span multiple lines 23 | M = 24 | [1, 0, 0 25 | 0, 1, 0 26 | 0, 0, 1]; 27 | -------------------------------------------------------------------------------- /examples/SimpleDisplayImage/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.8 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimpleDisplayImage main.cpp) 6 | target_link_libraries(SimpleDisplayImage pango_display) 7 | -------------------------------------------------------------------------------- /examples/SimpleMultiDisplay/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.8 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimpleMultiDisplay main.cpp) 6 | target_link_libraries(SimpleMultiDisplay pango_display) 7 | -------------------------------------------------------------------------------- /examples/SimpleMultiDisplay/app.cfg: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Pangolin Sample configuration file 3 | % Comments start with '%' or '#' 4 | % 5 | % Declarations are name value pairs, 6 | % seperated with '=' and terminated with ';' 7 | 8 | % We can set any variable referenced in code directly 9 | ui.A Double = 3.2; 10 | 11 | % We can set unreferenced variables too 12 | a.b = 1; 13 | a.c = 2; 14 | z.b = 3; 15 | z.c = 4; 16 | start = z; 17 | 18 | % Which we might refer to by reference 19 | ui.An Int = ${${start}.c}; 20 | 21 | % Declarations can span multiple lines 22 | M = 23 | [1, 0, 0 24 | 0, 1, 0 25 | 0, 0, 1]; 26 | 27 | ui.Aliased Double = @ui.A Double; 28 | ui.Aliased Double = 2.0; 29 | -------------------------------------------------------------------------------- /examples/SimplePlot/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.8 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimplePlot main.cpp) 6 | target_link_libraries(SimplePlot pango_display pango_plot) 7 | -------------------------------------------------------------------------------- /examples/SimplePlot/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(/*int argc, char* argv[]*/) 5 | { 6 | // Create OpenGL window in single line 7 | pangolin::CreateWindowAndBind("Main",640,480); 8 | 9 | // Data logger object 10 | pangolin::DataLog log; 11 | 12 | // Optionally add named labels 13 | std::vector labels; 14 | labels.push_back(std::string("sin(t)")); 15 | labels.push_back(std::string("cos(t)")); 16 | labels.push_back(std::string("sin(t)+cos(t)")); 17 | log.SetLabels(labels); 18 | 19 | const float tinc = 0.01f; 20 | 21 | // OpenGL 'view' of data. We might have many views of the same data. 22 | pangolin::Plotter plotter(&log,0.0f,4.0f*(float)M_PI/tinc,-2.0f,2.0f,(float)M_PI/(4.0f*tinc),0.5f); 23 | plotter.SetBounds(0.0, 1.0, 0.0, 1.0); 24 | plotter.Track("$i"); 25 | 26 | // Add some sample annotations to the plot 27 | plotter.AddMarker(pangolin::Marker::Vertical, -1000, pangolin::Marker::LessThan, pangolin::Colour::Blue().WithAlpha(0.2f) ); 28 | plotter.AddMarker(pangolin::Marker::Horizontal, 100, pangolin::Marker::GreaterThan, pangolin::Colour::Red().WithAlpha(0.2f) ); 29 | plotter.AddMarker(pangolin::Marker::Horizontal, 10, pangolin::Marker::Equal, pangolin::Colour::Green().WithAlpha(0.2f) ); 30 | 31 | pangolin::DisplayBase().AddDisplay(plotter); 32 | 33 | float t = 0; 34 | 35 | // Default hooks for exiting (Esc) and fullscreen (tab). 36 | while( !pangolin::ShouldQuit() ) 37 | { 38 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 39 | 40 | log.Log(sin(t),cos(t),sin(t)+cos(t)); 41 | t += tinc; 42 | 43 | // Render graph, Swap frames and Process Events 44 | pangolin::FinishFrame(); 45 | } 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /examples/SimpleRecord/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.8 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimpleRecord main.cpp) 6 | target_link_libraries(SimpleRecord pango_display pango_video) 7 | -------------------------------------------------------------------------------- /examples/SimpleScene/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.8 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimpleScene main.cpp) 6 | target_link_libraries(SimpleScene pango_display pango_scene) 7 | -------------------------------------------------------------------------------- /examples/SimpleScene/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main( int /*argc*/, char** /*argv*/ ) 7 | { 8 | pangolin::CreateWindowAndBind("Main",640,480); 9 | glEnable(GL_DEPTH_TEST); 10 | 11 | // Define Projection and initial ModelView matrix 12 | pangolin::OpenGlRenderState s_cam( 13 | pangolin::ProjectionMatrix(640,480,420,420,320,240,0.2,100), 14 | pangolin::ModelViewLookAt(-2,2,-2, 0,0,0, pangolin::AxisY) 15 | ); 16 | 17 | pangolin::Renderable tree; 18 | for(size_t i=0; i < 10; ++i ) 19 | { 20 | auto axis_i = std::make_shared(); 21 | axis_i->T_pc = pangolin::OpenGlMatrix::Translate(i*2.0, i*0.1, 0.0); 22 | tree.Add(axis_i); 23 | } 24 | 25 | // Create Interactive View in window 26 | pangolin::SceneHandler handler(tree, s_cam); 27 | pangolin::View& d_cam = pangolin::CreateDisplay() 28 | .SetBounds(0.0, 1.0, 0.0, 1.0, -640.0f/480.0f) 29 | .SetHandler(&handler); 30 | 31 | d_cam.SetDrawFunction([&](pangolin::View& view){ 32 | view.Activate(s_cam); 33 | tree.Render(); 34 | }); 35 | 36 | while( !pangolin::ShouldQuit() ) 37 | { 38 | // Clear screen and activate view to render into 39 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 40 | 41 | // Swap frames and Process Events 42 | pangolin::FinishFrame(); 43 | } 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /examples/SimpleVideo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.8 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimpleVideo main.cpp) 6 | target_link_libraries(SimpleVideo pango_display pango_video) 7 | -------------------------------------------------------------------------------- /examples/VBODisplay/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.8 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | link_directories(${Pangolin_LIBRARY_DIRS}) 5 | link_libraries(${Pangolin_LIBRARIES}) 6 | 7 | find_package(CUDA QUIET) 8 | 9 | # This example could be made to work with C++11, but the kernel code must be 10 | # compiled without it. 11 | if(CUDA_FOUND) 12 | cuda_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 13 | 14 | cuda_add_executable( 15 | VBODisplay 16 | main.cpp kernal.cu 17 | ) 18 | 19 | endif() 20 | -------------------------------------------------------------------------------- /examples/VBODisplay/kernal.cu: -------------------------------------------------------------------------------- 1 | // Colour Sine wave Kernal 2 | // Based on kernal_colour in kernelVBO.cpp by Rob Farber 3 | __global__ void kernel(float4* dVertexArray, uchar4 *dColorArray, 4 | unsigned int width, unsigned int height, float time) 5 | { 6 | unsigned int x = blockIdx.x*blockDim.x + threadIdx.x; 7 | unsigned int y = blockIdx.y*blockDim.y + threadIdx.y; 8 | 9 | // Each thread is unique point (u,v) in interval [-1,1],[-1,1] 10 | const float u = 2.0f* (x/(float)width) - 1.0f; 11 | const float v = 2.0f* (y/(float)height) - 1.0f; 12 | const float w = 0.5f * sinf(4.0f*u + time) * cosf(4.0f*v + time); 13 | 14 | // Update vertex array for point 15 | dVertexArray[y*width+x] = make_float4(u, w, v, 1.0f); 16 | 17 | // Update colour array for point 18 | dColorArray[y*width+x].w = 0.0f; 19 | dColorArray[y*width+x].x = 255.0f *0.5f*(1.f+sinf(w+x)); 20 | dColorArray[y*width+x].y = 255.0f *0.5f*(1.f+sinf(x)*cosf(y)); 21 | dColorArray[y*width+x].z = 255.0f *0.5f*(1.f+sinf(w+time/10.0f)); 22 | } 23 | 24 | extern "C" void launch_kernel(float4* dVertexArray, uchar4* dColourArray, 25 | unsigned int width, unsigned int height, float time) 26 | { 27 | dim3 block(8, 8, 1); 28 | dim3 grid(width / block.x, height / block.y, 1); 29 | kernel<<< grid, block>>>(dVertexArray, dColourArray, width, height, time); 30 | } 31 | -------------------------------------------------------------------------------- /package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | pangolin 4 | 0.9.3 5 | Pangolin is a set of lightweight and portable utility libraries for prototyping 3D, numeric or video based programs and algorithms. 6 | Steven Lovegrove 7 | Christian Rauch 8 | Steven Lovegrove 9 | MIT 10 | 11 | cmake 12 | 13 | libglew-dev 14 | libepoxy-dev 15 | python3-dev 16 | eigen 17 | libpng-dev 18 | libturbojpeg 19 | libxkbcommon-dev 20 | opengl 21 | wayland-dev 22 | wayland 23 | 24 | python3-wheel 25 | 26 | catch2 27 | 28 | 29 | cmake 30 | 31 | 32 | -------------------------------------------------------------------------------- /tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(VideoConvert) 2 | add_subdirectory(VideoJson) 3 | add_subdirectory(Plotter) 4 | 5 | if(NOT EMSCRIPTEN) 6 | add_subdirectory(VideoViewer) # undefined symbol: glRotatef 7 | add_subdirectory(ModelViewer) # undefined symbol: glColorPointer 8 | endif() 9 | -------------------------------------------------------------------------------- /tools/ModelViewer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.3 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(ModelViewer main.cpp) 6 | target_link_libraries(ModelViewer ${Pangolin_LIBRARIES}) 7 | -------------------------------------------------------------------------------- /tools/ModelViewer/util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | template 4 | bool is_ready(std::future const& f) 5 | { return f.wait_for(std::chrono::seconds(0)) == std::future_status::ready; } 6 | 7 | inline std::vector ExpandGlobOption(const argagg::option_results& opt) 8 | { 9 | std::vector expanded; 10 | for(const auto& o : opt.all) 11 | { 12 | const std::string r = o.as(); 13 | pangolin::FilesMatchingWildcard(r, expanded); 14 | } 15 | return expanded; 16 | } 17 | 18 | template 19 | inline std::vector TryLoad(const std::vector& in, const F& load_func) 20 | { 21 | std::vector loaded; 22 | for(const Tin& file : in) 23 | { 24 | try { 25 | loaded.emplace_back(load_func(file)); 26 | }catch(const std::exception&) { 27 | } 28 | } 29 | return loaded; 30 | } 31 | -------------------------------------------------------------------------------- /tools/Plotter/application-x-pangoplot.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Pangolin Video File 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tools/VideoConvert/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.8 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(VideoConvert main.cpp) 6 | target_link_libraries(VideoConvert ${Pangolin_LIBRARIES}) 7 | 8 | ####################################################### 9 | ## Install 10 | 11 | install(TARGETS VideoConvert 12 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 13 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 14 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 15 | ) 16 | -------------------------------------------------------------------------------- /tools/VideoJson/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.8 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(VideoJsonPrint main-print.cpp) 6 | target_link_libraries(VideoJsonPrint ${Pangolin_LIBRARIES}) 7 | 8 | add_executable(VideoJsonTransform main-transform.cpp) 9 | target_link_libraries(VideoJsonTransform ${Pangolin_LIBRARIES}) 10 | 11 | ####################################################### 12 | ## Install 13 | 14 | install(TARGETS VideoJsonPrint VideoJsonTransform 15 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 16 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 17 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 18 | ) 19 | -------------------------------------------------------------------------------- /tools/VideoJson/main-print.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main( int argc, char* argv[] ) 8 | { 9 | if( argc == 2) { 10 | const std::string filename = std::string(argv[1]); 11 | pangolin::PacketStreamReader reader(filename); 12 | 13 | // Extract JSON 14 | picojson::value all_properties; 15 | 16 | for(size_t i=0; i < reader.Sources().size(); ++i) { 17 | picojson::value source_props; 18 | 19 | const pangolin::PacketStreamSource& src = reader.Sources()[i]; 20 | source_props["device_properties"] = src.info["device"]; 21 | 22 | // Seek through index, loading frame properties 23 | for(size_t framenum=0; framenum < src.index.size(); ++framenum) { 24 | reader.Seek(src.id, framenum); 25 | pangolin::Packet pkt = reader.NextFrame(); 26 | source_props["frame_properties"].push_back(pkt.meta); 27 | } 28 | 29 | all_properties.push_back(source_props); 30 | } 31 | 32 | std::cout << all_properties.serialize(true) << std::endl; 33 | }else{ 34 | std::cout << "Usage: \n\tPangolinVideoJson filename.pango" << std::endl; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tools/VideoViewer/application-x-pango.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Pangolin Video File 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tools/VideoViewer/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main( int argc, char* argv[] ) 7 | { 8 | const std::string dflt_output_uri = "pango:[unique_filename]//video.pango"; 9 | 10 | argagg::parser argparser = {{ 11 | { "help", {"-h", "--help"}, "shows this help message!", 0}, 12 | { "scheme", {"-s", "--scheme"}, "filters the help message by scheme", 1}, 13 | { "verbose", {"-v","--verbose"}, "verbose level in number, 0=list of schemes(default),1=scheme parameters,2=parameter details", 1} 14 | }}; 15 | 16 | argagg::parser_results args = argparser.parse(argc, argv); 17 | if( args["help"] || args.pos.size() == 0){ 18 | std::cerr << "Usage:\n"; 19 | std::cerr << " VideoViewer [options] VideoInputUri\n\n"; 20 | std::cerr << "Examples:\n"; 21 | std::cerr << " VideoViewer test:[size=160x120,n=1,fmt=RGB24]// Show the 'test' video driver with 160x120 resolution, 1 stream, RGB format.\n"; 22 | std::cerr << " VideoViewer --help -s image Find out how to use the 'image' video driver\n\n"; 23 | std::cerr << "Options:\n"; 24 | std::cerr << argparser << std::endl; 25 | 26 | const std::string scheme_filter = args["scheme"].as(""); 27 | const int v = std::clamp(args["verbose"].as(scheme_filter.empty() ? 0 : 2), 0, 2); 28 | pangolin::VideoHelp(std::cerr, scheme_filter, (pangolin::HelpVerbosity)v ); 29 | return 0; 30 | } 31 | 32 | const std::string input_uri = std::string(args.pos[0]); 33 | const std::string output_uri = (args.pos.size() > 1 ) ? std::string(args.pos[1]) : dflt_output_uri; 34 | try{ 35 | pangolin::RunVideoViewerUI(input_uri, output_uri); 36 | } catch (const pangolin::VideoException& e) { 37 | std::cerr << e.what() << std::endl; 38 | } 39 | 40 | return 0; 41 | } 42 | --------------------------------------------------------------------------------