cglm

📽 Highly Optimized 2D / 3D Graphics Math (glm) for C

MIT License

Downloads
10
Stars
2.1K
Committers
74

Bot releases are hidden (Show)

cglm - v0.7.3: Print Functions Update

Published by recp over 4 years ago

Bugfixes and Improvements:

  • suppress documentation warnings
  • remove redundant typedef
  • fix print functions to align column correctly

New Features:

Print Functions Improvements

  • While printing, mis-alignment of columns are fixed: larger numbers are printed via %g and others are printed via %f Column withs are calculated before print.

  • Now values are colorful ;)

  • New options with default values:

    #define CGLM_PRINT_PRECISION    5
    #define CGLM_PRINT_MAX_TO_SHORT 1e5
    #define CGLM_PRINT_COLOR        "\033[36m"
    #define CGLM_PRINT_COLOR_RESET  "\033[0m"
  • Inline prints are only enabled in DEBUG mode and if CGLM_DEFINE_PRINTS is defined.
  • You can still call library-print functions e.g. glmc_print...

To make codes unbroken, cglm makes inline print functions to be empty-body (if DEBUG and CGLM_DEFINE_PRINTS are not defined):

CGLM_INLINE void glm_mat4_print(mat4 matrix, FILE *o) { }

compiler must eliminate this empty inline function calls. This also can be disabled by defining CGLM_NO_PRINTS_NOOP macro. 🎉

Define CGLM_PRINT_PRECISION to change print precision, default is increased to 5 from 4 ...

cglm - v0.7.2: CMake Integration and Ray Intersection Update

Published by recp over 4 years ago

