Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gasinfinity/rnm

Small, simple C++26 math library for game development.
https://github.com/gasinfinity/rnm

cpp cpp26 graphics-programming math

Last synced: 1 day ago
JSON representation

Small, simple C++26 math library for game development.

Awesome Lists containing this project

README

        

## 📏 Rena::Mathematics (rnm)

Small, simple C++26 math library for game development and such. Use it by adding the headers in your project and including `rnm/rnm.hpp` (or each header individually).

[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)

## 🔍 Usage

```cpp
#include

typedef rnm::vec vec2f; // a.k.a: rnm::vec2
typedef rnm::vec vec3f; // a.k.a: rnm::vec2
typedef rnm::mat mat3f; // a.k.a: rnm::mat3

vec2f xy = {100.f, 20.f};
mat3f translation = rnm::translate(xy);

vec2f translated = (translation * vec3f(xy, 1.f)).xy;

std::print("{:.2f}", translated / 4.f); // Prints: "(50.00, 10.00)"
```

## ❓ FAQ

#### Why don't you use SIMD?

SIMD is overrated for this, you won't get any kind of performance improvement by using it naively. You must think about the data you'll be handling and [put it in optimal ways for SIMD](https://www.reedbeta.com/blog/on-vector-math-libraries/#how-to-simd-and-how-not-to).

## 📜 License

[MIT](https://choosealicense.com/licenses/mit/)

## 📝 TODO

- [ ] Document the entire library.
- [ ] Add support for C++20 modules.