{"id":15137004,"url":"https://github.com/jjbel/samarium","last_synced_at":"2025-10-23T11:32:06.109Z","repository":{"id":41186495,"uuid":"413511390","full_name":"jjbel/samarium","owner":"jjbel","description":"2-D physics simulation and rendering engine written in modern C++.","archived":false,"fork":false,"pushed_at":"2024-10-08T14:51:27.000Z","size":2424,"stargazers_count":8,"open_issues_count":10,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-10T19:23:20.565Z","etag":null,"topics":["cmake","conan","cpp","modern-cpp","physics-simulation"],"latest_commit_sha":null,"homepage":"https://jjbel.github.io/samarium/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jjbel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","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":"2021-10-04T16:59:29.000Z","updated_at":"2024-10-08T14:51:59.000Z","dependencies_parsed_at":"2024-10-26T00:53:02.402Z","dependency_job_id":"709656ec-bd16-47e1-ae4d-03be48416987","html_url":"https://github.com/jjbel/samarium","commit_stats":{"total_commits":1299,"total_committers":1,"mean_commits":1299.0,"dds":0.0,"last_synced_commit":"6692209c26f9be29073e9dade10fd5546a4af8ba"},"previous_names":["jjbel/samarium"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjbel%2Fsamarium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjbel%2Fsamarium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjbel%2Fsamarium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjbel%2Fsamarium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jjbel","download_url":"https://codeload.github.com/jjbel/samarium/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237821728,"owners_count":19371816,"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":["cmake","conan","cpp","modern-cpp","physics-simulation"],"created_at":"2024-09-26T06:42:39.691Z","updated_at":"2025-10-23T11:32:05.669Z","avatar_url":"https://github.com/jjbel.png","language":"C++","readme":"## See installation instructions below\n\n\u003c!-- TODO make a script to merge these into 2x2 grid, loop them --\u003e\n\n$10^4$ particles interacting gravitationally in realtime, using a [hashgrid](https://github.com/jjbel/samarium/blob/main/src/samarium/util/HashGrid.hpp):\n\n[](https://github.com/user-attachments/assets/b461e8b8-eac3-4cb0-b3aa-b91b147f4b81)\n\n$10^5$ particles moving in a velocity field of [perlin noise](https://github.com/jjbel/samarium/blob/main/src/samarium/util/noise.hpp):\n\n[](https://github.com/user-attachments/assets/f8f23bc0-c454-481b-b536-9e6e7abb8bd9)\n\nSoftbody, interact with a mouse:\n\n[](https://user-images.githubusercontent.com/83468982/178473002-b7f896f6-d5ed-4cc5-be34-bcccab9ef11e.mp4)\n\nAn ideal gas's velocity distribution approaching the Maxwell-Boltzmann Distribution:\n\n[](https://github.com/user-attachments/assets/1bd3aa90-80b7-486c-94df-1e03d7e276c9)\n\n### Graphics:\n\nAnimating levels of the Hilbert Curve:\n\n[](https://user-images.githubusercontent.com/83468982/178472984-8cd83808-bfb2-478b-8a5e-3d45782f2c7d.mp4)\n\nAnimating levels of the Fourier transform of a shape:\n\n[](https://github.com/user-attachments/assets/d870c975-44d4-4624-b122-48129506bbf6)\n\n# Samarium\n\n\u003c!--\n[![GCC](https://github.com/jjbel/samarium/actions/workflows/gcc.yml/badge.svg)](https://github.com/jjbel/samarium/actions/workflows/gcc.yml)\n[![Clang](https://github.com/jjbel/samarium/actions/workflows/clang.yml/badge.svg)](https://github.com/jjbel/samarium/actions/workflows/clang.yml)\n[![MSVC](https://github.com/jjbel/samarium/actions/workflows/msvc.yml/badge.svg)](https://github.com/jjbel/samarium/actions/workflows/msvc.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=jjbel_samarium\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=jjbel_samarium) --\u003e\n\n\u003c!-- [![MIT License](https://img.shields.io/badge/license-MIT-yellow)](https://github.com/jjbel/samarium/blob/main/LICENSE.md) --\u003e\n\n\u003c!--\n![language: C++20](https://img.shields.io/badge/language-C%2B%2B20-yellow)\n[![Latest Github Release](https://img.shields.io/github/v/tag/jjbel/samarium?label=latest%20release)](https://github.com/jjbel/samarium/tags) --\u003e\n\nSamarium is a 2d physics simulation and rendering library written in C++20, with a focus on high performance using GPU acceleration (CUDA and compute shaders), and by using the CPU and memory better (multithreading, data-oriented-design).\n\nI am actively working on adding 3D support and more simulation domains: chemical reactions, phase change, cloth etc.\n\n\u003c!-- Rendering is done directly with OpenGL. --\u003e\n\u003c!-- Offload more work to the GPU --\u003e\n\u003c!-- SIMD for increasing, CPU performance --\u003e\n\n\u003c!-- ## Contents --\u003e\n\n\u003c!-- TODO use vscode markdown auto TOC --\u003e\n\n\u003c!-- - [Examples](#examples) --\u003e\n\u003c!-- - [Quickstart](#quickstart) --\u003e\n\u003c!-- - [Prerequistes](#prerequistes)\n- [Installation](#installation)\n- [Example](#example)\n- [Tools](#tools)\n- [Documentation](#documentation)\n- [License](#license) --\u003e\n\n## Quickstart\n\n```sh\ngit clone --depth 1 https://github.com/jjbel/samarium.git\npython samarium/bootstrap.py\n```\n\n\u003c!-- TODO make sure bootstrap works --\u003e\n\u003c!-- TODO make it easy to run examples, easier than copy pasting the code into a source file? --\u003e\n\n## Installation\n\n\u003c!-- | Dependency | URL                                 | Documentation               |\n| ---------- | ----------------------------------- | --------------------------- |\n| python     | \u003chttps://www.python.org/downloads/\u003e |                             |\n| git        | \u003chttps://git-scm.com/downloads/\u003e    | \u003chttps://git-scm.com/docs/\u003e | --\u003e\n\n\u003c!-- | cmake      | \u003chttps://cmake.org/download/\u003e       | \u003chttps://cmake.org/cmake/help/latest/\u003e | --\u003e\n\u003c!-- | conan      | \u003chttps://conan.io/downloads.html/\u003e | \u003chttps://docs.conan.io/en/latest/\u003e | --\u003e\n\nInstall [python](https://www.python.org/downloads/) and [git](https://git-scm.com/docs/).\n\nA compiler supporting C++20 is required, namely [Visual C++ 2019 on Windows](https://visualstudio.microsoft.com/downloads/), or GCC-11/Clang-13 on Linux.\n\nTo install, do the following, or **just run `python samarium/boostrap.py`**\n\n1. Install [CMake](https://cmake.org/download/) and [Conan](https://conan.io/downloads.html/)\n2. Download [the zip](https://github.com/jjbel/samarium/archive/refs/heads/main.zip) or clone the repo:\n\n```sh\ngit clone https://github.com/jjbel/samarium.git\n```\n\n3. build the library for your machine:\n\n```sh\nconan create ./samarium/ -b missing\n```\n\n\u003c!-- ## Installation\n\nTo install the library locally:\n\n```\nconan download samarium/1.1.0@\n```\n\nor for the latest version\n\n```sh\ngit clone --depth 1 https://github.com/jjbel/samarium.git\nconan create ./samarium/ -b missing\n``` --\u003e\n\n\u003c!-- ## Example --\u003e\n\nFor a fully-featured and self-contained example, run:\n\n\u003c!-- is depth 1 rly faster? --\u003e\n\n```sh\ngit clone --depth 1 https://github.com/jjbel/samarium_example.git .\ncmake --preset default\ncmake --build --preset default\n```\n\n### Now try the `examples/` directory!\n\n## Documentation\n\nView the docs at [Github Pages: https://jjbel.github.io/samarium/](https://jjbel.github.io/samarium/)\n\n## License\n\nSamarium is distributed under the [MIT License](LICENSE.md).\n\n## Libraries Used\n\nMany thanks to the following wonderful libraries:\n\n1. [GLFW](https://www.glfw.org/), [glad](https://github.com/Dav1dde/glad) and [glm](https://github.com/g-truc/glm) for OpenGL support\n2. [fmtlib](https://github.com/fmtlib/fmt) to completely replace `iostream`\n3. [range-v3](https://github.com/ericniebler/range-v3)\n4. [BS::thread_pool](https://github.com/bshoshany/thread-pool)\n5. [PCG RNG](https://www.pcg-random.org/) for simple and fast randomness\n6. [tl::function_ref](https://github.com/TartanLlama/function_ref) and [tl::expected](https://github.com/TartanLlama/expected)\n7. [znone/call_thunk](https://github.com/znone/call_thunk) for using with GLFW's C callback\n8. [itlib-static-vector](https://github.com/iboB/itlib)\n9. [unordered-dense](https://github.com/martinus/unordered_dense) for faster `unordered_map`\n10. [stb](https://github.com/nothings/stb) for image reading and writing\n11. [FreeType](http://freetype.org/) for text rendering\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjbel%2Fsamarium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjjbel%2Fsamarium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjbel%2Fsamarium/lists"}