📽 Highly Optimized 2D / 3D Graphics Math (glm) for C
Now there are _no
and _zo
vesions of project / unproject functions. They are placed in include/cglm/clipspace/
and include/cglm/call/clipspace/
folders.
if CGLM_CLIPSPACE_INCLUDE_ALL
is defined then all clipspace headers are icluded in project.h or related main headers, otherwise only related clipspace headers will be included to avoid including unused headers...
glm_pickmatrix()
aka gluPickMatrix()
Supporting cross platform, multiple OS-es and multiple CPUs requires multiple hardwares to test on it which requires extra financial cost. Also sparing time is another big issue while working at somewhere fulltime... Your company can become a sponsor to help:
cglm now supports different clipspace configurations.
Many many thanks to @raedwulf and @michael-g to provide this feature to cglm which was in TODOs long time. There are missing tests for now but tests will or should be added as soon as possible. Also thanks to @hartenfels and @bwhmather fixing build files...
Options
#define CGLM_FORCE_DEPTH_ZERO_TO_ONE
#define CGLM_FORCE_LEFT_HANDED
#define CGLM_CLIPSPACE_INCLUDE_ALL
/* auto created in cglm */
#define CGLM_CONFIG_CLIP_CONTROL
#define CGLM_CLIP_CONTROL_LH_ZO
#define CGLM_CLIP_CONTROL_LH_NO
#define CGLM_CLIP_CONTROL_RH_ZO
#define CGLM_CLIP_CONTROL_RH_NO
New functions
Now there are _no
, _zo
, _lh
, _rh
... vesions of projection and view functions. No need to paste all of them here, they are placed in include/cglm/clipspace/
, include/cglm/struct/clipspace/
and include/cglm/call/clipspace/
folders.
if CGLM_CLIPSPACE_INCLUDE_ALL
is defined then all clipspace headers are icluded in cam.h or related main headers, otherwise only related clipspace headers will be included to avoid including unused headers...
Supporting cross platform, multiple OS-es and multiple CPUs requires multiple hardwares to test on it which requires extra financial cost. Also sparing time is another big issue while working at somewhere fulltime... Your company can become a sponsor to help:
New Features and Improvements
New glmm functions:
glmm_set1(x)
glmm_splat_x(x)
glmm_splat_y(x)
glmm_splat_z(x)
glmm_splat_w(x)
glmm_xor(a, b)
for neonglmm_vhadd(a)
for neonNew Features:
Implement FMA
SIMD operations are optimized with FMA instructions to reduce operations and increasee accuracy. The gennerated CPU instructions are reduced. All matrix and related-vector operations are optimized.
FMA must be enable for these optimizations (with -mfma flag on GCC and Clang, /arch:AVX2 /O1-2 on MSVC)
New glmm functions (SSE + NEON):
glmm_vhadd()
- broadcast-ed haddglmm_fmadd(a, b, c)
- fused multiply addglmm_fnmadd(a, b, c)
- fused negative multiply addglmm_fmsub(a, b, c)
- fused multiply subglmm_fnmsub(a, b, c)
- fused negative multiply subNew glmm functions (AVX):
glmm256_fmadd(a, b, c)
- fused multiply add AVXglmm256_fnmadd(a, b, c)
- fused negative multiply add AVXglmm256_fmsub(a, b, c)
- fused multiply sub AVXglmm256_fnmsub(a, b, c)
- fused negative multiply sub AVXglm_mat4_scale_avx(mat4 m, float s)
- scale matrix with scalar (if AVX enabled)CMake
This requires no building or installation of cglm.
cmake_minimum_required(VERSION 3.8.2)
project(<Your Project Name>)
add_executable(${PROJECT_NAME} src/main.c)
target_link_libraries(${LIBRARY_NAME} PRIVATE
cglm_headers)
add_subdirectory(external/cglm/ EXCLUDE_FROM_ALL)
Bugfixes and Improvements:
glm_aabb_sphere()
) ( thanks to @ILeonor to report this ) - todo: more aabb v sphere intersect optionsNew Features:
This is useful for people who want to use cglm as a meson subproject without polluting the main project's install target.
Bugfixes and Improvements:
This modifies glmm_{load,store}3 functions to make the compiler assume the v pointer is appropriately aligned for the type it is being cast to. Not tested with CGLM_ALL_UNALIGNED, but it probably doesn't matter.
New Features:
Bugfixes and Improvements:
New Features:
Now we have 2D Affine Transform functions. 2D Transform functions are suffixed with 2d, functions that don't have any suffixes are 3D. For instance glm_translate2d()
is 2D and glm_translate()
is 3D.
New Functions:
Translate2D:
glm_translate2d()
glm_translate2d_to()
glm_translate2d_x()
glm_translate2d_y()
glm_translate2d_make()
Scale2D:
glm_scale2d_to()
glm_scale2d_make()
glm_scale2d()
glm_scale2d_uni()
Rotate2D:
glm_rotate2d_make()
glm_rotate2d()
glm_rotate2d_to()
All these functions are documented at https://cglm.readthedocs.io/en/latest/affine2d.html . Rotate functions are rotating around Z axes. SIMD optimizations will be applied in the future releases.
Bugfixes and Improvements:
CGLM_DEFINE_PRINTS
macro for test targets to see printed resultsBuild:
Bugfixes and Improvements:
vec2/vec3/vec4_eq_all
New Features:
FLT_EPSILON
with GLM_FLT_EPSILON
Improvements: