A little library for compactly representing the cells of a polycube and enabling transitions between its facelets.
This is mostly a learning and practice project with the following goals:
- [V] Learn and practice some C++ (17).
- [V] Learn about interfacing between C and C++ and make a C interface, while:
- [V] Using macros to define and use result/option-like structs (as in Rust) on the C side.
- [V] Catching C++ exceptions and exposing error codes and messages on the C side without heap allocation (at the cost of a fixed limit on message sizes).
- [V] Learn and practice a little bit of CMake.
- [?] Use the
doctestC++ library for testing. - [V] Have fun with compact representations (1 or 2 bytes) and bitwise operations.
- [?] Learn about bindings to other languages (Rust, Python, CSharp).
- [?] Use the library in other projects (via bindings) in Godot or Unity for rendering (and "visually" test the library..!)
The entire library could have very well been made in C, but the goal was to learn about C/C++ interfacing as well as some of the things that aren't as nice as we would like in C++. Notably, the use of enum classes add useless complexity - some constant would have done the trick and would have worked well with other parts of the library - but it was an opportunity to practice and implement a small little pattern around them, which could be reused in future projects where it would be more appropriate.
What was not practiced (yet?) in this project:
- Using pointers to "handle" structs in the C interface
- Indeed, the classes are all very small, as their size is just 1 or 2 bytes. So it actually makes more sense to copy them / pass them by value.
- Using pointers or references (except in a few places related to error management), for the same reason as above.
TODO
TODO