- Vectors (2, 3, 4), Matrices (2, 3, 4), Quaternion
- One single header file library
- C/C++ inline pure functions
- Plain-old-data types, code and data are separated.
- SIMD support: SSE, NEON
- Multi-platforms: Intel, ARM
- C++ operators/functions overloading
- GLSL-like API design (C++ only)
- With some other languages implement (experimental): C#, F#
- GCC and clang: MacOS tested
- Cygwin: Windows 7, 10 Desktop testing
- NDK: Android tested
- MSVisualC++: 2017 Community - Windows 7, 10 Desktop C/C++ tested
C language example:
vec3_t position = vec3(100.0f, 200.0f, 10.0f);
quat_t rotation = quat_euler(0.0f, 0.0f, 0.0f);
vec3_t scale = VEC3_ONE;
mat4_t model = mat4_mul(mat4_mul(mat4_translatev3(position),
mat4_rotateq(rotation)),
mat4_scalev3(scale));
/* Perspective matrix with 45 degree fov */
mat4_t proj = mat4_perspective(radians(45), WIDTH / HEIGHT, 0.0f, 100.0f);
... apply matrix to render ...
C++ language example:
vec3_t position = vec3(100.0f, 200.0f, 10.0f);
quat_t rotation = quat_euler(0.0f, 0.0f, 0.0f);
vec3_t scalation = VEC3_ONE;
mat4_t model = mat4_translatev3(position)
* mat4_rotateq(rotation)
* mat4_scalev3(scalation);
/* OR
mat4_t model = mul(mul(mat4_translatev3(position),
mat4_rotateq(rotation)),
mat4_scalev3(scale));
*/
/* Perspective matrix with 45 degree fov */
mat4_t proj = mat4_perspective(M_PI * 0.25f, WIDTH / HEIGHT, 0.0f, 100.0f);
/** GLSL-like types version */
vec3 position = vec3(100.0f, 200.0f, 10.0f);
quat rotation = quat(0.0f, 0.0f, 0.0f); /* create quat with roll-pitch-yaw */
vec3 scalation = vec3(1.0f);
mat4 model = translate(position)
* rotate(rotation)
* scale(scalation);
/* Perspective matrix with 45 degree fov */
mat4 proj = perspective(M_PI * 0.25f, WIDTH / HEIGHT, 0.0f, 100.0f);
... apply matrix to render ...
- MaiHD's OpenGL examples (https://github.com/maihd/opengl.git)
- MaiHD's tween functions library (https://github.com/maihd/tween.git)
- License: Public domain
- Copyright: MaiHD @ ${HOME}, 2017 - 2018
- Editors: Emacs (used) + VSCode + Visual Studio Community
First, C and C++ are both supported. Second, Data-oriented design. Lastly, design based on GLSL.
Shortly, yes. Long answer, we cannot naming functions with data types' name. The types, are defined separate from default types (name with _t postfix), and has implicit conversion.