Bugfixes and Improvements:

  • fix glms_sphere_transform by using mat4s instead of mat4 (#121) ( thanks to @Zollerboy1 )
  • fix glms_vec2_rotate() by using a dest vec2s instead of taking an axis ( thanks to @Zollerboy1 )
  • fix some documentation mistakes ( thanks to @Uwila )
  • remove redundant forward decelerations
  • use glm_clamp_zo in some places to clamp between 0 and 1
  • make Github recognize header language as C (#127) ( thanks to @Uwila )
  • [README] link contributors' avatars to the correct page ( thanks to @Uwila )
  • and some forgotten big or small fixes maybe :) ( thanks to all )

New Features:

  • ray-triangle intersection ( many thanks to @Uwila )

  • CMake build support ( many thanks to @FMMazur and @realaltffour )
    Now we can build cglm with CMake and can integrate with other CMake projects.

    CMake options:

  option(CGLM_SHARED "Shared build" ON)
  option(CGLM_STATIC "Static build" OFF)
  option(CGLM_USE_C99 "" OFF) # C11 
  option(CGLM_USE_TEST "Enable Tests" OFF) # for make check - make test

there may be some bugs in CMake configurations, it will be improved by time.

feel free to suggest new features, improvements and fix things by creating issues or pull requests.

cglm - v0.7.1: Critical Build Bugfix

Published by recp over 4 years ago

  • build: add missing headers
  • helper to swap two float values
cglm - v0.7.0: vec2 and mat2 update

Published by recp over 4 years ago

New Features:

Bugfixes and Improvements:

  • quat: fix quat_for and quat_forp implementations; These are identical to QuaternionLook / LookRotation in other frameworks/engines...
  • add notes for versor/quaternion type to describe memory layout
  • merge test sources into one C source
  • make plane zero if norm is zero after normalization
  • Add more tests

Since vec2 and mat2 are new features, bugs may occurs. Any feedback or help would be appreciated.

cglm - v0.6.2: Bug-fixes for Windows MSC compiler

Published by recp almost 5 years ago

  • Now tests can be run on Windows too. Just run cglm-test project.
  • Anonymous structs are enabled for MSC >=1900 (Visual Studio 2015+)
  • win: fix glms_quat_imagn if use_struct option is disabled
cglm - v0.6.1: Custom/Built-in Test Suite and Improvements

Published by recp almost 5 years ago

New Features:

  • Custom Built-in Unit Test Suite: Now we have custom test suite which don't require external dependencies. It is very cool and simple to implement
  • Helpers for apple's simd library (#107)
  • mat4: add zero for call

Bugfixes and Improvements:

  • Add more tests
  • Remove build-deps.sh
  • Remove cmocka from submodules and update docs
  • quat: fix glmc_quat_normalize()
  • vec: fix min/max for compiled vec3
  • arm: fix type castings for ARM Neon
  • vec4: fix parameter name for NEON
  • build: remove duplicate entry in makefile
  • Change empty prototypes to (void) ( @hartenfels )
  • Add a vec2s struct type for consistency ( @hartenfels )
  • Don't add default autoconf flags to build ( @hartenfels )
  • [major change] Use gnu11 instead of gnu99 ( @hartenfels )
  • and some other bugfixes and improvements made by @hartenfels
  • Fix spelling error in name of glms_rotate_x ( @jdolan )

Now cglm don't require external dependencies and it has very cool test suite 🎉

cglm - v0.6.0: Struct API and New Features

Published by recp about 5 years ago

New API: Structs ( thanks to @acoto87 ) (https://github.com/recp/cglm/pull/80)

cglm now supports structs. To use struct api, just include cglm/struct.h header. You can also use struct api with array api. Struct api provides type-safety. Currently struct parameters are pass-by-value but in the future it may be pass-by-reference by using pointers (feedbacks are welcome by creating issues).

New Features and Improvements:

  • swizzling api: now cglm supports swizzling
  • Find post-build.sh even when not building in. ( @hartenfels )
  • quat: fix glm_quat_axis axis parameter type
  • win: remove optional DLLMain entry point
  • new name for euler sequence (#94) ( @superbigio )
  • squared distance with SIMD support (#96) ( @superbigio )
  • glm_lerpc(), glm_step(), glm_smoothstep(), glm_smoothinterp() (#98) ( @superbigio )
  • added glm_vec_fill() (#100) ( @superbigio )
  • swapped argument order in glmm_store3() (#102) ( @superbigio )
  • vec: some useful functions (#103) ( @superbigio )
  • quat: fix identity quat in glm_quat_normalize_to (#88) ( @yushli )
  • and some minor changes...

New glmm (SIMD) functions: (thanks to @superbigio )

  • glmm_norm2(v) squared l2 norm
  • glmm_vhmin(v) horizontal min
  • glmm_vhmax(v) horizontal max
  • glmm_norm_one(v) l1 norm
  • glmm_norm_inf(v) infinity norm
cglm - v0.5.4: Bug fixes and Improvements

Published by recp over 5 years ago

Bug fixes and Improvements:

  • improve vec3 alignment ( @haxpor )
  • Add missing header for size_t ( @acoto87 )
  • move common headers to common.h
  • Fix glm_vec4_distance for armv7 and improve for SSE2 ( @haxpor )
  • ci: print test logs after failure
  • fix glm_quat_normalize_to ( @yushli )
  • improve docs
  • fix build scripts
    • fix linking cmocka
    • fix build script if folder names contain spaces
cglm - v0.5.3: memory and improvements

Published by recp over 5 years ago

Improvements:

  • drop glm__memcpy, glm__memset and glm__memzero
    • copy matrix items manually in _ucopy functions
  • update docs

New Functions:

  • float glm_mat3_rmc(vec3 r, mat3 m, vec3 c) multiplies row vector, matrix and column vector and returns scalar.
  • glm_mat3_zero(mat3 mat) , glm_mat4_zero(mat4 mat) make given matrix zero.
cglm - v0.5.2: SIMD Update + New Features

Published by recp over 5 years ago

New Options:

  • CGLM_SSE4_DOT : Enable SSE4 dot product
  • CGLM_SSE3_DOT : Enable SSE3 dot product

New Functions:

  • glm_persp_move_far() extend frustum's far distance
  • void glm_vec4_cubic(float s, vec4 dest) fills vec4 as [s^3, s^2, s, 1.0]
  • float glm_mat4_rmc(vec4 r, mat4 m, vec4 c) multiplies row vector, matrix and column vector and returns scalar. This is good helper to get SMC result easily for curves.
  • float glm_smc(float s, mat4 m, vec4 c) calculates SMC multiplication by using glm_mat4_rmc()and glm_vec4_cubic()
  • float glm_bezier() cubic bezier equation
  • float glm_hermite() cubic hermite equation
  • float glm_decasteljau() solve cubic bezier equation using decasteljau

New glmm (SIMD) functions:

  • glmm_vhadds(v) horizontal add, returns register
  • glmm_hadd(v) horizontal add, returns scalar
  • glmm_vdots(a, b) dot product, single lane contain dot product to convert result to scalar
  • glmm_vdot(a, b) dot product, all lanes contain dot product to use result with other vector operations

Improvements:

  • glmm_ functions are moved to platform specific headers.
  • Now some glmm_ functions supports NEON
  • CGLM_SIMD_x86, CGLM_SIMD_ARM and CGLM_SIMD are defined if it is supported.
cglm - v0.5.1: type[s] update

Published by recp almost 6 years ago

New Features or Improvements:

  • [major change] builtin alignment (8-byte) is removed from vec3 and mat3 types
  • a helper to get normalized cross product (glm_vec3_crossn())
  • helpers to get trace of matrix

Bugfixes:

  • fix comparing two float values in tests
cglm - v0.5.0: vector update

Published by recp almost 6 years ago

New Features or Improvements:

  • [major change]: rename glm_vec_ namespace to glm_vec3_
  • new minadd, and maxadd functions for vectors
  • new negate functions e.g. glm_vec3_negate() , glm_vec4_negate()

Bugfixes:

  • fix versor alignment ( thanks to @sinisterchipmunk )
  • fix glm_vec3_angle() if cosine is out of range, now it does not return NaN and more stable.

DEPRECATED:

  • _flipsign and _inv functions for vectors are deprecated in favor of _negate function.
cglm - v0.4.9: Bug fixes and improvements

Published by recp almost 6 years ago

New Features or Improvements:

  • identiy helper for arrays (matrix/quaternion). This helpers will make each item of array identity matrix/quaternion.
  • define math constants in cglm header ( @hartenfels ). Now cglm does not depends on platform specific math constants

Bugfixes:

  • avx: replace binary constants with hex. Binary constants are GCC extensions ( thanks to @jonathanplatzer )
  • avx: fix glm_mul_avx().
cglm - v0.4.8: Easing functions and bug fixes

Published by recp about 6 years ago

New Features or Improvements:

  • easing functions (experimental)
  • additional utils (see util.h)
    • add MIN and MAX macros
    • new version for clamp: clamp to zero and one
    • percentage
    • glm_eq to compare floats
  • unalignned version for vec4_copy: vec4_ucopy. Use this if you want to copy vector from external source
  • Add macro for automatic alignment of matrices (@jonathanplatzer)

Bugfixes:

  • Fix alignment issue when using AVX (@jonathanplatzer)
cglm - v0.4.7: AABB and Sphere

Published by recp over 6 years ago

New Features or Improvements:

  • add support for spheres
  • aabb and sphere intersect functions
  • add squared distance for vec3; this will improve performance by avoiding calling sqrt function in some places
cglm - v0.4.6: Bugfix and Improvements

Published by recp over 6 years ago

New Features or Improvements:

  • optimize glm_scale_make and glm_translate_make
  • align local variables on stack (because since v0.4.5, alignment is optional)
  • add missing call versions
  • helper for getting center of aabb (wrapper for vec_center)

Bug fixes:

  • fix glm_translate_to

API changes:

  • improve glm_mat4_mulv3 to apply translation too
cglm - v0.4.5: SIMD update

Published by recp over 6 years ago

  • _MSC_VER is used instead of _WIN32 (Yatima1460)
  • header dependencies are fixed
  • New option for alignment; Alignment requirement is now OPTIONAL, check the docs to see options
  • New option for SSE/SSE2 shuffle operations
  • New namespace definition; now glmm_ is used for SIMD api
  • Alignment is disabled for older Visual Studio versions, this will fix alignment error for function params. Alignment is still required for Visual Studio 2017 15.6+ if it is not disabled.
cglm -

Published by recp over 6 years ago

  • fix and improve build scripts
  • fix includes in public headers

Package Manager (Xcode):

  • add Cocoapod spec for iOS and macOS developers.
cglm -

Published by recp over 6 years ago

  • fix build script
cglm - v0.4.2: transforms update

Published by recp over 6 years ago

  • New rotation functions:
    • glm_rotate_at: rotate around point
    • glm_rotate_atm: make rotation around point
    • glm_quat_rotate_at: rotate around point using quaternion
    • glm_quat_rotate_atm: make rotate around point using quaternion
  • New mat4 multiplication function
    • glm_mul_rot: multiply matrix with rotation matrix
    • use this function for glm_rotate and glm_quat_rotate functions
  • Drop scale1, rotate_ndc transform functions
  • updates docs:
    • add clarifications for affine transforms
    • add troubleshooting
  • add some tests for affine transforms and for mat3