github recp/cglm v0.8.6
v0.8.6: ivec Api and New Affine Transform and Project Functions

latest releases: v0.9.4, v0.9.3, v0.9.2...
2 years ago

Now we have post transform functions which is similar to existing transform function but with different multiplication order.

New Features

  • #260: new affine transform and project functions 🚀
  • #251: add basic ivec functions ( thanks to @Chris-F5 )

new affine functions:

  • CGLM_INLINE void glm_spin(mat4 m, float angle, vec3 axis): rotates existing transform around itself by with axis. this helps to rotate object around itself without moving manually or providing a pivot for glm_rotate_at() to rotate around itself

Current implementations apply transforms to vector first, but sometimes we may need to apply rotations as last transform, cglm introduces post-transform operations e.g. apply rotation/translate last instead of first to vector.

Post transform function have similar names with existing ones with ed suffix:

  • CGLM_INLINE void glm_translated_to(mat4 m, vec3 v, mat4 dest)
  • CGLM_INLINE void glm_translated(mat4 m, vec3 v)
  • CGLM_INLINE void glm_translated_x(mat4 m, float to)
  • CGLM_INLINE void glm_translated_y(mat4 m, float to)
  • CGLM_INLINE void glm_translated_z(mat4 m, float to)
  • CGLM_INLINE void glm_rotated_x(mat4 m, float angle, mat4 dest)
  • CGLM_INLINE void glm_rotated_y(mat4 m, float angle, mat4 dest)
  • CGLM_INLINE void glm_rotated_z(mat4 m, float angle, mat4 dest)
  • CGLM_INLINE void glm_rotated(mat4 m, float angle, vec3 axis)
  • CGLM_INLINE void glm_rotated_at(mat4 m, vec3 pivot, float angle, vec3 axis)
  • CGLM_INLINE void glm_spinned(mat4 m, float angle, vec3 axis)

new project functions:

  • CGLM_INLINE float glm_project_z(vec3 pos, mat4 m) - map object's z coordinate to window coordinates
  • CGLM_INLINE float glm_project_z_no(vec3 pos, mat4 m)
  • CGLM_INLINE float glm_project_z_zo(vec3 pos, mat4 m)

new ivec functions ( thanks to @Chris-F5 ):

void  glm_ivec2(int * __restrict v, ivec2 dest);
void  glm_ivec2_copy(ivec2 a, ivec2 dest);
void  glm_ivec2_zero(ivec2 v);
void  glm_ivec2_one(ivec2 v);
void  glm_ivec2_add(ivec2 a, ivec2 b, ivec2 dest);
void  glm_ivec2_adds(ivec2 v, int s, ivec2 dest);
void  glm_ivec2_sub(ivec2 a, ivec2 b, ivec2 dest);
void  glm_ivec2_subs(ivec2 v, int s, ivec2 dest);
void  glm_ivec2_mul(ivec2 a, ivec2 b, ivec2 dest);
void  glm_ivec2_scale(ivec2 v, int s, ivec2 dest);
int   glm_ivec2_distance2(ivec2 a, ivec2 b);
float glm_ivec2_distance(ivec2 a, ivec2 b);
void  glm_ivec2_maxv(ivec2 a, ivec2 b, ivec2 dest);
void  glm_ivec2_minv(ivec2 a, ivec2 b, ivec2 dest);
void  glm_ivec2_clamp(ivec2 v, int minVal, int maxVal);

void  glm_ivec3(ivec4 v4, ivec3 dest);
void  glm_ivec3_copy(ivec3 a, ivec3 dest);
void  glm_ivec3_zero(ivec3 v);
void  glm_ivec3_one(ivec3 v);
void  glm_ivec3_add(ivec3 a, ivec3 b, ivec3 dest);
void  glm_ivec3_adds(ivec3 v, int s, ivec3 dest);
void  glm_ivec3_sub(ivec3 a, ivec3 b, ivec3 dest);
void  glm_ivec3_subs(ivec3 v, int s, ivec3 dest);
void  glm_ivec3_mul(ivec3 a, ivec3 b, ivec3 dest);
void  glm_ivec3_scale(ivec3 v, int s, ivec3 dest);
int   glm_ivec3_distance2(ivec3 a, ivec3 b);
float glm_ivec3_distance(ivec3 a, ivec3 b);
void  glm_ivec3_maxv(ivec3 a, ivec3 b, ivec3 dest);
void  glm_ivec3_minv(ivec3 a, ivec3 b, ivec3 dest);
void  glm_ivec3_clamp(ivec3 v, int minVal, int maxVal);

void  glm_ivec4(ivec3 v3, int last, ivec4 dest);
void  glm_ivec4_copy(ivec4 a, ivec4 dest);
void  glm_ivec4_zero(ivec4 v);
void  glm_ivec4_one(ivec4 v);
void  glm_ivec4_add(ivec4 a, ivec4 b, ivec4 dest);
void  glm_ivec4_adds(ivec4 v, int s, ivec4 dest);
void  glm_ivec4_sub(ivec4 a, ivec4 b, ivec4 dest);
void  glm_ivec4_subs(ivec4 v, int s, ivec4 dest);
void  glm_ivec4_mul(ivec4 a, ivec4 b, ivec4 dest);
void  glm_ivec4_scale(ivec4 v, int s, ivec4 dest);
int   glm_ivec4_distance2(ivec4 a, ivec4 b);
float glm_ivec4_distance(ivec4 a, ivec4 b);
void  glm_ivec4_maxv(ivec4 a, ivec4 b, ivec4 dest);
void  glm_ivec4_minv(ivec4 a, ivec4 b, ivec4 dest);
void  glm_ivec4_clamp(ivec4 v, int minVal, int maxVal);

Bugfixes and Improvements:

  • #259: fix: simplified pkgconfig generation ( thanks to @bobvanderlinden )
  • #257: added missing include in io.h which adds GLM_MAX macro ( thanks to @Rokannon )
  • #256: fix typo in comment ( thanks to @ogtn )
  • #254: update README to show that integer types are supported ( thanks to @Chris-F5 )
  • #250: fix pkg-config generation when CMAKE_INSTALL_*DIR is absolute ( thanks to @alexshpilkin )
  • #247: fix grammatical errors in docs index ( thanks to @Chris-F5 )
  • some improvements including build files

Sponsorship: Consider become a sponsor for cglm

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:

https://github.com/sponsors/recp
https://opencollective.com/cglm#backer
https://patreon.com/recp

Don't miss a new cglm release

NewReleases is sending notifications on new releases.