{"id":18054530,"url":"https://github.com/vertexwahn/flatlandrt","last_synced_at":"2025-03-17T09:05:49.188Z","repository":{"id":59631107,"uuid":"301144963","full_name":"Vertexwahn/FlatlandRT","owner":"Vertexwahn","description":"FlatlandRT is a 2D ray tracer visualization tool.","archived":false,"fork":false,"pushed_at":"2024-09-12T22:08:01.000Z","size":67948,"stargazers_count":72,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-09-13T11:35:34.398Z","etag":null,"topics":["2d","bazel-examples","computer-graphics","cpp","graphics","ray","ray-tracer","ray-tracing","raycasting","raytracer","raytracing","rendering","visualization"],"latest_commit_sha":null,"homepage":"https://vertexwahn.de/page/open_source/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vertexwahn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-04T14:09:18.000Z","updated_at":"2024-09-12T22:08:05.000Z","dependencies_parsed_at":"2024-09-13T09:45:07.949Z","dependency_job_id":null,"html_url":"https://github.com/Vertexwahn/FlatlandRT","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vertexwahn%2FFlatlandRT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vertexwahn%2FFlatlandRT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vertexwahn%2FFlatlandRT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vertexwahn%2FFlatlandRT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vertexwahn","download_url":"https://codeload.github.com/Vertexwahn/FlatlandRT/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244006260,"owners_count":20382441,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2d","bazel-examples","computer-graphics","cpp","graphics","ray","ray-tracer","ray-tracing","raycasting","raytracer","raytracing","rendering","visualization"],"created_at":"2024-10-31T00:11:36.154Z","updated_at":"2025-03-17T09:05:49.164Z","avatar_url":"https://github.com/Vertexwahn.png","language":"C++","readme":"\u003c!--\nSPDX-FileCopyrightText: Copyright 2022-2023 Julian Amann \u003cdev@vertexwahn.de\u003e\nSPDX-License-Identifier: Apache-2.0\n--\u003e\n\n[![Support Ukraine](https://img.shields.io/badge/Support-Ukraine-FFD500?style=flat\u0026labelColor=005BBB)](https://opensource.fb.com/support-ukraine)\n[![Build Status](https://vertexwahn.visualstudio.com/FlatlandRT/_apis/build/status/Vertexwahn.FlatlandRT?branchName=main)](https://vertexwahn.visualstudio.com/FlatlandRT/_build/latest?definitionId=6\u0026branchName=master)\n\n# FlatlandRT\n\n## Description\n\nFlatlandRT is a 2D ray tracer visualization tool.\nThe following pictures were created using FlatlandRT:\n\nFrom left to right: Refraction, ambient occlusion and reflection:\n\n![Refraction, ambient occlusion and reflection](docs/images/header.svg)\n\nQuadtree intersection of 2D triangle meshes:\n\n![Quadtree](docs/images/quadtree_StopSplitIfAtLeastTwoChildsHaveAsManySubShapesAsParent.svg)\n\nMore examples scenes can be found [here](devertexwahn/flatland/docs/example_scenes.md).\nSee the [user manual](devertexwahn/flatland/docs/user_manual.md) if you want to find out how to use it. \n\n## Quick start\n\nThis project uses [Bazel](https://bazel.build/) as a build system.\nThe current used version is defined in [.bazelversion](devertexwahn/.bazelversion).\n\n**Prerequisites:**\n\nThe following tools should be installed:\n\n* [Git](https://git-scm.com/)\n* [Bazel](https://bazel.build/install)\n* A C++ compiler ([GCC](https://gcc.gnu.org/), [Visual Studio](https://visualstudio.microsoft.com/), [Clang](https://clang.llvm.org/), etc.)\n\n**Checkout, build, and run:**\n\nYou can use Flatland by invoking the following commands:\n\n*All platforms:*\n\n```shell\ngit clone https://github.com/Vertexwahn/FlatlandRT # clone the repository\ncd FlatlandRT # change directory to cloned repository\ncd devertexwahn # switch to the location where the MODULE.bazel file is located\n```\n\n*Render a scene with Windows 10/11 x64 with Visual Studio 2019:*\n\n```shell\nbazel --output_base=C:/bazel_output_base  run --config=vs2019 //flatland/cli:flatland.cli --scene_filename=C:\\scenes\\bunny.flatland.xml\n```\n\n*Render a scene with Windows 10/11 x64 with Visual Studio 2022:*\n\n```shell\nbazel --output_base=C:/bazel_output_base  run --config=vs2022 //flatland/cli:flatland.cli --scene_filename=C:\\scenes\\bunny.flatland.xml\n```\n\nFor more hints on how to use Bazel on Windows have a look at the [Bazel on Windows](https://docs.google.com/document/d/17YIqUdffxpwcKP-0whHM6TFELN8VohTpjiiEIbbRfts/edit?usp=sharing) document.\n\n*Render a scene with Ubuntu 20.04:*\n\n```shell\nbazel run --config=gcc9 //flatland/cli:flatland.cli -- --scene_filename=$(pwd)/flatland/scenes/bunny/bunny.flatland.xml\n```\n\n*Render a scene with Ubuntu 22.04:*\n\n```shell\nbazel run --config=gcc11 //flatland/cli:flatland.cli -- --scene_filename=$(pwd)/flatland/scenes/bunny/bunny.flatland.xml\n```\n\n*Render a scene with macOS 11/12/13:*\n\n```shell\nbazel run --config=macos //flatland/cli:flatland.cli -- --scene_filename=$(pwd)/flatland/scenes/bunny/bunny.flatland.xml\n```\n\n## Building \u0026 Testing\n\n### Building and testing with Linux\n\n#### Command line (bash/zsh)\n\n```shell\n# Run all tests using GCC 9.3\nbazel test --config=gcc9 //...\n# Build all targets uing GCC 9.3\nbazel build --config=gcc9 //... \n# Run all tests using GCC 11\nbazel test --config=gcc11 //...\n# Build all targets uing GCC 11\nbazel build --config=gcc11 //...\n# Run all tests using Clang 14\nbazel test --config=clang14 //...\n# Build all targets uing Clang 14\nbazel build --config=clang14 //...\n```\n\n#### CLion\n\nThere is a Bazel plug-in for CLion.\nIt can be downloaded from [here](https://plugins.jetbrains.com/author/4bb31785-ad06-4671-8e26-266aadc184bd).\n\nYou can use the following `.bazelproject` file:\n\n```yaml\ndirectories:\n  .\n\ntest_sources:\n  flatland/tests\n\nderive_targets_from_directories: true\n\nadditional_languages:\n  python\n\nbuild_flags:\n  --config=gcc11\n```\n\n#### Code coverage\n\nMake sure that lcov is installed.\n\n```shell\nsudo apt install lcov\n```\n\nGo to the directory that contains the `MODULE.bazel` file and execute:\n\n```shell\n./coverage.sh --additional_bazel_config=buchgr_remote_cache\nopen coverage_report/index.html\n```\n\n#### Address Sanitizer\n\nThere is a build config called `asan` that can be used for detecting memory errors.\n\n```shell\nbazel run --config=asan --compilation_mode=opt //flatland/cli:flatland.cli --  $(pwd)/flatland/scenes/sphere.flatland.xml\n```\n\n#### Clang Tidy\n\n```shell\nbazel build --config=clang-tidy //core:object\n```\n\nor\n\n```shell\nbazel build //core:object \\\n  --aspects @bazel_clang_tidy//clang_tidy:clang_tidy.bzl%clang_tidy_aspect \\\n  --output_groups=report\n```\n\n### Building with Windows\n\n#### Command line (Powershell)\n\n```shell\n# Build with Visual Studio C++ Compiler\nbazel build --config=vs2022 //...\n```\n\n#### Using Visual Studio\n\nUse [Lavender](https://github.com/tmandry/lavender) to generate a solution and project files for Visual Studio.\n\n```shell\npython3 G:\\dev\\lavender\\generate.py --config=vs2022  //...\n```\n\nLavender is far from being perfect.\nIt might be necessary to do some modifications to the generated solution and project files.\n\n## Development process\n\nI made a short video where I describe how I use test driven development to implement this project:\n[![Let's Code: Using Test-driven Development to implement a ray tracer](https://img.youtube.com/vi/vFBXNr952nU/0.jpg)](https://www.youtube.com/watch?v=vFBXNr952nU)\n\n## Ray tracing 101\n\nI have written some blog post about ray tracing that can be found here: [Ray Tracing 101](https://book.vertexwahn.de/)\n\n## License\n\nThe source code of FlatlandRT itself is under the Apache License 2.0 (see [LICENSE](LICENSE)).\nThe license of its third-party dependencies or some third-party code fragments can and is under different license terms.\nSee copyright notes in the next section.\n\n## Copyright notes\n\nFlatlandRT makes use of several software libraries.\nSome tools and libraries were copied to this repository (see `third_party` folder).\nThe corresponding licenses can be found in the `third_party` folder of this repository.\nBesides this,\nsome source code was directly copied from other open-source software libraries or programs.\nThis is always clearly stated as a comment in the source code of FlatlandRT.\nIf you find any copyright or license violations or issues please let me know.\n\n### Copied source code/ideas\n\n* Mitsuba Renderer 2 (https://github.com/mitsuba-renderer/mitsuba2) (scene file format) ([License](devertexwahn/flatland/LICENSES/mitsuba2/LICENSE))\n* pbrt, Version 3 (https://github.com/mmp/pbrt-v3) (Refract, face_forward functions) ([License](devertexwahn/flatland/LICENSES/pbrt-v3/LICENSE.txt))\n* pbrt, Version 4 (https://github.com/mmp/pbrt-v4) (concentric sampling of unit disk) ([License](devertexwahn/flatland/LICENSES/pbrt-v4/LICENSE.txt))\n* bazel_clang_tidy (https://github.com/erenon/bazel_clang_tidy) (almost everything) ([License](devertexwahn/flatland/LICENSES/bazel_clang_tidy/LICENSE))\n\n### Build related\n\n* LLVM toolchain for Bazel (https://github.com/grailbio/bazel-toolchain) (building Flatland with LLVM) ([License](licenses/llvm_bazel_toolchain/LICENSE))\n\n### Third-party dependencies\n\n* Boost (https://www.boost.org/) (third party dependency) ([License](devertexwahn/flatland/LICENSES/boost/LICENSE))\n* Catch2 (https://github.com/catchorg/Catch2) (see `third_party` folder)\n* Eigen (see `third_party` folder)\n* Google Test (https://github.com/google/googletest) (see `third_party` folder)\n* Imath (see `third_party` folder)\n* LLVM toolchain for Bazel (see `third_party` folder)\n* [OpenEXR](/third_party/openexr) (https://github.com/AcademySoftwareFoundation/openexr) ([License](/third_party/openexr/LICENSE.md))\n* [libpng](/third_party/libpng-1.6.40) (http://www.libpng.org/pub/png/libpng.html) ([License](/third_party/libpng-1.6.40/LICENSE))\n* [pcg-cpp](/third_party/pcg-cpp) (https://github.com/imneme/pcg-cpp/)\n* [pugixml](/third_party/pugixml-1.13) (https://pugixml.org/, https://github.com/zeux/pugixml)\n* [rules_boost](/third_party/rules_boost) (https://github.com/nelhage/rules_boost) ([License](/third_party/rules_boost/LICENSE))\n* [rules_pkg-0.9.1](/third_party/rules_pkg)\n* abseil (https://abseil.io/) (see `third_party` folder)\n* gflags (https://github.com/gflags/gflags/) (see `third_party` folder)\n* glog (https://github.com/google/glog) (see `third_party` folder)\n* hypothesis (https://github.com/wjakob/hypothesis) (see `third_party` folder)\n* yaml-cpp (https://github.com/jbeder/yaml-cpp) (third party dependency) ([License](devertexwahn/flatland/LICENSES/yaml-cpp/LICENSE))\n* zlib (https://zlib.net/) ([License](devertexwahn/flatland/LICENSES/third_party/zlib-1.2.11/README))\n* {fmt} (https://github.com/fmtlib/fmt) (see `third_party` folder)\n\n### Artwork\n\nThe Stanford Bunny was derived from the Stanford Bunny provided from the Stanford 3D Scanning Repository (see [here](http://graphics.stanford.edu/data/3Dscanrep/#bunny)).\n\nThe data for the Donut, Armadillo, and Stanford Bunny for the 2D triangle data was derived from https://github.com/mmacklin/sandbox.\n\n### Credits\n\nA big thank goes to all the providers, developers, and maintainers of the aforementioned open-source projects and artifacts.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvertexwahn%2Fflatlandrt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvertexwahn%2Fflatlandrt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvertexwahn%2Fflatlandrt/lists"}